Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Funzione controllo del numero
function numberIsNumber(userInput) { var userInputNumber = parseInt(userInput) if (Number.isNaN(userInputNumber) && !userInput) { return false } return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function presionarNumero(numero){\n console.log(\"numero\",numero)\n\n calculadora.agregarNumero(numero)\n actualizarDisplay()\n}", "function getNumero(numero) {\n if (numero === void 0) { numero = 12; }\n return 'el numero es ' + numero;\n}", "function numero(xx) { //recoge el n&uacute;mero pulsado en el argumento.\r\n if (x==\"0\" || xi==1 ) { // inicializar un n&uacute;mero, \r\n pantalla.innerHTML=xx; //mostrar en pantalla\r\n x=xx; //guardar n&uacute;mero\r\n if (xx==\".\") { //si escribimos una coma al principio del n&uacute;mero\r\n pantalla.innerHTML=\"0.\"; //escribimos 0.\r\n x=xx; //guardar n&uacute;mero\r\n coma=1; //cambiar estado de la coma\r\n }\r\n }\r\n else { //continuar escribiendo un n&uacute;mero\r\n if (xx==\".\" && coma==0) { //si escribimos una coma decimal pòr primera vez\r\n pantalla.innerHTML+=xx;\r\n x+=xx;\r\n coma=1; //cambiar el estado de la coma \r\n }\r\n //si intentamos escribir una segunda coma decimal no realiza ninguna acci&oacute;n.\r\n else if (xx==\".\" && coma==1) {} \r\n //Resto de casos: escribir un n&uacute;mero del 0 al 9: \r\n else {\r\n pantalla.innerHTML+=xx;\r\n x+=xx\r\n }\r\n }\r\n xi=0 //el n&uacute;mero est&aacute; iniciado y podemos ampliarlo.\r\n }", "function getNum1() {\n return 4;\n}", "function agregarNumero(num){\n opActual = opActual + num; \n actualizarDisplay();\n}", "function arretNumber() {\n if (this.enCours) {\n this.sonMatricule.stop();\n this.sonAmbiance.fade(0.8 , 1) //Volume son ambiance\n this.sonAmbiance.loop();\n numPrecedent = 10;\n this.enCours = false;\n clearInterval(this.changeNumber);\n // On se bloque sur un matricule connu\n selectMatricule = (this.recupererMatriculeAlea()).toString();\n ordre = (tabMatricule.indexOf(selectMatricule))+1;\n afficherMatricule(selectMatricule);\n }\n}", "function numero(key){\n\tif(respuesta == key){\n\n\t\tmostrarMensaje(\"../../imagen/icon/exito.png\",\"matematica/felicitaciones.webm\",\"../../audio/efecto_sonido/felicitaciones.ogg\");\n\n\t\tfin = getActual();\t\n\n\t\tanotarDesempeno();\n\n\t\tsetTimeout(function(){\n\t\t\tcargarActividad();\n\t\t\t$(\"#campoRespuesta\").val(\"\");\n\t\t}, 3000);\n\n\t\t$(\"#intentoCont\").val(0);\t\t\t\n\t}\n\telse{\n\t\tmostrarMensaje(\"../../imagen/icon/fracaso1.png\",\"matematica/error_repetir.webm\",\"../../audio/efecto_sonido/error_repetir.ogg\");\n\n\t\t$(\"#intentoCont\").val( parseInt($(\"#intentoCont\").val()) + 1 );\n\t}\n}", "function amelioration(){\n return nbMultiplicateurAmelioAutoclick +9;\n}", "function aumenta(str,n){\n //prendo l'elemento e un numero (1 o -1)\n var x = document.getElementById(str);\n //se il n==1 allora devo incrementare il valore dell'elemento \n if(n==1){\n x.value++;\n }\n //se n==-1 devo decrementare il valore dell'elemento\n if(n==-1){\n x.value--;\n }\n //controllo che il valore non sia <0, se diventa minore di 0 allora lo pongo a zero\n if(x.value<0) x.value=0;\n //siccome ho cambiato il valore richiamo la funzione conta per aggiornare i valori \n conta();\n}", "function numeros(caracter) {\n lugarDeColocacion = input.value.length + ultimoIndice; \n input.value = insertarCaracter(lugarDeColocacion,input.value,caracter);\n}", "function ponerNumero(numero){\r\n if(num2 == 0 && num2 !== '0.')\r\n num2 = numero;\r\n else\r\n num2+= numero;\r\n actualizarValor2();\r\n}", "function numeroPulsado(numero) {//controlar varios puntos\n //lineaInputText1 += numero;//cambiar lineaInputText por ta1.value\n return numero;\n}", "function numerico(campo)\n\t{\n\tvar charpos = campo.value.search(\"[^0-9]\");\n if (campo.value.length > 0 && charpos >= 0)\n\t\t{\n\t\tcampo.value = campo.value.slice(0, -1);\n\t\tcampo.focus();\n\t return false;\n\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\treturn true;\n\t\t\t\t}\n\t}", "function presionarNumero(valor) {\n var result = obtenerResultado();\n if (result == \"01010010\") {\n mostrarResultado(\"Rolling (<>)\");\n } else {\n mostrarResultado(result + valor);\n }\n}", "function dobro(numero) {\n return numero * 2;\n}", "fNumero (numero){\n //Borra display si antes hemos pulsado una operacion\n if (this.operacionPulsada) { \n display.value = numero;\n this.operacionPulsada = false; //controla \"apaga la ultima operacion\"\n\n }else{ //si no hay pulsada una operacion...\n if (display.value === \"0\" && numero === \".\") //Para admitir valores de (0.0 a 0.9)\n display.value += numero;\n else if(display.value === \"0\")//si display es igual a cero asigna directamente el valor\n display.value = numero;\n else if(display.value === \"0.\"){\n if (numero === \".\");\n else display.value += numero;}\n else \n display.value += numero; //si display es distinto de 0 (ya hay un numero) \n } \n }", "function funcion() {\n return numeracion;\n}", "function generateNumCommande() {\n var random = Math.floor(100000000 + Math.random() * 900000000);\n num_commande = 'NH'+random\n }", "transformar(numero) {\n switch (numero) {\n case 0:\n return 'celeste'\n case 1:\n return 'violeta'\n case 2:\n return 'naranja'\n case 3:\n return 'verde'\n }\n }", "transformarNumeroAColor(numero) {\n switch (numero) {\n case 0:\n return 'celeste'; \n case 1:\n return 'rojo';\n case 2:\n return 'naranja'; \n case 3:\n return 'verde'; \n }\n }", "function entero(numero){\n return parseInt(numero);\n}", "function nume(num) {\r\n if (typeof gvisor == 'undefined') {\r\n document.calcula.tela.value=\"\";\r\n }\r\n document.calcula.tela.value = document.calcula.tela.value + num;\r\n gvisor = 1;\r\n}", "function determinaNumero( numero ){\n if( (numero % 2) == 1 ){\n console.log(\" El numero es impar \"+numero);\n }\n else if((numero%2) == 0){\n console.log(\"El numero es par \"+numero);\n }\n\n}", "function numberLine(data){\n\tline = data.nb;\n\tdocument.getElementById(\"NombreTournage\").innerHTML=line;\n}", "function agregarNumero(num) {\n // llevandolo a texto para concatenar (para unir), recordar que la pantalla es in input text\n opeActual = opeActual.toString() + num.toString();\n actualizarPantalla();\n\n}", "function numero1(num){\n \n if(document.getElementById(\"Ctexto\").value==\"\" && op==false ){\n\t\tdocument.getElementById(\"Ctexto\").value=num;\n\t\top=true;\n\t\tcont++;\n\t\tdocument.getElementById(\"dados1\").style.visibility =\"hidden\";\n\t\t\n\t}else if(op==false){\n\t\t//$('#dados1,#dados2,#dados3,#dados4,#dados5').click(function (){$(this).hide()});\n\t\tdocument.getElementById(\"Ctexto\").value+=num;\n\t\top=true;\n\t\tcont++;\n\t\tdocument.getElementById(\"dados1\").style.visibility =\"hidden\";\n\t}\n\n}", "function generarAleatorio(valor)\r\n{\r\n return numIdentificacion = Math.floor(Math.random() * ((valor+1) - 0) + 0); \r\n}", "function pOdValidator(num) {\n if (num % 2 === 0) {\n return \" è un numero pari, quindi hanno vinto i pari!\";\n } else {\n return \" è un numero dispari, quindi hanno vinto i dispari!\";\n }\n }", "function generaNumeroCasuale (){\n return numero = Math.floor(Math.random()*100);\n}", "function chequearSoloNumeros(field) {\n if (/^([0-9])*$/.test(field.value)) {\n setValido(field);\n return true;\n } else {\n setInvalido(field, `${field.name} solo debe contener números`);\n return false;\n }\n }", "function num(numero){\n document.calculadora.visor.value += numero;\n}", "function creacionCombinacion(numero_elegido, posicion_elegida){\n var id_combinacion = 'combinacion-' + posicion_elegida;\n var posicion_actual = document.getElementById(id_combinacion);\n if(numero_elegido <= 9){\n posicion_actual.innerText = '0' + numero_elegido;\n } else {\n posicion_actual.innerText = numero_elegido;\n }\n}", "function Telefono(num, marca, color) {\n\tthis.marca = marca;\n\tthis.color = color;\n\tthis.num = num;\n\tthis.numLlamadas = 0;\n\tthis.marcar = function(){\n\tconsole.log(\"llamada realizada\");\n\tthis.numLlamadas++;\n\treturn this.numLlamadas;\n\t};\n}", "function prendidati(){\n let num=document.getElementById('input').getElementsByClassName(\"numero\");\n let ci_sono=[];\n let contatore=0;\n for(let i=0;i<num.length;i++){\n if(!(ci_sono.includes(parseInt(num[i].value)))){\n if(numeri.includes(parseInt(num[i].value))){\n contatore++;\n ci_sono.push(parseInt(num[i].value));\n }\n }\n }\n if(contatore>=3){\n document.getElementById(\"message\").innerHTML=\"<h1>bravo <br>hai indovinato <br>\"+contatore+\"<br>\"+ci_sono+\" </h1>\";\n }else{\n document.getElementById(\"message\").innerHTML=\"<h1>o no hai <br>indovinato solo<br>\"+contatore+\"<br>\"+ci_sono+\" </h1>\";\n }\n document.getElementById(\"input\").classList+= \" d-none\";\n}", "tratarDigito() {\n let numero = \"\";\n\n numero = numero.concat(this.caracter);\n this.lerCaracter();\n\n while (/[0-9]/g.test(this.caracter) === true) {\n numero = numero.concat(this.caracter);\n this.lerCaracter();\n }\n this.token.lexema = +numero\n this.token.simbolo = \"snumero\"\n this.token.linha = this.numLinha\n }", "pallini(i){\r\n // L'indice dell'immagine deve essere uguale al parametro che gli ho passato \r\n this.indice_immagine = i;\r\n console.log(i);\r\n }", "function clasificacion(numero) {\n let salida = \"hola\";\n switch (numero) {\n case \"0\":\n salida = \" Personal \"\n break;\n case \"1\":\n salida = \" Hipotecario \"\n break;\n case \"2\":\n salida = \" Prendario \"\n break;\n\n }\n return (salida);\n}", "function oNumero(numero) {\n\t//Propiedades\n\tthis.valor = numero || 0\n\tthis.dec = -1;\n\t// Metodos\n\tthis.formato = numFormat;\n\tthis.ponValor = ponValor;\n\t// Definicion de los metodos\n\tfunction ponValor(cad) {\n\t\tif (cad == '-' || cad == '+')\n\t\t\treturn\n\n\t\tif (cad.length == 0)\n\t\t\treturn\n\n\t\tif (cad.indexOf('.') >= 0)\n\t\t\tthis.valor = parseFloat(cad);\n\t\telse\n\t\t\tthis.valor = parseInt(cad);\n\t}\n\tfunction numFormat(dec, miles) {\n\t\tvar num = this.valor, signo = 3, expr;\n\t\tvar cad = \"\" + this.valor;\n\t\tvar ceros = \"\", pos, pdec, i;\n\t\tfor (i = 0; i < dec; i++)\n\t\t\tceros += '0';\n\t\tpos = cad.indexOf('.');\n\t\tif (pos < 0) {\n\t\t\tif (ceros != \"\") {\n\t\t\t\tcad = cad + \".\" + ceros;\n\t\t\t}\n\t\t} else {\n\t\t\tpdec = cad.length - pos - 1;\n\t\t\tif (pdec <= dec) {\n\t\t\t\tfor (i = 0; i < (dec - pdec); i++)\n\t\t\t\t\tcad += '0';\n\t\t\t} else {\n\t\t\t\tnum = num * Math.pow(10, dec);\n\t\t\t\tnum = Math.round(num);\n\t\t\t\tnum = num / Math.pow(10, dec);\n\t\t\t\tcad = new String(num);\n\t\t\t}\n\t\t}\n\t\tpos = cad.indexOf('.');\n\t\tif (pos < 0)\n\t\t\tpos = cad.lentgh;\n\n\t\tif (cad.substr(0, 1) == '-' || cad.substr(0, 1) == '+')\n\t\t\tsigno = 4;\n\n\t\tif (miles && pos > signo)\n\t\t\tdo {\n\t\t\t\texpr = /([+-]?\\d)(\\d{3}[\\.\\,]\\d*)/;\n\t\t\t\tcad.match(expr);\n\t\t\t\tcad = cad.replace(expr, RegExp.$1 + '' + RegExp.$2);\n\t\t\t} while (cad.indexOf(',') > signo);\n\n\t\tif (dec < 0)\n\t\t\tcad = cad.replace(/\\./, '');\n\n\t\treturn cad;\n\t}\n}", "function mostrar(num){\r\n\t\tif(resultado.textContent.length < 8){\r\n\t\t\tif(resultado.innerHTML ==\"0\"){\r\n\t\t\t\tresultado.textContent = num;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tresultado.textContent = \"0\";\r\n\t\t}\r\n\t}", "function elevar_al_cuadrado(numero)\n{\n return numero * numero;\n}", "function PonerCero(i){\r\n\t\tif(i<10){\r\n\t\t\ti=\"0\"+i;\r\n\t\t}\r\n\t\treturn i;\r\n\t}", "function agregarCeros(tiempo){\n if(tiempo < 10){\n tiempo = \"0\"+tiempo\n }\n return tiempo\n}", "function multiplos(numero) {\n let resultado = \"\";\n\n if (numero % 3 === 0 && numero % 5 === 0) {\n resultado = \"Buzzlightyear\";\n } else if (numero % 3 === 0) {\n resultado = \"buzz\";\n } else if (numero % 5 === 0) {\n resultado = \"Lightyear\";\n } else {\n return numero;\n }\n\n return resultado;\n\n}", "function soma(nnumero){\r\n let cont = 0;\r\n for (let num of numeros){\r\n cont = cont +num\r\n }\r\n return soma \r\n }", "function generaNumero(){\n let numero = Math.floor(Math.random() * 4 ) + 1;\n return numero;\n}", "static identityNumber(form, field, settings) {\n let id = form[field];\n id = String(id).trim();\n if(settings.required && id.length > 0){\n if (id.length > 9 || isNaN(id)) return settings.errorMessage || 'מספר ת\"ז אינו תקין';\n id = id.length < 9 ? (\"00000000\" + id).slice(-9) : id;\n let valid = Array.from(id, Number).reduce((counter, digit, i) => {\n const step = digit * ((i % 2) + 1);\n return counter + (step > 9 ? step - 9 : step);\n }) % 10 === 0;\n \n if(!valid){\n return settings.errorMessage || 'מספר ת\"ז אינו תקין';\n }\n return null;\n }\n return null;\n }", "function valida_numeros(e){\n tecla = (document.all) ? e.keyCode : e.which;\n //Tecla de retroceso para borrar, siempre la permite\n if (tecla == 8 ){ return true; }\n if (tecla == 9 ){ return true; }\n if (tecla == 0 ){ return true; }\n if (tecla == 13 ){ return true; }\n \n // Patron de entrada, en este caso solo acepta numeros\n patron =/[0-9-.]/;\n tecla_final = String.fromCharCode(tecla);\n return patron.test(tecla_final);\n }", "function comprobacion(e) {\n\t var numeros=\"0123456789\";\n\nfunction tiene_numeros(texto){\n for(i=0; i<texto.length; i++){\n if (numeros.indexOf(texto.charAt(i),0)!=-1){\n \t//si retorna 1 es que encontro numeros en el texto\n return 1;\n }\n }\n //si retorna 0 solo contiene letras\n return 0;\n}\n}", "function selectNaibor(id){\n console.log(id);\n if(id != 0 && id != 4 && id != 8 && id != 12) {\n changeColorById(id - 1);\n };\n if(id != 3 && id != 7 && id != 11 && id != 15) {\n changeColorById(Number(id) + 1);\n };\n if(id < 12) {\n changeColorById(Number(id) + 4);\n };\n if(id > 3) {\n changeColorById(Number(id) - 4);\n };\n}", "transformarNumeroAColor(numero){\n switch (numero){\n case 0:\n return 'celeste'\n case 1:\n return 'violeta'\n case 2:\n return 'naranja'\n case 3:\n return 'verde' \n }\n }", "function choose(number){\n\tPERSONAJE = number;\n}", "function getNumber(){\n\treturn;\n}", "function generarNumero(numero){\n return (Math.random()*numero).toFixed(0);\n }", "function Ejercicio3() {\n\n var numero = \"\";\n for (var i = -100; i <= 10; i++) {\n numero += \"Numero: \" + i + \"<br>\";\n }\n $('#mostrarNumero').html(numero);\n}", "constructor (number) {\n this.number = number\n }", "function numero(value) {\n if (value == '.' && numberNow.indexOf('.') > 0){\n Continue;\n } \n \n if (total && (total.length > 12 && total.length <= 15)) {\n $results.css({ \"font-size\": \"-=0.1em\" });\n $processed.css({ \"font-size\": \"-=0.1em\" });\n } \n if (total && total.length >= 16) {\n alert(\"Number or expression too long. Calculator will be reset.\");\n total = undefined;\n soma = undefined;\n $results.css({ \"font-size\": \"1.5em\" }).text('');\n $processed.css({ \"font-size\": \"1.2em\" }).text('');\n Continue;\n }\n \n if (!total || total == '0') {\n total = value;\n numberNow = value;\n $results.text(total);\n $processed.text(total);\n } else if (value == \"0\" && total.length == 0) {\n Continue;\n } else {\n total += value;\n numberNow += value;\n $results.text(total);\n $processed.text(total);\n }\n }", "function deal_number(){\n\t\n}", "transformarNumeroAColor(numero) {\n switch (numero) {\n case 0:\n return \"celeste\";\n case 1:\n return \"violeta\";\n case 2:\n return \"naranja\";\n case 3:\n return \"verde\";\n }\n }", "function AjPoFo() {\r\n \r\n if (perso.Por < 2) { //Test si assez d'argent\r\n alert(\"Vous n'avez pas assez d'argent\");\r\n console.log(\"Pas assez d'argent / nombre de potion = \"+ perso.Pinv[0]);\r\n } else {\r\n perso.Por -= 2; //Or du perso -2\r\n perso.Pinv[0] += 1; //Nombre de potion +1 \r\n document.getElementById('or').value = perso.Por; //affiche Or du perso dans la div caracteristique\r\n document.getElementById('nbPoFo').value = perso.Pinv[0]; //affiche le nombre de potion\r\n console.log(\"Achat d'une potion de force / nombre de potion = \"+ perso.Pinv[0]);\r\n }\r\n\r\n}", "function setNumberNF(num)\n{\n\tthis.numOriginal = num;\n\tthis.num = this.justNumber(num);\n}", "function validacionNumeros(numeroDigitado) {\n if (numeroDigitado == numerosOrden[0]) {\n inputNumeros.textContent += numeroDigitado;\n numerosOrden.shift();\n if (numerosOrden.length == 0 && numeroDigitado == '0') {\n swal(\"Ya se terminaron los numeros\", {\n className: \"swal-text\",\n icon: \"success\",\n });\n }\n } else {\n switch (numeroDigitado) {\n case '1':\n contadorNumero1 += 1;\n if (contadorNumero1 >= 2) {\n swal(\"El numero 1 ya fue digitado\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break\n case '2':\n if (contadorNumero2 == 1) {\n swal(\"No puedes oprimir este numero te falta el numero 1\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorNumero2 += 1;\n } else if (contadorNumero2 >= 2) {\n swal(\"El numero 2 ya fue digitado\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case '3':\n if (contadorNumero3 == 1) {\n swal(\"No puedes oprimir este numero te falta el numero 1 y 2\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorNumero3 += 1;\n } else if (contadorNumero3 >= 2) {\n swal(\"El numero 3 ya fue digitado\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case '4':\n if (contadorNumero4 == 1) {\n swal(\"No puedes oprimir este numero te falta el numero 1, 2 ,3\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorNumero4 += 1;\n } else if (contadorNumero4 >= 2) {\n swal(\"El numero 4 ya fue digitado\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case '5':\n if (contadorNumero5 == 1) {\n swal(\"No puedes oprimir este numero te falta el numero 1, 2 ,3 ,4\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorNumero5 += 1;\n } else if (contadorNumero5 >= 2) {\n swal(\"El numero 5 ya fue digitado\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case '6':\n if (contadorNumero6 == 1) {\n swal(\"No puedes oprimir este numero te falta el numero 1 ,2 ,3 ,4 ,5\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorNumero6 += 1;\n } else if (contadorNumero6 >= 2) {\n swal(\"El numero6 ya fue digitado\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case '7':\n if (contadorNumero7 == 1) {\n swal(\"No puedes oprimir este numero te falta el numero 1 ,2 ,3 ,4 ,5 ,6\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorNumero7 += 1;\n } else if (contadorNumero7 >= 2) {\n swal(\"El numero7 ya fue digitado\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case '8':\n if (contadorNumero8 == 1) {\n swal(\"No puedes oprimir este numero te falta el numero 1 ,2 ,3 ,4 ,5 ,6 ,7\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorNumero8 += 1;\n } else if (contadorNumero8 >= 2) {\n swal(\"El numero 8 ya fue digitado\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case '9':\n if (contadorNumero9 == 1) {\n swal(\"No puedes oprimir este numero te falta el numero 1 ,2 ,3 ,4 ,5 ,6 ,7 ,8\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorNumero9 += 1;\n } else if (contadorNumero9 >= 2) {\n swal(\"El numero 9 ya fue digitado\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n case '0':\n if (contadorNumero0 == 1) {\n swal(\"No puedes oprimir este numero te falta el numero 1, 2 ,3 ,4 ,5 ,6 ,7 ,8 ,9\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n contadorNumero0 += 1;\n } else if (contadorNumero0 >= 2) {\n swal(\"El numero 0 ya fue digitado\", {\n className: \"swal-text\",\n icon: \"warning\",\n });\n }\n break;\n }\n }\n}", "function validaMinimo(numero){ \n if (!/^([0-9])*$/.test(numero)||(numero === \"\")){\n alert(\"[ERROR] Stock minimo invalido\");\n document.getElementById(\"minimo\").value=\"0\"; \n document.getElementById(\"minimo\").focus();\n }\n }", "function fatorial(numero) {\n return 0\n}", "function modificar(n1) {\n n1 = n1 + 1000\n}", "function phoneNumber(no){\n\t\n}", "function numeroDatos(){\n let valor = document.getElementById(\"InputDatos\");\n let numero = parseInt(valor.value);\n return numero;\n}", "function esNumero(numero){\n console.log(\"Estoy en la funcion 'esNumero'\");\n return !isNaN(numero);\n}", "function esNumero(numero){\n console.log(\"Estoy en la funcion 'esNumero'\");\n return !isNaN(numero);\n}", "function contLike(elNum,elId){\nvar igualC = document.getElementById(arrComentarios.length + 1).value;\t\nvar contadorAux = document.getElementById(\"num\");\n\nconsole.log(contadorAux);\n\nvar recorreLike = arrComentarios.filter(function(c){\n\treturn c.id = igualC;\n})\n\t\tvar elNum = parseInt(elNum);\n\t\tvar contador = elNum + 1;\n\n\n\treturn contadorAux.innerHTML = \" \" + contador;\n}", "function genaratoreNumeriRandom(numero) {\n return Math.floor(Math.random() * numero) +1;\n}", "function validaMaximo(numero){ \n if (!/^([0-9])*$/.test(numero)||(numero === \"\")){\n alert(\"[ERROR] Stock Maximo invalido\");\n document.getElementById(\"maximo\").value= \"0\"; \n document.getElementById(\"maximo\").focus();\n }\n }", "function numeroAlCuadrado (numero) {\n var calculo;\n calculo = numero*numero;\n\n return calculo;\n}", "function getNum(n){\n let screen = document.getElementById(\"screen\");\n screen.value += n;\n}", "function pret_a_la_banque(numero)\n{\n\tthis.money += numero * 5;\n}", "function changeNumberImg(value) {\n count = count + value;\n showSlide();\n }", "function addZero(numero) {\r\n if(numero < 10) {\r\n numero = '0' + numero;\r\n }\r\n return numero;\r\n }", "LanzarBomba(num){\n return this.bomba[num];\n\n }", "function comenzar()\n{\n numeroSecreto=(Math.floor(Math.random() *100) + 1); // Se Genera El Numero Secreto Random\n}", "function obtenerNumeroDigitado(botonDigitado) {\n return botonDigitado[1];\n}", "function displayNumber(n){\n if (resultado.textContent == '0' & n=='0') {\n\n }else if (cantDigitos < 8 & first == 0) {\n resultado.innerHTML = '';\n resultado.textContent = resultado.textContent + n;\n first = 1;\n cantDigitos = cantDigitos + 1;\n }else if (cantDigitos < 8 & first == 1) {\n resultado.textContent = resultado.textContent + n;\n cantDigitos = cantDigitos + 1;\n }else if (cantDigitos < 8 & first == 2 ){\n resultado.textContent = resultado.textContent + n;\n puntoPermitido = 0;\n first = 1 ;\n }\n}", "function changeRoadNumHandler(roadsNum, btnId) {\n let roadsWordForm = \"\";\n\n switch (roadsNum) {\n case \"1\":\n roadsWordForm = \"дорогу\";\n break;\n case \"2\":\n case \"3\":\n case \"4\":\n roadsWordForm = \"дороги\";\n break;\n default:\n roadsWordForm = \"дорог\";\n }\n btnId.value = `выбрать ${roadsNum} ${roadsWordForm}`;\n}", "function subirNivel() {\n\tniv++;\n\tatrapados = 0;\n\tcant = 2 + niv;\n\tpy++;\n}", "function setRowNumber() {\n $self.find('td.js-row-no').each(function (i) {\n i = i + 1;\n $(this).text(i);\n });\n }", "function Ejercicio4for() {\n var numero = \"\";\n for (var i = 40; i >= 10; i--) {\n numero += \"Numero: \" + i + \"<br>\";\n }\n $('#pMostrarEje3_for').html(numero);\n}", "function lireInput()\n{\n\t//RECUPERER L'OBJET QUI REPRESENTE LA BALISE <input id=\"nbrColonnes\">\n\tobjetInput = document.getElementById(\"nbrColonnes\");\n\t//LIT LE TEXTE ENTRE PAR L'UTILISATEUR\n\ttexteInput = objetInput.value;\n\t//CONVERTIR LE TEXTE EN NOMBRE ENTIER\n\tnbrColonnes = parseInt(texteInput);\n\t//CARRE\n\tnbrLignes = nbrColonnes;\n\t//LE CARRE\n\tnbrCase = nbrColonnes * nbrLignes;\n}", "function checkIdLenght(){\n if (dataPoke.id < 9) {\n return \"#00\";\n }\n else if (dataPoke.id < 99) {\n return \"#0\";\n }\n else {\n return \"#\"; \n }\n }", "function rand(numero) {\n\treturn Math.floor(Math.random() * numero) + 1;\n}", "function duplicar(numero){\n return numero*2;\n}", "function comenzar()\r\n{\r\nnumeroSecreto = Math.round(Math.random() * 99 + 1);\r\nalert(numeroSecreto);\r\ndocument.getElementById(\"txtIdNumero\").focus();\r\ncontadorIntentos = 0;\r\ndocument.getElementById(\"txtIdIntentos\").value = contadorIntentos;\r\nflag = 1;\r\n\r\n}", "function comprobarNum( campo ,size ) {\n var exp = /^[0-9]*$/;\n if(!comprobarExpresionRegular(campo,exp,size)){//comprueba que la expresión enviada en telef sea cumplida por el campo enviado si no lo hace devuelve false\n return false;\n }else {\n campo.style.border = \"2px solid green\";\n return true;\n }\n}", "function randomNr() {\n return Math.floor(Math.random() * 9999);\n}", "function decrement(numero) {\n\n return numero-1;\n\n }", "function validaDisponible(numero){ \n if (!/^([0-9])*$/.test(numero)||numero === \"\"){\n alert(\"[ERROR] Stock disponible invalido\");\n document.getElementById(\"disponible\").value= \"0\"; \n document.getElementById(\"disponible\").focus();\n }\n }", "function verificarNumero(value, min, id){\n let res = \"\";\n let val = value.split(\"\");\n for(let i = 0; i < val.length; i++){\n res += (NUMBERS.includes(val[i])) ? val[i] : \"\";\n }\n if(Number.parseInt(res) > 20) {\n res = (Number.parseInt(res) > 20) ? res.slice(0,-1) : res;\n }\n document.getElementById(id).value = res;\n return (Number.isInteger(Number.parseInt(value[value.length - 1])) && !(Number.parseInt(value) < min));\n}", "function Random(){\n var nb = Math.floor(Math.random()*52)+1;\n if (nb<10){\n var nb = \"0\"+ nb; // Ajout d'un 0 pour s'adapter a l'appelation des fichiers\n }\n return nb;\n}", "function CriaInputNumerico(numero, id, classe, funcao) {\n var input = CriaDom('input', id, classe);\n input.type = 'number';\n if (numero) {\n input.value = numero;\n }\n if (funcao) {\n input.addEventListener('input', funcao, false);\n }\n return input;\n}", "function getCurrentNum () {\n return parseInt($('.js-content').attr('data-no'), 10);\n}", "constructor(numero1,numero2){//funcion donde se declaran parametros\r\n this.Numero1=numero1;//atributos\r\n this.Numero2=numero2;//atributos\r\n }", "function aleatorio(minimo, maximo){\n\tvar Numero= Math.floor(Math.random() * (maximo - minimo + 1) + minimo );\n\treturn Numero;\n}", "function Numeros(e, field) {\n var teclaPulsada = window.event ? window.event.keyCode : e.which;\n var valor = field.value;\n\n if (teclaPulsada == 08) return true;\n\n return /\\d/.test(String.fromCharCode(teclaPulsada));\n}", "function numeroPerfecto(numero){\n let divisores = 0;\n\n if (numero < 0) {\n alert(\"no se admiten numeros negativos\");\n return;\n }\n\n if (numero.length >= 9) {\n alert(\"este numero es muy largo y demora mucho en procesar, te recomiendo mirar los otros ejemplos\")\n return;\n }\n // al agregar el diferente de nulo si se ingresa la letra (E) valida el campo numerico\n // al quitar esta comparacion no valida el campo numerico\n if (divisores == 0 && numero == null || numero == \"\") {\n alert(\"valor no permitido\");\n return;\n }\n for (let i = 1; i <= numero / 2; i++) {\n if (numero % i == 0) {\n //captura los divisores\n divisores +=i;\n }\n if (divisores == numero) {\n alert(`el numero ${numero} es perfecto`);\n return;\n\n }\n }\n if (numero != divisores) {\n alert(`el numero ${numero} no es perfecto`);\n return;\n\n }\n}" ]
[ "0.7163246", "0.6658498", "0.66433555", "0.6590076", "0.6584708", "0.6528237", "0.64961225", "0.64214945", "0.6362474", "0.6327545", "0.63226867", "0.63208914", "0.63130873", "0.62982255", "0.6294038", "0.6226135", "0.6211596", "0.6205355", "0.61994696", "0.6197704", "0.6196868", "0.6182827", "0.6182464", "0.6176333", "0.61738396", "0.6159094", "0.6124812", "0.6111701", "0.60834724", "0.6062777", "0.6060874", "0.60359937", "0.60274875", "0.60111713", "0.599133", "0.597007", "0.5936258", "0.5932909", "0.59323937", "0.5913269", "0.5909524", "0.58975", "0.5893497", "0.5887349", "0.58869356", "0.5886014", "0.5879929", "0.587857", "0.5878559", "0.58769524", "0.5876225", "0.5874669", "0.5874287", "0.5873469", "0.58726054", "0.5866026", "0.58645505", "0.5860844", "0.5852752", "0.5850988", "0.58476335", "0.58458734", "0.58445877", "0.5843231", "0.5836722", "0.5836439", "0.5826188", "0.5826188", "0.582333", "0.58210063", "0.5819693", "0.5817724", "0.580548", "0.58035314", "0.58020544", "0.57981545", "0.5797135", "0.5794113", "0.5792817", "0.57856", "0.57838225", "0.5781082", "0.5774541", "0.5773531", "0.577081", "0.5769578", "0.5768364", "0.57496345", "0.5744965", "0.5743876", "0.5740179", "0.57305354", "0.572862", "0.5712659", "0.5710955", "0.57087904", "0.5708578", "0.5707346", "0.57051873", "0.5704526", "0.57019025" ]
0.0
-1
Funzione confronto di due Array (ricordati il minore per primo)
function checkInArray(tocheckArray, mainArray) { var checkedItems = [] for (var i = 0; i < tocheckArray.length; i++) { for (var j = 0; j < mainArray.length; j++) { if (tocheckArray[i] === mainArray[j]) { checkedItems.push(mainArray[j])} } } console.log(checkedItems) return checkedItems }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rimuovi(){\n\n\tvar j = 0;\n\n\t// Per ogni elemento controllo la condizione\n\t// Se è idoneo, copio elemento in J\n\n\tfor(var i = 0; i<persone.length; i++){\n\t\tif(persone[i].altezza > 1.5) {\n\t\t\tpersone[j++] = persone[i];\n\t\t}\n\t}\n\t// Aggiorno array con valori nuovi messi in J\n\tpersone.length = j;\n\n\t// Visualizzo\n\tvisualizzaPersone();\n}", "piquesAleatoire() {\n\t\t// position y aleatoire pour 4 piques\n\t\tlet tirage = [];\n\t\twhile (tirage.length < 4) {\n\t\t\tlet nombreAleatoire = Math.round(Utl.aleatoire(4, 12));\n\t\t\tif (tirage.indexOf(nombreAleatoire) === -1) {\n\t\t\t\ttirage.push(nombreAleatoire);\n\t\t\t}\n\t\t}\n\t\treturn tirage;\n\t}", "function controllo(numeri, tentativi){\n // confronto i due array e restituisco la quantità di numeri indovinati e quali sono.\n\n var numeriCorretti = [];\n\n for (var i = 0; i < 5; i++) {\n if (cercaElemento(tentativi[i], numeri)){\n numeriCorretti.push(tentativi[i]);\n }\n }\n\n console.log(\"Hai indovinato \" + numeriCorretti.length + \" numeri.\");\n console.log(\"I numeri indovinati sono: \" + numeriCorretti);\n\n}", "mergeNewPieceTo(array){\n\n\t\tthis.newPiece.reduce((acc, element, index) => {\n\n\t\t\tlet x = this.newPiecePosition[0] + index%this.newPieceLen;\n\t\t\tlet y = this.newPiecePosition[1] + Math.trunc(index/this.newPieceLen);\n\n\n\n\t\t\t//Ou juste element ?\n\t\t\tif(element > 0){\n\t\t\t\tacc[x + y * this.boardLen] = element;\n\t\t\t}\n\n\t\t\treturn acc;\n\n\t\t}, array);\n\n\t}", "function plusUn(array) { // Function qui va ajouter +1 a chacuns des tableaux\n for (var i = 0; i < array.length; i++) { // Première boucle qui va parcourir les éléments du 1er tableau\n for (var j = 0; j < array[i].length; j++) { // Deuxième boucle qui va parcourir les éléments des sous-tableaux\n array[i][j] += 1; // On ajoute +1 a chacun des éléments du sous-tableau\n }\n }\n return array; // On retourne le tableau a la fin\n}", "function calculo() {\n return array.map(porDos).map(masUno);\n}", "function changeArrayU(array) {\n for(let i = 0; i<array.length; i++){\n for(let j = 0; j<array[i].length; j++){\n let arr = getcheil(array, i);\n arr = thesameL(arr)\n setcheil(array,i,arr);\n }\n }\n draw(array)\n return array;\n}", "function prueba() {\n let datos = [1,7,3,2]\n let masDatos = [1,4,6]//para que no me lo ponga mal necesito la function concat\n let arrayFinal = datos.concat(masDatos)\n //importancia de los arrays, el método array me devuelve algo\n //console.log(datos + masDatos) \n console.log(arrayFinal)\n //datos.sort()//sort es para ordenar\n //console.log(datos)//la function con cat no cambia con sort sí cambia y ya no los podría recuperar\n //pero bueno decimos hacemos una copia del array let temp= datos, temp.sort()\n \n //let temp = datos//esto es copiar referencias y no sirve para una copia de seguridad\n //necesitaríamos clonar un array que es un poco rara, reside en los prototipos de los arrays\n //pero no puedo poner datos. y no me sale nada y se quedan en el protopipo y escribo el array en mayuscula\n //y me da las funciones del prototipo\n //CLONAR UN ARRAY\n let temp = datos.slice(0)//esto es para clonar un array\n //la funcion sort solo numera alfabeticamente por lo que si tenemos: 1,7,3,70,9, nos pondría: 137709 así que tendríamos que poner una function\n//de ordenado que sería temp.sort(function(a,b)){return a-b} y seria las ahorro function se pone con =>\n temp.sort((a,b)=> a-b) //numera alfabéticamente y reverse al contrario\n //son implementadas como mutables me alteran todo por ello habría que clonar\n console.clear()\n console.log('Esto es temp')\n console.log(temp)\n console.log('Esto es datos')\n //console.log(datos)\n console.log(datos.join(''))//devolvería 1732 si quisiera numero se pone +datos.join y saldría nº\n}", "function subtracoesX(){\n let subtracoes = [];\n for(let i = 0; i < eixoX.length; i++){\n subtracoes[i] = eixoX[i] - entradaX;\n }\n return subtracoes;\n}", "function OrdenarArrayJuego() {\n for (let k = 0; k < ArrayJuego.length; k++) {\n for (let f = 0; f < ArrayJuego.length - k - 1; f++) {\n if (ArrayJuego[f].getKm() < ArrayJuego[f + 1].getKm()) {\n let aux;\n aux = ArrayJuego[f];\n ArrayJuego[f] = ArrayJuego[f + 1];\n ArrayJuego[f + 1] = aux;\n }\n }\n }\n\n ImprimirTabla();\n}", "function calcularVueltas(Pares){\n\t\tvar arreglo = new Array(mVueltas);\n\t\tvar cont = 0;\n\t\tvar dato;\n\t\tvar mVueltas = parseInt(vueltas.value);\n\t\tvar pares = Pares;\n\t\tvar temp;\n\t\tvar unidad = 1;\n\t\tfor (var i = 0; i < Pares; i++) {\n\t\t\tif(cont < mVueltas){\n\t\t\t\tif(arreglo[cont] == null){\n\t\t\t\t\tarreglo[cont] = 0;\n\t\t\t\t}\n\t\t\t\ttemp = arreglo[cont];\n\t\t\t\tarreglo[cont] = temp + unidad;\n\t\t\t\tcont++;\n\t\t\t\t\n\t\t\t}else{\n\t\t\t\tcont = 0;\n\t\t\t\ttemp = arreglo[cont];\n\t\t\t\tarreglo[cont] = temp + unidad;\n\t\t\t\tcont++;\n\t\t\t}\t\n\t\t}\n\t\treturn arreglo;\t\t\n\t}", "function update(){\n var novoArray = [];\n\n carrinho.forEach(item=>{\n if(item.quant>0){\n novoArray.push(item);\n }\n })\n\n return carrinho = novoArray;\n}", "function inverti_array(a){\n var array = new Array();\n //copio l'array in modo da non modificare i valori iniziali\n for(var i=0;i<a.length;i++){\n array[i] = copia_array(a[i])\n }\n for(var i=0;i<array.length/2;i++){\n var a_supp = array[i];\n array[i] = array[array.length-1-i];\n array[array.length-1-i] = a_supp;\n }\n return array;\n }", "function subtracoesY(){\n let subtracoes = [];\n for(let i = 0; i < eixoY.length; i++){\n subtracoes[i] = eixoY[i] - entradaY;\n }\n return subtracoes;\n}", "function construye() {\n let base = [];\n for (let i = 0; i < numCajas; i++) {\n base.push(angular.copy(cajaDefecto));\n }\n return base;\n }", "function generoArrayMine (rangeMax, numeroMine ) {\n // creo l'array dove inserire i numeri generati dalla funzione\n var campoMinato = [];\n // la funzione deve creare 16 numeri casuali, SENZA ripetizioni.\n // il ciclo dura fino a quando la lunghezza di campoMinato è < 16\n while ( campoMinato.length < numeroMine ) {\n var numeroCasuale = Math.floor(Math.random() * (rangeMax - 1) ) + 1;\n // aggiungo il numero generato da numeroCasuale ad ogni ciclo a campoMinato[] .\n // !! Il numero generato viene aggiunto a campoMinato[] SOLO SE non è gia presente.\n // Se la funzione controlloElementiArray è false, cioè non ci sono ripetizioni di numeri allora eseguo il push.\n if (controlloElementiArray(numeroCasuale, campoMinato) === false) {\n campoMinato.push(numeroCasuale)\n }\n\n } // fine while\n\n // la funzione mi ritorna campoMinato, interrompo la funzion e.\n return campoMinato;\n\n}", "limparArray() {\n this.erros.forEach((value, indice) => {\n this.erros.splice(indice);\n });\n }", "function vietuSukeitimas (i, j) {\n if (i >= 0 && j >= 0 && i !== j){\n var x = prekiautojai[i];\n prekiautojai[i] = prekiautojai[j];\n prekiautojai[j] = x;\n console.log(prekiautojai);\n } else {\n return \"Iveskite 0, teigiama reiksme ir skirtingas reiksmes\"\n }\n}", "function perspectiva(arrayNegativo) {\n for (let i = 0; i < arrayNegativo.length; i++) {\n if ( arrayNegativo[i] < 0 ) {\n console.log(\"Encontrado Negativo: \", arrayNegativo[i])\n } else {\n console.log(\"Encontrado Positivo: \", arrayNegativo[i])\n arrayNegativo[i] = arrayNegativo[i] * -1\n }\n }\n for (let x = 0; x < arrayNegativo.length; x++) {\n console.log(\"Posicion en el Array #[\"+(x)+\"]: \", arrayNegativo[x]) \n }\n return arrayNegativo\n}", "function comprarColete(i){\n if(mochilaColete.length == 0){\n if(jogador1.grana < mercadoColetes[i].preco){\n console.log('Falta din!!!')\n }else{\n mochilaColete.push(mercadoColetes[i])\n \n jogador1.grana -= mercadoColetes[i].preco \n }\n }else{\n for(let j in mochilaColete){\n if(i == mochilaColete[j].id){\n console.log('Já tem este colete!')\n return\n }\n }\n if(jogador1.grana < mercadoColetes[i].preco){\n console.log('Falta din!!!')\n }else{\n mochilaColete.push(mercadoColetes[i])\n \n jogador1.grana -= mercadoColetes[i].preco \n }\n }\n console.log(mochilaColete)\n gravarLS('grana', jogador1.grana); \n mostraInfoJogador()\n}", "allocateCautionArea() {\n const calNum = (n) => [n - 1, n, n + 1];\n const calCasIndex = (index) => {\n let [a , b] = index.split('-');\n let front = calNum(parseInt(a, 10));\n const frontcheck = (n) => n < this.length && n > -1;\n let back = calNum(parseInt(b, 10));\n const backcheck = (n) => n < this.length && n > -1;\n let Indexes = [];\n for (let i = 0; i < 3; i++) {\n for (let j = 0; j < 3; j++) {\n if (frontcheck(front[i]) && backcheck(back[j])) {\n Indexes.push(front[i] + '-' + back[j]);\n }\n }\n }\n let resultIndex = [];\n Indexes.map((el) => {\n if (!this.mines.includes(el)) {\n resultIndex.push(el);\n return true;\n } else {\n return false;\n }\n });\n return resultIndex;\n }\n const C = [];\n this.mines.map((el) => calCasIndex(el)).map(e => C.push(...e)); \n return C;\n }", "function obtenerColoresDegradados() {\r\n return [\"90-#ff0000-#9d0000\",\"90-#00ff00-#009d00\",\"90-#0000ff-#00009d\",\"90-#ffff00-#A99200\",\"90-#FF8000-#AA6000\",\"90-#8000FF-#420373\",\"90-#FF8080-#FF8888\",\"90-#808080-#00009d\",\"90-#800000-#00009d\",\"90-#800080-#4D0178\"]; \r\n}", "function optimal_compos_golden(adr)//mam sklad 7, szukam czy ktos na lawce sie nadaje//szukanie lepszego perfo-nie roz problem\n{\n if(adr==1)\n {\n \ttea = team1;//z tempo odczyt, a do tempz zapisuje;\n }\n else \n {\n \ttea = team2;//z tempo odczyt, a do tempz zapisuje;\n }\n//console.log(changes);\n var all_lawka = [];\n var item1 = [];\n var item2 = [];\n var item3 = [];\n var item4 = [];\n for(var i=1;i<=6;i++)//mam gwaracje, że przejdzie przez każdego R na ławce, ale dalej zawsze wybierze najlepszego\n {\t\n tea[0]=Array(0,0,0,0,0,0,0,0,0,0,0,0);\n item1 = [];item2 = [];item3 = [];item4 = [];\n\t\t\tfor(var j=8;j<=12;j++)\n\t\t\t{\n\t\t\t //item = [];\n if(tea[j][4]==\"R\" && i == 1)// i = 1 - sprawdzam każdego z ławki konkretnie za R\n\t\t\t {\n\t\t\t \tif(tea[j][11] > (tea[i][11]+1))\n {\n nadwyzka = tea[j][11] - tea[i][11];nadwyzka = zaokr(nadwyzka); \n item1 = [j, i, nadwyzka];\n all_lawka.unshift(item1);// \n }\n\t\t\t }\n if(tea[j][4]==\"A\" && i == 4)// i = 4\t\n\t\t\t {\n\t\t\t \tif(tea[j][6] > (tea[i][6]+1))\n {\n nadwyzka = tea[j][6] - tea[i][6];nadwyzka = zaokr(nadwyzka);\n item2 = [j, i, nadwyzka];\n all_lawka.unshift(item2);// \n }\n\t\t\t }\n item3 =[];\n if(tea[j][4]==\"P\" && (i == 2 || i == 5))// i = 2; i =5;\n\t\t\t {\n\t\t\t \tif( (tea[j][6]+tea[j][7])/2 > ((tea[i][6]+tea[i][7])/2)+1)\n {\n nadwyzka = (tea[j][6]+tea[j][7])/2 - ((tea[i][6]+tea[i][7])/2);nadwyzka = zaokr(nadwyzka);\n item3=[];\n item3 = [j, i, nadwyzka];\n test = all_lawka.unshift(item3);//\n //alert(\"test-length: \"+test+\" item: \"+item3);\n }\n\t\t\t }\n if(tea[j][4]==\"S\" && (i == 3 || i == 6))// i = 3; i =6;\n\t\t\t {\n\t\t\t \tif( (tea[j][6]+tea[j][9])/2 > ((tea[i][6]+tea[i][9])/2)+1)\n {\n nadwyzka = (tea[j][6]+tea[j][9])/2 - ((tea[i][6]+tea[i][9])/2);nadwyzka = zaokr(nadwyzka);\n item4 = [j, i, nadwyzka];\n all_lawka.unshift(item4);// \n }\n\t\t\t }\n } //end of for j=8..12\n //console.log(all_lawka);\n }//end of for i=1..6\n //sortowanie\n for(u=0; u<all_lawka.length; u++)\n {\n for(w=1; w<all_lawka.length; w++)\n {\n if(all_lawka[w][2] > all_lawka[w-1][2])\n {\n temp = all_lawka[w-1];\n all_lawka[w-1] = all_lawka[w];\n all_lawka[w] = temp;\n }\n }\n }\n //próba wykoanania zmiany\n for(u=0; u<all_lawka.length; u++)\n {\n out_id = all_lawka[u][1];\n in_id = all_lawka[u][0];\n out_nr = tea[out_id][3]; //na indeksie 1 mam wyznaczonego do zejścia - nr dla funkcji possible_change\n in_nr = tea[in_id][3]; //\n if(adr == 1)\n {\n if(possible_change(adr, out_nr, in_nr) < 6)\n {\nvar fffv = document.getElementById(\"screen3\").innerHTML;\ndocument.getElementById(\"screen3\").innerHTML=fffv+\"<br>(\"+pkt1+\":\"+pkt2+\") \"+tea[in_id][5]+\" za: \"+tea[out_id][5]+\" (stan: \"+mm1+\" : \"+mm2+\") \";\n//2021-01-13: nowy screen do zapisu zmian na czas seta\nvar fffv = document.getElementById(\"change_info1\").innerHTML;\ndocument.getElementById(\"change_info1\").innerHTML=fffv+\"<br>(\"+pkt1+\":\"+pkt2+\") \"+tea[in_id][5]+\" za \"+tea[out_id][5];\n change1(out_id,in_id); flag_golden1 = 1; return 0;\n }\n }\n else\n {\n if(possible_change(adr, out_nr, in_nr) < 6)\n {\nvar fffv = document.getElementById(\"screen6\").innerHTML;\ndocument.getElementById(\"screen6\").innerHTML=fffv+\"<br>(\"+pkt1+\":\"+pkt2+\") \"+tea[in_id][5]+\" za: \"+tea[out_id][5]+\" (stan: \"+mm1+\" : \"+mm2+\") \";\n//2021-01-13: nowy screen do zapisu zmian na czas seta\nvar fffv = document.getElementById(\"change_info2\").innerHTML;\ndocument.getElementById(\"change_info2\").innerHTML=fffv+\"<br>(\"+pkt1+\":\"+pkt2+\") \"+tea[in_id][5]+\" za \"+tea[out_id][5];\n change2(out_id,in_id); flag_golden2 = 1; return 0;\n }\n }\n }\n\n\n if(adr==1)\n {\n team1 = tea;\n }\n else \n {\n team2 = tea;\n }\n\n banch_ins();\n return 1;\n}", "function MiaFunzione (array, a, b) {\n var arrayNuovo = [];\n for (i = a; i < b; i++) {\n arrayNuovo.push(array[i]);\n }\n return arrayNuovo;\n}", "function InitFirstSolu()\n{\n\tconsole.log(\"courseList.length: \"+ roomList.length);\n\ttmpArr = new Array(35*roomList.length);\n\tvar tmpIndex = 0;\n\tfor(var i = 0; i< courseList.length; i++)\n\t\tfor(var j = 0; j< courseList[i].times; j++)\n\t\t\ttmpArr[tmpIndex++] = i;\n\tfor(var i = tmpIndex; i<tmpArr.length; i++)\n\t\ttmpArr[i] = -1;\n\treturn tmpArr;\n}", "function sukeistiMasayvoElementus(nr1, nr2) {\nlet y = prekiautojai[nr1];\nprekiautojai[nr1] = prekiautojai[nr2];\nprekiautojai[nr2] = y;\n\n}", "function medida_separatriz_cont(arr,medida,posicao){ \n /*\n Q - Quartil - 25% 50% 75% 100% (4)\n K - Quintil - 20% 40% 60% 80% 100% (5)\n D - Deal - 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% (10)\n P - Percentil - 1 % 2% .. 100% (100); \n */\n \n //variaveis auxiliares//\n var medida = Number(medida), posicao = Number(posicao), linha = 0, cont = 0,\n pos = 0, fac_anterior = 0, fi_linha = 0, H = 0, ms = 0, I = 0;\n \n //identifica a separatriz e guarda o contador adequado//\n switch(medida){\n case 4:\n cont = Number(((arr[6].length*25*posicao)/100).toFixed(2));\n break;\n case 5:\n cont = Number(((arr[6].length*20*posicao)/100).toFixed(2));\n break;\n case 10:\n cont = Number(((arr[6].length*10*posicao)/100).toFixed(2));\n break;\n case 100:\n cont = Number(((arr[6].length*posicao)/100).toFixed(2));\n break;\n }\n\n //verifica a quantidades de linha ate a posicao encontrada//\n for(var i=0; i<arr[3].length; i++){\n if(arr[3][i] <= cont){\n linha++;\n } \n }\n \n \n //Indice inferior//\n I = arr[0][linha]\n \n //Posição//\n pos = cont;\n \n\n if(linha == 0){\n fac_anterior = arr[3][linha];\n }else if(linha == 1){\n fac_anterior = arr[3][linha-1];\n }else{\n fac_anterior = arr[3][linha-1];\n }\n \n \n //FI - da linha//\n fi_linha = arr[1][linha];\n \n //H - da formula (intervalo)//\n H = Number(arr[8].toFixed(2));\n \n //medida separatriz recebe//\n ms = I + ( (pos - fac_anterior) /fi_linha ) * H;\n\n return Number(ms.toFixed(2));\n }", "function returnReverso(array) { //array= [1,2,3,4]; array.length = 4; \n let nuevoArreglo = []; //[4,3,2,1]\n for (let i = array.length - 1; i >= 0; i--) { //i =3>2>1>0>-1\n nuevoArreglo.push(array[i]);\n }\n return nuevoArreglo;\n}", "function negativos(array) {\n var newArray = [];\n for (var i = 0; i < array.length; i++) { \n if(array[i] > 0){\n newArray.push(array[i]*-1);\n }\n else{\n newArray.push(array[i]);\n }\n }\n\n return newArray;\n}", "function controlloArrayUguali(primoArray, secondoArray) {\n var i = 0;\n var j = [];\n\n while (i<primoArray.length) {\n if (primoArray[i] == secondoArray[i]) {\n j.push(primoArray[i]);\n }\n i++\n }\n\n return j;\n}", "function rellenarArray(Arr){\n var line4 = [];\n a = 0;\n var j = 0;\n count = 0;\n media = 0;\n for (var prop_name in Arr) {\n a = parseFloat(prop_name); \n line4.push([a, Arr[prop_name]]) \n if (j==0){\n inicio = a;\n maximo = parseFloat(Arr[prop_name]);\n minimo = parseFloat(Arr[prop_name]);\n j = 1; \n }\n if (parseFloat(Arr[prop_name]) > maximo){maximo = parseFloat(Arr[prop_name])}\n if (parseFloat(Arr[prop_name]) < minimo){minimo = parseFloat(Arr[prop_name])}\n media += parseFloat(Arr[prop_name]);\n count += 1;\n };\n finGra = a;\n media = media/count;\n return line4;\n}", "function matemathicArr(arr) {\n \n newArr = [];\n \n for (var i = 0; i < arr.length; i++) {\n arr[i] = arr[i] / 2 + 5;\n if (arr[i] === 0) {\n arr[i] = 20;\n }\n }\n return arr;\n}", "function generarPoblacionInicial(){\n\tarrayAux = new Array(GENES);\n\tfor(i=0;i<POBLACION;i++) {\n\n\t\t//aux con los numeros del 0 al 22\n\t\tfor(j=0;j<GENES;j++) {\n\t\t\tarrayAux[j] = j;\n\t\t}\n\n\t\t//rellenar cromosomas con el aux en orden aleatorio\n\t\tfor(j=0;j<GENES;j++) {\n\t\t\tcromosoma[i][j] = parseInt((arrayAux.splice(Math.floor(Math.random() * arrayAux.length), 1)).join(\"\"));\n\t\t}\n\t}\n}", "function returnReverso(array) { //array= [1,2,3,4]; array.length = 4; \n\n let nuevoArreglo = []; //[4,3,2,1]\n for (let i = array.length - 1; i >= 0; i--) { //i =3>2>1>0>-1\n nuevoArreglo.push(array[i]);\n }\n return nuevoArreglo;\n}", "function e() {\n return [1, 0, 0, 1, 0, 0];\n }", "function aleatorios(limite = 1) {\n let r = []\n for (let i = 0; i < limite; i++) {\n r[i] = numeroAlAzar100()\n }\n\n return r\n \n }", "function otroCarton() {\n for (var i = 0; i < numeroUsados.length; i++) {\n //se resetea el array de numeros usados\n numeroUsados[i] = false;\n }\n\n}", "function mostrarCurvas(){\n\tvar index = -1;\n\tvar arr = [];\n\tpontosAtuais.forEach(a => arr.push(a));\n\tguardarPontos();\n\tallPoints.forEach(function(conj){\n\t\tvar l = true;\n\t\tfor(let i = 0; i < conj.length; i++){\n\t\t\tif(conj[i] != pontosAtuais[i]){\n\t\t\t\tl = false;\n\t\t\t}\n\t\t\tarr.push(conj[i]);\n\t\t}\n\t\t//console.log(conj.length);\n\t\tif(l && conj.length > 0){\n\t\t\tconsole.log(\"entrou \" + allPoints.length);\n\t\t\tif(allPoints.length > 1){\n\t\t\t\tvar index = allPoints.indexOf(conj);\n\t\t\t\tconsole.log(allPoints);\n\t\t\t\tarr_curvas[index] = p_curvas;\n\t\t\t\tconsole.log(arr_curvas);\n\t\t\t}else{\n\t\t\t\tconsole.log(arr_curvas);\n\t\t\t\tarr_curvas[0] = p_curvas;\n\t\t\t}\n\t\t}else if(conj.length == 0 && arr_curvas.length == 0){\n\t\t\t//console.log(\"aaa\");\n\t\t\tarr_curvas.push(p_curvas);\n\t\t}\n\t});\n\tarr_curvas.forEach(a => a.forEach(b => arr.push(b)));\n\tstage.children(arr);\n}", "function lobural() {\n\tfor(var i=0;i<20;i++) {\n\t\tindiceCartas[i] = new Array(20);\n\t\tfor (var j=0;j<20;j++) {\n\t\t\tindiceCartas[i][j] = 0;\n\t\t}\n\t} \n}", "function naikAngkot(arrPenumpang) {\n rute = ['A', 'B', 'C', 'D', 'E', 'F'];\n //your code here\n if (arrPenumpang.length === 0) {\n \treturn '[]';\n }\n var daftarPenumpang = [];\n for (var i = 0; i < arrPenumpang.length; i++) {\n \tvar dataPenumpang = {};\n \tdataPenumpang.penumpang = arrPenumpang[i][0];\n \tdataPenumpang.naikDari = arrPenumpang[i][1];\n \tdataPenumpang.tujuan = arrPenumpang[i][2];\n \tdataPenumpang.bayar = (rute.indexOf(arrPenumpang[i][2])-rute.indexOf(arrPenumpang[i][1]))*2000;\n \tdaftarPenumpang.push(dataPenumpang);\n }\n return daftarPenumpang;\n}", "function traitement (array){\n console.log(\"ici le test pour le traitement\")\n return array.filter(avecA).map(maj)\n}", "function ordina(){\n\n\tfor (var i = 0; i<persone.length; i++){\n\t\tvar minimoFinOra = i; \n\n\t\tfor(var j=i+1; j<persone.length; j++){\n\n\t\t\tif(persone[j].altezza<persone[minimoFinOra].altezza){\n\n\t\t\t\tminimoFinOra = j;\n\t\t\t}\n\t\t}\n\t\t// Salvo il valore minimo\n\t\tvar tmp = persone[i];\n\t\tpersone[i] = persone[minimoFinOra];\n\t\tpersone[minimoFinOra] = tmp;\n\t}\n\t//Visualizzo\n\tvisualizzaPersone();\n}", "function inicializarArrayResultados() {\r\n for(var i=1;i<=totalPreguntas;i++) {\r\n resultadoEncuesta[\"p\"+i+\"-alt\"]=[0,0,0,0];\r\n }\r\n}", "function pengkodeanPopulasi(pos) {\n var urutan = new Array();\n //Pencocokan Posisi\n for (var i = 0; i < pos.length; i++) {\n urutan[i] = pengkodean1Partikel(pos[i]);\n }\n return urutan;\n}", "function desviacionEstandarMuestra(array) {\n\t\t\tlet desviacionEstandar = varianzaMuestra(array) ** (1/2);\n\t\t\treturn desviacionEstandar;\n\t\t}", "function cortarArrayFn(array,inicio){\n let newArray=[];\n if(Array.isArray(array)){\n if(inicio+1<=array.length){\n for(let i=inicio+1;i<array.length;i++){\n newArray.push(array[i]);\n }\n }else{\n return -1;\n } \n }\n return newArray;\n}", "function e(){return [0,0,0,1]}", "function obtenerVectoresPesos() {\n myArray = inicializarArr(attributesGlobal.length);\n for (var i = 0; i < attributesGlobal.length; i++) { \n my_id = \"arq_tbody_id_\"+(i);\n mv = calcularVectorPesosAPartirDelTbody(document.getElementById(my_id));\n for (var j = 0; j < mv.length; j++) {\n // console.log(mv[j]);\n //w = myArray[j] + mv[j];\n myArray[j].push(mv[j]); \n };\n }\n return myArray;\n}", "asistenciasTotalesPorDia(equipo){\n let len = equipo.length;\n let asistencia_total = [];\n let total_lunes=0;\n let total_martes=0;\n let total_miercoles=0;\n let total_jueves=0;\n let total_viernes=0;\n let total_sabado=0;\n let total_domingo=0;\n \n for (var i = 0; i <len; ++i) {\n total_lunes = total_lunes + (equipo[i].asistencia.lunes * equipo[i].factor_dias_laborados);\n total_martes = total_martes+ (equipo[i].asistencia.martes * equipo[i].factor_dias_laborados);\n total_miercoles = total_miercoles + (equipo[i].asistencia.miercoles * equipo[i].factor_dias_laborados);\n total_jueves = total_jueves + (equipo[i].asistencia.jueves * equipo[i].factor_dias_laborados);\n total_viernes = total_viernes + (equipo[i].asistencia.viernes * equipo[i].factor_dias_laborados);\n total_sabado = total_sabado + (equipo[i].asistencia.sabado * equipo[i].factor_dias_laborados);\n // total_domingo = total_domingo + (equipo[i].asistencia.domingo * equipo[i].factor_dias_laborados);\n }\n\n asistencia_total.push(total_lunes);\n asistencia_total.push(total_martes);\n asistencia_total.push(total_miercoles);\n asistencia_total.push(total_jueves);\n asistencia_total.push(total_viernes);\n asistencia_total.push(total_sabado);\n // asistencia_total.push(total_domingo);\n\n \n return asistencia_total;\n }", "function cantidad_embarcadores(id_destino,array){\n var embarcadores= new Array();\n var aux;\n if( array.length > 0 ){\n for (var i = 0; i < array.length; i++) {\n if(array[i].id_destino == id_destino && embarcadores.length==0){\n embarcadores.push(array[i].id_unit);\n aux = array[i].id_unit;\n }\n if(array[i].id_destino == id_destino && embarcadores.length>0){\n if( aux != array[i].id_unit ){\n embarcadores.push(array[i].id_unit);\n aux=array[i].id_unit;\n }\n }\n }\n }\n return embarcadores;\n}", "function ordenarProductosPrecio(productos, orden){\n\n //creo una variable donde se van a cagar los productos por orden de precio\n\n //variable de menor a mayor\n let productosOrdenPrecioAsc = [];\n //variable de mayor a menor\n let productosOrdenPrecioDesc = [];\n\n //guardamos una copia del array de productos traidos del json\n\n let productosCopia = productos.slice();\n\n // creo una variable que va a ser un array con solo los precios de cada producto, la cargamos mediante un map\n \n let arrayProductosOrdenPrecio = productosCopia.map((producto) => {return producto.precio} );\n\n //ordeno el array con los precios\n \n let comparar = (a,b) => {return a - b};\n \n arrayProductosOrdenPrecio.sort(comparar);\n\n // recorro el array con los precios de los productos en orden\n\n for(precio of arrayProductosOrdenPrecio){\n \n //guardo el indice donde se encuentra el producto que coincide con el precio del array con precios ordenados\n\n let indice = productosCopia.findIndex( (productoCopia) => { if(productoCopia.precio==precio){ \n\n return productoCopia \n\n } } );\n\n //guardo en el array de productos por orden de precio que cree al principio de la funcion, el producto del array que coincida con el indice\n\n //mayor a menor\n productosOrdenPrecioDesc.unshift(productosCopia[indice]);\n //menor a mayor\n productosOrdenPrecioAsc.push(productosCopia[indice]);\n\n /*Luego de guardarlo, elimino ese producto del array copia ya que \n el metodo findIndex devuelve el indice del primer elemto que coincida y si hay productos con la misma fecha\n se va a guardar siempre el primero que encuentre (resumen: lo elimino para que no se guarden elementos repetidos)*/\n\n productosCopia.splice(indice,1);\n \n }\n\n //retornamos el nuevo array de productos ordenados por precio \n\n if(orden == \"asc\"){\n\n return productosOrdenPrecioAsc;\n\n }\n\n if(orden == \"des\"){\n\n return productosOrdenPrecioDesc;\n\n }\n\n if(orden != \"asc\" && orden != \"des\"){\n\n console.log(\"ingrese correctamente el parametro indicador del ordenamiento por precio\");\n\n }\n \n\n}", "function changeArrayD(array) {\n for (let i = 0; i < array.length; i++) {\n for(let j = 0; j<array[i].length; j++){\n let arr = getcheil(array, i);\n arr = thesameR(arr)\n setcheil(array,i,arr);\n }\n }\n draw(array)\n return array;\n}", "function task3(){\n let have = 0; //сколько взяли\n let LeftToGo = 0; // Сколько осталось взять\n let array = new Array;//Массив ответов \n let xChair = 0; //Занятых стульев\n let ExistingChair = 0; // Сколько стульев в комнате вообще\n let need = prompt(\"Введите сколько стульев нужно (не больше 8)\",\"\")\n let meetingRooms = prompt(\"Введите строку\",\"\");\n let meetingRooms2 = meetingRooms.replace(/[,.\"\"''()?!-]/g, '');\n meetingRooms = meetingRooms2.split(\" \");\n let length = meetingRooms.length;\n for(let i = 0; i < length; i++){\n if( i % 2 == 0){\n xChair = meetingRooms[i].length;\n }\n else{\n ExistingChair = Number(meetingRooms[i]);\n }\n if(xChair != 0 && ExistingChair != 0){\n if(ExistingChair - xChair >= 0 && need - have >= 0){\n LeftToGo = need - have;\n console.log(\"Сколько осталось взять \" + LeftToGo);\n if(LeftToGo > (ExistingChair - xChair)){\n have += ExistingChair - xChair;\n array.push(ExistingChair - xChair);\n if(have != need){\n console.log('Not enough!');\n }\n }\n else{\n have += ExistingChair - xChair;\n array.push((ExistingChair - xChair)-((ExistingChair - xChair) - LeftToGo));\n console.log('Game On');\n }\n console.log(array);\n }\n xChair = 0;\n ExistingChair = 0;\n }\n }\n //console.log(meetingRooms);\n}", "function matemathicArr(arr) {\n newArr = [];\n for (var i = 0; i < arr.length; i++) {\n arr[i] = arr[i] / 2 + 5;\n if (arr[i] === 0) {\n arr[i] = 20;\n }\n }\n return arr;\n}", "set_maj_angles(maj_angles){\n if(!this.maj_angles) { this.maj_angles = [] }\n let new_angles = []\n let existing_maj_angles_length = this.maj_angles.length\n for(let j = 0; j < 7; j++) {\n let val\n if(j >= maj_angles.length) {\n if(j >= existing_maj_angles_length) { val = 0 }\n else { val = this.maj_angles[j] }\n }\n else { val = maj_angles[j] }\n new_angles.push(val)\n }\n this.maj_angles = dui2.fix_angles(new_angles)\n }", "function incluyeOpcionVacia(datos) {\n\t var datos2 = new Array();\n\t datos2[0] = ['','']; \n\t for (var i=0;i<datos.length;i++) {\n\t \tdatos2[i+1] = datos[i];\n\t }\n\t return datos2;\n\t}", "function desviacionEstandar(array) {\n\t\t\tlet desviacionEstandar = varianza(array) ** (1/2);\n\t\t\treturn desviacionEstandar;\n\t\t}", "function sukeistiMasyvo2elementus(x,y) {\n var temp = prekiautojai[y];\n prekiautojai[y] = prekiautojai[x];\n prekiautojai[x] = temp;\n console.log( \"po sukeitimo prekybos centrai:\", prekiautojai );\n}", "upperTablePoints(){\n let pointsArray = [0, 0, 0, 0, 0, 0, 0];\n //[0, 2, 1, 0, 0, 2, 0] -> 2*1 + 1*2 + 2*5 = 14\n // pointsArray = [0, 2, 2, 0, 0, 10, 0]\n this.dice_values.forEach((element,index)=>{\n pointsArray[index] = element * index;\n })\n return pointsArray;\n }", "function e$1(){return [1,0,0,0,1,0,0,0,1]}", "addvecinos() {\r\n if (this.x > 0) { //vecino izquierdo\r\n this.vecinos.push(escenario[this.y][this.x - 1]);\r\n }\r\n if (this.x < filas - 1) { //vecino derecho\r\n this.vecinos.push(escenario[this.y][this.x + 1]);\r\n }\r\n if (this.y > 0) { //vecino superior\r\n this.vecinos.push(escenario[this.y - 1][this.x]);\r\n }\r\n if (this.y < columnas - 1) { //vecino inferior\r\n this.vecinos.push(escenario[this.y + 1][this.x]);\r\n }\r\n\r\n /*console.log(this.vecinos);*/ //muestra los vecinos\r\n }", "separarArrays() {\n console.log(this.month + '-' + this.year);\n this.fecha = this.month + '/01/' + this.year;\n this.array1 = [];\n this.anterior = null;\n for (let i = 0; i < this.arrayT.length; i++) {\n const element = this.arrayT[i];\n if (element.year == this.year) {\n if (element.month < this.month) {\n this.array1.push(element);\n console.log(this.month - 1);\n if ((this.month - 1) > 0) {\n this.anterior = (this.month - 1) + '/' + this.year;\n }\n }\n }\n else if (element.year < this.year) {\n this.array1.push(element);\n if (this.month - 1 == 0) {\n this.anterior = (12) + '/' + (this.year - 1);\n }\n }\n }\n this.comprobarArray();\n }", "function obtenerValor(array) {\n return array[distribucionLineal(array.length)];\n }", "function cariModus(arr) {\n var indexTampung =0;\n var simpanIndex, tampung=[];\n\n //Memfilter sekaligus menghitung jumlah angka yang sama yang akan di simpan pada array\"tampung\"\n for(var i=0; i<arr.length; i++) {\n var counter = 1;\n for(var j=i+1; j<arr.length; j++) {\n if(arr[i] === arr[j] && arr[i] !== '') {\n counter++;\n arr[j] = ''; //jika ada nilai yang sama maka arr[j] di hilangkan agar tidak ada duplikasi lagi\n }\n }\n if(arr[i] !== '') {\n tampung.push([arr[i], counter]) // array \"tampung\" menyimpan nilai dan jumah duplikatnya\n }\n }\n\n //mencari Modus\n var indexMax = 0;\n var MAX = tampung[indexMax][0];\n for(var i=0; i<tampung.length; i++) {\n if(tampung[i][1] > tampung[indexMax][1]) {\n indexMax = i;\n MAX = tampung[indexMax][0];\n }\n }\n\n // console.log(tampung)\n if(tampung.length === 1 || tampung[indexMax][1] === 1){ //untuk jika modus hanya ada 1 nilai atau tidak ada modus\n return -1 ; \n }else{\n return MAX;\n }\n}", "function vaciarCesta(){\n //borrar los productos guardados en el array\n arrayCesta=[];\n //Renderizar cambios\n renderCesta();\n calcularTotal();\n}", "function arrayPares2(arreglo) {\n let aux = arreglo.pop();\n if (aux % 2 == 0) {\n arreglo.unshift(aux); //pongo adelante del arreglo el ultimo elemento del arreglo si es par\n }\n aux = arreglo.pop();\n if (aux % 2 == 0) {\n arreglo.unshift(aux); //pongo adelante del arreglo el ultimo elemento del arreglo si es par\n }\n aux = arreglo.pop();\n if (aux % 2 == 0) {\n arreglo.unshift(aux); //pongo adelante del arreglo el ultimo elemento del arreglo si es par\n }\n aux = arreglo.pop();\n if (aux % 2 == 0) {\n arreglo.unshift(aux); //pongo adelante del arreglo el ultimo elemento del arreglo si es par\n }\n return arreglo;\n}", "function crearSolicitudes() {\n var arraySolicitudes = [];\n for (var i = 1; i <= 104; i++) {\n arraySolicitudes.push(crearSolicitud(i));\n }\n return arraySolicitudes;\n }", "function leyes_vida(){\n\tcelulas_x2= new Array(50);\n\tfor(i=0;i<50;i++){\n\t\tcelulas_y2= new Array(50);\n\t\tfor(j=0;j<50;j++){\n\t\t\tsum=0;\n\t\t\tcelulas_y2[j]=evaluar(i,j,celulas_x,celulas_x[i][j],sum);\n\t\t\t//alert(\"resultado: \"+celulas_y2[j]);\n\t\t\t\n\t\t}//for j\n\t\tcelulas_x2[i]=celulas_y2;\n\t\t\n\t}//for i\n\tcelulas_x=celulas_x2;\n\t\n\timprimir_celulas(celulas_x);\n\t\n}", "function ordenarProductosFecha(productos){\n\n //creo una variable donde se van a cagar los productos por oden de fecha\n\n let productosOrdenFecha = [];\n\n //guardamos una copia del array de productos traidos del json\n\n let productosCopia = productos.slice();\n console.log(productosCopia)\n\n\n // creo una variable que va a ser un array con solo las fechas de cada producto, la cargamos mediante un map\n \n let arrayProductosOrdenFecha = productosCopia.map((producto) => {return producto.fecha} );\n\n //ordeno el array con las fechas\n \n let comparar = (a,b) => {return a - b};\n \n arrayProductosOrdenFecha.sort(comparar);\n\n // recorro el array con las fechas de los productos en orden\n\n for(fecha of arrayProductosOrdenFecha){\n \n //guardo el indice donde se encuentra el producto que coincide con la fecha\n\n let indice = productosCopia.findIndex( (productoCopia) => { if(productoCopia.fecha==fecha){ \n\n return productoCopia \n\n } } );\n\n //guardo en el array de productos por orden de fecha que cree al principio de la funcion, el producto del array que coincida con el indice\n\n productosOrdenFecha.unshift(productosCopia[indice]);\n\n /*Luego de guardarlo, elimino ese producto del array copia ya que \n el metodo findIndex devuelve el indice del primer elemto que coincida y si hay productos con la misma fecha\n se va a guardar siempre el primero que encuentre (resumen: lo elimino para que no se guarden elementos repetidos)*/\n\n productosCopia.splice(indice,1);\n \n }\n\n //retornamos el nuevo array de productos ordenados por fecha \n\n return productosOrdenFecha;\n\n}", "function actualizarDatos(){\r\n centro1X = centroX-dist/2;\r\n centro2X = centroX +dist/2;\r\n console.log(centro1X-rad1);\r\n arrayMedidores[0].x = centro1X-rad1;\r\n arrayMedidores[1].x = centro1X-(-rad1);\r\n arrayMedidores[2].x = centro2X-rad2;\r\n arrayMedidores[3].x = centro2X-(-rad2);\r\n d=dist/PixelMet;\r\n\r\n arrayCargas=[];\r\n arrayCargas2=[];\r\n for(var i = 0;i < maxCargas ; i++){\r\n var posicion = calPosUno(i);\r\n var q = calCargaUno(i);\r\n arrayCargas.push(new CargaP(centro1X+posicion*PixelMet,centroY,10,q))\r\n }\r\n for(var i = 1;i < maxCargas ; i++){\r\n var posicion = calPosDos(i);\r\n var q = calCargaDos(i);\r\n arrayCargas2.push(new CargaP(centro2X-posicion*PixelMet,centroY,10,q))\r\n }\r\n\r\n\r\n\r\n var conta = sliderPas.value;\r\n for(var i = 0 ;i<arrayCargas.length;i++){\r\n if(i<conta){\r\n arrayCargas[i].Boolshow = 1;\r\n }\r\n else {\r\n arrayCargas[i].Boolshow = 0;\r\n }\r\n }\r\n\r\n for(var i = 0 ;i<arrayCargas2.length;i++){\r\n if(i<conta){\r\n \tarrayCargas2[i].Boolshow = 1;\t}\r\n else {\r\n \tarrayCargas2[i].Boolshow = 0; }\r\n }\r\n}", "function arr_decier( arr ) {\n\n var tmp_arr = [0, 0, 0, 0, 0, 0, 0];\n\n if ( arr.length === 0 ) {\n return -1;\n }\n\n for ( var i = 0; i < arr.length; i++ ) {\n // tmp_arr[i] = Math.round( arr[i] * 100 ) / 100;\n tmp_arr[i] = Math.round( arr[i] * 100 );\n }\n\n return tmp_arr;\n\n}", "function recorarray(){\nvar i\nvar array1 = [i]\n//Estas serian variables locales de ésta funcion.\nfor (i=0; i<10;i++){\narray1[i]=Math.round((Math.random() * 200))\n/*De la siguiente manera utilizamos Math.random()*200 para\ncrear una serie de números aleatorios entre 0 y 200 y \nutilizamos el metodo Math.round para redondear el resultado\n*/\n}\nconsole.log('Este seria nuestro array sin filtrar = ' + array1)\n\n//De esta manera mostramos por consola nuestro resultado\n\nfor(i=0; i<array1.length;i++){\n if(array1[i]>100){\n delete array1[i]\n }\n}\n/*mediante el metodo \"delete\" eliminamos las casillas con\nnumeros comprendidos entre el 0 y el 100 */\n\n\narrayf = array1.filter(Number)\n/*Mediante el método filter podremos filtrar las casillas\nque poseen un número por tanto que esten comprendidas entre\nel 0 y el 100*/\n\n\nconsole.log(\"Nuestro array finalmente seria el siguiente = \" + arrayf)\n}", "function niveau1() {\n\ttable = [\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n\t];\n}", "function decidirGanador() {\n\n var arrayPosiciones = [];\n var indice;\n\n for (var i = 0; i < jugadores.length; i++) {\n mejorCombinacionPorJugador[i] = combinacionCartasGenerales(i);\n\n console.log(\"Mejor combinacion jugador \" + i + \" es \" + mejorCombinacionPorJugador[i]);\n\n if (mejorCombinacionPorJugador[i] > combinacionGanadoraActual) {\n combinacionGanadoraActual = mejorCombinacionPorJugador[i];\n }\n jugadores[i].manoGanadora = mejorCombinacionPorJugador[i];\n }\n\n indice = mejorCombinacionPorJugador.indexOf(combinacionGanadoraActual);\n while (indice !== -1) {\n arrayPosiciones.push(indice);\n indice = mejorCombinacionPorJugador.indexOf(combinacionGanadoraActual, indice + 1);\n }\n\n\n if (arrayPosiciones.length === 1) {\n return arrayPosiciones;\n } else if (arrayPosiciones.length > 1) {\n return decidirGanadorEmpate(arrayPosiciones);\n }\n}", "function cruzamiento(poblacion,seleccion,ciudades,elite)\n\t\t\t{\n\t\t\t\tvar numPobla = poblacion.length;\n\t\t\t\tvar indice1,indice2;\n\t\t\t\tvar k = 0;\n\t\t\t\tvar new_poblation = new Array();\n\t\t\t\t/*Genero nueva poblacion*/\n\t\t\t\twhile(k < parseInt(numPobla / 2))\n\t\t\t\t{\n\t\t\t\t\t//Escogo el metodo de seleccion para tener dos PADRES\n\t\t\t\t\tswitch(seleccion)\n\t\t\t\t\t{\n\t\t\t\t\t\t//Torneo\n\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\tdo{\n\t\t\t\t\t\t\t\tindice1 = torneo(poblacion,elite);\n\t\t\t\t\t\t\t\tindice2 = torneo(poblacion,elite);\n\t\t\t\t\t\t\t}while(indice1 == indice2);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t//Ranking\n\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t//Aleatorio\n\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\tdo{\n\t\t\t\t\t\t\t\tindice1 = parseInt( Math.random() * numPobla*elite);\n\t\t\t\t\t\t\t\tindice2 = parseInt( Math.random() * numPobla*elite);\n\t\t\t\t\t\t\t}while(indice1 == indice2);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t//console.log(indice1);\n\t\t\t\t\t//console.log(indice2);\n\t\t\t\t\t/*Padres*/\n\t\t\t\t\tvar dad = poblacion[indice1].recorrido; \n\t\t\t\t\tvar mom = poblacion[indice2].recorrido;\n\t\t\t\t\t/*Camino para Hijos*/\n\t\t\t\t\tvar camino1 = new Array();\n\t\t\t\t\tvar camino2 = new Array();\n\t\t\t\t\t/*Numero entre 0 y numero de ciudades menos 1*/\n\t\t\t\t\tbp = parseInt( Math.random() * ciudades ); /*Punto de roptura*/\n\n\t\t\t\t/*-----------Genero 2 nuevos caminos-----------*/\n\t\t\t\t\t//Respaldo caminos de papa y mama hasta bp\n\t\t\t\t\tfor(var i = 0; i < bp; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcamino1.push(dad[i]);\n\t\t\t\t\t\tcamino2.push(mom[i]);\n\t\t\t\t\t}\n\t\t\t\t\tfor(var i = 0; i < ciudades; i++)\n\t\t\t\t\t{\t\n\t\t\t\t\t\t//Tomo el elemento a buscar en el segundo vector\n\t\t\t\t\t\tvar busca1 = mom[i];\n\t\t\t\t\t\tvar busca2 = dad[i];\n\t\t\t\t\t\tfor(var j = bp; j < ciudades; j++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(busca1 == dad[j])\n\t\t\t\t\t\t\t\tcamino1.push(busca1);\n\t\t\t\t\t\t\tif(busca2 == mom[j])\n\t\t\t\t\t\t\t\tcamino2.push(busca2); \n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t/*Hijos generados*/\n\t\t\t\t\tvar hijo1 = {recorrido: camino1, distancia: aptitud(camino1,region)}\n\t\t\t\t\tvar hijo2 = {recorrido: camino2,distancia : aptitud(camino2,region)}\n\n\t\t\t\t\tnew_poblation.push(hijo1);\n\t\t\t\t\tnew_poblation.push(hijo2);\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t\treturn new_poblation;\n\t\t\t}", "function copiarArray(myArray){\n var arrayAux = [];\n for(let i in myArray){\n var e = []\n for(let j in myArray[i]){\n e.push(myArray[i][j]+0);\n }\n arrayAux.push(e);\n }\nreturn arrayAux;\n}", "function pares(platillos) {\r\n\r\n let cont = 1;\r\n let arregloPlatillos = [];\r\n for (let i = 0; i < platillos.length; i++) {\r\n if (cont % 2 == 0) {\r\n arregloPlatillos.push(platillos[i]);\r\n }\r\n cont++;\r\n }\r\n return arregloPlatillos;\r\n}", "getCaminosArbol(t) {\n if(this.t > t) return [];\n let retorno = this.caminosHijos;\n\n this.hijos.forEach(function (e) {\n retorno = retorno.concat(e.getCaminosArbol(t));\n }, this);\n\n return retorno;\n }", "function PrioArray() {\n this.reset();\n}", "function retireArray(bal,intR,nPer,mDep){\n\tvar retirement = [];\n\tretirement[0] = bal;\n\tfor(var year=1;year<=nPer;year++){\n\t\tretirement[year]=retirement[year-1]*(1+(intR/100));\n\t\tretirement[year]+=(mDep/12);\n\t\tretirement[year]=retirement[year].toFixed(2);\n\t}\n\treturn retirement;\n}", "getData() {\n return [\n [3.28084, 3.28084, 3.28084, 9.84252, 13.1234, 9.84252, 6.56168, 13.1234, 19.685, 16.4042, 9.84252, 6.56168, 13.1234, 22.9659, 22.9659, 19.685, 19.685, 22.9659, 19.685, 19.685, 16.4042, 13.1234, 13.1234, 9.84252, 13.1234, 16.4042, 19.685, 16.4042, 16.4042, 16.4042, 16.4042, 19.685, 22.9659, 26.2467, 29.5276, 29.5276, 32.8084, 36.0892, 36.0892, 36.0892, 42.6509, 45.9318, 49.2126, 55.7743, 59.0551, 59.0551, 68.8976, 68.8976, 72.1785, 78.7402, 82.021, 82.021, 85.3018, 91.8635, 91.8635, 88.5827, 85.3018, 91.8635, 91.8635, 85.3018, 82.021, 82.021, 85.3018, 82.021],\n [3.28084, 6.56168, 9.84252, 13.1234, 13.1234, 13.1234, 13.1234, 13.1234, 9.84252, 9.84252, 6.56168, 6.56168, 13.1234, 22.9659, 26.2467, 26.2467, 26.2467, 26.2467, 22.9659, 22.9659, 19.685, 19.685, 16.4042, 19.685, 19.685, 19.685, 19.685, 19.685, 13.1234, 13.1234, 16.4042, 19.685, 22.9659, 26.2467, 29.5276, 32.8084, 36.0892, 39.3701, 39.3701, 36.0892, 42.6509, 45.9318, 52.4934, 55.7743, 59.0551, 59.0551, 65.6168, 68.8976, 72.1785, 78.7402, 88.5827, 88.5827, 88.5827, 91.8635, 91.8635, 88.5827, 85.3018, 85.3018, 88.5827, 85.3018, 78.7402, 75.4593, 75.4593, 72.1785],\n [9.84252, 13.1234, 9.84252, 9.84252, 9.84252, 13.1234, 16.4042, 6.56168, -3.28084, -3.28084, -3.28084, 0.0, 6.56168, 16.4042, 19.685, 26.2467, 29.5276, 26.2467, 19.685, 16.4042, 13.1234, 13.1234, 16.4042, 19.685, 22.9659, 19.685, 19.685, 19.685, 16.4042, 16.4042, 16.4042, 19.685, 19.685, 22.9659, 26.2467, 32.8084, 36.0892, 39.3701, 39.3701, 39.3701, 42.6509, 49.2126, 52.4934, 55.7743, 55.7743, 59.0551, 62.336, 68.8976, 72.1785, 78.7402, 85.3018, 88.5827, 91.8635, 91.8635, 95.1444, 95.1444, 88.5827, 85.3018, 85.3018, 82.021, 78.7402, 75.4593, 68.8976, 59.0551],\n [9.84252, 16.4042, 13.1234, 6.56168, 3.28084, 9.84252, 13.1234, 6.56168, -3.28084, -3.28084, -3.28084, 0.0, 9.84252, 13.1234, 16.4042, 26.2467, 29.5276, 26.2467, 16.4042, 13.1234, 16.4042, 19.685, 19.685, 22.9659, 26.2467, 22.9659, 19.685, 16.4042, 13.1234, 16.4042, 16.4042, 13.1234, 13.1234, 16.4042, 19.685, 26.2467, 32.8084, 32.8084, 32.8084, 39.3701, 42.6509, 49.2126, 49.2126, 55.7743, 59.0551, 59.0551, 62.336, 68.8976, 78.7402, 82.021, 85.3018, 91.8635, 95.1444, 98.4252, 98.4252, 101.706, 95.1444, 88.5827, 88.5827, 88.5827, 78.7402, 72.1785, 68.8976, 62.336],\n [16.4042, 19.685, 16.4042, 13.1234, 9.84252, 6.56168, 6.56168, 6.56168, 9.84252, 13.1234, 9.84252, 13.1234, 19.685, 13.1234, 13.1234, 19.685, 22.9659, 26.2467, 19.685, 16.4042, 19.685, 19.685, 19.685, 19.685, 22.9659, 19.685, 19.685, 9.84252, 9.84252, 13.1234, 13.1234, 9.84252, 9.84252, 16.4042, 16.4042, 26.2467, 32.8084, 32.8084, 32.8084, 36.0892, 42.6509, 45.9318, 49.2126, 55.7743, 59.0551, 59.0551, 65.6168, 72.1785, 78.7402, 85.3018, 88.5827, 91.8635, 98.4252, 101.706, 104.987, 108.268, 101.706, 95.1444, 91.8635, 88.5827, 75.4593, 65.6168, 68.8976, 68.8976],\n [19.685, 26.2467, 19.685, 13.1234, 13.1234, 3.28084, 3.28084, 9.84252, 13.1234, 19.685, 16.4042, 19.685, 22.9659, 16.4042, 9.84252, 16.4042, 19.685, 19.685, 22.9659, 16.4042, 13.1234, 13.1234, 13.1234, 19.685, 16.4042, 19.685, 19.685, 13.1234, 9.84252, 13.1234, 13.1234, 13.1234, 16.4042, 22.9659, 29.5276, 32.8084, 32.8084, 32.8084, 32.8084, 36.0892, 39.3701, 42.6509, 45.9318, 52.4934, 59.0551, 62.336, 68.8976, 75.4593, 78.7402, 82.021, 88.5827, 91.8635, 95.1444, 101.706, 108.268, 111.549, 108.268, 98.4252, 91.8635, 88.5827, 75.4593, 68.8976, 68.8976, 68.8976],\n [13.1234, 13.1234, 9.84252, 9.84252, 13.1234, 6.56168, 9.84252, 13.1234, 16.4042, 16.4042, 16.4042, 19.685, 22.9659, 19.685, 16.4042, 13.1234, 13.1234, 16.4042, 19.685, 19.685, 16.4042, 13.1234, 13.1234, 16.4042, 22.9659, 22.9659, 9.84252, 9.84252, 13.1234, 19.685, 19.685, 26.2467, 26.2467, 29.5276, 36.0892, 32.8084, 32.8084, 32.8084, 32.8084, 39.3701, 42.6509, 42.6509, 45.9318, 52.4934, 55.7743, 62.336, 72.1785, 78.7402, 78.7402, 78.7402, 85.3018, 88.5827, 91.8635, 98.4252, 101.706, 108.268, 108.268, 104.987, 98.4252, 88.5827, 82.021, 72.1785, 68.8976, 65.6168],\n [16.4042, 3.28084, 9.84252, 13.1234, 16.4042, 13.1234, 13.1234, 16.4042, 19.685, 13.1234, 13.1234, 16.4042, 16.4042, 22.9659, 19.685, 16.4042, 16.4042, 16.4042, 16.4042, 19.685, 19.685, 19.685, 19.685, 16.4042, 19.685, 22.9659, 6.56168, 6.56168, 16.4042, 26.2467, 32.8084, 32.8084, 29.5276, 29.5276, 29.5276, 29.5276, 29.5276, 32.8084, 32.8084, 39.3701, 42.6509, 45.9318, 49.2126, 52.4934, 59.0551, 62.336, 68.8976, 75.4593, 75.4593, 78.7402, 88.5827, 91.8635, 91.8635, 95.1444, 101.706, 104.987, 108.268, 108.268, 98.4252, 91.8635, 85.3018, 72.1785, 65.6168, 62.336],\n [16.4042, 3.28084, 9.84252, 13.1234, 13.1234, 13.1234, 13.1234, 16.4042, 22.9659, 19.685, 19.685, 16.4042, 13.1234, 16.4042, 22.9659, 16.4042, 19.685, 22.9659, 22.9659, 22.9659, 19.685, 19.685, 19.685, 19.685, 22.9659, 26.2467, 3.28084, 3.28084, 13.1234, 19.685, 26.2467, 32.8084, 32.8084, 29.5276, 22.9659, 26.2467, 32.8084, 32.8084, 36.0892, 39.3701, 45.9318, 49.2126, 52.4934, 55.7743, 59.0551, 62.336, 62.336, 68.8976, 75.4593, 82.021, 88.5827, 91.8635, 95.1444, 98.4252, 104.987, 104.987, 108.268, 108.268, 101.706, 95.1444, 85.3018, 78.7402, 72.1785, 68.8976],\n [9.84252, 0.0, 0.0, 6.56168, 9.84252, 13.1234, 16.4042, 22.9659, 22.9659, 22.9659, 19.685, 13.1234, 6.56168, 6.56168, 16.4042, 19.685, 26.2467, 36.0892, 39.3701, 32.8084, 19.685, 9.84252, 19.685, 19.685, 19.685, 13.1234, 3.28084, 9.84252, 9.84252, 0.0, 6.56168, 26.2467, 32.8084, 26.2467, 22.9659, 29.5276, 32.8084, 36.0892, 39.3701, 39.3701, 42.6509, 45.9318, 52.4934, 59.0551, 59.0551, 62.336, 62.336, 65.6168, 72.1785, 78.7402, 85.3018, 88.5827, 95.1444, 98.4252, 104.987, 104.987, 104.987, 101.706, 98.4252, 95.1444, 91.8635, 82.021, 72.1785, 68.8976],\n [6.56168, -3.28084, -3.28084, 0.0, 9.84252, 9.84252, 13.1234, 19.685, 16.4042, 13.1234, 9.84252, 9.84252, 13.1234, 9.84252, 16.4042, 26.2467, 26.2467, 29.5276, 39.3701, 36.0892, 19.685, 9.84252, 16.4042, 16.4042, 9.84252, 9.84252, 16.4042, 16.4042, 9.84252, 0.0, 9.84252, 26.2467, 29.5276, 26.2467, 22.9659, 26.2467, 29.5276, 32.8084, 39.3701, 39.3701, 39.3701, 39.3701, 45.9318, 55.7743, 59.0551, 62.336, 62.336, 68.8976, 75.4593, 78.7402, 85.3018, 88.5827, 91.8635, 95.1444, 98.4252, 101.706, 101.706, 98.4252, 95.1444, 91.8635, 85.3018, 78.7402, 72.1785, 72.1785],\n [9.84252, 3.28084, 6.56168, 6.56168, 9.84252, 6.56168, 13.1234, 16.4042, 13.1234, 9.84252, 9.84252, 16.4042, 22.9659, 22.9659, 19.685, 13.1234, 13.1234, 22.9659, 29.5276, 29.5276, 16.4042, 9.84252, 22.9659, 26.2467, 16.4042, 13.1234, 16.4042, 9.84252, 6.56168, 13.1234, 19.685, 29.5276, 32.8084, 29.5276, 22.9659, 26.2467, 29.5276, 29.5276, 36.0892, 42.6509, 45.9318, 45.9318, 45.9318, 52.4934, 55.7743, 59.0551, 62.336, 72.1785, 75.4593, 78.7402, 85.3018, 88.5827, 88.5827, 91.8635, 91.8635, 95.1444, 98.4252, 98.4252, 91.8635, 88.5827, 82.021, 75.4593, 68.8976, 68.8976],\n [13.1234, 6.56168, 9.84252, 13.1234, 9.84252, 6.56168, 13.1234, 13.1234, 9.84252, 6.56168, 9.84252, 19.685, 26.2467, 26.2467, 16.4042, 6.56168, 13.1234, 26.2467, 39.3701, 36.0892, 19.685, 16.4042, 29.5276, 32.8084, 19.685, 9.84252, 0.0, -6.56168, 3.28084, 19.685, 26.2467, 29.5276, 29.5276, 26.2467, 26.2467, 26.2467, 32.8084, 29.5276, 36.0892, 42.6509, 45.9318, 45.9318, 45.9318, 49.2126, 55.7743, 59.0551, 65.6168, 68.8976, 72.1785, 75.4593, 78.7402, 82.021, 82.021, 82.021, 85.3018, 91.8635, 91.8635, 91.8635, 88.5827, 82.021, 75.4593, 72.1785, 65.6168, 62.336],\n [16.4042, 9.84252, 9.84252, 16.4042, 16.4042, 6.56168, 3.28084, 6.56168, 3.28084, 3.28084, 13.1234, 26.2467, 32.8084, 29.5276, 16.4042, 9.84252, 13.1234, 26.2467, 36.0892, 26.2467, 13.1234, 16.4042, 26.2467, 22.9659, 16.4042, 13.1234, 0.0, -9.84252, 3.28084, 19.685, 32.8084, 22.9659, 19.685, 22.9659, 22.9659, 29.5276, 36.0892, 36.0892, 36.0892, 45.9318, 45.9318, 45.9318, 45.9318, 52.4934, 55.7743, 62.336, 65.6168, 65.6168, 68.8976, 72.1785, 72.1785, 72.1785, 72.1785, 75.4593, 78.7402, 82.021, 82.021, 82.021, 82.021, 78.7402, 75.4593, 68.8976, 65.6168, 59.0551],\n [16.4042, 9.84252, 9.84252, 19.685, 19.685, 6.56168, 0.0, 6.56168, 9.84252, 9.84252, 16.4042, 29.5276, 36.0892, 32.8084, 26.2467, 16.4042, 13.1234, 16.4042, 22.9659, 22.9659, 16.4042, 13.1234, 13.1234, 13.1234, 19.685, 26.2467, 13.1234, 13.1234, 13.1234, 16.4042, 29.5276, 22.9659, 13.1234, 16.4042, 16.4042, 26.2467, 36.0892, 36.0892, 39.3701, 42.6509, 45.9318, 49.2126, 49.2126, 52.4934, 59.0551, 62.336, 62.336, 65.6168, 68.8976, 72.1785, 75.4593, 72.1785, 75.4593, 78.7402, 78.7402, 82.021, 78.7402, 78.7402, 75.4593, 75.4593, 72.1785, 65.6168, 62.336, 52.4934],\n [9.84252, 6.56168, 9.84252, 16.4042, 13.1234, 6.56168, 9.84252, 13.1234, 16.4042, 9.84252, 16.4042, 29.5276, 29.5276, 29.5276, 26.2467, 19.685, 16.4042, 13.1234, 19.685, 26.2467, 19.685, 9.84252, 6.56168, 9.84252, 19.685, 26.2467, 22.9659, 19.685, 16.4042, 13.1234, 16.4042, 13.1234, 16.4042, 22.9659, 22.9659, 29.5276, 36.0892, 39.3701, 39.3701, 39.3701, 45.9318, 49.2126, 49.2126, 55.7743, 59.0551, 62.336, 65.6168, 65.6168, 65.6168, 72.1785, 78.7402, 78.7402, 82.021, 82.021, 82.021, 78.7402, 75.4593, 68.8976, 68.8976, 72.1785, 68.8976, 65.6168, 59.0551, 55.7743],\n [9.84252, 6.56168, 6.56168, 9.84252, 3.28084, 6.56168, 13.1234, 16.4042, 13.1234, 3.28084, 9.84252, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 16.4042, 19.685, 29.5276, 22.9659, 9.84252, 6.56168, 13.1234, 22.9659, 32.8084, 29.5276, 22.9659, 13.1234, 6.56168, 9.84252, 9.84252, 19.685, 32.8084, 32.8084, 32.8084, 36.0892, 36.0892, 39.3701, 42.6509, 45.9318, 45.9318, 45.9318, 52.4934, 59.0551, 62.336, 68.8976, 68.8976, 68.8976, 72.1785, 78.7402, 82.021, 82.021, 85.3018, 85.3018, 82.021, 75.4593, 68.8976, 68.8976, 72.1785, 72.1785, 65.6168, 62.336, 59.0551],\n [16.4042, 6.56168, 3.28084, 9.84252, 6.56168, 9.84252, 9.84252, 13.1234, 9.84252, 0.0, 3.28084, 9.84252, 19.685, 26.2467, 29.5276, 26.2467, 22.9659, 13.1234, 16.4042, 22.9659, 22.9659, 13.1234, 13.1234, 19.685, 26.2467, 32.8084, 36.0892, 26.2467, 9.84252, 3.28084, 16.4042, 19.685, 19.685, 29.5276, 36.0892, 36.0892, 36.0892, 36.0892, 39.3701, 39.3701, 45.9318, 45.9318, 45.9318, 49.2126, 55.7743, 62.336, 68.8976, 68.8976, 72.1785, 75.4593, 78.7402, 82.021, 85.3018, 88.5827, 85.3018, 82.021, 78.7402, 75.4593, 78.7402, 75.4593, 75.4593, 75.4593, 72.1785, 65.6168],\n [19.685, 13.1234, 6.56168, 9.84252, 16.4042, 16.4042, 13.1234, 9.84252, 9.84252, 0.0, 3.28084, 13.1234, 19.685, 26.2467, 26.2467, 16.4042, 19.685, 22.9659, 22.9659, 26.2467, 22.9659, 13.1234, 16.4042, 16.4042, 16.4042, 26.2467, 32.8084, 29.5276, 16.4042, 9.84252, 22.9659, 26.2467, 16.4042, 19.685, 36.0892, 36.0892, 36.0892, 36.0892, 39.3701, 39.3701, 42.6509, 49.2126, 49.2126, 49.2126, 59.0551, 62.336, 68.8976, 68.8976, 72.1785, 75.4593, 78.7402, 78.7402, 88.5827, 91.8635, 88.5827, 85.3018, 85.3018, 82.021, 78.7402, 78.7402, 78.7402, 75.4593, 65.6168, 65.6168],\n [19.685, 19.685, 9.84252, 9.84252, 13.1234, 16.4042, 16.4042, 16.4042, 16.4042, 13.1234, 9.84252, 16.4042, 19.685, 22.9659, 22.9659, 16.4042, 19.685, 26.2467, 26.2467, 29.5276, 22.9659, 13.1234, 9.84252, 6.56168, 6.56168, 22.9659, 29.5276, 22.9659, 16.4042, 16.4042, 22.9659, 22.9659, 19.685, 19.685, 26.2467, 32.8084, 36.0892, 36.0892, 39.3701, 42.6509, 45.9318, 49.2126, 45.9318, 49.2126, 55.7743, 59.0551, 65.6168, 68.8976, 72.1785, 75.4593, 78.7402, 78.7402, 85.3018, 88.5827, 88.5827, 85.3018, 82.021, 82.021, 82.021, 78.7402, 78.7402, 72.1785, 65.6168, 55.7743],\n [22.9659, 22.9659, 19.685, 19.685, 19.685, 13.1234, 19.685, 26.2467, 22.9659, 16.4042, 13.1234, 9.84252, 13.1234, 19.685, 22.9659, 19.685, 19.685, 13.1234, 9.84252, 19.685, 19.685, 19.685, 13.1234, 6.56168, 6.56168, 22.9659, 26.2467, 19.685, 19.685, 19.685, 22.9659, 22.9659, 22.9659, 29.5276, 32.8084, 36.0892, 36.0892, 39.3701, 42.6509, 42.6509, 45.9318, 49.2126, 49.2126, 52.4934, 55.7743, 59.0551, 62.336, 65.6168, 68.8976, 75.4593, 78.7402, 82.021, 88.5827, 88.5827, 88.5827, 88.5827, 82.021, 78.7402, 75.4593, 75.4593, 75.4593, 75.4593, 72.1785, 59.0551],\n [19.685, 16.4042, 16.4042, 19.685, 19.685, 13.1234, 19.685, 22.9659, 16.4042, 9.84252, 6.56168, 6.56168, 9.84252, 19.685, 22.9659, 16.4042, 9.84252, 6.56168, 13.1234, 16.4042, 19.685, 26.2467, 16.4042, 13.1234, 13.1234, 16.4042, 16.4042, 19.685, 22.9659, 22.9659, 19.685, 19.685, 22.9659, 29.5276, 32.8084, 36.0892, 39.3701, 42.6509, 42.6509, 42.6509, 42.6509, 45.9318, 49.2126, 52.4934, 55.7743, 62.336, 62.336, 68.8976, 72.1785, 75.4593, 82.021, 85.3018, 88.5827, 91.8635, 95.1444, 88.5827, 82.021, 78.7402, 72.1785, 68.8976, 72.1785, 75.4593, 75.4593, 62.336],\n [13.1234, 9.84252, 13.1234, 16.4042, 19.685, 13.1234, 9.84252, 9.84252, 6.56168, 9.84252, 9.84252, 6.56168, 13.1234, 26.2467, 19.685, 16.4042, 9.84252, 6.56168, 16.4042, 16.4042, 16.4042, 19.685, 19.685, 19.685, 22.9659, 22.9659, 16.4042, 16.4042, 19.685, 22.9659, 19.685, 9.84252, 16.4042, 22.9659, 29.5276, 32.8084, 32.8084, 39.3701, 42.6509, 42.6509, 42.6509, 45.9318, 49.2126, 55.7743, 59.0551, 65.6168, 65.6168, 72.1785, 75.4593, 78.7402, 82.021, 85.3018, 91.8635, 98.4252, 95.1444, 91.8635, 85.3018, 82.021, 78.7402, 75.4593, 72.1785, 72.1785, 72.1785, 65.6168],\n [19.685, 16.4042, 16.4042, 16.4042, 16.4042, 9.84252, 6.56168, 3.28084, 6.56168, 13.1234, 9.84252, 6.56168, 16.4042, 26.2467, 19.685, 16.4042, 16.4042, 13.1234, 16.4042, 19.685, 19.685, 16.4042, 13.1234, 16.4042, 16.4042, 19.685, 16.4042, 16.4042, 16.4042, 22.9659, 22.9659, 16.4042, 19.685, 26.2467, 29.5276, 32.8084, 32.8084, 36.0892, 42.6509, 42.6509, 42.6509, 42.6509, 52.4934, 55.7743, 59.0551, 65.6168, 68.8976, 72.1785, 75.4593, 78.7402, 82.021, 85.3018, 91.8635, 98.4252, 98.4252, 91.8635, 88.5827, 85.3018, 82.021, 75.4593, 68.8976, 65.6168, 62.336, 62.336],\n [22.9659, 19.685, 19.685, 13.1234, 9.84252, 6.56168, 9.84252, 9.84252, 13.1234, 13.1234, 9.84252, 6.56168, 13.1234, 16.4042, 9.84252, 16.4042, 19.685, 19.685, 22.9659, 29.5276, 26.2467, 19.685, 13.1234, 13.1234, 9.84252, 16.4042, 22.9659, 22.9659, 19.685, 22.9659, 26.2467, 26.2467, 26.2467, 29.5276, 32.8084, 36.0892, 36.0892, 39.3701, 42.6509, 45.9318, 42.6509, 42.6509, 49.2126, 55.7743, 59.0551, 62.336, 65.6168, 68.8976, 72.1785, 78.7402, 85.3018, 88.5827, 95.1444, 101.706, 101.706, 95.1444, 88.5827, 85.3018, 78.7402, 78.7402, 72.1785, 65.6168, 62.336, 59.0551],\n [19.685, 19.685, 19.685, 13.1234, 9.84252, 6.56168, 16.4042, 16.4042, 13.1234, 13.1234, 13.1234, 9.84252, 6.56168, 3.28084, 6.56168, 13.1234, 19.685, 22.9659, 26.2467, 26.2467, 26.2467, 22.9659, 16.4042, 13.1234, 13.1234, 19.685, 29.5276, 22.9659, 19.685, 22.9659, 26.2467, 26.2467, 26.2467, 22.9659, 26.2467, 32.8084, 36.0892, 39.3701, 42.6509, 45.9318, 45.9318, 49.2126, 55.7743, 55.7743, 55.7743, 62.336, 65.6168, 65.6168, 72.1785, 82.021, 88.5827, 95.1444, 101.706, 104.987, 104.987, 91.8635, 85.3018, 82.021, 78.7402, 78.7402, 72.1785, 68.8976, 65.6168, 62.336],\n [13.1234, 13.1234, 16.4042, 16.4042, 9.84252, 9.84252, 16.4042, 22.9659, 19.685, 13.1234, 16.4042, 16.4042, 13.1234, 6.56168, 9.84252, 9.84252, 19.685, 22.9659, 22.9659, 19.685, 16.4042, 16.4042, 16.4042, 16.4042, 16.4042, 22.9659, 29.5276, 19.685, 16.4042, 22.9659, 26.2467, 29.5276, 22.9659, 19.685, 22.9659, 29.5276, 36.0892, 39.3701, 42.6509, 45.9318, 49.2126, 55.7743, 55.7743, 55.7743, 59.0551, 62.336, 68.8976, 68.8976, 78.7402, 85.3018, 91.8635, 95.1444, 101.706, 101.706, 101.706, 91.8635, 82.021, 78.7402, 78.7402, 75.4593, 72.1785, 68.8976, 68.8976, 65.6168],\n [6.56168, 9.84252, 16.4042, 16.4042, 9.84252, 9.84252, 13.1234, 16.4042, 22.9659, 19.685, 16.4042, 19.685, 19.685, 16.4042, 6.56168, 6.56168, 13.1234, 16.4042, 16.4042, 13.1234, 13.1234, 9.84252, 13.1234, 19.685, 19.685, 26.2467, 29.5276, 19.685, 9.84252, 13.1234, 26.2467, 36.0892, 29.5276, 19.685, 26.2467, 32.8084, 36.0892, 39.3701, 42.6509, 45.9318, 49.2126, 52.4934, 55.7743, 55.7743, 62.336, 65.6168, 68.8976, 72.1785, 78.7402, 85.3018, 88.5827, 91.8635, 95.1444, 98.4252, 98.4252, 95.1444, 85.3018, 78.7402, 75.4593, 75.4593, 75.4593, 72.1785, 72.1785, 65.6168],\n [6.56168, 13.1234, 22.9659, 19.685, 16.4042, 16.4042, 16.4042, 13.1234, 22.9659, 22.9659, 16.4042, 16.4042, 16.4042, 9.84252, 6.56168, 6.56168, 13.1234, 16.4042, 16.4042, 16.4042, 16.4042, 13.1234, 16.4042, 22.9659, 19.685, 19.685, 26.2467, 19.685, 13.1234, 13.1234, 19.685, 29.5276, 26.2467, 19.685, 22.9659, 29.5276, 36.0892, 39.3701, 39.3701, 42.6509, 45.9318, 52.4934, 55.7743, 59.0551, 62.336, 68.8976, 68.8976, 72.1785, 78.7402, 85.3018, 88.5827, 95.1444, 98.4252, 98.4252, 98.4252, 95.1444, 85.3018, 72.1785, 68.8976, 72.1785, 75.4593, 75.4593, 72.1785, 68.8976],\n [9.84252, 16.4042, 26.2467, 26.2467, 19.685, 19.685, 19.685, 19.685, 22.9659, 22.9659, 19.685, 16.4042, 13.1234, 9.84252, 9.84252, 9.84252, 13.1234, 19.685, 19.685, 16.4042, 16.4042, 19.685, 22.9659, 26.2467, 22.9659, 22.9659, 29.5276, 26.2467, 22.9659, 16.4042, 16.4042, 19.685, 22.9659, 19.685, 22.9659, 29.5276, 36.0892, 39.3701, 39.3701, 39.3701, 45.9318, 49.2126, 52.4934, 55.7743, 65.6168, 68.8976, 72.1785, 75.4593, 78.7402, 85.3018, 91.8635, 95.1444, 98.4252, 98.4252, 98.4252, 95.1444, 85.3018, 72.1785, 65.6168, 65.6168, 68.8976, 68.8976, 68.8976, 62.336],\n [6.56168, 6.56168, 13.1234, 19.685, 16.4042, 9.84252, 19.685, 22.9659, 22.9659, 19.685, 16.4042, 9.84252, 9.84252, 13.1234, 16.4042, 13.1234, 13.1234, 16.4042, 16.4042, 13.1234, 13.1234, 19.685, 22.9659, 26.2467, 22.9659, 26.2467, 29.5276, 26.2467, 29.5276, 19.685, 19.685, 19.685, 19.685, 22.9659, 26.2467, 36.0892, 42.6509, 42.6509, 39.3701, 39.3701, 42.6509, 49.2126, 49.2126, 55.7743, 62.336, 68.8976, 72.1785, 78.7402, 82.021, 88.5827, 91.8635, 91.8635, 91.8635, 95.1444, 98.4252, 95.1444, 88.5827, 78.7402, 68.8976, 65.6168, 62.336, 68.8976, 72.1785, 65.6168],\n [9.84252, 9.84252, 13.1234, 19.685, 13.1234, 9.84252, 13.1234, 16.4042, 13.1234, 13.1234, 13.1234, 13.1234, 16.4042, 16.4042, 19.685, 13.1234, 13.1234, 16.4042, 16.4042, 13.1234, 16.4042, 19.685, 22.9659, 29.5276, 26.2467, 26.2467, 26.2467, 29.5276, 29.5276, 22.9659, 22.9659, 22.9659, 22.9659, 26.2467, 32.8084, 36.0892, 39.3701, 39.3701, 36.0892, 39.3701, 45.9318, 49.2126, 49.2126, 52.4934, 59.0551, 65.6168, 68.8976, 75.4593, 85.3018, 91.8635, 91.8635, 91.8635, 91.8635, 91.8635, 91.8635, 91.8635, 88.5827, 75.4593, 68.8976, 62.336, 59.0551, 65.6168, 72.1785, 72.1785],\n [13.1234, 13.1234, 16.4042, 19.685, 16.4042, 16.4042, 13.1234, 9.84252, 9.84252, 9.84252, 9.84252, 16.4042, 19.685, 19.685, 19.685, 16.4042, 16.4042, 13.1234, 13.1234, 16.4042, 19.685, 19.685, 26.2467, 29.5276, 26.2467, 26.2467, 29.5276, 29.5276, 29.5276, 22.9659, 22.9659, 26.2467, 29.5276, 32.8084, 36.0892, 36.0892, 36.0892, 36.0892, 32.8084, 36.0892, 42.6509, 45.9318, 45.9318, 52.4934, 59.0551, 65.6168, 68.8976, 75.4593, 82.021, 91.8635, 95.1444, 91.8635, 91.8635, 88.5827, 82.021, 82.021, 78.7402, 75.4593, 65.6168, 62.336, 62.336, 62.336, 59.0551, 55.7743],\n [16.4042, 16.4042, 16.4042, 16.4042, 16.4042, 16.4042, 13.1234, 6.56168, 6.56168, 9.84252, 13.1234, 13.1234, 19.685, 19.685, 19.685, 19.685, 16.4042, 13.1234, 16.4042, 19.685, 19.685, 26.2467, 29.5276, 26.2467, 16.4042, 19.685, 19.685, 16.4042, 19.685, 22.9659, 22.9659, 26.2467, 29.5276, 36.0892, 39.3701, 36.0892, 36.0892, 39.3701, 39.3701, 39.3701, 39.3701, 42.6509, 45.9318, 52.4934, 62.336, 65.6168, 68.8976, 72.1785, 78.7402, 85.3018, 88.5827, 88.5827, 85.3018, 78.7402, 75.4593, 72.1785, 72.1785, 68.8976, 62.336, 65.6168, 65.6168, 62.336, 52.4934, 45.9318],\n [22.9659, 19.685, 13.1234, 13.1234, 13.1234, 16.4042, 13.1234, 6.56168, 6.56168, 9.84252, 13.1234, 9.84252, 16.4042, 22.9659, 22.9659, 19.685, 13.1234, 13.1234, 19.685, 19.685, 16.4042, 22.9659, 26.2467, 22.9659, 16.4042, 19.685, 16.4042, 13.1234, 16.4042, 22.9659, 26.2467, 26.2467, 26.2467, 36.0892, 36.0892, 36.0892, 32.8084, 39.3701, 42.6509, 42.6509, 42.6509, 49.2126, 49.2126, 52.4934, 59.0551, 62.336, 65.6168, 68.8976, 72.1785, 78.7402, 82.021, 82.021, 78.7402, 72.1785, 62.336, 62.336, 65.6168, 65.6168, 65.6168, 72.1785, 72.1785, 68.8976, 68.8976, 65.6168],\n [19.685, 16.4042, 13.1234, 13.1234, 13.1234, 19.685, 16.4042, 6.56168, 9.84252, 13.1234, 13.1234, 16.4042, 19.685, 22.9659, 19.685, 13.1234, 13.1234, 13.1234, 19.685, 16.4042, 9.84252, 16.4042, 19.685, 22.9659, 26.2467, 26.2467, 22.9659, 19.685, 22.9659, 26.2467, 26.2467, 22.9659, 22.9659, 26.2467, 32.8084, 32.8084, 36.0892, 42.6509, 42.6509, 42.6509, 49.2126, 52.4934, 55.7743, 55.7743, 59.0551, 62.336, 62.336, 65.6168, 68.8976, 72.1785, 75.4593, 78.7402, 78.7402, 75.4593, 68.8976, 62.336, 65.6168, 68.8976, 68.8976, 72.1785, 65.6168, 68.8976, 75.4593, 68.8976],\n [13.1234, 16.4042, 16.4042, 16.4042, 16.4042, 13.1234, 13.1234, 13.1234, 16.4042, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 19.685, 13.1234, 13.1234, 16.4042, 16.4042, 13.1234, 13.1234, 13.1234, 16.4042, 22.9659, 26.2467, 29.5276, 22.9659, 22.9659, 26.2467, 22.9659, 26.2467, 29.5276, 29.5276, 29.5276, 29.5276, 32.8084, 39.3701, 42.6509, 42.6509, 42.6509, 49.2126, 52.4934, 55.7743, 62.336, 65.6168, 65.6168, 65.6168, 68.8976, 72.1785, 78.7402, 82.021, 85.3018, 91.8635, 88.5827, 82.021, 75.4593, 72.1785, 72.1785, 68.8976, 68.8976, 59.0551, 62.336, 68.8976, 62.336],\n [16.4042, 16.4042, 19.685, 19.685, 16.4042, 13.1234, 13.1234, 16.4042, 16.4042, 22.9659, 19.685, 22.9659, 26.2467, 29.5276, 22.9659, 16.4042, 16.4042, 19.685, 19.685, 19.685, 16.4042, 16.4042, 16.4042, 22.9659, 26.2467, 22.9659, 22.9659, 26.2467, 29.5276, 29.5276, 32.8084, 36.0892, 36.0892, 36.0892, 32.8084, 32.8084, 39.3701, 42.6509, 42.6509, 45.9318, 52.4934, 55.7743, 55.7743, 62.336, 68.8976, 72.1785, 72.1785, 75.4593, 82.021, 88.5827, 91.8635, 95.1444, 101.706, 101.706, 95.1444, 91.8635, 82.021, 75.4593, 68.8976, 62.336, 55.7743, 62.336, 65.6168, 59.0551],\n [19.685, 19.685, 19.685, 19.685, 22.9659, 19.685, 16.4042, 13.1234, 9.84252, 13.1234, 16.4042, 19.685, 26.2467, 26.2467, 26.2467, 22.9659, 19.685, 22.9659, 22.9659, 22.9659, 22.9659, 19.685, 16.4042, 19.685, 22.9659, 22.9659, 26.2467, 29.5276, 32.8084, 29.5276, 39.3701, 39.3701, 36.0892, 36.0892, 36.0892, 36.0892, 39.3701, 45.9318, 45.9318, 49.2126, 52.4934, 55.7743, 59.0551, 62.336, 68.8976, 72.1785, 75.4593, 78.7402, 85.3018, 91.8635, 95.1444, 101.706, 108.268, 108.268, 104.987, 101.706, 91.8635, 78.7402, 68.8976, 59.0551, 55.7743, 65.6168, 68.8976, 55.7743],\n [22.9659, 22.9659, 16.4042, 16.4042, 22.9659, 26.2467, 22.9659, 16.4042, 9.84252, 6.56168, 9.84252, 16.4042, 16.4042, 19.685, 22.9659, 22.9659, 16.4042, 19.685, 19.685, 26.2467, 29.5276, 22.9659, 16.4042, 19.685, 22.9659, 22.9659, 26.2467, 29.5276, 29.5276, 29.5276, 36.0892, 39.3701, 36.0892, 32.8084, 32.8084, 36.0892, 42.6509, 45.9318, 49.2126, 52.4934, 52.4934, 55.7743, 59.0551, 65.6168, 65.6168, 68.8976, 72.1785, 78.7402, 82.021, 85.3018, 95.1444, 101.706, 104.987, 111.549, 108.268, 101.706, 91.8635, 82.021, 72.1785, 59.0551, 59.0551, 68.8976, 68.8976, 55.7743],\n [22.9659, 19.685, 19.685, 19.685, 22.9659, 26.2467, 22.9659, 19.685, 13.1234, 13.1234, 16.4042, 13.1234, 16.4042, 19.685, 19.685, 16.4042, 13.1234, 16.4042, 22.9659, 22.9659, 26.2467, 16.4042, 9.84252, 16.4042, 22.9659, 26.2467, 29.5276, 32.8084, 26.2467, 29.5276, 36.0892, 39.3701, 39.3701, 36.0892, 32.8084, 39.3701, 42.6509, 45.9318, 49.2126, 49.2126, 52.4934, 59.0551, 59.0551, 62.336, 65.6168, 68.8976, 72.1785, 75.4593, 82.021, 85.3018, 91.8635, 98.4252, 104.987, 108.268, 108.268, 98.4252, 95.1444, 85.3018, 75.4593, 65.6168, 59.0551, 65.6168, 65.6168, 55.7743],\n [19.685, 19.685, 22.9659, 22.9659, 22.9659, 22.9659, 16.4042, 9.84252, 9.84252, 16.4042, 19.685, 19.685, 22.9659, 26.2467, 22.9659, 16.4042, 13.1234, 19.685, 22.9659, 22.9659, 19.685, 13.1234, 9.84252, 9.84252, 22.9659, 29.5276, 32.8084, 29.5276, 26.2467, 26.2467, 32.8084, 39.3701, 39.3701, 39.3701, 39.3701, 42.6509, 42.6509, 42.6509, 42.6509, 45.9318, 52.4934, 62.336, 65.6168, 65.6168, 65.6168, 72.1785, 75.4593, 78.7402, 82.021, 88.5827, 91.8635, 98.4252, 101.706, 108.268, 108.268, 104.987, 95.1444, 88.5827, 78.7402, 72.1785, 65.6168, 65.6168, 65.6168, 59.0551],\n [26.2467, 26.2467, 26.2467, 19.685, 16.4042, 19.685, 16.4042, 6.56168, 6.56168, 16.4042, 19.685, 22.9659, 22.9659, 22.9659, 22.9659, 19.685, 16.4042, 19.685, 22.9659, 22.9659, 16.4042, 16.4042, 16.4042, 16.4042, 26.2467, 29.5276, 26.2467, 26.2467, 26.2467, 29.5276, 36.0892, 36.0892, 39.3701, 42.6509, 42.6509, 45.9318, 45.9318, 42.6509, 45.9318, 52.4934, 55.7743, 62.336, 65.6168, 65.6168, 68.8976, 68.8976, 75.4593, 82.021, 85.3018, 91.8635, 98.4252, 101.706, 104.987, 108.268, 111.549, 108.268, 101.706, 91.8635, 82.021, 68.8976, 65.6168, 72.1785, 75.4593, 68.8976],\n [29.5276, 29.5276, 22.9659, 16.4042, 16.4042, 22.9659, 19.685, 9.84252, 9.84252, 16.4042, 22.9659, 19.685, 13.1234, 16.4042, 19.685, 22.9659, 19.685, 16.4042, 22.9659, 22.9659, 19.685, 16.4042, 22.9659, 29.5276, 29.5276, 26.2467, 26.2467, 26.2467, 26.2467, 32.8084, 36.0892, 39.3701, 42.6509, 42.6509, 42.6509, 42.6509, 45.9318, 45.9318, 45.9318, 49.2126, 55.7743, 62.336, 65.6168, 68.8976, 72.1785, 72.1785, 78.7402, 82.021, 88.5827, 95.1444, 98.4252, 101.706, 108.268, 111.549, 111.549, 111.549, 108.268, 104.987, 88.5827, 65.6168, 59.0551, 65.6168, 75.4593, 75.4593],\n [29.5276, 26.2467, 19.685, 13.1234, 19.685, 26.2467, 22.9659, 13.1234, 13.1234, 19.685, 16.4042, 13.1234, 13.1234, 13.1234, 19.685, 22.9659, 19.685, 16.4042, 19.685, 16.4042, 16.4042, 19.685, 26.2467, 29.5276, 29.5276, 26.2467, 26.2467, 26.2467, 29.5276, 32.8084, 39.3701, 42.6509, 45.9318, 45.9318, 42.6509, 42.6509, 45.9318, 45.9318, 45.9318, 52.4934, 55.7743, 62.336, 65.6168, 68.8976, 72.1785, 75.4593, 78.7402, 82.021, 88.5827, 95.1444, 101.706, 101.706, 104.987, 111.549, 114.829, 114.829, 114.829, 108.268, 91.8635, 68.8976, 62.336, 62.336, 65.6168, 65.6168],\n [29.5276, 29.5276, 22.9659, 13.1234, 16.4042, 19.685, 19.685, 13.1234, 13.1234, 16.4042, 13.1234, 9.84252, 13.1234, 16.4042, 16.4042, 22.9659, 19.685, 13.1234, 9.84252, 9.84252, 16.4042, 22.9659, 26.2467, 22.9659, 22.9659, 29.5276, 26.2467, 26.2467, 29.5276, 32.8084, 32.8084, 36.0892, 39.3701, 45.9318, 45.9318, 42.6509, 42.6509, 45.9318, 52.4934, 55.7743, 55.7743, 59.0551, 62.336, 68.8976, 72.1785, 75.4593, 78.7402, 82.021, 88.5827, 95.1444, 101.706, 104.987, 104.987, 111.549, 111.549, 111.549, 114.829, 108.268, 95.1444, 78.7402, 72.1785, 65.6168, 62.336, 55.7743],\n [26.2467, 26.2467, 26.2467, 16.4042, 9.84252, 16.4042, 13.1234, 9.84252, 13.1234, 16.4042, 13.1234, 13.1234, 16.4042, 16.4042, 19.685, 22.9659, 22.9659, 16.4042, 13.1234, 16.4042, 19.685, 26.2467, 26.2467, 19.685, 19.685, 29.5276, 26.2467, 22.9659, 26.2467, 32.8084, 29.5276, 29.5276, 32.8084, 42.6509, 49.2126, 45.9318, 42.6509, 45.9318, 49.2126, 52.4934, 55.7743, 62.336, 65.6168, 65.6168, 68.8976, 75.4593, 78.7402, 82.021, 88.5827, 95.1444, 98.4252, 101.706, 104.987, 111.549, 114.829, 118.11, 118.11, 111.549, 98.4252, 85.3018, 75.4593, 65.6168, 59.0551, 49.2126],\n [19.685, 16.4042, 19.685, 16.4042, 9.84252, 16.4042, 19.685, 16.4042, 16.4042, 16.4042, 13.1234, 19.685, 22.9659, 22.9659, 26.2467, 29.5276, 22.9659, 16.4042, 16.4042, 22.9659, 26.2467, 26.2467, 22.9659, 16.4042, 19.685, 26.2467, 26.2467, 22.9659, 26.2467, 36.0892, 32.8084, 32.8084, 36.0892, 42.6509, 49.2126, 45.9318, 42.6509, 45.9318, 52.4934, 52.4934, 55.7743, 62.336, 65.6168, 65.6168, 72.1785, 78.7402, 82.021, 82.021, 88.5827, 95.1444, 98.4252, 101.706, 104.987, 111.549, 114.829, 118.11, 121.391, 114.829, 104.987, 88.5827, 75.4593, 68.8976, 59.0551, 45.9318],\n [19.685, 16.4042, 16.4042, 13.1234, 13.1234, 19.685, 22.9659, 26.2467, 19.685, 16.4042, 19.685, 26.2467, 32.8084, 26.2467, 26.2467, 26.2467, 19.685, 13.1234, 19.685, 22.9659, 26.2467, 26.2467, 19.685, 16.4042, 19.685, 22.9659, 26.2467, 26.2467, 26.2467, 26.2467, 32.8084, 36.0892, 39.3701, 45.9318, 45.9318, 42.6509, 42.6509, 49.2126, 55.7743, 59.0551, 62.336, 65.6168, 65.6168, 68.8976, 75.4593, 78.7402, 78.7402, 85.3018, 91.8635, 95.1444, 95.1444, 101.706, 104.987, 108.268, 114.829, 118.11, 121.391, 118.11, 108.268, 91.8635, 72.1785, 65.6168, 55.7743, 45.9318],\n [16.4042, 13.1234, 13.1234, 13.1234, 16.4042, 19.685, 19.685, 16.4042, 16.4042, 16.4042, 22.9659, 26.2467, 26.2467, 22.9659, 19.685, 19.685, 16.4042, 16.4042, 19.685, 19.685, 19.685, 22.9659, 19.685, 22.9659, 22.9659, 26.2467, 26.2467, 29.5276, 26.2467, 22.9659, 26.2467, 29.5276, 36.0892, 39.3701, 42.6509, 42.6509, 45.9318, 49.2126, 55.7743, 65.6168, 65.6168, 62.336, 65.6168, 72.1785, 75.4593, 78.7402, 82.021, 85.3018, 88.5827, 91.8635, 91.8635, 98.4252, 101.706, 108.268, 111.549, 118.11, 118.11, 114.829, 104.987, 95.1444, 78.7402, 72.1785, 62.336, 52.4934],\n [9.84252, 13.1234, 16.4042, 16.4042, 19.685, 19.685, 19.685, 16.4042, 16.4042, 16.4042, 19.685, 22.9659, 19.685, 13.1234, 19.685, 19.685, 19.685, 16.4042, 16.4042, 16.4042, 19.685, 22.9659, 26.2467, 29.5276, 26.2467, 19.685, 22.9659, 26.2467, 26.2467, 22.9659, 22.9659, 26.2467, 32.8084, 39.3701, 39.3701, 45.9318, 45.9318, 45.9318, 55.7743, 62.336, 62.336, 62.336, 68.8976, 72.1785, 75.4593, 78.7402, 82.021, 85.3018, 91.8635, 95.1444, 98.4252, 101.706, 101.706, 108.268, 111.549, 114.829, 114.829, 111.549, 104.987, 95.1444, 82.021, 72.1785, 72.1785, 62.336],\n [16.4042, 19.685, 19.685, 19.685, 19.685, 19.685, 19.685, 19.685, 19.685, 19.685, 19.685, 22.9659, 19.685, 16.4042, 19.685, 19.685, 19.685, 19.685, 19.685, 19.685, 19.685, 19.685, 26.2467, 29.5276, 22.9659, 19.685, 19.685, 26.2467, 26.2467, 22.9659, 26.2467, 32.8084, 36.0892, 39.3701, 39.3701, 39.3701, 45.9318, 45.9318, 49.2126, 55.7743, 59.0551, 62.336, 72.1785, 72.1785, 72.1785, 78.7402, 82.021, 85.3018, 91.8635, 98.4252, 104.987, 104.987, 108.268, 108.268, 111.549, 114.829, 114.829, 111.549, 104.987, 98.4252, 82.021, 72.1785, 65.6168, 65.6168],\n [19.685, 22.9659, 22.9659, 19.685, 16.4042, 16.4042, 19.685, 19.685, 19.685, 19.685, 19.685, 19.685, 19.685, 16.4042, 19.685, 22.9659, 22.9659, 22.9659, 22.9659, 26.2467, 26.2467, 19.685, 22.9659, 26.2467, 26.2467, 26.2467, 22.9659, 26.2467, 26.2467, 26.2467, 26.2467, 32.8084, 39.3701, 42.6509, 42.6509, 45.9318, 49.2126, 49.2126, 49.2126, 52.4934, 55.7743, 62.336, 75.4593, 75.4593, 78.7402, 82.021, 85.3018, 85.3018, 91.8635, 98.4252, 104.987, 108.268, 108.268, 111.549, 114.829, 114.829, 114.829, 114.829, 108.268, 101.706, 85.3018, 75.4593, 72.1785, 68.8976],\n [19.685, 26.2467, 26.2467, 19.685, 16.4042, 19.685, 19.685, 13.1234, 16.4042, 19.685, 19.685, 19.685, 19.685, 16.4042, 19.685, 22.9659, 22.9659, 26.2467, 26.2467, 26.2467, 29.5276, 26.2467, 22.9659, 26.2467, 32.8084, 32.8084, 29.5276, 26.2467, 26.2467, 26.2467, 26.2467, 32.8084, 39.3701, 42.6509, 49.2126, 49.2126, 49.2126, 49.2126, 49.2126, 52.4934, 59.0551, 65.6168, 75.4593, 82.021, 78.7402, 78.7402, 82.021, 85.3018, 91.8635, 95.1444, 98.4252, 104.987, 108.268, 111.549, 114.829, 114.829, 118.11, 118.11, 114.829, 101.706, 85.3018, 75.4593, 75.4593, 72.1785],\n [19.685, 19.685, 22.9659, 19.685, 16.4042, 16.4042, 19.685, 16.4042, 19.685, 19.685, 19.685, 22.9659, 22.9659, 22.9659, 22.9659, 19.685, 19.685, 22.9659, 29.5276, 32.8084, 32.8084, 29.5276, 26.2467, 26.2467, 32.8084, 32.8084, 29.5276, 29.5276, 29.5276, 29.5276, 29.5276, 36.0892, 42.6509, 45.9318, 45.9318, 45.9318, 49.2126, 49.2126, 52.4934, 55.7743, 62.336, 65.6168, 72.1785, 78.7402, 78.7402, 82.021, 85.3018, 88.5827, 88.5827, 91.8635, 95.1444, 101.706, 108.268, 108.268, 111.549, 114.829, 121.391, 124.672, 118.11, 101.706, 85.3018, 78.7402, 75.4593, 72.1785],\n [19.685, 16.4042, 19.685, 16.4042, 16.4042, 19.685, 22.9659, 19.685, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 26.2467, 19.685, 19.685, 22.9659, 29.5276, 29.5276, 29.5276, 26.2467, 26.2467, 26.2467, 26.2467, 26.2467, 26.2467, 32.8084, 36.0892, 36.0892, 36.0892, 42.6509, 45.9318, 42.6509, 42.6509, 45.9318, 49.2126, 52.4934, 55.7743, 59.0551, 65.6168, 65.6168, 68.8976, 75.4593, 78.7402, 85.3018, 88.5827, 88.5827, 88.5827, 91.8635, 95.1444, 98.4252, 101.706, 108.268, 111.549, 118.11, 124.672, 127.953, 121.391, 104.987, 88.5827, 82.021, 75.4593, 68.8976],\n [16.4042, 16.4042, 19.685, 16.4042, 16.4042, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 26.2467, 26.2467, 26.2467, 22.9659, 22.9659, 22.9659, 26.2467, 29.5276, 26.2467, 26.2467, 26.2467, 26.2467, 26.2467, 26.2467, 22.9659, 29.5276, 32.8084, 36.0892, 39.3701, 36.0892, 39.3701, 42.6509, 45.9318, 45.9318, 45.9318, 49.2126, 52.4934, 55.7743, 59.0551, 65.6168, 65.6168, 68.8976, 75.4593, 78.7402, 82.021, 85.3018, 88.5827, 91.8635, 91.8635, 95.1444, 98.4252, 104.987, 111.549, 118.11, 121.391, 124.672, 131.234, 127.953, 121.391, 98.4252, 85.3018, 72.1785, 62.336],\n [16.4042, 19.685, 19.685, 16.4042, 16.4042, 19.685, 19.685, 19.685, 19.685, 19.685, 22.9659, 26.2467, 26.2467, 26.2467, 22.9659, 26.2467, 29.5276, 29.5276, 29.5276, 26.2467, 26.2467, 29.5276, 29.5276, 26.2467, 26.2467, 26.2467, 32.8084, 36.0892, 32.8084, 36.0892, 32.8084, 36.0892, 42.6509, 42.6509, 45.9318, 45.9318, 49.2126, 52.4934, 55.7743, 59.0551, 65.6168, 68.8976, 72.1785, 72.1785, 75.4593, 82.021, 88.5827, 91.8635, 95.1444, 98.4252, 98.4252, 101.706, 104.987, 111.549, 114.829, 121.391, 124.672, 131.234, 131.234, 127.953, 111.549, 91.8635, 75.4593, 65.6168],\n [16.4042, 16.4042, 16.4042, 16.4042, 19.685, 19.685, 19.685, 16.4042, 19.685, 22.9659, 26.2467, 26.2467, 26.2467, 29.5276, 29.5276, 29.5276, 29.5276, 29.5276, 29.5276, 22.9659, 22.9659, 22.9659, 22.9659, 26.2467, 29.5276, 32.8084, 32.8084, 32.8084, 36.0892, 36.0892, 36.0892, 39.3701, 42.6509, 42.6509, 39.3701, 42.6509, 49.2126, 52.4934, 59.0551, 62.336, 65.6168, 72.1785, 72.1785, 75.4593, 78.7402, 82.021, 88.5827, 91.8635, 95.1444, 98.4252, 101.706, 101.706, 104.987, 108.268, 114.829, 118.11, 124.672, 131.234, 131.234, 124.672, 118.11, 101.706, 75.4593, 68.8976],\n [19.685, 16.4042, 16.4042, 19.685, 22.9659, 22.9659, 19.685, 19.685, 22.9659, 26.2467, 26.2467, 22.9659, 26.2467, 29.5276, 29.5276, 32.8084, 29.5276, 29.5276, 26.2467, 22.9659, 22.9659, 19.685, 19.685, 22.9659, 29.5276, 29.5276, 22.9659, 29.5276, 32.8084, 36.0892, 32.8084, 39.3701, 39.3701, 39.3701, 42.6509, 45.9318, 52.4934, 52.4934, 55.7743, 62.336, 65.6168, 72.1785, 72.1785, 75.4593, 78.7402, 82.021, 85.3018, 88.5827, 91.8635, 98.4252, 104.987, 104.987, 108.268, 111.549, 114.829, 114.829, 124.672, 127.953, 127.953, 124.672, 121.391, 108.268, 82.021, 65.6168],\n [19.685, 19.685, 16.4042, 19.685, 22.9659, 22.9659, 19.685, 19.685, 22.9659, 22.9659, 22.9659, 19.685, 22.9659, 26.2467, 26.2467, 26.2467, 26.2467, 26.2467, 29.5276, 29.5276, 22.9659, 19.685, 16.4042, 19.685, 22.9659, 22.9659, 19.685, 22.9659, 32.8084, 32.8084, 32.8084, 36.0892, 42.6509, 45.9318, 45.9318, 49.2126, 52.4934, 55.7743, 55.7743, 59.0551, 68.8976, 75.4593, 75.4593, 75.4593, 78.7402, 85.3018, 88.5827, 91.8635, 91.8635, 95.1444, 104.987, 108.268, 111.549, 114.829, 118.11, 118.11, 121.391, 124.672, 124.672, 124.672, 124.672, 111.549, 91.8635, 68.8976],\n [19.685, 19.685, 19.685, 22.9659, 22.9659, 19.685, 16.4042, 19.685, 19.685, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 19.685, 26.2467, 29.5276, 32.8084, 32.8084, 29.5276, 22.9659, 19.685, 22.9659, 26.2467, 22.9659, 19.685, 22.9659, 29.5276, 32.8084, 32.8084, 39.3701, 42.6509, 49.2126, 49.2126, 45.9318, 52.4934, 55.7743, 55.7743, 62.336, 65.6168, 72.1785, 75.4593, 75.4593, 78.7402, 82.021, 88.5827, 91.8635, 91.8635, 95.1444, 104.987, 111.549, 114.829, 118.11, 121.391, 124.672, 127.953, 124.672, 124.672, 124.672, 124.672, 118.11, 101.706, 75.4593],\n [22.9659, 22.9659, 22.9659, 22.9659, 19.685, 19.685, 19.685, 19.685, 22.9659, 26.2467, 26.2467, 22.9659, 22.9659, 22.9659, 22.9659, 26.2467, 29.5276, 32.8084, 29.5276, 32.8084, 29.5276, 26.2467, 26.2467, 26.2467, 29.5276, 22.9659, 19.685, 26.2467, 29.5276, 32.8084, 36.0892, 36.0892, 39.3701, 45.9318, 49.2126, 45.9318, 49.2126, 52.4934, 59.0551, 62.336, 68.8976, 68.8976, 72.1785, 78.7402, 78.7402, 82.021, 85.3018, 88.5827, 91.8635, 98.4252, 104.987, 111.549, 114.829, 118.11, 124.672, 134.514, 134.514, 134.514, 131.234, 131.234, 127.953, 121.391, 104.987, 85.3018],\n [22.9659, 22.9659, 22.9659, 19.685, 19.685, 22.9659, 19.685, 19.685, 19.685, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 22.9659, 29.5276, 32.8084, 29.5276, 29.5276, 32.8084, 29.5276, 26.2467, 29.5276, 32.8084, 29.5276, 26.2467, 22.9659, 26.2467, 29.5276, 36.0892, 39.3701, 39.3701, 39.3701, 45.9318, 49.2126, 49.2126, 49.2126, 52.4934, 62.336, 65.6168, 65.6168, 68.8976, 72.1785, 78.7402, 82.021, 85.3018, 85.3018, 88.5827, 95.1444, 98.4252, 104.987, 104.987, 111.549, 118.11, 124.672, 134.514, 137.795, 141.076, 141.076, 141.076, 134.514, 127.953, 114.829, 98.4252]\n ];\n }", "function fillArray() {\n\n let inputValue = document.getElementById('ingreso');\n let arrayPrimeNumber = [];\n console.time(\"Iniciodefuerzabruta\");\n for (let i = 0; i < Number(inputValue.value); i++) {\n let numberPrime = isPrime();\n if (numberPrime === null) {\n i--;\n } else {\n arrayPrimeNumber[i] = numberPrime;\n }\n\n }\n console.timeEnd(\"Iniciodefuerzabruta\");\n\n console.log(arrayPrimeNumber);\n let maximo = 0;\n for (let x = 0; x < arrayPrimeNumber.length; x++) {\n if (maximo < arrayPrimeNumber[x]) {\n maximo = arrayPrimeNumber[x];\n }\n }\n console.log(maximo);\n\n\n\n}", "function convertGI() {\n //Cria copia da CTMC\n ctmcGI = [];\n for (var i = 0; i < ctmc.length; i++) {\n ctmcGI.push(ctmc[i].slice());\n }\n //Executa logica na diagonal principal da ctmcGI\n for (let i = 0; i < ctmcGI.length; i++) {\n let soma = 0;\n for (let j = 0; j < ctmcGI[i].length; j++) {\n soma += ctmcGI[i][j];\n }\n ctmcGI[i][i] = soma * (-1);\n }\n console.log(\"Gerador Infinitesimal:\");\n console.log(ctmcGI);\n}", "function impares(platillos) {\r\n\r\n let cont = 1;\r\n let arregloPlatillos = [];\r\n for (let i = 0; i < platillos.length; i++) {\r\n if (cont % 2 != 0) {\r\n arregloPlatillos.push(platillos[i]);\r\n }\r\n cont++;\r\n }\r\n return arregloPlatillos;\r\n}", "function sortChart(arr_treated) {\n //premier element = tableau auquel on se réfère, le reste ce sont des séries de stats pour les pays\n var joint_arr = JSON.parse(JSON.stringify(arr_treated.shift()));\n var country_arr = JSON.parse(JSON.stringify(arr_treated));\n //On parcourt la totalité des mots\n var len_joint_arr = joint_arr.length;\n //Pour chaque mot dans le tableau global, j compte les mots\n var array = [];\n for (var i = 0; i < country_arr.length; i++) {\n array.push([]);\n }\n //array_res = [ [], [], [], [] ];\n var res = JSON.parse(JSON.stringify(array));\n for (var j = 0; j < len_joint_arr; j++) {\n var current_word = JSON.parse(JSON.stringify(joint_arr[j][0]));\n //Pour chaque mot, on traite chaque tableau, k parcours les séries des pays\n for (var k = 0; k < country_arr.length; k++) {\n var current_country = JSON.parse(JSON.stringify(country_arr[k]));\n //Si l'index existe dans le tableau du pays courant\n var index = JSON.parse(JSON.stringify(exist(current_word, current_country)));\n if (index !== null) {\n res[k].push(JSON.parse(JSON.stringify(current_country[index])));\n } else {\n res[k].push(null);\n }\n }\n }\n return [joint_arr].concat(res);\n}", "function cargarProvincias() {\n //Inicializamos el array.\n let array = [\"Guayaquil\",\n \"Quito\",\n \"Cuenca\",\n \"Santo Domingo\",\n \"Machala\",\n \"Duran\",\n \"Manta\",\n \"Portoviejo\",\n \"Loja\",\n \"Ambato\",\n \"Esmeraldas\",\n \"Quevedo\",\n \"Riobamba\",\n \"Gualaceo\",\n \"Cariamanga\",\n \"Montalvo\",\n \"Macara\",\n\n \"Zamora\",\n \"Puerto Ayora\",\n \"Salitre\",\n \"Tosagua\",\n \"Pelileo\",\n \"Pujili\",\n \"Tabacundo\",\n \"Puerto Lopez\",\n \"San Vicente\",\n \"Santa Ana\",\n \"Zaruma\",\n \"Balao\",\n \"Rocafuerte\",\n \"Yantzaza\",\n \"Cotacachi\",\n \"Santa Lucia\",\n \"Cumanda\",\n \"Palestina\",\n \"Alfredo Baquerizo Moreno\",\n \"Nobol\",\n \"Mocache\",\n \"Puebloviejo\",\n \"Portovelo\",\n \"Sucua\",\n \"Guano\",\n \"Pillaro\",\n \"Gualaquiza\",\n \"Paute\",\n \"Saquisili\",\n \"Pajan\",\n \"San Miguel\",\n \"Puerto Baquerizo Moreno\",\n \"Catacocha\",\n \"Palenque\",\n \"Alausi\",\n \"Catarama\",\n \"Flavio Alfaro\",\n \"Colimes\",\n \"Echeandia\",\n \"Jama\",\n \"Isidro Ayora\",\n \"Muisne\",\n \"Santa Isabel\",\n \"Pedro Vicente Maldonado\",\n \"Biblian\",\n \"Archidona\",\n \"Junin\",\n \"Baba\",\n \"Pimampiro\",\n \"Camilo Ponce Enriquez\",\n \"El Tambo\",\n \"El Angel\",\n \"Alamor\",\n \"Chambo\",\n \"Celica\",\n \"Chordeleg\",\n \"Balsas\",\n \"Saraguro\",\n \"El Chaco\",\n \"Giron\",\n \"Huaca\",\n \"Chunchi\",\n \"Pallatanga\",\n \"Marcabeli\",\n \"Sigsig\",\n \"Urcuqui\",\n \"Loreto\",\n \"Rioverde\",\n \"Zumba\",\n \"Palora\",\n \"Mira\",\n \"El Pangui\",\n \"Puerto Quito\",\n \"Sucre\",\n \"Chillanes\",\n \"Quero\",\n \"Guamote\",\n \"Cevallos\",\n \"Zapotillo\",\n \"Zumbi\",\n \"Patate\",\n \"Puerto Villamil\",\n \"Lumbaqui\",\n \"Palanda\",\n \"Sigchos\",\n \"Pindal\",\n \"Guayzimi\",\n \"Baeza\",\n \"El Corazon\",\n \"Paccha\",\n \"Amaluza\",\n \"Las Naves\",\n \"San Fernando\",\n \"Gonzanama\",\n \"San Juan Bosco\",\n \"Yacuambi\",\n \"Santa Clara\",\n \"Arajuno\",\n \"Tarapoa\",\n \"Tisaleo\",\n \"Suscal\",\n \"Nabon\",\n \"Mocha\",\n \"La Victoria\",\n \"Guachapala\",\n \"Santiago\",\n \"Chaguarpamba\",\n \"Penipe\",\n \"Chilla\",\n \"Paquisha\",\n \"Carlos Julio Arosemena Tola\",\n \"Sozoranga\",\n \"Pucara\",\n \"Huamboya\",\n \"Quilanga\",\n \"Mera\",\n \"Olmedo\",\n \"Deleg\",\n \"La Bonita\",\n \"El Pan\",\n \"Tiputini\"\n ];\n //Ordena el array alfabeticamente.\n array.sort();\n //Pasamos a la funcion addOptions(el ID del select, las provincias cargadas en el array).\n addOptions(\"provincia\", array);\n}", "static change(array) {\n let change = [];\n array.reduce(function (accumulator, currentValue, currentIndex, array) {\n if (currentIndex === 0) {\n accumulator = currentValue;\n }\n change.push(currentValue - accumulator);\n return currentValue;\n }, array[0]);\n return change;\n }", "function incluyeOpcionVacia(datos) {\n\tvar datos2 = new Array();\n\tdatos2[0] = ['',''];\n\t\n\tfor (var i=0;i<datos.length;i++) {\n \tdatos2[i+1] = datos[i];\n\t}\n\treturn datos2;\n}", "function incluyeOpcionVacia(datos) {\n\tvar datos2 = new Array();\n\tdatos2[0] = ['',''];\n\t\n\tfor (var i=0;i<datos.length;i++) {\n \tdatos2[i+1] = datos[i];\n\t}\n\treturn datos2;\n}", "radiansArraytoPositivePeriodicFractions(data) {\n const n = data.length;\n for (let i = 0; i < n; i++) {\n data.reassign(i, this.radiansToPositivePeriodicFraction(data.at(i)));\n }\n }", "function multiplies(array) {\n var minElement = []\n var trenutniMinimum = array[0];\n var position = 0;\n for (var i = 0; i < array.length; i++) {\n var trenutniElement = array[i]\n if (trenutniMinimum > trenutniElement) {\n trenutniMinimum = trenutniElement;\n position = i\n\n }\n }\n minElement = [trenutniMinimum, position]\n return minElement\n}", "function crearniveles() {\n let niveles = [];\n let fila = 0;\n let columna = 0;\n niveles[0] = [];\n for (let c = 1; c < 21; c++) {\n niveles[0][c - 1] =\n {\n tipo: 0,\n fila: fila + 3,\n columna: columna,\n }\n if (c % 10 == 0) {\n fila++;\n columna = 0;\n } else {\n columna++;\n }\n }\n fila = 0;\n columna = 0;\n niveles[1] = [];\n for (let c = 1; c < 41; c++) {\n \tniveles[1][c - 1] =\n {\n \ttipo: 0,\n \tfila: fila + 3,\n \tcolumna: columna,\n }\n \tif (c % 10 == 0) {\n \t\tfila++;\n \t\tcolumna = 0;\n \t} else {\n \t\tcolumna++;\n \t}\n }\n\n return niveles;\n }", "function myArr(mili) {\n 'use strict';\n\n // Only change code below this line\n // Using mili = [4, 10, 25] would be invalid\n milili[0]= mili[0];\n milili[1]= mili[1];\n milili[2]= mili[2];\n // console.log(milili);\n // Only change code above this line\n return mili;\n}", "function chairs(arr) {\n const arrLength = arr.length;\n const needChairs = arr[arrLength - 1];\n const roomsCount = arrLength - 1;\n let chairsHave = 0;\n let chairsTake = new Array();\n for(let i = 0; i < roomsCount; i++){\n if(chairsHave != needChairs){\n const peopleInRoom = arr[i][0].length;\n const chairsInRoom = arr[i][1];\n const availableChairs = chairsInRoom - peopleInRoom;\n if(availableChairs > 0){\n if((chairsHave + availableChairs) > needChairs){\n chairsTake.push(needChairs - chairsHave);\n chairsHave = needChairs;\n }\n else{\n chairsTake.push(availableChairs);\n chairsHave += availableChairs;\n }\n }\n else{\n chairsTake.push(0);\n }\n }\n else{\n break;\n }\n }\n chairsTake.join(', ');\n if(chairsHave < needChairs){\n document.getElementById('otvetChair').innerHTML = \"Порядок взятия стульев: \" + chairsTake;\n document.getElementById('otvetChairTwo').innerHTML = \"но стульев не хватило!\";\n }\n else{\n document.getElementById('otvetChair').innerHTML = \"Порядок взятия стульев: \" + chairsTake;\n document.getElementById('otvetChairTwo').innerHTML = \"Стульев достаточно!\";\n }\n}", "function penult() {\n var arr = [1,2,3,4,5,6,7,8,9,10]\n var lowHigh = []\n var seclow = arr[1]\n lowHigh.push(seclow)\n var sechigh = arr.length - 1\n lowHigh.push(sechigh)\n return lowHigh\n}", "function limpiarCarrito() {\r\n carrito = [];\r\n actualizarCarritoLocal(carrito);\r\n}", "minimo(arr = []) {\r\n Array.prototype.min = function () {\r\n return Math.min.apply(null, this);\r\n };\r\n return arr.min();\r\n }", "function doublenum() {\n let x = numArray.map(Element => Element * 2);\n return x;\n }", "function lineThemUp(int1, int2, int3){\n\tlet newArr = [int1, int2, int3];\n\treturn newArr;\n}", "getNodosArbol(t) {\n // debugger;\n if(this.t > t) return [];\n let retorno = [this];\n this.hijos.forEach(function (e) {\n retorno = retorno.concat(e.getNodosArbol(t));\n }, this);\n\n return retorno;\n }", "function fixTheMeerkat(arr) {\n let out = [];\n arr.forEach((x,y) => out[arr.length - 1 - y] = x);\n return out;\n}" ]
[ "0.6734216", "0.6712348", "0.63883847", "0.6345884", "0.6298861", "0.62926435", "0.6195799", "0.61523443", "0.6146546", "0.6108231", "0.6102607", "0.60934156", "0.60456514", "0.604099", "0.5945853", "0.593791", "0.5933508", "0.5921939", "0.59188265", "0.5912921", "0.58974916", "0.5895432", "0.5889464", "0.58822304", "0.5875844", "0.5871173", "0.5867491", "0.58543426", "0.5853434", "0.58382493", "0.5828465", "0.5822323", "0.5819205", "0.5816124", "0.5814654", "0.5814533", "0.58136433", "0.5813618", "0.5808615", "0.58056825", "0.58044964", "0.57917184", "0.57903206", "0.57853734", "0.57845163", "0.5783421", "0.57772136", "0.5774593", "0.5772809", "0.5761406", "0.57370573", "0.57367945", "0.57235396", "0.57215977", "0.5710426", "0.570981", "0.5708152", "0.57066023", "0.5704217", "0.56943905", "0.569318", "0.5691859", "0.568834", "0.5686719", "0.56775594", "0.5673191", "0.5672616", "0.5665077", "0.5658363", "0.56543875", "0.56508434", "0.5637502", "0.563099", "0.56219214", "0.56131417", "0.5607413", "0.5603256", "0.56028885", "0.5602121", "0.56012577", "0.5596446", "0.5594524", "0.55899453", "0.558906", "0.5582861", "0.55804324", "0.5576337", "0.55712473", "0.55712473", "0.5567341", "0.5565815", "0.5561623", "0.5560173", "0.5549491", "0.554898", "0.55482906", "0.55466896", "0.5538476", "0.5529478", "0.55261874", "0.5522898" ]
0.0
-1
Counts number of trailing zeros
function countTrailingZeros(v) { var c = 32; v &= -v; if (v) c--; if (v & 0x0000FFFF) c -= 16; if (v & 0x00FF00FF) c -= 8; if (v & 0x0F0F0F0F) c -= 4; if (v & 0x33333333) c -= 2; if (v & 0x55555555) c -= 1; return c; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countTrailingZeroes(n) {\n let currNumber = n;\n let count = 0;\n\n while(currNumber > 0) {\n if(currNumber % 10 === 0) {\n count++;\n currNumber /= 10;\n } else {\n return count;\n }\n }\n\n return count;\n}", "function zeros(test) {\r\n let count = 0;\r\n while( test > 0){\r\n test = Math.floor(test/5);\r\n count +=test\r\n }\r\n return count;\r\n }", "function countZeros(n) {\n var counter = 0;\n while(n>0) {\n counter += Math.floor(n/10);\n n = n/10;\n }\n return counter;\n}", "function countTrailingZeros(v) {\n\t var c = 32;\n\t v &= -v;\n\t if (v) c--;\n\t if (v & 0x0000FFFF) c -= 16;\n\t if (v & 0x00FF00FF) c -= 8;\n\t if (v & 0x0F0F0F0F) c -= 4;\n\t if (v & 0x33333333) c -= 2;\n\t if (v & 0x55555555) c -= 1;\n\t return c;\n\t}", "function countTrailingZeros(v) {\n\t var c = 32;\n\t v &= -v;\n\t if (v) c--;\n\t if (v & 0x0000FFFF) c -= 16;\n\t if (v & 0x00FF00FF) c -= 8;\n\t if (v & 0x0F0F0F0F) c -= 4;\n\t if (v & 0x33333333) c -= 2;\n\t if (v & 0x55555555) c -= 1;\n\t return c;\n\t}", "function countTrailingZeros(v) {\n\t var c = 32;\n\t v &= -v;\n\t if (v) c--;\n\t if (v & 0x0000FFFF) c -= 16;\n\t if (v & 0x00FF00FF) c -= 8;\n\t if (v & 0x0F0F0F0F) c -= 4;\n\t if (v & 0x33333333) c -= 2;\n\t if (v & 0x55555555) c -= 1;\n\t return c;\n\t}", "function countZeroes(arr) {\n // add whatever parameters you deem necessary - good luck!!!\n if (arr.length === 0) return 0;\n if (arr[0] === 0 && arr[arr.length - 1] === 0) return arr.length;\n let first = 0;\n let last = arr.length - 1;\n\n while (first <= last) {\n let mid = Math.floor((first + last) / 2);\n let midElement = arr[mid];\n\n if (midElement > 0) {\n first = mid + 1;\n } else if (midElement === 0 && arr[mid - 1] === 1) {\n return arr.length - mid;\n } else if (midElement === 0) {\n last = mid - 1;\n }\n }\n return 0;\n}", "function countZeroes(arr) {\n let min = 0;\n let max = arr.length - 1;\n let middle = 0;\n if (arr[0] === 0) return arr.length;\n if (arr[arr.length-1] === 1) return 0;\n while (min <= max) {\n middle = Math.floor((min + max) / 2);\n if (arr[middle]) {\n min = middle + 1;\n } else if (arr[middle - 1] === 1) {\n return arr.length - middle;\n } else {\n max = middle - 1;\n }\n }\n}", "function trailingZeros(mantissa) {\n var zeros = 0;\n\n for (var i = mantissa.length - 1; i >= 0; i--) {\n var c = mantissa.charAt(i);\n\n if (c == \"0\") {\n zeros++;\n } else {\n return zeros;\n }\n }\n\n return zeros;\n}", "function zeroCount(numbers) {\n var result = 0;\n var index = 0;\n while (index < numbers.length) {\n if (numbers[index] === 0) {\n result += 1;\n }\n index += 1;\n }\n return result;\n}", "function countZeroes(array) {\n let left = 0;\n let right = array.length - 1;\n\n while (left <= right) {\n const mid = Math.floor((left + right) / 2);\n\n if (array[mid] === 1) left = mid + 1;\n else right = mid - 1;\n }\n\n return array.length - left;\n}", "function trailingZeros(mantissa) {\n\t var zeros = 0;\n\t for (var i = mantissa.length - 1; i >= 0; i--) {\n\t var c = mantissa.charAt(i);\n\t if (c == \"0\") {\n\t zeros++;\n\t } else {\n\t return zeros;\n\t }\n\t }\n\t return zeros;\n\t}", "function countZero(n) {\n var count = 0;\n while (n > 0) {\n count += Math.floor(n / 10);\n n = n / 10;\n }\n return count;\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZeros(buf) {\n\tvar o = 0, obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = (1 << obit);\n\t\tif ((buf[o] & mask) === mask)\n\t\t\tbreak;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn (o*8 + (8 - obit) - 1);\n}", "function countZero(n){\n var count = 0;\n while(n>0){\n count += Math.floor(n/10);\n n = n/10;\n }\n return count;\n}", "function countZeros(buf) {\n\tvar o = 0,\n\t obit = 8;\n\twhile (o < buf.length) {\n\t\tvar mask = 1 << obit;\n\t\tif ((buf[o] & mask) === mask) break;\n\t\tobit--;\n\t\tif (obit < 0) {\n\t\t\to++;\n\t\t\tobit = 8;\n\t\t}\n\t}\n\treturn o * 8 + (8 - obit) - 1;\n}", "function countZero(n) {\n var count = 0;\n while (n > 0) {\n count += Math.floor(n / 10);\n n = n / 10;\n }\n return count;\n}", "function countZeros1(arr) {\n\t\t\t\treturn arr.reduce(function(sum, item) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn sum + (item === 0 ? 1 :0);\n\t\t\t\t\t\t\t\t\t\t\t\t}, 0);\n}", "function countZeroes(numbers) {\n x = reduce(isZero, 0, numbers)\n console.log(x)\n return x\n}", "function get_data_length(arr) {\n var nlen = arr.length;\n\n for(var i = arr.length - 1; i > 0 && arr[i] == 0; i--)\n nlen--;\n\n return nlen;\n}", "function zeros (n) {\n var count =0;\n for (var i=5; (n/i)>=1; i *= 5)\n count += n/i;\n return count-count%1; \n}", "function countZeroes(arr){\n\nlet result = arr.reduce((total, elem)=>{\n if(elem === 0){\n total++}\n return total;\n },0)\n\n return result}", "function CountPositives(arr) {\n var counter = 0;\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] > 0) {\n counter++;\n }\n }\n arr[arr.length - 1] = counter;\n return arr;\n }", "function trailingZeros(n) {\n let result = 0;\n let power = 1;\n while (Math.floor(n / Math.pow(5, power)) > 0) {\n result += Math.floor(n / Math.pow(5, power));\n power++;\n }\n return result;\n}", "function ml_z_trailing_zeros(z) {\n z = bigInt(z).abs();\n var zero = bigInt(0);\n var one = bigInt(1);\n if (z.equals(zero)) {\n // max_int in 32bit\n return 0x7fffffff;\n }\n var i = 0\n z = z.xor(z.prev()).shiftRight(1);\n for (i = 0; !z.equals(bigInt.zero); i++) {\n z = z.shiftRight(1);\n }\n return i;\n}", "function countpos(array){\n var count = 0\n for(var i=0;i<array.length;i++){\n if(array[i] > 0){\n count = count + 1;\n } \n }\n array[array.length-1] = count;\n console.log(array);\n}", "function countPositives(arr){\n var count = 0\n for(var i = 0; i < arr.length; i++){\n if(arr[i] >= 0){\n count++\n }\n }\n arr[arr.length-1] = count\n return arr\n}", "function main() {\n var n = parseInt(readLine());\n arr = readLine().split(' ');\n arr = arr.map(Number);\n\n var posCounter = 0;\n var negCounter = 0;\n var zerCounter = 0;\n\n for (var i = 0; i < n; i++) {\n if (arr[i] === 0) {\n zerCounter++;\n } else if (arr[i] < 0) {\n negCounter++;\n } else {\n posCounter++;\n }\n }\n\n console.log((posCounter / n).toFixed(6));\n console.log((negCounter / n).toFixed(6));\n console.log((zerCounter / n).toFixed(6));\n}", "function countPosi(x) {\n var count = 0\n for ( var i = 0 ; i<x.length ; i++ ) {\n if (x[i]>0) {\n count++\n }\n } return count\n}", "function countPositives(arr){\n let count = 0;\n for(let i = 0; i < arr.length; i++){\n if(arr[i] > 0){\n count ++;\n }\n }\n arr[arr.length - 1] = count;\n return arr;\n}", "function plusMinus(arr) {\n const n = arr.length\n const precision = 6\n\n const plus_count = arr.filter(x => x > 0).length;\n const negative_count = arr.filter(x => x < 0).length;\n const zero_count = arr.filter(x => x == 0).length;\n\n console.log((plus_count/n).toFixed(precision))\n console.log((negative_count/n).toFixed(precision))\n console.log((zero_count/n).toFixed(precision))\n}", "function countP(arr) {\n var sum = 0;\n\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] > 0) {\n sum++;\n }\n }\n\n arr[arr.length - 1] = sum;\n\n return arr;\n}", "function countConsOnes(input){\n let prevMax = 0, curCount = 0;\n\n input.map(num =>{\n if(num == 0){\n if(curCount > prevMax){\n prevMax = curCount;\n }\n curCount = 0;\n }else{\n curCount++;\n }\n });\n\n return prevMax > curCount ? prevMax : curCount; \n}", "function countPositive(arr){\n var count = 0\n for (var i = 0; i < arr.length; i++){\n if(arr[i] > 0){\n count++\n }\n }\n arr[arr.length - 1] = count\n return arr\n}", "function countPositive(arr){\n var count = 0;\n for(var i =0; i < arr.length; i++){\n if(arr[i] > 0){\n count++;\n }\n }\n arr[arr.length-1] = count;\n console.log(arr);\n}", "function reduceZeros(arr) {\n let zeroCount = 0;\n let newArr = [];\n function inner(arr) {\n if(arr.length === 0) {\n return;\n } else {\n var firstEl = arr.splice(0,1)[0];\n if(firstEl === 0 && zeroCount === 0 ) {\n newArr.push(firstEl);\n zeroCount++;\n } else if (firstEl !== 0) {\n newArr.push(firstEl);\n }\n inner(arr);\n }\n }\n inner(arr);\n return newArr;\n}", "function countPositives(array){\n let counter = 0;\n for(let i = 0; i < array.length; i++){\n if(array[i] > 0){\n counter = counter + 1;\n }\n array[array.length - 1] = counter;\n }\n return array;\n}", "function countPositives(arr){\n let count = 0;\n for(let i = 0; i < arr.length; i++){\n if(arr[i] > 0){\n count++\n }\n }\n arr[arr.length-1] = count\n return arr\n}", "function jumpingOnClouds(arr){\n let count = 0;\n\n for (let i = 0; i < arr.length -1; i++){\n if(arr[i+2] === 0) i++\n count++\n }\n return count\n}", "function countPositives(arr){\n var count = 0;\n for(var i=0;i<arr.length;i++){\n if(arr[i]>0){\n count = count + 1;\n }\n }\n arr[arr.length-1] = count;\n return arr;\n}", "function countpositives(arr){\n var count=0;\n for(var i=0;i<arr.length;i++){\n if(arr[i]>0){\n count+=1;\n }\n arr.pop();\n arr.push(count);\n }\n return arr;\n}", "function countPositives(arr) {\n var count = 0;\n for(var i = 0; i < arr.length; i++) {\n arr[i] > 0 ? count++ : false;\n }\n arr[arr.length - 1] = count; \n return arr;\n}", "function getNumberEmptyFields() {\n\tvar empty = 0;\n\tvar i, j;\n\n\tfor (i=0; i<9; i++) {\n\t\tfor (j=0; j<9; j++) {\n\t\t\tif ( getPuzzleValue(i, j) === 0) {\n\t\t\t\tempty++;\n\t\t\t}\n\t\t}\n\t}\n\treturn empty;\n}", "function countLinesWithNegativeElements1(arr){\n let count=0;\n for(let i=0; i<arr.length; i++){\n for(let j=0; j<arr[i].length; j++){\n if(arr[i][j]<0){\n count += 1;\n break;\n }\n }\n }\n return count;\n}", "function countingDigits(arr) {\n let countOfOnes = 0;\n let swaps1s = 0; // the zeros that are out of order\n\n let countOfZeros = 0;\n let swaps0s = 0;\n\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === 1) {\n countOfOnes += 1;\n swaps1s += countOfOnes;\n } else {\n countOfZeros += 1;\n swaps0s += countOfZeros;\n }\n }\n\n return Math.min(swaps0s, swaps1s);\n\n // need to check the other side to see if the swaps are easier\n}", "function count(n){\n if(n<0){\n return (-n).toString().length;\n }\n else\n {\n return n.toString().length;\n }\n }", "function hasZeros(val) {\n return /[^.]\\.|^-*0+[0-9]/.test(val);\n}", "function hasZeros(val) {\n return /[^.]\\.|^-*0+[0-9]/.test(val);\n}", "function countPositivesSumNegatives(input) {\r\n\tif (!input || input.length < 1) return [];\r\n\treturn [input.filter(val => val > 0).length, input.filter(val => val < 0).reduce((acc, cur) => acc + cur, 0)];\r\n}", "function countPositives(array){\n let positiveCount = 0;\n for(var i = 0; i < array.length; i++){\n if(array[i] > 0){\n positiveCount++;\n }\n array[array.length - 1] = positiveCount;\n }\n return array;\n}", "function digitCount(n){\n if (n===0) return 1\n return Math.floor(1 + Math.log10(Math.abs(n)))\n}", "function countLinesWithNegativeElements(arr){\n let count=0;\n for(let i=0; i<arr.length; i++){\n for(let j=0; j<arr[i].length; j++){\n if(arr[i][j]<0){\n count += 1;\n }\n }\n }\n return count;\n}", "function hasZeros(val) {\n return (/[^.]\\.|^-*0+[0-9]/.test(val)\n );\n}", "function noBoringZeros(x) {\n let a = x.toString().split('');\n for(let i = a.length -1; i >= 0; i--){\n if (a[i] == 0){\n a.pop()\n }else{\n break\n }\n }\n return Number(a.join(''))\n }", "function ex_1_I(a) {\n var tot = 0;\n for(i = 0; i < a.length; ++i) {\n var x = a[i];\n if (x > 0) {\n tot += x;\n } else {\n return tot;\n }\n }\n return tot;\n}", "function signFlipCount(array){\n var count = 0;\n for(var i = 1; i < array.length; i++){\n var prev = array[i-1];\n var curr = array[i];\n //if (prev < 0 && curr > 0 || prev > 0 && curr < 0)\n if(Math.sign(curr) * Math.sign(prev) < 0){\n count +=1;\n }\n }\n return count;\n}", "function trailing_zeros_factorial(n) {\n let result = 0;\n for (let i = 5; i <= n; i += 5) {\n let num = i;\n while (num % 5 === 0) {\n num /= 5;\n result++;\n }\n }\n return result;\n}", "function main() {\n \n var t = parseInt(readLine());\n \n for(var a0 = 0; a0 < t; a0++){\n var n = parseInt(readLine());\n var digits = (\"\"+n).split(\"\");\n //console.log(digits);\n var cnt = 0;\n for (i = 0; i < digits.length; i++)\n {\n if (n % digits[i] == 0 && digits[i] != 0)\n {\n cnt++;\n }\n \n }\n console.log(cnt);\n //console.log(n);\n \n }\n \n \n\n}", "function plusMinus(arr) {\n // Write your code here\n let length = arr.length\n let positiveCount = 0\n let negativeCount = 0\n let zeroCount = 0\n \n for(let i =0; i < length; i++){\n if (arr[i] > 0){\n positiveCount ++\n }\n else if (arr[i] < 0){\n negativeCount ++\n }\n else if (arr[i] == 0){\n zeroCount ++\n }\n }\nlet negRatio = (positiveCount/length)\nlet posRatio = (negativeCount/length)\nlet zeroRatio = (zeroCount/length)\n\nconsole.log(negRatio.toFixed(6))\nconsole.log(posRatio.toFixed(6))\nconsole.log(zeroRatio.toFixed(6))\n}", "function plusMinus(arr) {\n let countPos = 0;\n let countNeg = 0;\n let countZero = 0;\n arr.forEach(num => {\n (num > 0) ? countPos++ : \n (num < 0) ? countNeg++ :\n countZero++;\n })\n console.log((countPos / arr.length).toFixed(6) + '\\n' +\n (countNeg / arr.length).toFixed(6) + '\\n' + \n (countZero / arr.length).toFixed(6));\n}", "function onesAndZeros(s){\n let arr = s.split('');\n arr.sort();\n if (arr.indexOf('1')==0||arr.indexOf('1')==-1) {\n return arr.length;\n } else {\n return Math.abs(arr.length-2*arr.indexOf('1'));\n }\n}", "function countPositives(arr){\n var positives = 0\n for(var i = 0; i < arr.length; i++){\n if(arr[i] > 0){\n positives +=1\n }\n }\n arr[arr.length-1] = positives\n console.log(arr)\n}", "function plusMinus(arr) {\n const len = arr.length;\n const positive = arr.filter(i => i>0 );\n const negatives = arr.filter(i => i<0 );\n const zeros = arr.filter(i => i==0 );\n console.log(positive.length/len);\n console.log(negatives.length/len);\n console.log(zeros.length/len);\n \n}", "function get_emin(a) {\n var i, n;\n n = a.length;\n for(i = 0; i < n; i++) {\n if (a[i] != 0)\n return i;\n }\n return n;\n }", "function noBoringZeros(n) {\n if(n===0) return n;\n let derp = n.toString().split('');\n for(var i = derp.length - 1; i > -1; i--){\n if(derp[i] != \"0\"){ break; }\n if(derp[i] === \"0\"){derp.pop();}\n }\n return parseInt(derp.join(\"\"));\n}", "function plusMinus(arr) {\n\t// console.log((arr.filter(number => number > 0).length / arr.length).toFixed(6))\n\t// console.log((arr.filter(number => number < 0).length / arr.length).toFixed(6))\n\t// console.log((arr.filter(number => number == 0).length / arr.length).toFixed(6))\n}", "function countPositives(arr) {}", "function main() {\n var n = parseInt(readLine());\n arr = readLine().split(' ');\n arr = arr.map(Number);\n var b = 0;\n var z = 0;\n var l = 0;\n for (var i = arr.length - 1; i >= 0; i--) {\n \tif(arr[i] > 0){\n \t\tb++;\n \t} else if (arr[i] <0) {\n \t\tl++;\n \t} else{\n \t\tz++;\n \t}\n }\n var lr = l/arr.length;\n var zr = z/arr.length;\n var br = b/arr.length;\n\n console.log(br);\n console.log(lr);\n console.log(zr);\n}", "function cutTheRopes(a) {\n let arr = [a.length];\n while (Math.max(...a) !== 0) {\n let s = a.sort((a, b) => a - b).find(i => i !== 0);\n a = a.map(rope => {\n if ((rope - s) < 0)\n return 0;\n return (rope - s);\n })\n let count = a.filter(rope => rope !== 0).length;\n if (count !== 0)\n arr.push(count); \n }\n return arr;\n}", "computeZeros() {\n let zeroL = this.fx - Math.sqrt(this._d ** 2 - this.fy ** 2);\n let zeroR = this.fx + Math.sqrt(this._d ** 2 - this.fy ** 2);\n return ([zeroL, zeroR]);\n }" ]
[ "0.7691476", "0.72729003", "0.72194046", "0.72079146", "0.72079146", "0.72079146", "0.7200482", "0.7189058", "0.7183695", "0.7181872", "0.7159809", "0.70866984", "0.6943503", "0.69381714", "0.69381714", "0.69381714", "0.69381714", "0.69381714", "0.69381714", "0.69381714", "0.69381714", "0.69381714", "0.69381714", "0.69381714", "0.69381714", "0.69322556", "0.6917977", "0.6855868", "0.68309015", "0.6746583", "0.6736392", "0.6684387", "0.66693443", "0.66020447", "0.65802914", "0.6531538", "0.6526702", "0.62841094", "0.62831104", "0.62746507", "0.6249038", "0.6210022", "0.61607623", "0.6160669", "0.61075395", "0.6106228", "0.6095318", "0.60920846", "0.6090316", "0.60830176", "0.60593617", "0.60517913", "0.60159874", "0.59991527", "0.5961204", "0.5928895", "0.5912964", "0.5910951", "0.5910951", "0.5909068", "0.5904825", "0.58786595", "0.5851237", "0.58305025", "0.5762961", "0.5681882", "0.56690264", "0.56356263", "0.56354785", "0.56200975", "0.5597825", "0.5588004", "0.556438", "0.5556439", "0.5552274", "0.5547343", "0.5536789", "0.5532868", "0.5524728", "0.55107945", "0.55068165" ]
0.7219277
21
Class: Buffer ============= The Buffer constructor returns instances of `Uint8Array` that are augmented with function properties for all the node `Buffer` API functions. We use `Uint8Array` so that square bracket notation works as expected it returns a single octet. By augmenting the instances, we can avoid modifying the `Uint8Array` prototype.
function Buffer (arg) { if (!(this instanceof Buffer)) { // Avoid going through an ArgumentsAdaptorTrampoline in the common case. if (arguments.length > 1) return new Buffer(arg, arguments[1]) return new Buffer(arg) } if (!Buffer.TYPED_ARRAY_SUPPORT) { this.length = 0 this.parent = undefined } // Common case. if (typeof arg === 'number') { return fromNumber(this, arg) } // Slightly less common case. if (typeof arg === 'string') { return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8') } // Unusual. return fromObject(this, arg) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\t\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\t\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\t\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\t\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\t\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\t\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\t\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\t\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\t\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\t\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\t\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\t\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\t\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\t\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\t\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\t\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\t\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\t\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\t\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\t\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\t\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n\t this.parent = undefined\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (subject, encoding) {\n var self = this\n if (!(self instanceof Buffer)) return new Buffer(subject, encoding)\n\n var type = typeof subject\n var length\n\n if (type === 'number') {\n length = +subject\n } else if (type === 'string') {\n length = Buffer.byteLength(subject, encoding)\n } else if (type === 'object' && subject !== null) {\n // assume object is array-like\n if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data\n length = +subject.length\n } else {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (length > kMaxLength) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +\n kMaxLength.toString(16) + ' bytes')\n }\n\n if (length < 0) length = 0\n else length >>>= 0 // coerce to uint32\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Preferred: Return an augmented `Uint8Array` instance for best performance\n self = Buffer._augment(new Uint8Array(length)) // eslint-disable-line consistent-this\n } else {\n // Fallback: Return THIS instance of Buffer (created by `new`)\n self.length = length\n self._isBuffer = true\n }\n\n var i\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n // Speed optimization -- use set if we're copying from a typed array\n self._set(subject)\n } else if (isArrayish(subject)) {\n // Treat array-ish objects as a byte array\n if (Buffer.isBuffer(subject)) {\n for (i = 0; i < length; i++) {\n self[i] = subject.readUInt8(i)\n }\n } else {\n for (i = 0; i < length; i++) {\n self[i] = ((subject[i] % 256) + 256) % 256\n }\n }\n } else if (type === 'string') {\n self.write(subject, 0, encoding)\n } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT) {\n for (i = 0; i < length; i++) {\n self[i] = 0\n }\n }\n\n if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent\n\n return self\n}", "function Buffer (subject, encoding) {\n var self = this\n if (!(self instanceof Buffer)) return new Buffer(subject, encoding)\n\n var type = typeof subject\n var length\n\n if (type === 'number') {\n length = +subject\n } else if (type === 'string') {\n length = Buffer.byteLength(subject, encoding)\n } else if (type === 'object' && subject !== null) {\n // assume object is array-like\n if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data\n length = +subject.length\n } else {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (length > kMaxLength) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +\n kMaxLength.toString(16) + ' bytes')\n }\n\n if (length < 0) length = 0\n else length >>>= 0 // coerce to uint32\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Preferred: Return an augmented `Uint8Array` instance for best performance\n self = Buffer._augment(new Uint8Array(length)) // eslint-disable-line consistent-this\n } else {\n // Fallback: Return THIS instance of Buffer (created by `new`)\n self.length = length\n self._isBuffer = true\n }\n\n var i\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n // Speed optimization -- use set if we're copying from a typed array\n self._set(subject)\n } else if (isArrayish(subject)) {\n // Treat array-ish objects as a byte array\n if (Buffer.isBuffer(subject)) {\n for (i = 0; i < length; i++) {\n self[i] = subject.readUInt8(i)\n }\n } else {\n for (i = 0; i < length; i++) {\n self[i] = ((subject[i] % 256) + 256) % 256\n }\n }\n } else if (type === 'string') {\n self.write(subject, 0, encoding)\n } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT) {\n for (i = 0; i < length; i++) {\n self[i] = 0\n }\n }\n\n if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent\n\n return self\n}", "function Buffer (subject, encoding) {\n var self = this\n if (!(self instanceof Buffer)) return new Buffer(subject, encoding)\n\n var type = typeof subject\n var length\n\n if (type === 'number') {\n length = +subject\n } else if (type === 'string') {\n length = Buffer.byteLength(subject, encoding)\n } else if (type === 'object' && subject !== null) {\n // assume object is array-like\n if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data\n length = +subject.length\n } else {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (length > kMaxLength) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +\n kMaxLength.toString(16) + ' bytes')\n }\n\n if (length < 0) length = 0\n else length >>>= 0 // coerce to uint32\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Preferred: Return an augmented `Uint8Array` instance for best performance\n self = Buffer._augment(new Uint8Array(length)) // eslint-disable-line consistent-this\n } else {\n // Fallback: Return THIS instance of Buffer (created by `new`)\n self.length = length\n self._isBuffer = true\n }\n\n var i\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n // Speed optimization -- use set if we're copying from a typed array\n self._set(subject)\n } else if (isArrayish(subject)) {\n // Treat array-ish objects as a byte array\n if (Buffer.isBuffer(subject)) {\n for (i = 0; i < length; i++) {\n self[i] = subject.readUInt8(i)\n }\n } else {\n for (i = 0; i < length; i++) {\n self[i] = ((subject[i] % 256) + 256) % 256\n }\n }\n } else if (type === 'string') {\n self.write(subject, 0, encoding)\n } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT) {\n for (i = 0; i < length; i++) {\n self[i] = 0\n }\n }\n\n if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent\n\n return self\n}", "function Buffer (subject, encoding) {\n var self = this\n if (!(self instanceof Buffer)) return new Buffer(subject, encoding)\n\n var type = typeof subject\n var length\n\n if (type === 'number') {\n length = +subject\n } else if (type === 'string') {\n length = Buffer.byteLength(subject, encoding)\n } else if (type === 'object' && subject !== null) {\n // assume object is array-like\n if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data\n length = +subject.length\n } else {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (length > kMaxLength) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +\n kMaxLength.toString(16) + ' bytes')\n }\n\n if (length < 0) length = 0\n else length >>>= 0 // coerce to uint32\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Preferred: Return an augmented `Uint8Array` instance for best performance\n self = Buffer._augment(new Uint8Array(length)) // eslint-disable-line consistent-this\n } else {\n // Fallback: Return THIS instance of Buffer (created by `new`)\n self.length = length\n self._isBuffer = true\n }\n\n var i\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n // Speed optimization -- use set if we're copying from a typed array\n self._set(subject)\n } else if (isArrayish(subject)) {\n // Treat array-ish objects as a byte array\n if (Buffer.isBuffer(subject)) {\n for (i = 0; i < length; i++) {\n self[i] = subject.readUInt8(i)\n }\n } else {\n for (i = 0; i < length; i++) {\n self[i] = ((subject[i] % 256) + 256) % 256\n }\n }\n } else if (type === 'string') {\n self.write(subject, 0, encoding)\n } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT) {\n for (i = 0; i < length; i++) {\n self[i] = 0\n }\n }\n\n if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent\n\n return self\n}", "function Buffer (subject, encoding) {\n var self = this\n if (!(self instanceof Buffer)) return new Buffer(subject, encoding)\n\n var type = typeof subject\n var length\n\n if (type === 'number') {\n length = +subject\n } else if (type === 'string') {\n length = Buffer.byteLength(subject, encoding)\n } else if (type === 'object' && subject !== null) {\n // assume object is array-like\n if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data\n length = +subject.length\n } else {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (length > kMaxLength) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +\n kMaxLength.toString(16) + ' bytes')\n }\n\n if (length < 0) length = 0\n else length >>>= 0 // coerce to uint32\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Preferred: Return an augmented `Uint8Array` instance for best performance\n self = Buffer._augment(new Uint8Array(length)) // eslint-disable-line consistent-this\n } else {\n // Fallback: Return THIS instance of Buffer (created by `new`)\n self.length = length\n self._isBuffer = true\n }\n\n var i\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n // Speed optimization -- use set if we're copying from a typed array\n self._set(subject)\n } else if (isArrayish(subject)) {\n // Treat array-ish objects as a byte array\n if (Buffer.isBuffer(subject)) {\n for (i = 0; i < length; i++) {\n self[i] = subject.readUInt8(i)\n }\n } else {\n for (i = 0; i < length; i++) {\n self[i] = ((subject[i] % 256) + 256) % 256\n }\n }\n } else if (type === 'string') {\n self.write(subject, 0, encoding)\n } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT) {\n for (i = 0; i < length; i++) {\n self[i] = 0\n }\n }\n\n if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent\n\n return self\n}", "function Buffer(arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1]);\n\t return new Buffer(arg);\n\t }\n\t\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0;\n\t this.parent = undefined;\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg);\n\t }\n\t\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8');\n\t }\n\t\n\t // Unusual.\n\t return fromObject(this, arg);\n\t}", "function Buffer(arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1]);\n\t return new Buffer(arg);\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0;\n\t this.parent = undefined;\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg);\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8');\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg);\n\t}", "function Buffer(arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1]);\n\t return new Buffer(arg);\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0;\n\t this.parent = undefined;\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg);\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8');\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg);\n\t}", "function Buffer(arg,encodingOrOffset,length){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer)){return new Buffer(arg,encodingOrOffset,length);}// Common case.\n\tif(typeof arg==='number'){if(typeof encodingOrOffset==='string'){throw new Error('If encoding is specified then the first argument must be a string');}return allocUnsafe(this,arg);}return from(this,arg,encodingOrOffset,length);}", "function Buffer(arg,encodingOrOffset,length){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer)){return new Buffer(arg,encodingOrOffset,length);}// Common case.\nif(typeof arg==='number'){if(typeof encodingOrOffset==='string'){throw new Error('If encoding is specified then the first argument must be a string');}return allocUnsafe(this,arg);}return from(this,arg,encodingOrOffset,length);}", "function Buffer(arg,encodingOrOffset,length){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer)){return new Buffer(arg,encodingOrOffset,length);}// Common case.\nif(typeof arg==='number'){if(typeof encodingOrOffset==='string'){throw new Error('If encoding is specified then the first argument must be a string');}return allocUnsafe(this,arg);}return from(this,arg,encodingOrOffset,length);}", "function Buffer (arg) {\n if (!(this instanceof Buffer)) {\n // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n if (arguments.length > 1) return new Buffer(arg, arguments[1])\n return new Buffer(arg)\n }\n\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n this.length = 0\n this.parent = undefined\n }\n\n // Common case.\n if (typeof arg === 'number') {\n return fromNumber(this, arg)\n }\n\n // Slightly less common case.\n if (typeof arg === 'string') {\n return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n }\n\n // Unusual.\n return fromObject(this, arg)\n }", "function Buffer(arg) {\n if (!(this instanceof Buffer)) {\n // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n if (arguments.length > 1)\n return new Buffer(arg, arguments[1]);\n return new Buffer(arg);\n }\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n this.length = 0;\n this.parent = undefined;\n }\n // Common case.\n if (typeof arg === 'number') {\n return fromNumber(this, arg);\n }\n // Slightly less common case.\n if (typeof arg === 'string') {\n return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8');\n }\n // Unusual.\n return fromObject(this, arg);\n }", "function Buffer(arg) {\n if (!(this instanceof Buffer)) {\n // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n if (arguments.length > 1) return new Buffer(arg, arguments[1])\n return new Buffer(arg)\n }\n\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n this.length = 0\n this.parent = undefined\n }\n\n // Common case.\n if (typeof arg === 'number') {\n return fromNumber(this, arg)\n }\n\n // Slightly less common case.\n if (typeof arg === 'string') {\n return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n }\n\n // Unusual.\n return fromObject(this, arg)\n }", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function Buffer(arg){if(!(this instanceof Buffer)){ // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\nif(arguments.length>1)return new Buffer(arg,arguments[1]);return new Buffer(arg);}if(!Buffer.TYPED_ARRAY_SUPPORT){this.length=0;this.parent=undefined;} // Common case.\nif(typeof arg==='number'){return fromNumber(this,arg);} // Slightly less common case.\nif(typeof arg==='string'){return fromString(this,arg,arguments.length>1?arguments[1]:'utf8');} // Unusual.\nreturn fromObject(this,arg);}", "function Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n \n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n }", "function Buffer(arg) {\n if (!(this instanceof Buffer)) {\n // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n if (arguments.length > 1) return new Buffer(arg, arguments[1]);\n return new Buffer(arg);\n }\n\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n this.length = 0;\n this.parent = undefined;\n }\n\n // Common case.\n if (typeof arg === 'number') {\n return fromNumber(this, arg);\n }\n\n // Slightly less common case.\n if (typeof arg === 'string') {\n return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8');\n }\n\n // Unusual.\n return fromObject(this, arg);\n }", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n }", "function Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n }", "function Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n }", "function Buffer (arg) {\n\t\t if (!(this instanceof Buffer)) {\n\t\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t\t return new Buffer(arg)\n\t\t }\n\t\t\n\t\t this.length = 0\n\t\t this.parent = undefined\n\t\t\n\t\t // Common case.\n\t\t if (typeof arg === 'number') {\n\t\t return fromNumber(this, arg)\n\t\t }\n\t\t\n\t\t // Slightly less common case.\n\t\t if (typeof arg === 'string') {\n\t\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t\t }\n\t\t\n\t\t // Unusual.\n\t\t return fromObject(this, arg)\n\t\t}", "function createByteContainer() {\n if (HAS_BUFFER)\n return new Buffer(0);\n\n return new Uint8Array();\n }", "function createByteContainer() {\n if (HAS_BUFFER)\n return new Buffer(0);\n\n return new Uint8Array();\n }", "function Buffer (subject, encoding, noZero) {\n if (!(this instanceof Buffer))\n return new Buffer(subject, encoding, noZero)\n\n var type = typeof subject\n\n // Find the length\n var length\n if (type === 'number') {\n length = +subject\n } else if (type === 'string') {\n length = Buffer.byteLength(subject, encoding)\n } else if (type === 'object' && subject !== null) { // assume object is array-like\n if (subject.type === 'Buffer' && isArray(subject.data))\n subject = subject.data\n length = +subject.length\n } else {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (length > kMaxLength)\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength.toString(16) + ' bytes')\n\n if (length < 0)\n length = 0\n else\n length >>>= 0 // Coerce to uint32.\n\n var self = this\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Preferred: Return an augmented `Uint8Array` instance for best performance\n /*eslint-disable consistent-this */\n self = Buffer._augment(new Uint8Array(length))\n /*eslint-enable consistent-this */\n } else {\n // Fallback: Return THIS instance of Buffer (created by `new`)\n self.length = length\n self._isBuffer = true\n }\n\n var i\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n // Speed optimization -- use set if we're copying from a typed array\n self._set(subject)\n } else if (isArrayish(subject)) {\n // Treat array-ish objects as a byte array\n if (Buffer.isBuffer(subject)) {\n for (i = 0; i < length; i++)\n self[i] = subject.readUInt8(i)\n } else {\n for (i = 0; i < length; i++)\n self[i] = ((subject[i] % 256) + 256) % 256\n }\n } else if (type === 'string') {\n self.write(subject, 0, encoding)\n } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT && !noZero) {\n for (i = 0; i < length; i++) {\n self[i] = 0\n }\n }\n\n if (length > 0 && length <= Buffer.poolSize)\n self.parent = rootParent\n\n return self\n}", "function Buffer (subject, encoding, noZero) {\n if (!(this instanceof Buffer))\n return new Buffer(subject, encoding, noZero)\n\n var type = typeof subject\n\n // Find the length\n var length\n if (type === 'number') {\n length = +subject\n } else if (type === 'string') {\n length = Buffer.byteLength(subject, encoding)\n } else if (type === 'object' && subject !== null) { // assume object is array-like\n if (subject.type === 'Buffer' && isArray(subject.data))\n subject = subject.data\n length = +subject.length\n } else {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (length > kMaxLength)\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength.toString(16) + ' bytes')\n\n if (length < 0)\n length = 0\n else\n length >>>= 0 // Coerce to uint32.\n\n var self = this\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Preferred: Return an augmented `Uint8Array` instance for best performance\n /*eslint-disable consistent-this */\n self = Buffer._augment(new Uint8Array(length))\n /*eslint-enable consistent-this */\n } else {\n // Fallback: Return THIS instance of Buffer (created by `new`)\n self.length = length\n self._isBuffer = true\n }\n\n var i\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n // Speed optimization -- use set if we're copying from a typed array\n self._set(subject)\n } else if (isArrayish(subject)) {\n // Treat array-ish objects as a byte array\n if (Buffer.isBuffer(subject)) {\n for (i = 0; i < length; i++)\n self[i] = subject.readUInt8(i)\n } else {\n for (i = 0; i < length; i++)\n self[i] = ((subject[i] % 256) + 256) % 256\n }\n } else if (type === 'string') {\n self.write(subject, 0, encoding)\n } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT && !noZero) {\n for (i = 0; i < length; i++) {\n self[i] = 0\n }\n }\n\n if (length > 0 && length <= Buffer.poolSize)\n self.parent = rootParent\n\n return self\n}", "function Buffer (subject, encoding, noZero) {\n if (!(this instanceof Buffer))\n return new Buffer(subject, encoding, noZero)\n\n var type = typeof subject\n\n // Find the length\n var length\n if (type === 'number') {\n length = +subject\n } else if (type === 'string') {\n length = Buffer.byteLength(subject, encoding)\n } else if (type === 'object' && subject !== null) { // assume object is array-like\n if (subject.type === 'Buffer' && isArray(subject.data))\n subject = subject.data\n length = +subject.length\n } else {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (length > kMaxLength)\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength.toString(16) + ' bytes')\n\n if (length < 0)\n length = 0\n else\n length >>>= 0 // Coerce to uint32.\n\n var self = this\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Preferred: Return an augmented `Uint8Array` instance for best performance\n /*eslint-disable consistent-this */\n self = Buffer._augment(new Uint8Array(length))\n /*eslint-enable consistent-this */\n } else {\n // Fallback: Return THIS instance of Buffer (created by `new`)\n self.length = length\n self._isBuffer = true\n }\n\n var i\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n // Speed optimization -- use set if we're copying from a typed array\n self._set(subject)\n } else if (isArrayish(subject)) {\n // Treat array-ish objects as a byte array\n if (Buffer.isBuffer(subject)) {\n for (i = 0; i < length; i++)\n self[i] = subject.readUInt8(i)\n } else {\n for (i = 0; i < length; i++)\n self[i] = ((subject[i] % 256) + 256) % 256\n }\n } else if (type === 'string') {\n self.write(subject, 0, encoding)\n } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT && !noZero) {\n for (i = 0; i < length; i++) {\n self[i] = 0\n }\n }\n\n if (length > 0 && length <= Buffer.poolSize)\n self.parent = rootParent\n\n return self\n}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t this.length = 0\n\t this.parent = undefined\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t this.length = 0\n\t this.parent = undefined\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t this.length = 0\n\t this.parent = undefined\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t this.length = 0\n\t this.parent = undefined\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t this.length = 0\n\t this.parent = undefined\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t this.length = 0\n\t this.parent = undefined\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t return fromNumber(this, arg)\n\t }\n\n\t // Slightly less common case.\n\t if (typeof arg === 'string') {\n\t return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n\t }\n\n\t // Unusual.\n\t return fromObject(this, arg)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}", "function Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}" ]
[ "0.7388503", "0.7388503", "0.7388503", "0.7388503", "0.7388503", "0.7388503", "0.7388503", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.7384735", "0.73223513", "0.73223513", "0.73223513", "0.73223513", "0.73223513", "0.73115295", "0.7307739", "0.7307739", "0.7273573", "0.7245712", "0.7245712", "0.72002083", "0.71985126", "0.7197401", "0.7185328", "0.7185328", "0.7185328", "0.7185328", "0.71633506", "0.71528536", "0.7142339", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71227735", "0.71180093", "0.71180093", "0.71180093", "0.71108824", "0.7100203", "0.7100203", "0.709414", "0.709414", "0.709414", "0.70921075", "0.70921075", "0.70921075", "0.70921075", "0.70921075", "0.70921075", "0.7090172", "0.7090172" ]
0.7126436
64
Duplicate of fromArray() to keep fromArray() monomorphic.
function fromTypedArray (that, array) { var length = checked(array.length) | 0 that = allocate(that, length) // Truncating the elements is probably not what people expect from typed // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior // of the old Buffer constructor. for (var i = 0; i < length; i += 1) { that[i] = array[i] & 255 } return that }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fromArray(as) {\n // For some reason, TypeScript does not infer this type correctly\n var b = build;\n var f = as.reduce(b, []);\n return f;\n }", "function __spreadArray(to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n }", "function cloneArrFrom(arr) {\n let newArr = Array.from(arr);\n return newArr;\n}", "function fromTypedArray(that, array) {\n var length = checked(array.length) | 0;\n that = allocate(that, length);\n // Truncating the elements is probably not what people expect from typed\n // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n // of the old Buffer constructor.\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255;\n }\n return that;\n }", "function fromTypedArray(that, array) {\n var length = checked(array.length) | 0;\n that = allocate(that, length);\n // Truncating the elements is probably not what people expect from typed\n // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n // of the old Buffer constructor.\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255;\n }\n return that;\n }", "function fromTypedArray(that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n // Truncating the elements is probably not what people expect from typed\n // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n // of the old Buffer constructor.\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n }", "function copyArray() {\n return new Array(...array);\n}", "function fromTypedArray(that, array) {\n\t var length = checked(array.length) | 0;\n\t that = allocate(that, length);\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255;\n\t }\n\t return that;\n\t}", "function fromTypedArray(that, array) {\n\t var length = checked(array.length) | 0;\n\t that = allocate(that, length);\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255;\n\t }\n\t return that;\n\t}", "function fromTypedArray(that, array) {\n\t var length = checked(array.length) | 0;\n\t that = allocate(that, length);\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255;\n\t }\n\t return that;\n\t}", "function fromTypedArray(that, array) {\n\t var length = checked(array.length) | 0;\n\t that = allocate(that, length);\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255;\n\t }\n\t return that;\n\t}", "function fromTypedArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n // Truncating the elements is probably not what people expect from typed\n // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n // of the old Buffer constructor.\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n }", "function fromTypedArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n // Truncating the elements is probably not what people expect from typed\n // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n // of the old Buffer constructor.\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n }", "function fromArray(as) {\n return as.reduce(build, {});\n }", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "function fromTypedArray (that, array) {\n\t var length = checked(array.length) | 0\n\t that = allocate(that, length)\n\t // Truncating the elements is probably not what people expect from typed\n\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t // of the old Buffer constructor.\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}", "static fromArray(arr) {\n return Matrix.map(new Matrix(arr.length, 1), (_, i) => arr[i]);\n }", "function fromTypedArray (that, array) {\n\t\t var length = checked(array.length) | 0\n\t\t that = allocate(that, length)\n\t\t // Truncating the elements is probably not what people expect from typed\n\t\t // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n\t\t // of the old Buffer constructor.\n\t\t for (var i = 0; i < length; i += 1) {\n\t\t that[i] = array[i] & 255\n\t\t }\n\t\t return that\n\t\t}", "function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }", "function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }", "function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }", "function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }", "function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }", "function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }", "function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }", "function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }", "function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }", "function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }", "copyArray(arr) {\n\t\treturn Array.from(arr).map((val, ind) => Array.from(arr[ind]));\n\t}", "function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}else return Array.from(arr)}", "function toObjectArray(origArray) {\n\n var newArray = [];\n for (var index = 1; index < origArray.length; index++) {\n newArray.push(_.zipObject(origArray[0], origArray[index]));\n }\n\n return newArray;\n\n}", "function h$fromArray(a) {\n var r = h$ghczmprimZCGHCziTypesziZMZN;\n for(var i=a.length-1;i>=0;i--) r = (h$c2(h$ghczmprimZCGHCziTypesziZC_con_e, ((h$c1(h$ghcjszmprimZCGHCJSziPrimziJSVal_con_e, (a[i])))), (r)));\n return a;\n}", "function h$fromArray(a) {\n var r = h$ghczmprimZCGHCziTypesziZMZN;\n for(var i=a.length-1;i>=0;i--) r = (h$c2(h$ghczmprimZCGHCziTypesziZC_con_e, ((h$c1(h$ghcjszmprimZCGHCJSziPrimziJSVal_con_e, (a[i])))), (r)));\n return a;\n}", "function h$fromArray(a) {\n var r = h$ghczmprimZCGHCziTypesziZMZN;\n for(var i=a.length-1;i>=0;i--) r = (h$c2(h$ghczmprimZCGHCziTypesziZC_con_e, ((h$c1(h$ghcjszmprimZCGHCJSziPrimziJSVal_con_e, (a[i])))), (r)));\n return a;\n}" ]
[ "0.65889376", "0.65335846", "0.6512674", "0.64970803", "0.6463127", "0.6455966", "0.644092", "0.63979745", "0.63979745", "0.63979745", "0.63979745", "0.63100034", "0.63100034", "0.62795615", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6261167", "0.6212621", "0.6197625", "0.61800444", "0.61800444", "0.61800444", "0.61800444", "0.61800444", "0.61800444", "0.61800444", "0.61800444", "0.61800444", "0.61800444", "0.6108512", "0.6101382", "0.6098474", "0.6090728", "0.6090728", "0.6090728" ]
0.62321496
75
Need to make sure that buffer isn't trying to write out of bounds.
function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeBuffer(buffer, pos, src) {\n src.copy(buffer, pos)\n return src.length\n}", "function writeBuffer(buffer, pos, src) {\n src.copy(buffer, pos)\n return src.length\n}", "ensure(n) {\n let minsize = this.pos + n;\n if (minsize > this.capacity) {\n let cap = this.capacity * 2;\n while (cap < minsize) cap *= 2;\n let newbuf = new Uint8Array(cap);\n newbuf.set(this.buffer);\n this.buffer = newbuf;\n this.capacity = cap;\n }\n }", "function bufferOutOfBounds(name = undefined) {\n if (name) {\n return `\"${name}\" is outside of buffer bounds`;\n }\n return 'Attempt to write outside buffer bounds';\n}", "writeBytes(value) {\n let start = 0;\n let valueLen = value.length;\n while (valueLen > 0) {\n const bytesLeft = this.numBytesLeft();\n if (bytesLeft === 0) {\n this._grow(this.pos + valueLen);\n }\n const bytesToWrite = Math.min(bytesLeft, valueLen);\n value.copy(this.buf, this.pos, start, start + bytesToWrite);\n this.pos += bytesToWrite;\n start += bytesToWrite;\n valueLen -= bytesToWrite;\n }\n }", "function checkLen(len){\n if(pos + len > buf.length)\n throw new Error('Broken data stream at pos ' + pos + ' (need ' + len + ' more bytes)');\n }", "oob() {\n return this.at > this.buffer.byteLength || this.at < 0;\n }", "_blockedWrite() {\n throw new Error('Cannot write because the writer has been closed.');\n }", "_blockedWrite() {\n throw new Error('Cannot write because the writer has been closed.');\n }", "function write() {\n\t// Bail if the write queue is invalid\n\tif (!check_queue_write()) return;\n\n\t// Create message from buffer\n\tlet buffer = proto.proto.create(intf.intf.queue_write[intf.intf.queue_write.length - 1]);\n\n\tif (typeof buffer === 'undefined' || buffer === null || buffer === '') return;\n\n\tintf.intf.port.write(buffer, (error) => {\n\t\t// Bail and retry if there was a write error\n\t\tif (error) {\n\t\t\terror_out('writing', error);\n\n\t\t\t// Re-kick it\n\t\t\tsetImmediate(write);\n\n\t\t\treturn;\n\t\t}\n\n\t\tintf.intf.port.drain(() => {\n\t\t\t// After a successful write and drain, remove the last element from the write queue\n\t\t\tintf.intf.queue_write.pop();\n\n\t\t\t// Re-kick it\n\t\t\t// setImmediate(write);\n\t\t\tprocess.nextTick(write);\n\t\t});\n\t});\n}", "write(sequence, offset) {\n offset = typeof offset === 'number' ? offset : this.position;\n // If the buffer is to small let's extend the buffer\n if (this.buffer.length < offset + sequence.length) {\n const buffer$1 = buffer__WEBPACK_IMPORTED_MODULE_0___default.a.Buffer.alloc(this.buffer.length + sequence.length);\n this.buffer.copy(buffer$1, 0, 0, this.buffer.length);\n // Assign the new buffer\n this.buffer = buffer$1;\n }\n if (ArrayBuffer.isView(sequence)) {\n this.buffer.set(ensure_buffer.ensureBuffer(sequence), offset);\n this.position =\n offset + sequence.byteLength > this.position ? offset + sequence.length : this.position;\n }\n else if (typeof sequence === 'string') {\n this.buffer.write(sequence, offset, sequence.length, 'binary');\n this.position =\n offset + sequence.length > this.position ? offset + sequence.length : this.position;\n }\n }", "function pushError(){assert.throws(function(){r.push(new Buffer(1))})}", "function writeBuffer()\n{\n fs.writeFile(outputFile, outputBuffer, 'utf8', function (error) {\n if (error)\n {\n console.log('Could not write the file', error);\n }\n\n exit();\n });\n}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0)\n\t throw new RangeError('offset is not uint')\n\t if (offset + ext > length)\n\t throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}", "function checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0)\n throw new RangeError('offset is not uint')\n if (offset + ext > length)\n throw new RangeError('Trying to access beyond buffer length')\n }", "function checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n }", "function checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n }", "function checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n }", "function writeOrBuffer(stream, state, chunk, encoding, cb) {\n\t chunk = decodeChunk(state, chunk, encoding);\n\t if (util.isBuffer(chunk)) encoding = 'buffer';\n\t var len = state.objectMode ? 1 : chunk.length;\n\n\t state.length += len;\n\n\t var ret = state.length < state.highWaterMark;\n\t // we must ensure that previous needDrain will not be reset to false.\n\t if (!ret) state.needDrain = true;\n\n\t if (state.writing || state.corked) state.buffer.push(new WriteReq(chunk, encoding, cb));else doWrite(stream, state, false, len, chunk, encoding, cb);\n\n\t return ret;\n\t}", "onDrain() {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit(\"drain\");\n } else {\n this.flush();\n }\n }", "onDrain() {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit(\"drain\");\n } else {\n this.flush();\n }\n }", "function checkOffset (offset, ext, length) {\n\t\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t\t}", "function checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n }", "function writeLength(buffer, pos, length) {\n var digit = 0\n , origPos = pos\n\n do {\n digit = length % 128 | 0\n length = length / 128 | 0\n if (length > 0) {\n digit = digit | 0x80\n }\n buffer.writeUInt8(digit, pos++, true)\n } while (length > 0)\n\n return pos - origPos\n}", "function writeLength(buffer, pos, length) {\n var digit = 0\n , origPos = pos\n\n do {\n digit = length % 128 | 0\n length = length / 128 | 0\n if (length > 0) {\n digit = digit | 0x80\n }\n buffer.writeUInt8(digit, pos++, true)\n } while (length > 0)\n\n return pos - origPos\n}", "function checkOffset(offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n }", "function checkOffset(offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n }" ]
[ "0.6671098", "0.6671098", "0.6633269", "0.6519824", "0.6382888", "0.62769973", "0.6255935", "0.6233706", "0.6233706", "0.6106861", "0.6035961", "0.6019949", "0.5982479", "0.59593046", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.59507954", "0.5948267", "0.59400463", "0.59400463", "0.59400463", "0.59348553", "0.5930854", "0.5930854", "0.59252393", "0.5917571", "0.5915744", "0.5915744", "0.5915515", "0.59119034" ]
0.0
-1
This function generates very simple loops analogous to how you typically traverse arrays (the outermost loop corresponds to the slowest changing index, the innermost loop to the fastest changing index) TODO: If two arrays have the same strides (and offsets) there is potential for decreasing the number of "pointers" and related variables. The drawback is that the type signature would become more specific and that there would thus be less potential for caching, but it might still be worth it, especially when dealing with large numbers of arguments.
function innerFill(order, proc, body) { var dimension = order.length , nargs = proc.arrayArgs.length , has_index = proc.indexArgs.length>0 , code = [] , vars = [] , idx=0, pidx=0, i, j for(i=0; i<dimension; ++i) { // Iteration variables vars.push(["i",i,"=0"].join("")) } //Compute scan deltas for(j=0; j<nargs; ++j) { for(i=0; i<dimension; ++i) { pidx = idx idx = order[i] if(i === 0) { // The innermost/fastest dimension's delta is simply its stride vars.push(["d",j,"s",i,"=t",j,"p",idx].join("")) } else { // For other dimensions the delta is basically the stride minus something which essentially "rewinds" the previous (more inner) dimension vars.push(["d",j,"s",i,"=(t",j,"p",idx,"-s",pidx,"*t",j,"p",pidx,")"].join("")) } } } code.push("var " + vars.join(",")) //Scan loop for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards idx = order[i] code.push(["for(i",i,"=0;i",i,"<s",idx,";++i",i,"){"].join("")) } //Push body of inner loop code.push(body) //Advance scan pointers for(i=0; i<dimension; ++i) { pidx = idx idx = order[i] for(j=0; j<nargs; ++j) { code.push(["p",j,"+=d",j,"s",i].join("")) } if(has_index) { if(i > 0) { code.push(["index[",pidx,"]-=s",pidx].join("")) } code.push(["++index[",idx,"]"].join("")) } code.push("}") } return code.join("\n") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loopTheLoop(firstSize, secondSize) {\n // not n^2 because of different inputs\n for (let i = 0; i < firstSize; i++) {\n for (let j = 1; j < secondSize; j++) {\n console.log(i, j);\n }\n }\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n code.push(\"var \" + vars.join(\",\"))\n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n } \n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n } \n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n } \n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function innerFill(order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , has_index = proc.indexArgs.length>0\r\n\t , code = []\r\n\t , vars = []\r\n\t , idx=0, pidx=0, i, j\r\n\t for(i=0; i<dimension; ++i) { // Iteration variables\r\n\t vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n\t }\r\n\t //Compute scan deltas\r\n\t for(j=0; j<nargs; ++j) {\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n\t vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n\t } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n\t vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t }\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t //Scan loop\r\n\t for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n\t idx = order[i]\r\n\t code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n\t }\r\n\t //Push body of inner loop\r\n\t code.push(body)\r\n\t //Advance scan pointers\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t for(j=0; j<nargs; ++j) {\r\n\t code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n\t }\r\n\t if(has_index) {\r\n\t if(i > 0) {\r\n\t code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n\t }\r\n\t code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n\t }\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function innerFill(order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , has_index = proc.indexArgs.length>0\r\n\t , code = []\r\n\t , vars = []\r\n\t , idx=0, pidx=0, i, j\r\n\t for(i=0; i<dimension; ++i) { // Iteration variables\r\n\t vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n\t }\r\n\t //Compute scan deltas\r\n\t for(j=0; j<nargs; ++j) {\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n\t vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n\t } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n\t vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t }\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t //Scan loop\r\n\t for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n\t idx = order[i]\r\n\t code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n\t }\r\n\t //Push body of inner loop\r\n\t code.push(body)\r\n\t //Advance scan pointers\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t for(j=0; j<nargs; ++j) {\r\n\t code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n\t }\r\n\t if(has_index) {\r\n\t if(i > 0) {\r\n\t code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n\t }\r\n\t code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n\t }\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function _loopArray(array, key) {\n var res = [],\n typeIn;\n for (var i = 0, len = array.length; i < len; i++) {\n typeIn = _typeOf(array[i]);\n switch (typeIn) {\n\n // two refrence type(Object/Array) need to loop them and push the return value to the result array\n case \"Array\":\n res.push(_encode(_loopArray(array[i], (key + \"[\" + i + \"]\"))));\n break;\n\n case \"Object\":\n res.push(_encode(_loopObject(array[i], (key + \"[\" + i + \"]\"))));\n break;\n\n // not Object/Array type direct push to the result array\n default:\n res.push(_encode(key + \"[]\" + \"=\" + array[i]));\n break;\n\n }\n }\n return res.join(\"&\");\n }", "function loopTheLoop() {\n // time complexity would be something like 45^47\n for (let i = 0; i < 45; i++) {\n for (let j = 1; j < 47; j++) {\n console.log(i, j);\n }\n }\n}", "function DoMapTypedSeqDepth1() {\n for (var i = 0; i < totalLength; i++) {\n // In this loop, since depth is 1, \"indices\" denotes singleton array [i].\n\n // Prepare input element/handle and out pointer\n var element = TypedObjectGet(inGrainType, inArray, inOffset);\n var out = TypedObjectGetOpaqueIf(outGrainType, result, outOffset,\n outGrainTypeIsComplex);\n\n // Invoke: var r = func(element, ...indices, collection, out);\n var r = func(element, i, inArray, out);\n if (r !== undefined)\n TypedObjectSet(outGrainType, result, outOffset, null, r); // result[i] = r\n\n // Update offsets and (implicitly) increment indices.\n inOffset += inUnitSize;\n outOffset += outUnitSize;\n }\n\n return result;\n }", "function myCoolFunction(arrA, arrB) {\n for (let i = 0; i < arrA.length; i++) { // n\n for (let j = 0; j < arrB.length; i++) { // m\n console.log(arrA[i] + arrB[j]) // 1\n }\n }\n}", "function cycleIterator(array) {\n let count = 0\n function innerFunc(){\n for(let i=0; i<array.length; i++){\n if(count < array.length){\n let result = array[count]\n count++\n return result\n }else{\n count = 0\n }\n };\n }\n return innerFunc\n}", "function doubleFor(array) {\n let newArray = []\n for(let i = 0; i < array.length; i++) {\n for(let j = i + 1; j < array.length; j++) {\n console.log(i, j)\n \n }\n }\n return newArray\n \n}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , blockSize = proc.blockSize\r\n , has_index = proc.indexArgs.length > 0\r\n , code = []\r\n for(var i=0; i<nargs; ++i) {\r\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n }\r\n //Generate loops for unmatched dimensions\r\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n code.push([\"j\",i,\"=0\"].join(\"\"))\r\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n if(has_index) {\r\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<nargs; ++i) {\r\n var indexStr = [\"offset\"+i]\r\n for(var j=matched; j<dimension; ++j) {\r\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n }\r\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n }\r\n code.push(innerFill(order, proc, body))\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function outerFill(matched, order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , blockSize = proc.blockSize\r\n , has_index = proc.indexArgs.length > 0\r\n , code = []\r\n for(var i=0; i<nargs; ++i) {\r\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n }\r\n //Generate loops for unmatched dimensions\r\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n code.push([\"j\",i,\"=0\"].join(\"\"))\r\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n if(has_index) {\r\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<nargs; ++i) {\r\n var indexStr = [\"offset\"+i]\r\n for(var j=matched; j<dimension; ++j) {\r\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n }\r\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n }\r\n code.push(innerFill(order, proc, body))\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function outerFill(matched, order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , blockSize = proc.blockSize\r\n , has_index = proc.indexArgs.length > 0\r\n , code = []\r\n for(var i=0; i<nargs; ++i) {\r\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n }\r\n //Generate loops for unmatched dimensions\r\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n code.push([\"j\",i,\"=0\"].join(\"\"))\r\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n if(has_index) {\r\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<nargs; ++i) {\r\n var indexStr = [\"offset\"+i]\r\n for(var j=matched; j<dimension; ++j) {\r\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n }\r\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n }\r\n code.push(innerFill(order, proc, body))\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function outerFill(matched, order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , blockSize = proc.blockSize\r\n , has_index = proc.indexArgs.length > 0\r\n , code = []\r\n for(var i=0; i<nargs; ++i) {\r\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n }\r\n //Generate loops for unmatched dimensions\r\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n code.push([\"j\",i,\"=0\"].join(\"\"))\r\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n if(has_index) {\r\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<nargs; ++i) {\r\n var indexStr = [\"offset\"+i]\r\n for(var j=matched; j<dimension; ++j) {\r\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n }\r\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n }\r\n code.push(innerFill(order, proc, body))\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function looping(x,y){\n for(var i=0; i<x; i++){\n for(var j=0; j<x; j++){
\n console.log(i*j);\n }\n }\n}", "function outerFill(matched, order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , blockSize = proc.blockSize\r\n\t , has_index = proc.indexArgs.length > 0\r\n\t , code = []\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n\t }\r\n\t //Generate loops for unmatched dimensions\r\n\t // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n\t // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n\t code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n\t code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n\t code.push([\"j\",i,\"=0\"].join(\"\"))\r\n\t code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n\t code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n\t if(has_index) {\r\n\t code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t var indexStr = [\"offset\"+i]\r\n\t for(var j=matched; j<dimension; ++j) {\r\n\t indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n\t }\r\n\t code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n\t }\r\n\t code.push(innerFill(order, proc, body))\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function outerFill(matched, order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , blockSize = proc.blockSize\r\n\t , has_index = proc.indexArgs.length > 0\r\n\t , code = []\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n\t }\r\n\t //Generate loops for unmatched dimensions\r\n\t // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n\t // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n\t code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n\t code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n\t code.push([\"j\",i,\"=0\"].join(\"\"))\r\n\t code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n\t code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n\t if(has_index) {\r\n\t code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t var indexStr = [\"offset\"+i]\r\n\t for(var j=matched; j<dimension; ++j) {\r\n\t indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n\t }\r\n\t code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n\t }\r\n\t code.push(innerFill(order, proc, body))\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function vectorize(generator) {\n return function () {\n var n, result, i, args;\n args = [].slice.call(arguments)\n n = args.shift();\n result = [];\n for (i = 0; i < n; i++) {\n result.push(generator.apply(this, args));\n }\n return result;\n };\n}", "function vectorize(generator) {\n return function () {\n var n, result, i, args;\n args = [].slice.call(arguments)\n n = args.shift();\n result = [];\n for (i = 0; i < n; i++) {\n result.push(generator.apply(this, args));\n }\n return result;\n };\n}", "function loopSimult(A) {\n return A[0].map((v, i) => {\n return A.reduce((prev, curr) => {\n return prev + curr[i];\n }, \"\");\n });\n}", "function createLoop(x, y, width, height) {\n // x = x - 1, x + width\n let loop = [x - 1, x + width]\n .map((nx) => range(y, y + height).map((ny) => [nx, ny]))\n // y = y - 1, y + height\n loop = loop.concat([y - 1, y + height]\n .map((ny) => range(x, x + width).map((nx) => [nx, ny])))\n loop = flatten2D(loop)\n\n return loop\n}", "function forLoopTwoToThe(arr) {\n arr.forEach(function (item, index) {\n arr[index] = 2 ** item;\n });\n return arr;\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n code.push(\"var \" + vars.join(\",\"))\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function each( x, F, i0, i1 )\n{\n var len = x.length, argslen = arguments.length;\n if ( argslen < 4 ) i1 = len-1;\n if ( 0 > i1 ) i1 += len;\n if ( argslen < 3 ) i0 = 0;\n if ( i0 > i1 ) return x;\n var i, k, l=i1-i0+1, l1, lr, r, q;\n r=l&15; q=r&1;\n if ( q ) F(x[i0], i0, x);\n for (i=q; i<r; i+=2)\n { \n k = i0+i;\n F(x[ k], k, x);\n F(x[++k], k, x);\n }\n for (i=r; i<l; i+=16)\n {\n k = i0+i;\n F(x[ k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n }\n return x;\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function mapIt1(el, idx, ary) {\n for (var i = 0; i < ary.length; i++) {\n el = el * 2;\n }\n}", "triLoop(iAryA,iAryB){\n\t\tvar a,b,c,d,p,\n\t\t\tlen = iAryA.length;\n\n\t\tfor(var i=0; i < len; i++){\n\t\t\tp = (i+1)%len;\n\t\t\ta = iAryB[i],\n\t\t\tb = iAryA[i],\n\t\t\tc = iAryA[p],\n\t\t\td = iAryB[p];\n\t\t\tthis.indices.push(a,b,c,c,d,a);\n\t\t}\n\t}", "function exSelf(array) {\n //two for loops and a counter\n // first for loop starting from begining\n // second start from end\n let products = new Array(array.length);\n let counter = 1;\n for ( let i = 0 ; i < array.length ; i ++ ){\n products[i] = counter;\n counter *= array[i];\n }\n\n //SECERET WHEN DECREMENTING:\n // products[j] *= counter\n // counter *= array[j];\n\n counter = 1;\n for ( let j = array.length - 1 ; j >= 0 ; j -- ){\n products[j] *= counter\n counter *= array[j];\n }\n\n return products\n\n}", "function generateCWiseOp(proc, typesig) {\r\n\t\r\n\t //Compute dimension\r\n\t // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n\t var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n\t var orders = new Array(proc.arrayArgs.length)\r\n\t var dtypes = new Array(proc.arrayArgs.length)\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t dtypes[i] = typesig[2*i]\r\n\t orders[i] = typesig[2*i+1]\r\n\t }\r\n\t \r\n\t //Determine where block and loop indices start and end\r\n\t var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n\t var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n\t var loopOrders = [] // orders restricted to the loop indices\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t if (proc.arrayBlockIndices[i]<0) {\r\n\t loopBegin.push(0)\r\n\t loopEnd.push(dimension)\r\n\t blockBegin.push(dimension)\r\n\t blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n\t } else {\r\n\t loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n\t loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n\t blockBegin.push(0)\r\n\t blockEnd.push(proc.arrayBlockIndices[i])\r\n\t }\r\n\t var newOrder = []\r\n\t for(var j=0; j<orders[i].length; j++) {\r\n\t if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n\t newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n\t }\r\n\t }\r\n\t loopOrders.push(newOrder)\r\n\t }\r\n\t\r\n\t //First create arguments for procedure\r\n\t var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n\t var code = [\"'use strict'\"]\r\n\t var vars = []\r\n\t \r\n\t for(var j=0; j<dimension; ++j) {\r\n\t vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n\t }\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t arglist.push(\"a\"+i) // Actual data array\r\n\t arglist.push(\"t\"+i) // Strides\r\n\t arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n\t \r\n\t for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n\t vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t \r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n\t vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n\t arglist.push(\"Y\" + i)\r\n\t }\r\n\t if(proc.shapeArgs.length > 0) {\r\n\t vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n\t }\r\n\t if(proc.indexArgs.length > 0) {\r\n\t // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n\t var zeros = new Array(dimension)\r\n\t for(var i=0; i<dimension; ++i) {\r\n\t zeros[i] = \"0\"\r\n\t }\r\n\t vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n\t }\r\n\t for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n\t var off_arg = proc.offsetArgs[i]\r\n\t var init_string = []\r\n\t for(var j=0; j<off_arg.offset.length; ++j) {\r\n\t if(off_arg.offset[j] === 0) {\r\n\t continue\r\n\t } else if(off_arg.offset[j] === 1) {\r\n\t init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n\t } else {\r\n\t init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n\t }\r\n\t }\r\n\t if(init_string.length === 0) {\r\n\t vars.push(\"q\" + i + \"=0\")\r\n\t } else {\r\n\t vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n\t }\r\n\t }\r\n\t\r\n\t //Prepare this variables\r\n\t var thisVars = uniq([].concat(proc.pre.thisVars)\r\n\t .concat(proc.body.thisVars)\r\n\t .concat(proc.post.thisVars))\r\n\t vars = vars.concat(thisVars)\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t code.push(\"p\"+i+\"|=0\")\r\n\t }\r\n\t \r\n\t //Inline prelude\r\n\t if(proc.pre.body.length > 3) {\r\n\t code.push(processBlock(proc.pre, proc, dtypes))\r\n\t }\r\n\t\r\n\t //Process body\r\n\t var body = processBlock(proc.body, proc, dtypes)\r\n\t var matched = countMatches(loopOrders)\r\n\t if(matched < dimension) {\r\n\t code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n\t } else {\r\n\t code.push(innerFill(loopOrders[0], proc, body))\r\n\t }\r\n\t\r\n\t //Inline epilog\r\n\t if(proc.post.body.length > 3) {\r\n\t code.push(processBlock(proc.post, proc, dtypes))\r\n\t }\r\n\t \r\n\t if(proc.debug) {\r\n\t console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n\t }\r\n\t \r\n\t var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n\t var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n\t return f()\r\n\t}", "function generateCWiseOp(proc, typesig) {\r\n\t\r\n\t //Compute dimension\r\n\t // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n\t var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n\t var orders = new Array(proc.arrayArgs.length)\r\n\t var dtypes = new Array(proc.arrayArgs.length)\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t dtypes[i] = typesig[2*i]\r\n\t orders[i] = typesig[2*i+1]\r\n\t }\r\n\t \r\n\t //Determine where block and loop indices start and end\r\n\t var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n\t var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n\t var loopOrders = [] // orders restricted to the loop indices\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t if (proc.arrayBlockIndices[i]<0) {\r\n\t loopBegin.push(0)\r\n\t loopEnd.push(dimension)\r\n\t blockBegin.push(dimension)\r\n\t blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n\t } else {\r\n\t loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n\t loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n\t blockBegin.push(0)\r\n\t blockEnd.push(proc.arrayBlockIndices[i])\r\n\t }\r\n\t var newOrder = []\r\n\t for(var j=0; j<orders[i].length; j++) {\r\n\t if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n\t newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n\t }\r\n\t }\r\n\t loopOrders.push(newOrder)\r\n\t }\r\n\t\r\n\t //First create arguments for procedure\r\n\t var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n\t var code = [\"'use strict'\"]\r\n\t var vars = []\r\n\t \r\n\t for(var j=0; j<dimension; ++j) {\r\n\t vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n\t }\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t arglist.push(\"a\"+i) // Actual data array\r\n\t arglist.push(\"t\"+i) // Strides\r\n\t arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n\t \r\n\t for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n\t vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t \r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n\t vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n\t arglist.push(\"Y\" + i)\r\n\t }\r\n\t if(proc.shapeArgs.length > 0) {\r\n\t vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n\t }\r\n\t if(proc.indexArgs.length > 0) {\r\n\t // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n\t var zeros = new Array(dimension)\r\n\t for(var i=0; i<dimension; ++i) {\r\n\t zeros[i] = \"0\"\r\n\t }\r\n\t vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n\t }\r\n\t for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n\t var off_arg = proc.offsetArgs[i]\r\n\t var init_string = []\r\n\t for(var j=0; j<off_arg.offset.length; ++j) {\r\n\t if(off_arg.offset[j] === 0) {\r\n\t continue\r\n\t } else if(off_arg.offset[j] === 1) {\r\n\t init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n\t } else {\r\n\t init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n\t }\r\n\t }\r\n\t if(init_string.length === 0) {\r\n\t vars.push(\"q\" + i + \"=0\")\r\n\t } else {\r\n\t vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n\t }\r\n\t }\r\n\t\r\n\t //Prepare this variables\r\n\t var thisVars = uniq([].concat(proc.pre.thisVars)\r\n\t .concat(proc.body.thisVars)\r\n\t .concat(proc.post.thisVars))\r\n\t vars = vars.concat(thisVars)\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t code.push(\"p\"+i+\"|=0\")\r\n\t }\r\n\t \r\n\t //Inline prelude\r\n\t if(proc.pre.body.length > 3) {\r\n\t code.push(processBlock(proc.pre, proc, dtypes))\r\n\t }\r\n\t\r\n\t //Process body\r\n\t var body = processBlock(proc.body, proc, dtypes)\r\n\t var matched = countMatches(loopOrders)\r\n\t if(matched < dimension) {\r\n\t code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n\t } else {\r\n\t code.push(innerFill(loopOrders[0], proc, body))\r\n\t }\r\n\t\r\n\t //Inline epilog\r\n\t if(proc.post.body.length > 3) {\r\n\t code.push(processBlock(proc.post, proc, dtypes))\r\n\t }\r\n\t \r\n\t if(proc.debug) {\r\n\t console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n\t }\r\n\t \r\n\t var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n\t var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n\t return f()\r\n\t}", "function changeArrayD(array) {\n for (let i = 0; i < array.length; i++) {\n for(let j = 0; j<array[i].length; j++){\n let arr = getcheil(array, i);\n arr = thesameR(arr)\n setcheil(array,i,arr);\n }\n }\n draw(array)\n return array;\n}", "function i(e,t){for(var n=0;n<e.length;n++)t(e[n],n)}", "function unite(arr1, arr2, arr3) {\n newArray = [];\n \n for (var i = 0; i < arguments.length; i++) {\n var arrLength = arguments[i];\n \n for (var j = 0; j < arrLength.length; j++) {\n var indexValue = arrLength[j];\n\n while (newArray.indexOf(indexValue) < 0) {\n newArray.push(indexValue);\n }\n }\n }\n \n return newArray;\n}", "function createPairs(arr) {\n\t// Unsure about this one, but again\n\t// the presence of nested loops leads me to guess\n\t// polynomial. I am not sure how to distinguish \n\t// between polynomial and exponential time by \n\t// reading the code\n for (let i = 0; i < arr.length; i++) {\n for(let j = i+1; j < arr.length; j++) {\n console.log(arr[i] + \", \" + arr[j] );\n }\n }\n}", "function loop(arr, i, n){\n for (let j=0; j<n; j++) {\n i++;\n if (_.isUndefined(arr[i])) i = 0;\n arr[i]++;\n }\n return arr;\n}", "function repeat(array){\n var repeat = []; // 1\n for (var j = 0; j < 10; j++){ // 1\n repeat[j] = []; // 1\n for (var i = 0; i < array.length; i++){ // n linear\n repeat[j].push(array[i]); // 1\n }\n }\n return repeat; \n}", "function f() {\n var n = a.length;\n for (var i = 0; i < n; i++) {\n }\n for (var i = 0; i < n; i++) {\n }\n}", "function do_loop(loop_pc, an_array, an_index, start_value, step, end_value) {\r\n\tan_array[an_index] = start_value;\r\n\tstack.push(new stack_frame(loop_pc, an_array, an_index, step, end_value));\r\n}", "function batmap(arr,mapFunc,otherArrsArray) {\n let narr = []\n otherArrsArray = transpose(otherArrsArray)\n for(var i=0;i<arr.length;i++){\n let value = arr[i]\n let func = mapFunc\n let oargs = otherArrsArray[i]\n let ele = func(value,...oargs)\n narr.push(ele)\n }\n return(narr)\n}", "_loopBy2Keys(index0, key0, key1, callback) {\n let index1, index2, key2;\n if ((index1 = index0[key0]) && (index2 = index1[key1])) {\n for (key2 in index2) callback(key2);\n }\n }", "function improved(array) {\n var prev = new Array(array.length);\n var next = new Array(array.length);\n\n var prev_index = 0;\n addPrevious(prev, array);\n addNext(next, array);\n\n array = multiply(prev, next);\n console.log(array);\n}", "function mainloop(work, e, arrFactory) {\n\t\"use strict\";\n\t\n\tvar xzm1 = arrFactory.getUint32Array(64)\n\t, xzm = arrFactory.getUint32Array(64)\n\t, xzmb = arrFactory.getUint32Array(64)\n\t, xzm1b = arrFactory.getUint32Array(64)\n\t, xznb = arrFactory.getUint32Array(64)\n\t, xzn1b = arrFactory.getUint32Array(64)\n\t, a0 = arrFactory.getUint32Array(64)\n\t, a1 = arrFactory.getUint32Array(64)\n\t, b0 = arrFactory.getUint32Array(64)\n\t, b1 = arrFactory.getUint32Array(64)\n\t, c1 = arrFactory.getUint32Array(64)\n\t, r = arrFactory.getUint32Array(32)\n\t, s = arrFactory.getUint32Array(32)\n\t, t = arrFactory.getUint32Array(32)\n\t, u = arrFactory.getUint32Array(32)\n\t, b = 0;\n\n\tfor (var j=0; j<32; j+=1) { xzm1[j] = work[j]; }\n\txzm1[32] = 1;\n\tfor (var j=33; j<64; j+=1) { xzm1[j] = 0; }\n\n\txzm[0] = 1;\n\tfor (var j=1; j<64; j+=1) { xzm[j] = 0; }\n\t \n\t// views of last 32 elements of original arrays\n\tvar xzmb_32 = xzmb.subarray(32, 64)\n\t, xzm1b_32 = xzm1b.subarray(32, 64)\n\t, a0_32 = a0.subarray(32, 64)\n\t, a1_32 = a1.subarray(32, 64)\n\t, b0_32 = b0.subarray(32, 64)\n\t, b1_32 = b1.subarray(32, 64)\n\t, c1_32 = c1.subarray(32, 64)\n\t, xznb_32 = xznb.subarray(32, 64)\n\t, xzn1b_32 = xzn1b.subarray(32, 64);\n\n\tfor (var pos=254; pos>=0; pos-=1) {\n\t\tb = e[Math.floor(pos/8)] >>> (pos & 7);\n\t\tb &= 1;\n\t\tselect(xzmb,xzm1b,xzm,xzm1,b);\n\t\tadd(a0,xzmb,xzmb_32);\n\t\tsub(a0_32,xzmb,xzmb_32);\n\t\tadd(a1,xzm1b,xzm1b_32);\n\t\tsub(a1_32,xzm1b,xzm1b_32);\n\t\tsquare(b0,a0);\n\t\tsquare(b0_32,a0_32);\n\t\tmult(b1,a1,a0_32);\n\t\tmult(b1_32,a1_32,a0);\n\t\tadd(c1,b1,b1_32);\n\t\tsub(c1_32,b1,b1_32);\n\t\tsquare(r,c1_32);\n\t\tsub(s,b0,b0_32);\n\t\tmult121665(t,s);\n\t\tadd(u,t,b0);\n\t\tmult(xznb,b0,b0_32);\n\t\tmult(xznb_32,s,u);\n\t\tsquare(xzn1b,c1);\n\t\tmult(xzn1b_32,r,work);\n\t\tselect(xzm,xzm1,xznb,xzn1b,b);\n\t}\n\n\twork.set(xzm);\n\t\n\tarrFactory.recycle(\n\t\t\txzm1, xzm, xzmb, xzm1b, xznb, xzn1b, a0, a1, b0, b1, c1, r, s, t, u);\n}", "function mainloop(work, e, arrFactory) {\n\t\"use strict\";\n\t\n\tvar xzm1 = arrFactory.getUint32Array(64)\n\t, xzm = arrFactory.getUint32Array(64)\n\t, xzmb = arrFactory.getUint32Array(64)\n\t, xzm1b = arrFactory.getUint32Array(64)\n\t, xznb = arrFactory.getUint32Array(64)\n\t, xzn1b = arrFactory.getUint32Array(64)\n\t, a0 = arrFactory.getUint32Array(64)\n\t, a1 = arrFactory.getUint32Array(64)\n\t, b0 = arrFactory.getUint32Array(64)\n\t, b1 = arrFactory.getUint32Array(64)\n\t, c1 = arrFactory.getUint32Array(64)\n\t, r = arrFactory.getUint32Array(32)\n\t, s = arrFactory.getUint32Array(32)\n\t, t = arrFactory.getUint32Array(32)\n\t, u = arrFactory.getUint32Array(32)\n\t, b = 0;\n\n\tfor (var j=0; j<32; j+=1) { xzm1[j] = work[j]; }\n\txzm1[32] = 1;\n\tfor (var j=33; j<64; j+=1) { xzm1[j] = 0; }\n\n\txzm[0] = 1;\n\tfor (var j=1; j<64; j+=1) { xzm[j] = 0; }\n\t \n\t// views of last 32 elements of original arrays\n\tvar xzmb_32 = xzmb.subarray(32, 64)\n\t, xzm1b_32 = xzm1b.subarray(32, 64)\n\t, a0_32 = a0.subarray(32, 64)\n\t, a1_32 = a1.subarray(32, 64)\n\t, b0_32 = b0.subarray(32, 64)\n\t, b1_32 = b1.subarray(32, 64)\n\t, c1_32 = c1.subarray(32, 64)\n\t, xznb_32 = xznb.subarray(32, 64)\n\t, xzn1b_32 = xzn1b.subarray(32, 64);\n\n\tfor (var pos=254; pos>=0; pos-=1) {\n\t\tb = e[Math.floor(pos/8)] >>> (pos & 7);\n\t\tb &= 1;\n\t\tselect(xzmb,xzm1b,xzm,xzm1,b);\n\t\tadd(a0,xzmb,xzmb_32);\n\t\tsub(a0_32,xzmb,xzmb_32);\n\t\tadd(a1,xzm1b,xzm1b_32);\n\t\tsub(a1_32,xzm1b,xzm1b_32);\n\t\tsquare(b0,a0);\n\t\tsquare(b0_32,a0_32);\n\t\tmult(b1,a1,a0_32);\n\t\tmult(b1_32,a1_32,a0);\n\t\tadd(c1,b1,b1_32);\n\t\tsub(c1_32,b1,b1_32);\n\t\tsquare(r,c1_32);\n\t\tsub(s,b0,b0_32);\n\t\tmult121665(t,s);\n\t\tadd(u,t,b0);\n\t\tmult(xznb,b0,b0_32);\n\t\tmult(xznb_32,s,u);\n\t\tsquare(xzn1b,c1);\n\t\tmult(xzn1b_32,r,work);\n\t\tselect(xzm,xzm1,xznb,xzn1b,b);\n\t}\n\n\twork.set(xzm);\n\t\n\tarrFactory.recycle(\n\t\t\txzm1, xzm, xzmb, xzm1b, xznb, xzn1b, a0, a1, b0, b1, c1, r, s, t, u);\n}", "function double_all(arr) {\n var ret = Array(arr.length);\n for (var i = 0; i < arr.length; ++i) {\n ret[i] = arr[i] * 2;\n }\n return ret;\n}", "function double_all(arr) {\n var ret = Array(arr.length);\n for (var i = 0; i < arr.length; ++i) {\n ret[i] = arr[i] * 2;\n }\n return ret;\n}", "function loopArray (array) {\n for (i = 0; i < array.length; i++)\n console.log(`Hello`, array[i]);\n}", "function sumForLoop() {\n \"use strict\";\n var args = Array.prototype.slice.apply(arguments, []);\n var sum = 0;\n for (var i = 0; i < args.length; i++) {\n sum += args[i];\n }\n return sum;\n\n}", "function a() {\n for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++) {\n console.log(i, j);\n }\n console.log(j, i);\n }\n}", "function a() {\n for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++) {\n console.log(i, j);\n }\n console.log(j, i);\n }\n}", "function a() {\n for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++) {\n console.log(i, j);\n }\n console.log(j, i);\n }\n}", "function double_all(arr) {\n var ret = Array(arr.length);\n for (var i = 0; i < arr.length; ++i) {\n ret[i] = arr[i] * 2;\n }\n return ret;\n}", "function FlattenIntoArray(target, source, sourceLen, start, depth /* , mapperFunction, thisArg */) { // eslint-disable-line no-unused-vars\n\t\tvar mapperFunction = arguments[5];\n\t\tvar thisArg = arguments[6];\n\t\t// 1. Let targetIndex be start.\n\t\tvar targetIndex = start;\n\t\t// 2. Let sourceIndex be 0.\n\t\tvar sourceIndex = 0;\n\t\t// 3. Repeat, while sourceIndex < sourceLen\n\t\twhile (sourceIndex < sourceLen) {\n\t\t\t// a. Let P be ! ToString(sourceIndex).\n\t\t\tvar P = ToString(sourceIndex);\n\t\t\t// b. Let exists be ? HasProperty(source, P).\n\t\t\tvar exists = HasProperty(source, P);\n\t\t\t// c. If exists is true, then\n\t\t\tif (exists === true) {\n\t\t\t\t// i. Let element be ? Get(source, P).\n\t\t\t\tvar element = Get(source, P);\n\t\t\t\t// ii. If mapperFunction is present, then\n\t\t\t\tif (5 in arguments) {\n\t\t\t\t\t// 1. Assert: thisArg is present.\n\t\t\t\t\t// 2. Set element to ? Call(mapperFunction, thisArg , « element, sourceIndex, source »).\n\t\t\t\t\telement = Call(mapperFunction, thisArg, [element, sourceIndex, source]);\n\t\t\t\t}\n\t\t\t\t// iii. Let shouldFlatten be false.\n\t\t\t\tvar shouldFlatten = false;\n\t\t\t\t// iv. If depth > 0, then\n\t\t\t\tif (depth > 0) {\n\t\t\t\t\t// 1. Set shouldFlatten to ? IsArray(element).\n\t\t\t\t\tshouldFlatten = IsArray(element);\n\t\t\t\t}\n\t\t\t\t// v. If shouldFlatten is true, then\n\t\t\t\tif (shouldFlatten === true) {\n\t\t\t\t\t// 1. Let elementLen be ? ToLength(? Get(element, \"length\")).\n\t\t\t\t\tvar elementLen = ToLength(Get(element, \"length\"));\n\t\t\t\t\t// 2. Set targetIndex to ? FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1).\n\t\t\t\t\ttargetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1); // eslint-disable-line no-unused-vars\n\t\t\t\t\t// vi. Else,\n\t\t\t\t} else {\n\t\t\t\t\t// 1. If targetIndex ≥ 253-1, throw a TypeError exception.\n\t\t\t\t\tif (targetIndex >= (Math.pow(2, 53) - 1)) {\n\t\t\t\t\t\tthrow new TypeError(\"targetIndex is greater than or equal to 2^53-1\");\n\t\t\t\t\t}\n\t\t\t\t\t// 2. Perform ? CreateDataPropertyOrThrow(target, ! ToString(targetIndex), element).\n\t\t\t\t\tCreateDataPropertyOrThrow(target, ToString(targetIndex), element);\n\t\t\t\t\t// 3. Increase targetIndex by 1.\n\t\t\t\t\ttargetIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// d. Increase sourceIndex by 1.\n\t\t\tsourceIndex += 1;\n\t\t}\n\t\t// 4. Return targetIndex.\n\t\treturn targetIndex;\n\t}", "function dim(...args) {\n var res, next;\n\n if (args.length == 1)\n return typeof args[0] === 'function'\n ? args[0]()\n : args[0];\n\n res = [];\n next = args.slice(1);\n\n for (var i = 0; i < args[0]; i++)\n res.push(dim(...next));\n\n return res;\n}", "function fn(n) {\n for (var i = 0; i < n; i++) {\n for (var j = 0; j < n; j++) {\n console.log(i, j);\n }\n }\n}", "function changeArrayL(array) {\n for (let i = 0; i < array.length; i++) {\n for(let j = 0; j<array[i].length; j++){\n array[i] = thesameL(array[i])\n }\n }\n draw(array)\n return array;\n}", "function executeLoop (loopParams, p1, p2, node) {\n // two loop locals are allowed\n // - for arrays it's the current value and the index\n // - for objects, it's the value and the key\n const scopedLocals = {}\n scopedLocals[loopParams[0]] = p1\n if (loopParams[1]) scopedLocals[loopParams[1]] = p2\n // merge nondestructively into existing locals\n const scopedOptions = merge(cloneDeep(options), { locals: scopedLocals })\n // walk through the contents and run replacements with modified options\n // we need to clone the node because the normal operation modifies\n // the node directly\n return walk(scopedOptions, cloneDeep(node.content))\n}", "function looping(x,y){\n for(var i=0; i<x; i++){\n for(var j=0; j<y; j++){
\n console.log(i*j);\n }\n }\n return x*y; //will exicute only for last x,y values\n}", "_loopBy2Keys(index0, key0, key1, callback) {\n var index1, index2, key2;\n\n if ((index1 = index0[key0]) && (index2 = index1[key1])) {\n for (key2 in index2) callback(key2);\n }\n }", "function maps(arr) {\n const doubled = arr.map(num => num * 2)\n return doubled\n}", "function cartesianProduct(arr1, arr2) {\n let result = [];\n for (let i = 0; i < arr1.length; i++) {\n let partial = 0;\n for (let j = 0; j < arr1[0].length; j++) {\n partial += arr1[i][j] * arr2[j]\n }\n result.push(partial)\n }\n return result\n}", "function arrayfy2 (operator, dim) {\n if (dim === 1) {\n return operator\n } else {\n return function (a, b) {\n var c = []\n\n for (var i = 0; i < dim; i++) {\n c.push(operator(a[i], b[i]))\n }\n\n return c\n }\n }\n}", "function changeArrayU(array) {\n for(let i = 0; i<array.length; i++){\n for(let j = 0; j<array[i].length; j++){\n let arr = getcheil(array, i);\n arr = thesameL(arr)\n setcheil(array,i,arr);\n }\n }\n draw(array)\n return array;\n}", "function arrayManipulation(n, queries) {\n\n\n}", "function loopAnArrayAgain(array) {\n for (var i = 0; i < array.length; i++) {\n console.log(array[i]);\n }\n}", "function GenArrays() {\n for (let i = 0; i < rows; i++) {\n aGen[i] = new Array(cols);\n pGen[i] = new Array(cols);\n }\n}", "function a() {\n for(var i=0; i<10; i++){\n for(var j=0; j<10; j++){\n console.log(i,j);\n }\n console.log(j,i);\n }\n}", "function loopAnArray(array) {\n var index = 0;\n while (index < array.length) {\n console.log(array[index]);\n index++;\n }\n}", "function forLoop(array) {\nfor (var i = 0; i < 25; i++)\n{\n if (i===1 || i===0){\n array.push(`I am ${i} strange loop.`)\n}\nelse {\n array.push(`I am ${i} strange loops.`)\n}}\n return array\n}", "compileArrayIndex(opts, result) {\nopts.dereferencedPointer = false;\nhelper.assertArray(opts.identifier, opts.token);\nlet program = this._program;\nlet identifier = opts.identifier;\nlet arraySize = identifier.getArraySize();\n// Check if it's a number, string or pointer then the size is 1.\n// If it's a record then it's the size of the record...\nlet identifierSize = identifier.getType().typePointer ? 1 : helper.getIdentifierSize(identifier.getType().type);\nif (typeof arraySize === 'number') {\n// It's a single dimensional array...\nopts.index++;\nopts.identifierSize = identifierSize;\nopts.arraySize = 1;\nopts.maxArraySize = arraySize;\nresult.dataSize = identifierSize;\nthis.compileArrayIndexToReg(opts);\n} else {\n// It's a multi dimensional array...\n// Calculate the array sized with the nested arrays inside...\nlet arraySizes = [];\nlet size = identifierSize;\nfor (let i = arraySize.length - 1; i > 0; i--) {\nsize *= arraySize[i];\narraySizes.unshift(size);\n}\narraySizes.push(identifierSize);\nfor (let i = 0; i < arraySize.length; i++) {\nopts.index++;\nopts.identifierSize = 1;\nopts.arraySize = arraySizes[i];\nopts.maxArraySize = arraySize[i];\nthis.compileArrayIndexToReg(opts);\nopts.index++;\nif ((opts.index >= opts.expression.tokens.length) && (i < arraySize.length - 1)) {\n// It's part of a multidimensional array, create an intermediary result type...\nresult.fullArrayAddress = false;\nresult.dataSize = arraySize[i];\nlet resultArraySize = [];\nfor (let j = i + 1; j < arraySize.length; j++) {\nresultArraySize.push(arraySize[j]);\n}\nif (resultArraySize.length === 1) {\nresultArraySize = resultArraySize[0];\n}\nresult.type = new Var({\ncompiler: this._compiler,\nunionId: 0,\nname: '?',\narraySize: resultArraySize,\noffset: identifier.getOffset(),\ntoken: identifier.getToken(),\ntype: identifier.getType().type,\ntypePointer: identifier.getType().typePointer,\nglobal: identifier.getGlobal(),\npointer: identifier.getPointer()\n});\nbreak;\n}\n}\nopts.index--;\n}\n// When writing the last field then we don't dereference the pointer...\nif (identifier.getPointer() && (!opts.forWriting || (opts.index + 1 < opts.expression.tokens.length))) {\nif (opts.identifier.getType().typePointer && (opts.reg !== $.REG_PTR)) {\nprogram.addCommand(\n$.CMD_SET, $.T_NUM_G, $.REG_PTR, $.T_NUM_G, opts.reg,\n$.CMD_SET, $.T_NUM_G, $.REG_PTR, $.T_NUM_P, 0,\n$.CMD_SET, $.T_NUM_G, opts.reg, $.T_NUM_G, $.REG_PTR\n);\n} else {\nif (!opts.dereferencedPointer && !opts.dereferencedPointerForWriting) {\nprogram.addCommand($.CMD_SET, $.T_NUM_G, $.REG_PTR, $.T_NUM_P, 0);\n}\nopts.dereferencedPointerForWriting = false;\n}\nopts.dereferencedPointer = true;\n}\nreturn opts;\n}", "function r$i(e,t,f,o){const s=f.typedBuffer,r=f.typedBufferStride,n=e.length;o*=r;for(let i=0;i<n;++i){const f=2*e[i];s[o]=t[f],s[o+1]=t[f+1],o+=r;}}", "function iterateArray(iterateArr) {\r\n var length = iterateArr.length\r\n for (var i = 0; i < length; i++) {\r\n console.log(iterateArr[i]);\r\n }\r\n}", "function loop(arr) {\n // i IS known here, but undefined\n // j IS NOT known here\n\n for( var i = 0; i < arr.length; i++ ) {\n // i IS known here, and has a value\n // j IS NOT known here\n };\n\n // i IS known here, and has a value\n // j IS NOT known here\n\n for( let j = 0; j < arr.length; j++ ) {\n // i IS known here, and has a value\n // j IS known here, and has a value\n\n };\n\n // i IS known here, and has a value\n // j IS NOT known here\n \n}", "function iterar1(argumento1) {\n for (let myLoop = 0; myLoop < argumento1.length; myLoop++) {\n console.log(argumento1[myLoop]);\n }\n}", "function arrayfy1 (operator, dim) {\n if (dim === 1) {\n return operator\n } else {\n return function (a) {\n var b = []\n\n for (var i = 0; i < dim; i++) {\n b.push(operator(a[i]))\n }\n\n return b\n }\n }\n}", "function timesIndexC(arr) {\n return arr.map (function (el, i) {\n return el * i\n })\n}", "function zip(arrays) {\n return arrays[0].map(function(_,i){\n return arrays.map(function(array){return array[i]})\n });\n}", "function loopEveryOther(array) {\n // for (i = 0; i < array.length; i+= 2){\n // console.log(array[i]);\n var i = 0;\n while (i < array.length) {\n console.log(array[i]);\n i += 2;\n }\n}", "function eqArrays(array1, array2){ \n if (array1.length !== array2.length) {\n return false;\n } \n for (let i = 0; i < array1.length; i++) { //check item at same index if the same; not nested for loop, not need both 1 and 2\n if(array1[i] !== array2[i]) { //end condition is not equal\n return false; \n } \n } \n return true; //return boolean\n }", "function makeArray(start, end, iter){\n const inputArray = [];\n for(let i = start; i < end + 1; i += iter){\n inputArray.push(i)\n }\n return inputArray;\n}", "function makeArray(start, end, iter){\n const inputArray = [];\n for(let i = start; i < end + 1; i += iter){\n inputArray.push(i)\n }\n return inputArray;\n}", "function double_all(arr) {\n if (!arr.length) { //constant\n return []; //constant\n }\n return [arr[0] * 2, ...double_all(arr.slice(1))]; \n}", "function easierEachWithIndex(array) {\n return turnThisIntoAnIteratorSomehow(function() {\n for (var i = 0; i != array.length; ++i) {\n yield({\n index: i,\n item: array[i]\n });\n }\n });\n}", "function all2(func2, arg1, arg2s) {\n var len = arg2s.length;\n for (var i = 0; i < len; i += 1) {\n\tfunc2(arg1, arg2s[$A$Num(i)]);\n }\n }", "function loop(arr, callback){\n for(var i=0; i<arr.length; i++){\n callback(arr[i], i);\n }\n}" ]
[ "0.61390644", "0.5961583", "0.59225935", "0.59225935", "0.59225935", "0.58168125", "0.58168125", "0.55257344", "0.55016446", "0.5497182", "0.54922116", "0.5455689", "0.5452755", "0.54517114", "0.54517114", "0.54517114", "0.54517114", "0.5385444", "0.5385444", "0.5385444", "0.5385444", "0.5286307", "0.52536494", "0.52536494", "0.52419734", "0.52419734", "0.52326035", "0.5200498", "0.5195066", "0.51947623", "0.51947623", "0.51947623", "0.51947623", "0.51876116", "0.5147211", "0.5147211", "0.5147211", "0.5147211", "0.51446456", "0.5144393", "0.51391053", "0.5100741", "0.5100741", "0.5089453", "0.50775456", "0.5072719", "0.50673616", "0.50644726", "0.5062556", "0.5037855", "0.5002036", "0.49869967", "0.498688", "0.4980915", "0.4973315", "0.4973315", "0.49590054", "0.49590054", "0.49544185", "0.49511376", "0.49357438", "0.49357438", "0.49357438", "0.49292874", "0.4923896", "0.49177176", "0.491521", "0.49129155", "0.49090898", "0.4902576", "0.4889374", "0.4888998", "0.48876786", "0.4880841", "0.4878297", "0.48499444", "0.4848163", "0.4840669", "0.4836443", "0.4832509", "0.48234227", "0.48198166", "0.48154446", "0.47946516", "0.47722557", "0.47687688", "0.4739151", "0.47377452", "0.4737374", "0.47338137", "0.47324613", "0.4727542", "0.4727542", "0.4721417", "0.47199315", "0.47199038", "0.47187537" ]
0.5941542
5
Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s is essentially unnecessary. I believe the s are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s dependent on what loop method is being used.
function outerFill(matched, order, proc, body) { var dimension = order.length , nargs = proc.arrayArgs.length , blockSize = proc.blockSize , has_index = proc.indexArgs.length > 0 , code = [] for(var i=0; i<nargs; ++i) { code.push(["var offset",i,"=p",i].join("")) } //Generate loops for unmatched dimensions // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument) // TODO: It would be nice if the order in which these loops are placed would also be somehow "optimal" (at the very least we should check that it really doesn't hurt us if they're not). for(var i=matched; i<dimension; ++i) { code.push(["for(var j"+i+"=SS[", order[i], "]|0;j", i, ">0;){"].join("")) // Iterate back to front code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). code.push(["s",order[i],"=j",i].join("")) code.push(["j",i,"=0"].join("")) code.push(["}else{s",order[i],"=",blockSize].join("")) code.push(["j",i,"-=",blockSize,"}"].join("")) if(has_index) { code.push(["index[",order[i],"]=j",i].join("")) } } for(var i=0; i<nargs; ++i) { var indexStr = ["offset"+i] for(var j=matched; j<dimension; ++j) { indexStr.push(["j",j,"*t",i,"p",order[j]].join("")) } code.push(["p",i,"=(",indexStr.join("+"),")"].join("")) } code.push(innerFill(order, proc, body)) for(var i=matched; i<dimension; ++i) { code.push("}") } return code.join("\n") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n code.push(\"var \" + vars.join(\",\"))\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\t\r\n\t //Compute dimension\r\n\t // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n\t var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n\t var orders = new Array(proc.arrayArgs.length)\r\n\t var dtypes = new Array(proc.arrayArgs.length)\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t dtypes[i] = typesig[2*i]\r\n\t orders[i] = typesig[2*i+1]\r\n\t }\r\n\t \r\n\t //Determine where block and loop indices start and end\r\n\t var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n\t var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n\t var loopOrders = [] // orders restricted to the loop indices\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t if (proc.arrayBlockIndices[i]<0) {\r\n\t loopBegin.push(0)\r\n\t loopEnd.push(dimension)\r\n\t blockBegin.push(dimension)\r\n\t blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n\t } else {\r\n\t loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n\t loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n\t blockBegin.push(0)\r\n\t blockEnd.push(proc.arrayBlockIndices[i])\r\n\t }\r\n\t var newOrder = []\r\n\t for(var j=0; j<orders[i].length; j++) {\r\n\t if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n\t newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n\t }\r\n\t }\r\n\t loopOrders.push(newOrder)\r\n\t }\r\n\t\r\n\t //First create arguments for procedure\r\n\t var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n\t var code = [\"'use strict'\"]\r\n\t var vars = []\r\n\t \r\n\t for(var j=0; j<dimension; ++j) {\r\n\t vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n\t }\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t arglist.push(\"a\"+i) // Actual data array\r\n\t arglist.push(\"t\"+i) // Strides\r\n\t arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n\t \r\n\t for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n\t vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t \r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n\t vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n\t arglist.push(\"Y\" + i)\r\n\t }\r\n\t if(proc.shapeArgs.length > 0) {\r\n\t vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n\t }\r\n\t if(proc.indexArgs.length > 0) {\r\n\t // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n\t var zeros = new Array(dimension)\r\n\t for(var i=0; i<dimension; ++i) {\r\n\t zeros[i] = \"0\"\r\n\t }\r\n\t vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n\t }\r\n\t for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n\t var off_arg = proc.offsetArgs[i]\r\n\t var init_string = []\r\n\t for(var j=0; j<off_arg.offset.length; ++j) {\r\n\t if(off_arg.offset[j] === 0) {\r\n\t continue\r\n\t } else if(off_arg.offset[j] === 1) {\r\n\t init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n\t } else {\r\n\t init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n\t }\r\n\t }\r\n\t if(init_string.length === 0) {\r\n\t vars.push(\"q\" + i + \"=0\")\r\n\t } else {\r\n\t vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n\t }\r\n\t }\r\n\t\r\n\t //Prepare this variables\r\n\t var thisVars = uniq([].concat(proc.pre.thisVars)\r\n\t .concat(proc.body.thisVars)\r\n\t .concat(proc.post.thisVars))\r\n\t vars = vars.concat(thisVars)\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t code.push(\"p\"+i+\"|=0\")\r\n\t }\r\n\t \r\n\t //Inline prelude\r\n\t if(proc.pre.body.length > 3) {\r\n\t code.push(processBlock(proc.pre, proc, dtypes))\r\n\t }\r\n\t\r\n\t //Process body\r\n\t var body = processBlock(proc.body, proc, dtypes)\r\n\t var matched = countMatches(loopOrders)\r\n\t if(matched < dimension) {\r\n\t code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n\t } else {\r\n\t code.push(innerFill(loopOrders[0], proc, body))\r\n\t }\r\n\t\r\n\t //Inline epilog\r\n\t if(proc.post.body.length > 3) {\r\n\t code.push(processBlock(proc.post, proc, dtypes))\r\n\t }\r\n\t \r\n\t if(proc.debug) {\r\n\t console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n\t }\r\n\t \r\n\t var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n\t var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n\t return f()\r\n\t}", "function generateCWiseOp(proc, typesig) {\r\n\t\r\n\t //Compute dimension\r\n\t // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n\t var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n\t var orders = new Array(proc.arrayArgs.length)\r\n\t var dtypes = new Array(proc.arrayArgs.length)\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t dtypes[i] = typesig[2*i]\r\n\t orders[i] = typesig[2*i+1]\r\n\t }\r\n\t \r\n\t //Determine where block and loop indices start and end\r\n\t var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n\t var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n\t var loopOrders = [] // orders restricted to the loop indices\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t if (proc.arrayBlockIndices[i]<0) {\r\n\t loopBegin.push(0)\r\n\t loopEnd.push(dimension)\r\n\t blockBegin.push(dimension)\r\n\t blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n\t } else {\r\n\t loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n\t loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n\t blockBegin.push(0)\r\n\t blockEnd.push(proc.arrayBlockIndices[i])\r\n\t }\r\n\t var newOrder = []\r\n\t for(var j=0; j<orders[i].length; j++) {\r\n\t if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n\t newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n\t }\r\n\t }\r\n\t loopOrders.push(newOrder)\r\n\t }\r\n\t\r\n\t //First create arguments for procedure\r\n\t var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n\t var code = [\"'use strict'\"]\r\n\t var vars = []\r\n\t \r\n\t for(var j=0; j<dimension; ++j) {\r\n\t vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n\t }\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t arglist.push(\"a\"+i) // Actual data array\r\n\t arglist.push(\"t\"+i) // Strides\r\n\t arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n\t \r\n\t for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n\t vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t \r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n\t vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n\t arglist.push(\"Y\" + i)\r\n\t }\r\n\t if(proc.shapeArgs.length > 0) {\r\n\t vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n\t }\r\n\t if(proc.indexArgs.length > 0) {\r\n\t // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n\t var zeros = new Array(dimension)\r\n\t for(var i=0; i<dimension; ++i) {\r\n\t zeros[i] = \"0\"\r\n\t }\r\n\t vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n\t }\r\n\t for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n\t var off_arg = proc.offsetArgs[i]\r\n\t var init_string = []\r\n\t for(var j=0; j<off_arg.offset.length; ++j) {\r\n\t if(off_arg.offset[j] === 0) {\r\n\t continue\r\n\t } else if(off_arg.offset[j] === 1) {\r\n\t init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n\t } else {\r\n\t init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n\t }\r\n\t }\r\n\t if(init_string.length === 0) {\r\n\t vars.push(\"q\" + i + \"=0\")\r\n\t } else {\r\n\t vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n\t }\r\n\t }\r\n\t\r\n\t //Prepare this variables\r\n\t var thisVars = uniq([].concat(proc.pre.thisVars)\r\n\t .concat(proc.body.thisVars)\r\n\t .concat(proc.post.thisVars))\r\n\t vars = vars.concat(thisVars)\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t code.push(\"p\"+i+\"|=0\")\r\n\t }\r\n\t \r\n\t //Inline prelude\r\n\t if(proc.pre.body.length > 3) {\r\n\t code.push(processBlock(proc.pre, proc, dtypes))\r\n\t }\r\n\t\r\n\t //Process body\r\n\t var body = processBlock(proc.body, proc, dtypes)\r\n\t var matched = countMatches(loopOrders)\r\n\t if(matched < dimension) {\r\n\t code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n\t } else {\r\n\t code.push(innerFill(loopOrders[0], proc, body))\r\n\t }\r\n\t\r\n\t //Inline epilog\r\n\t if(proc.post.body.length > 3) {\r\n\t code.push(processBlock(proc.post, proc, dtypes))\r\n\t }\r\n\t \r\n\t if(proc.debug) {\r\n\t console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n\t }\r\n\t \r\n\t var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n\t var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n\t return f()\r\n\t}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n var dimension = typesig[1].length|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n\n //First create arguments for procedure\n var arglist = [\"SS\"]\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i)\n arglist.push(\"t\"+i)\n arglist.push(\"p\"+i)\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\")\n }\n if(proc.indexArgs.length > 0) {\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) {\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n code.push(\"var \" + vars.join(\",\"))\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(orders)\n if(matched < dimension) {\n code.push(outerFill(matched, orders[0], proc, body))\n } else {\n code.push(innerFill(orders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"Generated cwise routine for \", typesig, \":\\n\\n\", code.join(\"\\n\"))\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n var dimension = typesig[1].length|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n\n //First create arguments for procedure\n var arglist = [\"SS\"]\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i)\n arglist.push(\"t\"+i)\n arglist.push(\"p\"+i)\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\")\n }\n if(proc.indexArgs.length > 0) {\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) {\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n code.push(\"var \" + vars.join(\",\"))\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(orders)\n if(matched < dimension) {\n code.push(outerFill(matched, orders[0], proc, body))\n } else {\n code.push(innerFill(orders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"Generated cwise routine for \", typesig, \":\\n\\n\", code.join(\"\\n\"))\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n code.push(\"var \" + vars.join(\",\"))\n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n } \n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n } \n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n } \n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function innerFill(order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , has_index = proc.indexArgs.length>0\r\n , code = []\r\n , vars = []\r\n , idx=0, pidx=0, i, j\r\n for(i=0; i<dimension; ++i) { // Iteration variables\r\n vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n }\r\n //Compute scan deltas\r\n for(j=0; j<nargs; ++j) {\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n }\r\n }\r\n }\r\n code.push(\"var \" + vars.join(\",\"))\r\n //Scan loop\r\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n idx = order[i]\r\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n }\r\n //Push body of inner loop\r\n code.push(body)\r\n //Advance scan pointers\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n for(j=0; j<nargs; ++j) {\r\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n }\r\n if(has_index) {\r\n if(i > 0) {\r\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n }\r\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n }\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function innerFill(order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , has_index = proc.indexArgs.length>0\r\n , code = []\r\n , vars = []\r\n , idx=0, pidx=0, i, j\r\n for(i=0; i<dimension; ++i) { // Iteration variables\r\n vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n }\r\n //Compute scan deltas\r\n for(j=0; j<nargs; ++j) {\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n }\r\n }\r\n }\r\n code.push(\"var \" + vars.join(\",\"))\r\n //Scan loop\r\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n idx = order[i]\r\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n }\r\n //Push body of inner loop\r\n code.push(body)\r\n //Advance scan pointers\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n for(j=0; j<nargs; ++j) {\r\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n }\r\n if(has_index) {\r\n if(i > 0) {\r\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n }\r\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n }\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function innerFill(order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , has_index = proc.indexArgs.length>0\r\n , code = []\r\n , vars = []\r\n , idx=0, pidx=0, i, j\r\n for(i=0; i<dimension; ++i) { // Iteration variables\r\n vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n }\r\n //Compute scan deltas\r\n for(j=0; j<nargs; ++j) {\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n }\r\n }\r\n }\r\n code.push(\"var \" + vars.join(\",\"))\r\n //Scan loop\r\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n idx = order[i]\r\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n }\r\n //Push body of inner loop\r\n code.push(body)\r\n //Advance scan pointers\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n for(j=0; j<nargs; ++j) {\r\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n }\r\n if(has_index) {\r\n if(i > 0) {\r\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n }\r\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n }\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function innerFill(order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , has_index = proc.indexArgs.length>0\r\n , code = []\r\n , vars = []\r\n , idx=0, pidx=0, i, j\r\n for(i=0; i<dimension; ++i) { // Iteration variables\r\n vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n }\r\n //Compute scan deltas\r\n for(j=0; j<nargs; ++j) {\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n }\r\n }\r\n }\r\n code.push(\"var \" + vars.join(\",\"))\r\n //Scan loop\r\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n idx = order[i]\r\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n }\r\n //Push body of inner loop\r\n code.push(body)\r\n //Advance scan pointers\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n for(j=0; j<nargs; ++j) {\r\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n }\r\n if(has_index) {\r\n if(i > 0) {\r\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n }\r\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n }\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function innerFill(order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , has_index = proc.indexArgs.length>0\r\n\t , code = []\r\n\t , vars = []\r\n\t , idx=0, pidx=0, i, j\r\n\t for(i=0; i<dimension; ++i) { // Iteration variables\r\n\t vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n\t }\r\n\t //Compute scan deltas\r\n\t for(j=0; j<nargs; ++j) {\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n\t vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n\t } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n\t vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t }\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t //Scan loop\r\n\t for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n\t idx = order[i]\r\n\t code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n\t }\r\n\t //Push body of inner loop\r\n\t code.push(body)\r\n\t //Advance scan pointers\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t for(j=0; j<nargs; ++j) {\r\n\t code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n\t }\r\n\t if(has_index) {\r\n\t if(i > 0) {\r\n\t code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n\t }\r\n\t code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n\t }\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function innerFill(order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , has_index = proc.indexArgs.length>0\r\n\t , code = []\r\n\t , vars = []\r\n\t , idx=0, pidx=0, i, j\r\n\t for(i=0; i<dimension; ++i) { // Iteration variables\r\n\t vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n\t }\r\n\t //Compute scan deltas\r\n\t for(j=0; j<nargs; ++j) {\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n\t vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n\t } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n\t vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t }\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t //Scan loop\r\n\t for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n\t idx = order[i]\r\n\t code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n\t }\r\n\t //Push body of inner loop\r\n\t code.push(body)\r\n\t //Advance scan pointers\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t for(j=0; j<nargs; ++j) {\r\n\t code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n\t }\r\n\t if(has_index) {\r\n\t if(i > 0) {\r\n\t code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n\t }\r\n\t code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n\t }\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , blockSize = proc.blockSize\r\n\t , has_index = proc.indexArgs.length > 0\r\n\t , code = []\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n\t }\r\n\t //Generate loops for unmatched dimensions\r\n\t // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n\t // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n\t code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n\t code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n\t code.push([\"j\",i,\"=0\"].join(\"\"))\r\n\t code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n\t code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n\t if(has_index) {\r\n\t code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t var indexStr = [\"offset\"+i]\r\n\t for(var j=matched; j<dimension; ++j) {\r\n\t indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n\t }\r\n\t code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n\t }\r\n\t code.push(innerFill(order, proc, body))\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function outerFill(matched, order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , blockSize = proc.blockSize\r\n\t , has_index = proc.indexArgs.length > 0\r\n\t , code = []\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n\t }\r\n\t //Generate loops for unmatched dimensions\r\n\t // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n\t // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n\t code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n\t code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n\t code.push([\"j\",i,\"=0\"].join(\"\"))\r\n\t code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n\t code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n\t if(has_index) {\r\n\t code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t var indexStr = [\"offset\"+i]\r\n\t for(var j=matched; j<dimension; ++j) {\r\n\t indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n\t }\r\n\t code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n\t }\r\n\t code.push(innerFill(order, proc, body))\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function processBlock(block, proc, dtypes) {\r\n\t var code = block.body\r\n\t var pre = []\r\n\t var post = []\r\n\t for(var i=0; i<block.args.length; ++i) {\r\n\t var carg = block.args[i]\r\n\t if(carg.count <= 0) {\r\n\t continue\r\n\t }\r\n\t var re = new RegExp(carg.name, \"g\")\r\n\t var ptrStr = \"\"\r\n\t var arrNum = proc.arrayArgs.indexOf(i)\r\n\t switch(proc.argTypes[i]) {\r\n\t case \"offset\":\r\n\t var offArgIndex = proc.offsetArgIndex.indexOf(i)\r\n\t var offArg = proc.offsetArgs[offArgIndex]\r\n\t arrNum = offArg.array\r\n\t ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\r\n\t case \"array\":\r\n\t ptrStr = \"p\" + arrNum + ptrStr\r\n\t var localStr = \"l\" + i\r\n\t var arrStr = \"a\" + arrNum\r\n\t if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\r\n\t if(carg.count === 1) { // Argument/array used only once(?)\r\n\t if(dtypes[arrNum] === \"generic\") {\r\n\t if(carg.lvalue) {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n\t code = code.replace(re, localStr)\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n\t }\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n\t }\r\n\t } else if(dtypes[arrNum] === \"generic\") {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n\t code = code.replace(re, localStr)\r\n\t if(carg.lvalue) {\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t }\r\n\t } else {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n\t code = code.replace(re, localStr)\r\n\t if(carg.lvalue) {\r\n\t post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\r\n\t }\r\n\t }\r\n\t } else { // Argument to body is a \"block\"\r\n\t var reStrArr = [carg.name], ptrStrArr = [ptrStr]\r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\r\n\t reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\r\n\t ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\r\n\t }\r\n\t re = new RegExp(reStrArr.join(\"\"), \"g\")\r\n\t ptrStr = ptrStrArr.join(\"+\")\r\n\t if(dtypes[arrNum] === \"generic\") {\r\n\t /*if(carg.lvalue) {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n\t code = code.replace(re, localStr)\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n\t }*/\r\n\t throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\r\n\t } else {\r\n\t // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\r\n\t code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t break\r\n\t case \"scalar\":\r\n\t code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\r\n\t break\r\n\t case \"index\":\r\n\t code = code.replace(re, \"index\")\r\n\t break\r\n\t case \"shape\":\r\n\t code = code.replace(re, \"shape\")\r\n\t break\r\n\t }\r\n\t }\r\n\t return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\r\n\t}", "function processBlock(block, proc, dtypes) {\r\n\t var code = block.body\r\n\t var pre = []\r\n\t var post = []\r\n\t for(var i=0; i<block.args.length; ++i) {\r\n\t var carg = block.args[i]\r\n\t if(carg.count <= 0) {\r\n\t continue\r\n\t }\r\n\t var re = new RegExp(carg.name, \"g\")\r\n\t var ptrStr = \"\"\r\n\t var arrNum = proc.arrayArgs.indexOf(i)\r\n\t switch(proc.argTypes[i]) {\r\n\t case \"offset\":\r\n\t var offArgIndex = proc.offsetArgIndex.indexOf(i)\r\n\t var offArg = proc.offsetArgs[offArgIndex]\r\n\t arrNum = offArg.array\r\n\t ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\r\n\t case \"array\":\r\n\t ptrStr = \"p\" + arrNum + ptrStr\r\n\t var localStr = \"l\" + i\r\n\t var arrStr = \"a\" + arrNum\r\n\t if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\r\n\t if(carg.count === 1) { // Argument/array used only once(?)\r\n\t if(dtypes[arrNum] === \"generic\") {\r\n\t if(carg.lvalue) {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n\t code = code.replace(re, localStr)\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n\t }\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n\t }\r\n\t } else if(dtypes[arrNum] === \"generic\") {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n\t code = code.replace(re, localStr)\r\n\t if(carg.lvalue) {\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t }\r\n\t } else {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n\t code = code.replace(re, localStr)\r\n\t if(carg.lvalue) {\r\n\t post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\r\n\t }\r\n\t }\r\n\t } else { // Argument to body is a \"block\"\r\n\t var reStrArr = [carg.name], ptrStrArr = [ptrStr]\r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\r\n\t reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\r\n\t ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\r\n\t }\r\n\t re = new RegExp(reStrArr.join(\"\"), \"g\")\r\n\t ptrStr = ptrStrArr.join(\"+\")\r\n\t if(dtypes[arrNum] === \"generic\") {\r\n\t /*if(carg.lvalue) {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n\t code = code.replace(re, localStr)\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n\t }*/\r\n\t throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\r\n\t } else {\r\n\t // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\r\n\t code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t break\r\n\t case \"scalar\":\r\n\t code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\r\n\t break\r\n\t case \"index\":\r\n\t code = code.replace(re, \"index\")\r\n\t break\r\n\t case \"shape\":\r\n\t code = code.replace(re, \"shape\")\r\n\t break\r\n\t }\r\n\t }\r\n\t return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\r\n\t}", "foreach(fct) {\n let action = (x, y) => fct(x, y);\n for (let i = 0; i < this.blocks.length; i++) {\n action(this.x + this.blocks[i].x, this.y + this.blocks[i].y);\n }\n }", "function processBlock(block, proc, dtypes) {\r\n var code = block.body\r\n var pre = []\r\n var post = []\r\n for(var i=0; i<block.args.length; ++i) {\r\n var carg = block.args[i]\r\n if(carg.count <= 0) {\r\n continue\r\n }\r\n var re = new RegExp(carg.name, \"g\")\r\n var ptrStr = \"\"\r\n var arrNum = proc.arrayArgs.indexOf(i)\r\n switch(proc.argTypes[i]) {\r\n case \"offset\":\r\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\r\n var offArg = proc.offsetArgs[offArgIndex]\r\n arrNum = offArg.array\r\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\r\n case \"array\":\r\n ptrStr = \"p\" + arrNum + ptrStr\r\n var localStr = \"l\" + i\r\n var arrStr = \"a\" + arrNum\r\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\r\n if(carg.count === 1) { // Argument/array used only once(?)\r\n if(dtypes[arrNum] === \"generic\") {\r\n if(carg.lvalue) {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n code = code.replace(re, localStr)\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n } else {\r\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n }\r\n } else {\r\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n }\r\n } else if(dtypes[arrNum] === \"generic\") {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n code = code.replace(re, localStr)\r\n if(carg.lvalue) {\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n }\r\n } else {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n code = code.replace(re, localStr)\r\n if(carg.lvalue) {\r\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\r\n }\r\n }\r\n } else { // Argument to body is a \"block\"\r\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\r\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\r\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\r\n }\r\n re = new RegExp(reStrArr.join(\"\"), \"g\")\r\n ptrStr = ptrStrArr.join(\"+\")\r\n if(dtypes[arrNum] === \"generic\") {\r\n /*if(carg.lvalue) {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n code = code.replace(re, localStr)\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n } else {\r\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n }*/\r\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\r\n } else {\r\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\r\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n }\r\n }\r\n break\r\n case \"scalar\":\r\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\r\n break\r\n case \"index\":\r\n code = code.replace(re, \"index\")\r\n break\r\n case \"shape\":\r\n code = code.replace(re, \"shape\")\r\n break\r\n }\r\n }\r\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\r\n}", "function processBlock(block, proc, dtypes) {\r\n var code = block.body\r\n var pre = []\r\n var post = []\r\n for(var i=0; i<block.args.length; ++i) {\r\n var carg = block.args[i]\r\n if(carg.count <= 0) {\r\n continue\r\n }\r\n var re = new RegExp(carg.name, \"g\")\r\n var ptrStr = \"\"\r\n var arrNum = proc.arrayArgs.indexOf(i)\r\n switch(proc.argTypes[i]) {\r\n case \"offset\":\r\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\r\n var offArg = proc.offsetArgs[offArgIndex]\r\n arrNum = offArg.array\r\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\r\n case \"array\":\r\n ptrStr = \"p\" + arrNum + ptrStr\r\n var localStr = \"l\" + i\r\n var arrStr = \"a\" + arrNum\r\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\r\n if(carg.count === 1) { // Argument/array used only once(?)\r\n if(dtypes[arrNum] === \"generic\") {\r\n if(carg.lvalue) {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n code = code.replace(re, localStr)\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n } else {\r\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n }\r\n } else {\r\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n }\r\n } else if(dtypes[arrNum] === \"generic\") {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n code = code.replace(re, localStr)\r\n if(carg.lvalue) {\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n }\r\n } else {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n code = code.replace(re, localStr)\r\n if(carg.lvalue) {\r\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\r\n }\r\n }\r\n } else { // Argument to body is a \"block\"\r\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\r\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\r\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\r\n }\r\n re = new RegExp(reStrArr.join(\"\"), \"g\")\r\n ptrStr = ptrStrArr.join(\"+\")\r\n if(dtypes[arrNum] === \"generic\") {\r\n /*if(carg.lvalue) {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n code = code.replace(re, localStr)\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n } else {\r\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n }*/\r\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\r\n } else {\r\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\r\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n }\r\n }\r\n break\r\n case \"scalar\":\r\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\r\n break\r\n case \"index\":\r\n code = code.replace(re, \"index\")\r\n break\r\n case \"shape\":\r\n code = code.replace(re, \"shape\")\r\n break\r\n }\r\n }\r\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\r\n}", "function processBlock(block, proc, dtypes) {\r\n var code = block.body\r\n var pre = []\r\n var post = []\r\n for(var i=0; i<block.args.length; ++i) {\r\n var carg = block.args[i]\r\n if(carg.count <= 0) {\r\n continue\r\n }\r\n var re = new RegExp(carg.name, \"g\")\r\n var ptrStr = \"\"\r\n var arrNum = proc.arrayArgs.indexOf(i)\r\n switch(proc.argTypes[i]) {\r\n case \"offset\":\r\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\r\n var offArg = proc.offsetArgs[offArgIndex]\r\n arrNum = offArg.array\r\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\r\n case \"array\":\r\n ptrStr = \"p\" + arrNum + ptrStr\r\n var localStr = \"l\" + i\r\n var arrStr = \"a\" + arrNum\r\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\r\n if(carg.count === 1) { // Argument/array used only once(?)\r\n if(dtypes[arrNum] === \"generic\") {\r\n if(carg.lvalue) {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n code = code.replace(re, localStr)\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n } else {\r\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n }\r\n } else {\r\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n }\r\n } else if(dtypes[arrNum] === \"generic\") {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n code = code.replace(re, localStr)\r\n if(carg.lvalue) {\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n }\r\n } else {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n code = code.replace(re, localStr)\r\n if(carg.lvalue) {\r\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\r\n }\r\n }\r\n } else { // Argument to body is a \"block\"\r\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\r\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\r\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\r\n }\r\n re = new RegExp(reStrArr.join(\"\"), \"g\")\r\n ptrStr = ptrStrArr.join(\"+\")\r\n if(dtypes[arrNum] === \"generic\") {\r\n /*if(carg.lvalue) {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n code = code.replace(re, localStr)\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n } else {\r\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n }*/\r\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\r\n } else {\r\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\r\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n }\r\n }\r\n break\r\n case \"scalar\":\r\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\r\n break\r\n case \"index\":\r\n code = code.replace(re, \"index\")\r\n break\r\n case \"shape\":\r\n code = code.replace(re, \"shape\")\r\n break\r\n }\r\n }\r\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\r\n}", "function processBlock(block, proc, dtypes) {\r\n var code = block.body\r\n var pre = []\r\n var post = []\r\n for(var i=0; i<block.args.length; ++i) {\r\n var carg = block.args[i]\r\n if(carg.count <= 0) {\r\n continue\r\n }\r\n var re = new RegExp(carg.name, \"g\")\r\n var ptrStr = \"\"\r\n var arrNum = proc.arrayArgs.indexOf(i)\r\n switch(proc.argTypes[i]) {\r\n case \"offset\":\r\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\r\n var offArg = proc.offsetArgs[offArgIndex]\r\n arrNum = offArg.array\r\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\r\n case \"array\":\r\n ptrStr = \"p\" + arrNum + ptrStr\r\n var localStr = \"l\" + i\r\n var arrStr = \"a\" + arrNum\r\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\r\n if(carg.count === 1) { // Argument/array used only once(?)\r\n if(dtypes[arrNum] === \"generic\") {\r\n if(carg.lvalue) {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n code = code.replace(re, localStr)\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n } else {\r\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n }\r\n } else {\r\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n }\r\n } else if(dtypes[arrNum] === \"generic\") {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n code = code.replace(re, localStr)\r\n if(carg.lvalue) {\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n }\r\n } else {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n code = code.replace(re, localStr)\r\n if(carg.lvalue) {\r\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\r\n }\r\n }\r\n } else { // Argument to body is a \"block\"\r\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\r\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\r\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\r\n }\r\n re = new RegExp(reStrArr.join(\"\"), \"g\")\r\n ptrStr = ptrStrArr.join(\"+\")\r\n if(dtypes[arrNum] === \"generic\") {\r\n /*if(carg.lvalue) {\r\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n code = code.replace(re, localStr)\r\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n } else {\r\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n }*/\r\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\r\n } else {\r\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\r\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n }\r\n }\r\n break\r\n case \"scalar\":\r\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\r\n break\r\n case \"index\":\r\n code = code.replace(re, \"index\")\r\n break\r\n case \"shape\":\r\n code = code.replace(re, \"shape\")\r\n break\r\n }\r\n }\r\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\r\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\n if(carg.count === 1) { // Argument/array used only once(?)\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n } else { // Argument to body is a \"block\"\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\n }\n re = new RegExp(reStrArr.join(\"\"), \"g\")\n ptrStr = ptrStrArr.join(\"+\")\n if(dtypes[arrNum] === \"generic\") {\n /*if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }*/\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\n } else {\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\n if(carg.count === 1) { // Argument/array used only once(?)\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n } else { // Argument to body is a \"block\"\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\n }\n re = new RegExp(reStrArr.join(\"\"), \"g\")\n ptrStr = ptrStrArr.join(\"+\")\n if(dtypes[arrNum] === \"generic\") {\n /*if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }*/\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\n } else {\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\n if(carg.count === 1) { // Argument/array used only once(?)\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n } else { // Argument to body is a \"block\"\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\n }\n re = new RegExp(reStrArr.join(\"\"), \"g\")\n ptrStr = ptrStrArr.join(\"+\")\n if(dtypes[arrNum] === \"generic\") {\n /*if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }*/\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\n } else {\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\n if(carg.count === 1) { // Argument/array used only once(?)\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n } else { // Argument to body is a \"block\"\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\n }\n re = new RegExp(reStrArr.join(\"\"), \"g\")\n ptrStr = ptrStrArr.join(\"+\")\n if(dtypes[arrNum] === \"generic\") {\n /*if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }*/\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\n } else {\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function gen_thumb2_data_op(/* DisasContext * */ s, /* int */ op, /* int */ conds, /* uint32_t */ shifter_out)\n{\n var logic_cc;\n\n logic_cc = 0;\n switch (op) {\n case 0: /* and */\n gen_op_andl_T0_T1();\n logic_cc = conds;\n break;\n case 1: /* bic */\n gen_op_bicl_T0_T1();\n logic_cc = conds;\n break;\n case 2: /* orr */\n gen_op_orl_T0_T1();\n logic_cc = conds;\n break;\n case 3: /* orn */\n gen_op_notl_T1();\n gen_op_orl_T0_T1();\n logic_cc = conds;\n break;\n case 4: /* eor */\n gen_op_xorl_T0_T1();\n logic_cc = conds;\n break;\n case 8: /* add */\n if (conds)\n gen_op_addl_T0_T1_cc();\n else\n gen_op_addl_T0_T1();\n break;\n case 10: /* adc */\n if (conds)\n gen_op_adcl_T0_T1_cc();\n else\n gen_op_adcl_T0_T1();\n break;\n case 11: /* sbc */\n if (conds)\n gen_op_sbcl_T0_T1_cc();\n else\n gen_op_sbcl_T0_T1();\n break;\n case 13: /* sub */\n if (conds)\n gen_op_subl_T0_T1_cc();\n else\n gen_op_subl_T0_T1();\n break;\n case 14: /* rsb */\n if (conds)\n gen_op_rsbl_T0_T1_cc();\n else\n gen_op_rsbl_T0_T1();\n break;\n default: /* 5, 6, 7, 9, 12, 15. */\n return 1;\n }\n if (logic_cc) {\n gen_op_logic_T0_cc();\n if (shifter_out)\n gen_op_mov_CF_T1();\n }\n return 0;\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if(carg.count === 1) {\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if(carg.count === 1) {\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function makeOpComposition () {\n \n var ops = []; \n var domain = makeEmptyMap(); \n var gen = 0; \n \n var func = function (s) {\n return function (i) {\n return evaluate(domain.has(i) ? (ops.length-1) - (gen-domain.get(i)) : -1, i)(i);\n }\n \n // determine selection state of i but only access the elements \n // of ops (staring from ind) that have i in their domain\n function evaluate(ind, i) {\n if (ind < 0) return s; // i defined in the base selection mapping s\n else {\n var op = ops[ind];\n return op(function (j) { return evaluate(ind - op.domain.get(i), j)(i); });\n // the call to evaluate is wrapped to a lambda to make the call lazy.\n // op will only call the lambda if op.f.constant is false\n }\n }\n }\n \n func.domain = domain;\n \n // member functions of func\n func.push = function (op) {\n ops.push(op);\n ++gen\n op.domain.forEach(function(_, i) {\n op.domain.set(i, domain.has(i) ? gen - domain.get(i) : ops.length);\n domain.set(i, gen); \n });\n }\n func.pop = function () {\n var n = ops.length;\n var op = ops.pop();\n --gen;\n // domain updated for those elements that are in op.domain\n op.domain.forEach(function (_, i) {\n if (op.domain.get(i) >= n) domain.delete(i); // no op defines i\n else domain.set(i, domain.get(i) - op.domain.get(i)); \n });\n return op;\n }\n func.top = function () { return ops[ops.length - 1]; }\n func.top2 = function () { return ops[ops.length - 2]; }\n func.shift = function (bmap) {\n var op = ops.shift();\n op.domain.forEach(function(_, i) {\n if (domain.get(i) - gen === ops.length) { domain.delete(i); }\n // if lastOp the only op that defines i, remove i from domain\n });\n return op;\n }\n func.size = function () { return ops.length; }\n func.removeIndex = function (i) {\n if (!domain.has(i)) return;\n \n // find the first op in ops that defines i\n var j = (ops.length - 1) - (gen - domain.get(i));\n \n while (j >= 0) {\n var d = ops[j].domain.get(i);\n ops[j].domain.delete(i);\n j -= d;\n }\n domain.delete(i);\n }\n \n return func;\n }", "scavengeLoop() {\n const closures = this.nonMovedObjectsToScavenge,\n blocks = this.blocksToScavenge;\n\n let currentBlock = undefined, currentObject = undefined;\n\n // Note: there are various nested loops, mainly because there are\n // two kinds of objects, that must be scavenged in a different way:\n // objects that have been copied in to-space, and non-moved objects.\n // Objects copied in to-space are scavenged by traversing the\n // to-space sequentially. Non-moved objects are stored\n // in `this.nonMovedObjects` and must be handled separately.\n // Moreover, scavenging an object of either kind may introduce\n // new objects of either kind.\n while (true) {\n if (!currentBlock) {\n // We try and pick a new block to scavenge\n currentBlock = blocks.pop();\n if (currentBlock)\n // If there exists a block to scavenge,\n // start with the object pointed\n // by the `start` field in the block\n // descriptor\n currentObject = (\n this.memory.i32Load(\n currentBlock + rtsConstants.offset_bdescr_start\n )\n );\n }\n // Iterate over the objects in the `currentBlock`,\n // but only if there's such a block\n while (currentBlock) {\n // `currentLimit` is the upper limit for `currentBlock`\n // and consists of a pointer to the free space in the\n // current block\n const currentLimit = (\n this.memory.i32Load(\n currentBlock + rtsConstants.offset_bdescr_free\n )\n );\n if (currentObject >= currentLimit)\n // There are no more blocks to scavenge in the\n // `currentBlock`. Break, but do not unset\n // the current block, as we are not done with\n // it yet: scavenging the non-moved closures below\n // may add new objects to `currentBlock`.\n break;\n // Scavenge the current object, and increase the\n // `currentObject` address of the amount (sizeof) provided by\n // the `scavengeClosure` function.\n currentObject += this.scavengeClosure(currentObject);\n }\n if (blocks.length > 0) {\n // There are more blocks to scavenge:\n // since we have completely processed the\n // current currentBlock, we can continue\n // and pick the next one\n currentBlock = currentObject = undefined;\n continue;\n } else if (closures.length == 0)\n // There are no more block to scavenge,\n // nor in the to-space nor among the non-moved\n // objects. We are done.\n return;\n // Scavenge the remaining non-moved objects\n while (closures.length > 0) {\n this.scavengeClosure(closures.pop());\n }\n // Continue scavenging the possibly newly evacuated objects\n }\n }", "function getLoopBlock(){ \n \nworkspacePlayground.updateToolbox(\" <category name='%{BKY_CATLOOPS}' colour='%{BKY_LOOPS_HUE}'><block type='controls_repeat_ext'> <value name='TIMES'> <shadow type='math_number'> <field name='NUM'>10</field> </shadow> </value> </block> <block type='controls_whileUntil'></block> <block type='controls_for'> <value name='FROM'> <shadow type='math_number'> <field name='NUM'>1</field> </shadow> </value> <value name='TO'> <shadow type='math_number'> <field name='NUM'>10</field> </shadow> </value> <value name='BY'> <shadow type='math_number'> <field name='NUM'>1</field> </shadow> </value> </block> <block type='controls_forEach'></block> <block type='controls_flow_statements'></block> </category> \");\n \n }", "function subLoop()\r\n{\r\n\tcurrentSubroutine = \"subLoop()\"\r\n\r\n\tvar iterator\r\n\tvar iteratorPtr\r\n\tvar la\r\n\tvar block\r\n\tvar stop3\r\n\t\r\n\titerator = parseNextWord()\r\n\tif (stop) return \"N0pe.\" // +++ STOP +++\r\n\t\r\n\tif (variableIsDefined(iterator))\r\n\t{\r\n\t\tif (variableArray[variableLastLookup].isBuiltIn == builtIn)\r\n\t\t{\r\n\t\t\terror(invalidIteratorVariableForLoop, true)\r\n\t\t\treturn \"N0pe.\"\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif ( _isNaN(variableArray[variableLastLookup].value) )\r\n\t\t\t{\r\n\t\t\t\terror(invalidIteratorVariableForLoop, true)\r\n\t\t\t\treturn \"N0pe.\"\r\n\t\t\t}\r\n\t\t\telse // number\r\n\t\t\t{\r\n\t\t\t\t// iterator ok\r\n\t\t\t\titeratorPtr = variableLastLookup\r\n\t\t\t\r\n\t\t\t\tla = lookAhead()\r\n\t\t\t\tif (stop) return \"N0pe.\"\r\n\t\t\t\t\r\n\t\t\t\tif (la == \"defined\")\r\n\t\t\t\t{\r\n\t\t\t\t\tparseNextWord()\r\n\t\t\t\t\tif (variableArray[variableLastLookup].isBuiltIn == builtIn)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\terror(invalidBlockArgumentForLoop, true)\r\n\t\t\t\t\t\treturn \"N0pe.\"\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse // user\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif ( _isNaN(variableArray[variableLastLookup].value) )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tblock = variableArray[variableLastLookup].value\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse // number\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\terror(invalidBlockArgumentForLoop, true)\r\n\t\t\t\t\t\t\treturn \"N0pe.\"\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\telse if (la == \"string\")\r\n\t\t\t\t{\r\n\t\t\t\t\tblock = parseNextString()\r\n\t\t\t\t\tif (stop) return \"N0pe.\"\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tparseNextWord()\r\n\t\t\t\t\terror(invalidBlockArgumentForLoop, true)\r\n\t\t\t\t\treturn \"N0pe.\"\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// block ok\r\n\t\t\t\t\r\n\t\t\t\t// ----------------------------------------------------------------\r\n\t\t\t\t\r\n\t\t\t\tworkStack.push(wordArray)\r\n\t\t\t\tworkStack.push(wordCount)\r\n\t\t\t\tworkStack.push(wordCurrent)\r\n\t\t\t\twordArray = block.split(wsre)\r\n\t\t\t\twordCount = wordArray.length\r\n\t\t\t\tif (wordArray[0] == \"\") wordCount = 0\r\n\t\t\t\twordCurrent = 0\r\n\t\t\t\tloopLevel++\r\n\t\t\t\r\n\t\t\t\tstop3 = false\r\n\t\t\t\r\n\t\t\t\twhile (!stop3)\r\n\t\t\t\t{\r\n\t\t\t\t\tcurrentSubroutine = \"subLoop()\"\r\n\t\t\t\t\t\r\n\t\t\t\t\t// check iterator\r\n\t\t\t\t\tif ( _isNaN(variableArray[iteratorPtr].value) )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\terror(iteratorTypeMustNotBeChanged, true)\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse // iterator ok\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif ( variableArray[iteratorPtr].value == 0 )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tstop3 = true\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse // iterator != 0\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (wordCurrent >= wordCount)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\twordCurrent = 0 // loop\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif (variableIsDefined(parseNextWord()))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tif ( variableArray[variableLastLookup].isBuiltIn == user )\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\terror(builtInSubroutineCallRequired, true)\r\n\t\t\t\t\t\t\t\t\t\tbreak\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tvariableArray[variableLastLookup].value()\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tif (wordArray[wordCurrent-1] == \"\") stop3 = true // Firefox bugfix\r\n\t\t\t\t\t\t\t\t\telse error(invalidSubroutineReference, true)\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (stop) stop3 = true\r\n\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\tloopLevel--\r\n\t\t\t\twordCurrent = workStack.pop()\r\n\t\t\t\twordCount = workStack.pop()\r\n\t\t\t\twordArray = workStack.pop()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\terror(invalidIteratorVariableForLoop, true)\r\n\t}\r\n\r\n\treturn \"N0pe.\"\r\n}", "function loopOverPixels(context){\n\tvar imagedata = context.createImageData(w,h);\n\tvar leftPixel = new Array(3);\n\tvar rightPixel = new Array(3);\n\tvar pixel = new Array(3);\n\tvar col;\n\tfor(var t=0;t<=1;t=t+0.001){\n\t\t//leftPixel[0] = LL[0]+t*(UL[0]-LL[0]); leftPixel[1] = LL[1]+t*(UL[1]-LL[1]); leftPixel[2] = LL[2]+t*(UL[2]-LL[2]);\n\t\tleftPixel[0] = UL[0]+t*(LL[0]-UL[0]); leftPixel[1] = UL[1]+t*(LL[1]-UL[1]); leftPixel[2] = UL[2]+t*(LL[2]-UL[2]);\n\t\t//rightPixel[0] = LR[0]+t*(UR[0]-LR[0]); rightPixel[1] = LR[1]+t*(UR[1]-LR[1]); rightPixel[2] = LR[2]+t*(UR[2]-LR[2]);\n\t\trightPixel[0] = UR[0]+t*(LR[0]-UR[0]); rightPixel[1] = UR[1]+t*(LR[1]-UR[1]); rightPixel[2] = UR[2]+t*(LR[2]-UR[2]);\n\t\tfor(var s=0;s<=1;s=s+0.001){\n\t\t\tpixel[0] = leftPixel[0]+s*(rightPixel[0]-leftPixel[0]);\n\t\t\tpixel[1] = leftPixel[1]+s*(rightPixel[1]-leftPixel[1]);\n\t\t\tpixel[2] = leftPixel[2]+s*(rightPixel[2]-leftPixel[2]);\n\t\t\t//console.log(pixel);\n\t\t\t//now for each pixel, iterate over each sphere to find the intersection\n\t\t\tvar poinSph = findIntersection(pixel); //console.log(poinSph); \n\t\t\tif(poinSph != undefined && poinSph != String.null){\n\t\t\t\tvar poi = poinSph[0];\n\t\t\t\tvar sno = poinSph[1];\n\n\t\t\t\tcol = getColorForPoi(poi,sno,pixel);\n\t\t\t\t//col= new Color(255,255,255,255);\n }\n else{\n \tcol = new Color(0,0,0,255); \n }\n \t\t\t//drawing the pixel\t\n drawPixel(imagedata, Math.floor(pixel[1]*w), Math.floor(pixel[0]*h),col);\t\n \t/*var pixelindex = ((Math.floor(pixel[1]*600))*600 + (Math.floor(pixel[0]*600))) * 4;\n imagedata.data[pixelindex] = col.r;\n imagedata.data[pixelindex+1] = col.g;\n imagedata.data[pixelindex+2] = col.b;\n imagedata.data[pixelindex+3] = 255;*/\n\t\t}\n\t}\n\tcontext.putImageData(imagedata,0,0);\t\n}", "function makeLoop() {\n var ret = {\n type: 'reloop',\n id: blockId,\n needBlockId: true,\n entries: entries,\n labels: labels\n };\n\n // Find internal and external labels\n var split_ = splitter(labels, function(label) {\n // External labels are those that are (1) not an entry, and (2) cannot reach an entry. In other words,\n // the labels inside the loop are the entries and those that can return to the entries.\n return !(label.ident in s_entries) && values(setIntersect(s_entries, label.allOutLabels)).length == 0;\n });\n var externals = split_.splitOut;\n var internals = split_.leftIn;\n var externalsLabels = set(getLabelIds(externals));\n\n if (dcheck('relooping')) dprint(' Creating reloop: Inner: ' + dump(getLabelIds(internals)) + ', Exxer: ' + dump(externalsLabels));\n\n if (ASSERTIONS) {\n // Verify that no external can reach an internal\n var inLabels = set(getLabelIds(internals));\n externals.forEach(function(external) {\n if (values(setIntersect(external.outLabels, inLabels)).length > 0) {\n dprint('relooping', 'Found an external that wants to reach an internal, fallback to emulated?');\n throw \"Spaghetti label flow\";\n }\n });\n }\n\n // We will be in a loop, |continue| gets us back to the entry\n var pattern = 'BCONT|' + blockId;\n if (entries.length == 1) {\n // We are returning to a loop that has one entry, so we don't need to set __label__\n pattern = 'BCNOL|' + blockId;\n }\n entries.forEach(function(entry) {\n replaceLabelLabels(internals, set(entries), pattern);\n });\n\n // Find the entries of the external labels\n var externalsEntries = {};\n internals.forEach(function(internal) {\n mergeInto(externalsEntries, setIntersect(internal.outLabels, externalsLabels));\n });\n externalsEntries = keys(externalsEntries);\n\n // We also want to include additional labels inside the loop. If the loop has just one exit label,\n // then that is fine - keep the loop small by having the next code outside, and do not set __label__ in\n // that break. If there is more than one, though, we can avoid __label__ checks in a multiple outside\n // by hoisting labels into the loop.\n if (externalsEntries.length > 1) {\n (function() {\n // If an external entry would make the loop too big, don't hoist\n var maxHoist = Infinity; //sum(internals.map(function(internal) { return internal.lines.length }));\n var avoid = externalsEntries.map(function(l) { return labelsDict[l] });\n var totalNewEntries = {};\n for (var i = 0; i < externalsEntries.length; i++) {\n var exitLabel = labelsDict[externalsEntries[i]];\n // Check if hoisting this external entry is worthwhile. We first do a dry run, aborting on\n // loops (which we never hoist, to avoid over-nesting) or on seeing too many labels would be hoisted\n // (to avoid enlarging loops too much). If the dry run succeeded, it will stop when it reaches\n // places where we rejoin other external entries.\n var seen, newEntries;\n function prepare() {\n seen = {};\n newEntries = {};\n }\n function hoist(label, dryRun) { // returns false if aborting\n if (seen[label.ident]) return true;\n seen[label.ident] = true;\n if (label.ident in label.allInLabels) return false; // loop, abort\n if (isReachable(label, avoid, exitLabel)) {\n // We rejoined, so this is a new external entry\n newEntries[label.ident] = true;\n return true;\n }\n // Hoistable.\n if (!dryRun) {\n dprint('relooping', 'Hoisting into loop: ' + label.ident);\n internals.push(label);\n externals = externals.filter(function(l) { return l != label }); // not very efficient at all TODO: optimize\n }\n for (var outLabelId in label.outLabels) {\n var outLabel = labelsDict[outLabelId];\n if (!hoist(outLabel, dryRun)) return false;\n }\n return true;\n }\n prepare();\n if (hoist(exitLabel, true)) {\n var seenList = unset(seen);\n var num = sum(seenList.map(function(seen) { return labelsDict[seen].lines.length }));\n // Only hoist if the sizes make sense\n if (seenList.length >= 1 && num <= maxHoist) { // && unset(newEntries).length <= 1) {\n prepare();\n hoist(exitLabel);\n mergeInto(totalNewEntries, newEntries);\n externalsEntries.splice(i, 1);\n i--;\n }\n }\n }\n externalsLabels = set(getLabelIds(externals));\n externalsEntries = keys(set(externalsEntries.concat(unset(totalNewEntries))));\n assert(externalsEntries.length > 0 || externals.length == 0);\n })();\n }\n\n // To get to any of our (not our parents') exit labels, we will break.\n if (dcheck('relooping')) dprint('for exit purposes, Replacing: ' + dump(externalsLabels));\n if (externals.length > 0) {\n assert(externalsEntries.length > 0);\n var pattern = 'BREAK|' + blockId;\n if (externalsEntries.length == 1) {\n // We are breaking out of a loop and have one entry after it, so we don't need to set __label__ \n pattern = 'BRNOL|' + blockId;\n }\n replaceLabelLabels(internals, externalsLabels, pattern);\n if (dcheck('relooping')) dprint('externalsEntries: ' + dump(externalsEntries));\n }\n\n // inner\n ret.inner = makeBlock(internals, entries, labelsDict);\n\n if (externals.length > 0) {\n // outer\n ret.next = makeBlock(externals, externalsEntries, labelsDict);\n }\n\n return ret;\n }", "function _sum(a, b, r, s) {\n\t\n\t\tfor (var i = 0; i < s; i++) {\n\n\t\t\tfor (var j = 0; j < s; j++) {\n\n\t\t\t\tr[s*i + j] = OP.sum(a[s*i + j], b[s*i + j]);\n\n\t\t\t}\n\n\t\t}\n\n\t}", "softClippedBlocks() {\n let left\n let right\n let interiorSeen\n for (let b of this.blocks) {\n if ('S' === b.type) {\n if (interiorSeen) {\n right = b\n } else {\n left = b\n }\n } else if ('H' !== b.type) {\n interiorSeen = true\n }\n }\n return {left, right}\n }", "function blockxor (S, Si, D, Di, len) {\n for (let i = 0; i < len; i++) {\n D[Di + i] ^= S[Si + i]\n }\n}", "function blockxor (S, Si, D, Di, len) {\n for (let i = 0; i < len; i++) {\n D[Di + i] ^= S[Si + i]\n }\n}", "function relooper() {\n function makeBlock(labels, entries, labelsDict, forceEmulated) {\n if (labels.length == 0) return null;\n dprint('relooping', 'prelooping: ' + entries + ',' + labels.length + ' labels');\n assert(entries && entries[0]); // need at least 1 entry\n\n var emulated = {\n type: 'emulated',\n id: 'B',\n labels: labels,\n entries: entries.slice(0)\n };\n return emulated;\n }\n item.functions.forEach(function(func) {\n dprint('relooping', \"// relooping function: \" + func.ident);\n func.block = makeBlock(func.labels, [func.labels[0].ident], func.labelsDict, func.forceEmulated);\n });\n }", "function gen_op_stl_kernel()\n{\n gen_opc_ptr.push({func:op_stl_kernel});\n}", "function init_block(s) {\n let n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) {\n s.dyn_ltree[n * 2]/*.Freq*/ = 0; \n }\n for (n = 0; n < D_CODES; n++) {\n s.dyn_dtree[n * 2]/*.Freq*/ = 0; \n }\n for (n = 0; n < BL_CODES; n++) {\n s.bl_tree[n * 2]/*.Freq*/ = 0; \n }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n }", "async * getOperations() {\n for await (const num of this.getSequentBlockNum()) {\n const operations = await this.getBlockOperations(num);\n for (const op of operations) yield op;\n }\n }", "_s2v(associated_data, plaintext) {\n return __awaiter(this, void 0, void 0, function* () {\n this._mac.reset();\n this._tmp1.clear();\n // Note: the standalone S2V returns CMAC(1) if the number of passed\n // vectors is zero, however in SIV construction this case is never\n // triggered, since we always pass plaintext as the last vector (even\n // if it's zero-length), so we omit this case.\n yield this._mac.update(this._tmp1.data);\n this._tmp2.clear();\n this._tmp2.data.set(yield this._mac.finish());\n this._mac.reset();\n for (const ad of associated_data) {\n yield this._mac.update(ad);\n this._tmp1.clear();\n this._tmp1.data.set(yield this._mac.finish());\n this._mac.reset();\n this._tmp2.dbl();\n xor_1.xor(this._tmp2.data, this._tmp1.data);\n }\n this._tmp1.clear();\n if (plaintext.length >= block_1.default.SIZE) {\n const n = plaintext.length - block_1.default.SIZE;\n this._tmp1.data.set(plaintext.subarray(n));\n yield this._mac.update(plaintext.subarray(0, n));\n }\n else {\n this._tmp1.data.set(plaintext);\n this._tmp1.data[plaintext.length] = 0x80;\n this._tmp2.dbl();\n }\n xor_1.xor(this._tmp1.data, this._tmp2.data);\n yield this._mac.update(this._tmp1.data);\n return this._mac.finish();\n });\n }", "function init_block(s) {\n\t var n; /* iterates over tree elements */\n\n\t /* Initialize the trees. */\n\t for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n\t s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n\t s.opt_len = s.static_len = 0;\n\t s.last_lit = s.matches = 0;\n\t}", "function init_block(s) {\n\t var n; /* iterates over tree elements */\n\n\t /* Initialize the trees. */\n\t for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n\t s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n\t s.opt_len = s.static_len = 0;\n\t s.last_lit = s.matches = 0;\n\t}", "function init_block(s) {\n\t var n; /* iterates over tree elements */\n\n\t /* Initialize the trees. */\n\t for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n\t s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n\t s.opt_len = s.static_len = 0;\n\t s.last_lit = s.matches = 0;\n\t}", "function init_block(s) {\n\t var n; /* iterates over tree elements */\n\n\t /* Initialize the trees. */\n\t for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n\t s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n\t s.opt_len = s.static_len = 0;\n\t s.last_lit = s.matches = 0;\n\t}", "function init_block(s) {\n\t var n; /* iterates over tree elements */\n\n\t /* Initialize the trees. */\n\t for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n\t s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n\t s.opt_len = s.static_len = 0;\n\t s.last_lit = s.matches = 0;\n\t}", "function init_block(s) {\n\t var n; /* iterates over tree elements */\n\n\t /* Initialize the trees. */\n\t for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n*2]/*.Freq*/ = 0; }\n\t for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n*2]/*.Freq*/ = 0; }\n\t for (n = 0; n < BL_CODES; n++) { s.bl_tree[n*2]/*.Freq*/ = 0; }\n\n\t s.dyn_ltree[END_BLOCK*2]/*.Freq*/ = 1;\n\t s.opt_len = s.static_len = 0;\n\t s.last_lit = s.matches = 0;\n\t}", "function init_block(s) {\n\t var n; /* iterates over tree elements */\n\n\t /* Initialize the trees. */\n\t for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n*2]/*.Freq*/ = 0; }\n\t for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n*2]/*.Freq*/ = 0; }\n\t for (n = 0; n < BL_CODES; n++) { s.bl_tree[n*2]/*.Freq*/ = 0; }\n\n\t s.dyn_ltree[END_BLOCK*2]/*.Freq*/ = 1;\n\t s.opt_len = s.static_len = 0;\n\t s.last_lit = s.matches = 0;\n\t}", "function init_block(s) {\n\t var n; /* iterates over tree elements */\n\n\t /* Initialize the trees. */\n\t for (n = 0; n < L_CODES$1; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < D_CODES$1; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < BL_CODES$1; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n\t s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n\t s.opt_len = s.static_len = 0;\n\t s.last_lit = s.matches = 0;\n\t}", "function init_block(s) {\n var n; /* iterates over tree elements */\n \n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n \n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n }", "function gen_op_stl_raw()\n{\n gen_opc_ptr.push({func:op_stl_raw});\n}", "static reduceConsecutiveSameStyleBlocksToOne(groups) {\n var newLineOp = DeltaInsertOp.createNewLineOp();\n return groups.map(function (elm) {\n if (!Array.isArray(elm)) {\n if (elm instanceof BlockGroup && !elm.ops.length) {\n elm.ops.push(newLineOp);\n }\n return elm;\n }\n var groupsLastInd = elm.length - 1;\n elm[0].ops = flatten(elm.map((g, i) => {\n if (!g.ops.length) {\n return [newLineOp];\n }\n return g.ops.concat(i < groupsLastInd ? [newLineOp] : []);\n }));\n return elm[0];\n });\n }", "function init_block$1(s) {\n\t var n; /* iterates over tree elements */\n\n\t /* Initialize the trees. */\n\t for (n = 0; n < L_CODES$2; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < D_CODES$2; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n\t for (n = 0; n < BL_CODES$2; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n\t s.dyn_ltree[END_BLOCK$1 * 2]/*.Freq*/ = 1;\n\t s.opt_len = s.static_len = 0;\n\t s.last_lit = s.matches = 0;\n\t}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}", "function init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}" ]
[ "0.7018799", "0.7018799", "0.7018799", "0.7018799", "0.69928503", "0.69928503", "0.69928503", "0.69928503", "0.6851732", "0.6851732", "0.59302425", "0.59302425", "0.5589564", "0.5558303", "0.5558303", "0.5558303", "0.55195004", "0.55195004", "0.55195004", "0.55195004", "0.5485615", "0.5485615", "0.5148859", "0.5148859", "0.5148859", "0.5148859", "0.50151914", "0.50151914", "0.5010629", "0.5010629", "0.49927494", "0.49474373", "0.49474373", "0.49474373", "0.49474373", "0.49362653", "0.49362653", "0.49362653", "0.49362653", "0.48699784", "0.48019797", "0.48019797", "0.47752434", "0.4750214", "0.46418446", "0.4634039", "0.46068078", "0.45948884", "0.45832148", "0.456425", "0.4549667", "0.4549667", "0.45424515", "0.45368537", "0.45310876", "0.4456608", "0.44502893", "0.44413412", "0.443445", "0.443445", "0.443445", "0.443445", "0.443445", "0.4432811", "0.4432811", "0.44308358", "0.44305834", "0.44289473", "0.44174078", "0.44160363", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977", "0.44151977" ]
0.5061742
29
Count the number of compatible inner orders This is the length of the longest common prefix of the arrays in orders. Each array in orders lists the dimensions of the correspond ndarray in order of increasing stride. This is thus the maximum number of dimensions that can be efficiently traversed by simple nested loops for all arrays.
function countMatches(orders) { var matched = 0, dimension = orders[0].length while(matched < dimension) { for(var j=1; j<orders.length; ++j) { if(orders[j][matched] !== orders[0][matched]) { return matched } } ++matched } return matched }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countMatches(orders) {\n var matched = 0, dimension = orders[0].length\n while(matched < dimension) {\n for(var j=1; j<orders.length; ++j) {\n if(orders[j][matched] !== orders[0][matched]) {\n return matched\n }\n }\n ++matched\n }\n return matched\n}", "function countMatches(orders) {\n var matched = 0, dimension = orders[0].length\n while(matched < dimension) {\n for(var j=1; j<orders.length; ++j) {\n if(orders[j][matched] !== orders[0][matched]) {\n return matched\n }\n }\n ++matched\n }\n return matched\n}", "function countMatches(orders) {\n var matched = 0, dimension = orders[0].length\n while(matched < dimension) {\n for(var j=1; j<orders.length; ++j) {\n if(orders[j][matched] !== orders[0][matched]) {\n return matched\n }\n }\n ++matched\n }\n return matched\n}", "function countMatches(orders) {\n var matched = 0, dimension = orders[0].length\n while(matched < dimension) {\n for(var j=1; j<orders.length; ++j) {\n if(orders[j][matched] !== orders[0][matched]) {\n return matched\n }\n }\n ++matched\n }\n return matched\n}", "function countMatches(orders) {\n var matched = 0, dimension = orders[0].length\n while(matched < dimension) {\n for(var j=1; j<orders.length; ++j) {\n if(orders[j][matched] !== orders[0][matched]) {\n return matched\n }\n }\n ++matched\n }\n return matched\n}", "function countMatches(orders) {\n var matched = 0, dimension = orders[0].length\n while(matched < dimension) {\n for(var j=1; j<orders.length; ++j) {\n if(orders[j][matched] !== orders[0][matched]) {\n return matched\n }\n }\n ++matched\n }\n return matched\n}", "function countMatches(orders) {\r\n\t var matched = 0, dimension = orders[0].length\r\n\t while(matched < dimension) {\r\n\t for(var j=1; j<orders.length; ++j) {\r\n\t if(orders[j][matched] !== orders[0][matched]) {\r\n\t return matched\r\n\t }\r\n\t }\r\n\t ++matched\r\n\t }\r\n\t return matched\r\n\t}", "function countMatches(orders) {\r\n\t var matched = 0, dimension = orders[0].length\r\n\t while(matched < dimension) {\r\n\t for(var j=1; j<orders.length; ++j) {\r\n\t if(orders[j][matched] !== orders[0][matched]) {\r\n\t return matched\r\n\t }\r\n\t }\r\n\t ++matched\r\n\t }\r\n\t return matched\r\n\t}", "function twoDimensionalSize(array) {\n var count = 0;\n\n for (var i = 0; i < array.length; i += 1) {\n var inner_arr = array[i];\n count += inner_arr.length;\n }\n return count;\n}", "function findMaxPartCount(shapes) {\n var maxCount = 0, shp;\n for (var i=0, n=shapes.length; i<n; i++) {\n shp = shapes[i];\n if (shp && shp.length > maxCount) {\n maxCount = shp.length;\n }\n }\n return maxCount;\n }", "function getLength(nestArr) {\n return nestArr.flat(Infinity).length;\n}", "function detCount(arr) {\n var size = arr.length;\n return size.toString();\n }", "function dimension(cells) {\n var d = 0\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n d = max(d, cells[i].length)\n }\n return d-1\n}", "function dimension(cells) {\n var d = 0\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n d = max(d, cells[i].length)\n }\n return d-1\n}", "function dimension(cells) {\n var d = 0\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n d = max(d, cells[i].length)\n }\n return d-1\n}", "function dimension(cells) {\n var d = 0\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n d = max(d, cells[i].length)\n }\n return d-1\n}", "function dimension(cells) {\n var d = 0\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n d = max(d, cells[i].length)\n }\n return d-1\n}", "function dimension(cells) {\n var d = 0\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n d = max(d, cells[i].length)\n }\n return d-1\n}", "function dimension(cells) {\n var d = 0\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n d = max(d, cells[i].length)\n }\n return d-1\n}", "function dimension(cells) {\n var d = 0\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n d = max(d, cells[i].length)\n }\n return d-1\n}", "function dimension(cells) {\n\t var d = 0\n\t , max = Math.max\n\t for(var i=0, il=cells.length; i<il; ++i) {\n\t d = max(d, cells[i].length)\n\t }\n\t return d-1\n\t}", "function dimension(cells) {\n\t var d = 0\n\t , max = Math.max\n\t for(var i=0, il=cells.length; i<il; ++i) {\n\t d = max(d, cells[i].length)\n\t }\n\t return d-1\n\t}", "function dimension(cells) {\n\t var d = 0\n\t , max = Math.max\n\t for(var i=0, il=cells.length; i<il; ++i) {\n\t d = max(d, cells[i].length)\n\t }\n\t return d-1\n\t}", "get scalableComponentsCount() {\n\t\t\tvar scalableComponentIdentifiers = this.scalableHeightComponentIdentifiers;\n\n\t\t\tvar scalableComponentsCount = scalableComponentIdentifiers.dimension.length + scalableComponentIdentifiers.margin.length;\n\n\t\t\treturn scalableComponentsCount;\n\t\t}", "function calculateNumOfCombinations(adapters, cache = {}) {\n const currArr = adapters.join();\n if (currArr in cache) {\n return cache[currArr];\n }\n\n let result = 1;\n for (let i = 1; i < adapters.length - 1; i++) {\n if (adapters[i + 1] - adapters[i - 1] <= 3) {\n const subArr = [adapters[i - 1], ...adapters.slice(i + 1)];\n result += calculateNumOfCombinations(subArr, cache);\n }\n }\n cache[currArr] = result;\n return result;\n}", "function solve(arr) {\n // returning the count of unique array combinations\n return (\n // mapping over each array and returning a Set of the size of the array (without duplicates)\n arr\n .map((v) => new Set(v).size)\n // reduce the new Set (lengths of each arr in essence) and multiplies them together starting with 1 to return the count of unique array combos\n .reduce((v, w) => v * w, 1)\n );\n}", "function size() {\n out = 1;\n for (var dim in dimensions) {\n out *= dimensions[dim].members.length;\n }\n return out;\n }", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function matrixDimension (array){\n var parentDimension = array.length;\n var childDimension = array[0].length;\n return parentDimension + 'x' + childDimension;\n}", "function imperativeLengths(elements){\n\tlet lengths = {};\n\telements.forEach(function(element) {\n\t\tlengths[element] = element.length;\n\t});\n\treturn lengths;\n}", "function maxInversions2(arr) {\n let arrLength = arr.length;\n let inversionCount = 0;\n\n // Subsequence of 3: Iterate through N^3 possibilities\n for (let i = 0; i < arrLength - 2; i++) {\n for (let j = i + 1; j < arrLength - 1; j++) {\n if (arr[i] > arr[j]) {\n for (let k = j + 1; k < arrLength; k++) {\n if (arr[j] > arr[k]) {\n inversionCount++;\n }\n }\n }\n }\n }\n return inversionCount;\n}", "function outerFill(matched, order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , blockSize = proc.blockSize\r\n , has_index = proc.indexArgs.length > 0\r\n , code = []\r\n for(var i=0; i<nargs; ++i) {\r\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n }\r\n //Generate loops for unmatched dimensions\r\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n code.push([\"j\",i,\"=0\"].join(\"\"))\r\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n if(has_index) {\r\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<nargs; ++i) {\r\n var indexStr = [\"offset\"+i]\r\n for(var j=matched; j<dimension; ++j) {\r\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n }\r\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n }\r\n code.push(innerFill(order, proc, body))\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function outerFill(matched, order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , blockSize = proc.blockSize\r\n , has_index = proc.indexArgs.length > 0\r\n , code = []\r\n for(var i=0; i<nargs; ++i) {\r\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n }\r\n //Generate loops for unmatched dimensions\r\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n code.push([\"j\",i,\"=0\"].join(\"\"))\r\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n if(has_index) {\r\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<nargs; ++i) {\r\n var indexStr = [\"offset\"+i]\r\n for(var j=matched; j<dimension; ++j) {\r\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n }\r\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n }\r\n code.push(innerFill(order, proc, body))\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function outerFill(matched, order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , blockSize = proc.blockSize\r\n , has_index = proc.indexArgs.length > 0\r\n , code = []\r\n for(var i=0; i<nargs; ++i) {\r\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n }\r\n //Generate loops for unmatched dimensions\r\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n code.push([\"j\",i,\"=0\"].join(\"\"))\r\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n if(has_index) {\r\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<nargs; ++i) {\r\n var indexStr = [\"offset\"+i]\r\n for(var j=matched; j<dimension; ++j) {\r\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n }\r\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n }\r\n code.push(innerFill(order, proc, body))\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function outerFill(matched, order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , blockSize = proc.blockSize\r\n , has_index = proc.indexArgs.length > 0\r\n , code = []\r\n for(var i=0; i<nargs; ++i) {\r\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n }\r\n //Generate loops for unmatched dimensions\r\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n code.push([\"j\",i,\"=0\"].join(\"\"))\r\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n if(has_index) {\r\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<nargs; ++i) {\r\n var indexStr = [\"offset\"+i]\r\n for(var j=matched; j<dimension; ++j) {\r\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n }\r\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n }\r\n code.push(innerFill(order, proc, body))\r\n for(var i=matched; i<dimension; ++i) {\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function countCycles(arr) {\n\n let arrChildLength = arr[0].length;\n let cycles;\n\n if (arrChildLength / 2 === 0) {\n cycles = arrChildLength / 2;\n } else {\n cycles = Math.round(arrChildLength / 2);\n }\n\n return cycles;\n}", "function imperativeLengths(states) {\n let lengths = [];\n states.forEach(function(state) {\n lengths[state] = state.length; \n });\n return lengths;\n}", "function arrayCeption(array) {\n var count;\n array.forEach(element => {\n if(element.length === 0){\n count = 0\n }\n else if (Array.isArray(element)) {\n count = arrayCeption(element)\n if (count>0) {\n count++\n }\n } \n else {\n count = 1\n }\n }); \n return count\n}", "function outerFill(matched, order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , blockSize = proc.blockSize\r\n\t , has_index = proc.indexArgs.length > 0\r\n\t , code = []\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n\t }\r\n\t //Generate loops for unmatched dimensions\r\n\t // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n\t // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n\t code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n\t code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n\t code.push([\"j\",i,\"=0\"].join(\"\"))\r\n\t code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n\t code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n\t if(has_index) {\r\n\t code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t var indexStr = [\"offset\"+i]\r\n\t for(var j=matched; j<dimension; ++j) {\r\n\t indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n\t }\r\n\t code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n\t }\r\n\t code.push(innerFill(order, proc, body))\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function outerFill(matched, order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , blockSize = proc.blockSize\r\n\t , has_index = proc.indexArgs.length > 0\r\n\t , code = []\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t code.push([\"var offset\",i,\"=p\",i].join(\"\"))\r\n\t }\r\n\t //Generate loops for unmatched dimensions\r\n\t // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\r\n\t // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\r\n\t code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\r\n\t code.push([\"s\",order[i],\"=j\",i].join(\"\"))\r\n\t code.push([\"j\",i,\"=0\"].join(\"\"))\r\n\t code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\r\n\t code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\r\n\t if(has_index) {\r\n\t code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<nargs; ++i) {\r\n\t var indexStr = [\"offset\"+i]\r\n\t for(var j=matched; j<dimension; ++j) {\r\n\t indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\r\n\t }\r\n\t code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\r\n\t }\r\n\t code.push(innerFill(order, proc, body))\r\n\t for(var i=matched; i<dimension; ++i) {\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n code.push(\"var \" + vars.join(\",\"))\n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function countComponents(n, edges){\n\tconst roots = new Array(n).fill().map((e, i) => {return i});\n\t\n\tfor(e of edges){\n\t\tconst r1 = find(roots, e[0]);\n\t\tconst r2 = find(roots, e[1]);\n\t\tif(r1 !== r2){\n\t\t\troots[r1] = r2;\n\t\t\t--n;\n\t\t}\n\t}\n\treturn n;\n}", "function innerFill(order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , has_index = proc.indexArgs.length>0\r\n , code = []\r\n , vars = []\r\n , idx=0, pidx=0, i, j\r\n for(i=0; i<dimension; ++i) { // Iteration variables\r\n vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n }\r\n //Compute scan deltas\r\n for(j=0; j<nargs; ++j) {\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n }\r\n }\r\n }\r\n code.push(\"var \" + vars.join(\",\"))\r\n //Scan loop\r\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n idx = order[i]\r\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n }\r\n //Push body of inner loop\r\n code.push(body)\r\n //Advance scan pointers\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n for(j=0; j<nargs; ++j) {\r\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n }\r\n if(has_index) {\r\n if(i > 0) {\r\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n }\r\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n }\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function innerFill(order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , has_index = proc.indexArgs.length>0\r\n , code = []\r\n , vars = []\r\n , idx=0, pidx=0, i, j\r\n for(i=0; i<dimension; ++i) { // Iteration variables\r\n vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n }\r\n //Compute scan deltas\r\n for(j=0; j<nargs; ++j) {\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n }\r\n }\r\n }\r\n code.push(\"var \" + vars.join(\",\"))\r\n //Scan loop\r\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n idx = order[i]\r\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n }\r\n //Push body of inner loop\r\n code.push(body)\r\n //Advance scan pointers\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n for(j=0; j<nargs; ++j) {\r\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n }\r\n if(has_index) {\r\n if(i > 0) {\r\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n }\r\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n }\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function innerFill(order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , has_index = proc.indexArgs.length>0\r\n , code = []\r\n , vars = []\r\n , idx=0, pidx=0, i, j\r\n for(i=0; i<dimension; ++i) { // Iteration variables\r\n vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n }\r\n //Compute scan deltas\r\n for(j=0; j<nargs; ++j) {\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n }\r\n }\r\n }\r\n code.push(\"var \" + vars.join(\",\"))\r\n //Scan loop\r\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n idx = order[i]\r\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n }\r\n //Push body of inner loop\r\n code.push(body)\r\n //Advance scan pointers\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n for(j=0; j<nargs; ++j) {\r\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n }\r\n if(has_index) {\r\n if(i > 0) {\r\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n }\r\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n }\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "function innerFill(order, proc, body) {\r\n var dimension = order.length\r\n , nargs = proc.arrayArgs.length\r\n , has_index = proc.indexArgs.length>0\r\n , code = []\r\n , vars = []\r\n , idx=0, pidx=0, i, j\r\n for(i=0; i<dimension; ++i) { // Iteration variables\r\n vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n }\r\n //Compute scan deltas\r\n for(j=0; j<nargs; ++j) {\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n }\r\n }\r\n }\r\n code.push(\"var \" + vars.join(\",\"))\r\n //Scan loop\r\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n idx = order[i]\r\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n }\r\n //Push body of inner loop\r\n code.push(body)\r\n //Advance scan pointers\r\n for(i=0; i<dimension; ++i) {\r\n pidx = idx\r\n idx = order[i]\r\n for(j=0; j<nargs; ++j) {\r\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n }\r\n if(has_index) {\r\n if(i > 0) {\r\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n }\r\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n }\r\n code.push(\"}\")\r\n }\r\n return code.join(\"\\n\")\r\n}", "get size() {\n // Return the quad count if if was cached\n var size = this._size;\n if (size !== null) return size; // Calculate the number of quads by counting to the deepest level\n\n size = 0;\n var graphs = this._graphs,\n subjects,\n subject;\n\n for (var graphKey in graphs) for (var subjectKey in subjects = graphs[graphKey].subjects) for (var predicateKey in subject = subjects[subjectKey]) size += Object.keys(subject[predicateKey]).length;\n\n return this._size = size;\n }", "get size() {\n // Return the triple count if if was cached\n var size = this._size;\n if (size !== null)\n return size;\n\n // Calculate the number of triples by counting to the deepest level\n size = 0;\n var graphs = this._graphs, subjects, subject;\n for (var graphKey in graphs)\n for (var subjectKey in (subjects = graphs[graphKey].subjects))\n for (var predicateKey in (subject = subjects[subjectKey]))\n size += Object.keys(subject[predicateKey]).length;\n return this._size = size;\n }", "function arrayLengths(arrayOfArrays) {\n arrayOfArrays.forEach((array) => {\n console.log(array.length);\n });\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n } \n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n } \n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "function innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n } \n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}", "get size() {\n // Return the quad count if if was cached\n let size = this._size;\n if (size !== null) return size;\n\n // Calculate the number of quads by counting to the deepest level\n size = 0;\n const graphs = this._graphs;\n let subjects, subject;\n for (const graphKey in graphs) for (const subjectKey in subjects = graphs[graphKey].subjects) for (const predicateKey in subject = subjects[subjectKey]) size += Object.keys(subject[predicateKey]).length;\n return this._size = size;\n }", "function totalLabelLength(arr) {\n var i,\n total = 0;\n\n if (Array.isArray(arr[0])) {\n for (i = 0; i < arr.length; i++) {\n total += totalLabelLength(arr[i]);\n }\n } else {\n for (i = 0; i < arr.length; i++) {\n total += arr[i].length;\n }\n }\n\n return total;\n } // count of labels (i.e [[\"Italy\"],[\"Spain\", \"Greece\"]] -> 3)", "function numOffices(grid) {\n let result = 0;\n\n for (let x = 0; x < grid[0].length; x++) {\n if (grid[0][x] === 1 && grid[0][x - 1] !== 1) {\n result = result + 1;\n }\n }\n\n\n for (let y = 1; y < grid.length; y++) {\n for (let x = 0; x < grid[0].length; x++) {\n if (grid[y][x] === 1 && grid[y][x - 1] !== 1 && grid[y - 1][x] !== 1) {\n result = result + 1;\n }\n }\n }\n return result;\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function imperativeLengths(states) {\n let lengths = {};\n states.forEach(function(state) {\n lengths[state] = state.length;\n });\n return lengths;\n}", "function totalLabelLength(arr) {\n let i,\n total = 0\n if (Array.isArray(arr[0])) {\n for (i = 0; i < arr.length; i++) {\n total += totalLabelLength(arr[i])\n }\n } else {\n for (i = 0; i < arr.length; i++) {\n total += arr[i].length\n }\n }\n return total\n }", "function checkLengths(board) {\n var found = [];\n board.forEach(function(row, r) {\n row.forEach(function(cell, c) {\n if(cell.state !== 'fill') return;\n if(cell.invalid) return;\n if(getCellFill(board, r-1, c)) return;\n if(getCellFill(board, r, c-1)) return;\n\n var sizeD = checkLengths.project(board, r, c, 1, 0);\n var sizeR = checkLengths.project(board, r, c, 0, 1);\n if(!sizeD || !sizeR) return; // if either is invalid, then nothing was matched\n\n found.push(Math.max(sizeD, sizeR));\n });\n });\n\n var sizes = {};\n found.forEach(function(s) {\n sizes[s] = (sizes[s]||0)+1;\n });\n\n board.len.forEach(function(l) { l.done = false; l.over = false; });\n _.forEach(sizes, function(count, size) {\n var lens = board.len.filter(function(l) { return l.size === +size; });\n\n if(lens.length < +count) {\n // if we found more lengths defined than we actually have\n lens.forEach(function(l) { l.over = true; });\n } else {\n // we can account for all the lengths we found\n lens.slice(0, +count).forEach(function(l) { l.done = true; });\n }\n });\n}", "get size() {\n // Return the triple count if if was cached.\n var size = this._size;\n if (size !== null)\n return size;\n\n // Calculate the number of triples by counting to the deepest level.\n var graphs = this._graphs, subjects, subject;\n for (var graphKey in graphs)\n for (var subjectKey in (subjects = graphs[graphKey].subjects))\n for (var predicateKey in (subject = subjects[subjectKey]))\n size += Object.keys(subject[predicateKey]).length;\n return this._size = size;\n }", "get size() {\n // Return the triple count if if was cached.\n var size = this._size;\n if (size !== null)\n return size;\n\n // Calculate the number of triples by counting to the deepest level.\n var graphs = this._graphs, subjects, subject;\n for (var graphKey in graphs)\n for (var subjectKey in (subjects = graphs[graphKey].subjects))\n for (var predicateKey in (subject = subjects[subjectKey]))\n size += Object.keys(subject[predicateKey]).length;\n return this._size = size;\n }", "function countArcsInLayers(layers, arcs) {\n var counts = new Uint32Array(arcs.size());\n layers.filter(layerHasPaths).forEach(function(lyr) {\n countArcsInShapes(lyr.shapes, counts);\n });\n return counts;\n }", "function findSolution(arr) {\n const x = [];\n let longestSubArrayLength = 0;\n let subArrayLength = 0;\n for (i = 0; i < arr.length; i++) {\n if (x.includes(arr[i])) {\n if (subArrayLength > longestSubArrayLength) {\n longestSubArrayLength = subArrayLength;\n }\n subArrayLength = 1;\n x.length = 0;\n } else {\n x.push(arr[i]);\n subArrayLength += 1;\n }\n }\n return subArrayLength > longestSubArrayLength\n ? subArrayLength\n : longestSubArrayLength;\n}", "function countVertices(cells) {\n\t var vc = -1\n\t , max = Math.max\n\t for(var i=0, il=cells.length; i<il; ++i) {\n\t var c = cells[i]\n\t for(var j=0, jl=c.length; j<jl; ++j) {\n\t vc = max(vc, c[j])\n\t }\n\t }\n\t return vc+1\n\t}", "function countVertices(cells) {\n\t var vc = -1\n\t , max = Math.max\n\t for(var i=0, il=cells.length; i<il; ++i) {\n\t var c = cells[i]\n\t for(var j=0, jl=c.length; j<jl; ++j) {\n\t vc = max(vc, c[j])\n\t }\n\t }\n\t return vc+1\n\t}", "function countVertices(cells) {\n\t var vc = -1\n\t , max = Math.max\n\t for(var i=0, il=cells.length; i<il; ++i) {\n\t var c = cells[i]\n\t for(var j=0, jl=c.length; j<jl; ++j) {\n\t vc = max(vc, c[j])\n\t }\n\t }\n\t return vc+1\n\t}", "function innerFill(order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , has_index = proc.indexArgs.length>0\r\n\t , code = []\r\n\t , vars = []\r\n\t , idx=0, pidx=0, i, j\r\n\t for(i=0; i<dimension; ++i) { // Iteration variables\r\n\t vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n\t }\r\n\t //Compute scan deltas\r\n\t for(j=0; j<nargs; ++j) {\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n\t vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n\t } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n\t vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t }\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t //Scan loop\r\n\t for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n\t idx = order[i]\r\n\t code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n\t }\r\n\t //Push body of inner loop\r\n\t code.push(body)\r\n\t //Advance scan pointers\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t for(j=0; j<nargs; ++j) {\r\n\t code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n\t }\r\n\t if(has_index) {\r\n\t if(i > 0) {\r\n\t code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n\t }\r\n\t code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n\t }\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function innerFill(order, proc, body) {\r\n\t var dimension = order.length\r\n\t , nargs = proc.arrayArgs.length\r\n\t , has_index = proc.indexArgs.length>0\r\n\t , code = []\r\n\t , vars = []\r\n\t , idx=0, pidx=0, i, j\r\n\t for(i=0; i<dimension; ++i) { // Iteration variables\r\n\t vars.push([\"i\",i,\"=0\"].join(\"\"))\r\n\t }\r\n\t //Compute scan deltas\r\n\t for(j=0; j<nargs; ++j) {\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\r\n\t vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\r\n\t } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\r\n\t vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t }\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t //Scan loop\r\n\t for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\r\n\t idx = order[i]\r\n\t code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\r\n\t }\r\n\t //Push body of inner loop\r\n\t code.push(body)\r\n\t //Advance scan pointers\r\n\t for(i=0; i<dimension; ++i) {\r\n\t pidx = idx\r\n\t idx = order[i]\r\n\t for(j=0; j<nargs; ++j) {\r\n\t code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\r\n\t }\r\n\t if(has_index) {\r\n\t if(i > 0) {\r\n\t code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\r\n\t }\r\n\t code.push([\"++index[\",idx,\"]\"].join(\"\"))\r\n\t }\r\n\t code.push(\"}\")\r\n\t }\r\n\t return code.join(\"\\n\")\r\n\t}", "function size(ar){\n var row_count = ar.length;\n var row_sizes = []\n for(var i=0;i<row_count;i++){\n row_sizes.push(ar[i].length);\n }\n return [row_count, Math.max.apply(null, row_sizes)]\n }", "function functionalLengths(states) {\n return states.reduce((lengths, state) => {\n lengths[state] = state.length;\n return lengths;\n },{});\n \n}", "function crossCount(g) {\n var cc = 0;\n var ordering = util.ordering(g);\n for (var i = 1; i < ordering.length; ++i) {\n cc += twoLayerCrossCount(g, ordering[i-1], ordering[i]);\n }\n return cc;\n}", "function crossCount(g) {\n var cc = 0;\n var ordering = util.ordering(g);\n for (var i = 1; i < ordering.length; ++i) {\n cc += twoLayerCrossCount(g, ordering[i-1], ordering[i]);\n }\n return cc;\n}", "function countLabels(arr) {\n let i,\n total = 0\n if (Array.isArray(arr[0])) {\n for (i = 0; i < arr.length; i++) {\n total += countLabels(arr[i])\n }\n } else {\n for (i = 0; i < arr.length; i++) {\n total += 1\n }\n }\n return total\n }", "count() {\n return this.arrayWidth * this.arrayHeight;\n }", "computeMaxDepth() {\n let d = 0;\n for (const child of this.components) {\n d = Math.max(d + 1, child.children.computeMaxDepth());\n }\n return d;\n }", "function Size(arr) {\n let size = 0;\n for (let i of arr) {\n size+= i.length;\n }\n return size;\n}", "function realSize(arr) {\n // var suma = 0;\n // arr.forEach(function arrFor(val) {\n // if(typeof val === \"object\"){\n // suma += realSize(val);\n // }else if(typeof val === \"number\"){\n // suma++;\n // }\n\n // });\n\n if(arr.length == 0) return 0;\n // return suma;\n var copy = arr.slice();\n\n //SubTotal: Para arrays internos\n var subTotal;\n\n //Copia de array\n copy.shift();\n if(typeof arr[0] === \"object\"){\n subTotal = realSize(arr[0]);\n return subTotal + realSize(copy);\n }\n\n \n return 1 + realSize(copy);\n}", "function count(lengthArray, woodLength, k) {\n var count = 0;\n var curLength;\n var i;\n\n for (i = 0; i < lengthArray.length; i++) {\n curLength = lengthArray[i];\n while (curLength >= woodLength) {\n count++;\n curLength -= woodLength;\n }\n }\n\n return count >= k;\n}", "getNumOfEdges() {\n let numOfRelations = 0;\n for (let node of this.nodes) {\n numOfRelations += node.adjacent.size;\n }\n return numOfRelations / 2;\n }", "function countInverse(array) {\n\n split(0, array.length - 1);\n // console.log(\"Result:\" + array);\n //console.log(count);\n //console.log(perf + ' ' + array.length * Math.log(array.length));\n\n function split(left, right) {\n // console.log('Split ' + left + \" \" + right)\n var middle = Math.floor((right + left) / 2);\n\n if (middle > left) {\n split(left, middle);\n split(middle + 1, right);\n }\n merge(left, middle, right)\n }\n\n function merge(left, middle, right) {\n //console.log(\"Merge\" + left + ',' + middle + ',' + right);\n var leftArr = array.slice(left, middle + 1);\n var rightArr = array.slice(middle + 1, right + 1);\n // console.log(leftArr);\n // console.log(rightArr);\n while (leftArr.length > 0 && rightArr.length > 0) {\n perf++;\n if (leftArr[0] < rightArr[0]) {\n array[left++] = leftArr.shift();\n } else {\n count = (count+leftArr.length);\n array[left++] = rightArr.shift();\n }\n }\n leftArr.concat(rightArr);\n while (leftArr.length > 0) {\n array[left++] = leftArr.shift();\n }\n }\n return count;\n }", "function functionalLengths(states) {\n return states.reduce((lengths, state) => {\n lengths[state] = state.length; \n return lengths;\n }, {});\n}", "function computeDimension(topLeft, topRight, bottomLeft, matrix) {\n var moduleSize = (sum(countBlackWhiteRun(topLeft, bottomLeft, matrix, 5)) / 7 + // Divide by 7 since the ratio is 1:1:3:1:1\n sum(countBlackWhiteRun(topLeft, topRight, matrix, 5)) / 7 +\n sum(countBlackWhiteRun(bottomLeft, topLeft, matrix, 5)) / 7 +\n sum(countBlackWhiteRun(topRight, topLeft, matrix, 5)) / 7) / 4;\n var topDimension = Math.round(distance(topLeft, topRight) / moduleSize);\n var sideDimension = Math.round(distance(topLeft, bottomLeft) / moduleSize);\n var dimension = Math.floor((topDimension + sideDimension) / 2) + 7;\n switch (dimension % 4) {\n case 0:\n dimension++;\n break;\n case 2:\n dimension--;\n break;\n }\n return { dimension: dimension, moduleSize: moduleSize };\n}", "function howMany(array) {\n return array.length;\n}", "computeBoundaryLengths() {\n\t\tthis.l = DenseMatrix.zeros(this.nB, 1);\n\t\tfor (let he of this.boundary.adjacentHalfedges()) {\n\t\t\tlet i = this.bVertexIndex[he.vertex];\n\n\t\t\tthis.l.set(geometry.length(he.edge), i, 0);\n\t\t}\n\t}", "function getOptionMatrixWidth(options) {\n var max = 0;\n $.each(options, function (key, option) {\n max = option.length > max && option.length || max;\n });\n return max;\n }", "function ArrayInversionCount(A) {\n var count = 0;\n \n // Merge sort algorithm from:\n // http://www.stoimen.com/blog/2010/07/02/friday-algorithms-javascript-merge-sort/\n \n function mergeSort(arr) {\n if (arr.length < 2)\n return arr;\n \n var middle = parseInt(arr.length / 2);\n var left = arr.slice(0, middle);\n var right = arr.slice(middle, arr.length);\n \n return merge(mergeSort(left), mergeSort(right));\n }\n \n function merge(left, right) {\n var result = [];\n \n while (left.length && right.length) {\n if (left[0] > right[0]) {\n count += right.length;\n result.push(left.shift());\n } else {\n result.push(right.shift());\n }\n }\n \n while (left.length)\n result.push(left.shift());\n \n while (right.length)\n result.push(right.shift());\n \n return result;\n }\n \n mergeSort(A);\n\n return count < 10e8 ? count : -1; \n}", "get size() {\n // Return the triple count if if was cached.\n var size = this._size;\n if (size !== null)\n return size;\n\n // Calculate the number of triples by counting to the deepest level.\n var contexts = this._contexts, subjects, subject;\n for (var contextKey in contexts)\n for (var subjectKey in (subjects = contexts[contextKey].subjects))\n for (var predicateKey in (subject = subjects[subjectKey]))\n size += Object.keys(subject[predicateKey]).length;\n return this._size = size;\n }" ]
[ "0.61891526", "0.61891526", "0.61891526", "0.61891526", "0.61891526", "0.61891526", "0.6147925", "0.6147925", "0.5894984", "0.56328326", "0.55223143", "0.54141325", "0.5352982", "0.5352982", "0.5352982", "0.5352982", "0.5352982", "0.5352982", "0.5352982", "0.5352982", "0.5340315", "0.5340315", "0.5340315", "0.52794987", "0.52622646", "0.52361536", "0.5218274", "0.52076983", "0.52076983", "0.52076983", "0.52076983", "0.5176598", "0.51572925", "0.5149397", "0.513613", "0.513613", "0.513613", "0.513613", "0.51240766", "0.51214504", "0.50792944", "0.50589305", "0.50589305", "0.50503165", "0.5048723", "0.5046791", "0.5046791", "0.5046791", "0.5046791", "0.50333506", "0.5032027", "0.5028672", "0.5025235", "0.5025235", "0.5025235", "0.5017049", "0.50111264", "0.49870375", "0.4983517", "0.4983517", "0.4983517", "0.4983517", "0.4983517", "0.4983517", "0.4983517", "0.4983517", "0.4970056", "0.49576744", "0.4942762", "0.49425498", "0.49425498", "0.4927477", "0.49120167", "0.49017864", "0.49017864", "0.49017864", "0.48992133", "0.48992133", "0.48969048", "0.48931623", "0.48919138", "0.48919138", "0.48909432", "0.48878688", "0.4865149", "0.48593438", "0.48439807", "0.48298407", "0.4827054", "0.48257446", "0.48244914", "0.48211464", "0.481839", "0.48182353", "0.4815458", "0.47997513", "0.47951132" ]
0.621481
3
Processes a block according to the given data types Replaces variable names by different ones, either "local" ones (that are then ferried in and out of the given array) or ones matching the arguments that the function performing the ultimate loop will accept.
function processBlock(block, proc, dtypes) { var code = block.body var pre = [] var post = [] for(var i=0; i<block.args.length; ++i) { var carg = block.args[i] if(carg.count <= 0) { continue } var re = new RegExp(carg.name, "g") var ptrStr = "" var arrNum = proc.arrayArgs.indexOf(i) switch(proc.argTypes[i]) { case "offset": var offArgIndex = proc.offsetArgIndex.indexOf(i) var offArg = proc.offsetArgs[offArgIndex] arrNum = offArg.array ptrStr = "+q" + offArgIndex // Adds offset to the "pointer" in the array case "array": ptrStr = "p" + arrNum + ptrStr var localStr = "l" + i var arrStr = "a" + arrNum if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array if(carg.count === 1) { // Argument/array used only once(?) if(dtypes[arrNum] === "generic") { if(carg.lvalue) { pre.push(["var ", localStr, "=", arrStr, ".get(", ptrStr, ")"].join("")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue) code = code.replace(re, localStr) post.push([arrStr, ".set(", ptrStr, ",", localStr,")"].join("")) } else { code = code.replace(re, [arrStr, ".get(", ptrStr, ")"].join("")) } } else { code = code.replace(re, [arrStr, "[", ptrStr, "]"].join("")) } } else if(dtypes[arrNum] === "generic") { pre.push(["var ", localStr, "=", arrStr, ".get(", ptrStr, ")"].join("")) // TODO: Could we optimize by checking for carg.rvalue? code = code.replace(re, localStr) if(carg.lvalue) { post.push([arrStr, ".set(", ptrStr, ",", localStr,")"].join("")) } } else { pre.push(["var ", localStr, "=", arrStr, "[", ptrStr, "]"].join("")) // TODO: Could we optimize by checking for carg.rvalue? code = code.replace(re, localStr) if(carg.lvalue) { post.push([arrStr, "[", ptrStr, "]=", localStr].join("")) } } } else { // Argument to body is a "block" var reStrArr = [carg.name], ptrStrArr = [ptrStr] for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) { reStrArr.push("\\s*\\[([^\\]]+)\\]") ptrStrArr.push("$" + (j+1) + "*t" + arrNum + "b" + j) // Matched index times stride } re = new RegExp(reStrArr.join(""), "g") ptrStr = ptrStrArr.join("+") if(dtypes[arrNum] === "generic") { /*if(carg.lvalue) { pre.push(["var ", localStr, "=", arrStr, ".get(", ptrStr, ")"].join("")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue) code = code.replace(re, localStr) post.push([arrStr, ".set(", ptrStr, ",", localStr,")"].join("")) } else { code = code.replace(re, [arrStr, ".get(", ptrStr, ")"].join("")) }*/ throw new Error("cwise: Generic arrays not supported in combination with blocks!") } else { // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit. code = code.replace(re, [arrStr, "[", ptrStr, "]"].join("")) } } break case "scalar": code = code.replace(re, "Y" + proc.scalarArgs.indexOf(i)) break case "index": code = code.replace(re, "index") break case "shape": code = code.replace(re, "shape") break } } return [pre.join("\n"), code, post.join("\n")].join("\n").trim() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\n if(carg.count === 1) { // Argument/array used only once(?)\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n } else { // Argument to body is a \"block\"\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\n }\n re = new RegExp(reStrArr.join(\"\"), \"g\")\n ptrStr = ptrStrArr.join(\"+\")\n if(dtypes[arrNum] === \"generic\") {\n /*if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }*/\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\n } else {\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\n if(carg.count === 1) { // Argument/array used only once(?)\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n } else { // Argument to body is a \"block\"\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\n }\n re = new RegExp(reStrArr.join(\"\"), \"g\")\n ptrStr = ptrStrArr.join(\"+\")\n if(dtypes[arrNum] === \"generic\") {\n /*if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }*/\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\n } else {\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\n if(carg.count === 1) { // Argument/array used only once(?)\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n } else { // Argument to body is a \"block\"\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\n }\n re = new RegExp(reStrArr.join(\"\"), \"g\")\n ptrStr = ptrStrArr.join(\"+\")\n if(dtypes[arrNum] === \"generic\") {\n /*if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }*/\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\n } else {\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\n if(carg.count === 1) { // Argument/array used only once(?)\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n } else { // Argument to body is a \"block\"\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\n }\n re = new RegExp(reStrArr.join(\"\"), \"g\")\n ptrStr = ptrStrArr.join(\"+\")\n if(dtypes[arrNum] === \"generic\") {\n /*if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }*/\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\n } else {\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if(carg.count === 1) {\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if(carg.count === 1) {\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}", "function processBlock(block, proc, dtypes) {\r\n\t var code = block.body\r\n\t var pre = []\r\n\t var post = []\r\n\t for(var i=0; i<block.args.length; ++i) {\r\n\t var carg = block.args[i]\r\n\t if(carg.count <= 0) {\r\n\t continue\r\n\t }\r\n\t var re = new RegExp(carg.name, \"g\")\r\n\t var ptrStr = \"\"\r\n\t var arrNum = proc.arrayArgs.indexOf(i)\r\n\t switch(proc.argTypes[i]) {\r\n\t case \"offset\":\r\n\t var offArgIndex = proc.offsetArgIndex.indexOf(i)\r\n\t var offArg = proc.offsetArgs[offArgIndex]\r\n\t arrNum = offArg.array\r\n\t ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\r\n\t case \"array\":\r\n\t ptrStr = \"p\" + arrNum + ptrStr\r\n\t var localStr = \"l\" + i\r\n\t var arrStr = \"a\" + arrNum\r\n\t if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\r\n\t if(carg.count === 1) { // Argument/array used only once(?)\r\n\t if(dtypes[arrNum] === \"generic\") {\r\n\t if(carg.lvalue) {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n\t code = code.replace(re, localStr)\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n\t }\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n\t }\r\n\t } else if(dtypes[arrNum] === \"generic\") {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n\t code = code.replace(re, localStr)\r\n\t if(carg.lvalue) {\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t }\r\n\t } else {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n\t code = code.replace(re, localStr)\r\n\t if(carg.lvalue) {\r\n\t post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\r\n\t }\r\n\t }\r\n\t } else { // Argument to body is a \"block\"\r\n\t var reStrArr = [carg.name], ptrStrArr = [ptrStr]\r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\r\n\t reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\r\n\t ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\r\n\t }\r\n\t re = new RegExp(reStrArr.join(\"\"), \"g\")\r\n\t ptrStr = ptrStrArr.join(\"+\")\r\n\t if(dtypes[arrNum] === \"generic\") {\r\n\t /*if(carg.lvalue) {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n\t code = code.replace(re, localStr)\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n\t }*/\r\n\t throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\r\n\t } else {\r\n\t // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\r\n\t code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t break\r\n\t case \"scalar\":\r\n\t code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\r\n\t break\r\n\t case \"index\":\r\n\t code = code.replace(re, \"index\")\r\n\t break\r\n\t case \"shape\":\r\n\t code = code.replace(re, \"shape\")\r\n\t break\r\n\t }\r\n\t }\r\n\t return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\r\n\t}", "function processBlock(block, proc, dtypes) {\r\n\t var code = block.body\r\n\t var pre = []\r\n\t var post = []\r\n\t for(var i=0; i<block.args.length; ++i) {\r\n\t var carg = block.args[i]\r\n\t if(carg.count <= 0) {\r\n\t continue\r\n\t }\r\n\t var re = new RegExp(carg.name, \"g\")\r\n\t var ptrStr = \"\"\r\n\t var arrNum = proc.arrayArgs.indexOf(i)\r\n\t switch(proc.argTypes[i]) {\r\n\t case \"offset\":\r\n\t var offArgIndex = proc.offsetArgIndex.indexOf(i)\r\n\t var offArg = proc.offsetArgs[offArgIndex]\r\n\t arrNum = offArg.array\r\n\t ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\r\n\t case \"array\":\r\n\t ptrStr = \"p\" + arrNum + ptrStr\r\n\t var localStr = \"l\" + i\r\n\t var arrStr = \"a\" + arrNum\r\n\t if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\r\n\t if(carg.count === 1) { // Argument/array used only once(?)\r\n\t if(dtypes[arrNum] === \"generic\") {\r\n\t if(carg.lvalue) {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n\t code = code.replace(re, localStr)\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n\t }\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n\t }\r\n\t } else if(dtypes[arrNum] === \"generic\") {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n\t code = code.replace(re, localStr)\r\n\t if(carg.lvalue) {\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t }\r\n\t } else {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\r\n\t code = code.replace(re, localStr)\r\n\t if(carg.lvalue) {\r\n\t post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\r\n\t }\r\n\t }\r\n\t } else { // Argument to body is a \"block\"\r\n\t var reStrArr = [carg.name], ptrStrArr = [ptrStr]\r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\r\n\t reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\r\n\t ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\r\n\t }\r\n\t re = new RegExp(reStrArr.join(\"\"), \"g\")\r\n\t ptrStr = ptrStrArr.join(\"+\")\r\n\t if(dtypes[arrNum] === \"generic\") {\r\n\t /*if(carg.lvalue) {\r\n\t pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\r\n\t code = code.replace(re, localStr)\r\n\t post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\r\n\t } else {\r\n\t code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\r\n\t }*/\r\n\t throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\r\n\t } else {\r\n\t // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\r\n\t code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t break\r\n\t case \"scalar\":\r\n\t code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\r\n\t break\r\n\t case \"index\":\r\n\t code = code.replace(re, \"index\")\r\n\t break\r\n\t case \"shape\":\r\n\t code = code.replace(re, \"shape\")\r\n\t break\r\n\t }\r\n\t }\r\n\t return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\r\n\t}", "function prepareData(datatype){\n switch(datatype){\n case \"strain\":\n dim1_text = \"Frequency (Hz)\";\n dim2_text = \"Strain / Voltage (V)\";\n data = f_arr.map(function(d, i){\n return { 'dim1' : f_arr[i], 'dim2' : ew_arr[i] };\n });\n break;\n\n case \"force\":\n dim1_text = \"Frequency (Hz)\";\n dim2_text = \"Force (µN) / Voltage (V)\";\n data = f_arr.map(function(d, i){\n return { 'dim1' : f_arr[i], 'dim2' : fw_arr[i] };\n });\n break;\n\n case \"displacement\":\n dim1_text = \"Frequency (Hz)\";\n dim2_text = \"Displacement (mm) / Voltage (V)\";\n data = f_arr.map(function(d, i){\n return { 'dim1' : f_arr[i], 'dim2' : dw_arr[i] };\n });\n break;\n\n //Range values\n case \"cutoff\":\n dim1_text = parseDimensionText(param_id);\n dim2_text = \"Cutoff Frequency (Hz)\";\n data = param_arr.map(function(d, i){\n return { 'dim1' : param_arr[i], 'dim2' : cutoff_arr[i] };\n });\n break;\n case \"maxForce\":\n dim1_text= parseDimensionText(param_id);\n dim2_text= \"Max Force (µN) / Voltage (V)\";\n data = param_arr.map(function(d, i){\n return { 'dim1' : param_arr[i], 'dim2' : maxFW_arr[i] };\n });\n break;\n case \"maxDisplacement\":\n dim1_text= parseDimensionText(param_id);\n dim2_text= \"Max Displacement (mm) / Voltage (V)\";\n data = param_arr.map(function(d, i){\n return { 'dim1' : param_arr[i], 'dim2' : maxDW_arr[i] };\n });\n break;\n }\n \n\n\n // if(state ==\"fixed_values\"){\n // dim1_text = \"Frequency\";\n // dim2_text = \"Strain/Voltage (V)\";\n // data = f_arr.map(function(d, i){\n // return { 'dim1' : f_arr[i], 'dim2' : ew_arr[i] };\n // });\n // }\n // else if(state == \"range_values\" && datatype==\"cutoff_arr\"){\n // dim1_text = param_id;\n // dim2_text = \"Cutoff Value\";\n // data = param_arr.map(function(d, i){\n // return { 'dim1' : param_arr[i], 'dim2' : cutoff_arr[i] };\n // });\n // }\n // else if(state == \"range_values\" && datatype==\"maxF_arr\"){\n // dim1_text= param_id;\n // dim2_text= \"Max Value\";\n // data = param_arr.map(function(d, i){\n // return { 'dim1' : param_arr[i], 'dim2' : maxF_arr[i] };\n // });\n // }\n}", "preprocessData(type) {\n if (type == \"Genomes\")\n this.preprocessGenomes();\n else if (type == \"Paired-end Reads\")\n this.preprocessPairedReads();\n else if (type == \"Single-end Reads\")\n this.preprocessSingleReads();\n else if (type == \"Interleaved Paired-end Reads\")\n this.preprocessSingleReads();\n }", "function typify (quantifiedGroups) {\n return quantifiedGroups.map(item => {\n if (item && item.type == \"group\") { // Recurse Groups\n item.items = typify(item.items);\n return item;\n }\n\n if (typeof item != \"string\") throw \"Unable to itemize - not a string\";\n\n let items = [];\n let type = null; // space, variable, delimiter, constant, divider, or\n let typeStart = 0;\n\n // Walk the String\n item.split(\"\").forEach((char, index) => {\n\n if (type == \"variable\" && char !== constants.VARIABLE_END) {\n if (!/[a-zA-Z0-9:.]/g.test(char)) throw \"Invalid variable name\";\n return;\n // /^[a-zA-Z][a-zA-Z0-9:]*$/g.test(\"3aAsd:f9\");\n }\n\n if (/\\s/g.test(char)) { // space\n if (type !== \"space\") {\n if (type) items.push({type, value: item.substring(typeStart, index)});\n type = \"space\";\n typeStart = index;\n }\n\n } else if (char === constants.GROUP_DIVIDER) {\n if (type) items.push({type, value: item.substring(typeStart, index)});\n type = \"divider\";\n typeStart = index;\n\n } else if (char === \"|\") { // or\n if (type) items.push({type, value: item.substring(typeStart, index)});\n type = \"or\";\n typeStart = index;\n\n } else if (char === \"<\") { // Variable start\n if (type) items.push({type, value: item.substring(typeStart, index)});\n type = \"variable\";\n typeStart = index + 1;\n\n } else if (char === \">\") { // Variable stop\n if (type !== \"variable\") throw \"Unmatched starting variable caret\";\n\n let variable = {\n type: \"variable\",\n name: item.substring(typeStart, index),\n dataType: \"String\"\n };\n\n let nameSplit = variable.name.split(constants.VARIABLE_DIVIDER);\n if (nameSplit.length > 2) throw \"Invalid variable: \" + name;\n\n // Custom Data Type\n if (nameSplit.length == 2) {\n if (nameSplit[0]) variable.dataType = nameSplit[0];\n variable.name = nameSplit[1];\n }\n\n // Dot dot dot\n if (variable.name.substr(-3) === \"...\") {\n variable.dotdotdot = true;\n variable.name = variable.name.substr(0, variable.name.length - 3);\n }\n\n // Empty name - use prior constant name\n if (!variable.name) {\n for (let i = items.length - 1; i >= 0; i--) {\n if (items[i].type == \"constant\") {\n variable.name = items[i].value;\n break;\n }\n }\n if (!variable.name) throw \"Missing variable name\";\n }\n\n // Validate name\n if (!/[a-zA-Z0-9_-]/g.test(variable.name)) throw \"Invalid variable name: \" + variable.name;\n\n items.push(variable);\n type = null;\n\n } else if (/[a-zA-Z0-9_-]/g.test(char)) { // constant\n if (type !== \"constant\") {\n if (type) items.push({type, value: item.substring(typeStart, index)});\n type = \"constant\";\n typeStart = index;\n }\n\n } else { // delimiter\n if (type !== \"delimiter\") {\n if (type) items.push({type, value: item.substring(typeStart, index)});\n type = \"delimiter\";\n typeStart = index;\n }\n }\n\n });\n\n // Make sure variables were closed\n if (type == \"variable\") throw \"Variable was not closed\";\n\n // Remainder (for spaces, delimiters, and constants\n if (type) items.push({type, value: item.substring(typeStart)});\n\n return items;\n\n }).reduce((items, item) => {\n if (Array.isArray(item)) {\n return items.concat(item);\n } else {\n items.push(item);\n return items;\n }\n }, []);\n}", "function encodeBlocks($, prefix, blockType, args, block) {\n if (!prefix) prefix = \"\";\n if (blockType == \"function\") {\n // decode the function block (THIS IS THE IMPORTANT BIT)\n // We are retrieving all sub-blocks and will re-parse them in light\n // of newly shrunk variables\n block = args + decodeBlocks(block, SCOPED);\n prefix = prefix.replace(BRACKETS, \"\");\n \n // create the list of variable and argument names\n args = args.slice(1, -1);\n \n if (args != \"_no_shrink_\") {\n var vars = match(block, VARS).join(\";\").replace(VAR_g, \";var\");\n while (BRACKETS.test(vars)) {\n vars = vars.replace(BRACKETS_g, \"\");\n }\n vars = vars.replace(VAR_TIDY, \"\").replace(VAR_EQUAL, \"\");\n }\n block = decodeBlocks(block, ENCODED_BLOCK);\n \n // process each identifier\n if (args != \"_no_shrink_\") {\n var count = 0, shortId;\n var ids = match([args, vars], IDENTIFIER);\n var processed = {};\n for (var i = 0; i < ids.length; i++) {\n id = ids[i];\n if (!processed[\"#\" + id]) {\n processed[\"#\" + id] = true;\n id = rescape(id);\n // encode variable names\n while (new RegExp(Shrinker.PREFIX + count + \"\\\\b\").test(block)) count++;\n var reg = new RegExp(\"([^\\\\w$.])\" + id + \"([^\\\\w$:])\");\n while (reg.test(block)) {\n block = block.replace(global(reg), \"$1\" + Shrinker.PREFIX + count + \"$2\");\n }\n var reg = new RegExp(\"([^{,\\\\w$.])\" + id + \":\", \"g\");\n block = block.replace(reg, \"$1\" + Shrinker.PREFIX + count + \":\");\n count++;\n }\n }\n total = Math.max(total, count);\n }\n var replacement = prefix + \"~\" + blocks.length + \"~\";\n blocks.push(block);\n } else {\n var replacement = \"~#\" + blocks.length + \"~\";\n blocks.push(prefix + block);\n }\n return replacement;\n }", "function changeVariableType(variables) {\n for (var i in variables) {\n var variable = variables[i];\n if (variable[\"type\"] === \"TEXT\") {\n variable[\"type\"] = \"STRING\";\n }\n if (isNotUndefinedOrNull(variable.variableSet) && variable.variableSet.length > 0) {\n changeVariableType(variable.variableSet);\n }\n }\n}", "function fillBlocks(dataset, block, arraysToList, enable) {\n if (dataset.type === 'vtkMultiBlock') {\n Object.keys(dataset.MultiBlock.Blocks).forEach(blockName => {\n block[blockName] = fillBlocks(dataset.MultiBlock.Blocks[blockName], {}, arraysToList, enable);\n block[blockName].enable = enable;\n });\n } else {\n block.type = dataset.type;\n block.enable = enable;\n const container = dataset[dataset.type];\n LOCATIONS.forEach(location => {\n if (container[location]) {\n Object.keys(container[location]).forEach(name => {\n if (arraysToList[`${location}_:|:_${name}`]) {\n arraysToList[`${location}_:|:_${name}`].ds.push(container);\n } else {\n arraysToList[`${location}_:|:_${name}`] = { name, enable, location, ds: [container] };\n }\n });\n }\n });\n }\n\n return block;\n }", "parse_tag_blocks() {\n for (var i = 0; i < this.blocks.length; ++i) {\n for (var key in BlockPatterns) {\n if (this.blocks[i].matches(BlockPatterns[key])) {\n this.blocks[i].type = key;\n }\n }\n }\n }", "function transformTheOtherDeclarations(input,output,classesArray) {\r\n\r\n\t\t\t //alert('starting function declarations adjustments');\r\n\t\t\t //alert('input: ' + input);\r\n\t\t\t output.innerHTML = \"\";\r\n\r\n\t\t\t // first we remove comments\r\n\t\t\t //inputWithoutComments = removeComments(input);\t\t\t \r\n\r\n\t\t\t var lineCommentExp = \"((\\\\r|\\\\n)*\\\\/\\\\*lineNumber[1234567890]*\\\\*\\\\/(\\\\r|\\\\n)*\\\\s*)*\";\r\n\t\t\t var howManyClasses = classesArray.length;\r\n\t\t\t var myRe;\r\n\t\t\t var foundLeftSideArraysPlace;\r\n\t\t\t var foundLeftSideArrays;\r\n\t\t\t var foundLeftSideArraysLength;\r\n\t\t\t var secondPart;\r\n\t\t\t\t\t\t\r\n\t\t\t for ( var i=0; i<howManyClasses; i++ ){\r\n\r\n\t\t\t\tvar allMatches=0;\r\n\t\t\t\t\twhile ( true )\t{\r\n\t\t\t\t\t\tallMatches++;\r\n\t\t\t\t \r\n\t\t\t\t\t // let's find right side declarations of arrays\r\n\t\t\t\t\t // that is, anything that has a class name and actually contains something\r\n\t\t\t\t\t // after the opening square bracket\r\n\t\t\t\t\t\tsecondPart = classesArray[i] + \"\\\\s+\"+lineCommentExp+\"[a-zA-Z][a-zA-Z0-9_]*\\\\s*\"+lineCommentExp+\"[\\\\;\\\\,\\\\=]\";\r\n\t\t\t\t\t\t//alert('building regex for functions returning ' + classesArray[i]);\r\n\t\t\t\t\t\tmyRe = new RegExp(\"[^a-zA-Z0-9_]\"+secondPart);\r\n\t\t\t\t\t\t//alert('searching for type ' + classesArray[i]);\r\n\t\t\t\t\t\tfoundLeftSideArraysPlace = input.search(myRe);\r\n\r\n\t\t\t\t\t\t// go to the next class if there are no more results for this one\r\n\t\t\t\t\t\tif (foundLeftSideArraysPlace == -1){\r\n\t\t\t\t\t\t //alert('found no types ' + classesArray[i]);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tfoundLeftSideArraysPlace++;\r\n\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//alert('found one function returning ' + classesArray[i]);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfoundLeftSideArrays = input.match(myRe);\r\n\t\t\t\t\t\tfoundLeftSideArraysLength = foundLeftSideArrays[0].length;\r\n\t\t\t\t\t\tfoundLeftSideArraysLength--;\r\n var untouchedPart = input.substring(foundLeftSideArraysPlace + foundLeftSideArraysLength);\r\n\t\t\t\t\t\t//alert('the untouched part is: ' + input.substring(foundLeftSideArraysPlace + foundLeftSideArraysLength));\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfoundLeftSideArrays = foundLeftSideArrays[0].substring(1);\r\n\t\t\t\t\t\t//alert('here it is: ' + foundLeftSideArrays);\r\n \t\t\t\t\t\t\r\n\t\t\t\t\t\tvar regexsoonafterPar;\r\n\t\t\t\t\t\t//var foundLeftSideArraysPlace;\r\n\r\n\t\t\t\t\t\t for ( var j=0; j<howManyClasses; j++ ){\r\n\t\t\t\t\t\t\t//alert('eliminating the type ' + classesArray[j] + 'inside the parenthesys');\r\n\t\t\t\t\t\t // the type name is preceded by either an open parenthesys, a comma\r\n\t\t\t\t\t\t\t// or a space\r\n\t\t\t\t\t\t\tregexsoonafterPar = new RegExp(classesArray[j]+\"\\\\s\",\"g\");\r\n\t\t\t\t\t\t\tvar foundLeftSideArraysPlace2 = foundLeftSideArrays.search(regexsoonafterPar,'');\r\n\t\t\t\t\t\t\tfoundLeftSideArrays = foundLeftSideArrays.replace(regexsoonafterPar,'');\r\n\t\t\t\t\t\t\tif (foundLeftSideArraysPlace2 !== -1){\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t//alert('the replaced version is '+foundLeftSideArrays);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//alert('found a match for right side array declaration of class ' + );\r\n\r\n\t\t\t\t\t\t// in the line with the function declaration, now all types within\r\n\t\t\t\t\t\t// the parenthesys should be gone\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// substitute the function declaration in the program. Also remove the return type and change it into \"var\"\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tinput= input.substring(0,foundLeftSideArraysPlace) + \"var \" + foundLeftSideArrays + untouchedPart;\r\n\t\t\t\t\t\t//alert('substitution: '+input);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\toutput.innerHTML += input.replace( /\\n/g, '<br />\\n' );\r\n\t\t\t\treturn input;\r\n\r\n\t\t}", "function handleBlock(startArr, startOffsetM, startOffsetNextM, destArr, destOffsetM, destOffsetNextM, undefined$1){\n\n // slice out the block we need\n var startArrTemp = startArr.slice(startOffsetM, startOffsetNextM || undefined$1)\n , destArrTemp = destArr.slice( destOffsetM, destOffsetNextM || undefined$1);\n\n var i = 0\n , posStart = {pos:[0,0], start:[0,0]}\n , posDest = {pos:[0,0], start:[0,0]};\n\n do{\n\n // convert shorthand types to long form\n startArrTemp[i] = simplyfy.call(posStart, startArrTemp[i]);\n destArrTemp[i] = simplyfy.call(posDest , destArrTemp[i]);\n\n // check if both shape types match\n // 2 elliptical arc curve commands ('A'), are considered different if the\n // flags (large-arc-flag, sweep-flag) don't match\n if(startArrTemp[i][0] != destArrTemp[i][0] || startArrTemp[i][0] == 'M' ||\n (startArrTemp[i][0] == 'A' &&\n (startArrTemp[i][4] != destArrTemp[i][4] || startArrTemp[i][5] != destArrTemp[i][5])\n )\n ) {\n\n // if not, convert shapes to beziere\n Array.prototype.splice.apply(startArrTemp, [i, 1].concat(toBeziere.call(posStart, startArrTemp[i])));\n Array.prototype.splice.apply(destArrTemp, [i, 1].concat(toBeziere.call(posDest, destArrTemp[i])));\n\n } else {\n\n // only update positions otherwise\n startArrTemp[i] = setPosAndReflection.call(posStart, startArrTemp[i]);\n destArrTemp[i] = setPosAndReflection.call(posDest , destArrTemp[i]);\n\n }\n\n // we are at the end at both arrays. stop here\n if(++i == startArrTemp.length && i == destArrTemp.length) break\n\n // destArray is longer. Add one element\n if(i == startArrTemp.length){\n startArrTemp.push([\n 'C',\n posStart.pos[0],\n posStart.pos[1],\n posStart.pos[0],\n posStart.pos[1],\n posStart.pos[0],\n posStart.pos[1],\n ]);\n }\n\n // startArr is longer. Add one element\n if(i == destArrTemp.length){\n destArrTemp.push([\n 'C',\n posDest.pos[0],\n posDest.pos[1],\n posDest.pos[0],\n posDest.pos[1],\n posDest.pos[0],\n posDest.pos[1]\n ]);\n }\n\n\n }while(true)\n\n // return the updated block\n return {start:startArrTemp, dest:destArrTemp}\n }", "function process(context, list) {\n if (context) context = context + \".\";\n\n for (var i in list) {\n var token = list[i];\n\n // Is a partial\n if (token[0] === \">\") {\n // this is dangerous but used to avoid fetching partials twice\n partials[token[1]] = null;\n }\n\n // Is a variable, '#' starts iterative blocks\n // '&' starts unescaped blocks\n if (\n token[0] === \"name\" ||\n token[0] === \"#\" ||\n token[0] === \"^\" ||\n token[0] === \"&\"\n ) {\n // e.g. all_entries.length\n var variable = token[1];\n // e.g. all_entries\n var variableRoot =\n variable.indexOf(\".\") > -1 &&\n variable.slice(0, variable.indexOf(\".\"));\n\n if (retrieveThese.indexOf(variable) > -1) retrieve[variable] = true;\n\n if (retrieveThese.indexOf(variableRoot) > -1)\n retrieve[variableRoot] = true;\n\n // console.log(context + variable);\n\n for (var x = 0; x < retrieveThese.length; x++) {\n var approved = retrieveThese[x];\n\n if (approved.indexOf(\".\") === -1) continue;\n\n // console.log('--', approved);\n\n if ((context + variable).indexOf(approved) > -1) {\n var fix = (context + variable).slice(\n (context + variable).indexOf(approved)\n );\n retrieve[fix] = true;\n }\n }\n\n // There are other tokens inside this block\n // process these recursively\n if (type(token[4], \"array\")) process(context + variable, token[4]);\n }\n }\n }", "function variablesTypes(input) {\n console.log(\"My name: \" + input[0] + '//type is ' + typeof(input[0]) +\n '. My age: ' + input[1] + ' //type is ' + typeof(input[1]) +\n '. I am male: ' + input[2] + '//type is ' + typeof(input[2]) + '. My favorite foods are:' + input[3].toString() + '. //type is ' + typeof(input[3]));\n}", "function executeLoop (loopParams, p1, p2, node) {\n // two loop locals are allowed\n // - for arrays it's the current value and the index\n // - for objects, it's the value and the key\n const scopedLocals = {}\n scopedLocals[loopParams[0]] = p1\n if (loopParams[1]) scopedLocals[loopParams[1]] = p2\n // merge nondestructively into existing locals\n const scopedOptions = merge(cloneDeep(options), { locals: scopedLocals })\n // walk through the contents and run replacements with modified options\n // we need to clone the node because the normal operation modifies\n // the node directly\n return walk(scopedOptions, cloneDeep(node.content))\n}", "function process(arr) {\n console.log('pre-process');\n for (var k in GRADE) {\n GRADE[k+ '_tv'] = GRADE[k].map(p=> p.map(v => to_seconds(v)));\n }\n arr.forEach(d => {\n // d.name = d.alias + '(' + d.name.split('/').pop() + ')';\n d.name = d.alias || d.name.split('/').pop();\n d.gender = d.gender.slice(0, 1);\n d.gender = d.gender === 'W' ? 'F' : d.gender;\n d.dispName = d.block + ' ' + d.name;\n\n var split = d.split, gap = to_seconds(d.result.gap);\n\n split.unshift({\n position: '0km',\n elapsed: '0:00:00',\n duration: d.result.gap,\n pace: '20:00:00',\n });\n\n d._step = split.map(m => to_seconds(m.duration));\n d._pace = split.map(m => to_seconds(m.pace));\n d._total = split.map(m => to_seconds(m.elapsed) - gap);\n d._gap = gap;\n d._grade = d._pace.map((p, i) => gradeOf(d.gender, p));\n\n // d._distance = interpolateDistance(d);\n });\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\r\n //Compute dimension\r\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n var orders = new Array(proc.arrayArgs.length)\r\n var dtypes = new Array(proc.arrayArgs.length)\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n dtypes[i] = typesig[2*i]\r\n orders[i] = typesig[2*i+1]\r\n }\r\n \r\n //Determine where block and loop indices start and end\r\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n var loopOrders = [] // orders restricted to the loop indices\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n if (proc.arrayBlockIndices[i]<0) {\r\n loopBegin.push(0)\r\n loopEnd.push(dimension)\r\n blockBegin.push(dimension)\r\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n } else {\r\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n blockBegin.push(0)\r\n blockEnd.push(proc.arrayBlockIndices[i])\r\n }\r\n var newOrder = []\r\n for(var j=0; j<orders[i].length; j++) {\r\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n }\r\n }\r\n loopOrders.push(newOrder)\r\n }\r\n\r\n //First create arguments for procedure\r\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n var code = [\"'use strict'\"]\r\n var vars = []\r\n \r\n for(var j=0; j<dimension; ++j) {\r\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n }\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n arglist.push(\"a\"+i) // Actual data array\r\n arglist.push(\"t\"+i) // Strides\r\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n \r\n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n \r\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n }\r\n }\r\n for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n arglist.push(\"Y\" + i)\r\n }\r\n if(proc.shapeArgs.length > 0) {\r\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n }\r\n if(proc.indexArgs.length > 0) {\r\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n var zeros = new Array(dimension)\r\n for(var i=0; i<dimension; ++i) {\r\n zeros[i] = \"0\"\r\n }\r\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n }\r\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n var off_arg = proc.offsetArgs[i]\r\n var init_string = []\r\n for(var j=0; j<off_arg.offset.length; ++j) {\r\n if(off_arg.offset[j] === 0) {\r\n continue\r\n } else if(off_arg.offset[j] === 1) {\r\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n } else {\r\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n }\r\n }\r\n if(init_string.length === 0) {\r\n vars.push(\"q\" + i + \"=0\")\r\n } else {\r\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n }\r\n }\r\n\r\n //Prepare this variables\r\n var thisVars = uniq([].concat(proc.pre.thisVars)\r\n .concat(proc.body.thisVars)\r\n .concat(proc.post.thisVars))\r\n vars = vars.concat(thisVars)\r\n code.push(\"var \" + vars.join(\",\"))\r\n for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n code.push(\"p\"+i+\"|=0\")\r\n }\r\n \r\n //Inline prelude\r\n if(proc.pre.body.length > 3) {\r\n code.push(processBlock(proc.pre, proc, dtypes))\r\n }\r\n\r\n //Process body\r\n var body = processBlock(proc.body, proc, dtypes)\r\n var matched = countMatches(loopOrders)\r\n if(matched < dimension) {\r\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n } else {\r\n code.push(innerFill(loopOrders[0], proc, body))\r\n }\r\n\r\n //Inline epilog\r\n if(proc.post.body.length > 3) {\r\n code.push(processBlock(proc.post, proc, dtypes))\r\n }\r\n \r\n if(proc.debug) {\r\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n }\r\n \r\n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n return f()\r\n}", "function variablesTypes(params) {\r\n 'use strict';\r\n var foodsAsString = '', i, name, age, isMale, foods;\r\n name = params[0];\r\n age = params[1];\r\n isMale = params[2];\r\n foods = params[3];\r\n for (i = 0; i < foods.length; i += 1) {\r\n foodsAsString += foods[i];\r\n if (i !== foods.length - 1) {\r\n foodsAsString += ',';\r\n }\r\n }\r\n console.log('My name: ' + name + '//type is ' + typeof name);\r\n console.log('My age: ' + age + '//type is ' + typeof age);\r\n console.log('I am male: ' + isMale + '//type is ' + typeof isMale);\r\n console.log('My favourite foods are: ' + foodsAsString + '//type is ' + typeof foods);\r\n}", "function generateCWiseOp(proc, typesig) {\r\n\t\r\n\t //Compute dimension\r\n\t // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n\t var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n\t var orders = new Array(proc.arrayArgs.length)\r\n\t var dtypes = new Array(proc.arrayArgs.length)\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t dtypes[i] = typesig[2*i]\r\n\t orders[i] = typesig[2*i+1]\r\n\t }\r\n\t \r\n\t //Determine where block and loop indices start and end\r\n\t var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n\t var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n\t var loopOrders = [] // orders restricted to the loop indices\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t if (proc.arrayBlockIndices[i]<0) {\r\n\t loopBegin.push(0)\r\n\t loopEnd.push(dimension)\r\n\t blockBegin.push(dimension)\r\n\t blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n\t } else {\r\n\t loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n\t loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n\t blockBegin.push(0)\r\n\t blockEnd.push(proc.arrayBlockIndices[i])\r\n\t }\r\n\t var newOrder = []\r\n\t for(var j=0; j<orders[i].length; j++) {\r\n\t if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n\t newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n\t }\r\n\t }\r\n\t loopOrders.push(newOrder)\r\n\t }\r\n\t\r\n\t //First create arguments for procedure\r\n\t var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n\t var code = [\"'use strict'\"]\r\n\t var vars = []\r\n\t \r\n\t for(var j=0; j<dimension; ++j) {\r\n\t vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n\t }\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t arglist.push(\"a\"+i) // Actual data array\r\n\t arglist.push(\"t\"+i) // Strides\r\n\t arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n\t \r\n\t for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n\t vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t \r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n\t vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n\t arglist.push(\"Y\" + i)\r\n\t }\r\n\t if(proc.shapeArgs.length > 0) {\r\n\t vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n\t }\r\n\t if(proc.indexArgs.length > 0) {\r\n\t // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n\t var zeros = new Array(dimension)\r\n\t for(var i=0; i<dimension; ++i) {\r\n\t zeros[i] = \"0\"\r\n\t }\r\n\t vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n\t }\r\n\t for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n\t var off_arg = proc.offsetArgs[i]\r\n\t var init_string = []\r\n\t for(var j=0; j<off_arg.offset.length; ++j) {\r\n\t if(off_arg.offset[j] === 0) {\r\n\t continue\r\n\t } else if(off_arg.offset[j] === 1) {\r\n\t init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n\t } else {\r\n\t init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n\t }\r\n\t }\r\n\t if(init_string.length === 0) {\r\n\t vars.push(\"q\" + i + \"=0\")\r\n\t } else {\r\n\t vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n\t }\r\n\t }\r\n\t\r\n\t //Prepare this variables\r\n\t var thisVars = uniq([].concat(proc.pre.thisVars)\r\n\t .concat(proc.body.thisVars)\r\n\t .concat(proc.post.thisVars))\r\n\t vars = vars.concat(thisVars)\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t code.push(\"p\"+i+\"|=0\")\r\n\t }\r\n\t \r\n\t //Inline prelude\r\n\t if(proc.pre.body.length > 3) {\r\n\t code.push(processBlock(proc.pre, proc, dtypes))\r\n\t }\r\n\t\r\n\t //Process body\r\n\t var body = processBlock(proc.body, proc, dtypes)\r\n\t var matched = countMatches(loopOrders)\r\n\t if(matched < dimension) {\r\n\t code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n\t } else {\r\n\t code.push(innerFill(loopOrders[0], proc, body))\r\n\t }\r\n\t\r\n\t //Inline epilog\r\n\t if(proc.post.body.length > 3) {\r\n\t code.push(processBlock(proc.post, proc, dtypes))\r\n\t }\r\n\t \r\n\t if(proc.debug) {\r\n\t console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n\t }\r\n\t \r\n\t var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n\t var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n\t return f()\r\n\t}", "function generateCWiseOp(proc, typesig) {\r\n\t\r\n\t //Compute dimension\r\n\t // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n\t var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n\t var orders = new Array(proc.arrayArgs.length)\r\n\t var dtypes = new Array(proc.arrayArgs.length)\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t dtypes[i] = typesig[2*i]\r\n\t orders[i] = typesig[2*i+1]\r\n\t }\r\n\t \r\n\t //Determine where block and loop indices start and end\r\n\t var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n\t var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n\t var loopOrders = [] // orders restricted to the loop indices\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t if (proc.arrayBlockIndices[i]<0) {\r\n\t loopBegin.push(0)\r\n\t loopEnd.push(dimension)\r\n\t blockBegin.push(dimension)\r\n\t blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n\t } else {\r\n\t loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n\t loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n\t blockBegin.push(0)\r\n\t blockEnd.push(proc.arrayBlockIndices[i])\r\n\t }\r\n\t var newOrder = []\r\n\t for(var j=0; j<orders[i].length; j++) {\r\n\t if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n\t newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n\t }\r\n\t }\r\n\t loopOrders.push(newOrder)\r\n\t }\r\n\t\r\n\t //First create arguments for procedure\r\n\t var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n\t var code = [\"'use strict'\"]\r\n\t var vars = []\r\n\t \r\n\t for(var j=0; j<dimension; ++j) {\r\n\t vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n\t }\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t arglist.push(\"a\"+i) // Actual data array\r\n\t arglist.push(\"t\"+i) // Strides\r\n\t arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n\t \r\n\t for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n\t vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t \r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n\t vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n\t arglist.push(\"Y\" + i)\r\n\t }\r\n\t if(proc.shapeArgs.length > 0) {\r\n\t vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n\t }\r\n\t if(proc.indexArgs.length > 0) {\r\n\t // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n\t var zeros = new Array(dimension)\r\n\t for(var i=0; i<dimension; ++i) {\r\n\t zeros[i] = \"0\"\r\n\t }\r\n\t vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n\t }\r\n\t for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n\t var off_arg = proc.offsetArgs[i]\r\n\t var init_string = []\r\n\t for(var j=0; j<off_arg.offset.length; ++j) {\r\n\t if(off_arg.offset[j] === 0) {\r\n\t continue\r\n\t } else if(off_arg.offset[j] === 1) {\r\n\t init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n\t } else {\r\n\t init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n\t }\r\n\t }\r\n\t if(init_string.length === 0) {\r\n\t vars.push(\"q\" + i + \"=0\")\r\n\t } else {\r\n\t vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n\t }\r\n\t }\r\n\t\r\n\t //Prepare this variables\r\n\t var thisVars = uniq([].concat(proc.pre.thisVars)\r\n\t .concat(proc.body.thisVars)\r\n\t .concat(proc.post.thisVars))\r\n\t vars = vars.concat(thisVars)\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t code.push(\"p\"+i+\"|=0\")\r\n\t }\r\n\t \r\n\t //Inline prelude\r\n\t if(proc.pre.body.length > 3) {\r\n\t code.push(processBlock(proc.pre, proc, dtypes))\r\n\t }\r\n\t\r\n\t //Process body\r\n\t var body = processBlock(proc.body, proc, dtypes)\r\n\t var matched = countMatches(loopOrders)\r\n\t if(matched < dimension) {\r\n\t code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n\t } else {\r\n\t code.push(innerFill(loopOrders[0], proc, body))\r\n\t }\r\n\t\r\n\t //Inline epilog\r\n\t if(proc.post.body.length > 3) {\r\n\t code.push(processBlock(proc.post, proc, dtypes))\r\n\t }\r\n\t \r\n\t if(proc.debug) {\r\n\t console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n\t }\r\n\t \r\n\t var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n\t var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n\t return f()\r\n\t}", "function findArrayDeclarationsLeftSides(input,output,classesArray) {\r\n\r\n\t\t\t // to do 1) you regex the whole program every time when you look\r\n\t\t\t // for successive array declarations - you obviously don't need to do\r\n\t\t\t // that. You should regex the whole file only when you check\r\n\t\t\t // a new type\r\n\t\t\t \r\n\t\t\t // to do 2) if at the end of this you still find something like\r\n\t\t\t // type[] then it means that you are referencing a type / class\r\n\t\t\t // that doesn't exist, you can report that.\r\n\r\n\r\n\r\n\t\t\t // this should replace stuff like\r\n\t\t\t // float mx[] = new float[num], my[] = new float[num];\r\n\t\t\t // into\r\n\t\t\t // var mx = new float[num], my = new float[num];\r\n\t\t\t \r\n\t\t\t output.innerHTML = \"\";\r\n\t\t\t \r\n\t\t\t // first we remove comments\r\n\t\t\t var inputWithoutComments = input;\t\t\t \r\n\t\t\t \r\n\t\t\t //alert('entering the function');\r\n\t\t\t \t\t\t \r\n\t\t\t // let's find left side declarations of arrays\r\n\t\t\t // i.e. stuff like float [] coswave;\r\n\t\t\t \r\n\t\t\t // this is the regex for eating a line comment ((\\r|\\n)*\\/\\*lineNumber[1234567890]*\\*\\/(\\r|\\n)*\\s*)*\r\n\r\n\t\t\t // so the actual regular expression is something like /float\\s*((\\r|\\n)*\\/\\*lineNumber[1234567890]*\\*\\/(\\r|\\n)*\\s*)*\\[\\s*((\\r|\\n)*\\/\\*lineNumber[1234567890]*\\*\\/(\\r|\\n)*\\s*)*\\]/g\r\n\t\t\t \r\n\t\t\t var lineCommentExp = \"((\\\\r|\\\\n)*\\\\/\\\\*lineNumber[1234567890]*\\\\*\\\\/(\\\\r|\\\\n)*\\\\s*)*\";\r\n\t\t\t var second_part = \"\\\\s*\"+ lineCommentExp +\"[a-zA-Z0-9_]*\"+\"\\\\s*\"+ lineCommentExp +\"\\\\[\\\\s*\"+lineCommentExp+\"\\\\]\";\r\n\t\t\t var segment_part = '';\r\n\t\t\t var myRe = '';\r\n\t\t\t var foundLeftSideArrays = '';\r\n\t\t\t\tvar howManyClasses = classesArray.length;\r\n\t\t\t\t//alert('entering the loop');\r\n\t\t\t\tvar secondPart = '';\r\n\t\t\t\t\t\r\n\t\t\t\tvar processingLintMatches = [];\r\n\t\t\t\tvar positionOfSecondBracket = '';\r\n\t\t\t\tvar foundLeftSideArraysMatches = [];\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t for ( var i=0; i<howManyClasses; i++ ){\r\n\t\t\t while(true){\r\n\t\t\t\t//alert('inside the loop testing class ' + classesArray[i]);\r\n\t\t\t\tsegment_part = classesArray[i];\r\n\t\t\t\tvar buildingRegex = \"[^a-zA-Z0-9_]\"+segment_part + second_part;\r\n\t\t\t\t//alert('regex: ' + buildingRegex );\r\n\t\t\t\tmyRe = new RegExp(buildingRegex ,\"g\");\r\n\t\t\t\t//alert('regexed');\r\n\t\t\t\t\r\n\t\t\t\t// to do you need only to find one instance, not all, this is a waste of time\r\n\t\t\t\t\r\n\t\t\t\tfoundLeftSideArraysMatches = [];\r\n\t\t\t\tfoundLeftSideArraysMatches = inputWithoutComments.match(myRe);\r\n\t\t\t\tif (foundLeftSideArraysMatches === null){\r\n\t\t\t\t\t//alert('found no instances of type ' + classesArray[i] );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tfoundLeftSideArraysMatches = foundLeftSideArraysMatches[0];\r\n\t\t\t\tvar foundLeftSideArraysMatchesLength = foundLeftSideArraysMatches.length;\r\n\t\t\t\t\r\n\t\t\t\t//alert('found some instances of type ' + classesArray[i] );\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar foundLeftSideArraysMatchesPlace = inputWithoutComments.search(myRe);\r\n\t\t\t\t\t// take the type out\r\n\t\t\t\t\tfoundLeftSideArraysMatches = foundLeftSideArraysMatches.replace(classesArray[i],' var ').replace(/\\s*\\[\\s*\\]/,' ');\r\n\t\t\t\t\t//alert('replaced with: ' + foundLeftSideArraysMatches);\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tinputWithoutComments = inputWithoutComments.substring(0,foundLeftSideArraysMatchesPlace) + foundLeftSideArraysMatches + inputWithoutComments.substring(foundLeftSideArraysMatchesPlace + foundLeftSideArraysMatchesLength);\r\n\t\t\t\t\r\n\t\t\t\t//alert('program is now: ' + inputWithoutComments);\r\n\t\t\t\t\t\r\n\t\t\t }\r\n\t\t\t }\r\n\t\t\t //alert('outside the loop');\r\n\t\t\t\t\r\n//////////////////////////////////////////////////////////////////////////////////////\r\n//////////////////////////////////////////////////////////////////////////////////////\r\n\r\n\t\t\t // this should replace stuff like\r\n\t\t\t // float mx[] = new float[num], my[] = new float[num];\r\n\t\t\t // into\r\n\t\t\t // float mx[] = new float[num], my = new float[num];\r\n\t\t\t var second_part = \"\\\\,\\\\s*\"+\"[a-zA-Z0-9_]*\"+\"(\\\\s*\"+ lineCommentExp +\"\\\\[\\\\s*\"+lineCommentExp + \"\\\\]\\\\s*)+[\\\\,\\\\=;]\";\r\n\t\t\t var segment_part = '';\r\n\t\t\t var myRe = '';\r\n\t\t\t var foundLeftSideArrays = '';\r\n\t\t\t\t//alert('entering the loop');\r\n\t\t\t\tvar secondPart = '';\r\n\t\t\t\t\t\r\n\t\t\t\tvar processingLintMatches = [];\r\n\t\t\t\tvar positionOfSecondBracket = '';\r\n\t\t\t\tvar foundLeftSideArraysMatches = [];\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t while(true){\r\n\t\t\t\t//alert('inside the loop testing class ');\r\n\t\t\t\t//segment_part = classesArray[i];\r\n\t\t\t\tvar buildingRegex = second_part;\r\n\t\t\t\t//alert('regex: ' + buildingRegex );\r\n\t\t\t\tmyRe = new RegExp(buildingRegex ,\"g\");\r\n\t\t\t\t//alert('regexed');\r\n\t\t\t\t\r\n\t\t\t\t// to do you need only to find one instance, not all, this is a waste of time\r\n\t\t\t\t\r\n\t\t\t\tfoundLeftSideArraysMatches = [];\r\n\t\t\t\tfoundLeftSideArraysMatches = inputWithoutComments.match(myRe);\r\n\t\t\t\tif (foundLeftSideArraysMatches === null){\r\n\t\t\t\t\t//alert('found no instances' );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tfoundLeftSideArraysMatches = foundLeftSideArraysMatches[0];\r\n\t\t\t\tvar foundLeftSideArraysMatchesLength = foundLeftSideArraysMatches.length;\r\n\t\t\t\t\r\n\t\t\t\t//alert('found one instance');\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar foundLeftSideArraysMatchesPlace = inputWithoutComments.search(myRe);\r\n\t\t\t\t\t// take the type out\r\n\t\t\t\t\tfoundLeftSideArraysMatches = foundLeftSideArraysMatches.replace(/\\s*\\[\\s*\\]/,' ');\r\n\t\t\t\t\t//alert('replaced with: ' + foundLeftSideArraysMatches);\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tinputWithoutComments = inputWithoutComments.substring(0,foundLeftSideArraysMatchesPlace ) + foundLeftSideArraysMatches + inputWithoutComments.substring(foundLeftSideArraysMatchesPlace + foundLeftSideArraysMatchesLength);\r\n\t\t\t\t\r\n\t\t\t\t//alert('program is now: ' + inputWithoutComments);\r\n\t\t\t\t\t\r\n\t\t\t }\r\n\t\t\t //alert('outside the loop');\r\n\r\n//////////////////////////////////////////////////////////////////////////////////////\r\n//////////////////////////////////////////////////////////////////////////////////////\r\n\r\n\t\t\t // this should replace stuff like\r\n\t\t\t // var mx[] = new float[num], my[] = new float[num];\r\n\t\t\t // into\r\n\t\t\t // var mx = new float[num], my = new float[num];\r\n\t\t\t var second_part = \"var\\\\s*\"+\"[a-zA-Z0-9_]*\"+\"(\\\\s*\"+ lineCommentExp +\"\\\\[\\\\s*\"+lineCommentExp + \"\\\\]\\\\s*)+[\\\\=;\\\\,]\";\r\n\t\t\t var segment_part = '';\r\n\t\t\t var myRe = '';\r\n\t\t\t var foundLeftSideArrays = '';\r\n\t\t\t\t//alert('entering the loop');\r\n\t\t\t\tvar secondPart = '';\r\n\t\t\t\t\t\r\n\t\t\t\tvar processingLintMatches = [];\r\n\t\t\t\tvar positionOfSecondBracket = '';\r\n\t\t\t\tvar foundLeftSideArraysMatches = [];\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t while(true){\r\n\t\t\t\t//alert('inside the loop testing class ');\r\n\t\t\t\t//segment_part = classesArray[i];\r\n\t\t\t\tvar buildingRegex = second_part;\r\n\t\t\t\t//alert('regex: ' + buildingRegex );\r\n\t\t\t\tmyRe = new RegExp(buildingRegex ,\"g\");\r\n\t\t\t\t//alert('regexed');\r\n\t\t\t\t\r\n\t\t\t\t// to do you need only to find one instance, not all, this is a waste of time\r\n\t\t\t\t\r\n\t\t\t\tfoundLeftSideArraysMatches = [];\r\n\t\t\t\tfoundLeftSideArraysMatches = inputWithoutComments.match(myRe);\r\n\t\t\t\tif (foundLeftSideArraysMatches === null){\r\n\t\t\t\t\t//alert('found no instances' );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tfoundLeftSideArraysMatches = foundLeftSideArraysMatches[0];\r\n\t\t\t\tvar foundLeftSideArraysMatchesLength = foundLeftSideArraysMatches.length;\r\n\t\t\t\t\r\n\t\t\t\t//alert('found one instance');\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar foundLeftSideArraysMatchesPlace = inputWithoutComments.search(myRe);\r\n\t\t\t\t\t// take the type out\r\n\t\t\t\t\tfoundLeftSideArraysMatches = foundLeftSideArraysMatches.replace(/\\s*\\[\\s*\\]/,' ');\r\n\t\t\t\t\t//alert('replaced with: ' + foundLeftSideArraysMatches);\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tinputWithoutComments = inputWithoutComments.substring(0,foundLeftSideArraysMatchesPlace ) + foundLeftSideArraysMatches + inputWithoutComments.substring(foundLeftSideArraysMatchesPlace + foundLeftSideArraysMatchesLength);\r\n\t\t\t\t\r\n\t\t\t\t//alert('program is now: ' + inputWithoutComments);\r\n\t\t\t\t\t\r\n\t\t\t }\r\n\t\t\t //alert('outside the loop');\r\n\r\n\t\t\t \r\n\t\t\t\toutput.innerHTML += inputWithoutComments.replace( /\\n/g, '<br />\\n' );\r\n\t\t\t\treturn inputWithoutComments;\r\n\r\n\t\t}", "function handleBlock(startArr, startOffsetM, startOffsetNextM, destArr, destOffsetM, destOffsetNextM, undefined){\n\n // slice out the block we need\n var startArrTemp = startArr.slice(startOffsetM, startOffsetNextM || undefined)\n , destArrTemp = destArr.slice( destOffsetM, destOffsetNextM || undefined);\n\n var i = 0\n , posStart = {pos:[0,0], start:[0,0]}\n , posDest = {pos:[0,0], start:[0,0]};\n\n do{\n\n // convert shorthand types to long form\n startArrTemp[i] = simplyfy.call(posStart, startArrTemp[i]);\n destArrTemp[i] = simplyfy.call(posDest , destArrTemp[i]);\n\n // check if both shape types match\n // 2 elliptical arc curve commands ('A'), are considered different if the\n // flags (large-arc-flag, sweep-flag) don't match\n if(startArrTemp[i][0] != destArrTemp[i][0] || startArrTemp[i][0] == 'M' ||\n (startArrTemp[i][0] == 'A' &&\n (startArrTemp[i][4] != destArrTemp[i][4] || startArrTemp[i][5] != destArrTemp[i][5])\n )\n ) {\n\n // if not, convert shapes to beziere\n Array.prototype.splice.apply(startArrTemp, [i, 1].concat(toBeziere.call(posStart, startArrTemp[i])));\n Array.prototype.splice.apply(destArrTemp, [i, 1].concat(toBeziere.call(posDest, destArrTemp[i])));\n\n } else {\n\n // only update positions otherwise\n startArrTemp[i] = setPosAndReflection.call(posStart, startArrTemp[i]);\n destArrTemp[i] = setPosAndReflection.call(posDest , destArrTemp[i]);\n\n }\n\n // we are at the end at both arrays. stop here\n if(++i == startArrTemp.length && i == destArrTemp.length) break\n\n // destArray is longer. Add one element\n if(i == startArrTemp.length){\n startArrTemp.push([\n 'C',\n posStart.pos[0],\n posStart.pos[1],\n posStart.pos[0],\n posStart.pos[1],\n posStart.pos[0],\n posStart.pos[1],\n ]);\n }\n\n // startArr is longer. Add one element\n if(i == destArrTemp.length){\n destArrTemp.push([\n 'C',\n posDest.pos[0],\n posDest.pos[1],\n posDest.pos[0],\n posDest.pos[1],\n posDest.pos[0],\n posDest.pos[1]\n ]);\n }\n\n\n }while(true)\n\n // return the updated block\n return {start:startArrTemp, dest:destArrTemp}\n}", "function relooper() {\n function makeBlock(labels, entries, labelsDict, forceEmulated) {\n if (labels.length == 0) return null;\n dprint('relooping', 'prelooping: ' + entries + ',' + labels.length + ' labels');\n assert(entries && entries[0]); // need at least 1 entry\n\n var emulated = {\n type: 'emulated',\n id: 'B',\n labels: labels,\n entries: entries.slice(0)\n };\n return emulated;\n }\n item.functions.forEach(function(func) {\n dprint('relooping', \"// relooping function: \" + func.ident);\n func.block = makeBlock(func.labels, [func.labels[0].ident], func.labelsDict, func.forceEmulated);\n });\n }", "function setDataOfArray(array, data_type, data) {\n\tfor (let i=0; i < array.length; i++) {\n\t\tarray[i][data_type] = data;\n\t}\n}", "compileDataAssignment(opts) {\nopts.srcInfo = this.compileSourceExpression(opts);\nopts.destInfo = this._varExpression.compileExpressionToRegister({\nidentifier: opts.destIdentifier,\nexpression: opts.destExpression,\nreg: $.REG_PTR,\nforWriting: true\n});\nopts.srcVrOrType = opts.srcInfo.type;\nopts.destVrOrType = opts.destInfo.type;\nthis\n.validateRecords(opts)\n.validateTypes(opts)\n.validateDataSize(opts);\nlet copySize = 0;\nlet type = helper.getTypeFromIdentifier(opts.srcVrOrType);\nif (opts.srcVrOrType.getPointer && (opts.srcVrOrType.getPointer() || opts.srcVrOrType.getType().typePointer) &&\nopts.destVrOrType.getPointer && (opts.destVrOrType.getPointer() || opts.destVrOrType.getType().typePointer)) {\nthis._program.addCommand($.CMD_SET, $.T_NUM_P, 0, $.T_NUM_L, this._scope.getStackOffset());\n} else if (opts.address) {\n// Check if it's a data type like: number ^a[10]\nif (opts.destInfo.type && opts.destInfo.type.getPointer && !opts.destInfo.type.getPointer()) {\n// Check if it's a data type like: ^SomeObject a\nif (!opts.destInfo.type.getType().typePointer) {\nthrow errors.createError(err.POINTER_TYPE_EXPECTED, opts.destInfo.type.getToken(), 'Pointer type expected.');\n}\n}\nthis.compileAddressPointerAssignment(opts);\n} else if (type === t.LEXEME_STRING) {\nthis.compileStringAssignment(opts);\n} else if (type === t.LEXEME_PROC) {\nopts.srcIdentifier = this._scope.findIdentifier(opts.srcExpression.tokens[0].lexeme);\nthis.validateProcAssignment(opts);\ncopySize = this.compileNumberAssignment(opts);\n} else if (type === t.LEXEME_NUMBER) {\ncopySize = this.compileNumberAssignment(opts);\n} else {\ncopySize = opts.srcVrOrType.getTotalSize();\n}\nif (copySize) {\nthis._program.addCommand(\n$.CMD_SET, $.T_NUM_G, $.REG_DEST, $.T_NUM_G, $.REG_PTR,\n$.CMD_SET, $.T_NUM_G, $.REG_SRC, $.T_NUM_L, this._scope.getStackOffset(),\n$.CMD_COPY, 0, 0, $.T_NUM_C, copySize\n);\n}\n}", "replace( t, old_type, new_type ) {\n if(t.type==old_type) t.type = new_type\n if( Array.isArray(t.value) ) {\n var a = t.value\n for(var i=0; i<a.length; i++) a[i] = this.replace(a[i], old_type, new_type)\n } \n return t\n }", "function _restructureInfoList(infoList, dataType){\n\t\t\tvar templateClass,\n\t\t\t\tresInfoList = new Array(),\n\t\t\t\tgetValHandle;\n\t\t\tswitch(dataType){\n\t\t\tcase WOE_Setting._WOEColumnType.numeric:\n\t\t\t\ttemplateClass = WOE_Setting._WOENumericNode;\n\t\t\t\tgetValHandle = function(item, attr){\n\t\t\t\t\treturn WOE_Operator.getValueFromGrid(item[attr]);//alpine.flow.WorkFlowVariableReplacer.replaceVariable(WOE_Operator.getValueFromGrid(item[attr]));\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tcase WOE_Setting._WOEColumnType.text:\n\t\t\t\ttemplateClass = WOE_Setting._WOENominalNode;\n\t\t\t\tgetValHandle = function(item, attr){\n\t\t\t\t\tif(attr == WOE_Setting._WOENominalNode.optionalVal){// check if optional values then just return it. Because it already a Array\n\t\t\t\t\t\treturn item[attr];\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn WOE_Operator.getValueFromGrid(item[attr]);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tfor(var i = 0;i < infoList.length;i++){\n\t\t\t\tvar info = infoList[i],\n\t\t\t\t\tresInfo = {};\n\t\t\t\tfor(var fieldNameItem in templateClass){\n\t\t\t\t\tvar fieldName = templateClass[fieldNameItem];\n\t\t\t\t\tresInfo[fieldName] = getValHandle(info, fieldName);\n\t\t\t\t}\n\t\t\t\tresInfoList.push(resInfo);\n\t\t\t}\n\t\t\treturn resInfoList;\n\t\t}", "function processData(data){\n for (var i=0; i<data.objects.length; i++){\n var link = $('<a href=\"#'+data.objects[i].name+'\"></a>');\n var img = $('<img src=\"http://toloshny.com/pokeimg/'+getNormalizedNumber(data.objects[i].pkdx_id)+'.png\" class=\"pokepic\">');\n var poceblock = $('<div class=\"col-sm-4 col-xs-12 col-md-3 pokenames text-center\"></div>');\n var poceblocktext = $('<br><span class=\"poke-name\">'+data.objects[i].name+'</span><br><span class=\"types\">'+getPoceTypesWithStyling(data.objects[i])+'</span>');\n pokeAll.objects.push(data.objects[i]);\n //console.log(pokeAll);\n var type1 = data.objects[i].types[0].name;\n var type2=\"\";\n if (typeof data.objects[i].types[1] !== 'undefined') {\n // the variable is defined\n var type2 = data.objects[i].types[1].name;\n }\n\n // Now that's what i call monkey-code. But it's the best solution i've got. \n // Basicly it's filling filter-objects with data asssosiated with those pokemon types.\n // I know i know, 2x memory (or even more, object itself consumes memory) just for the filters. \n fillFilterObjects(type1, data.objects[i]);\n fillFilterObjects(type2, data.objects[i]);\n\n link.append(img); \n link.click((function(e){\n var poceObject = data.objects[i];\n // console.log(pokeFire);\n return function() {\n var img = '<img src=\"http://toloshny.com/pokeimg/'+getNormalizedNumber(poceObject.pkdx_id)+'.png\" class=\"poce-details-image\">';\n var pokedetails = $('<div class=\"\">'+img+'<br><span class=\"bold align-left\">'+poceObject.name+' </span><span class=\"bold align-right\">#'+getNormalizedNumber(poceObject.pkdx_id)+'</span><div class=\"clearifx\"><br><span class=\"align-left\">Type:</span><span class=\"align-right\">'+getPoceTypes(poceObject)+\n '</span><br><span class=\"align-left\">Attack: </span><span class=\"align-right\">'+poceObject.attack+'</span><div class=\"clearifx\"><br><span class=\"align-left\">Defence:</span><span class=\"align-right\">'+poceObject.defense+'</span><div class=\"clearifx\"><br><span class=\"align-left\">Health: </span><span class=\"align-right\">'+poceObject.hp+'</span><br><div class=\"clearfix\"></div><span class=\"align-left\">SP Attack:</span><span class=\"align-right\">'+poceObject.sp_atk+'</span><br><div class=\"clearfix\"></div><span class=\"align-left\">SP Defense:</span> <span class=\"align-right\">'+poceObject.sp_def+'</span><br><div class=\"clearifx\"></div><span class=\"align-left\">Speed: </span><span class=\"align-right\">'+poceObject.speed+'</span><br><div class=\"clearfix\"></div><span class=\"align-left\">Weight:</span> <span class=\"align-right\">'+poceObject.weight+'</span><br><div class=\"clearfix\"></div><span class=\"align-left\">Total moves:</span> <span class=\"align-right\">'+poceObject.moves.length+'</span><br><div class=\"clearfix\"></div></div>');\n $('.pokedetails').hide().html(pokedetails).addClass('pokedetails-border').fadeIn(300);\n return false;\n }\n })());\n\n poceblock.append(link);\n poceblock.append(poceblocktext);\n poceElement.append(poceblock.hide().fadeIn(100));\n\n $('.loadmore-btn').fadeIn(400);\n }\n}", "variableStorage(data, varType) {\n const type = parseInt(data.storage, 10);\n if (type !== varType) return;\n return [data.varName2, \"Text\"];\n }", "function renderBlocks(saveData,target){\n\t\t/**\n\t\t*init variables and reuse typeString later\n\t\t*/\t\n\t\tvar blockTypes = ['g_block_c2','g_block_c3','g_block_c4','g_block_c5','g_block_c6','g_block_c7','g_block_c8','g_block_c9','g_block_c12'];\n\t\n\t\t//var blockBox= $(\"#g_page \"+target+\" div.\"+blockTypes.join(\",#g_page div.\")),l,typeIs,i,ref,type,arrtest,assign=tdc.Grd.Templates.getByID('blockBox');\n\t\t\n\t\t// We use the following line until all block markup have been \"wrapped\"\n\t\tvar blockBox= $(\"#g_page \"+target+\" .g_block_content.\"+blockTypes.join(\",#g_page .g_block_content.\")),l,typeIs,i,ref,type,arrtest,assign=tdc.Grd.Templates.getByID('blockBox');\n\t\tvar data;\n\t\n\t\tif(blockBox.length){\n\t\t\tvar blength=blockBox.length;\n\t\n\t\t\tfor (i=0;i<blength; i++) {\n\t\t\t\tref=$(blockBox[i]);\n\t\t\t\tarrtest=ref.attr('class').split(' ');\n\t\t\t\tl = arrtest.length;\n\t\t\t\tfor (var j=0;j<l; j++) {\n\t\t\t\t\ttypeIs = blockTypes.indexOf(arrtest[j]);\n\t\t\t\t\tif(typeIs!=-1){\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t*if data is needed AGAIN\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tif(saveData){\n\t\t\t\t\t\t\t$(this).data('blockType',blockTypes[typeIs]);\n\t\t\t\t\t\t}\n\t\t\n\t\t\t\t\t\tvar blockType=blockTypes[typeIs];\n\t\t\t\t\t\t\n\t\t\t\t\t\tdata = { //data object used in template rendering engine\n\t\t\t\t\t\t\ttype:blockType, //set type\n\t\t\t\t\t\t\tref:ref.removeClass(blockType).outerHTML() //cleanup the markup the class on the ref is not needed longer\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tref.fasterReplace($.renderTemplate(assign,data));\n\t\t\t\t//ref.replaceWith($.renderTemplate(assign,data)); this is alot slower, the new Custom function is 20-30% faster\n\t\t\t}\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n code.push(\"var \" + vars.join(\",\"))\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function buildStatBlock() {\n\n //try gathering data\n try {\n\n //reset stat block object\n statBlock = {};\n\n //Step 1\n\n //base array\n var CRDrop = $('[data-id=\"CRDrop\"]').text().trim().replace(\"CR \",\"\");\n var arrayDrop = $('[data-id=\"arrayDrop\"]').text().trim();\n\n statBlock.Cr = CRDrop;\n statBlock.Base = arrayDrop;\n //monster XP\n statBlock.Xp = xp[CRDrop];\n\n var baseStats = [];\n if (arrayDrop == 'Combatant') {\n baseStats = combatantMainStats[CRDrop].concat(combatantAttackStats[CRDrop]);\n } else if (arrayDrop == 'Expert') {\n baseStats = expertMainStats[CRDrop].concat(expertAttackStats[CRDrop]);\n } else if (arrayDrop == 'Spellcaster') {\n baseStats = spellcasterMainStats[CRDrop].concat(spellcasterAttackStats[CRDrop]);\n }\n\n //assign base stat values\n for (i = 0; i < statLabels.length; i++) {\n statBlock[statLabels[i]] = baseStats[i]\n }\n\n // step 2 - creature type\n\n var creatureTypeDrop = $('[data-id=\"creatureTypeDrop\"]').text().trim();\n\n statBlock.CreatureType = creatureTypeDrop;\n statBlock.CreatureAdjustments = creatureType[creatureTypeDrop].Adjustments;\n\n\n //Senses\n if (creatureType[creatureTypeDrop].hasOwnProperty(\"Senses\")){\n statBlock[\"Senses\"] = creatureType[creatureTypeDrop].Senses;\n }\n\n //otherAbilities\n if (creatureType[creatureTypeDrop].hasOwnProperty(\"OtherAbilities\")){\n statBlock[\"OtherAbilities\"] = creatureType[creatureTypeDrop].OtherAbilities;\n }\n\n //Immunities\n if (creatureType[creatureTypeDrop].hasOwnProperty(\"Immunities\")){\n statBlock[\"Immunities\"] = creatureType[creatureTypeDrop].Immunities;\n }\n\n //Options - only applies to construct and animal - so far\n if ($('[data-id=\"optionDrop\"]').length){\n if (creatureTypeDrop == \"Animal\"){\n statBlock.int = -Number($('[data-id=\"optionDrop\"]').text().trim().replace('Set intelligence -',''));\n } else if (creatureTypeDrop == \"Construct\") {\n if (!$('[data-id=\"optionDrop\"]').text().trim().includes(\"Not\")){\n statBlock.int = '-';\n statBlock.OtherAbilities = statBlock.OtherAbilities.concat([\"Mindless\"]);\n }\n } else {console.log(\"option error\")}\n }\n\n //step 3 - subtype\n var subTypeDrop = $('#creatureSubTypeDrop').val().trim()\n\n //if option is selected\n if (subTypeDrop != '' && subTypeDrop != 'None'){\n\n statBlock.SubType = subTypeDrop;\n\n if (creatureSubType[subTypeDrop].hasOwnProperty(\"SubRaces\")){\n var subRaceDrop = $('#stepThreeOptionDrop').val().trim();\n var subTypeObject = creatureSubType[subTypeDrop].SubRaces[subRaceDrop];\n } else {\n var subTypeObject = creatureSubType[subTypeDrop];\n }\n\n for (trait in subTypeObject) {\n\n if (trait != \"Description\" && trait != \"Options\"){\n var traitArray = subTypeObject[trait];\n if (statBlock.hasOwnProperty(trait)){\n statBlock[trait] = statBlock[trait].concat(traitArray);\n } else {\n statBlock[trait] = traitArray;\n }\n\n } else if (trait == \"Options\") {\n var optionDrop = $('#stepThreeOptionDrop').val().trim();\n optionTrait = subTypeObject.Options[0]\n\n if(!optionDrop.includes(\"Not\")){\n if (statBlock.hasOwnProperty(optionTrait)){\n statBlock[optionTrait] = statBlock[optionTrait].concat([optionDrop]);\n } else {\n statBlock[optionTrait] = [optionDrop];\n }\n }\n }\n }\n }\n\n //step 4 -class\n\n //get base stats\n statBlock = getClassStats(statBlock);\n\n //more specific stats\n var classDrop = $('#classDrop').val().trim();\n\n //SOLARIAN SPECIAL RULES\n if (classDrop == 'Solarian') {\n var solarDrop = $('#stepFourOptionDrop').val().trim();\n if (solarDrop == \"Solar armor\") {\n statBlock.eac = statBlock.eac + 1;\n statBlock.kac = statBlock.kac + 1;\n\n var resist = classData.Solarian.Resistance[CRDrop]\n if (resist != '') {\n if (statBlock.hasOwnProperty('Resistance')){\n statBlock.Resistance = statBlock.Resistance.concat(['cold or fire ' + resist + ' (solar armor)']);\n }\n else {\n statBlock.Resistance = ['cold or fire ' + resist + ' (solar armor)'];\n }\n }\n }\n\n var solarCr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n var solarianFeatures = getClassAbilities('Solarian',solarCr);\n var featurelist = solarianFeatures.features;\n\n featurelist = removeElement(featurelist,'solar manifestation');\n featurelist = removeElement(featurelist,'stellar alignment');\n featurelist = removeElement(featurelist,'black hole');\n featurelist = removeElement(featurelist,'supernova');\n\n //add default revelations\n var revelations = ['Black Hole','Supernova'];\n\n if (solarianFeatures.hasOwnProperty('revelations')){\n //do revelations\n var revs = $('#stepFourOptionDropTwo').val().toString().trim();\n if (revs.includes(',')){\n revelations = revelations.concat(revs.split(','))\n } else {\n revelations = revelations.concat([revs])\n }\n revelations.sort();\n }\n\n var otherRevs = [];\n var defenseRevs = [];\n var offenseRevs = [];\n\n //find revelation in data\n classObject = allClassFeatures['Solarian'][\"Stellar Revelations\"];\n var revLevels = Object.keys(classObject)\n //for every revelation\n for (var i = 0; i < revelations.length; i++) {\n\n //search through every title until found\n for (var j = 0; j < revLevels.length; j++) {\n //find the revelation in the data\n if (allClassFeatures['Solarian'][\"Stellar Revelations\"][revLevels[j]].hasOwnProperty(revelations[i]) || ['Black Hole','Supernova'].includes(revelations[i])) {\n\n if (['Black Hole','Supernova'].includes(revelations[i])){\n var currentRev = allClassFeatures['Solarian'][\"Class features\"][(revelations[i])];\n } else {\n var currentRev = allClassFeatures['Solarian'][\"Stellar Revelations\"][revLevels[j]][(revelations[i])];\n }\n\n if (currentRev.hasOwnProperty('entry')) {\n var entries = Object.keys(currentRev.entry);\n\n var currentRevString = currentRev.entry.layout;\n currentRevString = currentRevString.replace('DC' , 'DC ' + statBlock.abilityDCBase.toString());\n\n for (var k = 0; k < entries.length; k++) {\n if (entries[k] != 'layout') {\n\n if (currentRev.entry[entries[k]].hasOwnProperty('PERCR')){\n //per cr entries\n var valNum = currentRev.entry[entries[k]]['base'] + (currentRev.entry[entries[k]]['PERCR'] * solarCr);\n } else {\n\n table = currentRev.entry[entries[k]]['CR']\n var choice = 'none'\n for (l = 0; l < table.length; l++) {\n if (solarCr >= table[l]) {\n choice = l;\n }\n }\n if (choice == 'none') {\n var valNum = currentRev.entry[entries[k]]['base'];\n } else {\n var valNum = currentRev.entry[entries[k]]['base'] + currentRev.entry[entries[k]]['VAL'][choice];\n }\n\n }\n\n currentRevString = currentRevString.replace(entries[k],valNum.toString())\n\n }\n }\n } else {\n var currentRevString = revelations[i].toLowerCase()\n }\n\n if (currentRev.type == 'offense'){\n offenseRevs = offenseRevs.concat([currentRevString]);\n } else if (currentRev.type == 'defense'){\n defenseRevs = defenseRevs.concat([currentRevString]);\n } else if (currentRev.type == 'other'){\n otherRevs = otherRevs.concat([currentRevString]);\n } else {\n console.log('ERROR ERROR')\n }\n\n break;\n }\n }\n }\n\n statBlock.ClassOtherAbilities = ['solar manifestation (' + solarDrop.toLowerCase() + ')','stellar alignment'];\n if (featurelist.includes('stellar apotheosis')) {\n featurelist = removeElement(featurelist,'stellar apotheosis');\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(['stellar apotheosis'])\n }\n\n //add to ability lists\n statBlock.ClassOffensiveAbilities = featurelist;\n if (offenseRevs.length > 0) {\n statBlock.ClassOffensiveAbilities = statBlock.ClassOffensiveAbilities.concat(['stellar revelations (' + offenseRevs.join(', ') + ')'])\n }\n if (defenseRevs.length > 0) {\n statBlock.ClassDefensiveAbilities = ['stellar revelations (' + defenseRevs.join(', ') + ')']\n }\n if (otherRevs.length > 0) {\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(['stellar revelations (' + otherRevs.join(', ') + ')'])\n }\n\n }\n\n //SOLDIER SPECIAL RULES AND PRINT ABILITIES\n if (classDrop == 'Soldier') {\n\n var classFeatures = [];\n\n var soldierCr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n var soldierFeatures = getClassAbilities('Soldier',soldierCr);\n\n var style = $('#stepFourOptionDropTwo').val().trim();\n var styleList = soldierFeatures[\"Fighting style\"][\"first\"];\n\n statBlock.ClassOffensiveAbilities = resolveClassAbilities('FightingStyle',soldierCr,statBlock.abilityDCBase,styleList,style);\n\n var secondStyle = '';\n var styleListTwo = [];\n\n if ($('[data-id=\"stepFourOptionDropThree\"]').length){\n var styleTwo = $('#stepFourOptionDropThree').val().trim()\n secondStyle = ', ' + styleTwo;\n styleListTwo = soldierFeatures[\"Fighting style\"][\"second\"];\n\n statBlock.ClassOffensiveAbilities = statBlock.ClassOffensiveAbilities.concat(resolveClassAbilities('FightingStyle',soldierCr,statBlock.abilityDCBase,styleListTwo,styleTwo));\n }\n\n style = 'fighting styles (' + style.toLowerCase() + secondStyle.toLowerCase() + ')';\n\n statBlock.ClassOffensiveAbilities = statBlock.ClassOffensiveAbilities.concat([style]);\n //Gear boosts\n\n if ($('[data-id=\"stepFourOptionDropFour\"]').length){\n var boosts = $('#stepFourOptionDropFour').val().toString().trim()\n if (boosts.includes(',')){\n var boostList = boosts.split(',')\n } else {\n var boostList = [boosts];\n }\n statBlock.ClassOffensiveAbilities = statBlock.ClassOffensiveAbilities.concat(resolveClassAbilities('GearBoost',soldierCr,statBlock.abilityDCBase,boostList,''));\n\n }\n\n if (soldierFeatures.hasOwnProperty(\"features\")) {\n var features = soldierFeatures.features;\n for (var i = 0; i < features.length; i++) {\n features[i] = features[i].toLowerCase();\n }\n\n statBlock.ClassOffensiveAbilities = statBlock.ClassOffensiveAbilities.concat(features);\n }\n\n statBlock.ClassOffensiveAbilities.sort();\n }\n //MYSTIC SPECIAL RULES AND PRINT ABILITIES\n if (classDrop == 'Mystic') {\n\n var mysticCr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n var mysticFeatures = getClassAbilities('Mystic',mysticCr);\n\n var connection = $('#stepFourOptionDrop').val().trim();\n var connectionList = mysticFeatures[\"connection\"];\n\n statBlock.ClassOtherAbilities = resolveClassAbilities('Connections',mysticCr,statBlock.abilityDCBase,connectionList,connection);\n\n if (mysticFeatures.hasOwnProperty(\"features\")) {\n var featureList = mysticFeatures[\"features\"];\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(resolveClassAbilities('MysticFeatures',mysticCr,statBlock.abilityDCBase,featureList,''));\n }\n\n statBlock.ClassOtherAbilities.sort();\n }\n //TECHNOMANCER SPECIAL RULES AND PRINT ABILITIES\n if (classDrop == 'Technomancer') {\n var technoCr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n var technoFeatures = getClassAbilities('Technomancer',technoCr);\n\n statBlock.ClassOffensiveAbilities = []\n\n if ($('[data-id=\"stepFourOptionDrop\"]').length){\n var spellHack = $('#stepFourOptionDrop').val().toString().trim();\n if (spellHack != '') {\n if (spellHack.includes(',')) {\n var hackList = spellHack.split(',');\n } else {\n var hackList = [spellHack];\n }\n resolvedHacks = resolveClassAbilities('MagicHack',technoCr,statBlock.abilityDCBase,hackList,'');\n statBlock.ClassOffensiveAbilities = statBlock.ClassOffensiveAbilities.concat(['magic hacks (' + resolvedHacks.join(', ') + ')']);\n }\n }\n\n\n var featureList = technoFeatures[\"features\"];\n statBlock.ClassOffensiveAbilities = statBlock.ClassOffensiveAbilities.concat(resolveClassAbilities('TechnomancerFeatures',technoCr,statBlock.abilityDCBase,featureList,''));\n\n statBlock.ClassOffensiveAbilities.sort();\n\n }\n //OPERATIVE SPECIAL RULES AND PRINT ABILITIES\n if (classDrop == 'Operative') {\n\n var operativeCr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n var operativeFeatures = getClassAbilities('Operative',operativeCr);\n\n var special = $('#stepFourOptionDrop').val().trim();\n\n var featureList = operativeFeatures[\"features\"];\n statBlock.ClassOtherAbilities = [];\n\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(['specialization (' + special.toLowerCase() + ')']);\n\n var exploits = []\n\n if ($('[data-id=\"stepFourOptionDropTwo\"]').length){\n var exploitsString = $('#stepFourOptionDropTwo').val().toString().trim();\n if (exploitsString != '') {\n if (exploitsString.includes(',')) {\n exploits = exploitsString.split(',');\n } else {\n exploits = [exploitsString];\n }\n }\n if (featureList.includes(\"Specialization Exploit\")){\n exploits.push(allClassFeatures.Operative[\"Operative Specializations\"][special][\"Specialization Exploit\"])\n }\n resolvedExploits = resolveClassAbilities('Exploits',operativeCr,statBlock.abilityDCBase,exploits,'');\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(['operative exploits (' + resolvedExploits.join(', ') + ')']);\n\n }\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(resolveClassAbilities('OperativeFeatures',operativeCr,statBlock.abilityDCBase,featureList,''));\n\n if (featureList.includes(\"Specialization Power\")){\n statBlock.ClassOtherAbilities.push(allClassFeatures.Operative[\"Operative Specializations\"][special][\"Specialization Power\"][\"name\"].toLowerCase())\n }\n\n statBlock.ClassOtherAbilities.sort();\n\n }\n //MECHANIC SPECIAL RULES AND PRINT ABILITIES\n if (classDrop == 'Mechanic') {\n\n var mechaCr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n var mechaFeatures = getClassAbilities('Mechanic',mechaCr);\n\n var ai = $('#artificialDrop').val().trim().toLowerCase();\n\n statBlock.ClassOtherAbilities = [];\n\n if ($('[data-id=\"stepFourOptionDropTwo\"]').length){\n var tricks = $('#stepFourOptionDropTwo').val().toString().trim();\n if (tricks != '') {\n if (tricks.includes(',')) {\n var trickList = tricks.split(',');\n } else {\n var trickList = [tricks];\n }\n resolvedTricks = resolveClassAbilities('Tricks',mechaCr,statBlock.abilityDCBase,trickList,'');\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(['mechanic tricks (' + resolvedTricks.join(', ') + ')']);\n }\n }\n\n\n var featureList = mechaFeatures[\"features\"];\n\n featureList = removeElement(featureList,\"Artificial intelligence\");\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat([\"artificial intelligence (\" + ai + \")\"]);\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(resolveClassAbilities('MechanicFeatures',mechaCr,statBlock.abilityDCBase,featureList,''));\n\n if (ai == 'exocortex') {\n var exocortexFeatures = mechaFeatures[\"exocortex\"];\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(resolveClassAbilities('Exocortex',mechaCr,statBlock.abilityDCBase,exocortexFeatures,''));\n }\n\n statBlock.ClassOtherAbilities.sort();\n\n }\n //ENVOY SPECIAL RULES AND PRINT ABILITIES\n if (classDrop == 'Envoy') {\n\n var envoyCr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n var envoyFeatures = getClassAbilities('Envoy',envoyCr);\n\n statBlock.ClassOtherAbilities = []\n\n if ($('[data-id=\"stepFourOptionDropTwo\"]').length){\n var envoyImprov = $('#stepFourOptionDropTwo').val().toString().trim();\n if (envoyImprov != '') {\n if (envoyImprov.includes(',')) {\n var improvisations = envoyImprov.split(',');\n } else {\n var improvisations = [envoyImprov];\n }\n resolvedImprovisations = resolveClassAbilities('Improvisations',envoyCr,statBlock.abilityDCBase,improvisations,'');\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(['envoy improvisations (' + resolvedImprovisations.join(', ') + ')']);\n }\n }\n if (envoyFeatures.hasOwnProperty(\"features\")) {\n statBlock.ClassOtherAbilities = statBlock.ClassOtherAbilities.concat(envoyFeatures.features);\n }\n\n statBlock.ClassOtherAbilities.sort();\n\n }\n\n\n //step 5 - graft\n var graft = $('#graftDrop').val().trim();\n\n //iterate through selected graft traits\n if (graft != '' && graft != 'None') {\n\n statBlock.Graft = graft;\n\n for (var graftType in graftTemplates){\n //iterate traits in all graft types. eg . dragons, simple\n if (graftTemplates[graftType].hasOwnProperty(graft)) {\n\n for (trait in graftTemplates[graftType][graft]) {\n\n if (trait != \"Description\"){//skip descriptions\n var traitArray = graftTemplates[graftType][graft][trait];\n //check if trait is array or object, handle each differently\n if (statBlock.hasOwnProperty(trait)){\n if (Array.isArray(traitArray)){\n //handle array\n statBlock[trait] = statBlock[trait].concat(traitArray);\n } else {\n //handle object\n statBlock[trait] = $.extend({}, statBlock[trait], traitArray);\n }\n } else {\n //if trait does not already exist, create and assign value\n statBlock[trait] = traitArray;\n }\n }\n }\n }\n\n }\n }\n //step 6 - special Abilities\n\n //from grafts\n var graftOther = getGraftAbilities(\"Other\");\n if (graftOther.length > 0) {\n statBlock.OtherAbilitiesGraft = graftOther;\n }\n\n var graftSpecial = getGraftAbilities(\"Special\");\n if (graftSpecial.length > 0) {\n statBlock.SpecialAbilitiesGraft = graftSpecial;\n }\n\n //speeds\n //burrow\n if ($('#inputBurrow').length != 0){\n var burrow = 'burrow ' + $('#inputBurrow').val().trim() + ' ft.';\n\n if (statBlock.hasOwnProperty('Speed')){\n if (!statBlock.Speed.join(',').includes('burrow')){\n statBlock.Speed.push(burrow);\n }\n } else {\n statBlock.Speed = [burrow];\n }\n }\n //climb\n if ($('#inputClimb').length != 0){\n var climb = 'climb ' + $('#inputClimb').val().trim() + ' ft.';\n\n if (statBlock.hasOwnProperty('Speed')){\n if (!statBlock.Speed.join(',').includes('climb')){\n statBlock.Speed.push(climb);\n }\n } else {\n statBlock.Speed = [climb];\n }\n }\n //fly\n if ($('#inputFly').length != 0){\n var fly = 'fly ' + $('#inputFly').val().trim() + ' ft. (' + $('#flyInputDrop').val().trim() + ')';\n\n if (statBlock.hasOwnProperty('Speed')){\n if (!statBlock.Speed.join(',').includes('fly')){\n statBlock.Speed.push(fly);\n }\n } else {\n statBlock.Speed = [fly];\n }\n }\n //swim\n if ($('#inputSwim').length != 0){\n var swim = 'swim ' + $('#inputSwim').val().trim() + ' ft.';\n\n if (statBlock.hasOwnProperty('Speed')){\n if (!statBlock.Speed.join(',').includes('swim')){\n statBlock.Speed.push(swim);\n }\n } else {\n statBlock.Speed = [swim];\n }\n }\n\n //weaknesses if any\n if ($('#inputWeakness').length != 0){\n statBlock.weaknessAbilities = $('#inputWeakness').val().trim();\n }\n\n //vulnerabilities if any\n if ($('#inputVulnerability').length != 0){\n var stats = $('#inputVulnerability').val().trim();\n if (stats != '') {\n if (stats.includes(',')){\n var vulners = stats.split(',')\n } else {\n var vulners = [stats];\n }\n\n if (statBlock.hasOwnProperty('Vulnerable')){\n statBlock.Vulnerable = statBlock.Vulnerable.concat(vulners);\n }\n else {\n statBlock.Vulnerable = vulners;\n }\n }\n }\n\n //dependencies if any\n if ($('#inputDependency').length != 0){\n var depends = $('#inputDependency').val().trim();\n if (stats != '') {\n if (depends.includes(',')){\n statBlock.Dependencies = depends.split(',')\n } else {\n statBlock.Dependencies = [depends];\n }\n }\n }\n\n //special abilities selected if any\n var specialList = $('#specialDrop').val().toString().trim();\n if(specialList != ''){\n if (specialList.includes(',')){\n var subArray = specialList.split(',');\n } else {\n var subArray = [specialList];\n }\n //Split adjustments and abilities\n var subArrayAdjustment = [];\n var subArrayAbility = [];\n\n for (var i = 0; i < subArray.length; i++) {\n if (specialAbilities.Abilities.hasOwnProperty(subArray[i])){\n subArrayAbility.push(subArray[i]);\n } else if (specialAbilities.AdjustmentAbilities.hasOwnProperty(subArray[i])){\n subArrayAdjustment.push(subArray[i]);\n }\n }\n\n if (subArrayAdjustment.length > 0){\n statBlock.AdjustmentAbilitiesDescription = subArrayAdjustment;\n }\n if (subArrayAbility.length > 0){\n statBlock.SpecialAbilitiesDescription = subArrayAbility;\n }\n\n }\n\n //free abilities selected if any\n var freeList = $('#freeDrop').val().toString().trim();\n if(freeList != ''){\n if (freeList.includes(',')){\n var subArray = freeList.split(',');\n } else {\n var subArray = [freeList];\n }\n statBlock.FreeAbilities = subArray\n }\n\n //step 8 - skills and Modifiers\n\n //overwrite master+ good skills with selected + graft skills\n statBlock.MainAbilityScores = $(\".stepSevenAbilityDescription\").first().text().replace('Main ability scores: (','').replace(')','').split(',')\n statBlock.MasterSkills = $(\".stepSevenMasterDescription\").first().text().replace('Master skills: ','').replace(/\\*/g,'').split(',');\n statBlock.GoodSkills = $(\".stepSevenGoodDescription\").first().text().replace('Good skills: ','').replace(/\\*/g,'').split(',');\n\n //Step 8 - gear\n\n var gearTabDescription = $(\".stepEightGearDescription\").first().text().replace('Gear: ','');\n if (gearTabDescription != '') {\n statBlock.gear = gearTabDescription;\n }\n\n //step 9 - attacks\n statBlock.attackFocus = $(\"#attackDrop\").val().trim();\n\n //step 10 - spells\n\n //TODO checks only step 3 grafts not step 5\n //get any spelllike abilities from grafts\n var subtype = $('#creatureSubTypeDrop').val().trim();\n if (subtype != '' && subtype != 'None') {\n if (creatureSubType[subtype].hasOwnProperty(\"Spell-likeAbilities\")){\n statBlock.spellLikeFromGrafts = creatureSubType[subtype][\"Spell-likeAbilities\"];\n }\n if (creatureSubType[subtype].hasOwnProperty(\"SubRaces\")){\n subRaceDrop = $('#stepThreeOptionDrop').val().trim();\n if (creatureSubType[subtype].SubRaces[subRaceDrop].hasOwnProperty(\"Spell-likeAbilities\")){\n statBlock.spellLikeFromGrafts = creatureSubType[subtype].SubRaces[subRaceDrop][\"Spell-likeAbilities\"];\n }\n }\n }\n //spells from descriptions\n spellArray = [];\n for (var i = 1; i < 4; i++) {//loop three times\n //grab text from descriptions\n var spellSlot = $(\".stepEight\"+ i.toString() +\"Description\").first().text()\n\n //check if there is text there and assign to stat block\n if (spellSlot.length > 2){\n var spells = spellSlot.split(': ');\n var frequency = spells[0];\n //remove connection tag from mytic spell lists\n spells[1] = spells[1].replace(' (from connection)','')\n //make sure values are arrays even if only 1 value\n if (spells[1].includes(',')){\n var subArray = spells[1].split(', ');\n } else {\n var subArray = [spells[1]];\n }\n spellArray[spellArray.length] = [frequency].concat(subArray);\n }\n }\n //if no spells chosen, dont add spell list\n if (spellArray.length != 0){\n statBlock.Spellcasting = spellArray;\n }\n\n //step 11 - final checks\n\n statBlock.creatureSize = $('#sizeDrop').val().trim();\n\n } catch(err) {\n var status = getErrorStatus();\n document.getElementById(\"errorMessage\").innerHTML = \"statblock building error: \" + err.message + '<br><br>' + err.stack + status;\n $('.alert-this-red').show();\n return false;\n }\n\n //\n //stat block adjustments\n //\n\n try {\n\n //choose creature or class adjustments to apply\n var classDrop = $('#classDrop').val().trim();\n //choose class or creature adjustments not both\n if (classDrop != '' && classDrop != 'None'){\n var precedenceDrop = $('#precedenceDrop').val().trim();\n if (precedenceDrop.includes(\"Creature\")) {\n var adjustments = statBlock.CreatureAdjustments;\n } else if (precedenceDrop.includes(\"Class\")){\n var adjustments = statBlock.ClassAdjustments;\n }\n } else {\n var adjustments = statBlock.CreatureAdjustments;\n }\n //apply\n for (adjustment in adjustments) {\n if (adjustment == \"anySave\"){\n //use picker\n var savingThrow = $('[data-id=\"SavingThrowDrop\"]').text().trim().replace(' +2','').toLowerCase();\n statBlock[savingThrow] += 2;\n } else if (adjustment == \"None\") {\n //do nothing\n } else if (statBlock.hasOwnProperty(adjustment)){\n //check if proprty already has entry\n statBlock[adjustment] += adjustments[adjustment];\n } else {\n statBlock[adjustment] = adjustments[adjustment];\n }\n }\n\n //apply attack mods if any\n if (statBlock.hasOwnProperty('attackMod')){\n\n statBlock.highAttackBonus = '+' + (Number(statBlock.highAttackBonus.replace('+','')) + statBlock.attackMod).toString();\n statBlock.lowAttackBonus = '+' + (Number(statBlock.lowAttackBonus.replace('+','')) + statBlock.attackMod).toString();\n }\n\n if (statBlock.hasOwnProperty(\"skillCheckMod\")){\n //increase skill scores\n statBlock.masterSkills[0] = statBlock.masterSkills[0] + statBlock.skillCheckMod;\n statBlock.goodSkills[0] = statBlock.goodSkills[0] + statBlock.skillCheckMod;\n }\n\n //apply ability mods to selected ability scores\n scoreNames = ['str','dex','con','int','wis','cha'];\n for (i = 0; i < scoreNames.length; i++) {\n if (!statBlock.hasOwnProperty(scoreNames[i])){\n ability = scoreNames[i].capitalise();\n if (statBlock.MainAbilityScores.includes(ability)){\n index = statBlock.MainAbilityScores.indexOf(ability);\n\n statBlock[scoreNames[i]] = '+' + statBlock['abilityScoreModifier'+ index.toString()].toString();\n } else {\n statBlock[scoreNames[i]] = '+0';\n }\n }\n }\n\n statBlock.initiative = statBlock.dex\n\n //add any initiative mods. ie from operative\n if (statBlock.hasOwnProperty(\"initiativeMod\")){\n //increase initiative if needed\n if (statBlock.hasOwnProperty('initiativeMod')){\n if (statBlock.initiativeMod == \"+CR/4\"){\n statBlock.initiative = '+' + (Number(statBlock.initiative.replace('+','')) + Math.floor(Number(statBlock.Cr) / 4)).toString();\n } else {\n statBlock.initiative = '+' + (Number(statBlock.initiative.replace('+','')) + statBlock.initiativeMod).toString();\n }\n }\n }\n\n //apply any adjustment ABILITIES\n if (statBlock.hasOwnProperty('AdjustmentAbilitiesDescription')){\n var adjustments = statBlock.AdjustmentAbilitiesDescription\n if (adjustments.includes(\"Extra Hit Points\")){\n //add 20% hitpoints\n\n statBlock.hitPoints = Math.round(statBlock.hitPoints + (statBlock.hitPoints * 0.2));\n\n }\n if (adjustments.includes(\"Skillful\")){\n //increase skill scores\n statBlock.masterSkills[0] = statBlock.masterSkills[0] + 1;\n statBlock.goodSkills[0] = statBlock.goodSkills[0] + 1;\n }\n if (adjustments.includes(\"Save Boost\")){\n //increase save values\n var saveInput = $('#BoostDrop').val().trim();\n if (saveInput.startsWith(\"All\")) {\n statBlock.fortitude = statBlock.fortitude + 1;\n statBlock.reflex = statBlock.reflex + 1;\n statBlock.will = statBlock.will + 1;\n } else {\n var pick = saveInput.replace(' +3','').toLowerCase();\n statBlock[pick] = statBlock[pick] + 3;\n }\n }\n }\n\n //apply DR\n if (statBlock.hasOwnProperty('DR')){\n if (statBlock['DR'].hasOwnProperty('DR')){\n var drsplit = statBlock['DR']['DR'].split('/')\n var drcr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n drcr = drcr + Number(drsplit[0].replace('CR',''));\n if (drcr < 1){\n drcr = 1;\n }\n statBlock.DRapplied = drcr.toString() + '/' + drsplit[1];\n }\n }\n if (statBlock.hasOwnProperty('DRtable')){\n var crTable = statBlock.DRtable['CR']\n var drcr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n var choice = 'none'\n for (i = 0; i < crTable.length; i++) {\n if (drcr >= crTable[i]) {\n choice = i;\n }\n }\n if (choice != 'none') {\n statBlock.DRapplied = statBlock.DRtable['DR'][choice].toString() + '/' + statBlock.DRtable.type;\n }\n }\n //apply SR\n if (statBlock.hasOwnProperty('SRtable')){\n var crTable = statBlock.SRtable['CR']\n var srcr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n var choice = 'none'\n for (i = 0; i < crTable.length; i++) {\n if (srcr >= crTable[i]) {\n choice = i;\n }\n }\n if (choice != 'none') {\n var sr = statBlock.SRtable['SR'][choice];\n if (sr.toString().includes('+CR') ){\n statBlock.SRapplied = (Number(sr.replace('+CR','')) + srcr).toString();\n } else {\n statBlock.SRapplied = sr;\n }\n }\n }\n //apply senses per cr\n if (statBlock.hasOwnProperty('SensesTable')){\n var SensesTable = statBlock.SensesTable;\n var cr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n var senseArray = [];\n var currentSense = '';\n\n for (sense in SensesTable) {\n if (SensesTable[sense] == \"always\") {\n senseArray.push(sense);\n } else if (cr >= SensesTable[sense]){\n currentSense = sense;\n }\n }\n if (currentSense != ''){\n senseArray.push(currentSense);\n }\n\n if (senseArray.length > 0){\n if (statBlock.hasOwnProperty('Senses')){\n statBlock.Senses = statBlock.Senses.concat(senseArray);\n } else {\n statBlock.Senses = senseArray;\n }\n }\n }\n\n\n //apply any calculated abilities\n if (statBlock.hasOwnProperty('CalculatedAbilities')){\n for (ability in statBlock.CalculatedAbilities){\n //any breath weapons\n if (ability == \"Breath weapon\") {\n var breathEntry = 'breath weapon';\n\n var cr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n\n var range1 = Number((statBlock.CalculatedAbilities[\"Breath weapon\"].range.split('+'))[0]);\n var range2 = Math.floor(cr/2) * Number(statBlock.CalculatedAbilities[\"Breath weapon\"].range.split('+')[1].split('per')[0])\n\n breathEntry += ' (' + (range1+range2).toString() +' ft. '+ statBlock.CalculatedAbilities[\"Breath weapon\"].type;\n\n var damageDice = (statBlock.CalculatedAbilities[\"Breath weapon\"].damage.split('+'))[0].split('d')[1];\n var damage = 1 + cr\n\n breathEntry += ', ' + damage.toString() + 'd' + damageDice + ' ' + statBlock.CalculatedAbilities[\"Breath weapon\"].damageType + ', Reflex DC ' +statBlock.abilityDCBase.toString() + ' half, usable every 1d4 rounds)';\n\n statBlock.OffensiveAbilities = [breathEntry];\n }\n if (ability == \"Frightful presence\") {\n\n var cr = Number(statBlock.Cr.replace('1/2','1').replace('1/3','1'));\n if (cr >= statBlock.CalculatedAbilities[\"Frightful presence\"][\"CR\"]) {\n var auraEntry = 'frightful presence (';\n var fright = statBlock.CalculatedAbilities[\"Frightful presence\"][\"range\"].split('+');\n auraEntry += (Number(fright[0]) + (10 * cr)).toString()+ ' ft., DC ' + statBlock.abilityDCBase.toString() + ')';\n statBlock.Aura = [auraEntry];\n //TODO only does 10ft * cr will need updating if any grafts change\n }\n }\n if (ability == \"Save\") {\n for(save in statBlock.CalculatedAbilities[\"Save\"]) {\n statBlock[save] = statBlock[save] + statBlock.CalculatedAbilities[\"Save\"][save];\n }\n }\n }\n }\n } catch(err) {\n var status = getErrorStatus();\n document.getElementById(\"errorMessage\").innerHTML = \"statblock building error: \" + err.message + '<br><br>' + err.stack + status;\n $('.alert-this-red').show();\n return false;\n }\n\n //\n //Stat Block Strings\n //\n\n try {\n //if the string requires more than one line of code then build it before the stat block section\n\n //build name String\n var nameInput = $('#inputName').val().trim();\n var nameString = '';\n if (nameInput == ''){\n nameString = \"CREATURE NAME\";\n } else {\n nameString = nameInput;\n }\n\n //build class type String\n var classTypeString = '';\n\n var genderString = $('#inputGender').val().trim();\n\n var subTypeString = '';\n if (statBlock.hasOwnProperty('SubType')){\n subTypeString = statBlock.SubType.toLowerCase();\n }\n\n var className = $('#classDrop').val().trim();\n if ( className != '' && className != 'None'){\n var classSString = className.toLowerCase()\n } else {\n var classSString = '';\n }\n\n if (genderString != ''){\n classTypeString = genderString;\n }\n if (subTypeString != ''){\n if (classTypeString != ''){\n classTypeString += ' ';\n }\n classTypeString += subTypeString;\n }\n if (classSString != ''){\n if (classTypeString != ''){\n classTypeString += ' ';\n }\n classTypeString += classSString;\n }\n //don't include subtype by itself\n if (classTypeString == subTypeString){\n classTypeString = '';\n }\n if (classTypeString != ''){\n classTypeString = '<div>'+ classTypeString.capitalise() + '</div>';\n }\n\n //build creature type String\n if (statBlock.hasOwnProperty('SubType')){\n subTypeString = ' (' + statBlock.SubType.toLowerCase() + ')';\n }\n\n var alignString = alignments[$('#align1Drop').val().trim() + $('#align2Drop').val().trim()];\n\n var typeString = '<div>'+ alignString +' ' + statBlock.creatureSize + ' ' + statBlock.CreatureType.toLowerCase() + subTypeString + '</div>';\n\n //build skills string\n listOfSkills = Object.keys(skillNames);\n listOfSkills = listOfSkills.concat(professionSkills);\n var skillString = '';\n for (i = 0; i < listOfSkills.length; i++) {\n if (statBlock.MasterSkills.includes(listOfSkills[i])){\n skillString += ', ' + listOfSkills[i] + ' +' + statBlock.masterSkills[0].toString()\n } else if (statBlock.GoodSkills.includes(listOfSkills[i])){\n skillString += ', ' + listOfSkills[i] + ' +' + statBlock.goodSkills[0].toString()\n }\n }\n skillString = skillString.replace(', ','');\n if (skillString == ''){\n skillString = 'None';\n }\n\n //build spell casting string\n var spellString = '';\n\n // calc caster level\n var clVal = ordinalNumber(Number(statBlock.Cr));\n\n //racial spell-like abilitiesArray\n if (statBlock.hasOwnProperty('spellLikeFromGrafts')){\n var spells = statBlock.spellLikeFromGrafts;\n spellString += '<div><b>' + statBlock.SubType + ' Spell-Like Abilities</b> (CL ' + clVal +')';\n for (key in spells) {\n var Key = key;\n if (Key == \"atWill\"){\n Key = \"at will\";\n }\n spellString += '<br>' + Key + \" - <i>\" + spells[key].join(', ') + \"</i>\";\n }\n spellString += '</div>';\n spellString = spellString.replace('; ','')\n }\n\n //check if creature has spellcasting\n if (statBlock.hasOwnProperty('Spellcasting')){\n\n //do the spells title\n var typeTitle = '';\n if ($('.casterTypeDescription').text().includes('Mystic')){\n //Mystic\n typeTitle = 'Mystic Spells Known';\n } else if ($('.casterTypeDescription').text().includes('Technomancer')){\n //Technomancer\n typeTitle = 'Technomancer Spells Known';\n } else if ($('[data-id=\"casterDrop\"]').length){\n //Full caster\n if ($('[data-id=\"casterDrop\"]').text().includes(\"Full\")) {\n typeTitle = 'Spells Known';\n } else {\n //spell-like\n typeTitle = 'Spell-like Abilities';\n }\n } else {\n //spell-like\n typeTitle = 'Spell-like Abilities';\n }\n\n var rangeAttackVal = (statBlock.attackFocus == 'Ranged') ? statBlock.highAttackBonus:statBlock.lowAttackBonus;\n //Caster Level\n\n spellString += '<div><b>'+typeTitle+'</b> (CL ' + clVal +'; ranged '+rangeAttackVal+')';\n //for each frequency\n for (var i = 0; i < statBlock.Spellcasting.length; i++) {\n spellBlock = statBlock.Spellcasting[i];\n\n //add new line for each frequency\n spellString += '<div>' + spellBlock[0] + ' - ';\n //for each spell\n for (var j = 1; j < spellBlock.length; j++) {\n spell = '<i>' + spellBlock[j].toLowerCase() + '</i>';\n dc = '';\n //check if the spell needs a DC save and add in if necessary\n if (spellsData[spellBlock[j]].hasOwnProperty(\"SAVEINFO\")){\n if (spellsData[spellBlock[j]][\"SAVEINFO\"] != 'None'){\n dc = ' (DC ' + (Number(spellBlock[0].charAt(0)) + statBlock.spellDC).toString() + ')';\n }\n } else {\n dc = ' (DC ' + (Number(spellBlock[0].charAt(0)) + statBlock.spellDC).toString() + ')';\n }\n spell+=dc;\n if (j > 1){\n spellString += ', ';\n }\n spellString += spell;\n\n }\n // finalise the spell string\n spellString += '</div>';\n }\n spellString += '</div>';\n }\n\n var specialString = '';\n var offensiveAbilities = [];\n var defensiveAbilities = [];\n var otherAbilities = [];\n //build special ability Strings\n\n if (statBlock.hasOwnProperty('SpecialAbilitiesDescription') || statBlock.hasOwnProperty('SpecialAbilitiesGraft')){\n\n specialString += '<div><b>SPECIAL ABILITIES</b></div>';\n specialString += '<hr>';\n\n var abilitiesArray = [];\n if (statBlock.hasOwnProperty('SpecialAbilitiesDescription')) {\n abilitiesArray = abilitiesArray.concat(statBlock.SpecialAbilitiesDescription);\n }\n if (statBlock.hasOwnProperty('SpecialAbilitiesGraft')) {\n abilitiesArray = abilitiesArray.concat(statBlock.SpecialAbilitiesGraft);\n }\n var abilitiesArray = abilitiesArray.sort();\n\n for (var i = 0; i < abilitiesArray.length; i++) {\n //chosen abilities\n if (specialAbilities.Abilities.hasOwnProperty(abilitiesArray[i])){\n specialString += '<div><b>'+abilitiesArray[i]+'</b> ';\n specialString += specialAbilities.Abilities[abilitiesArray[i]].Description;\n //print guidelines if any\n if (specialAbilities.Abilities[abilitiesArray[i]].hasOwnProperty(\"Guidelines\")) {\n specialString += ' <b>Guidelines </b>' + specialAbilities.Abilities[abilitiesArray[i]].Guidelines;\n }\n specialString += '</div><br>';\n //add abilities to the correct headings\n var format = specialAbilities.Abilities[abilitiesArray[i]].Format;\n if (format.includes('Defensive Abilities')){\n defensiveAbilities.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,''));\n }\n if (format.includes('Other Abilities')){\n otherAbilities.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,''));\n }\n\n if (format.includes('Speed')){\n if (statBlock.hasOwnProperty('Speed')){\n statBlock.Speed.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,'').capitalise());\n } else {\n statBlock.Speed = [abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,'').capitalise()];\n }\n\n }\n if (format.includes('Languages')){\n if (statBlock.hasOwnProperty('Languages')){\n statBlock.Languages.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,'').capitalise());\n } else {\n statBlock.Languages = [abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,'').capitalise()];\n }\n\n }\n if (format.includes('Senses')){\n if (statBlock.hasOwnProperty('Senses')){\n statBlock.Senses.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,''));\n } else {\n statBlock.Senses = [abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,'')];\n }\n\n }\n if (format.includes('Melee')){\n /*if (statBlock.hasOwnProperty('MeleeFromAbility')){\n statBlock.MeleeFromAbility = statBlock.MeleeFromAbility.push(format.replace('Melee ','').replace('.',''));\n } else {\n statBlock.MeleeFromAbility = format.replace('Melee ','').replace('.','');\n }*/\n //else if so that swallow whole doesn't mess things up TODO fix\n }else if (format.includes('Offensive Abilities')){\n offensiveAbilities.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,''));\n }\n //graft abilities\n } else if (graftSpecialAbilities.hasOwnProperty(abilitiesArray[i])){\n specialString += '<div><b>'+abilitiesArray[i]+'</b> ';\n specialString += graftSpecialAbilities[abilitiesArray[i]];\n specialString += '</div><br>';\n //add to other abilities\n otherAbilities.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,''));\n }\n }\n\n }\n\n //free abilities\n if (statBlock.hasOwnProperty('FreeAbilities')){\n var abilitiesArray = statBlock.FreeAbilities;\n for (var i = 0; i < abilitiesArray.length; i++) {\n if (!Object.keys(specialAbilities.Weaknesses).includes(abilitiesArray[i])){\n var format = specialAbilities.FreeAbilities[abilitiesArray[i]].Format;\n if (format.includes('Other Abilities')){\n otherAbilities.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,''));\n }\n /*if (format.includes('Speed')){\n if (statBlock.hasOwnProperty('Speed')){\n statBlock.Speed.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,'').capitalise());\n } else {\n statBlock.Speed = [abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,'').capitalise()];\n }\n\n }*/\n if (format.includes('Languages')){\n if (statBlock.hasOwnProperty('Languages')){\n statBlock.Languages.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,'').capitalise());\n } else {\n statBlock.Languages = [abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,'').capitalise()];\n }\n\n }\n if (format.includes('Senses')){\n if (statBlock.hasOwnProperty('Senses')){\n if (abilitiesArray[i] == 'Blindsense (Ex)'){\n abilitiesArray[i] = 'Blindsense 60 ft.'\n }\n if (abilitiesArray[i] == 'Darkvision (Ex Or Su)'){\n abilitiesArray[i] = 'Darkvision 60 ft.'\n }\n statBlock.Senses.push(abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,''));\n } else {\n statBlock.Senses = [abilitiesArray[i].toLowerCase().replace(/ \\(.*\\)/g,'')];\n }\n\n }\n }\n }\n }\n\n //other abilities from grafts\n if (statBlock.hasOwnProperty('OtherAbilitiesGraft')){\n otherAbilities = otherAbilities.concat(statBlock.OtherAbilitiesGraft)\n }\n //other abilities from sub choices\n if (statBlock.hasOwnProperty('OtherAbilities')){\n var otherotherabilities = statBlock.OtherAbilities;\n var OAString = otherAbilities.join(',').toLowerCase();\n for (var i = 0; i < otherotherabilities.length; i++) {\n if ( !OAString.includes(otherotherabilities[i]) && !OAString.includes(otherotherabilities[i].toLowerCase())){\n otherAbilities.push(otherotherabilities[i]);\n }\n }\n otherAbilities.sort();\n }\n //other abilities from class\n if (statBlock.hasOwnProperty('ClassOtherAbilities')){\n otherAbilities = otherAbilities.concat(statBlock.ClassOtherAbilities)\n }\n\n\n //strings for abilities\n var offensiveAbilitiesString = '';\n var defensiveAbilitiesString = '';\n var otherAbilitiesString = '';\n\n if (offensiveAbilities.length > 0 || statBlock.hasOwnProperty('OffensiveAbilities') || statBlock.hasOwnProperty('ClassOffensiveAbilities')) {\n var offence = [];\n if (offensiveAbilities.length > 0){\n offence = offence.concat(offensiveAbilities);\n }\n if (statBlock.hasOwnProperty('OffensiveAbilities')){\n offence = offence.concat(statBlock.OffensiveAbilities);\n }\n if (statBlock.hasOwnProperty('ClassOffensiveAbilities')){\n offence = offence.concat(statBlock.ClassOffensiveAbilities);\n }\n offence.sort()\n offensiveAbilitiesString = '<div><b>Offensive abilities </b>' + offence.join(', ') + '</div>';\n }\n if (defensiveAbilities.length > 0 || statBlock.hasOwnProperty('ClassDefensiveAbilities')) {\n var defence = [];\n if (defensiveAbilities.length > 0){\n defence = defence.concat(defensiveAbilities);\n }\n if (statBlock.hasOwnProperty('ClassDefensiveAbilities')){\n defence = defence.concat(statBlock.ClassDefensiveAbilities);\n }\n defence.sort()\n defensiveAbilitiesString = '<b>Defensive abilities </b>' + defence.join(', ');\n }\n if (otherAbilities.length > 0) {\n //sort the array\n var sorted = [];\n for (var i = 0; i < otherAbilities.length; i++) {\n sorted.push(otherAbilities[i].toLowerCase());\n }\n sorted.sort();\n otherAbilities = sorted;\n otherAbilitiesString = '<div><b>Other abilities </b>' + otherAbilities.join(', ') + '</div>';\n }\n\n\n //check if there is any senses\n var sensesString = '';\n if (statBlock.hasOwnProperty('Senses')){\n\n //remove duplicates\n var uniqueSenses = statBlock.Senses.filter(function(elem, index, self) {\n return index === self.indexOf(elem);\n })\n\n uniqueSenses = uniqueSenses.sort();\n\n sensesString = '; <b>Senses</b> '+uniqueSenses.join(', ').toLowerCase()\n }\n\n //build attack strings\n var MeleeString = '';\n var RangedString = '';\n //iterate through attack entries\n $(\"[class^='attackDiv']\").each(function(){\n var index = $(this).attr('class').replace('attackDiv','').replace(' brute','')\n\n var indexParts = index.split('-');\n var name = $('#attackName'+index).val().trim().toLowerCase();\n var bonus = $('#bonus'+index).val().trim();\n var damage = $('#damage'+index).val().trim();\n if ($('[data-id=\"AT'+index+'Drop\"]').length){\n var attackType = $('#AT'+index+'Drop').val().trim();\n var damageType = $('#DT'+index+'Drop').val().trim();\n damageType = window[attackType.toLowerCase() + indexParts[0] + 'Types'][damageType];\n } else {\n var damageType = $('#damagetype'+index).val().trim();\n }\n\n var critical = $('#critical'+index).val().trim();\n var end = ' or<br>';\n\n //handle strength\n if (damage.includes('Str')){\n var damageSplit = damage.split('+');\n var str = Number(statBlock.str.replace('+',''));\n var damageBonus = Number(damageSplit[1])\n damageBonus = damageBonus + str;\n //add any strength Modifiers\n if (statBlock.hasOwnProperty('damageMod')){\n if (statBlock.damageMod == '1/2STR') {\n damageBonus = damageBonus + (Math.round(str/2));\n }\n }\n damage = damageSplit[0] + '+' + damageBonus.toString();\n }\n\n //handle attack mod\n if (statBlock.hasOwnProperty('attackMod')){\n bonus = '+' + (Number(bonus.replace('+','')) + statBlock.attackMod).toString();\n }\n\n if (critical == '-') {\n critical = '';\n }\n\n if (critical != '' && critical != '-') {\n critical = '; critical ' + critical.toLowerCase();\n }\n\n if (indexParts[0].toString() == 'Melee') {\n\n if (MeleeString == ''){\n MeleeString = '<div><b>'+ indexParts[0] + '</b> ';\n end = ''\n }\n\n MeleeString += end + name + ' ' + bonus + ' (' + damage + ' ' + damageType + critical + ')'\n\n }\n\n if (indexParts[0].toString() == 'Ranged') {\n\n if (RangedString == ''){\n RangedString = '<div><b>'+ indexParts[0] + '</b> ';\n end = ''\n }\n\n RangedString += end + name + ' ' + bonus + ' (' + damage + ' ' + damageType + critical + ')'\n\n }\n\n });\n if (MeleeString != ''){\n MeleeString += '</div>';\n }\n if (RangedString != ''){\n RangedString += '</div>';\n }\n\n // language string\n var languageString = '';\n var languageArray = [];\n var languages = $('#languageDrop').val().toString().trim();\n if (languages != ''){\n languageArray = languageArray.concat(languages.split(','))\n }\n if (statBlock.hasOwnProperty('Languages')){\n languageArray = languageArray.concat(statBlock.Languages);\n }\n if (languageArray.length > 0){\n languageArray.sort();\n languageString = '<div><b>Languages</b> ' + languageArray.join(', ') + '</div>';\n }\n\n //Extra user fillable entries\n var EcologyString = '';\n var TacticsString = '';\n var extraEntries = $('#OSDrop').val().toString().trim();\n\n if (extraEntries.includes(\"Ecology\")){\n EcologyString = '<div><b>ECOLOGY</b></div><hr><div>ecology details here e.g. Environment, Organisation, Home Planet</div><br>';\n }\n if (extraEntries.includes(\"Tactics\")){\n TacticsString = '<div><b>TACTICS</b></div><hr><div>tactics details here e.g. Before Combat, During combat, Morale</div><br>';\n }\n\n //perception string\n if (statBlock.MasterSkills.includes(\"Perception\")){\n var perceptionValue = statBlock.masterSkills[0].toString()\n } else {\n var perceptionValue = statBlock.goodSkills[0].toString()\n }\n\n //space and reach strings\n var spaceReachString = '';\n if (statBlock.creatureSize != 'Medium' ){\n sizeArray = creatureSize[statBlock.creatureSize];\n var space = '';\n var reach = '';\n\n if (sizeArray[2] != \"5 ft.\"){\n space = '<b>Space</b> ' + sizeArray[2];\n }\n if (sizeArray[3] != \"5 ft.\"){\n reach = '<b>Reach</b> ' + sizeArray[3];\n }\n spaceReachString += space;\n if (space != '' && reach != '') {\n spaceReachString += '; '\n }\n spaceReachString += reach;\n if (spaceReachString != ''){\n spaceReachString = '<div>' + spaceReachString + '</div>';\n }\n }\n\n //defences String\n var defencesString = '';\n //defensive abbilities\n defencesString += defensiveAbilitiesString;\n\n //DR\n if (statBlock.hasOwnProperty('DRapplied')){\n if (defencesString != '') {\n defencesString += '; ';\n }\n defencesString += '<b>DR </b>'+statBlock.DRapplied;\n }\n //immunities\n if (statBlock.hasOwnProperty('Immunities')){\n if (defencesString != '') {\n defencesString += '; ';\n }\n defencesString += '<b>Immunities </b>'+statBlock.Immunities.join(', ');\n }\n //resistances\n if (statBlock.hasOwnProperty('Resistance')){\n if (defencesString != '') {\n defencesString += '; ';\n }\n defencesString += '<b>Resistances </b>'+statBlock.Resistance.join(', ');\n }\n //SR\n if (statBlock.hasOwnProperty('SRapplied')){\n if (defencesString != '') {\n defencesString += '; ';\n }\n defencesString += '<b>SR </b>'+statBlock.SRapplied;\n }\n //weaknesses\n var weaknessString = '';\n\n if (statBlock.hasOwnProperty('weaknessAbilities')){\n weaknessString += statBlock.weaknessAbilities;\n }\n\n if (statBlock.hasOwnProperty('Vulnerable')){\n if (weaknessString != '') {\n weaknessString += '; ';\n }\n weaknessString += 'vulnerable to ' + statBlock.Vulnerable.join(', vulnerable to ');\n }\n\n if (statBlock.hasOwnProperty('Dependencies')){\n if (weaknessString != '') {\n weaknessString += '; ';\n }\n weaknessString += statBlock.Dependencies.join(' dependent, ') + ' dependent';\n }\n\n if (weaknessString != '') {\n if (defencesString != '') {\n defencesString += '; ';\n }\n defencesString += '<b>Weaknesses </b>' + weaknessString;\n }\n if (defencesString != '') {\n defencesString = '<div>' + defencesString + '</div>';\n }\n\n //save string\n var saveString = \"<div><b>Fort</b> +\"+statBlock.fortitude + \"; <b>Ref</b> +\"+statBlock.reflex+ \"; <b>Will</b> +\"+statBlock.will;\n if (statBlock.hasOwnProperty('PlusAbilities')){\n saveString += '; ' + statBlock.PlusAbilities.join(', ').replace('+CR','+'+statBlock.Cr.toString());\n }\n saveString += \"</div>\";\n\n //speedString\n var speedInput = $('#inputSpeed').val().trim();\n if (statBlock.hasOwnProperty('addSpeed')){\n speedInput = (Number(speedInput) + statBlock.addSpeed).toString();\n }\n var speedString = '<div><b>Speed</b> '+speedInput+' ft.';\n if (statBlock.hasOwnProperty('Speed')){\n var speeds = statBlock.Speed;\n speeds.sort()\n speedString += ', ' + speeds.join(', ');\n }\n speedString += \"</div>\";\n\n rpBlock='';\n if (statBlock.hasOwnProperty('Class')) {\n rpBlock = ' <b>RP</b> ' + statBlock.ClassResolvePoints;\n }\n //defense title string, this far down because its waiting for RP\n var defenceTitle = leftAndRight('<b>DEFENSE</b>','<b>HP</b> ' + statBlock.hitPoints + rpBlock);\n\n //Aura string\n auraString = '';\n if (statBlock.hasOwnProperty('Aura')){\n auraString = '<div><b>Aura</b> ' + statBlock.Aura.join(', ') + '</div>'\n }\n\n //Text string\n textString = '';\n if (statBlock.hasOwnProperty('Text')){\n textString = '<div><b>Text</b> ' + statBlock.Text + '<br></div>'\n }\n\n //Gear string\n gearString = '';\n if (statBlock.hasOwnProperty('gear')){\n gearString = '<div><b>Gear</b> ' + statBlock.gear + '<br></div>'\n }\n\n //\n //Stat Block\n //\n\n textBlock = \"\";\n //description\n textBlock += '<hr>';\n textBlock += leftAndRight('<b>' + nameString + '</b>','<b>CR '+statBlock.Cr+'</b>');\n textBlock += '<hr>';\n textBlock += \"<div><b>XP \"+statBlock.Xp+\"</b></div>\";\n textBlock += classTypeString;\n textBlock += typeString;\n textBlock += \"<div><b>Init</b> \"+statBlock.initiative+sensesString+'; <b>Perception</b> +'+perceptionValue+\"</div>\";\n textBlock += auraString;\n textBlock += \"<br>\";\n\n //Defence\n textBlock += defenceTitle;\n textBlock += \"<hr>\";\n textBlock += \"<div><b>EAC</b> \"+statBlock.eac + \"; <b>KAC</b> \"+statBlock.kac+\"</div>\";\n textBlock += saveString;\n textBlock += defencesString;\n textBlock += \"<br>\";\n\n //Offence\n textBlock += '<div><b>OFFENSE</b></div>';\n textBlock += '<hr>';\n textBlock += speedString;\n textBlock += MeleeString;\n textBlock += RangedString;\n textBlock += spaceReachString;\n textBlock += offensiveAbilitiesString;\n textBlock += spellString;\n textBlock += \"<br>\";\n\n //tactics\n textBlock += TacticsString;\n\n //statistics\n textBlock += '<div><b>STATISTICS</b></div>';\n textBlock += '<hr>';\n textBlock += \"<div><b>Str</b> \"+statBlock.str + \"; <b>Dex</b> \"+statBlock.dex+ \"; <b>Con</b> \"+statBlock.con+ \"; <b>Int</b> \"+statBlock.int+ \"; <b>Wis</b> \"+statBlock.wis+ \"; <b>Cha</b> \"+statBlock.cha+\"</div>\";\n textBlock += '<div><b>Skills </b>'+skillString+'</div>';\n textBlock += languageString;\n textBlock += otherAbilitiesString;\n textBlock += gearString;\n textBlock += \"<br>\";\n\n //ecology\n textBlock += EcologyString;\n\n //warning\n if (specialString != '' || textString != '') {\n textBlock += '<br>';\n textBlock += '<div><b>Heads up!</b> if there are any required stat block changes below this warning, they will need to be added manually.</div>';\n textBlock += '<br>';\n }\n //extra text\n textBlock += textString;\n //special Abilities\n textBlock += specialString;\n\n //statBlock.CreatureType\n var $StatBlock = $(\".summernoteEdit\").first();\n $StatBlock.empty();\n $StatBlock.append(textBlock);\n\n //log event in analytics\n var analyticsString = \"\";\n if (statBlock.hasOwnProperty('SubType')){\n analyticsString += \":\"+statBlock.SubType;\n }\n if (statBlock.hasOwnProperty('Class')){\n analyticsString += \":\"+statBlock.Class;\n }\n if (statBlock.hasOwnProperty('Graft')){\n analyticsString += \":\"+statBlock.Graft;\n }\n\n\n ga('send', 'event', 'Generation', 'monster', statBlock.Cr+\":\"+statBlock.Base+\":\"+statBlock.CreatureType+analyticsString);\n\n } catch(err) {\n var status = getErrorStatus();\n document.getElementById(\"errorMessage\").innerHTML = \"statblock building error: \" + err.message + '<br><br>' + err.stack + status;\n $('.alert-this-red').show();\n return false;\n }\n\n return true;\n\n}", "function handleBlock(startArr,startOffsetM,startOffsetNextM,destArr,destOffsetM,destOffsetNextM,undefined$1){// slice out the block we need\nvar startArrTemp=startArr.slice(startOffsetM,startOffsetNextM||undefined$1),destArrTemp=destArr.slice(destOffsetM,destOffsetNextM||undefined$1);var i=0,posStart={pos:[0,0],start:[0,0]},posDest={pos:[0,0],start:[0,0]};do{// convert shorthand types to long form\nstartArrTemp[i]=simplyfy.call(posStart,startArrTemp[i]);destArrTemp[i]=simplyfy.call(posDest,destArrTemp[i]);// check if both shape types match\n// 2 elliptical arc curve commands ('A'), are considered different if the\n// flags (large-arc-flag, sweep-flag) don't match\nif(startArrTemp[i][0]!=destArrTemp[i][0]||startArrTemp[i][0]=='M'||startArrTemp[i][0]=='A'&&(startArrTemp[i][4]!=destArrTemp[i][4]||startArrTemp[i][5]!=destArrTemp[i][5])){// if not, convert shapes to beziere\nArray.prototype.splice.apply(startArrTemp,[i,1].concat(toBeziere.call(posStart,startArrTemp[i])));Array.prototype.splice.apply(destArrTemp,[i,1].concat(toBeziere.call(posDest,destArrTemp[i])));}else{// only update positions otherwise\nstartArrTemp[i]=setPosAndReflection.call(posStart,startArrTemp[i]);destArrTemp[i]=setPosAndReflection.call(posDest,destArrTemp[i]);}// we are at the end at both arrays. stop here\nif(++i==startArrTemp.length&&i==destArrTemp.length)break;// destArray is longer. Add one element\nif(i==startArrTemp.length){startArrTemp.push(['C',posStart.pos[0],posStart.pos[1],posStart.pos[0],posStart.pos[1],posStart.pos[0],posStart.pos[1]]);}// startArr is longer. Add one element\nif(i==destArrTemp.length){destArrTemp.push(['C',posDest.pos[0],posDest.pos[1],posDest.pos[0],posDest.pos[1],posDest.pos[0],posDest.pos[1]]);}}while(true);// return the updated block\nreturn{start:startArrTemp,dest:destArrTemp};}// converts shorthand types to long form", "function analyzer(data, sidePass) {\n //B.start('analyzer');\n var mainPass = !sidePass;\n\n var item = { items: data };\n var data = item;\n\n var newTypes = {};\n\n // Gather\n // Single-liners\n ['globalVariable', 'functionStub', 'unparsedFunction', 'unparsedGlobals', 'unparsedTypes', 'alias'].forEach(function(intertype) {\n var temp = splitter(item.items, function(item) { return item.intertype == intertype });\n item.items = temp.leftIn;\n item[intertype + 's'] = temp.splitOut;\n });\n var temp = splitter(item.items, function(item) { return item.intertype == 'type' });\n item.items = temp.leftIn;\n temp.splitOut.forEach(function(type) {\n //dprint('types', 'adding defined type: ' + type.name_);\n Types.types[type.name_] = type;\n newTypes[type.name_] = 1;\n if (QUANTUM_SIZE === 1) {\n Types.fatTypes[type.name_] = copy(type);\n }\n });\n\n // Functions & labels\n item.functions = [];\n var currLabelFinished = false; // Sometimes LLVM puts a branch in the middle of a label. We need to ignore all lines after that.\n item.items.sort(function(a, b) { return a.lineNum - b.lineNum });\n for (var i = 0; i < item.items.length; i++) {\n var subItem = item.items[i];\n assert(subItem.lineNum);\n if (subItem.intertype == 'function') {\n item.functions.push(subItem);\n subItem.endLineNum = null;\n subItem.lines = []; // We will fill in the function lines after the legalizer, since it can modify them\n subItem.labels = [];\n subItem.forceEmulated = false;\n\n // no explicit 'entry' label in clang on LLVM 2.8 - most of the time, but not all the time! - so we add one if necessary\n if (item.items[i+1].intertype !== 'label') {\n item.items.splice(i+1, 0, {\n intertype: 'label',\n ident: ENTRY_IDENT,\n lineNum: subItem.lineNum + '.5'\n });\n }\n } else if (subItem.intertype == 'functionEnd') {\n item.functions.slice(-1)[0].endLineNum = subItem.lineNum;\n } else if (subItem.intertype == 'label') {\n item.functions.slice(-1)[0].labels.push(subItem);\n subItem.lines = [];\n currLabelFinished = false;\n } else if (item.functions.length > 0 && item.functions.slice(-1)[0].endLineNum === null) {\n // Internal line\n if (!currLabelFinished) {\n item.functions.slice(-1)[0].labels.slice(-1)[0].lines.push(subItem); // If this line fails, perhaps missing a label?\n if (subItem.intertype in LABEL_ENDERS) {\n currLabelFinished = true;\n }\n } else {\n print('// WARNING: content after a branch in a label, line: ' + subItem.lineNum);\n }\n } else {\n throw 'ERROR: what is this? ' + dump(subItem);\n }\n }\n delete item.items;\n\n // CastAway - try to remove bitcasts of double<-->i64, which LLVM sometimes generates unnecessarily\n // (load a double, convert to i64, use as i64).\n // We optimize this by checking if there are such bitcasts. If so we create a shadow\n // variable that is of the other type, and use that in the relevant places. (As SSA, this is valid, and\n // variable elimination later will remove the double load if it is no longer needed.)\n //\n // Note that aside from being an optimization, this is needed for correctness in some cases: If code\n // assumes it can bitcast a double to an i64 and back and forth without loss, that may be violated\n // due to NaN canonicalization.\n function castAway() {\n if (USE_TYPED_ARRAYS != 2) return;\n\n item.functions.forEach(function(func) {\n var has = false;\n func.labels.forEach(function(label) {\n var lines = label.lines;\n for (var i = 0; i < lines.length; i++) {\n var line = lines[i];\n if (line.intertype == 'bitcast' && line.type in SHADOW_FLIP) {\n has = true;\n }\n }\n });\n if (!has) return;\n // there are integer<->floating-point bitcasts, create shadows for everything\n var shadowed = {};\n func.labels.forEach(function(label) {\n var lines = label.lines;\n var i = 0;\n while (i < lines.length) {\n var lines = label.lines;\n var line = lines[i];\n if (line.intertype == 'load' && line.type in SHADOW_FLIP) {\n if (line.pointer.intertype != 'value') { i++; continue } // TODO\n shadowed[line.assignTo] = 1;\n var shadow = line.assignTo + '$$SHADOW';\n var flip = SHADOW_FLIP[line.type];\n lines.splice(i + 1, 0, { // if necessary this element will be legalized in the next phase\n tokens: null,\n indent: 2,\n lineNum: line.lineNum + 0.5,\n assignTo: shadow,\n intertype: 'load',\n pointerType: flip + '*',\n type: flip,\n valueType: flip,\n pointer: {\n intertype: 'value',\n ident: line.pointer.ident,\n type: flip + '*'\n },\n align: line.align,\n ident: line.ident\n });\n // note: no need to update func.lines, it is generated in a later pass\n i++;\n }\n i++;\n }\n });\n // use shadows where possible\n func.labels.forEach(function(label) {\n var lines = label.lines;\n for (var i = 0; i < lines.length; i++) {\n var line = lines[i];\n if (line.intertype == 'bitcast' && line.type in SHADOW_FLIP && line.ident in shadowed) {\n var shadow = line.ident + '$$SHADOW';\n line.params[0].ident = shadow;\n line.params[0].type = line.type;\n line.type2 = line.type;\n }\n }\n });\n });\n }\n\n // Legalize LLVM unrealistic types into realistic types.\n //\n // With full LLVM optimizations, it can generate types like i888 which do not exist in\n // any actual hardware implementation, but are useful during optimization. LLVM then\n // legalizes these types into real ones during code generation. Sadly, there is no LLVM\n // IR pass to legalize them, which would have been useful and nice from a design perspective.\n // The LLVM community is also not interested in receiving patches to implement that\n // functionality, since it would duplicate existing code from the code generation\n // component. Therefore, we implement legalization here in Emscripten.\n //\n // Currently we just legalize completely unrealistic types into bundles of i32s, and just\n // the most common instructions that can be involved with such types: load, store, shifts,\n // trunc and zext.\n function legalizer() {\n // Legalization\n if (USE_TYPED_ARRAYS == 2) {\n function getLegalVars(base, bits, allowLegal) {\n bits = bits || 32; // things like pointers are all i32, but show up as 0 bits from getBits\n if (allowLegal && bits <= 32) return [{ intertype: 'value', ident: base + ('i' + bits in Runtime.INT_TYPES ? '' : '$0'), bits: bits, type: 'i' + bits }];\n if (isNumber(base)) return getLegalLiterals(base, bits);\n if (base[0] == '{') {\n warnOnce('seeing source of illegal data ' + base + ', likely an inline struct - assuming zeroinit');\n return getLegalLiterals('0', bits);\n }\n var ret = new Array(Math.ceil(bits/32));\n var i = 0;\n if (base == 'zeroinitializer' || base == 'undef') base = 0;\n while (bits > 0) {\n ret[i] = { intertype: 'value', ident: base ? base + '$' + i : '0', bits: Math.min(32, bits), type: 'i' + Math.min(32, bits) };\n bits -= 32;\n i++;\n }\n return ret;\n }\n function getLegalLiterals(text, bits) {\n var parsed = parseArbitraryInt(text, bits);\n var ret = new Array(Math.ceil(bits/32));\n var i = 0;\n while (bits > 0) {\n ret[i] = { intertype: 'value', ident: (parsed[i]|0).toString(), bits: Math.min(32, bits), type: 'i' + Math.min(32, bits) }; // resign all values\n bits -= 32;\n i++;\n }\n return ret;\n }\n function getLegalStructuralParts(value) {\n return value.params.slice(0);\n }\n function getLegalParams(params, bits) {\n return params.map(function(param) {\n var value = param.value || param;\n if (isNumber(value.ident)) {\n return getLegalLiterals(value.ident, bits);\n } else if (value.intertype == 'structvalue') {\n return getLegalStructuralParts(value).map(function(part) {\n part.bits = part.type.substr(1); // can be some nested IR, like LLVM calls\n return part;\n });\n } else {\n return getLegalVars(value.ident, bits);\n }\n });\n }\n // Uses the right factor to multiply line numbers by so that they fit in between\n // the line[i] and the line after it\n function interpLines(lines, i, toAdd) {\n var prev = i >= 0 ? lines[i].lineNum : -1;\n var next = (i < lines.length-1) ? lines[i+1].lineNum : (lines[i].lineNum + 0.5);\n var factor = (next - prev)/(4*toAdd.length+3);\n for (var k = 0; k < toAdd.length; k++) {\n toAdd[k].lineNum = prev + ((k+1)*factor);\n assert(k == 0 || toAdd[k].lineNum > toAdd[k-1].lineNum);\n }\n }\n function removeAndAdd(lines, i, toAdd) {\n var item = lines[i];\n interpLines(lines, i, toAdd);\n Array.prototype.splice.apply(lines, [i, 1].concat(toAdd));\n if (i > 0) assert(lines[i].lineNum > lines[i-1].lineNum);\n if (i + toAdd.length < lines.length) assert(lines[i + toAdd.length - 1].lineNum < lines[i + toAdd.length].lineNum);\n return toAdd.length;\n }\n function legalizeFunctionParameters(params) {\n var i = 0;\n while (i < params.length) {\n var param = params[i];\n if (param.intertype == 'value' && isIllegalType(param.type)) {\n var toAdd = getLegalVars(param.ident, getBits(param.type)).map(function(element) {\n return {\n intertype: 'value',\n type: 'i' + element.bits,\n ident: element.ident,\n byval: 0\n };\n });\n Array.prototype.splice.apply(params, [i, 1].concat(toAdd));\n i += toAdd.length;\n continue;\n } else if (param.intertype == 'structvalue') {\n // 'flatten' out the struct into scalars\n var toAdd = param.params;\n toAdd.forEach(function(param) {\n param.byval = 0;\n });\n Array.prototype.splice.apply(params, [i, 1].concat(toAdd));\n continue; // do not increment i; proceed to process the new params\n }\n i++;\n }\n }\n function fixUnfolded(item) {\n // Unfolded items may need some correction to work properly in the global scope\n if (item.intertype in MATHOPS) {\n item.op = item.intertype;\n item.intertype = 'mathop';\n }\n }\n data.functions.forEach(function(func) {\n // Legalize function params\n legalizeFunctionParameters(func.params);\n // Legalize lines in labels\n var tempId = 0;\n func.labels.forEach(function(label) {\n if (dcheck('legalizer')) dprint('zz legalizing: \\n' + dump(label.lines));\n var i = 0, bits;\n while (i < label.lines.length) {\n var item = label.lines[i];\n var value = item;\n // Check if we need to legalize here, and do some trivial legalization along the way\n var isIllegal = false;\n walkInterdata(item, function(item) {\n if (item.intertype == 'getelementptr' || (item.intertype == 'call' && item.ident in LLVM.INTRINSICS_32)) {\n // Turn i64 args into i32\n for (var i = 0; i < item.params.length; i++) {\n if (item.params[i].type == 'i64') item.params[i].type = 'i32';\n }\n } else if (item.intertype == 'inttoptr') {\n var input = item.params[0];\n if (input.type == 'i64') input.type = 'i32'; // inttoptr can only care about 32 bits anyhow since pointers are 32-bit\n }\n if (isIllegalType(item.valueType) || isIllegalType(item.type)) {\n isIllegal = true;\n } else if ((item.intertype == 'load' || item.intertype == 'store') && isStructType(item.valueType)) {\n isIllegal = true; // storing an entire structure is illegal\n } else if (item.intertype == 'mathop' && item.op == 'trunc' && isIllegalType(item.params[1].ident)) { // trunc stores target value in second ident\n isIllegal = true;\n }\n });\n if (!isIllegal) {\n //if (dcheck('legalizer')) dprint('no need to legalize \\n' + dump(item));\n i++;\n continue;\n }\n // Unfold this line. If we unfolded, we need to return and process the lines we just\n // generated - they may need legalization too\n var unfolded = [];\n walkAndModifyInterdata(item, function(subItem) {\n // Unfold all non-value interitems that we can, and also unfold all numbers (doing the latter\n // makes it easier later since we can then assume illegal expressions are always variables\n // accessible through ident$x, and not constants we need to parse then and there)\n if (subItem != item && (!(subItem.intertype in UNUNFOLDABLE) ||\n (subItem.intertype == 'value' && isNumber(subItem.ident) && isIllegalType(subItem.type)))) {\n if (item.intertype == 'phi') {\n assert(subItem.intertype == 'value' || subItem.intertype == 'structvalue' || subItem.intertype in PARSABLE_LLVM_FUNCTIONS, 'We can only unfold some expressions in phis');\n // we must handle this in the phi itself, if we unfold normally it will not be pushed back with the phi\n } else {\n var tempIdent = '$$etemp$' + (tempId++);\n subItem.assignTo = tempIdent;\n unfolded.unshift(subItem);\n fixUnfolded(subItem);\n return { intertype: 'value', ident: tempIdent, type: subItem.type };\n }\n } else if (subItem.intertype == 'switch' && isIllegalType(subItem.type)) {\n subItem.switchLabels.forEach(function(switchLabel) {\n if (switchLabel.value[0] != '$') {\n var tempIdent = '$$etemp$' + (tempId++);\n unfolded.unshift({\n assignTo: tempIdent,\n intertype: 'value',\n ident: switchLabel.value,\n type: subItem.type\n });\n switchLabel.value = tempIdent;\n }\n });\n }\n });\n if (unfolded.length > 0) {\n interpLines(label.lines, i-1, unfolded);\n Array.prototype.splice.apply(label.lines, [i, 0].concat(unfolded));\n continue; // remain at this index, to unfold newly generated lines\n }\n // This is an illegal-containing line, and it is unfolded. Legalize it now\n dprint('legalizer', 'Legalizing ' + item.intertype + ' at line ' + item.lineNum);\n var finalizer = null;\n switch (item.intertype) {\n case 'store': {\n var toAdd = [];\n bits = getBits(item.valueType);\n var elements = getLegalParams([item.value], bits)[0];\n var j = 0;\n elements.forEach(function(element) {\n var tempVar = '$st$' + (tempId++) + '$' + j;\n toAdd.push({\n intertype: 'getelementptr',\n assignTo: tempVar,\n ident: item.pointer.ident,\n type: '[0 x i32]*',\n params: [\n { intertype: 'value', ident: item.pointer.ident, type: '[0 x i32]*' }, // technically a bitcase is needed in llvm, but not for us\n { intertype: 'value', ident: '0', type: 'i32' },\n { intertype: 'value', ident: j.toString(), type: 'i32' }\n ],\n });\n var actualSizeType = 'i' + element.bits; // The last one may be smaller than 32 bits\n toAdd.push({\n intertype: 'store',\n valueType: actualSizeType,\n value: { intertype: 'value', ident: element.ident, type: actualSizeType },\n pointer: { intertype: 'value', ident: tempVar, type: actualSizeType + '*' },\n ident: tempVar,\n pointerType: actualSizeType + '*',\n align: item.align,\n });\n j++;\n });\n Types.needAnalysis['[0 x i32]'] = 0;\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n // call, return: Return the first 32 bits, the rest are in temp\n case 'call': {\n var toAdd = [value];\n // legalize parameters\n legalizeFunctionParameters(value.params);\n // legalize return value, if any\n var returnType = getReturnType(item.type);\n if (value.assignTo && isIllegalType(returnType)) {\n bits = getBits(returnType);\n var elements = getLegalVars(item.assignTo, bits);\n // legalize return value\n value.assignTo = elements[0].ident;\n for (var j = 1; j < elements.length; j++) {\n var element = elements[j];\n toAdd.push({\n intertype: 'value',\n assignTo: element.ident,\n type: 'i' + element.bits,\n ident: 'tempRet' + (j - 1)\n });\n assert(j<10); // TODO: dynamically create more than 10 tempRet-s\n }\n }\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'landingpad': {\n // not much to legalize\n i++;\n continue;\n }\n case 'return': {\n bits = getBits(item.type);\n var elements = getLegalVars(item.value.ident, bits);\n item.value.ident = '(';\n for (var j = 1; j < elements.length; j++) {\n item.value.ident += 'tempRet' + (j-1) + '=' + elements[j].ident + ',';\n }\n item.value.ident += elements[0].ident + ')';\n i++;\n continue;\n }\n case 'invoke': {\n legalizeFunctionParameters(value.params);\n // We can't add lines after this, since invoke already modifies control flow. So we handle the return in invoke\n i++;\n continue;\n }\n case 'value': {\n bits = getBits(value.type);\n var elements = getLegalVars(item.assignTo, bits);\n var values = getLegalLiterals(item.ident, bits);\n var j = 0;\n var toAdd = elements.map(function(element) {\n return {\n intertype: 'value',\n assignTo: element.ident,\n type: 'i' + bits,\n ident: values[j++].ident\n };\n });\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'structvalue': {\n bits = getBits(value.type);\n var elements = getLegalVars(item.assignTo, bits);\n var toAdd = [];\n for (var j = 0; j < item.params.length; j++) {\n toAdd[j] = {\n intertype: 'value',\n assignTo: elements[j].ident,\n type: 'i32',\n ident: item.params[j].ident\n };\n }\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'load': {\n bits = getBits(value.valueType);\n var elements = getLegalVars(item.assignTo, bits);\n var j = 0;\n var toAdd = [];\n elements.forEach(function(element) {\n var tempVar = '$ld$' + (tempId++) + '$' + j;\n toAdd.push({\n intertype: 'getelementptr',\n assignTo: tempVar,\n ident: value.pointer.ident,\n type: '[0 x i32]*',\n params: [\n { intertype: 'value', ident: value.pointer.ident, type: '[0 x i32]*' }, // technically bitcast is needed in llvm, but not for us\n { intertype: 'value', ident: '0', type: 'i32' },\n { intertype: 'value', ident: j.toString(), type: 'i32' }\n ]\n });\n var newItem = {\n intertype: 'load',\n assignTo: element.ident,\n pointerType: 'i32*',\n valueType: 'i32',\n type: 'i32',\n pointer: { intertype: 'value', ident: tempVar, type: 'i32*' },\n ident: tempVar,\n align: value.align\n };\n var newItem2 = null;\n // The last one may be smaller than 32 bits\n if (element.bits < 32) {\n newItem.assignTo += '$preadd$';\n newItem2 = {\n intertype: 'mathop',\n op: 'and',\n assignTo: element.ident,\n type: 'i32',\n params: [{\n intertype: 'value',\n type: 'i32',\n ident: newItem.assignTo\n }, {\n intertype: 'value',\n type: 'i32',\n ident: (0xffffffff >>> (32 - element.bits)).toString()\n }],\n };\n }\n toAdd.push(newItem);\n if (newItem2) toAdd.push(newItem2);\n j++;\n });\n Types.needAnalysis['[0 x i32]'] = 0;\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'phi': {\n bits = getBits(value.type);\n var toAdd = [];\n var elements = getLegalVars(item.assignTo, bits);\n var j = 0;\n var values = getLegalParams(value.params, bits);\n elements.forEach(function(element) {\n var k = 0;\n toAdd.push({\n intertype: 'phi',\n assignTo: element.ident,\n type: 'i' + element.bits,\n params: value.params.map(function(param) {\n return {\n intertype: 'phiparam',\n label: param.label,\n value: values[k++][j]\n };\n })\n });\n j++;\n });\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'switch': {\n i++;\n continue; // special case, handled in makeComparison\n }\n case 'va_arg': {\n assert(value.type == 'i64');\n assert(value.value.type == 'i32*', value.value.type);\n i += removeAndAdd(label.lines, i, range(2).map(function(x) {\n return {\n intertype: 'va_arg',\n assignTo: value.assignTo + '$' + x,\n type: 'i32',\n value: {\n intertype: 'value',\n ident: value.value.ident, // We read twice from the same i32* var, incrementing // + '$' + x,\n type: 'i32*'\n }\n };\n }));\n continue;\n }\n case 'extractvalue': { // XXX we assume 32-bit alignment in extractvalue/insertvalue,\n // but in theory they can run on packed structs too (see use getStructuralTypePartBits)\n // potentially legalize the actual extracted value too if it is >32 bits, not just the extraction in general\n var index = item.indexes[0][0].text;\n var parts = getStructureTypeParts(item.type);\n var indexedType = parts[index];\n var targetBits = getBits(indexedType);\n var sourceBits = getBits(item.type);\n var elements = getLegalVars(item.assignTo, targetBits, true); // possibly illegal\n var sourceElements = getLegalVars(item.ident, sourceBits); // definitely illegal\n var toAdd = [];\n var sourceIndex = 0;\n for (var partIndex = 0; partIndex < parts.length; partIndex++) {\n if (partIndex == index) {\n for (var j = 0; j < elements.length; j++) {\n toAdd.push({\n intertype: 'value',\n assignTo: elements[j].ident,\n type: 'i' + elements[j].bits,\n ident: sourceElements[sourceIndex+j].ident\n });\n }\n break;\n }\n sourceIndex += getStructuralTypePartBits(parts[partIndex])/32;\n }\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'insertvalue': {\n var index = item.indexes[0][0].text; // the modified index\n var parts = getStructureTypeParts(item.type);\n var indexedType = parts[index];\n var indexBits = getBits(indexedType);\n var bits = getBits(item.type); // source and target\n bits = getBits(value.type);\n var toAdd = [];\n var elements = getLegalVars(item.assignTo, bits);\n var sourceElements = getLegalVars(item.ident, bits);\n var indexElements = getLegalVars(item.value.ident, indexBits, true); // possibly legal\n var sourceIndex = 0;\n for (var partIndex = 0; partIndex < parts.length; partIndex++) {\n var currNum = getStructuralTypePartBits(parts[partIndex])/32;\n for (var j = 0; j < currNum; j++) {\n toAdd.push({\n intertype: 'value',\n assignTo: elements[sourceIndex+j].ident,\n type: 'i' + elements[sourceIndex+j].bits,\n ident: partIndex == index ? indexElements[j].ident : sourceElements[sourceIndex+j].ident\n });\n }\n sourceIndex += currNum;\n }\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'bitcast': {\n var inType = item.type2;\n var outType = item.type;\n if ((inType in Runtime.INT_TYPES && outType in Runtime.FLOAT_TYPES) ||\n (inType in Runtime.FLOAT_TYPES && outType in Runtime.INT_TYPES)) {\n i++;\n continue; // special case, handled in processMathop\n }\n // fall through\n }\n case 'inttoptr': case 'ptrtoint': case 'zext': case 'sext': case 'trunc': case 'ashr': case 'lshr': case 'shl': case 'or': case 'and': case 'xor': {\n value = {\n op: item.intertype,\n variant: item.variant,\n type: item.type,\n params: item.params\n };\n // fall through\n }\n case 'mathop': {\n var toAdd = [];\n var sourceBits = getBits(value.params[0].type);\n // All mathops can be parametrized by how many shifts we do, and how big the source is\n var shifts = 0;\n var targetBits = sourceBits;\n var processor = null;\n var signed = false;\n switch (value.op) {\n case 'ashr': {\n signed = true;\n // fall through\n }\n case 'lshr': {\n shifts = parseInt(value.params[1].ident);\n break;\n }\n case 'shl': {\n shifts = -parseInt(value.params[1].ident);\n break;\n }\n case 'sext': {\n signed = true;\n // fall through\n }\n case 'trunc': case 'zext': case 'ptrtoint': {\n targetBits = getBits(value.params[1] ? value.params[1].ident : value.type);\n break;\n }\n case 'inttoptr': {\n targetBits = 32;\n break;\n }\n case 'bitcast': {\n if (!sourceBits) {\n // we can be asked to bitcast doubles or such to integers, handle that as best we can (if it's a double that\n // was an x86_fp80, this code will likely break when called)\n sourceBits = targetBits = Runtime.getNativeTypeSize(value.params[0].type);\n warn('legalizing non-integer bitcast on ll #' + item.lineNum);\n }\n break;\n }\n case 'select': {\n sourceBits = targetBits = getBits(value.params[1].type);\n var params = getLegalParams(value.params.slice(1), sourceBits);\n processor = function(result, j) {\n return {\n intertype: 'mathop',\n op: 'select',\n type: 'i' + params[0][j].bits,\n params: [\n value.params[0],\n { intertype: 'value', ident: params[0][j].ident, type: 'i' + params[0][j].bits },\n { intertype: 'value', ident: params[1][j].ident, type: 'i' + params[1][j].bits }\n ]\n };\n };\n break;\n }\n case 'or': case 'and': case 'xor': case 'icmp': {\n var otherElements = getLegalVars(value.params[1].ident, sourceBits);\n processor = function(result, j) {\n return {\n intertype: 'mathop',\n op: value.op,\n variant: value.variant,\n type: 'i' + otherElements[j].bits,\n params: [\n result,\n { intertype: 'value', ident: otherElements[j].ident, type: 'i' + otherElements[j].bits }\n ]\n };\n };\n if (value.op == 'icmp') {\n if (sourceBits == 64) { // handle the i64 case in processMathOp, where we handle full i64 math\n i++;\n continue;\n }\n finalizer = function() {\n var ident = '';\n for (var i = 0; i < targetElements.length; i++) {\n if (i > 0) {\n switch(value.variant) {\n case 'eq': ident += '&'; break;\n case 'ne': ident += '|'; break;\n default: throw 'unhandleable illegal icmp: ' + value.variant;\n }\n }\n ident += targetElements[i].ident;\n }\n return {\n intertype: 'value',\n ident: ident,\n type: 'rawJS',\n assignTo: item.assignTo\n };\n }\n }\n break;\n }\n case 'add': case 'sub': case 'sdiv': case 'udiv': case 'mul': case 'urem': case 'srem': {\n if (sourceBits < 32) {\n // when we add illegal types like i24, we must work on the singleton chunks\n item.assignTo += '$0';\n item.params[0].ident += '$0';\n item.params[1].ident += '$0';\n }\n // fall through\n }\n case 'uitofp': case 'sitofp': case 'fptosi': case 'fptoui': {\n // We cannot do these in parallel chunks of 32-bit operations. We will handle these in processMathop\n i++;\n continue;\n }\n default: throw 'Invalid mathop for legalization: ' + [value.op, item.lineNum, dump(item)];\n }\n // Do the legalization\n var sourceElements = getLegalVars(value.params[0].ident, sourceBits, true);\n if (!isNumber(shifts)) {\n // We can't statically legalize this, do the operation at runtime TODO: optimize\n assert(sourceBits == 64, 'TODO: handle nonconstant shifts on != 64 bits');\n assert(PRECISE_I64_MATH, 'Must have precise i64 math for non-constant 64-bit shifts');\n Types.preciseI64MathUsed = 1;\n value.intertype = 'value';\n value.ident = makeVarDef(value.assignTo) + '$0=' +\n asmCoercion('_bitshift64' + value.op[0].toUpperCase() + value.op.substr(1) + '(' + \n asmCoercion(sourceElements[0].ident, 'i32') + ',' +\n asmCoercion(sourceElements[1].ident, 'i32') + ',' +\n asmCoercion(value.params[1].ident + '$0', 'i32') + ')', 'i32'\n ) + ';' +\n makeVarDef(value.assignTo) + '$1=tempRet0;';\n value.vars = [[value.assignTo + '$0', 'i32'], [value.assignTo + '$1', 'i32']];\n value.assignTo = null;\n i++;\n continue;\n }\n var targetElements = getLegalVars(item.assignTo, targetBits);\n var sign = shifts >= 0 ? 1 : -1;\n var shiftOp = shifts >= 0 ? 'shl' : 'lshr';\n var shiftOpReverse = shifts >= 0 ? 'lshr' : 'shl';\n var whole = shifts >= 0 ? Math.floor(shifts/32) : Math.ceil(shifts/32);\n var fraction = Math.abs(shifts % 32);\n if (signed) {\n var signedFill = {\n intertype: 'mathop',\n op: 'select',\n variant: 's',\n type: 'i32',\n params: [{\n intertype: 'mathop',\n op: 'icmp',\n variant: 'slt',\n type: 'i32',\n params: [\n { intertype: 'value', ident: sourceElements[sourceElements.length-1].ident, type: 'i' + Math.min(sourceBits, 32) },\n { intertype: 'value', ident: '0', type: 'i32' }\n ]\n },\n { intertype: 'value', ident: '-1', type: 'i32' },\n { intertype: 'value', ident: '0', type: 'i32' },\n ]\n };\n }\n for (var j = 0; j < targetElements.length; j++) {\n var inBounds = j + whole >= 0 && j + whole < sourceElements.length;\n var result;\n if (inBounds || !signed) {\n result = {\n intertype: 'value',\n ident: inBounds ? sourceElements[j + whole].ident : '0',\n type: 'i' + Math.min(sourceBits, 32),\n };\n if (j == 0 && sourceBits < 32) {\n // zext sign correction\n var result2 = {\n intertype: 'mathop',\n op: isUnsignedOp(value.op) ? 'zext' : 'sext',\n params: [result, {\n intertype: 'type',\n ident: 'i32',\n type: 'i' + sourceBits\n }],\n type: 'i32'\n };\n result = result2;\n }\n } else {\n // out of bounds and signed\n result = copy(signedFill);\n }\n if (fraction != 0) {\n var other;\n var otherInBounds = j + sign + whole >= 0 && j + sign + whole < sourceElements.length;\n if (otherInBounds || !signed) {\n other = {\n intertype: 'value',\n ident: otherInBounds ? sourceElements[j + sign + whole].ident : '0',\n type: 'i32',\n };\n } else {\n other = copy(signedFill);\n }\n other = {\n intertype: 'mathop',\n op: shiftOp,\n type: 'i32',\n params: [\n other,\n { intertype: 'value', ident: (32 - fraction).toString(), type: 'i32' }\n ]\n };\n result = {\n intertype: 'mathop',\n // shifting in 1s from the top is a special case\n op: (signed && shifts >= 0 && j + sign + whole >= sourceElements.length) ? 'ashr' : shiftOpReverse,\n type: 'i32',\n params: [\n result,\n { intertype: 'value', ident: fraction.toString(), type: 'i32' }\n ]\n };\n result = {\n intertype: 'mathop',\n op: 'or',\n type: 'i32',\n params: [\n result,\n other\n ]\n }\n }\n if (targetElements[j].bits < 32 && shifts < 0) {\n // truncate bits that fall off the end. This is not needed in most cases, can probably be optimized out\n result = {\n intertype: 'mathop',\n op: 'and',\n type: 'i32',\n params: [\n result,\n { intertype: 'value', ident: (Math.pow(2, targetElements[j].bits)-1).toString(), type: 'i32' }\n ]\n }\n }\n if (processor) {\n result = processor(result, j);\n }\n result.assignTo = targetElements[j].ident;\n toAdd.push(result);\n }\n if (targetBits <= 32) {\n // We are generating a normal legal type here\n legalValue = { intertype: 'value', ident: targetElements[0].ident, type: 'i32' };\n if (targetBits < 32) {\n legalValue = {\n intertype: 'mathop',\n op: 'and',\n type: 'i32',\n params: [\n legalValue,\n { intertype: 'value', ident: (Math.pow(2, targetBits)-1).toString(), type: 'i32' }\n ]\n }\n };\n legalValue.assignTo = item.assignTo;\n toAdd.push(legalValue);\n } else if (finalizer) {\n toAdd.push(finalizer());\n }\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n }\n assert(0, 'Could not legalize illegal line: ' + [item.lineNum, dump(item)]);\n }\n if (dcheck('legalizer')) dprint('zz legalized: \\n' + dump(label.lines));\n });\n });\n }\n\n // Add function lines to func.lines, after our modifications to the label lines\n data.functions.forEach(function(func) {\n func.labels.forEach(function(label) {\n func.lines = func.lines.concat(label.lines);\n });\n });\n }\n\n function addTypeInternal(type) {\n if (type.length == 1) return;\n if (Types.types[type]) return;\n if (['internal', 'hidden', 'inbounds', 'void'].indexOf(type) != -1) return;\n if (Runtime.isNumberType(type)) return;\n dprint('types', 'Adding type: ' + type);\n\n // 'blocks': [14 x %struct.X] etc. If this is a pointer, we need\n // to look at the underlying type - it was not defined explicitly\n // anywhere else.\n var nonPointing = removeAllPointing(type);\n if (Types.types[nonPointing]) return;\n var check = /^\\[(\\d+)\\ x\\ (.*)\\]$/.exec(nonPointing);\n if (check) {\n var num = parseInt(check[1]);\n num = Math.max(num, 1); // [0 x something] is used not for allocations and such of course, but\n // for indexing - for an |array of unknown length|, basically. So we\n // define the 'type' as having a single field. TODO: Ensure as a sanity\n // check that we never allocate with this (either as a child structure\n // in the analyzer, or in calcSize in alloca).\n var subType = check[2];\n addTypeInternal(subType); // needed for anonymous structure definitions (see below)\n\n var fields = [subType, subType]; // Two, so we get the flatFactor right. We care about the flatFactor, not the size here. see calculateStructAlignment\n Types.types[nonPointing] = {\n name_: nonPointing,\n fields: fields,\n lineNum: '?'\n };\n newTypes[nonPointing] = 1;\n // Also add a |[0 x type]| type\n var zerod = '[0 x ' + subType + ']';\n if (!Types.types[zerod]) {\n Types.types[zerod] = {\n name_: zerod,\n fields: fields,\n lineNum: '?'\n };\n newTypes[zerod] = 1;\n }\n return;\n }\n\n // anonymous structure definition, for example |{ i32, i8*, void ()*, i32 }|\n if (type[0] == '{' || type[0] == '<') {\n type = nonPointing;\n var packed = type[0] == '<';\n var internal = type;\n if (packed) {\n if (type[1] !== '{') {\n // vector type, <4 x float> etc.\n var size = getVectorSize(type);\n Types.types[type] = {\n name_: type,\n fields: zeros(size).map(function() {\n return getVectorNativeType(type);\n }),\n packed: false,\n flatSize: 4*size,\n lineNum: '?'\n };\n return;\n }\n if (internal[internal.length-1] != '>') {\n warnOnce('ignoring type ' + internal);\n return; // function pointer or such\n }\n internal = internal.substr(1, internal.length-2);\n }\n assert(internal[0] == '{', internal);\n if (internal[internal.length-1] != '}') {\n warnOnce('ignoring type ' + internal);\n return; // function pointer or such\n }\n internal = internal.substr(2, internal.length-4);\n Types.types[type] = {\n name_: type,\n fields: splitTokenList(tokenize(internal)).map(function(segment) {\n return segment[0].text;\n }),\n packed: packed,\n lineNum: '?'\n };\n newTypes[type] = 1;\n return;\n }\n\n if (isPointerType(type)) return;\n if (['['].indexOf(type) != -1) return;\n Types.types[type] = {\n name_: type,\n fields: [ 'i' + (QUANTUM_SIZE*8) ], // a single quantum size\n flatSize: 1,\n lineNum: '?'\n };\n newTypes[type] = 1;\n }\n\n function addType(type) {\n addTypeInternal(type);\n if (QUANTUM_SIZE === 1) {\n Types.flipTypes();\n addTypeInternal(type);\n Types.flipTypes();\n }\n }\n\n // Typevestigator\n function typevestigator() {\n if (sidePass) { // Do not investigate in the main pass - it is only valid to start to do so in the first side pass,\n // which handles type definitions, and later. Doing so before the first side pass will result in\n // making bad guesses about types which are actually defined\n for (var type in Types.needAnalysis) {\n if (type) addType(type);\n }\n Types.needAnalysis = {};\n }\n }\n\n // Type analyzer\n function analyzeTypes(fatTypes) {\n var types = Types.types;\n\n // 'fields' is the raw list of LLVM fields. However, we embed\n // child structures into parent structures, basically like C.\n // So { int, { int, int }, int } would be represented as\n // an Array of 4 ints. getelementptr on the parent would take\n // values 0, 1, 2, where 2 is the entire middle structure.\n // We also need to be careful with getelementptr to child\n // structures - we return a pointer to the same slab, just\n // a different offset. Likewise, need to be careful for\n // getelementptr of 2 (the last int) - it's real index is 4.\n // The benefit of this approach is inheritance -\n // { { ancestor } , etc. } = descendant\n // In this case it is easy to bitcast ancestor to descendant\n // pointers - nothing needs to be done. If the ancestor were\n // a new slab, it would need some pointer to the outer one\n // for casting in that direction.\n // TODO: bitcasts of non-inheritance cases of embedding (not at start)\n var more = true;\n while (more) {\n more = false;\n for (var typeName in newTypes) {\n var type = types[typeName];\n if (type.flatIndexes) continue;\n var ready = true;\n type.fields.forEach(function(field) {\n if (isStructType(field)) {\n if (!types[field]) {\n addType(field);\n ready = false;\n } else {\n if (!types[field].flatIndexes) {\n newTypes[field] = 1;\n ready = false;\n }\n }\n }\n });\n if (!ready) {\n more = true;\n continue;\n }\n\n Runtime.calculateStructAlignment(type);\n\n if (dcheck('types')) dprint('type (fat=' + !!fatTypes + '): ' + type.name_ + ' : ' + JSON.stringify(type.fields));\n if (dcheck('types')) dprint(' has final size of ' + type.flatSize + ', flatting: ' + type.needsFlattening + ' ? ' + (type.flatFactor ? type.flatFactor : JSON.stringify(type.flatIndexes)));\n }\n }\n\n if (QUANTUM_SIZE === 1 && !fatTypes) {\n Types.flipTypes();\n // Fake a quantum size of 4 for fat types. TODO: Might want non-4 for some reason?\n var trueQuantumSize = QUANTUM_SIZE;\n Runtime.QUANTUM_SIZE = 4;\n analyzeTypes(true);\n Runtime.QUANTUM_SIZE = trueQuantumSize;\n Types.flipTypes();\n }\n\n newTypes = null;\n }\n \n // Variable analyzer\n function variableAnalyzer() {\n // Globals\n\n var old = item.globalVariables;\n item.globalVariables = {};\n old.forEach(function(variable) {\n variable.impl = 'emulated'; // All global variables are emulated, for now. Consider optimizing later if useful\n item.globalVariables[variable.ident] = variable;\n });\n\n // Function locals\n\n item.functions.forEach(function(func) {\n func.variables = {};\n\n // LLVM is SSA, so we always have a single assignment/write. We care about\n // the reads/other uses.\n\n // Function parameters\n func.params.forEach(function(param) {\n if (param.intertype !== 'varargs') {\n if (func.variables[param.ident]) warn('cannot have duplicate variable names: ' + param.ident); // toNiceIdent collisions?\n func.variables[param.ident] = {\n ident: param.ident,\n type: param.type,\n origin: 'funcparam',\n lineNum: func.lineNum,\n rawLinesIndex: -1\n };\n }\n });\n\n // Normal variables\n func.lines.forEach(function(item, i) {\n if (item.assignTo) {\n if (func.variables[item.assignTo]) warn('cannot have duplicate variable names: ' + item.assignTo); // toNiceIdent collisions?\n var variable = func.variables[item.assignTo] = {\n ident: item.assignTo,\n type: item.type,\n origin: item.intertype,\n lineNum: item.lineNum,\n rawLinesIndex: i\n };\n if (variable.origin === 'alloca') {\n variable.allocatedNum = item.ident;\n }\n if (variable.origin === 'call') {\n variable.type = getReturnType(variable.type);\n }\n }\n });\n\n if (QUANTUM_SIZE === 1) {\n // Second pass over variables - notice when types are crossed by bitcast\n\n func.lines.forEach(function(item) {\n if (item.assignTo && item.intertype === 'bitcast') {\n // bitcasts are unique in that they convert one pointer to another. We\n // sometimes need to know the original type of a pointer, so we save that.\n //\n // originalType is the type this variable is created from\n // derivedTypes are the types that this variable is cast into\n func.variables[item.assignTo].originalType = item.type2;\n\n if (!isNumber(item.assignTo)) {\n if (!func.variables[item.assignTo].derivedTypes) {\n func.variables[item.assignTo].derivedTypes = [];\n }\n func.variables[item.assignTo].derivedTypes.push(item.type);\n }\n }\n });\n }\n\n // Analyze variable uses\n\n function analyzeVariableUses() {\n dprint('vars', 'Analyzing variables for ' + func.ident + '\\n');\n\n for (vname in func.variables) {\n var variable = func.variables[vname];\n\n // Whether the value itself is used. For an int, always yes. For a pointer,\n // we might never use the pointer's value - we might always just store to it /\n // read from it. If so, then we can optimize away the pointer.\n variable.hasValueTaken = false;\n\n variable.pointingLevels = pointingLevels(variable.type);\n\n variable.uses = 0;\n }\n\n // TODO: improve the analysis precision. bitcast, for example, means we take the value, but perhaps we only use it to load/store\n var inNoop = 0;\n func.lines.forEach(function(line) {\n walkInterdata(line, function(item) {\n if (item.intertype == 'noop') inNoop++;\n if (!inNoop) {\n if (item.ident in func.variables) {\n func.variables[item.ident].uses++;\n\n if (item.intertype != 'load' && item.intertype != 'store') {\n func.variables[item.ident].hasValueTaken = true;\n }\n }\n }\n }, function(item) {\n if (item.intertype == 'noop') inNoop--;\n });\n });\n\n //if (dcheck('vars')) dprint('analyzed variables: ' + dump(func.variables));\n }\n\n analyzeVariableUses();\n\n // Decision time\n\n for (vname in func.variables) {\n var variable = func.variables[vname];\n var pointedType = pointingLevels(variable.type) > 0 ? removePointing(variable.type) : null;\n if (variable.origin == 'getelementptr') {\n // Use our implementation that emulates pointers etc.\n // TODO Can we perhaps nativize some of these? However to do so, we need to discover their\n // true types; we have '?' for them now, as they cannot be discovered in the intertyper.\n variable.impl = VAR_EMULATED;\n } else if (variable.origin == 'funcparam') {\n variable.impl = VAR_EMULATED;\n } else if (variable.type == 'i64*' && USE_TYPED_ARRAYS == 2) {\n variable.impl = VAR_EMULATED;\n } else if (MICRO_OPTS && variable.pointingLevels === 0) {\n // A simple int value, can be implemented as a native variable\n variable.impl = VAR_NATIVE;\n } else if (MICRO_OPTS && variable.origin === 'alloca' && !variable.hasValueTaken &&\n variable.allocatedNum === 1 &&\n (Runtime.isNumberType(pointedType) || Runtime.isPointerType(pointedType))) {\n // A pointer to a value which is only accessible through this pointer. Basically\n // a local value on the stack, which nothing fancy is done on. So we can\n // optimize away the pointing altogether, and just have a native variable\n variable.impl = VAR_NATIVIZED;\n } else {\n variable.impl = VAR_EMULATED;\n }\n if (dcheck('vars')) dprint('// var ' + vname + ': ' + JSON.stringify(variable));\n }\n });\n }\n\n // Sign analyzer\n //\n // Analyze our variables and detect their signs. In USE_TYPED_ARRAYS == 2,\n // we can read signed or unsigned values and prevent the need for signing\n // corrections. If on the other hand we are doing corrections anyhow, then\n // we can skip this pass.\n //\n // For each variable that is the result of a Load, we look a little forward\n // to see where it is used. We only care about mathops, since only they\n // need signs.\n //\n function signalyzer() {\n if (USE_TYPED_ARRAYS != 2 || CORRECT_SIGNS == 1) return;\n\n function seekIdent(item, obj) {\n if (item.ident === obj.ident) {\n obj.found++;\n }\n }\n\n function seekMathop(item, obj) {\n if (item.intertype === 'mathop' && obj.found && !obj.decided) {\n if (isUnsignedOp(item.op, item.variant)) {\n obj.unsigned++;\n } else {\n obj.signed++;\n }\n }\n }\n\n item.functions.forEach(function(func) {\n func.lines.forEach(function(line, i) {\n if (line.intertype === 'load') {\n // Floats have no concept of signedness. Mark them as 'signed', which is the default, for which we do nothing\n if (line.type in Runtime.FLOAT_TYPES) {\n line.unsigned = false;\n return;\n }\n // Booleans are always unsigned\n var data = func.variables[line.assignTo];\n if (data.type === 'i1') {\n line.unsigned = true;\n return;\n }\n\n var total = data.uses;\n if (total === 0) return;\n var obj = { ident: line.assignTo, found: 0, unsigned: 0, signed: 0, total: total };\n // in loops with phis, we can also be used *before* we are defined\n var j = i-1, k = i+1;\n while(1) {\n assert(j >= 0 || k < func.lines.length, 'Signalyzer ran out of space to look for sign indications for line ' + line.lineNum);\n if (j >= 0 && walkInterdata(func.lines[j], seekIdent, seekMathop, obj)) break;\n if (k < func.lines.length && walkInterdata(func.lines[k], seekIdent, seekMathop, obj)) break;\n if (obj.total && obj.found >= obj.total) break; // see comment below\n j -= 1;\n k += 1;\n }\n\n // unsigned+signed might be < total, since the same ident can appear multiple times in the same mathop.\n // found can actually be > total, since we currently have the same ident in a GEP (see cubescript test)\n // in the GEP item, and a child item (we have the ident copied onto the GEP item as a convenience).\n // probably not a bug-causer, but FIXME. see also a reference to this above\n // we also leave the loop above potentially early due to this. otherwise, though, we end up scanning the\n // entire function in some cases which is very slow\n assert(obj.found >= obj.total, 'Could not Signalyze line ' + line.lineNum);\n line.unsigned = obj.unsigned > 0;\n dprint('vars', 'Signalyzer: ' + line.assignTo + ' has unsigned == ' + line.unsigned + ' (line ' + line.lineNum + ')');\n }\n });\n });\n }\n\n // Quantum fixer\n //\n // See settings.js for the meaning of QUANTUM_SIZE. The issue we fix here is,\n // to correct the .ll assembly code so that things work with QUANTUM_SIZE=1.\n //\n function quantumFixer() {\n if (QUANTUM_SIZE !== 1) return;\n\n // ptrs: the indexes of parameters that are pointers, whose originalType is what we want\n // bytes: the index of the 'bytes' parameter\n // TODO: malloc, realloc?\n var FIXABLE_CALLS = {\n 'memcpy': { ptrs: [0,1], bytes: 2 },\n 'memmove': { ptrs: [0,1], bytes: 2 },\n 'memset': { ptrs: [0], bytes: 2 },\n 'qsort': { ptrs: [0], bytes: 2 }\n };\n\n function getSize(types, type, fat) {\n if (types[type]) return types[type].flatSize;\n if (fat) {\n Runtime.QUANTUM_SIZE = 4;\n }\n var ret = Runtime.getNativeTypeSize(type);\n if (fat) {\n Runtime.QUANTUM_SIZE = 1;\n }\n return ret;\n }\n\n function getFlatIndexes(types, type) {\n if (types[type]) return types[type].flatIndexes;\n return [0];\n }\n\n item.functions.forEach(function(func) {\n function getOriginalType(param) {\n function get() {\n if (param.intertype === 'value' && !isNumber(param.ident)) {\n if (func.variables[param.ident]) {\n return func.variables[param.ident].originalType || null;\n } else {\n return item.globalVariables[param.ident].originalType;\n }\n } else if (param.intertype === 'bitcast') {\n return param.params[0].type;\n } else if (param.intertype === 'getelementptr') {\n if (param.params[0].type[0] === '[') return param.params[0].type;\n }\n return null;\n }\n var ret = get();\n if (ret && ret[0] === '[') {\n var check = /^\\[(\\d+)\\ x\\ (.*)\\]\\*$/.exec(ret);\n assert(check);\n ret = check[2] + '*';\n }\n return ret;\n }\n\n func.lines.forEach(function(line) {\n // Call\n if (line.intertype === 'call') {\n var funcIdent = LibraryManager.getRootIdent(line.ident.substr(1));\n var fixData = FIXABLE_CALLS[funcIdent];\n if (!fixData) return;\n var ptrs = fixData.ptrs.map(function(ptr) { return line.params[ptr] });\n var bytes = line.params[fixData.bytes].ident;\n\n // Only consider original types. This assumes memcpy always has pointers bitcast to i8*\n var originalTypes = ptrs.map(getOriginalType);\n for (var i = 0; i < originalTypes.length; i++) {\n if (!originalTypes[i]) return;\n }\n originalTypes = originalTypes.map(function(type) { return removePointing(type) });\n var sizes = originalTypes.map(function(type) { return getSize(Types.types, type) });\n var fatSizes = originalTypes.map(function(type) { return getSize(Types.fatTypes, type, true) });\n // The sizes may not be identical, if we copy a descendant class into a parent class. We use\n // the smaller size in that case. However, this may also be a bug, it is hard to tell, hence a warning\n warn(dedup(sizes).length === 1, 'All sizes should probably be identical here: ' + dump(originalTypes) + ':' + dump(sizes) + ':' +\n line.lineNum);\n warn(dedup(fatSizes).length === 1, 'All fat sizes should probably be identical here: ' + dump(originalTypes) + ':' + dump(sizes) + ':' +\n line.lineNum);\n var size = Math.min.apply(null, sizes);\n var fatSize = Math.min.apply(null, fatSizes);\n if (isNumber(bytes)) {\n // Figure out how much to copy.\n var fixedBytes;\n if (bytes % fatSize === 0) {\n fixedBytes = size*(bytes/fatSize);\n } else if (fatSize % bytes === 0 && size % (fatSize/bytes) === 0) {\n // Assume this is a simple array. XXX We can be wrong though! See next TODO\n fixedBytes = size/(fatSize/bytes);\n } else {\n // Just part of a structure. Align them to see how many fields. Err on copying more.\n // TODO: properly generate a complete structure, including nesteds, and calculate on that\n var flatIndexes = getFlatIndexes(Types.types, originalTypes[0]).concat(size);\n var fatFlatIndexes = getFlatIndexes(Types.fatTypes, originalTypes[0]).concat(fatSize);\n var index = 0;\n var left = bytes;\n fixedBytes = 0;\n while (left > 0) {\n left -= fatFlatIndexes[index+1] - fatFlatIndexes[index]; // note: we copy the alignment bytes too, which is unneeded\n fixedBytes += flatIndexes[index+1] - flatIndexes[index];\n }\n }\n line.params[fixData.bytes].ident = fixedBytes;\n } else {\n line.params[fixData.bytes].intertype = 'jsvalue';\n // We have an assertion in library::memcpy() that this is round\n line.params[fixData.bytes].ident = size + '*(' + bytes + '/' + fatSize + ')';\n }\n }\n });\n });\n\n // 2nd part - fix hardcoded constant offsets in global constants\n values(item.globalVariables).forEach(function(variable) {\n function recurse(item) {\n if (item.contents) {\n item.contents.forEach(recurse);\n } else if (item.intertype === 'getelementptr' && item.params[0].intertype === 'bitcast' && item.params[0].type === 'i8*') {\n var originalType = removePointing(item.params[0].params[0].type);\n var fatSize = getSize(Types.fatTypes, originalType, true);\n var slimSize = getSize(Types.types, originalType, false);\n assert(fatSize % slimSize === 0);\n item.params.slice(1).forEach(function(param) {\n if (param.intertype === 'value' && isNumber(param.ident)) {\n var corrected = parseInt(param.ident)/(fatSize/slimSize);\n assert(corrected % 1 === 0);\n param.ident = corrected.toString();\n }\n });\n } else if (item.params) {\n item.params.forEach(recurse);\n }\n }\n if (!variable.external && variable.value) recurse(variable.value);\n });\n }\n\n function operateOnLabels(line, func) {\n function process(item, id) {\n ['label', 'labelTrue', 'labelFalse', 'toLabel', 'unwindLabel', 'defaultLabel'].forEach(function(id) {\n if (item[id]) {\n func(item, id);\n }\n });\n }\n if (line.intertype in BRANCH_INVOKE) {\n process(line);\n } else if (line.intertype == 'switch') {\n process(line);\n line.switchLabels.forEach(process);\n }\n }\n\n // Label analyzer\n function labelAnalyzer() {\n item.functions.forEach(function(func) {\n func.labelsDict = {};\n func.labelIds = {};\n func.labelIdsInverse = {};\n func.labelIdCounter = 1;\n func.labels.forEach(function(label) {\n if (!(label.ident in func.labelIds)) {\n func.labelIds[label.ident] = func.labelIdCounter++;\n func.labelIdsInverse[func.labelIdCounter-1] = label.ident;\n }\n });\n var entryIdent = func.labels[0].ident;\n\n // Minify label ids to numeric ids.\n func.labels.forEach(function(label) {\n label.ident = func.labelIds[label.ident];\n label.lines.forEach(function(line) {\n operateOnLabels(line, function(item, id) {\n item[id] = func.labelIds[item[id]].toString(); // strings, because we will append as we process\n });\n });\n });\n\n func.labels.forEach(function(label) {\n func.labelsDict[label.ident] = label;\n });\n\n // Correct phis\n func.labels.forEach(function(label) {\n label.lines.forEach(function(phi) {\n if (phi.intertype == 'phi') {\n for (var i = 0; i < phi.params.length; i++) {\n phi.params[i].label = func.labelIds[phi.params[i].label];\n if (VERBOSE && !phi.params[i].label) warn('phi refers to nonexistent label on line ' + phi.lineNum);\n }\n }\n });\n });\n\n func.lines.forEach(function(line) {\n if (line.intertype == 'indirectbr') {\n func.forceEmulated = true;\n }\n });\n\n function getActualLabelId(labelId) {\n if (func.labelsDict[labelId]) return labelId;\n // If not present, it must be a surprisingly-named entry (or undefined behavior, in which case, still ok to use the entry)\n labelId = func.labelIds[entryIdent];\n assert(func.labelsDict[labelId]);\n return labelId;\n }\n\n // Basic longjmp support, see library.js setjmp/longjmp\n var setjmp = toNiceIdent('@setjmp');\n func.setjmpTable = null;\n for (var i = 0; i < func.labels.length; i++) {\n var label = func.labels[i];\n for (var j = 0; j < label.lines.length; j++) {\n var line = label.lines[j];\n if ((line.intertype == 'call' || line.intertype == 'invoke') && line.ident == setjmp) {\n if (line.intertype == 'invoke') {\n // setjmp cannot trigger unwinding, so just reduce the invoke to a call + branch\n line.intertype = 'call';\n label.lines.push({\n intertype: 'branch',\n label: line.toLabel,\n lineNum: line.lineNum + 0.01, // XXX legalizing might confuse this\n });\n line.toLabel = line.unwindLabel = -2;\n }\n // split this label into up to the setjmp (including), then a new label for the rest. longjmp will reach the rest\n var oldLabel = label.ident;\n var newLabel = func.labelIdCounter++;\n if (!func.setjmpTable) func.setjmpTable = [];\n func.setjmpTable.push({ oldLabel: oldLabel, newLabel: newLabel, assignTo: line.assignTo });\n func.labels.splice(i+1, 0, {\n intertype: 'label',\n ident: newLabel,\n lineNum: label.lineNum + 0.5,\n lines: label.lines.slice(j+1)\n });\n func.labelsDict[newLabel] = func.labels[i+1];\n label.lines = label.lines.slice(0, j+1);\n label.lines.push({\n intertype: 'branch',\n label: toNiceIdent(newLabel),\n lineNum: line.lineNum + 0.01, // XXX legalizing might confuse this\n });\n // Correct phis\n func.labels.forEach(function(label) {\n label.lines.forEach(function(phi) {\n if (phi.intertype == 'phi') {\n for (var i = 0; i < phi.params.length; i++) {\n var sourceLabelId = getActualLabelId(phi.params[i].label);\n if (sourceLabelId == oldLabel) {\n phi.params[i].label = newLabel;\n }\n }\n }\n });\n });\n }\n }\n }\n if (func.setjmpTable) {\n func.forceEmulated = true;\n recomputeLines(func);\n }\n\n // Properly implement phis, by pushing them back into the branch\n // that leads to here. We will only have the |var| definition in this location.\n\n // First, push phis back\n func.labels.forEach(function(label) {\n label.lines.forEach(function(phi) {\n if (phi.intertype == 'phi') {\n for (var i = 0; i < phi.params.length; i++) {\n var param = phi.params[i];\n if (VERBOSE && !param.label) warn('phi refers to nonexistent label on line ' + phi.lineNum);\n var sourceLabelId = getActualLabelId(param.label);\n if (sourceLabelId) {\n var sourceLabel = func.labelsDict[sourceLabelId];\n var lastLine = sourceLabel.lines.slice(-1)[0];\n assert(lastLine.intertype in LLVM.PHI_REACHERS, 'Only some can lead to labels with phis:' + [func.ident, label.ident, lastLine.intertype]);\n if (!lastLine.phi) {\n lastLine.phi = true;\n assert(!lastLine.dependent);\n lastLine.dependent = {\n intertype: 'phiassigns',\n params: []\n };\n };\n lastLine.dependent.params.push({\n intertype: 'phiassign',\n ident: phi.assignTo,\n value: param.value,\n targetLabel: label.ident\n });\n }\n }\n // The assign to phi is now just a var\n phi.intertype = 'var';\n phi.ident = phi.assignTo;\n phi.assignTo = null;\n }\n });\n });\n\n if (func.ident in NECESSARY_BLOCKADDRS) {\n Functions.blockAddresses[func.ident] = {};\n for (var needed in NECESSARY_BLOCKADDRS[func.ident]) {\n assert(needed in func.labelIds);\n Functions.blockAddresses[func.ident][needed] = func.labelIds[needed];\n }\n }\n });\n }\n\n // Stack analyzer - calculate the base stack usage\n function stackAnalyzer() {\n data.functions.forEach(function(func) {\n var lines = func.labels[0].lines;\n var hasAlloca = false;\n for (var i = 0; i < lines.length; i++) {\n var item = lines[i];\n if (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.ident)) break;\n item.allocatedSize = func.variables[item.assignTo].impl === VAR_EMULATED ?\n calcAllocatedSize(item.allocatedType)*item.ident: 0;\n hasAlloca = true;\n if (USE_TYPED_ARRAYS === 2) {\n // We need to keep the stack aligned\n item.allocatedSize = Runtime.forceAlign(item.allocatedSize, Runtime.STACK_ALIGN);\n }\n }\n var index = 0;\n for (var i = 0; i < lines.length; i++) {\n var item = lines[i];\n if (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.ident)) break;\n item.allocatedIndex = index;\n index += item.allocatedSize;\n delete item.allocatedSize;\n }\n func.initialStack = index;\n func.otherStackAllocations = false;\n if (func.initialStack === 0 && hasAlloca) func.otherStackAllocations = true; // a single alloca of zero still requires us to emit stack support code\n while (func.initialStack == 0) { // one-time loop with possible abort in the middle\n // If there is no obvious need for stack management, perhaps we don't need it\n // (we try to optimize that way with SKIP_STACK_IN_SMALL). However,\n // we need to note if stack allocations other than initial allocs can happen here\n // If so, we need to rewind the stack when we leave.\n\n // By-value params are causes of additional allocas (although we could in theory make them normal allocas too)\n func.params.forEach(function(param) {\n if (param.byVal) {\n func.otherStackAllocations = true;\n }\n });\n if (func.otherStackAllocations) break;\n\n // Allocas\n var finishedInitial = false;\n\n lines = func.lines; // We need to consider all the function lines now, not just the first label\n\n for (var i = 0; i < lines.length; i++) {\n var item = lines[i];\n if (!finishedInitial && (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.ident))) {\n finishedInitial = true;\n }\n if (item.intertype == 'alloca' && finishedInitial) {\n func.otherStackAllocations = true;\n break;\n }\n }\n if (func.otherStackAllocations) break;\n\n // Varargs\n for (var i = 0; i < lines.length; i++) {\n var item = lines[i];\n if (item.intertype == 'call' && isVarArgsFunctionType(item.type)) {\n func.otherStackAllocations = true;\n break;\n }\n }\n if (func.otherStackAllocations) break;\n\n break;\n }\n });\n }\n\n // ReLooper - reconstruct nice loops, as much as possible\n // This is now done in the jsify stage, using compiled relooper2\n function relooper() {\n function makeBlock(labels, entries, labelsDict, forceEmulated) {\n if (labels.length == 0) return null;\n dprint('relooping', 'prelooping: ' + entries + ',' + labels.length + ' labels');\n assert(entries && entries[0]); // need at least 1 entry\n\n var emulated = {\n type: 'emulated',\n id: 'B',\n labels: labels,\n entries: entries.slice(0)\n };\n return emulated;\n }\n item.functions.forEach(function(func) {\n dprint('relooping', \"// relooping function: \" + func.ident);\n func.block = makeBlock(func.labels, [func.labels[0].ident], func.labelsDict, func.forceEmulated);\n });\n }\n\n // main\n castAway();\n legalizer();\n typevestigator();\n analyzeTypes();\n variableAnalyzer();\n signalyzer();\n quantumFixer();\n labelAnalyzer();\n stackAnalyzer();\n relooper();\n\n //B.stop('analyzer');\n return item;\n}", "function makeAreasDropable(){\r\n // When a block is dropped, check the value and type global data variables\r\n // and append the appropriate block to that container.\r\n\r\n var blockBank = document.getElementById(\"block-bank\");\r\n var inBlock1 = document.getElementById(\"input-block-1\");\r\n var opBlock = document.getElementById(\"operator-block\");\r\n var inBlock2 = document.getElementById(\"input-block-2\");\r\n let list = [inBlock1,inBlock2,blockBank,opBlock];\r\n list.forEach(function(item){\r\n item.addEventListener(\"dragover\",function(event){\r\n event.preventDefault();\r\n });\r\n item.addEventListener(\"drop\",function(event){\r\n event.preventDefault();\r\n dropBlock(event);\r\n });\r\n })\r\n\r\n}", "function withTypeChecking(\n env, // :: Array Type\n typeInfo, // :: TypeInfo\n impl // :: Function\n ) {\n var n = typeInfo.types.length - 1;\n\n // wrapFunctionCond :: (TypeVarMap, Integer, a) -> a\n function wrapFunctionCond(_typeVarMap, index, value) {\n var expType = typeInfo.types[index];\n if (expType.type !== FUNCTION) return value;\n\n // checkValue :: (TypeVarMap, Integer, String, a) -> Either (() -> Error) TypeVarMap\n function checkValue(typeVarMap, index, k, x) {\n var propPath = [k];\n var t = expType.types[k];\n return (\n t.type === VARIABLE ?\n Z.chain (\n function(typeVarMap) {\n return isEmpty (typeVarMap[t.name].types) ?\n Left (function() {\n return typeVarConstraintViolation (\n env,\n typeInfo,\n index,\n propPath,\n typeVarMap[t.name].valuesByPath\n );\n }) :\n Right (typeVarMap);\n },\n Right (updateTypeVarMap (env,\n typeVarMap,\n t,\n index,\n propPath,\n [x]))\n ) :\n // else\n Z.map (\n function(r) { return r.typeVarMap; },\n satisfactoryTypes (env,\n typeInfo,\n typeVarMap,\n t,\n index,\n propPath,\n [x])\n )\n );\n }\n\n var typeVarMap = _typeVarMap;\n return function(x) {\n if (arguments.length !== expType.arity - 1) {\n throw invalidArgumentsLength (typeInfo,\n index,\n expType.arity - 1,\n slice.call (arguments));\n }\n\n var args = arguments;\n typeVarMap = assertRight (\n (init (expType.keys)).reduce (function(either, k, idx) {\n var arg = args[idx];\n return Z.chain (function(typeVarMap) {\n return checkValue (typeVarMap, index, k, arg);\n }, either);\n }, Right (typeVarMap))\n );\n\n var output = value.apply (this, arguments);\n var k = last (expType.keys);\n typeVarMap = assertRight (checkValue (typeVarMap, index, k, output));\n return output;\n };\n }\n\n // wrapNext :: (TypeVarMap, Array Any, Integer) -> (a -> b)\n function wrapNext(_typeVarMap, _values, index) {\n return function(x) {\n var args = slice.call (arguments);\n if (args.length !== 1) {\n throw invalidArgumentsCount (typeInfo, index, 1, args);\n }\n var typeVarMap = (assertRight (\n satisfactoryTypes (env,\n typeInfo,\n _typeVarMap,\n typeInfo.types[index],\n index,\n [],\n args)\n )).typeVarMap;\n\n var values = Z.concat (_values, args);\n if (index + 1 === n) {\n var value = values.reduce (function(f, x, idx) {\n return f (wrapFunctionCond (typeVarMap, idx, x));\n }, impl);\n typeVarMap = (assertRight (\n satisfactoryTypes (env,\n typeInfo,\n typeVarMap,\n typeInfo.types[n],\n n,\n [],\n [value])\n )).typeVarMap;\n return wrapFunctionCond (typeVarMap, n, value);\n } else {\n return wrapNext (typeVarMap, values, index + 1);\n }\n };\n }\n\n var wrapped = typeInfo.types[0].type === NO_ARGUMENTS ?\n function() {\n if (arguments.length !== 0) {\n throw invalidArgumentsCount (typeInfo, 0, 0, slice.call (arguments));\n }\n var value = impl ();\n var typeVarMap = (assertRight (\n satisfactoryTypes (env,\n typeInfo,\n {},\n typeInfo.types[n],\n n,\n [],\n [value])\n )).typeVarMap;\n return wrapFunctionCond (typeVarMap, n, value);\n } :\n wrapNext ({}, [], 0);\n\n wrapped[inspect] = wrapped.toString = always0 (typeSignature (typeInfo));\n\n return wrapped;\n }", "function setVal(block, type) {\n\tBlockly.Events.disable();\n\tblock.setDisabled(false);\n\tconst name = block.getFieldValue('NAME');\n\tif (name && name !== '' && !valDex[type[2]].has(name)) {\n\t\tconst subtype = type[2]==='mesh'?\n\t\t(type[3]==='group'?'GROUP':\n\t\t(type[3]==='from'?'IMPORT':'MESH')):block.getFieldValue('TYPE');\n\n\t\tvalDex[type[2]].set(name, [block.id, subtype]);\n\t\tBlockly.JavaScript.addReservedWords(type[2] + '_' + name);\n\t}\n\tBlockly.Events.enable();\n}", "function handleIt(type)\t{\n\t\t\t\t\tif(Number(sfo[index]) === 1)\t{\n\t\t\t\t\t\tr.push(index.replace('+','=')); // input name is navcat+.something, so simply changing + to = makes it macroesque-ready.\n\t\t\t\t\t\t}\n\t\t\t\t\t}", "function prepareTypedata(mytypedata) {\n typelabels = [];\n $.each(mytypedata.types, function (i, types) {\n typelabels.push(types.type)\n });\n typelabels = Array.from(new Set(typelabels));\n typedata = {\n 'labels': typelabels,\n 'datasets': []\n };\n datalabels = [];\n $.each(mytypedata.types, function (i, types) {\n datalabels.push(types.site)\n });\n datalabels = Array.from(new Set(datalabels));\n $.each(datalabels, function (i, label) {\n var typedatasets = {\n \"data\": [],\n \"label\": label\n };\n typedata.datasets.push(typedatasets);\n });\n $.each(typedata.datasets, function (i, dataset) {\n $.each(typedata.labels, function (i, label) {\n dataset.data.push(0)\n });\n });\n $.each(mytypedata.types, function (i, type) {\n mysite = type.site;\n mytype = type.type;\n mycount = type.count;\n $.each(typedata.labels, function (i, label) {\n if (mytype == label) {\n myindex = i;\n $.each(typedata.datasets, function (i, dataset) {\n if (dataset.label == mysite) {\n $.each(dataset.data, function (e, data) {\n if (e == myindex) {\n dataset.data[myindex] = mycount;\n }\n });\n }\n });\n }\n })\n });\n return typedata;\n}", "async function processVariableDeclaration(node) {\n // console.log(node);\n \n // Constant variables do not use storage.\n if(node.constant) return;\n\n // Print variable declaration.\n const declaration = getVariableDeclaration(node);\n console.log(declaration);\n // console.log(` offset: ${rightOffset}`);\n \n // Get variable type.\n const type = node.typeDescriptions.typeString;\n // console.log(` type: ${type}`);\n\n // Calculate variable size.\n const size = getVariableSize(type, web3);\n const sizeRemainingInWord = 64 - rightOffset;\n if(sizeRemainingInWord < size) advanceSlot(size);\n console.log(` size: ${size / 2} bytes`);\n \n // Read corresponding storage.\n console.log(` slot: ${slot}`);\n const raw = await web3.eth.getStorageAt(contractAddress, slot);\n const word = web3.utils.padLeft(raw, 64, '0').substring(2, 66);\n console.log(` word: ${word}`);\n\n // Read sub-word.\n const start = 64 - rightOffset - size;\n const end = start + size;\n let subword;\n if(type === 'string') subword = word.substring(start, end - 2);\n else subword = word.substring(start, end);\n console.log(` subword: ${subword}`);\n\n // Read value in word according to type.\n const value = getVariableValue(subword, type, web3);\n console.log(` value: ${value}`);\n\n advanceSlot(size);\n }", "function variableBlock(varName) {\n var newBlock = SpriteMorph.prototype.variableBlock(varName);\n newBlock.isDraggable = false;\n newBlock.isTemplate = true;\n return newBlock;\n }", "function handleBlock(startArr,startOffsetM,startOffsetNextM,destArr,destOffsetM,destOffsetNextM,undefined){// slice out the block we need\nvar startArrTemp=startArr.slice(startOffsetM,startOffsetNextM||undefined),destArrTemp=destArr.slice(destOffsetM,destOffsetNextM||undefined);var i=0,posStart={pos:[0,0],start:[0,0]},posDest={pos:[0,0],start:[0,0]};do{// convert shorthand types to long form\nstartArrTemp[i]=simplyfy.call(posStart,startArrTemp[i]);destArrTemp[i]=simplyfy.call(posDest,destArrTemp[i]);// check if both shape types match\n// 2 elliptical arc curve commands ('A'), are considered different if the\n// flags (large-arc-flag, sweep-flag) don't match\nif(startArrTemp[i][0]!=destArrTemp[i][0]||startArrTemp[i][0]=='M'||startArrTemp[i][0]=='A'&&(startArrTemp[i][4]!=destArrTemp[i][4]||startArrTemp[i][5]!=destArrTemp[i][5])){// if not, convert shapes to beziere\nArray.prototype.splice.apply(startArrTemp,[i,1].concat(toBeziere.call(posStart,startArrTemp[i])));Array.prototype.splice.apply(destArrTemp,[i,1].concat(toBeziere.call(posDest,destArrTemp[i])));}else{// only update positions otherwise\nstartArrTemp[i]=setPosAndReflection.call(posStart,startArrTemp[i]);destArrTemp[i]=setPosAndReflection.call(posDest,destArrTemp[i]);}// we are at the end at both arrays. stop here\nif(++i==startArrTemp.length&&i==destArrTemp.length)break;// destArray is longer. Add one element\nif(i==startArrTemp.length){startArrTemp.push(['C',posStart.pos[0],posStart.pos[1],posStart.pos[0],posStart.pos[1],posStart.pos[0],posStart.pos[1]]);}// startArr is longer. Add one element\nif(i==destArrTemp.length){destArrTemp.push(['C',posDest.pos[0],posDest.pos[1],posDest.pos[0],posDest.pos[1],posDest.pos[0],posDest.pos[1]]);}}while(true);// return the updated block\nreturn{start:startArrTemp,dest:destArrTemp};}// converts shorthand types to long form", "function local_change_type(input_object, new_type)\n {\n if(input_object instanceof new_type)\n return input_object;\n\n var new_object = new new_type();\n new_object.id_block = input_object.id_block;\n new_object.len_block = input_object.len_block;\n new_object.warnings = input_object.warnings;\n new_object.value_before_decode = util_copybuf(input_object.value_before_decode);\n\n return new_object;\n }", "function populatelayerObjects() {\n \n for (var i = 0; i < 4; i++) {\n // console.log(\"loop =\",j)\n new LayerObjectsConst(nameArray1[i], 1);\n }; // end suits loop\n for (var j = 0; j < 4; j++) {\n // console.log(\"loop =\",j)\n new LayerObjectsConst(nameArray2[j], 2);\n }; // end suits loop\n for (var k = 0; k < 4; k++) {\n // console.log(\"loop =\",j)\n new LayerObjectsConst(nameArray3[k], 3);\n }; // end suits loop\n\n\n}", "function _process(templates, params, cb) {\n var _templates = _.extend(templates, {}), // process template copies, not the originals\n tasks = {};\n\n _.keys(_templates).forEach(function (key) {\n tasks[key] = function (cb) {\n _templates[key].process(params, function (data) {\n cb(null, data);\n });\n };\n });\n\n async.parallel(tasks, function (err, results) {\n cb(results);\n });\n }", "function parseArrayItems(v, i, a) {\n\n\t\tif(checkForSpan(v)) {\n\t\t\t// is value a span class=\"code-line\"\n\t\t\tif(checkSpanForClassLine(v)) {\n\t\t\t\t// if not first currentSpanLine, set add block class to current Span Line before reassigning\n\t\t\t\tif(currentSpanLine) {\n\n\t\t\t\t\tsetTimeout(function(el) {\n\t\t\t\t\t\treturn function() {\n\t\t\t\t\t\t\taddCodeBlockClassToEL(el);\n\t\t\t\t\t\t}\n\t\t\t\t\t}(currentSpanLine), intervalTime+50);\n\n\t\t\t\t\t// currentSpanLine.addClass(\"code-block\");\n\t\t\t\t}\n\t\t\t\tcurrentSpanLine = $(v);\n\t\t\t\t// insert before txtCursor\n\t\t\t\ttxtCursorNode.before(currentSpanLine);\n\n\t\t\t} else {\n\t\t\t\t// insert span into current Span Line\n\t\t\t\tcurrentInnerSpan = $(v);\n\t\t\t\tcurrentSpanLine.append(currentInnerSpan);\n\t\t\t}\n\n\t\t} else { // will be a string of characters, insert them into currentInnerSpan\n\t\t\t// add each character in on at a time\n\t\t\tvar charInterval = v.length > 6 ? Math.floor( intervalTime/ v.length) : 100;\n\t\t\tfor(var j = 0; j < v.length; j++) {\n\t\t\t\tsetTimeout(function(ch) {\n\t\t\t\t\tvar character = ch;\n\t\t\t\t\treturn function() {\n\t\t\t\t\t\tcurrentInnerSpan.append(character);\n\t\t\t\t\t}\n\t\t\t\t}(v.charAt(j)), 0 + (charInterval * j));\n\t\t\t}\n\t\t\t// currentInnerSpan.html(v);\n\t\t}\n\n\t\t// if end of array add class code-block to currentSpanLine\n\t\tif(i == a.length - 1) {\n\t\t\t// setTimeout(addBlockToCurrentSpanLine, intervalTime);\n\t\t\t// currentSpanLine.addClass(\"code-block\");\n\t\t\t// setTimeout(codeContainerChildrenFade, 500);\n\n\t\t}\n\t}", "function changeTheWholeVarValueFromItsInitialOneFromVarForDictionary(struct_var, var_name, var_value){\n //// printf(\"#### changeTheWholeVarValueFromItsInitialOneFromFileForList ####\\n\");\n //// printf(\"#### \"++\", \"++\", \"++\" ####\\n\",file_name,var_name,var_value);\n //var row=0;\n var length=0;\n if (strcmp(struct_var[0].var_name,\"__size_of_array__\")!=0) {\n printf(\"@@ |\"+CURRENT_INPUT_STR+\"|\\n\");\n printf(\"Can not find __size_of_array__\");\n exit(0);\n }\n else{\n length=atoi(struct_var[0].var_value);\n }\n\n /*\n var temp_var_name=append(var_name, \"{\");\n while (row<length) {\n if (strcmp(var_name,struct_var[row].var_name)==0 || find(struct_var[row].var_name, temp_var_name)==0) {\n Var_removeVar(struct_var, struct_var[row].var_name);\n length--;\n row--;\n }\n row++;\n }\n */\n \n Var_removeVar(struct_var, var_name);\n\n \n writeVarNameAndVarValueIntoAppointedVarForDictionary(struct_var, var_name, var_value);\n}", "function taintConsequent(block, left, right) {\n\t// Loop through each line of the conditional body\n\tfor (j = 0; j < block.length; j++) {\n\t\t// If we are assigning variables, then propagate taint\n\t\tif (block[j].expression.type == \"AssignmentExpression\") {\n\t\t\tif (left.type == \"Identifier\") {\n\t\t\t\tvar cond1 = 'if (TSobjects.indexOf(\"' + left.name + '\") >= 0)';\n\t\t\t\tvar cond2 = '{TSobjects.push(\"' + block[j].expression.left.name +'\");}';\n\t\t\t\tblock.splice(j, 0, esprima.parse(cond1 + cond2));\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse if (right.type == \"Identifier\") {\n\t\t\t\tvar cond1 = 'if (TSobjects.indexOf(\"' + right.name + '\") >= 0)';\n\t\t\t\tvar cond2 = '{TSobjects.push(\"' + block[j].expression.left.name +'\");}';\n\t\t\t\tblock.splice(j, 0, esprima.parse(cond1 + cond2));\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t}\n}", "function standardizeLets(declars) {\n var _arr = declars;\n\n for (var _i = 0; _i < _arr.length; _i++) {\n var declar = _arr[_i];\n delete declar._let;\n }\n}", "function GetDataArray(type)\r\n{\r\n\tswitch(type)\r\n\t{\r\n\t\t// General\r\n\t\tcase \"typespoints\": return [5, 5, 1]; //wac\r\n\r\n\t\t// Default arguments\r\n\t\tcase \"defarg1\": return [50, 300, 1, 1, 1, 300, 300];\r\n\t\tcase \"defarg2\": return [300, 100, 100, 100, 100, 100, 100];\r\n\t\tcase \"defarg3\": return [100, 50, 10, 10, 10, 50, 50];\r\n\r\n\t\t// Weapons\r\n\t\tcase \"wpoints\": return [12, 7, 3, 3, 6, 5, 7, 7, 5, 4, 4];\r\n\t\tcase \"wdmg\": return [0.1, 0.25, 1.5, 2, 0.2, 4, 0.15, 0.35, 0.6, 3, 2.5];\r\n\t\tcase \"wrof\": return [2.5, 1.25, 0.25, 0.13, 2, 0.13, 1.5, 1, 0.5, 0.1, 0.15];\r\n\t\tcase \"wen\": return [1, 1.6, 2.2, 1, 2.5, 4, 1, 1.9, 1.4, 1.4, 2.2];\r\n\r\n\t\t// Weapon peculiarities\r\n\t\tcase \"wpeculpoints\": return [10, 10, 7, 8, 7, 9, 7, 6, 5, 7, 6, 4, 3, 1];\r\n\t\tcase \"wpeculdmg\": return [2, 0.5, 1.1, 1, 1.8, 0.7, 0.5, 1.5, 1, 1.2, 1.5, 2, 3.2, 5];\r\n\t\tcase \"wpeculrof\": return [0.7, 2.5, 1.1, 2, 0.9, 0.7, 0.3, 1, 2, 1.2, 1.5, 2, 3.2, 5];\r\n\t\tcase \"wpeculen\": return [1, 1, 0.7, 1.7, 0.8, 1, 0.8, 0.9, 0.9, 0.9, 0.8, 0.7, 0.6, 0.5];\r\n\r\n\t\t// Armors\r\n\t\tcase \"apoints\": return [10, 7, 6, 4, 4, 5, 4];\r\n\t\tcase \"afr\": return [50, 35, 80, 70, 10, 20, 70];\r\n\t\tcase \"abk\": return [10, 8, 20, 5, 10, 5, 70];\r\n\t\tcase \"awt\": return [5, 3, 9, 5, 1, 2, 11];\r\n\r\n\t\t// Armor peculiarities\r\n\t\tcase \"apeculpoints\": return [10, 9, 8, 8, 6, 5, 6, 4, 3, 2, 1];\r\n\t\tcase \"apeculfr\": return [1.5, 0.8, 0.7, 1.4, 0.9, 3, 0.5, 1.4, 2, 3.6, 5];\r\n\t\tcase \"apeculbk\": return [1.5, 0.8, 0.7, 1.2, 0.7, 0.3, 2, 1.4, 3.6, 5];\r\n\t\tcase \"apeculwt\": return [1.3, 0.8, 0.5, 1, 1, 1, 0.9, 0.9, 0.8, 0.7, 0.6];\r\n\r\n\t\t// Cores\r\n\t\tcase \"cpoints\": return [3, 4, 5, 4, 3];\r\n\t\tcase \"cen\": return [2.5, 4, 5, 8, 12];\r\n\t\tcase \"cwt\": return [40, 25, 20, 15, 12];\r\n\t\tcase \"cman\": return [20, 12, 10, 8, 4];\r\n\r\n\t\t// Cores peculiarities\r\n\t\tcase \"cpeculpoints\": return [10, 10, 10, 5, 3, 2, 1];\r\n\t\tcase \"cpeculen\": return [0.7, 0.8, 1.4, 0.7, 1.3, 1.6, 2];\r\n\t\tcase \"cpeculwt\": return [0.9, 1.2, 0.7, 0.7, 1.3, 1.6, 2];\r\n\t\tcase \"cpeculman\": return [1.4, 1, 0.8, 0.6, 1.3, 1.6, 2];\r\n\r\n\t\tdefault:\r\n\t\t\t{\r\n\t\t\t\tconsole.log('Default in a number database!');\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t}\r\n}", "gatherMatchingBlocks(matches) {\n this.nullifyMatchesInGridArray(matches);\n\n let beingSwapped = matches.filter(e => e.beingSwapped);\n const arrTypes = [...new Set(matches.map(m => m.id))];\n\n /* in this case this is automatch and we need to set target\n blocks for each match so that the rest of certain color can \n go to target block position\n */\n\n // array of all matches types... for example [\"ball_red\", \"ball_green\"] etc.\n for (let _id of arrTypes) {\n if (beingSwapped.map(m => m.id).includes(_id)) { continue; }\n console.log(_id);\n let currentMatchItems = matches.filter(e => e.id === _id);\n let central = Math.floor(currentMatchItems.length / 2);\n let centralItem = matches.indexOf(matches.find(m => m === currentMatchItems[central]));\n matches[centralItem].beingSwapped = true; //?? might cause problems!!!!\n beingSwapped.push(matches[centralItem]);\n }\n\n for (let m = 0; m < beingSwapped.length; m++) {\n let thisColorMatchesIds = matches.filter(e => e.id === beingSwapped[m].id);\n for (let e = 0; e < thisColorMatchesIds.length; e++) {\n let targetBlock = thisColorMatchesIds.filter(x => x.beingSwapped)[0];\n let tweenTarget = this.blocks[thisColorMatchesIds[e].row][thisColorMatchesIds[e].col];\n\n if (!thisColorMatchesIds[e].beingSwapped) {\n let newX = this.globalBlocksPositions[targetBlock.row][targetBlock.col].x;\n let newY = this.globalBlocksPositions[targetBlock.row][targetBlock.col].y;\n TweenMax.to(tweenTarget.blockImg, .2, {\n x: newX,\n y: newY,\n alpha: 0,\n ease: Linear.easeNone,\n onComplete: () => { }\n });\n }\n else {\n TweenMax.to(tweenTarget.blockImg, .2, {\n alpha: 0,\n delay: .2,\n onComplete: () => { }\n });\n }\n }\n }\n }", "function create_block(b, type) { // blockString\n\n const blockString = [\"rel\", \"comp\", \"pri\", \"xor\"];\n\n // get the critical sentence only for inference condition\n const utterance_mapper = {\n \"rel\": '',\n \"comp\": '',\n \"pri\": '',\n \"xor\": b.utterance_or,\n \"some\": b.utterance_imp\n };\n\n // let utterance = blockString == \"xor\" ? '<br /> ' + b.utterance_or : '';\n\n // first comprehension question block\n let t1 = {};\n t1.exp_condition = b.type;\n t1.relevance = b.relevance;\n t1.competence = b.competence;\n t1.prior = b.prior;\n t1.ID = b.ID;\n t1.main_type = type;\n t1.title = b.name;\n t1.QUD = b.background;\n t1.critical_question = ``;\n t1.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t1.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t1.condition = \"test\";\n t1.block = 'test_question1';\n t1.prompt = '<b>' + b.allQ[block_mapper[blockString[0]]] + '</b>';\n t1.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n test_Q_used(b, t1, type, 1);\n\n// relevance question block\n let t2 = {};\n t2.exp_condition = b.type;\n t2.relevance = b.relevance;\n t2.competence = b.competence;\n t2.prior = b.prior;\n t2.ID = b.ID;\n t2.main_type = type;\n t2.title = b.name;\n t2.QUD = b.background;\n t2.critical_question = ``;\n t2.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t2.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t2.condition = \"critical\";\n t2.block = blockString[0];\n t2.prompt = '<b>' + b.critical_question[block_mapper[blockString[0]]] + '</b>';\n t2.test_question = \"no\";\n t2.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n// competence question block\n let t3 = {};\n t3.exp_condition = b.type;\n t3.relevance = b.relevance;\n t3.competence = b.competence;\n t3.prior = b.prior;\n t3.ID = b.ID;\n t3.main_type = type;\n t3.title = b.name;\n t3.QUD = b.background;\n t3.critical_question = ``;\n t3.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t3.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t3.condition = \"critical\";\n t3.block = blockString[1];\n t3.prompt = `<b>` + b.critical_question[block_mapper[blockString[1]]] + `</b>`;\n t3.test_question = \"no\";\n t3.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n// first prior question block\n let t4 = {};\n t4.exp_condition = b.type;\n t4.relevance = b.relevance;\n t4.competence = b.competence;\n t4.prior = b.prior;\n t4.ID = b.ID;\n t4.main_type = type;\n t4.title = b.name;\n t4.QUD = b.background;\n t4.critical_question = ``;\n t4.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t4.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t4.condition = \"critical\";\n t4.test_question = \"no\";\n t4.block = blockString[2];\n t4.prompt = `<b>` + b.critical_question[block_mapper[blockString[2]]] + `</b>`;\n t4.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n // Second prior question block (only used for xor)\n let t5 = {};\n t5.exp_condition = b.type;\n t5.relevance = b.relevance;\n t5.competence = b.competence;\n t5.prior = b.prior;\n t5.ID = b.ID;\n t5.main_type = type;\n t5.title = b.name;\n t5.QUD = b.background;\n t5.critical_question = ``;\n t5.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t5.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t5.condition = \"critical\";\n t5.test_question = \"no\";\n t5.block = blockString[2];\n t5.prompt = `<b>` + b.critical_question[block_mapper[blockString[2]] + 1] + `</b>`;\n t5.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n // more test questions used as fillers before the inference question\n let t6 = {};\n t6.exp_condition = b.type;\n t6.relevance = b.relevance;\n t6.competence = b.competence;\n t6.prior = b.prior;\n t6.ID = b.ID;\n t6.main_type = type;\n t6.title = b.name;\n t6.QUD = b.background;\n t6.critical_question = ``;\n t6.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t6.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t6.condition = \"test\";\n t6.block = 'test_question2';\n t6.prompt = `<b>` + b.allQ[0] + `</b>`;\n t6.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n test_Q_used(b, t6, type, 0);\n\n // second filler question\n let t7 = {};\n t7.exp_condition = b.type;\n t7.relevance = b.relevance;\n t7.competence = b.competence;\n t7.prior = b.prior;\n t7.ID = b.ID;\n t7.main_type = type;\n t7.title = b.name;\n t7.QUD = b.background;\n t7.critical_question = ``;\n t7.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t7.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t7.condition = \"test\";\n t7.block = 'test_question3';\n t7.prompt = `<b>` + b.allQ[2] + `</b>`;\n t7.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n test_Q_used(b, t7, type, 2);\n\n\n// third filler question\n let t8 = {};\n t8.exp_condition = b.type;\n t8.relevance = b.relevance;\n t8.competence = b.competence;\n t8.prior = b.prior;\n t8.ID = b.ID;\n t8.main_type = type;\n t8.title = b.name;\n t8.QUD = b.background;\n t8.critical_question = ``;\n t8.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t8.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t8.condition = \"test\";\n t8.block = 'test_question4';\n t8.prompt = `<b>` + b.allQ[3] + `</b>`;\n t8.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n test_Q_used(b, t8, type, 3);\n\n // maybe an info block\n\n // inference question\n // an information statement in blue appears above the context drawing subjects' attention to the new sentence\n let t9 = {};\n t9.exp_condition = b.type;\n t9.relevance = b.relevance;\n t9.competence = b.competence;\n t9.prior = b.prior;\n t9.ID = b.ID;\n t9.main_type = type;\n t9.title = b.name;\n t9.QUD = b.background;\n // use correct utterance\n switch(true) {\n case (type == \"some\"):\n t9.critical_question = '<b>' + utterance_mapper[\"some\"] + '</b>';\n break;\n default:\n t9.critical_question = '<b>' + utterance_mapper[blockString[3]] + '</b>';\n }\n t9.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t9.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t9.condition = \"critical\";\n t9.block = type;\n t9.prompt = `<b>` + b.critical_question[block_mapper[blockString[3]]] + `</b>`;\n t9.test_question = \"no\";\n t9.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n // second round of rel and comp\n // rel\n let t10 = {};\n t10.exp_condition = b.type;\n t10.relevance = b.relevance;\n t10.competence = b.competence;\n t10.prior = b.prior;\n t10.ID = b.ID;\n t10.main_type = type;\n t10.title = b.name;\n t10.QUD = b.background;\n switch(true) {\n case (type == \"some\"):\n t10.critical_question = '<b>' + utterance_mapper[\"some\"] + '</b>';\n break;\n default:\n t10.critical_question = '<b>' + utterance_mapper[blockString[3]] + '</b>';\n }\n t10.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t10.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t10.condition = \"critical\";\n t10.block = blockString[0];\n t10.prompt = `<b>` + b.critical_question[block_mapper[blockString[0]]] + `</b>`;\n t10.test_question = \"no\";\n t10.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n //comp\n let t11 = {};\n t11.exp_condition = b.type;\n t11.relevance = b.relevance;\n t11.competence = b.competence;\n t11.prior = b.prior;\n t11.ID = b.ID;\n t11.main_type = type;\n t11.title = b.name;\n t11.QUD = b.background;\n\n switch(true) {\n case (type == \"some\"):\n t11.critical_question = '<b>' + utterance_mapper[\"some\"] + '</b>';\n break;\n default:\n t11.critical_question = '<b>' + utterance_mapper[blockString[3]] + '</b>';\n }\n t11.optionLeft = '<p style=\"font-family: sans-serif\">certainly false</p>';\n t11.optionRight = '<p style=\"font-family: sans-serif\">certainly true</p>';\n t11.condition = \"critical\";\n t11.block = blockString[1];\n t11.prompt = `<b>` + b.critical_question[block_mapper[blockString[1]]] + `</b>`;\n t11.test_question = \"no\";\n t11.question = '<font size=\"3\">' + \"How likely is it that the statement in the blue box is true given the story?\" + '</font>';\n\n // return both prior question blocks for xor, and make only one prior question for some\n if (type == \"xor\") {\n // remove second round of rel and comp for second pilot\n return (_.flattenDeep([t1, _.shuffle([t2, t3, _.shuffle([t4, t5])]), t6, t7, t8, t9 ])); // , _.shuffle([t10, t11])\n } else {\n return (_.flattenDeep([t1, _.shuffle([t2, t3, t4]), t6, t7, t8, t9 ])); // , _.shuffle([t10, t11])\n\n }\n\n\n}", "function data(tmp =[]){\n var [\n first,\n second,\n third\n ] = tmp;\n}", "function superTypeWriter(textArray, element) {\n textArray.forEach(function (item, j) {\n var time = j * 3000;\n setTimeout(function () {\n i = 0;\n typeWriter(item, element)\n }, time)\n })\n}", "function evalSpecifiers(specs, state) {\n var types = _.map(specs, function(s) { \n var type = s['spec']['node'];\n\n // If it's a structure or union we need to find out the fields\n if (util.isSUType(type)) {\n var su = s['spec']['sutype'];\n var name = util.unquotify(su['ident']);\n\n switch(su['node']) {\n case \"CStruct\":\n // For each field:\n //\n // * Find the type of the field\n // * Get the name its declared as (which may or may not exist)\n var fields = _.map(su['fields'], function(f) {\n var field_type = evalSpecifiers(f['specifiers']);\n if (!(_.isUndefined(f['declarations'])) && _.isArray(f['declarations'])\n && !(_.isEmpty(f['declarations'])))\n {\n var decl = f['declarations'][0]['declarator'];\n var field_name = util.unquotify(decl['name']);\n return { name: field_name, type: field_type };\n }\n });\n return { type: 'CStruct', name: name, fields: fields };\n case \"CUnion\":\n break;\n }\n }\n else {\n // Otherwise just return the name (CInteger, CLong, CLongUnsigned, etc)\n return s['spec']['node']; \n }\n });\n\n return types;\n }", "function changeTheWholeVarValueFromItsInitialOneFromVarForList(struct_var, var_name, var_value){\n // printf(\"#### changeTheWholeVarValueFromItsInitialOneFromFileForList ####\\n\");\n \n //var row=0;\n var length=0;\n if (strcmp(struct_var[0].var_name,\"__size_of_array__\")!=0) {\n printf(\"@@ |\"+CURRENT_INPUT_STR+\"|\\n\");\n printf(\"Can not find __size_of_array__\");\n exit(0);\n }\n else{\n length=atoi(struct_var[0].var_value);\n }\n\n /*\n //struct VAR temp_var[];\n var temp_var_name=append(var_name, \"[\");\n while (row<length) {\n if (strcmp(var_name,struct_var[row].var_name)==0 || find(struct_var[row].var_name, temp_var_name)==0) {\n Var_removeVar(struct_var, struct_var[row].var_name);\n length--;\n row--;\n }\n row++;\n }\n */ \n \n Var_removeVar(struct_var, var_name);\n writeVarNameAndVarValueIntoAppointedVarForList(struct_var, var_name, var_value);\n}", "_refreshTypeParser(dataType) {\n\n if (dataType.types.postgres.oids) {\n for (const oid of dataType.types.postgres.oids) {\n this.lib.types.setTypeParser(oid, value => dataType.parse(value, oid, this.lib.types.getTypeParser));\n }\n }\n\n if (dataType.types.postgres.array_oids) {\n for (const oid of dataType.types.postgres.array_oids) {\n this.lib.types.setTypeParser(oid, value =>\n this.lib.types.arrayParser.create(value, v =>\n dataType.parse(v, oid, this.lib.types.getTypeParser)\n ).parse()\n );\n }\n }\n }", "function parseLiteralArray(content) {\n\t\n\tif (content[0].text !== '[' || content[content.length-1].text !== ']') {\n\t\terror(\"Literal array is not actually a literal array\");\n\t}\n\t\n\tif (content.length === 2) {\n\t\treturn tows(\"_emptyArray\", valueFuncKw);\n\t} else {\n\t\t//check for \"in\" keyword\n\t\t//format is \"var for var in array if condition\"\n\t\tvar inOperands = splitTokens(content.slice(1, content.length-1), \"in\", false);\n\t\tif (inOperands.length === 2) {\n\t\t\tvar ifOperands = splitTokens(inOperands[1], \"if\");\n\t\t\tif (ifOperands.length !== 2) {\n\t\t\t\t//Not a filtered array (eg: [player.C for player in playersInRadius()])\n\t\t\t\tvar forOperands = splitTokens(inOperands[0], \"for\");\n\t\t\t\tif (forOperands.length !== 2) {\n\t\t\t\t\terror(\"Malformed 'x for y in z'\");\n\t\t\t\t}\n\t\t\t\tvar forVarName = forOperands[1][0].text;\n\t\t\t\tif (forLoopVariables[forVarName] !== undefined) {\n\t\t\t\t\terror(\"Variable \"+forVarName+\" is already used\");\n\t\t\t\t}\n\t\t\t\tforLoopVariables[forVarName] = inOperands[1];\n\t\t\t\t\n\t\t\t\tvar result = parse(forOperands[0]);\n\t\t\t\tdelete forLoopVariables[forVarName];\n\t\t\t\treturn result;\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t//Filtered array\n\t\t\t\tif (inOperands[0].length !== 3 || inOperands[0][1].text !== \"for\" || inOperands[0][0].text !== inOperands[0][2].text) {\n\t\t\t\t\terror(\"Malformed 'x for x in y'\");\n\t\t\t\t}\n\t\t\t\tdebug(\"Parsing 'x for x in y if z', x='\"+inOperands[0][0].text+\"', y='\"+dispTokens(ifOperands[0])+\"', z='\"+dispTokens(ifOperands[1])+\"'\");\n\t\t\t\t\n\t\t\t\tcurrentArrayElementNames.push(inOperands[0][0].text);\n\t\t\t\tvar result = tows(\"_filteredArray\", valueFuncKw)+\"(\"+parse(ifOperands[0])+\", \"+parse(ifOperands[1])+\")\";\n\t\t\t\tcurrentArrayElementNames.pop();\n\t\t\t\treturn result;\n\t\t\t}\n\t\t} else {\n\t\t\t\n\t\t\t//Literal array with only values ([1,2,3])\n\t\t\tvar args = splitTokens(content.slice(1, content.length-1), \",\");\n\t\t\tvar appendFunc = tows(\"_appendToArray\", valueFuncKw);\n\t\t\tvar result = tows(\"_emptyArray\", valueFuncKw);\n\t\t\tfor (var i = 0; i < args.length; i++) {\n\t\t\t\tresult = appendFunc+\"(\"+result+\", \"+parse(args[i])+\")\";\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t}\n\t\n\terror(\"This shouldn't happen\");\n\t\n}", "function displayData(somedata) {\n var someOtherData = TYPE;\n return somedata;\n}", "function addChartTypes(typeArray,typeLength){\n var variableTypeArray = [];\n for (var i = 0; i < typeLength; i++) {\n variableTypeArray[i] = xScaleVariations(i)\n }\n var typesPart = canvas.append(\"g\").attr(\"class\",\"typesPart\")\n var blocksPart = typesPart.append(\"g\").attr(\"class\",\"blocksPart\")\n typeArray.forEach(function(d,i){\n var tipeColor = \"\";\n var countColor = \"\";\n blocksPart.append(\"rect\")\n .attr(\"width\",function (d){ return width / typeLength })\n .attr(\"class\", \"block\")\n .attr(\"height\", 12)\n .attr(\"y\", height)\n .attr(\"x\", function (){ return xScaleVariations(i) })\n .style(\"fill\", function () {\n for (var count = 0; count < colors.length; count++) {\n tipeColor = colors[i]\n countColor = \".type\" + colors[i]\n return \"#\"+colors[i]\n }\n })\n\n .on(\"mouseover\", function(d,i) {\n d3.selectAll(\".link\")\n .style(\"stroke-opacity\",0.2)\n d3.selectAll(countColor)\n .style(\"stroke-opacity\",0.9)\n })\n .on(\"mouseout\", function() {\n d3.selectAll(\".link\")\n .style(\"stroke-opacity\",0.4)\n d3.selectAll(countColor)\n .style(\"stroke-opacity\",0.4)\n });\n var minValue = i * ( width / typeLength ) + (( width / typeLength )/8);\n var maxValue = i * ( width / typeLength ) + (( width / typeLength )/1.125);\n targets.push({target:{type:d, x: getRandomArbitrary(minValue, maxValue), y:height + 1, color:tipeColor, width:width / typeLength, minValue:minValue, maxValue:maxValue}})\n })\n\n var TextPart = typesPart.append(\"g\").attr(\"class\",\"TextPart\")\n typeArray.forEach(function(d,i){\n typesPart.append(\"text\")\n .attr(\"width\",function (d){ return i * ( width / typeLength ) + (( width / typeLength )/2) })\n .attr(\"height\", 15)\n .attr(\"y\", height + 40)\n .attr(\"x\",function (d) { return variableTypeArray[i]})\n .text(function () {return d.charAt(0).toUpperCase() + d.slice(1).replace(/_/g, ' ');})\n .style(\"font-zi\")\n })\n}", "function fillFilterObjects(type,pokemonObject){\n\n switch (type){\n case \"normal\":\n pokeNormal.objects.push(pokemonObject);\n break; \n case \"fire\":\n pokeFire.objects.push(pokemonObject);\n break; \n case \"water\":\n pokeWater.objects.push(pokemonObject);\n break;\n case \"grass\":\n pokeGrass.objects.push(pokemonObject);\n break;\n case \"electric\":\n pokeElectric.objects.push(pokemonObject);\n break;\n case \"ice\":\n pokeIce.objects.push(pokemonObject);\n break;\n case \"ground\":\n pokeGround.objects.push(pokemonObject);\n break;\n case \"flying\":\n pokeFlying.objects.push(pokemonObject);\n break;\n case \"poison\":\n pokePoison.objects.push(pokemonObject);\n break;\n case \"fighting\":\n pokeFighting.objects.push(pokemonObject);\n break;\n case \"psychic\":\n pokePsychic.objects.push(pokemonObject);\n break;\n case \"dark\":\n pokeDark.objects.push(pokemonObject);\n break;\n case \"rock\":\n pokeRock.objects.push(pokemonObject);\n break;\n case \"bug\":\n pokeBug.objects.push(pokemonObject);\n break;\n case \"ghost\":\n pokeGhost.objects.push(pokemonObject);\n break;\n case \"steel\":\n pokeSteel.objects.push(pokemonObject);\n break;\n case \"dragon\":\n pokeDragon.objects.push(pokemonObject);\n break;\n case \"fairy\":\n pokeFairy.objects.push(pokemonObject);\n break; \n}\n\n}", "function changeTheOneVarValueFromItsInitialOneFromVarForList(struct_var, change_var_name, to_var_value){\n //printf(\"###### changeTheOneVarValueFromItsInitialOneFromFileForList ######\\n\");\n change_var_name=removeBackSpace(change_var_name);\n change_var_name=removeAheadSpace(change_var_name);\n var var_name=substr(change_var_name,0,find_not_in_string(change_var_name,\"[\"));\n var var_value;\n \n var index=substr(change_var_name,find_not_in_string(change_var_name,\"[\"),change_var_name.length);\n index=removeBackSpace(index);\n // eg now index =[1][2][3];\n \n \n var row=0;\n var length=0;\n if (strcmp(struct_var[0].var_name,\"__size_of_array__\")!=0) {\n printf(\"@@ |\"+CURRENT_INPUT_STR+\"|\\n\");\n printf(\"Can not find __size_of_array__\");\n exit(0);\n }\n else{\n length=atoi(struct_var[0].var_value);\n }\n\n while (row<length) {\n var var_name_in_file = struct_var[row].var_name;\n if(strcmp(var_name_in_file, var_name) == 0){\n var_value=struct_var[row].var_value;\n break;\n }\n row++;\n }\n \n //eg now index = [1][0]\n // var_value=[1,[2,3],3]\n var original_value=valueOfListAtIndexString(var_value,index);\n var begin_end=[0,0];\n begin_end[0]=0;\n begin_end[1]=0;\n\n valueOfListAtIndexStringAndReturnBeginAndEnd(begin_end,var_value,index);\n var begin=begin_end[0];\n var end=begin_end[1];\n \n var change_change=replace_from_index_to_index(var_value,original_value,to_var_value,begin,end+1);\n changeTheWholeVarValueFromItsInitialOneFromVarForList(struct_var, var_name, change_change);\n \n}", "function replaceDynamicBits(statements) {\n var isDynamic = false;\n\n statements.forEach((statement, i) => {\n const childNode = statement.expression;\n\n if (childNode.type === 'ArrayExpression') {\n let newAst = childNode.elements.map(e => t.expressionStatement(e));\n let _isDynamic = replaceDynamicBits(newAst);\n if (_isDynamic) { isDynamic = true; }\n childNode.elements = newAst.map(e => e.expression);\n\n return;\n }\n\n const nodeName = childNode.properties.filter(property => {\n return property.key.value === 'nodeName';\n })[0].value;\n\n // The nodeName without `toLowerCase()` being called on it.\n const rawNodeName = childNode.properties.filter(property => {\n return property.key.value === 'rawNodeName';\n })[0].value.value;\n\n // Extract\n const identifierIsInScope = path.scope.hasBinding(rawNodeName);\n\n const nodeType = childNode.properties.filter(property => {\n return property.key.value === 'nodeType';\n })[0].value.value;\n\n const nodeValue = childNode.properties.filter(property => {\n return property.key.value === 'nodeValue';\n })[0].value;\n\n const attributes = childNode.properties.filter(property => {\n return property.key.value === 'attributes';\n })[0].value;\n\n const childNodes = childNode.properties.filter(property => {\n return property.key.value === 'childNodes';\n })[0].value;\n\n const args = [];\n\n // Real elements.\n if (nodeType === 1) {\n // Check childNodes.\n let expressions = childNodes.elements.map(\n c => t.expressionStatement(c)\n );\n\n // Replace the nested structures.\n let _isDynamic = replaceDynamicBits(expressions);\n\n // Only set if true.\n if (_isDynamic) {\n isDynamic = true;\n }\n\n args.push(createTree, [\n identifierIsInScope ? t.identifier(rawNodeName) : nodeName,\n attributes,\n t.arrayExpression(expressions.map(expr => expr.expression)),\n ]);\n }\n // Text nodes.\n else if (nodeType === 3) {\n let value = nodeValue.value || '';\n\n if (value.trim() === symbol) {\n const childNodes = supplemental.children.shift();\n\n args.push(createTree, [childNodes]);\n\n isDynamic = true;\n }\n else if (value.indexOf(symbol) > -1) {\n const values = splitDyanmicValues(value, supplemental.children);\n\n if (values.elements.length === 1) {\n args.push(values.elements[0]);\n }\n else {\n args.push(createTree, [\n t.stringLiteral('#document-fragment'),\n t.nullLiteral(),\n values.length === 1 ? values[0] : values,\n ]);\n }\n\n isDynamic = true;\n }\n else {\n args.push(createTree, [\n t.stringLiteral('#text'),\n t.nullLiteral(),\n nodeValue\n ]);\n }\n }\n\n const callExpr = args.length ?\n t.callExpression.apply(null, args) :\n args.replacement;\n\n // TODO This will determine if the Node is embedded in a dynamic call\n // in which case it cannot be hoisted.\n const isTopLevelStatic = false;\n\n // Is a static node and never changes, so hoist createTree call.\n if (!isDynamic && isTopLevelStatic) {\n let id = path.scope.generateUidIdentifier('vtree');\n path.scope.parent.push({ id, init: callExpr });\n statements[i].expression = id;\n }\n else {\n statements[i].expression = callExpr;\n }\n });\n\n return isDynamic;\n }", "function recurse(structure, data, scope) {\n if (!structure || !structure.type) { return; }\n var i=0, l;\n\n // Process the types\n switch (structure.type)\n {\n case 'Program':\n scope = {};\n break;\n \n case 'Function':\n /*\n if we're already handling an outer function, keep the scope around\n */\n scope = (scope.args) ?\n scope :\n {args:{}};\n\n\n\n if (!scope.collectedArgs && \n structure.params &&\n structure.params.length > 0)\n {\n l = structure.params.length\n for (i=0; i<l; i++) {\n\n data['in'][structure.params[i]] = {\n name : structure.params[i],\n type : \"argument\",\n direction : \"in\",\n };\n\n scope.args[structure.params[i]] = true;\n }\n }\n scope.collectedArgs = true;\n\n if (structure.elements) {\n var el = structure.elements.length;\n for (i=0; i<el; i++) {\n recurse(structure.elements[i], data, scope);\n }\n \n }\n break;\n\n case 'FunctionCall':\n\n if (structure.name.name && scope.args[structure.name.name]) {\n if (data['in'][structure.name.name]) {\n delete data['in'][structure.name.name];\n }\n data['out'][structure.name.name] = {\n name : structure.name.name,\n type : \"callback\",\n direction : \"out\",\n };\n }\n \n if (structure.name.base) {\n recurse(structure.name.base, data, scope);\n }\n \n l = structure.arguments.length;\n for (i=0; i<l; i++) {\n recurse(structure.arguments[i], data, scope);\n }\n break;\n\n case \"VariableDeclaration\":\n recurse(structure.value, data, scope);\n break;\n\n case \"VariableStatement\":\n if (structure.declarations) {\n var dd = 0, dl = structure.declarations.length;\n for (dd; dd<dl; dd++) {\n recurse(structure.declarations[dd], data, scope);\n }\n }\n break;\n\n case 'PropertyAccess':\n if (structure.base) {\n recurse(structure.base, data, scope);\n }\n break;\n\n case 'ReturnStatement':\n data['out'][\"return\"] = {\n name : \"return\",\n type : \"return\",\n direction : \"out\",\n };\n\n if (structure.value) {\n recurse(structure.value, data, scope);\n }\n \n break;\n }\n\n if (structure.value && structure.value.type) {\n recurse(structure.value, data, scope);\n }\n\n // Continue down if there are more children elements\n if (structure.elements) {\n l=structure.elements.length;\n for (i=0; i<l; i++) {\n recurse(structure.elements[i], data, scope);\n }\n }\n}", "function addVar(type) {\n\t\tif (isIntoFunction) {\n\t\t\tlocalVarTable.push(type);\n\t\t\tlocalVarTable.push(thisToken);\n\t\t} else {\n\t\t\tvarTable.push({\n\t\t\t\tname: thisToken,\n\t\t\t\ttype: type,\n\t\t\t\tlength: 1\n\t\t\t});\n\t\t\tasm.push(' _' + thisToken + ' word ? ');\n\t\t\tasm.push(' ');\n\t\t}\n\t}", "function modifyMultiple(elements, process) {\n\t\tvar ind = elements.length;\n\t\twhile(ind--) {\n\t\t\tprocess(elements[ind]);\n\t\t}\n\t}", "function handleDisplayVariables() {\n var varGridBody = $('#variable-grid tbody');\n varGridBody.empty();\n for (var variable in declaredVars) {\n var value = declaredVars[variable];\n var cellName = $('<td></td>');\n cellName.text(variable);\n var cellType = $('<td></td>');\n cellType.text(typeof value);\n var cellValue = $('<td></td>');\n cellValue.text(value);\n cellValue.attr('title', value);\n var row = $('<tr></tr>');\n row.append(cellName);\n row.append(cellType);\n row.append(cellValue);\n varGridBody.append(row);\n }\n}", "function processData(list, type, desc) {\n\n // Convert to data points\n for (var i = 0; i < list.length; i++) {\n list[i] = {\n value: Number(list[i][0]),\n volume: Number(list[i][1]),\n }\n }\n\n // Sort list just in case\n list.sort(function (a, b) {\n if (a.value > b.value) {\n return 1;\n }\n else if (a.value < b.value) {\n return -1;\n }\n else {\n return 0;\n }\n });\n\n // Calculate cummulative volume\n if (desc) {\n for (var i = list.length - 1; i >= 0; i--) {\n if (i < (list.length - 1)) {\n list[i].totalvolume = list[i + 1].totalvolume + list[i].volume;\n }\n else {\n list[i].totalvolume = list[i].volume;\n }\n var dp = {};\n dp[\"value\"] = list[i].value;\n dp[type + \"volume\"] = list[i].volume;\n dp[type + \"totalvolume\"] = list[i].totalvolume;\n res.unshift(dp);\n }\n }\n else {\n for (var i = 0; i < list.length; i++) {\n if (i > 0) {\n list[i].totalvolume = list[i - 1].totalvolume + list[i].volume;\n }\n else {\n list[i].totalvolume = list[i].volume;\n }\n var dp = {};\n dp[\"value\"] = list[i].value;\n dp[type + \"volume\"] = list[i].volume;\n dp[type + \"totalvolume\"] = list[i].totalvolume;\n res.push(dp);\n }\n }\n\n }", "function load(parsedData) {\n \n var newShape;\n var array = [];\n for (var i = 0; i < parsedData.length; i++){\n //if line\n if (parsedData[i].type == \"line\") {\n newShape = new lineShape(parsedData[i].colour,parsedData[i].startPos,parsedData[i].endPos);\n array.push(newShape);\n //if rectangle\n } else if (parsedData[i].type == \"rect\") {\n newShape = new rectShape(parsedData[i].colour,parsedData[i].startPos,parsedData[i].endPos);\n array.push(newShape);\n //square\n } else if (parsedData[i].type == \"square\") {\n newShape = new squareShape(parsedData[i].colour,parsedData[i].startPos,parsedData[i].endPos);\n array.push(newShape);\n //if circle\n } else if (parsedData[i].type == \"circ\") {\n newShape = new circShape(parsedData[i].colour,parsedData[i].startPos,parsedData[i].endPos);\n array.push(newShape);\n //if ellipse\n } else if (parsedData[i].type == \"ellip\") {\n newShape = new ellipShape(parsedData[i].colour,parsedData[i].startPos,parsedData[i].endPos);\n array.push(newShape);\n //if freehand\n } else if (parsedData[i].type == \"freehand\") {\n newShape = new freehandShape(parsedData[i].colour,parsedData[i].startPos);\n newShape.addArray(parsedData[i].posArray);\n array.push(newShape);\n //grouped shape\n } else if (parsedData[i].type == \"group\") {\n var loadedShapes = [];\n loadedShapes = load(parsedData[i].shapeArray);\n newShape = new groupShape(loadedShapes[0],loadedShapes[1]);\n array.push(newShape);\n }\n }\n \n return array;\n \n}", "_applydata(data, daplet) {\n let i = 0;\n for (let child in daplet) {\n if (!daplet[child].type) continue;\n daplet[child].data = data[i++];\n if (daplet[child].type == \"Structure\") {\n this._applydata(daplet[child].data, daplet[child]);\n }\n }\n }", "function mixedDataCleaner (arrayOfObjects) {\n function parseCurrency(aString){\n var monk = aString.replace(/\\$/g, ''),\n kungfu = monk.replace(/\\,/g, ''),\n master = Number(kungfu);\n return master;\n }\n \n\n for(var i = 0; i < arrayOfObjects.length; i++) {\n //For an Array containing arrays (custom data)\n if(Array.isArray(arrayOfObjects[i])) {\n for(var q = 0; q < arrayOfObjects[i].length; q++){\n if(arrayOfObjects[i][q]){\n arrayOfObjects[i][q] = parseCurrency(arrayOfObjects[i][q]); \n }\n } \n } else {\n //For an Array containing Objects (JSON)\n for(var j in arrayOfObjects[i]){\n if( arrayOfObjects[i][j][0] === '$' || arrayOfObjects[i][j][0] === '-' ) {\n arrayOfObjects[i][j] = parseCurrency(arrayOfObjects[i][j]);\n // console.log(arrayOfObjects[i][j])\n }\n }\n }\n }\n return arrayOfObjects;\n}", "function dataLoop(level1,level2,level3,theData,chartType) {\n\n if (chartType == 'doughnut') { var length = level2.length }\n else { var length = level3.length }\n\n if (chartType == 'doughnut') {\n var item = {\n backgroundColor: [],\n data: []\n };\n for (var i = 0; i < length; i++) {\n var subTotal = 0;\n for (var x = 0; x < level3.length; x++) {\n subTotal += results[level1][level2[i]][level3[x]];\n }\n item['backgroundColor'].push(backgroundColours[i]);\n item['data'].push(subTotal);\n }\n theData.push(item);\n }\n else {\n for (var i = 0; i < length; i++) {\n\n // Build each item for the array\n var item = {\n backgroundColor: [],\n data: []\n };\n item.label = level3[i];\n\n if (chartType == 'line') { item.borderColor = backgroundColours[i]; }\n else { item.backgroundColor = backgroundColours[i]; }\n\n item.fill = false;\n\n // Add data and push to collections array\n item.data = results[level1].chartData[i];\n theData.push(item);\n };\n };\n }", "foreach(fct) {\n let action = (x, y) => fct(x, y);\n for (let i = 0; i < this.blocks.length; i++) {\n action(this.x + this.blocks[i].x, this.y + this.blocks[i].y);\n }\n }", "function fillnameToSpell(){\nconsole.log(whois)\n switch (whois){\n case 'harvey':\n for(i=0; i < harvey.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(harvey[i]);\n nameToSpellSound.push(harveySound[i])\n }\n break;\n case 'sol':\n for(i=0; i < sol.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(sol[i]);\n nameToSpellSound.push(solSound[i])\n }\n \n break;\n case 'alice':\n for(i=0; i < alice.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(alice[i]);\n nameToSpellSound.push(aliceSound[i])\n }\n \n break;\n case 'andre':\n for(i=0; i < andre.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(andre[i]);\n nameToSpellSound.push(andreSound[i])\n }\n \n break;\n case 'frank':\n for(i=0; i < frank.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(frank[i]);\n nameToSpellSound.push(frankSound[i])\n }\n \n break;\n case 'luke':\n for(i=0; i < luke.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(luke[i]);\n nameToSpellSound.push(lukeSound[i])\n }\n break;\n case 'ben':\n for(i=0; i < ben.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(ben[i]);\n nameToSpellSound.push(benSound[i])\n }\n \n break;\n case 'emma':\n for(i=0; i < emma.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(emma[i]);\n nameToSpellSound.push(emmaSound[i])\n }\n \n break;\n case 'vero':\n for(i=0; i < vero.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(vero[i]);\n nameToSpellSound.push(veroSound[i])\n }\n \n break;\n case 'cement':\n for(i=0; i < cement.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(cement[i]);\n nameToSpellSound.push(cementSound[i])\n }\n \n break;\n case 'digger':\n for(i=0; i < digger.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(digger[i]);\n nameToSpellSound.push(diggerSound[i])\n }\n \n break;\n case 'dump':\n for(i=0; i < dump.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(dump[i]);\n nameToSpellSound.push(dumpSound[i])\n }\n \n break;\n case 'roller':\n for(i=0; i < roller.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(roller[i]);\n nameToSpellSound.push(rollerSound[i])\n }\n \n break;\n case 'airplane':\n for(i=0; i < airplane.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(airplane[i]);\n nameToSpellSound.push(airplaneSound[i])\n }\n \n break;\n case 'train':\n for(i=0; i < train.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(train[i]);\n nameToSpellSound.push(trainSound[i])\n }\n \n break;\n case 'car':\n for(i=0; i < car.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(car[i]);\n nameToSpellSound.push(carSound[i])\n }\n \n break;\n case 'barklake':\n for(i=0; i < barklake.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(barklake[i]);\n nameToSpellSound.push(barklakeSound[i])\n }\n \n break;\n case 'honolulu':\n for(i=0; i < honolulu.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(honolulu[i]);\n nameToSpellSound.push(honoluluSound[i])\n }\n \n break;\n case 'ottawa':\n for(i=0; i < ottawa.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(ottawa[i]);\n nameToSpellSound.push(ottawaSound[i])\n }\n \n break;\n case 'tiger':\n for(i=0; i < tiger.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(tiger[i]);\n nameToSpellSound.push(tigerSound[i])\n }\n \n break;\n case 'bear':\n for(i=0; i < bear.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(bear[i]);\n nameToSpellSound.push(bearSound[i])\n }\n \n break;\n case 'dog':\n for(i=0; i < dog.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(dog[i]);\n nameToSpellSound.push(dogSound[i])\n }\n \n break;\n case 'cat':\n for(i=0; i < cat.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(cat[i]);\n nameToSpellSound.push(catSound[i])\n }\n \n break;\n \n } \n }", "function modify(tree) {\n\t// These structures store which objects and storage elements are tainted\n\ttree.unshift(esprima.parse('var TSobjects = new Array();'));\n\ttree.unshift(esprima.parse('var TSlocalStorage = new Array();'));\n\ttree.unshift(esprima.parse('var TSsessionStorage = new Array();'));\n\n\t// Loop through each line in the method\n\tfor (i = 0; i < tree.length; i++) {\n\t\t// Check the syntax\n\t\tswitch(tree[i].type) {\n\t\t\tcase 'VariableDeclaration':\n\t\t\t\ti += taintVariableDeclaration(tree, i);\n\t\t\t\tbreak;\n\t\t\tcase \"IfStatement\":\n\t\t\t\ttaintIfStatement(tree[i]);\n\t\t\t\tbreak;\n\t\t\tcase \"ExpressionStatement\":\n\t\t\t\ti += taintExpressionStatement(tree, i);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n}", "function processType(type_subcomponent) {\n\n // types_subcomponent is either a group_bracket or a subtype,\n // which both contain subcontexts at [1]\n \n let types_arr = type_subcomponent[1];\n\n let types = [];\n\n for(let type_item of types_arr) {\n\n // Each type_item is a subcontext which contain types at [1]\n \n // A type item must only have a maximum of 2 children\n if(type_item[1].length>2)\n throw(`Unexpected ${type_item[1].length} elements `+\n `inside type (only max. 2 expected) at `+\n `line ${type_item[2][0].line} `+\n `column ${type_item[2][0].column}`);\n\n \n if(// If type item has 2 children, \n // first child must be NAME and second as SUBTYPE \n (type_item[1].length==2 && \n !(type_item[1][0][0].isOf(SubComponentType.NAME) && \n type_item[1][1][0].isOf(SubComponentType.SUBTYPE))) ||\n\n // If type item has 1 child, it must be NAME\n (type_item[1].length==1 && !type_item[1][0][0].isOf(SubComponentType.NAME)))\n\n throw(`Unexpected type format given (must be NAME or NAME<SUBTYPES>) at `+\n `line ${type_item[2][0].line} `+\n `column ${type_item[2][0].column}`);\n\n \n let type = new TypeItem();\n type.name = type_item[1][0][1];\n if(type_item[1][1]) type.subtype = processType(type_item[1][1]);\n \n types.push(type);\n }\n\n let typecontext = new TypeContext();\n typecontext.type_items = types;\n typecontext.start = type_subcomponent[2][0];\n typecontext.end = type_subcomponent[2][1];\n\n return typecontext;\n\n}", "parseBlock(s, currentRehearsalGroup, latest_variables){\n // parase until block boundary is found\n // block boundary = \"[\" or 2 successive NL or NOL\n try{\n var r = null;\n var loop_cnt = 0;\n\n var block = new common.Block();\n var current_align = \"expand\";\n\n this.context.contiguous_line_break = 0; // This should be done only if NL is really consumed.\n\n let num_meas_row = 0;\n\n let MAX_LOOP = 1000;\n\n let end_of_rg = false;\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n r = this.nextToken(s);\n if (r.type == TOKEN_END){\n s = r.s; // explicitly consume the last spaces if any.\n end_of_rg = true;\n break;\n }else if (r.type == TOKEN_NL) {\n this.context.line += 1;\n this.context.contiguous_line_break += 1;\n current_align = \"expand\"; // default is expand\n //if(this.context.contiguous_line_break >= 2) break; Do not break here. If the first non NL element is found, then break.\n } else if(r.type == TOKEN_BACK_SLASH){\n if(this.context.contiguous_line_break >= 2) break;\n // Expect TOKEN_NL \n r = this.nextToken(r.s);\n if(r.type != TOKEN_NL) this.onParseError(\"INVALID CODE DETECTED AFTER BACK SLASH\");\n this.context.line += 1;\n //block.appendChild(new common.RawSpaces(r.sss));\n //block.appendChild(new common.RawSpaces(r.token)); \n // Does not count as line break\n }else if(r.type == TOKEN_BRACKET_RA){\n if(this.context.contiguous_line_break >= 2) break;\n // Right aligh indicoator > which is outside measure\n current_align = \"right\";\n }else if(r.type == TOKEN_BRACKET_LA){\n if(this.context.contiguous_line_break >= 2) break;\n // Right aligh indicoator > which is outside measure\n current_align = \"left\";\n } else if (r.type == TOKEN_BRACKET_LS) {\n // Next rehearsal mark detected.\n // Do not consume.\n end_of_rg = true;\n break;\n } else if (\n [\n TOKEN_MB,\n TOKEN_MB_DBL,\n TOKEN_MB_LOOP_BEGIN,\n TOKEN_MB_LOOP_END,\n TOKEN_MB_LOOP_BOTH,\n TOKEN_MB_FIN,\n TOKEN_MB_DBL_SIMILE\n ].indexOf(r.type) >= 0\n ) {\n if(this.context.contiguous_line_break >= 2) break;\n\n let is_new_line_middle_of_block = num_meas_row > 0 && this.context.contiguous_line_break == 1;\n\n this.context.contiguous_line_break = 0;\n \n r = this.parseMeasures(r, r.s); // the last NL has not been consumed.\n // Apply the variables valid at this point for each measures\n //r.measures.forEach(m=>{ m.variables = common.shallowcopy(latest_variables);});\n r.measures.forEach(m=>{\n for(let key in latest_variables){\n m.setVariable(latest_variables[key]);\n }\n });\n\n // For the first measure, set align and new line mark.\n r.measures[0].align = current_align;\n r.measures[0].raw_new_line = is_new_line_middle_of_block; // mark to the first measure\n block.concat(r.measures);\n\n ++num_meas_row;\n\n } else if (r.type == TOKEN_PERCENT) {\n if(this.context.contiguous_line_break >= 2) break;\n // Expression\n r = this.parseVariable(r.s); // last NL would not be consumed\n let variable = new common.Variable(r.key, r.value);\n //block.setVariable(r.key, r.value); Do not do this as with this, only the last variable will be valid.\n latest_variables[r.key] = variable;\n block.appendChild(variable);\n this.context.contiguous_line_break = 0; // -= 1; // Does not reset to 0, but cancell the new line in the same row as this variable\n } else {\n console.log(r.token);\n this.onParseError(\"ERROR_WHILE_PARSE_MOST_OUTSIDER\");\n }\n s = r.s;\n loop_cnt++;\n if (loop_cnt >= MAX_LOOP){\n throw \"Too much elements or infnite loop detected with unkown reason\";\n }\n }\n return { block:block, s:s, end_of_rg:end_of_rg};\n }catch(e){\n console.error(e);\n return null;\n }\n }", "function messWithVars(one, two, three) {\n one.splice(0, 1, \"two\");\n two.splice(0, 1, \"three\");\n three.splice(0, 1, \"one\");\n}", "function conversionHandler(_splitted) {\n var _lastKey;\n for (var i = 0; i < _splitted.length; i++) {\n var _var = _splitted[i].trim();\n var isArray = _var.indexOf('[') > -1;\n if (isArray) {\n const key = _splitted[i - 1].trim();\n var arr = handleArrayInput(_splitted, _var, i);\n input.push({ key: key, value: arr });\n var_table[key] = { value: arr };\n while (_splitted[i].indexOf(']') == -1)\n i++;\n _lastKey = null;\n } else if (!_lastKey) {\n _lastKey = _var;\n } else {\n _lastKey = updateVarValue(_lastKey, _var);\n }\n }\n}", "function VarManager_ProcessVariables(theText, theId)\n{\n\t//while we can find variables to process\n\twhile (theText.match(this.RegExp_Variable))\n\t{\n\t\t//get the variable markers\n\t\tvar reg1 = RegExp.$1;\n\t\tvar reg3 = RegExp.$3;\n\t\t//get the variable name\n\t\tvar theVariable = RegExp.$2;\n\t\t//get the value\n\t\tvar theValue = this.GetVariableValue(theVariable);\n\t\t//now replace all\n\t\ttheText = theText.replace(new RegExp(reg1 + theVariable + reg3, \"g\"), theValue);\n\t\t//does this variable belong to a different object\n\t\tif (this.GetVariableID(theVariable) != theId)\n\t\t{\n\t\t\t//register to listen to this variable\n\t\t\tthis.AddVariableListener(theVariable, theId);\n\t\t}\n\t}\n\t//return the processed text\n\treturn theText;\n}", "function decode([types, values]) {\n let outputBuffer = [];\n _.times(_.size(types), i => {\n const type = types[i];\n const value = values[i];\n outputBuffer.push(mappings[type].unpack(value));\n });\n return outputBuffer;\n}", "function standardizeLets(declars) {\n\t var _arr = declars;\n\n\t for (var _i = 0; _i < _arr.length; _i++) {\n\t var declar = _arr[_i];\n\t delete declar._let;\n\t }\n\t}", "function standardizeLets(declars) {\n\t var _arr = declars;\n\n\t for (var _i = 0; _i < _arr.length; _i++) {\n\t var declar = _arr[_i];\n\t delete declar._let;\n\t }\n\t}", "function processData(list, type, desc) {\n\n\t\t// Convert to data points\n\t\tfor(var i = 0; i < list.length; i++) {\n\t\t list[i] = {\n\t\t\tvalue: Number(list[i][0]),\n\t\t\tvolume: Number(list[i][1]),\n\t\t }\n\t\t}\n\n\t\t// Sort list just in case\n\t\tlist.sort(function(a, b) {\n\t\t if (a.value > b.value) {\n\t\t\treturn 1;\n\t\t }\n\t\t else if (a.value < b.value) {\n\t\t\treturn -1;\n\t\t }\n\t\t else {\n\t\t\treturn 0;\n\t\t }\n\t\t});\n\n\t\t// Calculate cummulative volume\n\t\tif (desc) {\n\t\t for(var i = list.length - 1; i >= 0; i--) {\n\t\t\tif (i < (list.length - 1)) {\n\t\t\t list[i].totalvolume = list[i+1].totalvolume + list[i].volume;\n\t\t\t}\n\t\t\telse {\n\t\t\t list[i].totalvolume = list[i].volume;\n\t\t\t}\n\t\t\tvar dp = {};\n\t\t\tdp[\"value\"] = list[i].value;\n\t\t\tdp[type + \"volume\"] = list[i].volume;\n\t\t\tdp[type + \"totalvolume\"] = list[i].totalvolume;\n\t\t\tres.unshift(dp);\n\t\t }\n\t\t}\n\t\telse {\n\t\t for(var i = 0; i < list.length; i++) {\n\t\t\tif (i > 0) {\n\t\t\t list[i].totalvolume = list[i-1].totalvolume + list[i].volume;\n\t\t\t}\n\t\t\telse {\n\t\t\t list[i].totalvolume = list[i].volume;\n\t\t\t}\n\t\t\tvar dp = {};\n\t\t\tdp[\"value\"] = list[i].value;\n\t\t\tdp[type + \"volume\"] = list[i].volume;\n\t\t\tdp[type + \"totalvolume\"] = list[i].totalvolume;\n\t\t\tres.push(dp);\n\t\t }\n\t\t}\n\n\t }", "splitDataOnBlocks() {\n\t\t['Input', 'Patterns'].forEach((elem) => {\n\t\t\tvar propName = 'splitted' + elem;\n\t\t\tthis[propName] = [];\n\n\t\t\tthis[elem.toLowerCase()].forEach((string) => {\n\t\t\t\tvar blocks = string.split(/[^\\da-z\\-_]/i).filter(el => el.length);\n\t\t\t\tif (blocks.length > 0) {\n\t\t\t\t\tthis[propName].push(blocks);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function populateInputs($area, array, type, prefix) {\n\t\t// make sure type is checkbox or radio\n\t\tif (!(type === \"checkbox\" || type === \"radio\")) {\n\t\t\tthrow new Error(`Input type must be either 'checkbox' or 'radio', received ${type}`);\n\t\t}\n\n\t\t// iterate of array items\n\t\tarray.forEach((item, index) => {\n\t\t\tlet itemName = item;\n\t\t\tlet itemID = undefined;\n\n\t\t\tif (!(typeof item === \"string\")) {\n\t\t\t\titemName = item.name;\n\t\t\t\titemID = item.id\n\t\t\t}\n\n\t\t\t// generate metadata\n\t\t\tlet inputID = prefix + itemName;\n\n\t\t\tlet value;\n\t\t\tif (type === \"checkbox\") {\n\t\t\t\t// checkbox values are true or false\n\t\t\t\tvalue = true;\n\t\t\t} else {\n\t\t\t\t// radio value is name\n\t\t\t\tvalue = itemName;\n\t\t\t}\n\n\t\t\tlet name;\n\t\t\tif (type === \"radio\") {\n\t\t\t\t// group radio types by name\n\t\t\t\tname = prefix;\n\t\t\t} else {\n\t\t\t\t// checkboxes get their own name\n\t\t\t\tname = inputID;\n\t\t\t}\n\n\t\t\t// create elements\n\t\t\tlet p = $(\"<p>\");\n\t\t\tlet label = $(\"<label>\");\n\t\t\tlet inputElement = $(\"<input>\");\n\t\t\tlet span = $(\"<span>\");\n\n\t\t\t// element modifications\n\t\t\tp.addClass(\"col s6 m4\");\n\t\t\tlabel.attr(\"for\", inputID);\n\t\t\tinputElement.attr(\"id\", inputID);\n\t\t\tinputElement.attr(\"type\", type);\n\t\t\tspan.text(itemName);\n\n\t\t\t// conditional element modifications\n\t\t\tif (itemID != undefined) {\n\t\t\t\tinputElement.attr(`data-${prefix}`, itemID);\n\t\t\t}\n\t\t\tif (prefix === \"genre\") {\n\t\t\t\tinputElement\n\t\t\t\t\t.attr(\"value\", itemID)\n\t\t\t\t\t.attr(\"name\", itemName);\n\t\t\t} else {\n\t\t\t\tinputElement\n\t\t\t\t\t.attr(\"value\", value)\n\t\t\t\t\t.attr(\"name\", name);\n\t\t\t}\n\n\t\t\t// append elements\n\t\t\t$area\n\t\t\t\t.append(p\n\t\t\t\t\t.append(label\n\t\t\t\t\t\t.append(inputElement)\n\t\t\t\t\t\t.append(span)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t});\n\t}" ]
[ "0.69868785", "0.69868785", "0.69868785", "0.69868785", "0.6948387", "0.6948387", "0.6937791", "0.6937791", "0.5751973", "0.5527704", "0.5484366", "0.54475564", "0.5349662", "0.5223466", "0.5180604", "0.492264", "0.47843727", "0.47641605", "0.47224653", "0.4700773", "0.46943283", "0.46740437", "0.46740437", "0.46740437", "0.46740437", "0.4672548", "0.46664378", "0.46664378", "0.46379814", "0.46324372", "0.46256328", "0.462207", "0.46199533", "0.46078002", "0.46049708", "0.4602407", "0.45979288", "0.4592814", "0.4580205", "0.4580205", "0.4580205", "0.4580205", "0.45753202", "0.45652583", "0.45516104", "0.4543675", "0.45433718", "0.45183745", "0.44713524", "0.44682539", "0.4466068", "0.4462323", "0.4455696", "0.44242242", "0.44097462", "0.44054076", "0.43940598", "0.43876848", "0.43801033", "0.4372375", "0.43364382", "0.43296066", "0.4323239", "0.43220246", "0.43155444", "0.43010393", "0.42909577", "0.42842436", "0.4280207", "0.42734644", "0.42724797", "0.4253608", "0.42499107", "0.4249749", "0.42393392", "0.42389297", "0.4237537", "0.42340744", "0.42334458", "0.42276692", "0.4227489", "0.42274332", "0.42245704", "0.4221013", "0.42174372", "0.42106396", "0.4210431", "0.42085373", "0.42043054", "0.41970065", "0.41942215", "0.4192741", "0.41886285", "0.41886285", "0.41719776", "0.41679952", "0.41661984" ]
0.69786483
7
Generates a cwise operator
function generateCWiseOp(proc, typesig) { //Compute dimension // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 var orders = new Array(proc.arrayArgs.length) var dtypes = new Array(proc.arrayArgs.length) for(var i=0; i<proc.arrayArgs.length; ++i) { dtypes[i] = typesig[2*i] orders[i] = typesig[2*i+1] } //Determine where block and loop indices start and end var blockBegin = [], blockEnd = [] // These indices are exposed as blocks var loopBegin = [], loopEnd = [] // These indices are iterated over var loopOrders = [] // orders restricted to the loop indices for(var i=0; i<proc.arrayArgs.length; ++i) { if (proc.arrayBlockIndices[i]<0) { loopBegin.push(0) loopEnd.push(dimension) blockBegin.push(dimension) blockEnd.push(dimension+proc.arrayBlockIndices[i]) } else { loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative loopEnd.push(proc.arrayBlockIndices[i]+dimension) blockBegin.push(0) blockEnd.push(proc.arrayBlockIndices[i]) } var newOrder = [] for(var j=0; j<orders[i].length; j++) { if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) { newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices. } } loopOrders.push(newOrder) } //First create arguments for procedure var arglist = ["SS"] // SS is the overall shape over which we iterate var code = ["'use strict'"] var vars = [] for(var j=0; j<dimension; ++j) { vars.push(["s", j, "=SS[", j, "]"].join("")) // The limits for each dimension. } for(var i=0; i<proc.arrayArgs.length; ++i) { arglist.push("a"+i) // Actual data array arglist.push("t"+i) // Strides arglist.push("p"+i) // Offset in the array at which the data starts (also used for iterating over the data) for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping vars.push(["t",i,"p",j,"=t",i,"[",loopBegin[i]+j,"]"].join("")) } for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration vars.push(["t",i,"b",j,"=t",i,"[",blockBegin[i]+j,"]"].join("")) } } for(var i=0; i<proc.scalarArgs.length; ++i) { arglist.push("Y" + i) } if(proc.shapeArgs.length > 0) { vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) } if(proc.indexArgs.length > 0) { // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. var zeros = new Array(dimension) for(var i=0; i<dimension; ++i) { zeros[i] = "0" } vars.push(["index=[", zeros.join(","), "]"].join("")) } for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations var off_arg = proc.offsetArgs[i] var init_string = [] for(var j=0; j<off_arg.offset.length; ++j) { if(off_arg.offset[j] === 0) { continue } else if(off_arg.offset[j] === 1) { init_string.push(["t", off_arg.array, "p", j].join("")) } else { init_string.push([off_arg.offset[j], "*t", off_arg.array, "p", j].join("")) } } if(init_string.length === 0) { vars.push("q" + i + "=0") } else { vars.push(["q", i, "=", init_string.join("+")].join("")) } } //Prepare this variables var thisVars = uniq([].concat(proc.pre.thisVars) .concat(proc.body.thisVars) .concat(proc.post.thisVars)) vars = vars.concat(thisVars) code.push("var " + vars.join(",")) for(var i=0; i<proc.arrayArgs.length; ++i) { code.push("p"+i+"|=0") } //Inline prelude if(proc.pre.body.length > 3) { code.push(processBlock(proc.pre, proc, dtypes)) } //Process body var body = processBlock(proc.body, proc, dtypes) var matched = countMatches(loopOrders) if(matched < dimension) { code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. } else { code.push(innerFill(loopOrders[0], proc, body)) } //Inline epilog if(proc.post.body.length > 3) { code.push(processBlock(proc.post, proc, dtypes)) } if(proc.debug) { console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") } var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) return f() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "CCF(op){\n op.subtraction_flag = 0;\n op.half_carry_flag = 0;\n op.carry_flag ^= 1;\n }", "function gen_op_clrex()\n{\n gen_opc_ptr.push({func:op_clrex});\n}", "function gen_op_logicq_cc()\n{\n gen_opc_ptr.push({func:op_logicq_cc});\n}", "function gen_op_logic_T0_cc()\n{\n gen_opc_ptr.push({func:op_logic_T0_cc});\n}", "function gen_op_logic_T1_cc()\n{\n gen_opc_ptr.push({func:op_logic_T1_cc});\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n var dimension = typesig[1].length|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n\n //First create arguments for procedure\n var arglist = [\"SS\"]\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i)\n arglist.push(\"t\"+i)\n arglist.push(\"p\"+i)\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\")\n }\n if(proc.indexArgs.length > 0) {\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) {\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n code.push(\"var \" + vars.join(\",\"))\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(orders)\n if(matched < dimension) {\n code.push(outerFill(matched, orders[0], proc, body))\n } else {\n code.push(innerFill(orders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"Generated cwise routine for \", typesig, \":\\n\\n\", code.join(\"\\n\"))\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n var dimension = typesig[1].length|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n\n //First create arguments for procedure\n var arglist = [\"SS\"]\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i)\n arglist.push(\"t\"+i)\n arglist.push(\"p\"+i)\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\")\n }\n if(proc.indexArgs.length > 0) {\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) {\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n code.push(\"var \" + vars.join(\",\"))\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(orders)\n if(matched < dimension) {\n code.push(outerFill(matched, orders[0], proc, body))\n } else {\n code.push(innerFill(orders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"Generated cwise routine for \", typesig, \":\\n\\n\", code.join(\"\\n\"))\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function gen_op_sbcl_T0_T1_cc()\n{\n gen_opc_ptr.push({func:op_sbcl_T0_T1_cc});\n}", "CPL(op){\n this.register_A = ~this.register_A & ADDRESS_MASK;\n this.subtraction_flag = true;\n this.half_carry_flag = true;\n }", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n code.push(\"var \" + vars.join(\",\"))\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}", "function gen_op_adcl_T0_T1_cc()\n{\n gen_opc_ptr.push({func:op_adcl_T0_T1_cc});\n}", "function generateCWiseOp(proc, typesig) {\r\n\t\r\n\t //Compute dimension\r\n\t // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n\t var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n\t var orders = new Array(proc.arrayArgs.length)\r\n\t var dtypes = new Array(proc.arrayArgs.length)\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t dtypes[i] = typesig[2*i]\r\n\t orders[i] = typesig[2*i+1]\r\n\t }\r\n\t \r\n\t //Determine where block and loop indices start and end\r\n\t var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n\t var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n\t var loopOrders = [] // orders restricted to the loop indices\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t if (proc.arrayBlockIndices[i]<0) {\r\n\t loopBegin.push(0)\r\n\t loopEnd.push(dimension)\r\n\t blockBegin.push(dimension)\r\n\t blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n\t } else {\r\n\t loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n\t loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n\t blockBegin.push(0)\r\n\t blockEnd.push(proc.arrayBlockIndices[i])\r\n\t }\r\n\t var newOrder = []\r\n\t for(var j=0; j<orders[i].length; j++) {\r\n\t if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n\t newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n\t }\r\n\t }\r\n\t loopOrders.push(newOrder)\r\n\t }\r\n\t\r\n\t //First create arguments for procedure\r\n\t var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n\t var code = [\"'use strict'\"]\r\n\t var vars = []\r\n\t \r\n\t for(var j=0; j<dimension; ++j) {\r\n\t vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n\t }\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t arglist.push(\"a\"+i) // Actual data array\r\n\t arglist.push(\"t\"+i) // Strides\r\n\t arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n\t \r\n\t for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n\t vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t \r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n\t vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n\t arglist.push(\"Y\" + i)\r\n\t }\r\n\t if(proc.shapeArgs.length > 0) {\r\n\t vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n\t }\r\n\t if(proc.indexArgs.length > 0) {\r\n\t // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n\t var zeros = new Array(dimension)\r\n\t for(var i=0; i<dimension; ++i) {\r\n\t zeros[i] = \"0\"\r\n\t }\r\n\t vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n\t }\r\n\t for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n\t var off_arg = proc.offsetArgs[i]\r\n\t var init_string = []\r\n\t for(var j=0; j<off_arg.offset.length; ++j) {\r\n\t if(off_arg.offset[j] === 0) {\r\n\t continue\r\n\t } else if(off_arg.offset[j] === 1) {\r\n\t init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n\t } else {\r\n\t init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n\t }\r\n\t }\r\n\t if(init_string.length === 0) {\r\n\t vars.push(\"q\" + i + \"=0\")\r\n\t } else {\r\n\t vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n\t }\r\n\t }\r\n\t\r\n\t //Prepare this variables\r\n\t var thisVars = uniq([].concat(proc.pre.thisVars)\r\n\t .concat(proc.body.thisVars)\r\n\t .concat(proc.post.thisVars))\r\n\t vars = vars.concat(thisVars)\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t code.push(\"p\"+i+\"|=0\")\r\n\t }\r\n\t \r\n\t //Inline prelude\r\n\t if(proc.pre.body.length > 3) {\r\n\t code.push(processBlock(proc.pre, proc, dtypes))\r\n\t }\r\n\t\r\n\t //Process body\r\n\t var body = processBlock(proc.body, proc, dtypes)\r\n\t var matched = countMatches(loopOrders)\r\n\t if(matched < dimension) {\r\n\t code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n\t } else {\r\n\t code.push(innerFill(loopOrders[0], proc, body))\r\n\t }\r\n\t\r\n\t //Inline epilog\r\n\t if(proc.post.body.length > 3) {\r\n\t code.push(processBlock(proc.post, proc, dtypes))\r\n\t }\r\n\t \r\n\t if(proc.debug) {\r\n\t console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n\t }\r\n\t \r\n\t var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n\t var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n\t return f()\r\n\t}", "function generateCWiseOp(proc, typesig) {\r\n\t\r\n\t //Compute dimension\r\n\t // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\r\n\t var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\r\n\t var orders = new Array(proc.arrayArgs.length)\r\n\t var dtypes = new Array(proc.arrayArgs.length)\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t dtypes[i] = typesig[2*i]\r\n\t orders[i] = typesig[2*i+1]\r\n\t }\r\n\t \r\n\t //Determine where block and loop indices start and end\r\n\t var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\r\n\t var loopBegin = [], loopEnd = [] // These indices are iterated over\r\n\t var loopOrders = [] // orders restricted to the loop indices\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t if (proc.arrayBlockIndices[i]<0) {\r\n\t loopBegin.push(0)\r\n\t loopEnd.push(dimension)\r\n\t blockBegin.push(dimension)\r\n\t blockEnd.push(dimension+proc.arrayBlockIndices[i])\r\n\t } else {\r\n\t loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\r\n\t loopEnd.push(proc.arrayBlockIndices[i]+dimension)\r\n\t blockBegin.push(0)\r\n\t blockEnd.push(proc.arrayBlockIndices[i])\r\n\t }\r\n\t var newOrder = []\r\n\t for(var j=0; j<orders[i].length; j++) {\r\n\t if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\r\n\t newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\r\n\t }\r\n\t }\r\n\t loopOrders.push(newOrder)\r\n\t }\r\n\t\r\n\t //First create arguments for procedure\r\n\t var arglist = [\"SS\"] // SS is the overall shape over which we iterate\r\n\t var code = [\"'use strict'\"]\r\n\t var vars = []\r\n\t \r\n\t for(var j=0; j<dimension; ++j) {\r\n\t vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\r\n\t }\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t arglist.push(\"a\"+i) // Actual data array\r\n\t arglist.push(\"t\"+i) // Strides\r\n\t arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\r\n\t \r\n\t for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\r\n\t vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t \r\n\t for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\r\n\t vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\r\n\t }\r\n\t }\r\n\t for(var i=0; i<proc.scalarArgs.length; ++i) {\r\n\t arglist.push(\"Y\" + i)\r\n\t }\r\n\t if(proc.shapeArgs.length > 0) {\r\n\t vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\r\n\t }\r\n\t if(proc.indexArgs.length > 0) {\r\n\t // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\r\n\t var zeros = new Array(dimension)\r\n\t for(var i=0; i<dimension; ++i) {\r\n\t zeros[i] = \"0\"\r\n\t }\r\n\t vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\r\n\t }\r\n\t for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\r\n\t var off_arg = proc.offsetArgs[i]\r\n\t var init_string = []\r\n\t for(var j=0; j<off_arg.offset.length; ++j) {\r\n\t if(off_arg.offset[j] === 0) {\r\n\t continue\r\n\t } else if(off_arg.offset[j] === 1) {\r\n\t init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \r\n\t } else {\r\n\t init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\r\n\t }\r\n\t }\r\n\t if(init_string.length === 0) {\r\n\t vars.push(\"q\" + i + \"=0\")\r\n\t } else {\r\n\t vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\r\n\t }\r\n\t }\r\n\t\r\n\t //Prepare this variables\r\n\t var thisVars = uniq([].concat(proc.pre.thisVars)\r\n\t .concat(proc.body.thisVars)\r\n\t .concat(proc.post.thisVars))\r\n\t vars = vars.concat(thisVars)\r\n\t code.push(\"var \" + vars.join(\",\"))\r\n\t for(var i=0; i<proc.arrayArgs.length; ++i) {\r\n\t code.push(\"p\"+i+\"|=0\")\r\n\t }\r\n\t \r\n\t //Inline prelude\r\n\t if(proc.pre.body.length > 3) {\r\n\t code.push(processBlock(proc.pre, proc, dtypes))\r\n\t }\r\n\t\r\n\t //Process body\r\n\t var body = processBlock(proc.body, proc, dtypes)\r\n\t var matched = countMatches(loopOrders)\r\n\t if(matched < dimension) {\r\n\t code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\r\n\t } else {\r\n\t code.push(innerFill(loopOrders[0], proc, body))\r\n\t }\r\n\t\r\n\t //Inline epilog\r\n\t if(proc.post.body.length > 3) {\r\n\t code.push(processBlock(proc.post, proc, dtypes))\r\n\t }\r\n\t \r\n\t if(proc.debug) {\r\n\t console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\r\n\t }\r\n\t \r\n\t var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\r\n\t var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\r\n\t return f()\r\n\t}", "function Yc(a, b) { return Xc(this, a, b, 1) }", "function gen_op_test_cc(param1)\n{\n //gen_opparam_ptr.push(param1);\n gen_opc_ptr.push({func:op_test_cc, param: param1});\n}", "function gen_op_rscl_T0_T1_cc()\n{\n gen_opc_ptr.push({func:op_rscl_T0_T1_cc});\n}", "function operatorExpression(code, ctx) {\n return expression(['_'], code, ctx);\n }", "function gen_op_sarl_T1_im_cc(param1)\n{\n //gen_opparam_ptr.push(param1);\n gen_opc_ptr.push({func:op_sarl_T1_im_cc, param: param1});\n}", "function operatorExpression(code, ctx) {\n return expression(['_'], code, ctx);\n}", "function operatorExpression(code, ctx) {\n return expression(['_'], code, ctx);\n}", "function gen_op_neon_cge_u8()\n{\n gen_opc_ptr.push({func:op_neon_cge_u8});\n}", "function gen_op_rrxl_T1_cc()\n{\n gen_opc_ptr.push({func:op_rrxl_T1_cc});\n}", "function cmn(q, a, b, x, s, t) \n{ \n return safe_add(rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b) \n}", "function gen_op_clz_T0()\n{\n gen_opc_ptr.push({func:op_clz_T0});\n}", "function cmn(q, a, b, x, s, t) { return add(rol(add(add(a, q), add(x, t)), s), b); }", "function Xc(a,b){return Vc(this,a,b,-1)}", "function Xc(a,b){return Vc(this,a,b,-1)}", "function Xc(a,b){return Vc(this,a,b,-1)}", "function Xc(a,b){return Vc(this,a,b,-1)}", "function Xc(a,b){return Vc(this,a,b,-1)}", "function Xc(a,b){return Vc(this,a,b,-1)}", "function Xc(a,b){return Vc(this,a,b,-1)}", "function Xc(a,b){return Vc(this,a,b,-1)}", "function gen_op_neon_cge_u32()\n{\n gen_opc_ptr.push({func:op_neon_cge_u32});\n}", "function gen_op_neon_cgt_u8()\n{\n gen_opc_ptr.push({func:op_neon_cgt_u8});\n}", "function operatorExpression(code, ctx) {\n return expression$2(['_'], code, ctx);\n }", "function gen_op_sarl_T1_T0_cc()\n{\n gen_opc_ptr.push({func:op_sarl_T1_T0_cc});\n}", "function gen_op_neon_cgt_s8()\n{\n gen_opc_ptr.push({func:op_neon_cgt_s8});\n}", "function gen_op_neon_cgt_u32()\n{\n gen_opc_ptr.push({func:op_neon_cgt_u32});\n}", "function test_operators_create() {\n class Vec2 {\n constructor(x, y) {\n this.x = x;\n this.y = y;\n }\n static mul_scalar(p1, a) {\n var r = new Vec2();\n r.x = p1.x * a;\n r.y = p1.y * a;\n return r;\n }\n toString() {\n return 'Vec2(' + this.x + ',' + this.y + ')';\n }\n }\n\n Vec2.prototype[Symbol.operatorSet] = Operators.create(\n {\n '+'(p1, p2) {\n var r = new Vec2();\n r.x = p1.x + p2.x;\n r.y = p1.y + p2.y;\n return r;\n },\n '-'(p1, p2) {\n var r = new Vec2();\n r.x = p1.x - p2.x;\n r.y = p1.y - p2.y;\n return r;\n },\n '=='(a, b) {\n return a.x == b.x && a.y == b.y;\n },\n '<'(a, b) {\n var r;\n /* lexicographic order */\n if(a.x == b.x) r = a.y < b.y;\n else r = a.x < b.x;\n return r;\n },\n '++'(a) {\n var r = new Vec2();\n r.x = a.x + 1;\n r.y = a.y + 1;\n return r;\n },\n '--'(a) {\n var r = new Vec2();\n r.x = a.x - 1;\n r.y = a.y - 1;\n return r;\n },\n '^'(p1, p2) {\n var r = Math.sqrt((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2);\n return r;\n }\n },\n {\n left: Number,\n '*'(a, b) {\n return Vec2.mul_scalar(b, a);\n }\n },\n {\n right: Number,\n '*'(a, b) {\n return Vec2.mul_scalar(a, b);\n }\n }\n );\n\n var a = new Vec2(10, 5);\n var b = new Vec2(110, 105);\n var r;\n\n console.log(`a * 2 + 3 * b = `, (r = a * 2 + 3 * b));\n console.log(`b - a = `, b - a);\n console.log(`b ^ a = `, b ^ a);\n a++;\n r = ++a;\n}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function Zc(a,b){return Xc(this,a,b,-1)}", "function gen_op_neon_cgt_s32()\n{\n gen_opc_ptr.push({func:op_neon_cgt_s32});\n}", "function gen_op_neon_ceq_u32()\n{\n gen_opc_ptr.push({func:op_neon_ceq_u32});\n}", "function gen_op_neon_cge_s8()\n{\n gen_opc_ptr.push({func:op_neon_cge_s8});\n}", "function makeOpComposition () {\n \n var ops = []; \n var domain = makeEmptyMap(); \n var gen = 0; \n \n var func = function (s) {\n return function (i) {\n return evaluate(domain.has(i) ? (ops.length-1) - (gen-domain.get(i)) : -1, i)(i);\n }\n \n // determine selection state of i but only access the elements \n // of ops (staring from ind) that have i in their domain\n function evaluate(ind, i) {\n if (ind < 0) return s; // i defined in the base selection mapping s\n else {\n var op = ops[ind];\n return op(function (j) { return evaluate(ind - op.domain.get(i), j)(i); });\n // the call to evaluate is wrapped to a lambda to make the call lazy.\n // op will only call the lambda if op.f.constant is false\n }\n }\n }\n \n func.domain = domain;\n \n // member functions of func\n func.push = function (op) {\n ops.push(op);\n ++gen\n op.domain.forEach(function(_, i) {\n op.domain.set(i, domain.has(i) ? gen - domain.get(i) : ops.length);\n domain.set(i, gen); \n });\n }\n func.pop = function () {\n var n = ops.length;\n var op = ops.pop();\n --gen;\n // domain updated for those elements that are in op.domain\n op.domain.forEach(function (_, i) {\n if (op.domain.get(i) >= n) domain.delete(i); // no op defines i\n else domain.set(i, domain.get(i) - op.domain.get(i)); \n });\n return op;\n }\n func.top = function () { return ops[ops.length - 1]; }\n func.top2 = function () { return ops[ops.length - 2]; }\n func.shift = function (bmap) {\n var op = ops.shift();\n op.domain.forEach(function(_, i) {\n if (domain.get(i) - gen === ops.length) { domain.delete(i); }\n // if lastOp the only op that defines i, remove i from domain\n });\n return op;\n }\n func.size = function () { return ops.length; }\n func.removeIndex = function (i) {\n if (!domain.has(i)) return;\n \n // find the first op in ops that defines i\n var j = (ops.length - 1) - (gen - domain.get(i));\n \n while (j >= 0) {\n var d = ops[j].domain.get(i);\n ops[j].domain.delete(i);\n j -= d;\n }\n domain.delete(i);\n }\n \n return func;\n }", "function gen_op_sarl_T1_0_cc()\n{\n gen_opc_ptr.push({func:op_sarl_T1_0_cc});\n}", "function Wc(a,b){return Vc(this,a,b,1)}", "function Wc(a,b){return Vc(this,a,b,1)}", "function Wc(a,b){return Vc(this,a,b,1)}", "function Wc(a,b){return Vc(this,a,b,1)}", "function Wc(a,b){return Vc(this,a,b,1)}", "function Wc(a,b){return Vc(this,a,b,1)}", "function Wc(a,b){return Vc(this,a,b,1)}", "function Wc(a,b){return Vc(this,a,b,1)}", "function gen_op_rorl_T1_T0_cc()\n{\n gen_opc_ptr.push({func:op_rorl_T1_T0_cc});\n}", "function Zc(a, b) { return Xc(this, a, b, -1) }", "function gen_op_movl_T0_cpsr()\n{\n gen_opc_ptr.push({func:op_movl_T0_cpsr});\n}", "function gen_op_neon_cge_s32()\n{\n gen_opc_ptr.push({func:op_neon_cge_s32});\n}", "function aCC(num1, num2)\n{\n\treturn new ComplexNumber(num1.real + num2.real, num1.img + num2.img);\n}", "function gen_op_iwmmxt_set_cup()\n{\n gen_opc_ptr.push({func:op_iwmmxt_set_cup});\n}", "function gen_op_subl_T0_T1_cc()\n{\n gen_opc_ptr.push({func:op_subl_T0_T1_cc});\n}", "function gen_op_shrl_T1_im_cc(param1)\n{\n //gen_opparam_ptr.push(param1);\n gen_opc_ptr.push({func:op_shrl_T1_im_cc, param: param1});\n}", "function gen_op_rorl_T1_im_cc(param1)\n{\n //gen_opparam_ptr.push(param1);\n gen_opc_ptr.push({func:op_rorl_T1_im_cc, param: param1});\n}", "function gen_op_shll_T1_im_cc(param1)\n{\n //gen_opparam_ptr.push(param1);\n gen_opc_ptr.push({func:op_shll_T1_im_cc, param: param1});\n}", "function cset_to_expr(cset,id){var i,l,ret=[]\n for(i=0,l=cset.length;i<l;i++)\n ret.push(id+'<'+cset[i]+'?'+(i%2?'1':'0')+':')\n ret.push(l%2?'1':'0')\n return ret.join('')}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}", "function Yc(a,b){return Xc(this,a,b,1)}" ]
[ "0.634074", "0.62518406", "0.6250411", "0.62167865", "0.6171341", "0.6124577", "0.6124577", "0.5979284", "0.5831132", "0.57429564", "0.57429564", "0.57429564", "0.57429564", "0.5656328", "0.5619601", "0.5619601", "0.5546452", "0.55394644", "0.54957616", "0.54555213", "0.54321593", "0.54103416", "0.54103416", "0.5406263", "0.5403888", "0.5395813", "0.5385451", "0.5385051", "0.5384774", "0.5384774", "0.5384774", "0.5384774", "0.5384774", "0.5384774", "0.5384774", "0.5384774", "0.5382675", "0.53813815", "0.5374444", "0.5348909", "0.5343739", "0.5343627", "0.5308824", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53084016", "0.53071904", "0.5306813", "0.5300292", "0.5300223", "0.5286646", "0.5277757", "0.5277757", "0.5277757", "0.5277757", "0.5277757", "0.5277757", "0.5277757", "0.5277757", "0.5267066", "0.52647054", "0.526351", "0.526218", "0.5261251", "0.5260097", "0.52584946", "0.52566075", "0.52555513", "0.5255404", "0.52413994", "0.5235231", "0.5235231", "0.5235231", "0.5235231", "0.5235231", "0.5235231", "0.5235231", "0.5235231", "0.5235231", "0.5235231", "0.5235231", "0.5235231", "0.5235231", "0.5235231" ]
0.5659622
16
Retrieves a local variable
function createLocal(id) { var nstr = prefix + id.replace(/\_/g, "__") localVars.push(nstr) return nstr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getVar(){\n var r = varStack[0];\n varStack.shift();\n return r;\n}", "function h$readLocalTVar(t, tv) {\n if(t.checkRead !== null) {\n t.checkRead.add(tv);\n }\n var t0 = t;\n while(t0 !== null) {\n var v = t0.tvars.get(tv);\n if(v !== null) {\n ;\n return v.val;\n }\n t0 = t0.parent;\n }\n var lv = t.accessed.get(tv);\n if(lv !== null) {\n ;\n return lv.val;\n } else {\n ;\n t.accessed.put(tv, new h$LocalTVar(tv));\n return tv.val;\n }\n}", "function h$readLocalTVar(t, tv) {\n if(t.checkRead !== null) {\n t.checkRead.add(tv);\n }\n var t0 = t;\n while(t0 !== null) {\n var v = t0.tvars.get(tv);\n if(v !== null) {\n ;\n return v.val;\n }\n t0 = t0.parent;\n }\n var lv = t.accessed.get(tv);\n if(lv !== null) {\n ;\n return lv.val;\n } else {\n ;\n t.accessed.put(tv, new h$LocalTVar(tv));\n return tv.val;\n }\n}", "function h$readLocalTVar(t, tv) {\n if(t.checkRead !== null) {\n t.checkRead.add(tv);\n }\n var t0 = t;\n while(t0 !== null) {\n var v = t0.tvars.get(tv);\n if(v !== null) {\n ;\n return v.val;\n }\n t0 = t0.parent;\n }\n var lv = t.accessed.get(tv);\n if(lv !== null) {\n ;\n return lv.val;\n } else {\n ;\n t.accessed.put(tv, new h$LocalTVar(tv));\n return tv.val;\n }\n}", "function h$readLocalTVar(t, tv) {\n if(t.checkRead !== null) {\n t.checkRead.add(tv);\n }\n var t0 = t;\n while(t0 !== null) {\n var v = t0.tvars.get(tv);\n if(v !== null) {\n ;\n return v.val;\n }\n t0 = t0.parent;\n }\n var lv = t.accessed.get(tv);\n if(lv !== null) {\n ;\n return lv.val;\n } else {\n ;\n t.accessed.put(tv, new h$LocalTVar(tv));\n return tv.val;\n }\n}", "get Local() {}", "function test() {\n var local = 123\n console.log(local)\n}", "function teste(){\n var local = 123\n console.log(local)\n}", "function getvar(name) {\n\t\treturn window[name];\n\t}", "function pgp_getVar(varName){\r\n\treturn varName+pgp_location;\r\n}", "getLocal(name) { return this.get(name); }", "getLocal(name) { return this.get(name); }", "function getVariable(str) {\n\n return str;\n}", "getVariable(varName){\n\n\t\t// To support derivate, I think this function needs to return the object\n\t\t// rather than the value\n\t\treturn this._variables[varName];\n\t\t// return this._variables[varName].valueOf();\n\n\t}", "getVariable(varName){\n\n\t\t// To support derivate, I think this function needs to return the object\n\t\t// rather than the value\n\t\treturn this._variables[varName];\n\t\t// return this._variables[varName].valueOf();\n\n\t}", "function AccessVariableGlobally() {\n globalName=\"Block360\"\n var localVariable=\"CIE-NUST\"\n}", "function LocalVarAccess(){ return Access.apply(this,arguments) }", "function myLocalScope(){\n var myVarLocal = 5;\n console.log(myVarLocal); // will show 5\n}", "getVar(name) {\n return __awaiter(this, void 0, void 0, function* () {\n const args = this._getArgsByPrefix(name);\n return this.request(`${this.prefix}get_var`, args).then(res => res, err => {\n if (err && err.message && err.message.includes('not found')) {\n return null;\n }\n throw err;\n });\n });\n }", "function localScope() {\n var myVariable = \"I am here!\";\n\n console.log(myVariable);\n}", "get variable() {\n\t\treturn this.__variable;\n\t}", "function extractVariable() {\n extract('var');\n}", "function wpsc_var_get( name ) {\n\tif ( typeof wpsc_vars !== 'undefined' ) {\n\t\treturn wpsc_vars[name];\n\t}\n\n\treturn undefined;\n}", "variable(name) {\r\n\r\n // Check which one it is\r\n name = name.toLowerCase()\r\n if (name == \"user.displayname\") {\r\n\r\n // Get user's name\r\n return Account.username || \"User\"\r\n\r\n } else if (name == \"input\") {\r\n\r\n // Get previous action's input\r\n return this.lastActionInput\r\n\r\n } else {\r\n\r\n // Unkown variable, return value from the variable storage\r\n return this.localEntity.variables[name]\r\n\r\n }\r\n\r\n }", "function someFunc() {\r\n\t\tvar somevar = 1;\r\n\t\t// local variable\r\n\t\tconsole.log(\"somevar is now 1\");\r\n\t}", "function h$LocalTVar(v) {\n ;\n this.readVal = v.val; // the value when read from environment\n this.val = v.val; // the current uncommitted value\n this.tvar = v;\n}", "function h$LocalTVar(v) {\n ;\n this.readVal = v.val; // the value when read from environment\n this.val = v.val; // the current uncommitted value\n this.tvar = v;\n}", "function h$LocalTVar(v) {\n ;\n this.readVal = v.val; // the value when read from environment\n this.val = v.val; // the current uncommitted value\n this.tvar = v;\n}", "function h$LocalTVar(v) {\n ;\n this.readVal = v.val; // the value when read from environment\n this.val = v.val; // the current uncommitted value\n this.tvar = v;\n}", "function foo(){\n var i = \"local\";//declaramos la misma variable i como local\n console.log(i);// mostrar local\n}", "getLocal(name) {\n return this.get(name);\n }", "getLocal(name) {\n return this.get(name);\n }", "function getLocalVariableContent(f, name){\n\tvar tmpEnt = f.getEntityByName(name);\n\t//set content equal to entity by default\n\tvar tmpVal = tmpEnt;\n\t//if OTHER is defined and it is an entity\n\tif( tmpEnt != null && tmpEnt.getTypeName() == RES_ENT_TYPE.ENTITY ){\n\t\t//re-define value of OTHER\n\t\ttmpVal = tmpEnt._value;\n\t}\n\t//return content for local variable\n\treturn tmpVal;\n}", "function getFromLocalNotEmpty(key, variable) {\r\n\tif (!isEmpty(localStorage.getItem(key))) {\r\n\t\tvariable = localStorage.getItem(key);\r\n\t}\r\n\treturn variable;\r\n}", "function ambito(variableGlobal){\n\n let variableLocal = \"Variable local\";\n\n console.log(variableGlobal);\n console.log(variableLocal);\n console.log(numeroGlobal.toString());\n}", "function getVariableById(id) {\n return document.getElementById(id);\n}", "function variables()\n{\n var local = 10;\n console.log(global + local);\n}", "function myLocalScope() {\n\tvar myVar11 = 5;\n\tconsole.log(myVar11);\n}", "function returnLocals() {\n let local = \"this is a local variable\";\n var localTwo = \"this is also a local variable\";\n return local + localTwo;\n}", "function checkscope() {\n\tvar scope = \"local\"; // Declare a local variable with the same name\n\treturn scope; // Return the local value, not the global one\n}", "peekVarString () {\n let pos = this.pos;\n let s = this.readVarString();\n this.pos = pos;\n return s\n }", "function myLocalScope() {\n var myVar = 5;\n console.log(myVar);\n}", "function getVar(t) {\n\t\tfor (var i = 0; i < varTable.length; i++) {\n\t\t\tif (varTable[i].name == t)\n\t\t\t\treturn varTable[i];\n\t\t}\n\t\treturn {\n\t\t\tname: 'null',\n\t\t\ttype: 'void',\n\t\t\tlength: 1\n\t\t}\n\t}", "function usingvar (){\n console.log(a); // return undefined\n var a = 10;\n}", "function samplefunction() {\r\n var myVariable = \"inside function\";\r\n}", "function variableHoisted() {\n var var1;\n if (true) {\n var1 = 1;\n } else {\n var1 = 2;\n }\n return var1;\n}", "function ThreadLocalGet() {\r\n}", "Global(varName){\n // return gameState.globals[varName];\n }", "function exercicio01() {\n var variavel = \"valor\";\n return variavel;\n}", "function localVars(x, y){\r\n var a = 6;\r\n function innerVars(){\r\n var a = 10;\r\n b = a;\r\n }\r\n var b = 7;\r\n function innerVars2(){\r\n var c = 11;\r\n var d = b;\r\n }\r\n innerVars();\r\n return b;\r\n}", "function readVariable(){\r\n\t\tvar ret={name:\"\"};\r\n\t\tnext();\r\n\t\treturn {name:word}\r\n\t\tswitch(type){\r\n\t\t\tcase \"word\":\r\n\t\t\t\tret.name=word;\r\n\t\t\tbreak;default:\r\n\t\t\t\treadNext=0;\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\treturn ret;\r\n\t}", "function getVar(s, name, def) {\n\treturn JSON.parse(match(s, new RegExp(\"var \"+name+\" *= *([^;]+);\"),1,def));\n}", "function myFunction()\n{\nx = 7; //x is local variable and value is 7.\n}", "function myTest() {\r\n var loc = \"foo\";\r\n console.log(loc);\r\n}", "function myLocalScope() {\n var myVar = 5 + \" This is myVar\";\n console.log(myVar);\n}", "function retr(input)\n{\n var index = names.indexOf(input);\n return variables[index];\n}", "function myTest() {\n var loc = \"foo\";\n console.log(loc);\n}", "function myTest() {\n var loc = \"foo\";\n console.log(loc);\n}", "function myTest() {\n var loc = \"foo\";\n console.log(loc);\n}", "function myTest() {\n var loc = \"foo\";\n console.log(loc);\n}", "get localReference() {\n return this.localRef;\n }", "function printVar2() {\n const costanza = 'Belongs to the local scope of a function.'\n console.log(costanza); //Belongs to the local scope of a function.\n\n}", "function local(t){\n\t// Here t is a local variable, can be passed with any type as a parameter\n\t// in js, every function will create a scope!!!!!\n\tconsole.log(t);\n\n\tvar x = 1; // local variable to the function, you can not use this outside this fucntion!\n\n\ty = 2; // we declare y without using var keyword, but assign a value to y\n\t// Basically, js will check as follows:\n\t// 1. check where y is declared inside the function scope\n\t// 2. check whether y is declared in the file scope\n\n\tz = 3; // global.z = 3, fails for both senario 1 & 2, js will create global.z object\n\n\t// scope: function scope-> file scope -> global scope\n\n\t// for glocal object: in nodejs: global; in browser: window\n\n\t// when access: search until global, if the variable is not defined in global, then throw out error\n\t// here \"access\" is like console.log()\n\n\t//assign: ... create a vriable in global\n}", "function local() {\n let localNumber = 4\n const localConst = 5\n console.log(localNumber, localConst)\n}", "getVar(variable) {\n\t\tconst tag = variable.toLowerCase();\n\t\treturn this._customVar[tag];\n\t}", "function someVar(){\n\tconsole.log(some)\n\tvar some = \"something\"\n}", "function changeLocal() {\n\n // global can be used here\n\n var a = 2; // local\n\n // local a now = 2\n\n return a;\n}", "function test(){\n\t// how to create a local variable under function local scope\n\tvar v1 = 1; // can only be used in current function\n\n\tv1 = 3; // assignment\n\n\treturn 1;\n}", "function test(){ // Variables in functions has a local scope\n var x = 222;\n return x;\n}", "function lvar() {\n var docomo = 12;\n document.write(\"<br>\" + docomo + \" local variable\");\n}", "variableOf(name) {\n\t\tfor (const v of this._vars) {\n\t\t\tif (v.name() === name) return v;\n\t\t}\n\t\treturn null;\n\t}", "variableAt(index) {\n\t\treturn this._vars[index];\n\t}", "function foo() {\n\tvar bar = 'bat'\n}", "function dfil_get_var(varname) {\n var wf1d = window.frames[1].document;\n var variable = $('head', wf1d).attr(varname);\n return variable ? variable : false;\n}", "function scope(){\n \n var localScope = 'LOCALSCOPE';\n\n console.log ( globalScope );\n\n return localScope;\n\n}", "function getVar(target) {\n if (!target) {\n console.log('ERROR: Imporper variable request for', target, 'from federal.variables.js');\n return null;\n }\n // Check to see if requested variable depends on marital status.\n if (target[plan.filingStatus]) {\n return target[plan.filingStatus];\n } else {\n return target;\n }\n }", "function teste() {/// essa bloco esta associada uma funcao.\n var local =123\n console.log(local)\n}", "function playWithVar() {\n a = \"do't do this\"; // global variable is assigned a value (bad practice example 😁)\n\n if (b === 1) { // using global variable\n var iAmLocalVar = 'local'; // declaration and initialization of function-scoped local variable.\n }\n\n // prints the following to console:\n // { iAmLocalVar: 'local' }\n console.log({ iAmLocalVar }); // using function-scoped local variable here.\n}", "function getFromLocalGreaterThanZero(key, variable) {\r\n\tif (localStorage.getItem(key) > 0) {\r\n\t\tvariable = localStorage.getItem(key);\r\n\t\tvariable = parseInt(variable);\r\n\t}\r\n\treturn variable;\r\n}", "i18nGenerateMainBlockVar() {\n return variable(this.constantPool.uniqueName(TRANSLATION_VAR_PREFIX));\n }", "i18nGenerateMainBlockVar() {\n return variable(this.constantPool.uniqueName(TRANSLATION_VAR_PREFIX));\n }", "function foo() {\n var bar;\n}", "function myLocalScope() {\n 'use strict'; // you shouldn't need to edit this line\n var myVar;\n console.log(myVar);\n}", "function get(){\n one = 300;\n// var one = 300;\n console.log(\"함수:\", one);\n}", "function getStorylineVar (varName)\n{\n try {\n var p = parent.GetPlayer();\n return p.GetVar(varName);\n } catch (err) {}\n}", "function getpetName(){\n var petName = 'Ha';\n return petName;\n}", "function myLocalScope() {\n 'use strict'; // you shouldn't need to edit this line\n var myVar = \"foo\";\n console.log(myVar);\n}", "function get(x) { return x; }", "function getVardas(){\n var vardas=\"Tomas\";\n return vardas;\n}", "function getMemory(variable)\r\n{\r\n\treturn getUtilities('memory', { action: 'get', variable: variable }).value;\r\n}", "function _getCurrentVariables(){\n return [\"ina\", \"ik\", \"il\"];\n }", "function getLocal(name){\n\n\tif (typeof(Storage) !== \"undefined\") {\n\t\treturn JSON.parse(localStorage.getItem(name));\n\t}else{\n\t\t//if we do not have local storage for some reason try to use cookies\n\t\treturn JSON.parse(getCookie(name));\n\t}\n\n}", "function dummyFunction() {\n let myVar = 'Hi there';\n console.log(myVar);\n}", "function TempVars() {\n}", "function normalVar(){\n num = 5;\n console.log(num);\n var num;\n }", "function foo() {\n let bar = 2; // local var\n console.log('local var \"bar\" inside function, ', bar); // logs local var\n}", "function getVariable(variable, callback) {\n var url = baseURL + $(\"#core-id\").val() + \"/\" + variable + \"?access_token=\" + $(\"#api-token\").val();\n $.getJSON(url, callback)\n .fail(function(obj) {\n onMethodFailure();\n });\n }", "function varGet(pieces, stateHolder, next) {\n\tpieces = pieces.filter(\n\t\t(element, index, array) => {\n\t\t\tif (element) return true;\n\t\t\treturn false;\n\t\t}\n\t);\n\n\tif (pieces.length == 3) {\n\t\treturn varGetAll(pieces, stateHolder, next);\n\t}\n\n\tif (pieces.length < 4) {\n\t\tstateHolder.simpleAddMessage(stateHolder.username, 'Not enough parameters to var get.');\n\t\treturn next();\n\t}\n\n\tvar parameters = {};\n\tparameters.name = pieces[3];\n\n\tvar namespace = pieces[2];\n\n\tvar value = '';\n\tfor (var i = 4; i < pieces.length; i++) {\n\t\tif (i != 4) value += ' ';\n\t\tvalue += pieces[i];\n\t}\n\n\tsetupVarParameters(\n\t\tparameters,\n\t\tnamespace,\n\t\tstateHolder,\n\t\t(err) => {\n\t\t\tif (err) {\n\t\t\t\tthrow new Error(err);\n\t\t\t}\n\n\t\t\tret.varModel.find(parameters).exec(\n\t\t\t\t(err, res) => {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tthrow new Error(err);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (res.length) {\n\t\t\t\t\t\tstateHolder.simpleAddMessage(stateHolder.channelID, res[0].value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstateHolder.simpleAddMessage(stateHolder.username, 'No such variable ' + parameters.name + '.');\n\t\t\t\t\t}\n\t\t\t\t\tnext();\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n}", "function myLocalScope() {\n 'use strict'; // you shouldn't need to edit this line\n var myVar = 7;\n console.log(myVar);\n}", "function ejemploVar() {\n if (true) {\n var variable = 100;\n console.log(variable);\n }\n console.log(variable);\n }", "function checkscope() {\n myVar = \"local\"; // Declare a local variable\n document.write(\"</br>\")\n document.write(myVar);\n}" ]
[ "0.7219391", "0.7143212", "0.7135867", "0.7135867", "0.7135867", "0.7074074", "0.6841914", "0.68389076", "0.6784249", "0.66357875", "0.65949667", "0.65949667", "0.6580295", "0.6563201", "0.6563201", "0.6555324", "0.6517439", "0.65061957", "0.6460275", "0.6442359", "0.64340425", "0.6427755", "0.63875395", "0.63705283", "0.63587004", "0.6346886", "0.631755", "0.631755", "0.631755", "0.62648433", "0.62303495", "0.62303495", "0.6229696", "0.61896425", "0.6139909", "0.6139797", "0.61143214", "0.60700434", "0.60416234", "0.6021948", "0.6011572", "0.60099286", "0.6009239", "0.5972004", "0.5970564", "0.5956281", "0.5947845", "0.59334904", "0.5923332", "0.5922565", "0.5908548", "0.5908382", "0.58689976", "0.5844718", "0.5843708", "0.58386797", "0.5805662", "0.5805662", "0.5805662", "0.5805662", "0.5797875", "0.57845783", "0.5782734", "0.57819587", "0.5779112", "0.57774216", "0.5776216", "0.5774039", "0.5765485", "0.5760007", "0.57587636", "0.57571566", "0.57569706", "0.5756074", "0.5751518", "0.5744707", "0.5738402", "0.57382405", "0.57183176", "0.571326", "0.571326", "0.571194", "0.570594", "0.57044554", "0.5702605", "0.570229", "0.5679196", "0.56739295", "0.5665725", "0.56624556", "0.5662258", "0.5651205", "0.56507057", "0.5639599", "0.5636448", "0.56348336", "0.5632857", "0.5632626", "0.56281507", "0.56222963", "0.56190133" ]
0.0
-1
Creates a this variable
function createThisVar(id) { var nstr = "this_" + id.replace(/\_/g, "__") thisVars.push(nstr) return nstr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "newInstance() {\r\n\t\t\t\t\tvar base, ref1;\r\n\t\t\t\t\tbase = ((ref1 = this.variable) != null ? ref1.base : void 0) || this.variable;\r\n\t\t\t\t\tif (base instanceof Call && !base.isNew) {\r\n\t\t\t\t\t\tbase.newInstance();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.isNew = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.needsUpdatedStartLocation = true;\r\n\t\t\t\t\treturn this;\r\n\t\t\t\t}", "constructor() {\n copy(this, create());\n }", "function VariableModule(self) {\n that = self;\n o = self.o;\n va = self.va;\n is = self.is;\n M = self.M;\n }", "function VariableBlock()\r\n{\r\n this.objectName = \"Variable\";\r\n\tthis.divHeight=16;\r\n\tthis.divWidth=40;\r\n\tthis.variableValue=0;\r\n\tthis.text=0;\r\n}", "constructur() {}", "function Variable(name) {\n if (!(this instanceof Variable)) {\n return new Variable(name);\n }\n\n this.name = name;\n}", "function toConstruct(instance_var) {\n instance_var = getName(instance_var);\n return \" this.\" + instance_var + \" = \" + instance_var + \";\";\n}", "function variable(name, argumentCount, isBuiltIn, value)\r\n{\r\n\tthis.name = name\r\n\tthis.argumentCount = argumentCount\r\n\tthis.isBuiltIn = isBuiltIn\r\n\tthis.value = value\r\n}", "create() {\n return this.new();\n }", "constructor(value){\n\t\tthis.value = value;\n\t}", "constructor() {\n super()\n self = this\n self.init()\n }", "constructor(value) {\n this.value = value;\n }", "function construct() { }", "constructor() { // Las clases necesitan un constructor, en este asignaremos las variables DENTRO DEL SCOPE GLOBAL\n this.valueA = 0;\n this.valueB = 0;\n }", "function newVariable(_name, _argumentCount, _isBuiltIn, _value)\r\n{\r\n\tworkStack.push(variableLastLookup)\r\n\r\n\t_name = _name.toLowerCase() // !!!\r\n\tif (variableIsDefined(_name))\r\n\t{\r\n\t\tvariableArray[variableLastLookup].name = _name\r\n\t\tvariableArray[variableLastLookup].argumentCount = _argumentCount\r\n\t\tvariableArray[variableLastLookup].isBuiltIn = _isBuiltIn\r\n\t\tvariableArray[variableLastLookup].value = _value\r\n\t}\r\n\telse\r\n\t{\r\n\t\tvariableArray.push( new variable(_name, _argumentCount, _isBuiltIn, _value) )\r\n\t\tvariableCount = variableArray.length\r\n\t}\r\n\r\n\tvariableLastLookup = workStack.pop()\r\n}", "create() {\n\t}", "function or(){this.__data__=new Ut}", "constructor(...args) {\n\t\tsuper(...args);\n\t\tthis.exampleVariable = \"Hello!\";\n\t}", "function Constructor(arg){\n this.var = arg;\n }", "static create(params) {\n return {type: `${this.prefix}${this.name}`, _instance: new this(params)}; //eslint-disable-line\n }", "constructor () {\n this.p = 1\n }", "static create () {}", "function Self(value){\n\t\tthis._value = value;\n\t}", "__previnit(){}", "function VariableDeclaration(){ return ListNode.apply(this,arguments) }", "function learnWithNew(str){\n this.name = str;\n this.functionObj = {name:str};\n let prop = \"its private variable\";\n }", "function BaseVariable(key) {\n return {\n type: \"variable\",\n key: () => key\n }\n}", "function Variable(id, name, value, eq, output) {\n // Error associated with this variable\n this.error = new r.ObservableProperty(null);\n // Is value stale?\n this.stale = new r.ObservableProperty(false);\n // Is the variable a source?\n this.source = new r.ObservableProperty(false);\n // Is the variable pending?\n this.pending = new r.ObservableProperty(false);\n // Is the variable contributing to an output?\n this.contributing = new r.ObservableProperty(u.Fuzzy.Yes);\n // Could the variable contribute to an output if edited?\n this.relevant = new r.ObservableProperty(u.Fuzzy.Yes);\n // Publishes events when value is touched or changed\n this.changes = new r.BasicObservable();\n this.id = id;\n this.name = name;\n this.value = new r.ObservableProperty(undefined, eq);\n this.output = new r.ObservableProperty(!!output);\n this.ladder = new r.PromiseLadder();\n // connect ladder to value\n this.ladder.addObserver(this, this.onLadderNext, this.onLadderError, null);\n if (value !== undefined) {\n var p;\n if (value instanceof r.Promise) {\n p = value;\n }\n else {\n p = new r.Promise();\n if (r.plogger) {\n r.plogger.register(p, this.name, \"variable initialization\");\n }\n p.resolve(value);\n }\n this.makePromise(p);\n }\n }", "function Ctor() {}", "constructor(params) {\n super(params);\n\n const oThis = this;\n }", "get variable() {\n\t\treturn this.__variable;\n\t}", "function self($this) {\n\treturn $this;\n}", "constructor() {\n this.name = 'Matt'\n }", "function MyCustom(){\nthis.property1 = \"something\";\n}", "function UniverseYet() {\n //cache instance\n var instance = this;\n //some function\n this.bang = \"Big\";\n UniverseYet = function () {\n return instance;\n };\n}", "function SuperType() {\n\t \t\t\t\tthis.property = true;\n\t \t\t\t}", "create () {}", "create () {}", "function Builder() {}", "function Builder() {}", "function NewObj(){}", "function learn(str){\n this.name = str;\n this.functionObj = {name:str};\n let prop = \"its private variable\";\n return this;\n }", "newObj() {\n const newObj = {};\n this.objects[this.count] = {};\n this.objects[this.count].JSobj = newObj; // Store JS object\n this.objects[this.count].DOMelements = {}; // Prepare to store DOM elements\n\n newObj.nodeID = null;\n newObj.id = this.count++;\n newObj.name = \"\";\n newObj.type = \"\";\n newObj.parent = \"null\";\n newObj.children = [];\n newObj.details = [];\n\n newObj.instance = this;\n\n // Remember which node to edit\n this.editNode = newObj.id;\n this.newObject = newObj;\n\n return newObj;\n }", "function Variable(scope,name,decl,o){\n\t\tthis._ref = STACK._counter++;\n\t\tthis._c = null;\n\t\tthis._scope = scope;\n\t\tthis._name = name;\n\t\tthis._alias = null;\n\t\tthis._initialized = true;\n\t\tthis._declarator = decl;\n\t\tthis._autodeclare = false;\n\t\tthis._declared = o && o.declared || false;\n\t\tthis._resolved = false;\n\t\tthis._options = o || {};\n\t\tthis._type = o && o.type || 'var'; // what about let here=\n\t\tthis._export = false;\n\t\tthis._references = []; // only needed when profiling\n\t\tthis._assignments = [];\n\t\tthis;\n\t}", "constructor(value){\n //\n //Construct the parent.\n super(value);\n }", "static new() {\n let g = new this();\n g.init();\n return g;\n }", "static studentBuilder() {\n // return new this('Ihor Kohut', 'qc')); // ---> object\n return new Student('Ihor Kohut', 'qc'); // ---> object\n }", "copy({ type = this.type, value = this.value } = {}) {\n const { id, lbp, rules, unknown, ignored } = this;\n return new this.constructor(id, {\n lbp,\n rules,\n unknown,\n ignored,\n type,\n value,\n original: this,\n });\n }", "function create() {\n\n}", "function Constructor() {\n return { someKey: \"some value\" };\n }", "function _construct()\n\t\t{;\n\t\t}", "static create() {\nreturn this.from_xyzw(0, 0, 0, 1);\n}", "constructor(){\n\t\tthis.util = new Util();\n\t\tthis.currentContextIdIndex = -1;\n\t}", "create() {}", "create() {}", "function Ctor() {\r\n }", "constructor(varId, varDispID, )\n {\n ;\n }", "get creator() { return creator }", "static get properties() { return {\n _variables: {type:Object} \n}}", "copy()\n\t{\n\t\treturn this.constructor.createNewInstance(this);\n\t}", "function Variable(initialValue, trainable, name) {\n if (trainable === void 0) { trainable = true; }\n var _this = _super.call(this, initialValue.shape, initialValue.dtype, null /* values */, initialValue.dataId) || this;\n _this.trainable = trainable;\n _this.name = name;\n if (_this.name == null) {\n _this.name = trackerFn().nextVariableId().toString();\n }\n try {\n trackerFn().registerVariable(_this);\n }\n catch (ex) {\n trackerFn().disposeTensor(_this);\n throw ex;\n }\n return _this;\n }", "function createVariable() {\n var id = nextVariableId++;\n var name = '$V';\n\n do {\n name += variableTokens[id % variableTokensLength];\n id = ~~(id / variableTokensLength);\n } while (id !== 0);\n\n return name;\n }", "async init() {\n return this;\n }", "constructor() {\n this.value = {};\n this.num = 0;\n }", "function CTOR() {\n this.name = 'Instance';\n}", "TP(val) {\n this._TP = val;\n return this;\n }", "function v(v) { return {type: 'var', v}}", "function VariableHud() {\n this.initialize.apply(this, arguments);\n}", "function Node(){\n\t\tthis.setup();\n\t\tthis;\n\t}", "constructor(name){\n this._name = name;\n }", "function Class() {\n this.someName = 'Shiv';\n}", "constructor() {\n\n\t\t// base constructor\n\n\t\t// the property active is never utilized however\n\n\t\tthis.active = true;\n\t}", "constructor (){}", "function NewObj() {}", "function Test(){\n this.value = true;\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1b7907ae;\n this.SUBCLASS_OF_ID = 0xb2b987f3;\n\n this.newValue = args.newValue;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x5f5c95f1;\n this.SUBCLASS_OF_ID = 0xb2b987f3;\n\n this.newValue = args.newValue;\n }", "function makeVariableToken(varIndex, start, end) {\n\treturn { type: \"variable\", \n\t index: varIndex,\n\t \"start\": start,\n\t \"end\": end };\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x26ae0971;\n this.SUBCLASS_OF_ID = 0xb2b987f3;\n\n this.newValue = args.newValue;\n }", "constructor() {\n\t\tif (!instance) { instance = this }\n\n\t\treturn instance\n\t}", "_copy () {\n return new this.constructor()\n }", "_copy () {\n return new this.constructor()\n }", "function func(arg){\n this.var = arg;\n }", "function func(arg){\n this.var = arg;\n }", "constructor(name){\n // if(Person.instance){\n // return Person.instance;\n // }\n // Person.instance = this;\n this.name = name;\n }", "function createRef() {\n var refObject = {\n current: null,\n };\n\n {\n Object.seal(refObject);\n }\n\n return refObject;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x53909779;\n this.SUBCLASS_OF_ID = 0xb2b987f3;\n\n this.prevValue = args.prevValue;\n this.newValue = args.newValue;\n }", "function PoolVariable(name, type, holderUUID, description) {\r\n this.name = name;\r\n this.uuid = guid();\r\n this.type = type;\r\n this.holderUUID = holderUUID;\r\n this.description = description;\r\n }", "function createRef() {\n var refObject = {\n current: null\n };\n {\n Object.seal(refObject);\n }\n return refObject;\n }", "function createRef() {\n var refObject = {\n current: null\n };\n {\n Object.seal(refObject);\n }\n return refObject;\n }", "function VarManager_VarManager()\n{\n\t//initialise variable table\n\tthis.VariablesTable = new Object();\n\t//identifies a function start\n\tthis.FunctionIdentifier = \"fx=\";\n\t//Variables Regular expression\n\tthis.RegExp_Variable = /(<variable>)(\\w+)(<\\/variable>)/i;\n\tthis.RegExp_StripBreakLines = /\\r\\n|\\r|\\n/g;\n\tthis.RegExp_StripHTML = /<[^>]*>/g;\n\tthis.RegExp_ConvertBreakLines = /<BR>|<\\/P>/gi;\n\tthis.RegExp_ConvertNBSP = /&nbsp;/g;\n\tthis.RegExt_HideVariableOpen = /(<variable>)/gi;\n\tthis.RegExt_ShowVariableOpen = /(¬5¬)/gi;\n\tthis.RegExt_HideVariableClose = /(<\\/variable>)/gi;\n\tthis.RegExt_ShowVariableClose = /(¬6¬)/gi;\n\t//function table\n\tthis.FunctionTable =\n\t\t[\n\t\t\t[\"FN_Add(\", fx_Add],\n\t\t\t[\"FN_Sub(\", fx_Sub],\n\t\t\t[\"FN_Mul(\", fx_Mul],\n\t\t\t[\"FN_Div(\", fx_Div],\n\t\t\t[\"FN_TodayDate(\", fx_Date],\n\t\t\t[\"FN_TodayTime(\", fx_Time],\n\t\t\t[\"FN_Lowercase(\", fx_Lower],\n\t\t\t[\"FN_Uppercase(\", fx_Upper],\n\t\t\t[\"FN_Capitalize(\", fx_Capitalise],\n\t\t\t[\"FN_StatementHTML(\", fx_Statement],\n\t\t\t[\"FN_StatementTEXT(\", fx_StatementStripped],\n\t\t\t[\"FN_OverviewHTML(\", fx_Statement],\n\t\t\t[\"FN_OverviewTEXT(\", fx_StatementStripped],\n\t\t\t[\"FN_LessonName(\", fx_LessonName],\n\t\t\t[\"FN_Hints(\", fx_Hints],\n\t\t\t[\"FN_ChangeDate(\", fx_ChangeDate],\n\t\t\t[\"FN_UserName(\", fx_UserName]\n\t\t];\n\t//current statement resource path\n\tthis.StatementResourcePath = __HOST_ENOTE_RESOURCES;\n\t//set convert statement to plain as false\n\tthis.ConvertStatementToPlain = false;\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x2be0dfa4;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x55188a2e;\n this.SUBCLASS_OF_ID = 0xb2b987f3;\n\n this.prevValue = args.prevValue;\n this.newValue = args.newValue;\n }", "function Persona(){\n\n let persona2 = new Persona()\n\n}", "constructor () {\n super()\n\n // Attach a shadow DOM tree to this element and\n // append the template to the shadow root.\n this.attachShadow({ mode: 'open' })\n .appendChild(template.content.cloneNode(true))\n\n /* Set up general pwd-app properties */\n this._pwdApp = this.shadowRoot.querySelector('#pwd-app')\n this.name = 'Memory'\n this._styleSize = this.shadowRoot.querySelector('style#size')\n this.width = 800\n this.height = 600\n\n this.SetSize(this.width, this.height)\n\n /* Set up app-specific properties */\n this.currentState = null\n this.userNickname = ''\n this.totalTime = 0\n this.gameType = ''\n\n /* Initiates the nickname state */\n this.DisplayNicknameState()\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x0e6b76ae;\n this.SUBCLASS_OF_ID = 0xb2b987f3;\n\n this.prevValue = args.prevValue;\n this.newValue = args.newValue;\n }", "function createRef() {\n var refObject = {\n current: null\n };\n {\n Object.seal(refObject);\n }\n return refObject;\n }", "function Foo1() {\n this.name1 = '1';\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x99c1d49d;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xc7345e6a;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this.value = args.value;\n }" ]
[ "0.6620614", "0.6212397", "0.6086407", "0.60396516", "0.596879", "0.591245", "0.58820903", "0.5843658", "0.580857", "0.5808394", "0.58077145", "0.57973707", "0.5777957", "0.576941", "0.57302535", "0.5727041", "0.5709703", "0.568413", "0.56579596", "0.56461936", "0.5634682", "0.5632831", "0.56264955", "0.5624287", "0.5619546", "0.56161773", "0.56151205", "0.5611886", "0.56091374", "0.5587366", "0.5549896", "0.5545988", "0.554579", "0.5544068", "0.55367506", "0.5527584", "0.55241525", "0.55241525", "0.55127037", "0.55127037", "0.5512555", "0.5510835", "0.55026615", "0.5492701", "0.549259", "0.54921", "0.5480282", "0.54802114", "0.5464871", "0.5463406", "0.5462832", "0.5445504", "0.543324", "0.5432579", "0.5432579", "0.5431175", "0.5428399", "0.54228765", "0.54207355", "0.5414639", "0.54027885", "0.53773916", "0.53696394", "0.536699", "0.5360634", "0.53587675", "0.53566533", "0.53539085", "0.53520274", "0.53420043", "0.53398734", "0.53361475", "0.53331584", "0.5332778", "0.5321763", "0.5319683", "0.5318452", "0.53151137", "0.53123164", "0.5306628", "0.5306334", "0.5306334", "0.5302675", "0.5302675", "0.5290956", "0.5286495", "0.5286286", "0.5285927", "0.5284461", "0.5284461", "0.52790314", "0.5278974", "0.5278811", "0.5276973", "0.5275522", "0.52720124", "0.5270053", "0.52636486", "0.52603424", "0.52568084" ]
0.6639504
0
Rewrites an ast node
function rewrite(node, nstr) { var lo = node.range[0], hi = node.range[1] for(var i=lo+1; i<hi; ++i) { exploded[i] = "" } exploded[lo] = nstr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function modifyAST(err, astNode, cb){\n\tif(!err){\n\t\tconsole.log(JSON.stringify(astNode, false, 2));\n\t\tcb(astNode);\n\t}\n\t\n}", "function traverseTree(replacementNode, functionName, ast) {\n console.log('traverse called');\n estraverse.replace(ast, {\n enter(node) {\n if (node.type === 'FunctionDeclaration') {\n if (node.id.name === functionName) {\n node.body = replacementNode.body[0].body;\n console.log('From parser. REPLACING!', node.id.name);\n }\n }\n },\n });\n}", "function massageAstNode(ast, newObj) {\n // Handling ApexDoc\n if (\n ast[\"@class\"] &&\n ast[\"@class\"] === apexTypes.BLOCK_COMMENT &&\n isApexDocComment(ast)\n ) {\n newObj.value = ast.value.replace(/\\s/g, \"\");\n }\n if (ast.scope && typeof ast.scope === \"string\") {\n // Apex is case insensitivity, but in sone case we're forcing the strings\n // to be uppercase for consistency so the ASTs may be different between\n // the original and parsed strings.\n newObj.scope = ast.scope.toUpperCase();\n } else if (\n ast.dottedExpr &&\n ast.dottedExpr.value &&\n ast.dottedExpr.value.names &&\n ast.dottedExpr.value[\"@class\"] === apexTypes.VARIABLE_EXPRESSION &&\n ast.names\n ) {\n // This is a workaround for #38 - jorje sometimes groups names with\n // spaces as dottedExpr, so we can't compare AST effectively.\n // In those cases we will bring the dottedExpr out into the names.\n newObj.names = newObj.dottedExpr.value.names.concat(newObj.names);\n newObj.dottedExpr = newObj.dottedExpr.value.dottedExpr;\n } else if (\n ast[\"@class\"] &&\n ast[\"@class\"] === apexTypes.WHERE_COMPOUND_EXPRESSION\n ) {\n // This flattens the SOQL/SOSL Compound Expression, e.g.:\n // SELECT Id FROM Account WHERE Name = 'Name' AND (Status = 'Active' AND City = 'Boston')\n // is equivalent to:\n // SELECT Id FROM Account WHERE Name = 'Name' AND Status = 'Active' AND City = 'Boston'\n for (let i = newObj.expr.length - 1; i >= 0; i -= 1) {\n if (\n newObj.expr[i][\"@class\"] === apexTypes.WHERE_COMPOUND_EXPRESSION &&\n newObj.expr[i].op[\"@class\"] === newObj.op[\"@class\"]\n ) {\n newObj.expr.splice(i, 1, ...newObj.expr[i].expr);\n }\n }\n }\n METADATA_TO_IGNORE.forEach(name => delete newObj[name]);\n}", "function probTransformAST(ast)\n{\n\testraverse.replace(ast, callWrapper)\n\tast[\"body\"].unshift(esprima.parse(preamble))\n\treturn ast\n}", "function mutate(ast) {\n\ttry {\n\t\t//var ast = UglifyJS.parse(code);\n\t\tvar_insert_init();\n\t\ttotal_for_mutate = [];\n\t\t//already_mutate = [];\n\t\ttotal_for_mutate = collectMostReferenceVar(ast);\n\t\tcntr_set.varName = generateMutateName();\n\t\tif( cntr_set.varName == \"GENERATE_NO_NAME\" )\n\t\t\treturn \"MUTATE_END\";\n\n\t\tvar ast_new = ast.transform(var_transformer);\n\n\t\treturn ast_new;\t\n\t} catch(ex) {\n\t\tconsole.log(\"EEEE: \" + ex);\n\t\treturn;\n\t}\n\t\n}", "function walkAst(node, parent) {\n\t\t\tif (!node)\n\t\t\t\treturn;\n\t\t\tfor (var key in node) {\n\t\t\t\tif (key === 'range')\n\t\t\t\t\tcontinue;\n\t\t\t\tvar value = node[key];\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\tfor (var i = 0, l = value.length; i < l; i++)\n\t\t\t\t\t\twalkAst(value[i], node);\n\t\t\t\t} else if (value && typeof value === 'object') {\n\t\t\t\t\t// We cannot use Base.isPlainObject() for these since\n\t\t\t\t\t// Acorn.js uses its own internal prototypes now.\n\t\t\t\t\twalkAst(value, node);\n\t\t\t\t}\n\t\t\t}\n\t\t\tswitch (node && node.type) {\n\t\t\tcase 'BinaryExpression':\n\t\t\t\tif (node.operator in binaryOperators\n\t\t\t\t\t\t&& node.left.type !== 'Literal') {\n\t\t\t\t\tvar left = getCode(node.left),\n\t\t\t\t\t\tright = getCode(node.right);\n\t\t\t\t\treplaceCode(node, '_$_(' + left + ', \"' + node.operator\n\t\t\t\t\t\t\t+ '\", ' + right + ')');\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'AssignmentExpression':\n\t\t\t\tif (/^.=$/.test(node.operator)\n\t\t\t\t\t\t&& node.left.type !== 'Literal') {\n\t\t\t\t\tvar left = getCode(node.left),\n\t\t\t\t\t\tright = getCode(node.right);\n\t\t\t\t\treplaceCode(node, left + ' = _$_(' + left + ', \"'\n\t\t\t\t\t\t\t+ node.operator[0] + '\", ' + right + ')');\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'UpdateExpression':\n\t\t\t\tif (!node.prefix && !(parent && (\n\t\t\t\t\t\t// We need to filter out parents that are comparison\n\t\t\t\t\t\t// operators, e.g. for situations like if (++i < 1),\n\t\t\t\t\t\t// as we can't replace that with if (_$_(i, \"+\", 1) < 1)\n\t\t\t\t\t\t// Match any operator beginning with =, !, < and >.\n\t\t\t\t\t\tparent.type === 'BinaryExpression'\n\t\t\t\t\t\t\t&& /^[=!<>]/.test(parent.operator)\n\t\t\t\t\t\t// array[i++] is a MemberExpression with computed = true\n\t\t\t\t\t\t// We can't replace that with array[_$_(i, \"+\", 1)].\n\t\t\t\t\t\t|| parent.type === 'MemberExpression'\n\t\t\t\t\t\t\t&& parent.computed))) {\n\t\t\t\t\tvar arg = getCode(node.argument);\n\t\t\t\t\treplaceCode(node, arg + ' = _$_(' + arg + ', \"'\n\t\t\t\t\t\t\t+ node.operator[0] + '\", 1)');\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'UnaryExpression':\n\t\t\t\tif (node.operator in unaryOperators\n\t\t\t\t\t\t&& node.argument.type !== 'Literal') {\n\t\t\t\t\tvar arg = getCode(node.argument);\n\t\t\t\t\treplaceCode(node, '$_(\"' + node.operator + '\", '\n\t\t\t\t\t\t\t+ arg + ')');\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}", "visitNode(node) { }", "function formatAst(ast) {\n return (0, _language.visit)(ast, { leave: printDocASTReducer });\n}", "function prepareAst(src){\n var tree = (typeof src === 'string') ? parse(src) : src\n return hoist(tree)\n}", "function prepareAst(src){\n var tree = (typeof src === 'string') ? parse(src) : src\n return hoist(tree)\n}", "function optimize(ast) {\n }", "function optimize(ast) {\n }", "function mutate_1(ast) {\n\ttry {\n\t\t//var ast = UglifyJS.parse(code);\n\t\tvar_insert_init();\n\t\ttotal_for_mutate = [];\n\t\t//already_mutate = [];\n\t\ttotal_for_mutate = collectMostReferenceVar(ast);\n\t\tcntr_set.varName = generateMutateName_1();\n\t\tif( cntr_set.varName == \"GENERATE_NO_NAME\" )\n\t\t\treturn \"MUTATE_END\";\n\n\t\tvar ast_new = ast.transform(var_transformer);\n\n\t\treturn ast_new;\t\n\t} catch(ex) {\n\t\tconsole.log(\"EEEE: \" + ex);\n\t\treturn;\n\t}\n\t\n}", "visit(node, context) {\n if (node instanceof AST) {\n node.visit(this, context);\n }\n else {\n node.visit(this);\n }\n }", "visit(node, context) {\n if (node instanceof AST) {\n node.visit(this, context);\n }\n else {\n node.visit(this);\n }\n }", "function transformation1(ast) {\n const state = {\n stopTraversal: false,\n skipSubNodes: false,\n };\n\n // We'll start by calling the traverser function with our ast and a visitor.\n // The newAST will be mutated through this traversal process.\n ast.traverse(explode(ownershipVisitor), state);\n logger.verbose('Performing final error checks on the zol AST...');\n ast.traverse(explode(errorChecksVisitor), state);\n\n // At the end of our transformer function we'll return the new ast that we\n // just created.\n return ast;\n}", "function PEGtoAST(node) {\n switch (type(node)) {\n case \"null\":\n return undefined;\n case \"string\":\n return new StringNode(node);\n case \"array\":\n return new ASTNodeList(...node.map(PEGtoAST));\n case \"object\":\n switch (node.TYPE) {\n case \"whitespace\":\n return new Whitespace();\n case \"parbreak\":\n return new Parbreak();\n case \"subscript\":\n return new Subscript(PEGtoAST(node.content));\n case \"superscript\":\n return new Superscript(PEGtoAST(node.content));\n case \"inlinemath\":\n return new InlineMath(PEGtoAST(node.content));\n case \"displaymath\":\n return new DisplayMath(PEGtoAST(node.content));\n case \"mathenv\":\n return new MathEnv(node.env, PEGtoAST(node.content));\n case \"group\":\n return new Group(PEGtoAST(node.content));\n case \"macro\":\n return new Macro(node.content, PEGtoAST(node.args));\n case \"environment\":\n return new Environment(\n PEGtoAST(node.env),\n PEGtoAST(node.args),\n PEGtoAST(node.content)\n );\n case \"verbatim\":\n return new Verbatim(PEGtoAST(node.content));\n case \"verb\":\n return new Verb(node[\"escape\"], PEGtoAST(node.content));\n case \"commentenv\":\n return new CommentEnv(PEGtoAST([node.content]));\n case \"comment\":\n return new CommentNode(\n node.sameline,\n PEGtoAST(node.content)\n );\n case \"arglist\":\n return new ArgList(PEGtoAST(node.content));\n }\n }\n}", "function getAst(code, sourceFileName) {\n // A utility class for handling nodes of an AST.\n function NodeUtils() {\n var self = this;\n // Performs deep copy of the given node.\n this.deepCopy = function(node) {\n return JSON.parse(JSON.stringify(node));\n };\n\n // Deletes a node from the body.\n this.deleteNode = function(parentBody, nodeToDel) {\n var deleteIndex = parentBody.indexOf(nodeToDel);\n parentBody.splice(deleteIndex, 1);\n };\n\n // Replaces source node with the target node and returns a reference to the new node.\n this.replaceNode = function(source, target, context) {\n var sourceCopy = self.deepCopy(source);\n\n Object.keys(source).forEach(function(key) {\n delete source[key];\n });\n Object.keys(target).forEach(function(key) {\n source[key] = target[key];\n });\n\n // Using this check temporarily.\n // if (!self.hasLocNode(sourceCopy)) {\n // \treturn source;\n // }\n\n // Attach the loc nodes based on the context.\n switch (context) {\n // Mapping of loc nodes for N1qlQuery happens during the substitution of variables in the N1QL query string.\n /*\n \tBefore:\n \tvar res1 = new N1qlQuery(`select * from :bucket LIMIT 10;`);\n \tAfter:\n \tvar res1 = new N1qlQuery('select * from ' + bucket + ' LIMIT 10;');\n */\n case Context.N1qlQuery:\n source.loc = self.deepCopy(sourceCopy.loc);\n source.callee.loc = self.deepCopy(sourceCopy.callee.loc);\n source.arguments[0].loc = self.deepCopy(sourceCopy.arguments[\n 0].quasis[0].loc);\n break;\n\n // Mapping of if-else block to for-of loop.\n /*\n \tBefore:\n \tfor (var r of res1){...}\n \tAfter:\n \tif (res1.isInstance) {\n \t\tres1.iter(function (r) {...}\n \t} else {...}\n */\n case Context.IterTypeCheck:\n source.loc = self.deepCopy(sourceCopy.loc);\n source.consequent.loc = self.deepCopy(sourceCopy.body.loc);\n source.test.loc = self.deepCopy(sourceCopy.right.loc);\n source.test.object.loc = self.deepCopy(sourceCopy.right\n .loc);\n source.test.property.loc = self.deepCopy(sourceCopy.right\n .loc);\n\n // TODO: Currently, after breaking out from labeled break statement, it goes to the beginning of the for-of loop.\n //\t\tIdeally, it should go to the end of the labeled block. This looks quite ideal to show the iteration behaviour -\n //\t\tIt stops at the enclosing for-of loops (iterators) before coming out and thus, demonstrating the stopping\n //\t\tof iteration. Need to ask whether this is ok or if the default behaviour is needed.\n if (source.consequent.body.length > 1 &&\n /SwitchStatement/.test(source.consequent.body[1].type)\n ) {\n self.forceSetLocForAllNodes(sourceCopy.loc, source.consequent\n .body[1]);\n }\n break;\n\n // The following case handles two-way mapping of loc nodes between continue and return statements.\n case Context.ContinueStatement:\n source.loc = self.deepCopy(sourceCopy.loc);\n switch (source.type) {\n // Return to continue statement mapping - source: return, target: continue\n case 'ContinueStatement':\n if (source.label) {\n source.label.loc = self.deepCopy(sourceCopy\n .loc);\n }\n break;\n\n // Continue to return statement mapping - source: continue, target: return\n case 'ReturnStatement':\n if (source.argument && sourceCopy.label.loc) {\n source.argument = self.setLocForAllNodes(\n sourceCopy.label.loc, source.argument\n );\n }\n break;\n\n default:\n throw 'Not yet handled for ' + source.type;\n }\n break;\n\n // The following case handles two-way mapping of loc nodes between break and return statements.\n case Context.BreakStatement:\n source.loc = self.deepCopy(sourceCopy.loc);\n switch (source.type) {\n // Return to break statement mapping - source: return, target: break\n case 'BreakStatement':\n source.label.loc = self.deepCopy(sourceCopy.argument\n .loc);\n break;\n\n // Break to return statement mapping - source: break, target: return\n case 'ReturnStatement':\n source.argument = self.setLocForAllNodes(\n sourceCopy.loc, source.argument);\n break;\n\n default:\n throw 'Not yet handled for ' + source.type;\n }\n break;\n\n // The following case handles mapping of loc nodes between two different 'stopIter' calls.\n /*\n \tBefore:\n \treturn res2.stopIter({\n \t\t'code': 'labeled_break',\n \t\t'args': 'x'\n \t});\n \tAfter:\n \treturn res1.stopIter({\n \t\t'code': 'labeled_break',\n \t\t'args': 'x'\n \t});\n */\n case Context.BreakAltInterrupt:\n self.setLocMatchingNodes(sourceCopy, source);\n break;\n\n // The following case handles the mapping of loc nodes between stopIter and\n // return statement or between two stopIter statements as the above case.\n /*\n \tBefore:\n \treturn res2.stopIter({\n \t\t\t'code': 'labeled_continue',\n \t\t\t'args': 'x'\n \t\t});\n \tAfter:\n \treturn;\n */\n case Context.ContinueAltInterrupt:\n if (source.argument) {\n self.setLocMatchingNodes(sourceCopy, source);\n } else {\n source.loc = sourceCopy.loc;\n }\n break;\n }\n\n return source;\n };\n\n // Checks if atleast one loc node is present in the AST.\n this.hasLocNode = function(ast) {\n var hasLoc = false;\n estraverse.traverse(ast, {\n enter: function(node) {\n if (hasLoc) {\n return;\n }\n\n hasLoc = node.loc;\n }\n });\n\n return hasLoc;\n };\n\n // Adds loc node for all the nodes in the AST.\n // Thus, all the nodes of AST might end up having unnecessary loc nodes.\n // Though this method wouldn't modify the parsing behaviour, it must be used as a last resort.\n this.forceSetLocForAllNodes = function(loc, ast) {\n estraverse.traverse(ast, {\n enter: function(node) {\n if (!node.loc) {\n node.loc = self.deepCopy(loc);\n }\n }\n });\n };\n\n // This is a safe method for adding loc nodes for a given AST.\n // The disadvantage is that it can not be used with all the AST.\n this.setLocForAllNodes = function(loc, ast) {\n // Generate the code snippet for the given AST.\n var codeSnippet = escodegen.generate(ast);\n // Parse with loc enabled to determine the nodes to which we can attach loc node.\n var astWithLoc = esprima.parse(codeSnippet, {\n loc: true\n });\n\n // We new traverse astWithLoc and replace all the loc nodes.\n estraverse.traverse(astWithLoc, {\n enter: function(node) {\n node.loc = node.loc ? nodeUtils.deepCopy(\n loc) : null;\n }\n });\n\n return astWithLoc.body[0].expression;\n };\n\n // This is a safe method for performing a one-to-one copy of the loc nodes from AST1 to AST2.\n // The two ASTs must have the same structure.\n this.setLocMatchingNodes = function(source, target) {\n var sourceNodeStack = new Stack(),\n targetNodeStack = new Stack();\n\n // Linearizes the given AST into a stack.\n function convertTreeToStack(ast, stack) {\n estraverse.traverse(ast, {\n enter: function(node) {\n stack.push(node);\n }\n });\n }\n\n convertTreeToStack(source, sourceNodeStack);\n convertTreeToStack(target, targetNodeStack);\n\n // Pop all nodes from the sourceNodeStack and if an element contains loc node,\n // copy it to the corresponding element in the targetNodeStack.\n while (!sourceNodeStack.isEmpty()) {\n var sourceNode = sourceNodeStack.pop();\n var targetNode = targetNodeStack.pop();\n if (sourceNode.loc) {\n targetNode.loc = self.deepCopy(sourceNode.loc);\n }\n }\n };\n\n // Inserts the given node to the given parentBody at the specified index.\n this.insertNode = function(parentBody, refNode, nodeToInsert,\n insertAfter) {\n var insertIndex = insertAfter ? parentBody.indexOf(refNode) + 1 :\n parentBody.indexOf(refNode);\n parentBody.splice(insertIndex, 0, nodeToInsert);\n };\n\n // A N1QL node is a statement of the form new N1qlQuery('...');\n this.isN1qlNode = function(node) {\n return /NewExpression/.test(node.type) && /N1qlQuery/.test(node\n .callee.name);\n };\n\n this.convertToBlockStmt = function(node) {\n switch (node.type) {\n case 'ForOfStatement':\n // Transform the previous single-line statement into a block.\n node.body.body = [nodeUtils.deepCopy(node.body)];\n node.body.type = 'BlockStatement';\n break;\n case 'IfStatement':\n node.consequent.body = [nodeUtils.deepCopy(node.consequent)];\n node.consequent.type = 'BlockStatement';\n // If the 'else' part exists, convert it to a block statement.\n if (node.alternate) {\n node.alternate.body = [nodeUtils.deepCopy(node.alternate)];\n node.alternate.type = 'BlockStatement';\n }\n break;\n default:\n throw 'unhandled case for: ' + node.type;\n }\n };\n\n // Inserts an array of AST nodes into parentBody at the specified index.\n this.insertNodeArray = function(parentBody, insAfterNode, arrayToInsert) {\n var insertIndex = parentBody.indexOf(insAfterNode) + 1;\n parentBody.splice.apply(parentBody, [insertIndex, 0].concat(\n arrayToInsert));\n };\n\n // Build an ast node for N1QL function call from the query.\n this.getQueryAst = function(query) {\n // Identifier regex.\n var re = /:([a-zA-Z_$][a-zA-Z_$0-9]*)/g;\n\n // Replace the :<var> with proper substitution.\n query = query.replace(re, '\" + $1 + \"');\n query = 'new N1qlQuery(\"' + query + '\");';\n\n return esprima.parse(query).body[0].expression;\n };\n\n // Checks if the global scope contains only function declarations.\n this.checkGlobals = function(ast) {\n for (var node of ast.body) {\n if (!/FunctionDeclaration/.test(node.type)) {\n throw 'Only function declaration are allowed in global scope';\n }\n }\n }\n }\n\n // A general purpose stack.\n function Stack() {\n var stack = [];\n\n this.stackCopy = stack;\n\n this.push = function(item) {\n stack.push(item);\n };\n\n this.pop = function() {\n if (stack.length === 0) {\n throw 'Stack underflow exception';\n }\n return stack.pop();\n };\n\n this.peek = function() {\n var size = this.getSize();\n if (size >= 0) {\n return stack[size - 1];\n }\n };\n\n this.getSize = function() {\n return stack.length;\n };\n\n this.cloneStack = function() {\n var clone = new Stack();\n\n for (var item of stack) {\n clone.push(nodeUtils.deepCopy(item));\n }\n\n return clone;\n };\n\n this.reverseElements = function() {\n stack.reverse();\n };\n\n this.isEmpty = function() {\n return stack.length === 0;\n };\n\n // debug.\n this.printAll = function() {\n for (var item of stack) {\n console.log(item);\n console.log();\n }\n }\n }\n\n // A sub-class of Stack. Its purpose it to maintain the ancestral information\n // of nodes : node-parent relationship.\n function AncestorStack() {\n Stack.call(this);\n\n // Returns or pops a node that satisfies the comparator.\n function getOrPopAncestor(_this, comparator, pop) {\n var tempStack = new Stack();\n var found = false;\n\n // Run through all the elements in the stack against the comparator and break out once the element is found.\n while (_this.getSize() > 0 && !found) {\n var node = _this.pop();\n tempStack.push(node);\n found = comparator(nodeUtils.deepCopy(node));\n }\n\n if (pop) {\n tempStack.pop();\n }\n\n // Restore everything back to the stack.\n while (tempStack.getSize() > 0) {\n _this.push(tempStack.pop());\n }\n\n return found ? node : null;\n }\n\n this.getAncestor = function(comparator) {\n return getOrPopAncestor(this, comparator, false);\n };\n\n this.popNode = function(comparator) {\n return getOrPopAncestor(this, comparator, true);\n };\n\n // Returns the topmost node of the given type. Need not necessarily be the top of stack.\n this.getTopNodeOfType = function(nodeType) {\n return this.getAncestor(function(node) {\n return nodeType === node.type;\n });\n };\n\n this.popTopNodeOfType = function(nodeType) {\n return this.popNode(function(node) {\n return nodeType === node.type;\n });\n };\n\n this.cloneAncestorStack = function() {\n var clone = new AncestorStack();\n // Clone the stack.\n var stackClone = this.cloneStack();\n\n while (stackClone.getSize() > 0) {\n clone.push(stackClone.pop());\n }\n\n // Reverse the stack elements.\n clone.reverseElements();\n\n return clone;\n };\n }\n\n // Class to maintain the association of loop modifiers - break, continue, return etc. with JavaScript loops.\n function LoopModifier(modifier) {\n var ancestorStack = new AncestorStack();\n this.modType = modifier;\n this.stackIndex = -1;\n\n // debug.\n this.stackCopy = ancestorStack.stackCopy;\n\n // Initializing association information.\n // Obtained from JavaScript reference - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference\n var associations = new Set();\n switch (this.modType) {\n case LoopModifier.CONST.BREAK:\n associations.add('DoWhileStatement');\n associations.add('ForStatement');\n associations.add('ForInStatement');\n associations.add('ForOfStatement');\n associations.add('SwitchStatement');\n associations.add('WhileStatement');\n associations.add('LabeledStatement');\n break;\n\n case LoopModifier.CONST.CONTINUE:\n associations.add('DoWhileStatement');\n associations.add('ForStatement');\n associations.add('ForInStatement');\n associations.add('ForOfStatement');\n associations.add('SwitchStatement');\n associations.add('WhileStatement');\n break;\n\n case LoopModifier.CONST.LABELED_CONTINUE:\n case LoopModifier.CONST.LABELED_BREAK:\n associations.add('LabeledStatement');\n break;\n\n case LoopModifier.CONST.RETURN:\n associations.add('FunctionDeclaration');\n associations.add('FunctionExpression');\n break;\n\n default:\n throw 'Invalid modifier';\n }\n\n this.checkAssoc = function(nodeType) {\n return associations.has(nodeType);\n };\n\n // Push the node if it associates with the loop modifier instance.\n this.pushIfAssoc = function(node) {\n if (this.checkAssoc(node.type)) {\n switch (this.modType) {\n case LoopModifier.CONST.BREAK:\n node.breakStackIndex = this.stackIndex;\n break;\n\n case LoopModifier.CONST.CONTINUE:\n node.continueStackIndex = this.stackIndex;\n break;\n\n case LoopModifier.CONST.LABELED_BREAK:\n node.lblBreakStackIndex = this.stackIndex;\n break;\n\n case LoopModifier.CONST.RETURN:\n node.returnStackIndex = this.stackIndex;\n break;\n\n case LoopModifier.CONST.LABELED_CONTINUE:\n node.lblContinueStackIndex = this.stackIndex;\n break;\n\n default:\n throw 'Invalid modifier type';\n }\n\n ancestorStack.push(node);\n }\n };\n\n this.popIfAssoc = function() {\n if (ancestorStack.getSize() > 0) {\n switch (this.modType) {\n case LoopModifier.CONST.BREAK:\n if (this.stackIndex === ancestorStack.peek().breakStackIndex) {\n return ancestorStack.pop();\n }\n break;\n\n case LoopModifier.CONST.CONTINUE:\n if (this.stackIndex === ancestorStack.peek().continueStackIndex) {\n return ancestorStack.pop();\n }\n break;\n\n case LoopModifier.CONST.LABELED_BREAK:\n if (this.stackIndex === ancestorStack.peek().lblBreakStackIndex) {\n return ancestorStack.pop();\n }\n break;\n\n case LoopModifier.CONST.RETURN:\n if (this.stackIndex === ancestorStack.peek().returnStackIndex) {\n return ancestorStack.pop();\n }\n break;\n\n case LoopModifier.CONST.LABELED_CONTINUE:\n if (this.stackIndex === ancestorStack.peek().lblContinueStackIndex) {\n return ancestorStack.pop();\n }\n break;\n\n default:\n throw 'Invalid modifier type';\n }\n }\n };\n\n\n this.getSize = function() {\n return ancestorStack.getSize();\n };\n\n // Returns a boolean suggesting whether the loop modifier needs to be replaced.\n this.isReplaceReq = function(args) {\n switch (this.modType) {\n // For break and continue, the replacement criteria is the for-of node being the parent on TOS.\n case LoopModifier.CONST.CONTINUE:\n case LoopModifier.CONST.BREAK:\n return ancestorStack.getSize() > 0 && /ForOfStatement/.test(\n ancestorStack.peek().type);\n\n case LoopModifier.CONST.LABELED_CONTINUE:\n // For labelled break, the replacement criteria is the absence of the label which the break is\n // associated with.\n case LoopModifier.CONST.LABELED_BREAK:\n return !ancestorStack.getAncestor(function(node) {\n if (/LabeledStatement/.test(node.type)) {\n return args === node.label.name;\n }\n });\n\n // For return statement, the replacement criteria is the absence of a function on TOS.\n case LoopModifier.CONST.RETURN:\n if (ancestorStack.getSize() === 0) {\n return true;\n }\n return !(/FunctionDeclaration/.test(ancestorStack.peek()\n .type) ||\n /FunctionExpression/.test(ancestorStack.peek().type)\n );\n\n default:\n throw 'Invalid modifier type';\n }\n };\n\n // debug.\n this.printAll = function() {\n ancestorStack.printAll();\n }\n }\n\n // LoopModifier types.\n LoopModifier.CONST = {\n BREAK: 'break',\n CONTINUE: 'continue',\n LABELED_BREAK: 'labeled_break',\n RETURN: 'return',\n LABELED_CONTINUE: 'labeled_continue'\n };\n\n Context = {\n N1qlQuery: 'n1ql_query',\n IterTypeCheck: 'iter_type_check',\n BreakStatement: 'break_statement',\n BreakAltInterrupt: 'break_alt_interrupt',\n ContinueStatement: 'continue_statement',\n ContinueAltInterrupt: 'continue_alt_interrupt',\n ReturnStatement: 'return_statement',\n ReturnAltFound: 'return_alt_found',\n ReturnAltInterrupt: 'return_alt_interrupt',\n IterConsequent: 'iter_consequent'\n };\n\n // Utilities for AncestorStack\n function StackHelper(ancestorStack) {\n this.ancestorStack = ancestorStack.cloneAncestorStack();\n\n this.getTopForOfNode = function() {\n return this.ancestorStack.getTopNodeOfType('ForOfStatement');\n };\n\n this.popTopForOfNode = function() {\n return this.ancestorStack.popTopNodeOfType('ForOfStatement');\n };\n\n // Targeted search - search the stack for the target, but stop and return if the stop-condition is met.\n // Comparator must define targetComparator and stopComparator and each of them should return a boolean.\n // Setting searchAll to true will return all the stopNodes till the targetNode is encountered.\n function search(_this, comparator, searchAll) {\n var tempStack = new Stack(),\n stopNodes = [],\n returnArgs = {\n targetFound: false\n };\n\n while (_this.ancestorStack.getSize() > 0) {\n var node = _this.ancestorStack.pop();\n tempStack.push(node);\n\n if (comparator.targetComparator(nodeUtils.deepCopy(node))) {\n returnArgs = {\n targetFound: true,\n stopNode: nodeUtils.deepCopy(node),\n searchInterrupted: false\n };\n break;\n } else if (comparator.stopComparator(nodeUtils.deepCopy(node))) {\n returnArgs = {\n targetFound: false,\n stopNode: nodeUtils.deepCopy(node),\n searchInterrupted: true\n };\n if (searchAll) {\n stopNodes.push(returnArgs.stopNode);\n } else {\n break;\n }\n }\n }\n\n // Restore the elements back to the stack.\n while (tempStack.getSize() > 0) {\n _this.ancestorStack.push(tempStack.pop());\n }\n\n // A check to validate that targetFound and searchInterrupted are mutually exclusive.\n if (returnArgs.targetFound && returnArgs.searchInterrupted) {\n throw 'Invalid case: targetFound=' + returnArgs.targetFound +\n '\\tsearchInterrupted=' + returnArgs.searchInterrupted;\n }\n\n if (searchAll && stopNodes.length > 0) {\n returnArgs = {\n targetFound: false,\n stopNodes: stopNodes,\n searchInterrupted: true\n };\n }\n\n return returnArgs;\n }\n\n this.searchStack = function(comparator) {\n return search(this, comparator);\n };\n\n this.searchAllStopNodes = function(comparator) {\n return search(this, comparator, true);\n }\n }\n\n // Data types JavaScript AST nodes - http://esprima.readthedocs.io/en/latest/syntax-tree-format.html\n function Ast(type) {\n this.type = type;\n }\n\n function SwitchAst(discriminantAst) {\n Ast.call(this, 'SwitchStatement');\n this.discriminant = discriminantAst;\n this.cases = [];\n }\n\n function CaseAst(testStr) {\n Ast.call(this, 'SwitchCase');\n this.test = {\n \"type\": \"Literal\",\n \"value\": testStr,\n \"raw\": String.raw `${testStr}`\n };\n this.consequent = [];\n }\n\n function BreakAst() {\n Ast.call(this, 'BreakStatement');\n this.label = null;\n }\n\n function LabeledStmtAst(label, body) {\n Ast.call(this, 'LabeledStatement');\n this.label = {\n \"type\": \"Identifier\",\n \"name\": label\n };\n this.body = body;\n }\n\n function LabeledBreakAst(label) {\n BreakAst.call(this);\n this.label = {\n \"type\": \"Identifier\",\n \"name\": label\n };\n }\n\n function ContinueAst() {\n Ast.call(this, 'ContinueStatement');\n this.label = null;\n }\n\n function LabeledContinueAst(label) {\n ContinueAst.call(this);\n this.label = {\n \"type\": \"Identifier\",\n \"name\": label\n };\n }\n\n function ReturnAst(argument) {\n Ast.call(this, 'ReturnStatement');\n this.argument = argument;\n }\n\n function StopIterAst(inst) {\n Ast.call(this, 'CallExpression');\n this.callee = {\n \"type\": \"MemberExpression\",\n \"computed\": false,\n \"object\": {\n \"type\": \"Identifier\",\n \"name\": inst\n },\n \"property\": {\n \"type\": \"Identifier\",\n \"name\": \"stopIter\"\n }\n };\n this.arguments = [];\n }\n\n function MemExprAst(objName) {\n Ast.call(this, 'MemberExpression');\n this.computed = false;\n this.object = {\n \"type\": \"Identifier\",\n \"name\": objName\n };\n this.property = {\n \"type\": \"Identifier\",\n \"name\": \"isInstance\"\n };\n }\n\n function IfElseAst(memExprAst) {\n Ast.call(this, 'IfStatement');\n this.test = memExprAst;\n this.consequent = {\n \"type\": \"BlockStatement\",\n \"body\": []\n };\n this.alternate = {\n \"type\": \"BlockStatement\",\n \"body\": []\n };\n }\n\n // Returns AST of the form 'iterVar'.'prop()'.data\n function ReturnDataAst(iterVar, prop) {\n Ast.call(this, 'ExpressionStatement');\n this.expression = {\n \"type\": \"MemberExpression\",\n \"computed\": false,\n \"object\": {\n \"type\": \"CallExpression\",\n \"callee\": {\n \"type\": \"MemberExpression\",\n \"computed\": false,\n \"object\": {\n \"type\": \"Identifier\",\n \"name\": iterVar\n },\n \"property\": {\n \"type\": \"Identifier\",\n \"name\": prop\n }\n },\n \"arguments\": []\n },\n \"property\": {\n \"type\": \"Identifier\",\n \"name\": \"data\"\n }\n };\n }\n\n // Returns AST of the form -\n /*\n \tres.iter(function(row){...});\n */\n function IteratorSkeletonAst(iterVar, arg) {\n Ast.call(this, 'ExpressionStatement');\n this.expression = {\n \"type\": \"CallExpression\",\n \"callee\": {\n \"type\": \"MemberExpression\",\n \"computed\": false,\n \"object\": {\n \"type\": \"Identifier\",\n \"name\": iterVar\n },\n \"property\": {\n \"type\": \"Identifier\",\n \"name\": \"iter\"\n }\n },\n \"arguments\": [{\n \"type\": \"FunctionExpression\",\n \"id\": null,\n \"params\": [{\n \"type\": \"Identifier\",\n \"name\": arg\n }],\n \"body\": {\n \"type\": \"BlockStatement\",\n \"body\": []\n },\n \"generator\": false,\n \"expression\": false,\n \"async\": false\n }]\n }\n }\n\n function BlockStatementAst(body) {\n Ast.call(this, 'BlockStatement');\n this.body = [body];\n }\n\n // Class for maintaining the object that will be passed to 'stopIter'.\n function Arg(arg) {\n this.code = arg.code;\n this.args = arg.args;\n\n this.getAst = function() {\n // Need to wrap 'arg' inside '()' to turn it into a statement - it becomes a JSON object otherwise.\n var argsAst = esprima.parse('(' + this.toString() + ')').body[0]\n .expression;\n\n // Setting appendData to 'true' will generate the AST for 'args' and append it to 'argsAst'.\n if (arg.appendData) {\n var dataAst = {\n \"type\": \"Property\",\n \"key\": {\n \"type\": \"Literal\",\n \"value\": \"data\",\n \"raw\": \"'data'\"\n },\n \"computed\": false,\n \"value\": this.getDataAst(),\n \"kind\": \"init\",\n \"method\": false,\n \"shorthand\": false\n };\n\n argsAst.properties.push(dataAst);\n }\n\n return argsAst;\n };\n\n // Returns the AST for 'args'.\n this.getDataAst = function() {\n if (!this.args) {\n throw '\"args\" field is needed to add \"data\" field';\n }\n\n return esprima.parse(this.args).body[0].expression;\n };\n\n // Stringify only the attributes of this class.\n this.toString = function() {\n var obj = {};\n for (var key of Object.keys(this)) {\n if (this.hasOwnProperty(key)) {\n obj[key] = this[key];\n }\n }\n\n return JSON.stringify(obj);\n }\n }\n\n // Class to generate post iteration steps - switch-case block.\n function PostIter(iterProp, returnBubbleFunc) {\n var stmts = [];\n\n this.iterProp = iterProp;\n this.returnBubbleFunc = returnBubbleFunc;\n\n this.push = function(arg) {\n // Avoid duplicates while insertion.\n // TODO : replace the list with a set in the final version - for faster lookup.\n if (stmts.indexOf(arg) === -1) {\n stmts.push(arg);\n }\n };\n\n // Returns a switch-case block to perform post-iteration steps.\n this.getAst = function(iterVar, stackHelper) {\n var discriminantAst = esprima.parse(iterVar + '.' + this.iterProp)\n .body[0].expression,\n switchAst = new SwitchAst(discriminantAst),\n postIter, caseAst, lookup, stopIterAst, arg, returnStmtAst,\n pushCase;\n\n // Loop over all the stmts and generate the corresponding 'case' block.\n for (var postIterStmt of stmts) {\n pushCase = true;\n // TODO : Changing 'var postIter' to 'const postIter' causes a unit test to fail. Investigate this issue.\n postIter = JSON.parse(postIterStmt);\n caseAst = new CaseAst(postIter.code + postIter.args);\n\n switch (postIter.code) {\n case LoopModifier.CONST.BREAK:\n case LoopModifier.CONST.CONTINUE:\n break;\n case LoopModifier.CONST.LABELED_BREAK:\n // Search the ancestor stack for the label. Interrupt the search if a for-of node is found.\n lookup = stackHelper.searchStack({\n targetComparator: function(node) {\n return /LabeledStatement/.test(\n node.type) && node.label\n .name === postIter.args;\n },\n stopComparator: function(node) {\n return /ForOfStatement/.test(\n node.type);\n }\n });\n // If the label is found and doesn't point to the for-of node, then add a break <label>.\n if (lookup.targetFound) {\n if (/ForOfStatement/.test(lookup.stopNode.body.type)) {\n pushCase = false;\n } else {\n caseAst.consequent.push(new LabeledBreakAst(\n postIter.args));\n }\n }\n // If the search was interrupted, then it means that it encountered a for-of node. So, add a\n // 'return stopIter' node.\n if (lookup.searchInterrupted) {\n stopIterAst = new StopIterAst(lookup.stopNode.right\n .name);\n arg = new Arg({\n code: LoopModifier.CONST.LABELED_BREAK,\n args: postIter.args\n });\n returnStmtAst = new ReturnAst(stopIterAst);\n stopIterAst.arguments.push(arg.getAst());\n\n // Annotate the node as it is subjected to change in the next iteration.\n returnStmtAst.isAnnotated = true;\n returnStmtAst.metaData = postIter;\n\n caseAst.consequent.push(returnStmtAst);\n }\n break;\n case LoopModifier.CONST.LABELED_CONTINUE:\n // This is very similar to Labeled break case.\n lookup = stackHelper.searchStack({\n targetComparator: function(node) {\n return /LabeledStatement/.test(\n node.type) && node.label\n .name === postIter.args;\n },\n stopComparator: function(node) {\n return /ForOfStatement/.test(\n node.type);\n }\n });\n if (lookup.targetFound) {\n if (/ForOfStatement/.test(lookup.stopNode.body.type)) {\n pushCase = false;\n } else {\n caseAst.consequent.push(new LabeledContinueAst(\n postIter.args));\n }\n }\n if (lookup.searchInterrupted) {\n if (lookup.stopNode.parentLabel === postIter.args) {\n returnStmtAst = new ReturnAst(null);\n } else {\n stopIterAst = new StopIterAst(lookup.stopNode\n .right.name);\n arg = new Arg({\n code: LoopModifier.CONST.LABELED_CONTINUE,\n args: postIter.args\n });\n returnStmtAst = new ReturnAst(stopIterAst);\n stopIterAst.arguments.push(arg.getAst());\n }\n\n returnStmtAst.isAnnotated = true;\n returnStmtAst.metaData = postIter;\n\n caseAst.consequent.push(returnStmtAst);\n }\n break;\n case LoopModifier.CONST.RETURN:\n // Target is to find the function name that binds to the 'return' node. Search is interrupted by\n // a for-of node.\n lookup = stackHelper.searchStack({\n targetComparator: function(item) {\n return (/FunctionDeclaration/.test(\n item.type) ||\n /FunctionExpression/.test(\n item.type)) &&\n (item.id ? item.id.name :\n null) === postIter.targetFunction;\n },\n stopComparator: function(item) {\n return /ForOfStatement/.test(\n item.type);\n }\n });\n if (lookup.targetFound) {\n returnStmtAst = new ReturnAst(new ReturnDataAst(\n postIter.iterVar, this.returnBubbleFunc\n ));\n }\n if (lookup.searchInterrupted) {\n stopIterAst = new StopIterAst(lookup.stopNode.right\n .name);\n arg = new Arg({\n code: LoopModifier.CONST.RETURN,\n args: postIter.iterVar + '.' + this\n .returnBubbleFunc + '().data',\n appendData: true\n });\n stopIterAst.arguments.push(arg.getAst());\n returnStmtAst = new ReturnAst(stopIterAst);\n\n returnStmtAst.isAnnotated = true;\n postIter.args = arg.args;\n returnStmtAst.metaData = postIter;\n }\n caseAst.consequent.push(returnStmtAst);\n break;\n }\n\n if (pushCase) {\n switchAst.cases.push(caseAst);\n }\n }\n\n return switchAst.cases.length > 0 ? switchAst : null;\n }\n }\n\n function Iter(forOfNode) {\n var _this = this;\n var breakMod = new LoopModifier(LoopModifier.CONST.BREAK);\n var continueMod = new LoopModifier(LoopModifier.CONST.CONTINUE);\n var lblBreakMod = new LoopModifier(LoopModifier.CONST.LABELED_BREAK);\n var returnMod = new LoopModifier(LoopModifier.CONST.RETURN);\n var lblContinueMod = new LoopModifier(LoopModifier.CONST.LABELED_CONTINUE);\n\n this.nodeCopy = nodeUtils.deepCopy(forOfNode);\n\n this.incrAndPush = function(node) {\n ++breakMod.stackIndex;\n ++continueMod.stackIndex;\n ++lblBreakMod.stackIndex;\n ++returnMod.stackIndex;\n ++lblContinueMod.stackIndex;\n\n breakMod.pushIfAssoc(node);\n continueMod.pushIfAssoc(node);\n lblBreakMod.pushIfAssoc(node);\n returnMod.pushIfAssoc(node);\n lblContinueMod.pushIfAssoc(node);\n };\n\n this.decrAndPop = function() {\n breakMod.popIfAssoc();\n continueMod.popIfAssoc();\n lblBreakMod.popIfAssoc();\n returnMod.popIfAssoc();\n lblContinueMod.popIfAssoc();\n\n --breakMod.stackIndex;\n --continueMod.stackIndex;\n --lblBreakMod.stackIndex;\n --returnMod.stackIndex;\n --lblContinueMod.stackIndex;\n };\n\n this.traverse = function(traversal) {\n estraverse.traverse(_this.nodeCopy, {\n enter: function(node) {\n traversal(node, _this.nodeCopy, breakMod,\n continueMod, lblBreakMod,\n lblContinueMod, returnMod);\n },\n leave: function(node) {\n _this.decrAndPop();\n }\n });\n };\n\n // debug.\n this.assertEmpty = function() {}\n }\n\n // Returns if-else AST having iterator in consequent and for-of in alternate (dynamic type checking).\n function IterCompatible(forOfNode) {\n var self = this;\n var stackHelper = new StackHelper(globalAncestorStack);\n\n // Returns an iterator construct for a given for-of loop ast.\n this.getIterConsequentAst = function() {\n var iterator = new Iter(forOfNode);\n\n // This is the property that will be set on the N1qlQuery instance - contains return value of iterator.\n var iterProp = 'getReturnValue(true)';\n var returnBubbleFunc = 'getReturnValue';\n\n // List to store post iteration exit statements.\n var postIter = new PostIter(iterProp, returnBubbleFunc);\n\n iterator.traverse(function(node, nodeCopy, breakMod,\n continueMod, lblBreakMod, lblContinueMod, returnMod\n ) {\n iterator.incrAndPush(node);\n\n var arg,\n stopIterAst,\n returnStmtAst;\n\n // Annotated nodes are those nodes that have been marked to be changed by the previous iteration.\n if (node.isAnnotated) {\n switch (node.metaData.code) {\n case LoopModifier.CONST.RETURN:\n // For 'return', the 'iterVar' must be set to the current for-of loop's source.\n node.metaData.iterVar = nodeCopy.right.name;\n arg = JSON.stringify(node.metaData);\n break;\n\n case LoopModifier.CONST.LABELED_BREAK:\n case LoopModifier.CONST.LABELED_CONTINUE:\n arg = new Arg({\n code: node.metaData.code,\n args: node.metaData.args\n });\n break;\n\n default:\n throw 'Unhandled case: ' + node.metaData\n .code;\n }\n\n postIter.push(arg.toString());\n\n // Remove the annotation if it's already present.\n // This is needed to prevent the else-block from replacing the already annotated node.\n delete node.isAnnotated;\n delete node.metaData;\n }\n\n if (node.isGen) {\n return;\n }\n\n // If any of the exit criteria is encountered, then that statement may be replaced.\n switch (node.type) {\n case 'BreakStatement':\n stopIterAst = arg = null;\n // Labeled break statement.\n /*\n\t\t\t\t\t\t\tBefore:\n\t\t\t\t\t\t\tbreak x;\n\t\t\t\t\t\t\tAfter:\n\t\t\t\t\t\t\treturn res.stopIter({\n\t\t\t\t\t\t\t\t'code': 'labeled_break',\n\t\t\t\t\t\t\t\t'args': 'x'\n\t\t\t\t\t\t\t});\n\t\t\t\t\t \t*/\n if (node.label && lblBreakMod.isReplaceReq(\n node.label.name)) {\n stopIterAst = new StopIterAst(nodeCopy.right\n .name);\n arg = new Arg({\n code: LoopModifier.CONST.LABELED_BREAK,\n args: node.label.name\n });\n postIter.push(arg.toString());\n } else if (!node.label && breakMod.isReplaceReq()) {\n // Unlabeled break statement.\n /*\n \tBefore:\n \tbreak;\n \tAfter:\n \treturn res.stopIter({ 'code': 'break' });\n */\n stopIterAst = new StopIterAst(nodeCopy.right\n .name);\n arg = new Arg({\n code: LoopModifier.CONST.BREAK\n });\n }\n\n if (stopIterAst && arg) {\n returnStmtAst = new ReturnAst(\n stopIterAst);\n // Add 'arg' as the argument to 'stopIter()'.\n stopIterAst.arguments.push(arg.getAst());\n nodeUtils.replaceNode(node,\n returnStmtAst, Context.BreakStatement\n );\n }\n break;\n\n case 'ContinueStatement':\n // Labeled continue statement.\n /*\n \tBefore:\n \tcontinue x;\n \tAfter:\n \treturn res.stopIter({\n \t\t'code': 'labeled_continue',\n \t\t'args': 'x'\n \t});\n */\n if (node.label && lblContinueMod.isReplaceReq(\n node.label.name)) {\n if (nodeCopy.parentLabel === node.label\n .name) {\n // If the target of labeled continue is its immediate parent, then just 'return'.\n returnStmtAst = new ReturnAst(null);\n } else {\n arg = new Arg({\n code: LoopModifier.CONST\n .LABELED_CONTINUE,\n args: node.label.name\n });\n stopIterAst = new StopIterAst(\n nodeCopy.right.name);\n returnStmtAst = new ReturnAst(\n stopIterAst);\n stopIterAst.arguments.push(arg.getAst());\n\n postIter.push(arg.toString());\n }\n\n nodeUtils.replaceNode(node,\n returnStmtAst, Context.ContinueStatement\n );\n } else if (continueMod.isReplaceReq()) {\n // Unlabeled continue statement.\n /*\n \tBefore:\n \tcontinue;\n \tAfter:\n \treturn;\n */\n nodeUtils.replaceNode(node, new ReturnAst(\n null), Context.ContinueStatement);\n }\n break;\n\n case 'ReturnStatement':\n /*\n \tBefore:\n \treturn a + b;\n \tAfter:\n \treturn res.stopIter({\n \t\t'code': 'return',\n \t\t'args': '(a + b)',\n \t\t'data': a + b\n \t});\n */\n if (returnMod.isReplaceReq(node)) {\n // Return statement may or may not have arguments.\n // In case there's no argument, we populate it with null.\n var argStr = node.argument ? escodegen.generate(\n node.argument) : null;\n // Must enclose the return statement's argument within an expression '()'.\n // Otherwise, it causes an error when returning anonymous function.\n arg = new Arg({\n code: LoopModifier.CONST.RETURN,\n args: '(' + argStr + ')',\n appendData: true\n });\n stopIterAst = new StopIterAst(nodeCopy.right\n .name);\n stopIterAst.arguments.push(arg.getAst());\n returnStmtAst = new ReturnAst(\n stopIterAst);\n self.mapSourceNode(node, returnStmtAst,\n Context.ReturnStatement);\n\n var postIterArgs = JSON.stringify({\n code: LoopModifier.CONST.RETURN,\n args: arg.args,\n iterVar: nodeCopy.right.name,\n targetFunction: node.targetFunction\n });\n\n postIter.push(postIterArgs);\n nodeUtils.replaceNode(node,\n returnStmtAst);\n }\n break;\n\n case 'IfStatement':\n if (!/BlockStatement/.test(node.consequent.type)) {\n nodeUtils.convertToBlockStmt(node);\n }\n break;\n }\n });\n\n var iter = new IteratorSkeletonAst(forOfNode.right.name, (\n forOfNode.left.name ? forOfNode.left.name :\n forOfNode.left.declarations[0].id.name));\n iter.expression.arguments[0].body = iterator.nodeCopy.body;\n self.mapSourceNode(forOfNode, iter, Context.IterConsequent);\n\n var iterBlockAst = new BlockStatementAst(iter);\n\n // Pop the top for-of node.\n stackHelper.popTopForOfNode();\n\n var postIterAst = postIter.getAst(forOfNode.right.name,\n stackHelper);\n if (postIterAst) {\n iterBlockAst.body.push(postIterAst);\n }\n\n iterator.assertEmpty();\n\n return iterBlockAst;\n };\n\n // Maps loc nodes of source to target according to the context.\n this.mapSourceNode = function(source, target, context) {\n switch (context) {\n // Maps the source to target loc during the following kind of transformation -\n /*\n \tBefore:\n \tfor (var r of res3){...}\n \tAfter:\n \tres.iter(function (r) {...}\n */\n case Context.IterConsequent:\n target.loc = nodeUtils.deepCopy(source.loc);\n target.expression.loc = nodeUtils.deepCopy(source.loc);\n target.expression.callee.loc = nodeUtils.deepCopy(\n source.loc);\n target.expression.callee.object.loc = nodeUtils.deepCopy(\n source.right.loc);\n target.expression.callee.property.loc = nodeUtils.deepCopy(\n source.right.loc);\n target.expression.arguments[0].loc = nodeUtils.deepCopy(\n source.right.loc);\n target.expression.arguments[0].params[0].loc =\n nodeUtils.deepCopy(source.left.declarations[0].id.loc);\n break;\n\n // Maps the source to target loc during the following kind of transformation -\n /*\n \tsource: return function () {\n \t\treturn inner;\n \t};\n \ttarget: return res1.stopIter({\n \t\t'code': 'return',\n \t\t'args': '(function () {\\n return inner;\\n})',\n \t\t'data': function () {\n \t\t\treturn inner;\n \t\t}\n \t});\n */\n case Context.ReturnStatement:\n target.loc = source.loc;\n nodeUtils.forceSetLocForAllNodes(source.loc, target.argument);\n if (source.argument) {\n for (var prop of target.argument.arguments[0].properties) {\n if (prop.key.value === 'data') {\n prop.value = nodeUtils.deepCopy(source.argument);\n break;\n }\n }\n }\n break;\n\n // Maps the source to target loc during the following kind of transformation -\n /*\n \tsource: return res.stopIter({\n \t\t'code': 'return',\n \t\t'args': 'res.getReturnValue().data',\n \t\t'data': res.getReturnValue().data\n \t});\n \ttarget: return res.getReturnValue().data;\n */\n case Context.ReturnAltFound:\n target.loc = source.loc;\n for (var prop of source.argument.arguments[0].properties) {\n if (prop.key.value === 'data') {\n target.argument = nodeUtils.deepCopy(prop.value);\n break;\n }\n }\n break;\n\n // Maps the source to target loc during the following kind of transformation -\n /*\n \tsource: return res1.stopIter({\n \t\t'code': 'return',\n \t\t'args': 'res.getReturnValue().data',\n \t\t'data': res.getReturnValue().data\n \t});\n \ttarget: return res2.stopIter({\n \t\t'code': 'return',\n \t\t'args': 'res.getReturnValue().data',\n \t\t'data': res.getReturnValue().data\n \t});\n */\n case Context.ReturnAltInterrupt:\n nodeUtils.setLocMatchingNodes(source, target);\n break;\n default:\n throw 'Unhandled case: ' + context;\n }\n };\n\n // Returns AST for 'else' block.\n this.getIterAlternateAst = function() {\n var iterator = new Iter(forOfNode);\n iterator.traverse(function(node, nodeCopy, breakMod,\n continueMod, lblBreakMod, lblContinueMod, returnMod\n ) {\n var lookup, stopIterAst, arg, returnStmtAst,\n stopNode = null,\n context;\n\n if (node.isAnnotated) {\n // Targeted lookup for annotated nodes.\n lookup = stackHelper.searchStack({\n targetComparator: function(item) {\n switch (node.metaData.code) {\n case LoopModifier.CONST\n .RETURN:\n // For a 'return' statement, the target is to find the function that the 'return'\n // statement was associated with, before transpilation.\n return (\n /FunctionDeclaration/\n .test(item.type) ||\n /FunctionExpression/\n .test(item.type)\n ) &&\n item.id.name ===\n node.metaData.targetFunction;\n case LoopModifier.CONST\n .LABELED_CONTINUE:\n case LoopModifier.CONST\n .LABELED_BREAK:\n return /LabeledStatement/\n .test(item.type) &&\n item.label.name ===\n node.metaData.args;\n default:\n throw 'Unhandled case: ' +\n node.metaData.code;\n }\n },\n stopComparator: function(item) {\n return /ForOfStatement/.test(\n item.type);\n }\n });\n if (lookup.targetFound) {\n switch (node.metaData.code) {\n case LoopModifier.CONST.LABELED_BREAK:\n nodeUtils.replaceNode(node, new LabeledBreakAst(\n node.metaData.args),\n Context.BreakStatement);\n break;\n case LoopModifier.CONST.LABELED_CONTINUE:\n nodeUtils.replaceNode(node, new LabeledContinueAst(\n node.metaData.args),\n Context.ContinueStatement);\n break;\n case LoopModifier.CONST.RETURN:\n arg = new Arg({\n code: LoopModifier.CONST\n .RETURN,\n args: node.metaData.args,\n appendData: true\n });\n returnStmtAst = new ReturnAst(arg.getDataAst());\n self.mapSourceNode(node,\n returnStmtAst, Context.ReturnAltFound\n );\n nodeUtils.replaceNode(node,\n returnStmtAst);\n break;\n }\n }\n if (lookup.searchInterrupted) {\n switch (node.metaData.code) {\n case LoopModifier.CONST.LABELED_BREAK:\n stopIterAst = new StopIterAst(\n lookup.stopNode.right.name);\n arg = new Arg({\n code: node.metaData.code,\n args: node.metaData.args\n });\n stopIterAst.arguments.push(arg.getAst());\n returnStmtAst = new ReturnAst(\n stopIterAst);\n context = Context.BreakAltInterrupt;\n break;\n\n case LoopModifier.CONST.LABELED_CONTINUE:\n if (lookup.stopNode.parentLabel ===\n node.metaData.args) {\n returnStmtAst = new ReturnAst(\n null);\n } else {\n stopIterAst = new StopIterAst(\n lookup.stopNode.right.name\n );\n arg = new Arg({\n code: node.metaData\n .code,\n args: node.metaData\n .args\n });\n stopIterAst.arguments.push(arg.getAst());\n returnStmtAst = new ReturnAst(\n stopIterAst);\n }\n context = Context.ContinueAltInterrupt;\n break;\n\n case LoopModifier.CONST.RETURN:\n arg = new Arg({\n code: LoopModifier.CONST\n .RETURN,\n args: node.metaData.args,\n appendData: true\n });\n stopIterAst = new StopIterAst(\n lookup.stopNode.right.name);\n stopIterAst.arguments.push(arg.getAst());\n returnStmtAst = new ReturnAst(\n stopIterAst);\n self.mapSourceNode(node,\n returnStmtAst, Context.ReturnAltInterrupt\n );\n break;\n }\n\n returnStmtAst.isAnnotated = true;\n returnStmtAst.metaData = node.metaData;\n\n nodeUtils.replaceNode(node, returnStmtAst,\n context);\n\n }\n\n return;\n }\n\n iterator.incrAndPush(node);\n\n switch (node.type) {\n case 'BreakStatement':\n if (node.label && lblBreakMod.isReplaceReq(\n node.label.name)) {\n lookup = stackHelper.searchStack({\n targetComparator: function(\n item) {\n return /LabeledStatement/\n .test(item.type) &&\n item.label.name ===\n node.label.name;\n },\n stopComparator: function(\n item) {\n return /ForOfStatement/\n .test(item.type);\n }\n });\n if (lookup.searchInterrupted) {\n stopIterAst = new StopIterAst(\n lookup.stopNode.right.name);\n arg = new Arg({\n code: LoopModifier.CONST\n .LABELED_BREAK,\n args: node.label.name\n });\n returnStmtAst = new ReturnAst(\n stopIterAst);\n stopIterAst.arguments.push(arg.getAst());\n\n returnStmtAst.isAnnotated = true;\n returnStmtAst.metaData = {\n code: LoopModifier.CONST.LABELED_BREAK,\n args: node.label.name\n };\n nodeUtils.replaceNode(node,\n returnStmtAst, Context.BreakStatement\n );\n }\n }\n break;\n case 'ContinueStatement':\n if (node.label && lblContinueMod.isReplaceReq(\n node.label.name)) {\n lookup = stackHelper.searchStack({\n targetComparator: function(\n item) {\n return /LabeledStatement/\n .test(item.type) &&\n item.label.name ===\n node.label.name;\n },\n stopComparator: function(\n item) {\n return /ForOfStatement/\n .test(item.type);\n }\n });\n if (lookup.searchInterrupted) {\n if (lookup.stopNode.parentLabel ===\n node.label.name) {\n returnStmtAst = new ReturnAst(\n null);\n } else {\n stopIterAst = new StopIterAst(\n lookup.stopNode.right.name\n );\n arg = new Arg({\n code: LoopModifier.CONST\n .LABELED_CONTINUE,\n args: node.label.name\n });\n returnStmtAst = new ReturnAst(\n stopIterAst);\n stopIterAst.arguments.push(arg.getAst());\n }\n\n returnStmtAst.isAnnotated = true;\n returnStmtAst.metaData = {\n code: LoopModifier.CONST.LABELED_CONTINUE,\n args: node.label.name\n };\n nodeUtils.replaceNode(node,\n returnStmtAst, Context.ContinueStatement\n );\n }\n }\n break;\n case 'ReturnStatement':\n if (node.targetFunction) {\n lookup = stackHelper.searchStack({\n targetComparator: function(\n item) {\n return (\n /FunctionDeclaration/\n .test(item.type) ||\n /FunctionExpression/\n .test(item.type)\n ) &&\n item.id.name ===\n node.targetFunction;\n },\n stopComparator: function(\n item) {\n return /ForOfStatement/\n .test(item.type);\n }\n });\n if (lookup.searchInterrupted) {\n var argStr = node.argument ?\n escodegen.generate(node.argument) :\n null;\n\n arg = new Arg({\n code: LoopModifier.CONST\n .RETURN,\n args: '(' + argStr +\n ')',\n appendData: true\n });\n stopIterAst = new StopIterAst(\n lookup.stopNode.right.name);\n stopIterAst.arguments.push(arg.getAst());\n returnStmtAst = new ReturnAst(\n stopIterAst);\n self.mapSourceNode(node,\n returnStmtAst, Context.ReturnStatement\n );\n\n returnStmtAst.isAnnotated = true;\n returnStmtAst.metaData = {\n code: LoopModifier.CONST.RETURN,\n args: arg.args,\n iterVar: nodeCopy.right.name,\n targetFunction: node.targetFunction\n };\n\n nodeUtils.replaceNode(node,\n returnStmtAst);\n }\n }\n break;\n }\n });\n\n iterator.assertEmpty();\n\n return iterator.nodeCopy.parentLabel ? new LabeledStmtAst(\n iterator.nodeCopy.parentLabel, iterator.nodeCopy) :\n iterator.nodeCopy;\n };\n\n this.getAst = function() {\n // if-else block which perform dynamic type checking.\n var ifElseAst = new IfElseAst(new MemExprAst(forOfNode.right.name));\n\n // Iterator AST.\n var iterConsequentAst = this.getIterConsequentAst();\n // Push the iterator AST into 'if' block.\n ifElseAst.consequent.body = iterConsequentAst.body;\n // Push the user-written 'for ... of ...' loop into 'else' block.\n ifElseAst.alternate.body.push(this.getIterAlternateAst());\n\n estraverse.traverse(ifElseAst, {\n enter: function(node) {\n // Mark all the nodes of 'ifElseAst' to avoid repeated operations.\n node.isGen = true;\n\n // Traverse all the for-of loops in the 'else' block and mark them as visited - so that we don't\n // recursively convert these into iterator constructs.\n if (/ForOfStatement/.test(node.type))\n node.isVisited = true;\n }\n });\n\n return ifElseAst;\n };\n }\n\n var nodeUtils = new NodeUtils();\n var globalAncestorStack = new AncestorStack();\n\n // Get the Abstract Syntax Tree (ast) of the input code.\n var ast = esprima.parse(code, {\n attachComment: true,\n sourceType: 'script',\n loc: true,\n source: sourceFileName\n });\n\n nodeUtils.checkGlobals(ast);\n\n estraverse.traverse(ast, {\n enter: function(node, parent) {\n globalAncestorStack.push(node);\n\n // Grab the for-of statement's label and mark the label for deletion.\n if (/ForOfStatement/.test(node.type) && !node.isVisited &&\n /LabeledStatement/.test(parent.type)) {\n node.parentLabel = parent.label.name;\n parent.remLabel = true;\n }\n\n // Find the function that the 'return' statement associates with.\n if (/ReturnStatement/.test(node.type)) {\n var stackHelper = new StackHelper(\n globalAncestorStack);\n var lookup = stackHelper.searchStack({\n targetComparator: function(item) {\n return /FunctionDeclaration/.test(\n item.type) ||\n /FunctionExpression/.test(\n item.type);\n },\n stopComparator: function(item) {\n return false;\n }\n });\n if (lookup.targetFound) {\n // TODO : Anonymous function might require some attention because comparing null doesn't make sense.\n node.targetFunction = lookup.stopNode.id ?\n lookup.stopNode.id.name : null;\n }\n }\n },\n leave: function(node) {\n // Perform variable substitution in query constructor.\n if (nodeUtils.isN1qlNode(node) && node.arguments.length >\n 0) {\n var queryAst = nodeUtils.getQueryAst(node.arguments[\n 0].quasis[0].value.raw);\n nodeUtils.replaceNode(node, nodeUtils.deepCopy(\n queryAst), Context.N1qlQuery);\n }\n\n // TODO : Handle the case when the source of for-of loop is of type x.y\n // Modifies all the for-of statements to support iteration.\n // Takes care to see to it that it visits the node only once.\n if (/ForOfStatement/.test(node.type) && !node.isVisited) {\n if (!/BlockStatement/.test(node.body.type)) {\n nodeUtils.convertToBlockStmt(node);\n }\n\n var iterator = new IterCompatible(node);\n var iterAst = iterator.getAst();\n nodeUtils.replaceNode(node, nodeUtils.deepCopy(\n iterAst), Context.IterTypeCheck);\n } else if (/LabeledStatement/.test(node.type) && node.remLabel) {\n // Delete the label.\n nodeUtils.replaceNode(node, node.body);\n }\n\n globalAncestorStack.pop();\n }\n });\n\n return ast;\n}", "function traverser(ast, visitor) {\n\n function traverseArray(array, parent) {\n array.forEach(child => {\n traverseNode(child, parent);\n });\n }\n\n function traverseNode(node, parent) {\n let methods = visitor[node.type];\n if (methods && methods.enter) {\n methods.enter(node, parent);\n }\n\n switch (node.type) {\n case 'Document':\n traverseArray(node.body, node);\n break;\n case 'DOMELEMENT':\n traverseArray(node.params, node);\n break;\n case \"CARGO\":\n break;\n }\n if (methods && methods.exit) {\n methods.exit(node, parent);\n }\n }\n traverseNode(ast, null);\n}", "function astToTypescript(ast, maybeResolve, config) {\n var translator = new AstTranslator(maybeResolve, config);\n return translator.translate(ast);\n }", "atrule (node) {\n }", "_rewriteAstToEmulateBaseTag(ast, docUrl) {\n const baseTag = dom5.query(ast, matchers.base);\n const p = dom5.predicates;\n // If there's no base tag, there's nothing to do.\n if (!baseTag) {\n return;\n }\n for (const baseTag of dom5.queryAll(ast, matchers.base)) {\n parse5_utils_1.removeElementAndNewline(baseTag);\n }\n if (dom5.predicates.hasAttr('href')(baseTag)) {\n const baseUrl = this.bundler.analyzer.urlResolver.resolve(docUrl, dom5.getAttribute(baseTag, 'href'));\n if (baseUrl) {\n this._rewriteAstBaseUrl(ast, baseUrl, docUrl);\n }\n }\n if (p.hasAttr('target')(baseTag)) {\n const baseTarget = dom5.getAttribute(baseTag, 'target');\n const tagsToTarget = dom5.queryAll(ast, p.AND(p.OR(p.hasTagName('a'), p.hasTagName('form')), p.NOT(p.hasAttr('target'))));\n for (const tag of tagsToTarget) {\n dom5.setAttribute(tag, 'target', baseTarget);\n }\n }\n }", "function addChildNode(child, node, sourceFile, appId) {\n var childType = child.type;\n if (child.type === \"Literal\") {\n if (child.value != undefined && typeof child.value === 'string') {\n childType = \"StringLiteral\";\n }\n else if (child.value != undefined && typeof child.value === 'number') {\n childType = \"NumberLiteral\";\n }\n else if (child.value != undefined && typeof child.value == 'boolean') {\n childType = \"BooleanLiteral\";\n }\n }\n\n var hasLoc = (child.loc != undefined), lineNumber, columnNumber;\n if (hasLoc) {\n lineNumber = child.loc.start.line;\n columnNumber = child.loc.start.column;\n }\n\n //Add this in the childNodes array of the current node\n var newCodeTreeNode = new CodeTreeNode(\"ast\", childType, node.codetreeref, sourceFile, appId);\n if (child.type === \"Literal\") newCodeTreeNode.abstractOut();\n if (hasLoc) newCodeTreeNode.addLoc(lineNumber, columnNumber);\n node.codetreeref.addChild(newCodeTreeNode);\n child.codetreeref = newCodeTreeNode;\n\n //Add values if necessary\n if (child.type === \"Literal\" && child.raw != undefined) {\n var newLiteralNode = new CodeTreeNode(\"ast\", \"\" + child.raw, newCodeTreeNode, sourceFile, appId);\n if (hasLoc) newLiteralNode.addLoc(lineNumber, columnNumber);\n newLiteralNode.abstractOut();\n newCodeTreeNode.addChild(newLiteralNode);\n }\n else if (child.type === \"Identifier\" && child.name != undefined) {\n var newNameNode = new CodeTreeNode(\"ast\", child.name, newCodeTreeNode, sourceFile, appId);\n if (hasLoc) newNameNode.addLoc(lineNumber, columnNumber);\n newNameNode.abstractOut();\n newCodeTreeNode.addChild(newNameNode);\n }\n else if (child.type === \"BinaryExpression\" || child.type === \"UpdateExpression\" || child.type === \"UnaryExpression\") {\n if (child.operator != undefined) {\n var newOperatorNode = new CodeTreeNode(\"ast\", child.operator, newCodeTreeNode, \n sourceFile, appId);\n if (hasLoc) newOperatorNode.addLoc(lineNumber, columnNumber);\n newCodeTreeNode.addChild(newOperatorNode);\n }\n if (child.prefix != undefined) {\n var newPrefixNode = new CodeTreeNode(\"ast\", child.prefix + \"\", newCodeTreeNode, \n sourceFile, appId);\n if (hasLoc) newPrefixNode.addLoc(lineNumber, columnNumber);\n newCodeTreeNode.addChild(newPrefixNode);\n }\n }\n }", "function transformAstToCodeTree(ast, sourceFile, appId) {\n var stack = [ ast ], i, j, key, len, node, child, subchild;\n \n //Create a CodeTreeNode for the root\n var newCodeTreeNode = new CodeTreeNode(\"ast\", ast.type, null, sourceFile, appId);\n if (ast.loc != undefined) {\n newCodeTreeNode.addLoc(ast.loc.start.line, ast.loc.start.column);\n }\n ast.codetreeref = newCodeTreeNode;\n\n //Now, walk through all the nodes\n for (i = 0; i < stack.length; i++) {\n node = stack[i];\n\n for (key in node) {\n if (key !== \"codetreeref\") {\n child = node[key];\n\n if (child instanceof Array) {\n for (j = 0, len = child.length; j < len; j += 1) {\n subchild = child[j];\n addChildNode(subchild, node, sourceFile, appId);\n stack.push(subchild);\n }\n } else if (child != void 0 && typeof child.type === 'string') {\n addChildNode(child, node, sourceFile, appId); \n stack.push(child);\n }\n \n //The above considers identifiers and literals as nodes in the CodeTree as well. These must \n //be added as the child of an Identifier or a Literal node. Also, the \"Literal\" label \n //should be changed based on the 'value' property. If it's a number literal, it should be \n //changed to \"NumberLiteral\". If it's a string literal, it should be changed to \n //\"StringLiteral\". We should also look at the \"operator\" property of a BinaryExpression, \n //UpdateExpression, or UnaryExpression, if any. For UpdateExpression and UnaryExpression, \n //we should also look at the prefix value (i.e., true or false), which indicates whether \n //the operator is before or after.\n }\n }\n }\n \n return ast.codetreeref;\n }", "function traverseAST(astNode){\n\t // .. recursively expand them.\n if(astNode.name!='block'){\n \t//????? cry????\n }else if(astNode.name=='block'){\n \tanalyzeBlock(astNode);\n\n \t}//eo if else\n }//eo traverseCST", "function transformString(code, visitorsPost, visitorsPre) {\n// StatCollector.resumeTimer(\"parse\");\n// console.time(\"parse\")\n// var newAst = esprima.parse(code, {loc:true, range:true});\n var newAst = acorn.parse(code, {locations: true, ecmaVersion: 6 });\n// console.timeEnd(\"parse\")\n// StatCollector.suspendTimer(\"parse\");\n// StatCollector.resumeTimer(\"transform\");\n// console.time(\"transform\")\n addScopes(newAst);\n var len = visitorsPost.length;\n for (var i = 0; i < len; i++) {\n newAst = astUtil.transformAst(newAst, visitorsPost[i], visitorsPre[i], astUtil.CONTEXT.RHS);\n }\n// console.timeEnd(\"transform\")\n// StatCollector.suspendTimer(\"transform\");\n// console.log(JSON.stringify(newAst,null,\" \"));\n return newAst;\n }", "function transformer(ast) {\n return flatMap(ast, node => {\n if (node.tagName === 'table') {\n const [header, body] = node.children;\n // hAST tables are deeply nested with an innumerable amount of children\n // This is necessary to pullout all the relevant strings\n return [\n {\n ...node,\n children: [\n {\n ...node.children[0],\n value: valuesToString(header),\n },\n {\n ...node.children[1],\n value: valuesToString(body),\n },\n ],\n },\n ];\n }\n\n return [node];\n });\n}", "function clearAst (ast) {\n\t const cleanAst = ast;\n\n\t delete cleanAst.parentRef;\n\n\t if (Array.isArray(ast.content.children)) {\n\t cleanAst.content.children = ast.content.children.map((node) => {\n\t return clearAst(node)\n\t });\n\t }\n\n\t return cleanAst\n\t}", "function transformation1(oldAST) {\n const state = {\n stopTraversal: false,\n skipSubNodes: false,\n };\n\n // TODO move this back into path traversals\n // it's here to catch the internal calls error which scope can't handle right now\n traverseNodesFastVisitor(oldAST, explode(unsupportedVisitor), state);\n logger.verbose('No unsupported Solidity');\n\n const newAST = {\n nodeType: 'Folder',\n files: [],\n };\n\n oldAST._newASTPointer = newAST.files;\n const dummyParent = {\n ast: oldAST,\n };\n dummyParent._newASTPointer = newAST;\n\n const path = new NodePath({\n parent: dummyParent,\n key: 'ast', // since parent.ast = node\n container: oldAST,\n node: oldAST,\n });\n\n // We'll start by calling the traverser function with our ast and a visitor.\n // The newAST will be mutated through this traversal process.\n path.traverse(explode(externalCallVisitor), state);\n logger.verbose('No unsupported external calls');\n path.traverse(explode(decoratorVisitor), state);\n logger.verbose('No conflicting known/unknown decorators');\n path.traverse(explode(interactsWithSecretVisitor), state);\n logger.verbose('Secret interacts marked');\n path.traverse(explode(incrementedVisitor), state);\n logger.verbose('Incrementations marked');\n path.traverse(explode(accessedVisitor), state);\n logger.verbose('Accessed values marked');\n path.traverse(explode(requireStatementVisitor), state);\n logger.verbose('Require statements labelled public / private');\n path.traverse(explode(localDeclarationsVisitor), state);\n logger.verbose('Checked for unsupported local variable declarations');\n path.traverse(explode(msgSenderParam), state);\n\n // At the end of our transformer function we'll return the new ast that we\n // just created.\n return path;\n}", "function buildAST(root) {\n //If not a leaf node...\n if (root !== null && root.children.length > 0) {\n //For each CST child...\n for (var i = 0; i < root.children.length; i++) {\n //If the CST node is useful to the AST...\n if (typeof ASTNodes[root.children[i].nodeName] !== \"undefined\") {\n //Rename from CST to AST nodeName\n //Block\n if (ASTNodes[root.children[i].nodeName] === \"Block\") {\n //Add a block AST node\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]); //with new name.\n //Recurse over Statements\n buildAST(root.children[i]);\n //Back up to Block when done - close this scope\n AST.backtrack();\n }\n else if (root.nodeName === \"IntegerExpression\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"int\";\n }\n }\n else if (root.nodeName === \"StringExpression\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"string\";\n activeValue.nodeVal = joinString(root, \"\"); //sets string value to full string\n }\n }\n else if (root.nodeName === \"BooleanExpression\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"boolean\";\n }\n }\n else if (root.nodeName === \"ID\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"ID\";\n }\n }\n else if (ASTNodes[root.children[i].nodeName] === \"VariableDeclaration\") {\n //New VariableDeclaration node!\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //Left - the type\n AST.addLeafNode(\"LeftVal\", root.children[i].children[0].nodeVal, true, root.children[i].children[0].lineNumber);\n //Right - the variable name\n AST.addLeafNode(\"RightVal\", root.children[i].children[1].children[0].nodeVal, true, root.children[i].children[1].children[0].lineNumber);\n //Backtrack\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"Assignment\") {\n //New Assignment node!\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //LeftVal - a variable\n AST.addLeafNode(\"LeftVal\", root.children[i].children[0].children[0].nodeVal, true, root.children[i].children[0].children[0].lineNumber);\n //RightVal - an Expression\n if (root.children[i].children[2].children[0].nodeName === \"IntegerExpression\") {\n if (root.children[i].children[2].children[0].children.length > 2 && root.children[i].children[2].children[0].children[1].nodeName === \"T_intop\") {\n AST.addLeafNode(\"RightVal\", findIDInAdd(root.children[i].children[2].children[0]), true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n else {\n AST.addLeafNode(\"RightVal\", root.children[i].children[2].children[0].children[0].nodeVal, true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n }\n else {\n AST.addLeafNode(\"RightVal\", root.children[i].children[2].children[0].children[0].nodeVal, true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n //Backtrack\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"Output\") {\n //New Output node\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //If printing from a variable\n if (root.children[i].children[2].children[0].nodeName === \"ID\") {\n AST.addLeafNode(\"OutputVal\", root.children[i].children[2].children[0].children[0].nodeVal, true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n else {\n AST.addLeafNode(\"OutputVal\", findIDInAdd(root.children[i].children[2].children[0]), true, root.children[i].lineNumber);\n }\n //Backtrack\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"If\" || ASTNodes[root.children[i].nodeName] === \"While\") {\n /*!= vs ==*/\n //New If or While node!\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //New CompareTest node!\n AST.addBranchNode(\"CompareTest\");\n //Add left and right of comparison\n if (root.children[i].children[1].children[1].children.length !== 0) {\n AST.addLeafNode(\"LeftVal\", root.children[i].children[1].children[1].children[0].children[0].nodeVal, true, root.children[i].children[1].children[1].children[0].children[0].lineNumber);\n AST.addLeafNode(\"RightVal\", root.children[i].children[1].children[3].children[0].children[0].nodeVal, true, root.children[i].children[1].children[3].children[0].children[0].lineNumber);\n }\n else {\n AST.addLeafNode(\"LeftVal\", root.children[i].children[1].children[1].children[0].nodeVal, true, root.children[i].children[1].children[1].children[0].lineNumber);\n AST.addLeafNode(\"RightVal\", root.children[i].children[1].children[1].children[0].nodeVal, true, root.children[i].children[1].children[1].children[0].lineNumber);\n }\n //Backtrack up to If/While from Compare\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"Add\") {\n //New Add tree\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //Backtrack\n AST.backtrack();\n }\n }\n //This subtree\n var saved = root.children[i];\n //Block handles own recursive call. Otherwise...\n if (ASTNodes[root.children[i].nodeName] !== \"Block\") {\n buildAST(saved); //recursively call until traversed whole CST\n }\n }\n }\n else {\n //return; //this is a value - no recursion needed\n if (ASTNodes[root.nodeName] === \"Add\") {\n }\n }\n}", "function formatAST(node)\n\t\t{\n\t\t\tif(!Array.isArray(node))\n\t\t\t{\n\t\t\t\t// Flatten enum values (object singletons with capital first letter key)\n\t\t\t\tif(node && typeof node === 'object')\n\t\t\t\t{\n\t\t\t\t\tlet keys = Object.keys(node);\n\t\t\t\t\tfor(let key of keys)\n\t\t\t\t\t{\n\t\t\t\t\t\tnode[key] = formatAST(node[key]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// // TEMP : `Der` case\n\t\t\t\t\t// if(node.rule && node.ctx && node.dir && node.rule)\n\t\t\t\t\t// {\n\t\t\t\t\t// \tlet sub = formatAST(node.rule);\n\t\t\t\t\t// \tnode.rule = sub;\n\t\t\t\t\t// \tsub._type = node;\n\t\t\t\t\t// \treturn sub;\n\t\t\t\t\t// }\n\t\t\t\t\t\n\t\t\t\t\t// let key = keys[0];\n\t\t\t\t\t// if(keys.length === 1 && key.charAt(0) !== key.charAt(0).toLowerCase())\n\t\t\t\t\t// {\n\t\t\t\t\t// \treturn formatAST([key].concat(node[key]));\n\t\t\t\t\t// }\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn node;\n\t\t\t}\n\t\t\telse if(node[0] === 'DebugLabel')\n\t\t\t{\n\t\t\t\tlet sub = formatAST(node[3]);\n\t\t\t\tnode[3] = sub;\n\t\t\t\tsub._debug = node;\n\t\t\t\treturn sub;\n\t\t\t}\n\t\t\telse if(node[0] === 'Der')\n\t\t\t{\n\t\t\t\tlet sub = formatAST(node[1].rule);\n\t\t\t\tnode[1].rule = sub;\n\t\t\t\tsub._type = node[1];\n\t\t\t\treturn sub;\n\t\t\t}\n\t\t\t\n\t\t\tfor(var i = 0; i < node.length; i++)\n\t\t\t{\n\t\t\t\tlet s = formatAST(node[i]);\n\t\t\t\tif(Array.isArray(s))\n\t\t\t\t{\n\t\t\t\t\ts._parent = node;\n\t\t\t\t}\n\t\t\t\tnode[i] = s;\n\t\t\t}\n\t\t\treturn node;\n\t\t}", "function walk_tree(ast) {\n var walker = {\n \"assign\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n assign_expr.left_expr = walk_tree(ast[2]);\n assign_expr.right_expr = walk_tree(ast[3]);\n assign_expr.name = assign_expr.left_expr.name;\n \n return assign_expr;\n },\n \n \"var\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n \n assign_expr.left_expr = new type_object();\n assign_expr.left_expr.name = ast[1][0][0];\n assign_expr.right_expr = walk_tree(ast[1][0][1]);\n assign_expr.name = assign_expr.left_expr.name;\n \n return assign_expr; \n },\n \n \"stat\" : function() {\n return walk_tree(ast[1]);\n },\n \n \"dot\" : function() {\n var dot_obj = walk_tree(ast[1]);\n dot_obj.child = new type_object();\n dot_obj.child.name = ast[2];\n dot_obj.child.parent = dot_obj;\n return dot_obj;\n },\n \n \"name\" : function() {\n var new_obj = new type_object();\n new_obj.type = \"name\";\n new_obj.name = ast[1];\n return new_obj;\n },\n \n \"new\" : function() {\n var expr = walk_tree(ast[1]);\n expr.type = \"composition\";\n return expr;\n },\n \n \"function\" : function() {\n var func = new type_function(\"function\", ast[1], [\"toplevel\", [ast]], ast[2]);\n return func;\n },\n \n \"defun\" : function() { \n var func = new type_function(\"defun\", ast[1], [\"toplevel\", [ast]], ast[2]);\n return func;\n },\n \n \"return\" : function() {\n var return_expr = new type_expression();\n return_expr.type = \"return_expr\";\n return_expr.expr = walk_tree(ast[1]);\n return return_expr;\n },\n \n \"string\" : function() {\n var obj = new type_object();\n obj.type = \"string\";\n obj.value = ast[1];\n return obj;\n },\n \n \"num\" : function() {\n var obj = new type_object();\n obj.type = \"num\";\n obj.value = ast[1];\n return obj;\n },\n \n \"binary\" : function() {\n var binary_expr = new binary_expression();\n binary_expr.type = \"binary_expr\";\n binary_expr.binary_lhs = walk_tree(ast[2]);\n binary_expr.binary_rhs = walk_tree(ast[3]);\n },\n }\n \n var parent = ast[0];\n \n var func = walker[parent];\n \n return func(ast);\n}", "_rewriteAstBaseUrl(ast, oldBaseUrl, newBaseUrl) {\n this._rewriteElementAttrsBaseUrl(ast, oldBaseUrl, newBaseUrl);\n this._rewriteStyleTagsBaseUrl(ast, oldBaseUrl, newBaseUrl);\n this._setDomModuleAssetpaths(ast, oldBaseUrl, newBaseUrl);\n }", "replaceWith (node) {\n node.replace(this)\n }", "function editNode(callback, node, parent, key, level, index)\n{\n\tlet res = callback(node, parent, key, level, index);\n\t// apply indentation to hig-level rules\n\t// if (isNode(res) && 'indent' in res) { res.indent = level; }\n\tindex != null ? parent[key][index] = res : parent[key] = res;\n}", "function transform( node, transformations ){\n\t\tfor( var key in node.attrs )\n\t\t\tif( transformations.hasOwnProperty( node.attrs[ key ] ) ){\n\t\t\t\tvar transformed = transformations[ key ](\n\t\t\t\t\tnode,\n\t\t\t\t\tnode.attrs[ key ],\n\t\t\t\t\tnode.attrs\n\t\t\t\t)\n\n\t\t\t\tif( transformed !== undefined )\n\t\t\t\t\tnode = transformed\n\t\t\t}\n\n\t\treturn node\n\t}", "function ASTannotate(ast, parent, next, previous) {\n if (!ast) {\n return;\n }\n ast.parent = parent;\n ast.next = next;\n ast.previous = previous;\n\n switch (ast.TYPE) {\n case \"nodelist\":\n for (let i = 0; i < ast.length; i++) {\n previous = i === 0 ? null : ast[i - 1];\n next = i === ast.length - 1 ? null : ast[i + 1];\n ASTannotate(ast[i], ast, next, previous);\n }\n break;\n case \"arglist\":\n case \"subscript\":\n case \"superscript\":\n case \"inlinemath\":\n case \"displaymath\":\n case \"mathenv\":\n case \"group\":\n ASTannotate(ast.content, ast);\n break;\n case \"macro\":\n ASTannotate(ast.args, ast);\n break;\n case \"environment\":\n ASTannotate(ast.content, ast);\n ASTannotate(ast.args, ast);\n break;\n case \"string\":\n case \"parbreak\":\n case \"verbatim\":\n case \"verb\":\n case \"commentenv\":\n case \"comment\":\n break;\n }\n return ast;\n}", "ast(code) {\n const tokens = splitIntoTokens(code)\n return buildAstFromTokens(tokens)\n }", "function wrapper(ast, options) {\n var settings = options || {}\n var file\n\n if (settings.messages) {\n file = settings\n settings = {}\n } else {\n file = settings.file\n }\n\n return transform(ast, {\n schema: settings.space === 'svg' ? svg : html,\n file: file,\n verbose: settings.verbose\n })\n}", "function church_astify(tokens) {\n\t// astify changes the opening bracket tokens so the end site is the matching closing bracket\n\tfunction astify(tokens) {\n\n\t\tfunction helper(opening_bracket) {\n\t\t\t// Tree nodes have keys [children, start, end]\n\t\t\tvar result = {children: [], start: opening_bracket ? opening_bracket.start : \"1:1\"};\n\t\t\twhile (tokens.length > 0) {\n\t\t\t\tif (tokens[0].text == \"(\" || tokens[0].text == \"[\") {\n\t\t\t\t\tvar bracket = tokens[0];\n\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\tresult.children.push(helper(bracket));\n\t\t\t\t} else if (tokens[0].text == \")\" || tokens[0].text == \"]\") {\n\t\t\t\t\tif (!opening_bracket || tokens[0].text != brackets_map[opening_bracket.text]) {\n\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", tokens[0].start, tokens[0].end, \"Unexpected close parens\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult[\"end\"] = tokens[0].start;\n\t\t\t\t\t\topening_bracket.end = tokens[0].start;\n\t\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar token = tokens.shift();\n\t\t\t\t\tstorage.push(token);\n\t\t\t\t\tresult.children.push(token);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!opening_bracket) {\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", opening_bracket.start, opening_bracket.end, \"Unclosed parens\");\n\t\t\t}\n\t\t}\n\t\tvar storage = [];\n\t\tvar ast = helper();\n\t\tfor (var i = 0; i < storage.length; i++) {\n\t\t\ttokens.push(storage[i]);\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction traverse(ast, fn, stopfn) {\n\t\tif (!util.is_leaf(ast) && ast.children.length > 0 && (!stopfn || !stopfn(ast))) {\n\t\t\tast = fn(ast);\n\t\t\tfor (var i = 0; i < ast.children.length; i++) {\n\t\t\t\tast.children[i] = traverse(ast.children[i], fn, stopfn);\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction is_special_form(text) {\n\t\treturn [\"define\", \"lambda\", \"case\", \"cond\", \"if\", \"let\"].indexOf(text) != -1;\n\t}\n\n\tfunction assert_not_special_form(node) {\n\t\tif (is_special_form(node.text)) {\n\t\t\tthrow util.make_church_error(\"SyntaxError\", node.start, node.end, \"Special form \" + node.text + \" cannot be used as an atom\");\n\t\t}\n\t}\n\n\tfunction validate_leaves(ast) {\n\t\tfor (var i = 1; i < ast.children.length; i++) {\n\t\t\tassert_not_special_form(ast.children[i]);\n\t\t}\n\t\treturn ast;\n\t}\n\n\t// NOTE: Many of the desugar functions don't add range information.\n\t// For now, it seems unlikely they'll be needed.\n\n\tfunction dsgr_define(ast) {\n\t\tif (ast.children[0].text==\"define\") {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"Invalid define\");\n\t\t\t}\n\t\t\t// Function define sugar\n\t\t\tif (!util.is_leaf(ast.children[1])) {\n\t\t\t\tvar lambda_args;\n\t\t\t\t// Variadic sugar\n\t\t\t\tif (ast.children[1].children.length == 3 && ast.children[1].children[1].text == \".\") {\n\t\t\t\t\tlambda_args = ast.children[1].children[2];\n\t\t\t\t} else {\n\t\t\t\t\tlambda_args = {children: ast.children[1].children.slice(1)};\n\t\t\t\t}\n\t\t\t\tvar lambda = {\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\tlambda_args\n\t\t\t\t\t].concat(ast.children.slice(2))\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tchildren: [ast.children[0], ast.children[1].children[0], lambda],\n\t\t\t\t\tstart: ast.start,\n\t\t\t\t\tend: ast.end\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction dsgr_lambda(ast) {\n\t\tif (ast.children[0].text==\"lambda\") {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"lambda has no body\");\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction dsgr_let(ast) {\n\t\tvar let_varieties = [\"let\", \"let*\"];\n\n\t\tif (let_varieties.indexOf(ast.children[0].text)!=-1) {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, ast.children[0].text + \" has no body\");\n\t\t\t}\n\t\t\tvar bindings = ast.children[1];\n\t\t\tvar valid_bindings = true;\n\t\t\tif (util.is_leaf(bindings)) {\n\t\t\t\tvalid_bindings = false;\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < bindings.children.length; i++) {\n\t\t\t\t\tif (util.is_leaf(bindings.children[i]) || bindings.children[i].children.length != 2) {\n\t\t\t\t\t\tvalid_bindings = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!valid_bindings) {\n\t\t\t\tthrow util.make_church_error_range(\"SyntaxError\", bindings.start, bindings.end, ast.children[0].text + \" has invalid bindings\");\n\t\t\t}\n\n\t\t\tswitch (ast.children[0].text) {\n\t\t\t\tcase \"let\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\t\t\t\t{children: bindings.children.map(function(x) {return x.children[0]})},\n\t\t\t\t\t\t\t\t\tast.children[2]\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t].concat(bindings.children.map(function(x) {return x.children[1]}))\n\t\t\t\t\t};\n\t\t\t\tcase \"let*\":\n\t\t\t\t\tvar new_ast = {\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\t\t\t\t{children: []},\n\t\t\t\t\t\t\t\t\tast.children[2]\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\tfor (var i = bindings.children.length-1; i >= 0; i--) {\n\t\t\t\t\t\t// console.log(JSON.stringify(bindings.children[i].children[0],undefined,2))\n\t\t\t\t\t\tnew_ast = {\n\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\t\t\t\t\t{children: [bindings.children[i].children[0]]},\n\t\t\t\t\t\t\t\t\t\tnew_ast\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\tbindings.children[i].children[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\treturn new_ast;\n\t\t\t}\n\n\n\t\t} else {\n\t\t\treturn ast;\n\t\t}\n\t}\n\n\tfunction dsgr_quote(ast) {\n\t\tvar last = ast.children[ast.children.length-1];\n\t\tif (last.text==\"'\") {\n\t\t\tthrow util.make_church_error(\"SyntaxError\", last.start, last.end, \"Invalid single quote\");\n\t\t}\n\t\tfor (var i = ast.children.length - 2; i >= 0; i--) {\n\t\t\tif (ast.children[i].text == \"'\") {\n\t\t\t\tast.children.splice(i, 2, {\n\t\t\t\t\tchildren: [{text: \"quote\", start: ast.children[i].start, end: ast.children[i].end}, ast.children[i+1]],\n\t\t\t\t\tstart: ast.children[i].start,\n\t\t\t\t\tend: ast.children[i+1].end\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction dsgr_case(ast) {\n\t\tfunction case_helper(key, clauses) {\n\t\t\tif (clauses.length == 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tvar clause = clauses[0];\n\t\t\tif (util.is_leaf(clause) || clause.children.length != 2 ||\n\t\t\t\t(util.is_leaf(clause.children[0]) && clause.children[0].text!=\"else\")) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad clause for case\");\n\t\t\t}\n\n\t\t\tif (clause.children[0].text==\"else\") {\n\t\t\t\tif (clauses.length > 1) {\n\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad placement of else clause in case\");\n\t\t\t\t} else {\n\t\t\t\t\treturn clause.children[1];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < clause.children[0]; i++) {\n\t\t\t\t\tvar datum = clause.children[0].children[i];\n\t\t\t\t\tif (util.is_leaf(datum)) {\n\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", datum.start, datum.end, \" for case\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar next = case_helper(key, clauses.slice(1));\n\t\t\t\tvar new_ast = {\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{text: \"if\"},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t{text: \"member\"},\n\t\t\t\t\t\t\t\tkey,\n {children: [{text: \"list\"}].concat(clause.children[0].children)}\n\t\t\t\t\t\t\t\t// {children: [{text: \"list\"}].concat(clause.children[0])}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\t\t\t\t\t\tclause.children[1]\n\t\t\t\t\t]\n\t\t\t\t};\n\t\t\t\tif (next) {\n\t\t\t\t\tnew_ast.children.push(next);\n\t\t\t\t}\n\t\t\t\treturn new_ast;\n\t\t\t}\n\t\t}\n\n\t\tif (ast.children[0].text==\"case\") {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"case is missing clauses\");\n\t\t\t}\n\t\t\treturn case_helper(ast.children[1], ast.children.slice(2));\n\t\t} else {\n\t\t\treturn ast;\n\t\t}\n\t}\n\n\tfunction dsgr_cond(ast) {\n\t\tfunction cond_helper(clauses) {\n\t\t\tif (clauses.length == 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tvar clause = clauses[0];\n\t\t\tif (util.is_leaf(clause) || clause.children.length != 2) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad clause for cond\");\n\t\t\t}\n\t\t\tif (clause.children[0].text==\"else\") {\n\t\t\t\tif (clauses.length > 1) {\n\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad placement of else clause in cond\");\n\t\t\t\t} else {\n\t\t\t\t\treturn clause.children[1];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar next = cond_helper(\n\t\t\t\t\tclauses.slice(1));\n\t\t\t\tvar new_ast = {\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{text: \"if\"},\n\t\t\t\t\t\tclause.children[0],\n\t\t\t\t\t\tclause.children[1]\n\t\t\t\t\t]\n\t\t\t\t};\n\t\t\t\tif (next) {\n\t\t\t\t\tnew_ast.children.push(next);\n\t\t\t\t}\n\t\t\t\treturn new_ast;\n\t\t\t}\n\t\t}\n\n\t\tif (ast.children[0].text==\"cond\") {\n\t\t\tif (ast.children.length < 2) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"cond is missing clauses\");\n\t\t\t}\n\t\t\treturn cond_helper(ast.children.slice(1));\n\t\t} else {\n\t\t\treturn ast;\n\t\t}\n\t}\n\n function dsgr_eval(ast) {\n if (ast.children[0].text == \"eval\") {\n return {\n\t\t\t\tchildren: [\n\t\t\t\t\t{text: \"eval\"},\n\t\t\t\t\t{\n children: [\n // churchToBareJs: for use in eval only\n {text: \"churchToBareJs\"},\n {\n children: [\n {text: \"formatResult\"},\n ast.children[1]\n ]\n }\n ]\n } \n ]\n }\n\t\t\n\t}\n return ast;\n };\n\n\tfunction dsgr_query(ast) {\n\t\t// Makes the lambda that's passed to the query function\n\t\tfunction query_helper(statements, condition, args) {\n\t\t\tif (util.is_leaf(condition) ||\n (condition.children[0].text != \"condition\" && condition.children[0].text != \"factor\")) {\n\t\t\t\tcondition = {\n\t\t\t\t\tchildren: [{text: \"condition\"}, condition],\n\t\t\t\t\tstart: condition.start,\n\t\t\t\t\tend: condition.end\n\t\t\t\t};\n\t\t\t}\n\t\t\targs = args || {children: []};\n\t\t\treturn {\n\t\t\t\tchildren: [\n\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\targs\n\t\t\t\t].concat(statements.slice(0, -1)).concat(condition).concat(statements[statements.length-1])\n\t\t\t};\n\t\t}\n\t\t\n\t\tif ([\"rejection-query\", \"enumeration-query\"].indexOf(ast.children[0].text) != -1) {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, ast.children[0].text + \" has the wrong number of arguments\");\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tchildren: [\n\t\t\t\t\tast.children[0],\n\t\t\t\t\tquery_helper(ast.children.slice(1, -1), ast.children[ast.children.length-1])\n\t\t\t\t],\n\t\t\t\tstart: ast.start,\n\t\t\t\tend: ast.end\n\t\t\t};\n\t\t}\n\t\tif ([\"mh-query\"].indexOf(ast.children[0].text) != -1) {\n\t\t\tif (ast.children.length < 6) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, ast.children[0].text + \" has the wrong number of arguments\");\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tchildren: [\n\t\t\t\t\tast.children[0],\n\t\t\t\t\tquery_helper(ast.children.slice(3, -1), ast.children[ast.children.length-1])\n\t\t\t\t].concat(ast.children.slice(1, 3)),\n\t\t\t\tstart: ast.start,\n\t\t\t\tend: ast.end\n\t\t\t};\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction validate_if(ast) {\n\t\tif (ast.children[0].text==\"if\") {\n\t\t\tif (ast.children.length < 3 || ast.children.length > 4) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"if has the wrong number of arguments\");\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n \n\tfunction transform_equals_condition(ast) {\n\t\tfunction is_equals_conditionable(ast) {\n\t\t\tif (util.is_leaf(ast)) return false;\n\t\t\tvar fn = church_builtins.__annotations__[rename_map[ast.children[0].text]];\n\t\t\treturn fn && fn.erp && ast.children[fn.numArgs[fn.numArgs.length-1]] == undefined;\n\t\t}\n\n\t\tfunction transform_erp(erp, conditioned_value) {\n\t\t\terp.children.push(conditioned_value);\n\t\t}\n\n\t\tfunction try_transform(left, right) {\n\t\t\tif (left == undefined) return false;\n\t\t\tif (is_equals_conditionable(left)) {\n\t\t\t\ttransform_erp(left, right);\n\t\t\t\tstatements.splice(i, 1, left);\n\t\t\t\treturn true;\n\t\t\t} else if (util.is_leaf(left) && define_table[left.text]) {\n\t\t\t\tvar left_entry = define_table[left.text];\n\t\t\t\tif (!util.is_identifier(right.text) || (\n\t\t\t\t\t\tdefine_table[right.text] && left_entry.index > define_table[right.text].index)) {\n\t\t\t\t\ttransform_erp(left_entry.def, right);\n\t\t\t\t\tstatements.splice(i, 1);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tvar transformed;\n\t\tif ([\"rejection-query\", \"enumeration-query\", \"mh-query\"].indexOf(ast.children[0].text) != -1) {\t\t\t\n\t\t\tvar define_table = {};\n\t\t\t// Assumes preprocessing through dsgr_query\n\t\t\tvar statements = ast.children[1].children.slice(2);\n\t\t\tvar i = 0;\n\t\t\t// Iterate through each lambda statement\n\t\t\tfor (var i = 0; i < statements.length; i++) {\n\t\t\t\tif (!util.is_leaf(statements[i])) {\n\t\t\t\t\t// If statement is a define and an ERP without an existing condition, put it in a table\n\t\t\t\t\tif (statements[i].children[0].text == \"define\" && is_equals_conditionable(statements[i].children[2])) {\n\t\t\t\t\t\tdefine_table[statements[i].children[1].text] = {\n\t\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\t\tdef: statements[i].children[2]\n\t\t\t\t\t\t};\n\t\t\t\t\t// If statement is a condition, check if it's an equality and attempt to transform\n\t\t\t\t\t} else if (statements[i].children[0].text == \"condition\") {\n\t\t\t\t\t\tvar condition = statements[i].children[1];\n\t\t\t\t\t\tif (!util.is_leaf(condition) && [\"=\", \"equal?\"].indexOf(condition.children[0].text) != -1 && condition.children.length == 3) {\n\t\t\t\t\t\t\tvar left = condition.children[1];\n\t\t\t\t\t\t\tvar right = condition.children[2];\n\t\t\t\t\t\t\tif (!try_transform(left, right)) try_transform(right, left);\n\t\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\n\t\t}\n\t\treturn ast;\n\t}\n\n\t// Order is important, particularly desugaring quotes before anything else.\n\tvar desugar_fns = [validate_leaves, dsgr_define, dsgr_lambda, dsgr_let, dsgr_case, dsgr_cond, dsgr_eval, dsgr_query, validate_if, transform_equals_condition];\n\n\tvar ast = astify(tokens);\n\t// Special top-level check\n\tfor (var i = 0; i < ast.children.length; i++) {\n\t\tassert_not_special_form(ast.children[i]);\n\t}\n ast = traverse(ast, dsgr_quote);\n\tfor (var i = 0; i < desugar_fns.length; i++) {\n\t\tast = traverse(ast, desugar_fns[i], isquote);\n\t}\n\n\treturn ast;\n}", "function ast_inject(ast, code, key) {\n var w = uglifyjs.uglify.ast_walker(),\n walk = w.walk,\n MAP = uglifyjs.uglify.MAP,\n slice = uglifyjs.parser.slice;\n \n var ws = {\n \"stat\": function (stat) {\n // all but anomymous function calls\n if (this[0].start) {\n return addVisit([ this[0], walk(stat) ], key, stat, [ { start: this[0].start } ]);\n }\n },\n \n \"var\": function (defs) {\n if (this[0].start) {\n return addVisit([ this[0], MAP(defs, function (def) {\n var a = [ def[0] ];\n if (def.length > 1)\n a[1] = walk(def[1]);\n return a;\n }) ], key, this, [ { start: this[0].start, end: this[0].start } ]);\n }\n },\n \n \"binary\": function (op, left, right) {\n if (op === \"||\" || op === \"&&\") {\n return [\n this[0],\n op,\n addVisitAndReturnValue(walk(left), key, left),\n addVisitAndReturnValue(walk(right), key, right)\n ];\n }\n },\n \n \"conditional\": function (cond, t, e) {\n return [\n this[0],\n addVisitAndReturnValueIfSingleExpr(walk(cond), key, cond),\n addVisitAndReturnValue(walk(t), key, t),\n addVisitAndReturnValue(walk(e), key, e)\n ];\n },\n \n \"if\": function (cond, t, e) {\n if (e == null) {\n e = [\"block\", []];\n }\n \n var ifbl, elbl;\n \n var ce = endElement(cond).end;\n var ts = startElement(t).start;\n \n var epos = ce.endpos;\n \n var xcode = code.substring(epos, ts.pos);\n var tok = uglifyjs.parser.tokenizer(xcode);\n \n var token;\n while ((token = tok()).type !== \"eof\") {\n if (token.type === \"punc\" && token.value === \")\") {\n ifbl = [ { start: { pos: epos + token.pos, endpos: epos + token.endpos } } ];\n // parenthesis inside the condition are ommitted by uglifyjs. So test for the last occurence\n } else if (ifbl != null) {\n break;\n }\n }\n \n if (e && e[0].start) {\n var te = endElement(t).end;\n var es = startElement(e).start;\n \n xcode = code.substring(te.endpos, es.pos);\n tok = uglifyjs.parser.tokenizer(xcode);\n while ((token = tok()).type !== \"eof\") {\n if (token.type === \"keyword\" && token.value === \"else\") {\n elbl = [ { start: { pos: te.endpos + token.pos, endpos: te.endpos + token.endpos } } ];\n break;\n }\n }\n }\n \n return [\n this[0],\n addVisitAndReturnValueIfSingleExpr(walk(cond), key, cond),\n addBranchIf(walk(t), key, ifbl, this, false),\n addBranchIf(walk(e), key, elbl, this, true)\n ];\n },\n \n \"switch\": function (expr, body) {\n var s = startElement(this);\n if (s && s.start) {\n var nam = branchTesterName(s.start.pos, s.start.endpos);\n \n if (body[body.length - 1][0] !== null) {\n body.push([null, [ [ \"break\", null ] ]]);\n }\n \n var eidx = endElement(expr).end.endpos;\n \n \n var t = this;\n return block(\n [ \"var\", [ [ nam, [ \"name\", \"false\" ] ] ] ],\n [\n this[0],\n addVisitAndReturnValueIfSingleExpr(walk(expr), key, expr),\n MAP(body, function (branch) {\n var sb = startElement(branch);\n if (!sb) {\n sb = endElement(body);\n }\n var sbidx = sb.start.pos;\n var xcode = code.substring(eidx, sbidx);\n var leidx = eidx;\n \n var eb = endElement(branch);\n if (!eb) {\n eb = endElement(body);\n }\n eidx = eb.end.endpos;\n \n var isDefault = !branch[0];\n var tok = uglifyjs.parser.tokenizer(xcode);\n \n var token, inArgs = false;\n while ((token = tok()).type !== \"eof\") {\n if (token.type === \"keyword\") {\n if (token.value === \"case\" || token.value === \"default\") {\n return [\n isDefault ? null: walk(branch[0]),\n addBranchSwitch(\n MAP(branch[1], walk),\n key,\n [ { start: { pos: leidx + token.pos, endpos: leidx + token.endpos } } ],\n t, isDefault\n )\n ];\n }\n }\n }\n \n return branch;\n })\n ]\n );\n }\n },\n \n \"for\": function (init, cond, step, block) {\n return [\n this[0],\n walk(init),\n addVisitAndReturnValueIfSingleExpr(walk(cond), key, cond),\n addVisitAndReturnValueIfSingleExpr(walk(step), key, step),\n walk(block)\n ];\n },\n \n \"while\": function (cond, block) {\n return [\n this[0],\n addVisitAndReturnValueIfSingleExpr(walk(cond), key, cond),\n walk(block)\n ];\n },\n \n \"function\": function (name, args, body) {\n var s = startElement(this);\n if (s && s.start) {\n // function keyword\n var func = [ { start: s.start } ];\n \n // arguments\n var ar = [];\n var bs = startElement(body);\n if (bs && bs.start) {\n var startIdx = s.start.endpos;\n var xcode = code.substring(startIdx, bs.start.pos);\n var tok = uglifyjs.parser.tokenizer(xcode);\n \n var token, inArgs = false;\n while ((token = tok()).type !== \"eof\") {\n if (!inArgs && token.type === \"punc\" && token.value === \"(\") {\n inArgs = true;\n } else if (inArgs) {\n if (token.type === \"name\") {\n ar.push({ pos: token.pos + startIdx, endpos: token.endpos + startIdx });\n } else if (token.type === \"punc\" && token.value === \")\") {\n break;\n }\n }\n }\n }\n \n // skip directives\n var startAt = 0, bodyStat, i;\n var bl = body.length;\n for (i = 0; i < bl; i++) {\n bodyStat = body[i];\n if (bodyStat[0].toString() === \"stat\" && bodyStat[1].length === 2 && bodyStat[1][0].toString() === \"string\") {\n startAt++;\n continue;\n }\n break;\n }\n \n var newBody = MAP(body, function (bodyStat, idx) {\n if (idx >= startAt) {\n return walk(bodyStat);\n }\n return bodyStat;\n });\n \n var tmp = callVisitFuncParams(func, key, ar);\n if (tmp != null) newBody.splice(startAt, 0, tmp);\n tmp = callVisitFunc([], key, body, func);\n if (tmp != null) newBody.splice(startAt, 0, tmp);\n \n return [\n this[0],\n name,\n args.slice(),\n newBody\n ];\n }\n },\n \n \"seq\": function () {\n return [ this[0] ].concat(MAP(slice(arguments), function (se) {\n return addVisitAndReturnValue(walk(se), key, se);\n }));\n },\n \n \"return\": function (expr) {\n if (this[0].start) {\n return addVisit([ this[0], walk(expr) ], key, this, [ { start: this[0].start, end: this[0].start } ]); // select only keyword\n }\n },\n \n \"break\": function (label) {\n return addVisit([ this[0], label ], key, this);\n }\n };\n \n ws[\"do\"] = ws[\"while\"];\n ws.defun = ws[\"function\"];\n ws[\"throw\"] = ws[\"return\"];\n ws[\"continue\"] = ws[\"break\"];\n \n if (option.resolveRequires.length > 0) {\n ws.call = function (expr, args) {\n if (expr[0] === \"name\" && expr[1] === \"require\" && args.length === 1) {\n args.push([\"name\", \"module\"]);\n return callRuntime(\"helper\", \"require\", args);\n }\n };\n }\n \n return w.with_walkers(ws, function () {\n return walk(ast);\n });\n }", "convert(node) {\n let result = this._write_node(node);\n\n if (!result.startsWith('\\n\\n')) result = this.escape_block(result);\n\n return result.replace(/^\\n+|\\n+$/g, '') + '\\n';\n }", "function transformNode(el) {\n const attr = Object.keys(el.attrsMap).find(attr => attr.startsWith('~'))\n\n if (attr) {\n const attrName = attr.substr(1)\n let [arg, ...modifiers] = attrName.split('.')\n modifiers = modifiers.reduce((mods, mod) => {\n mods[mod] = true\n return mods\n }, {})\n getAndRemoveAttr(el, attr, true)\n addDirective(el, 'view', `v-view:${attrName}`, '', arg, false, modifiers)\n }\n}", "function convertTreeToStack(ast, stack) {\n estraverse.traverse(ast, {\n enter: function(node) {\n stack.push(node);\n }\n });\n }", "function ssrCodegenTransform(ast, options) {\n\t const context = createSSRTransformContext(ast, options);\n\t // inject SFC <style> CSS variables\n\t // we do this instead of inlining the expression to ensure the vars are\n\t // only resolved once per render\n\t if (options.ssrCssVars) {\n\t const varsExp = compilerDom.processExpression(compilerDom.createSimpleExpression(options.ssrCssVars, false), compilerDom.createTransformContext(compilerDom.createRoot([]), options));\n\t context.body.push(compilerDom.createCompoundExpression([`const _cssVars = { style: `, varsExp, `}`]));\n\t }\n\t const isFragment = ast.children.length > 1 && ast.children.some(c => !compilerDom.isText(c));\n\t processChildren(ast.children, context, isFragment);\n\t ast.codegenNode = compilerDom.createBlockStatement(context.body);\n\t // Finalize helpers.\n\t // We need to separate helpers imported from 'vue' vs. '@vue/server-renderer'\n\t ast.ssrHelpers = Array.from(new Set([\n\t ...ast.helpers.filter(h => h in ssrHelpers),\n\t ...context.helpers\n\t ]));\n\t ast.helpers = ast.helpers.filter(h => !(h in ssrHelpers));\n\t}", "function replaceWith(replacement, whateverAllowed) {\n this.resync();\n\n if (this.removed) {\n throw new Error(\"You can't replace this node, we've already removed it\");\n }\n\n if (replacement instanceof _index4[\"default\"]) {\n replacement = replacement.node;\n }\n\n if (!replacement) {\n throw new Error(\"You passed `path.replaceWith()` a falsy node, use `path.dangerouslyRemove()` instead\");\n }\n\n if (this.node === replacement) {\n return;\n }\n\n if (this.isProgram() && !t.isProgram(replacement)) {\n throw new Error(\"You can only replace a Program root node with another Program node\");\n }\n\n // normalise inserting an entire AST\n if (t.isProgram(replacement) && !this.isProgram()) {\n replacement = replacement.body;\n whateverAllowed = true;\n }\n\n if (Array.isArray(replacement)) {\n if (whateverAllowed) {\n return this.replaceWithMultiple(replacement);\n } else {\n throw new Error(\"Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`\");\n }\n }\n\n if (typeof replacement === \"string\") {\n // triggers an error\n return this.replaceWithSourceString();\n }\n\n if (this.isNodeType(\"Statement\") && t.isExpression(replacement)) {\n if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {\n // replacing a statement with an expression so wrap it in an expression statement\n replacement = t.expressionStatement(replacement);\n }\n }\n\n if (this.isNodeType(\"Expression\") && t.isStatement(replacement)) {\n if (!this.canSwapBetweenExpressionAndStatement(replacement)) {\n // replacing an expression with a statement so let's explode it\n return this.replaceExpressionWithStatements([replacement]);\n }\n }\n\n var oldNode = this.node;\n if (oldNode) t.inheritsComments(replacement, oldNode);\n\n // replace the node\n this.node = this.container[this.key] = replacement;\n this.type = replacement.type;\n\n // potentially create new scope\n this.setScope();\n}", "function replaceWith(replacement) {\n\t this.resync();\n\n\t if (this.removed) {\n\t throw new Error(\"You can't replace this node, we've already removed it\");\n\t }\n\n\t if (replacement instanceof _index4[\"default\"]) {\n\t replacement = replacement.node;\n\t }\n\n\t if (!replacement) {\n\t throw new Error(\"You passed `path.replaceWith()` a falsy node, use `path.remove()` instead\");\n\t }\n\n\t if (this.node === replacement) {\n\t return;\n\t }\n\n\t if (this.isProgram() && !t.isProgram(replacement)) {\n\t throw new Error(\"You can only replace a Program root node with another Program node\");\n\t }\n\n\t if (Array.isArray(replacement)) {\n\t throw new Error(\"Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`\");\n\t }\n\n\t if (typeof replacement === \"string\") {\n\t throw new Error(\"Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`\");\n\t }\n\n\t // replacing a statement with an expression so wrap it in an expression statement\n\t if (this.isNodeType(\"Statement\") && t.isExpression(replacement) && !this.canHaveVariableDeclarationOrExpression()) {\n\t replacement = t.expressionStatement(replacement);\n\t }\n\n\t // replacing an expression with a statement so let's explode it\n\t if (this.isNodeType(\"Expression\") && t.isStatement(replacement)) {\n\t return this.replaceExpressionWithStatements([replacement]);\n\t }\n\n\t var oldNode = this.node;\n\t if (oldNode) {\n\t t.inheritsComments(replacement, oldNode);\n\t t.removeComments(oldNode);\n\t }\n\n\t // replace the node\n\t this._replaceWith(replacement);\n\t this.type = replacement.type;\n\n\t // potentially create new scope\n\t this.setScope();\n\n\t // requeue for visiting\n\t this.requeue();\n\t}", "function replaceWith(replacement) {\n\t this.resync();\n\n\t if (this.removed) {\n\t throw new Error(\"You can't replace this node, we've already removed it\");\n\t }\n\n\t if (replacement instanceof _index4[\"default\"]) {\n\t replacement = replacement.node;\n\t }\n\n\t if (!replacement) {\n\t throw new Error(\"You passed `path.replaceWith()` a falsy node, use `path.remove()` instead\");\n\t }\n\n\t if (this.node === replacement) {\n\t return;\n\t }\n\n\t if (this.isProgram() && !t.isProgram(replacement)) {\n\t throw new Error(\"You can only replace a Program root node with another Program node\");\n\t }\n\n\t if (Array.isArray(replacement)) {\n\t throw new Error(\"Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`\");\n\t }\n\n\t if (typeof replacement === \"string\") {\n\t throw new Error(\"Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`\");\n\t }\n\n\t if (this.isNodeType(\"Statement\") && t.isExpression(replacement)) {\n\t if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {\n\t // replacing a statement with an expression so wrap it in an expression statement\n\t replacement = t.expressionStatement(replacement);\n\t }\n\t }\n\n\t if (this.isNodeType(\"Expression\") && t.isStatement(replacement)) {\n\t if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {\n\t // replacing an expression with a statement so let's explode it\n\t return this.replaceExpressionWithStatements([replacement]);\n\t }\n\t }\n\n\t var oldNode = this.node;\n\t if (oldNode) {\n\t t.inheritsComments(replacement, oldNode);\n\t t.removeComments(oldNode);\n\t }\n\n\t // replace the node\n\t this._replaceWith(replacement);\n\t this.type = replacement.type;\n\n\t // potentially create new scope\n\t this.setScope();\n\n\t // requeue for visiting\n\t this.requeue();\n\t}", "function replaceWith(replacement) {\n\t this.resync();\n\n\t if (this.removed) {\n\t throw new Error(\"You can't replace this node, we've already removed it\");\n\t }\n\n\t if (replacement instanceof _index4[\"default\"]) {\n\t replacement = replacement.node;\n\t }\n\n\t if (!replacement) {\n\t throw new Error(\"You passed `path.replaceWith()` a falsy node, use `path.remove()` instead\");\n\t }\n\n\t if (this.node === replacement) {\n\t return;\n\t }\n\n\t if (this.isProgram() && !t.isProgram(replacement)) {\n\t throw new Error(\"You can only replace a Program root node with another Program node\");\n\t }\n\n\t if (Array.isArray(replacement)) {\n\t throw new Error(\"Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`\");\n\t }\n\n\t if (typeof replacement === \"string\") {\n\t throw new Error(\"Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`\");\n\t }\n\n\t if (this.isNodeType(\"Statement\") && t.isExpression(replacement)) {\n\t if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {\n\t // replacing a statement with an expression so wrap it in an expression statement\n\t replacement = t.expressionStatement(replacement);\n\t }\n\t }\n\n\t if (this.isNodeType(\"Expression\") && t.isStatement(replacement)) {\n\t if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {\n\t // replacing an expression with a statement so let's explode it\n\t return this.replaceExpressionWithStatements([replacement]);\n\t }\n\t }\n\n\t var oldNode = this.node;\n\t if (oldNode) {\n\t t.inheritsComments(replacement, oldNode);\n\t t.removeComments(oldNode);\n\t }\n\n\t // replace the node\n\t this._replaceWith(replacement);\n\t this.type = replacement.type;\n\n\t // potentially create new scope\n\t this.setScope();\n\n\t // requeue for visiting\n\t this.requeue();\n\t}", "ast(o, level) {\r\n\t\t\t\t\tvar astNode;\r\n\t\t\t\t\t// Merge `level` into `o` and perform other universal checks.\r\n\t\t\t\t\to = this.astInitialize(o, level);\r\n\t\t\t\t\t// Create serializable representation of this node.\r\n\t\t\t\t\tastNode = this.astNode(o);\r\n\t\t\t\t\t// Mark AST nodes that correspond to expressions that (implicitly) return.\r\n\t\t\t\t\t// We can’t do this as part of `astNode` because we need to assemble child\r\n\t\t\t\t\t// nodes first before marking the parent being returned.\r\n\t\t\t\t\tif ((this.astNode != null) && this.canBeReturned) {\r\n\t\t\t\t\t\tObject.assign(astNode, {\r\n\t\t\t\t\t\t\treturns: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn astNode;\r\n\t\t\t\t}", "renameNode(oldId, newId) {\n this.checkTransactionStart();\n\n let node = this.getNode(oldId);\n if (!node) { return; }\n node.id = newId;\n\n for (let i = 0; i < this.edges.length; i++) {\n let edge = this.edges[i];\n if (!edge) { continue; }\n if (edge.from.node === oldId) {\n edge.from.node = newId;\n }\n if (edge.to.node === oldId) {\n edge.to.node = newId;\n }\n }\n\n for (let j = 0; j < this.initializers.length; j++) {\n let iip = this.initializers[j];\n if (!iip) { continue; }\n if (iip.to.node === oldId) {\n iip.to.node = newId;\n }\n }\n\n for (var pub in this.inports) {\n var priv = this.inports[pub];\n if (priv.process === oldId) {\n priv.process = newId;\n }\n }\n for (pub in this.outports) {\n var priv = this.outports[pub];\n if (priv.process === oldId) {\n priv.process = newId;\n }\n }\n for (let k = 0; k < this.exports.length; k++) {\n let exported = this.exports[k];\n if (exported.process === oldId) {\n exported.process = newId;\n }\n }\n\n for (let i1 = 0; i1 < this.groups.length; i1++) {\n let group = this.groups[i1];\n if (!group) { continue; }\n let index = group.nodes.indexOf(oldId);\n if (index === -1) { continue; }\n group.nodes[index] = newId;\n }\n\n this.emit('renameNode', oldId, newId);\n return this.checkTransactionEnd();\n }", "function church_ast_to_string(ast) {\n\tif (util.is_leaf(ast)) {\n\t\treturn ast.text;\n\t} else {\n\t\treturn \"(\" + ast.children.map(function(x) {return church_ast_to_string(x)}).join(\" \") + \")\"\n\t}\n}", "transform(program) {\n var options = AsxFormatter.options(this.file.ast);\n //DefaultFormatter.prototype.transform.apply(this, arguments);\n\n var locals = [];\n var definitions = [];\n var body = [];\n program.body.forEach(item=>{\n switch(item.type){\n case 'ExpressionStatement':\n var exp = item.expression;\n if(exp.type=='Literal' && exp.value.toLowerCase()=='use strict'){\n return;\n }\n break;\n case 'VariableDeclaration':\n item.declarations.forEach(d=>{\n locals.push(d.id);\n });\n break;\n case 'FunctionDeclaration':\n if(item.id.name=='module'){\n item.body.body.forEach(s=>{\n body.push(s);\n })\n return;\n }else\n if(item._class){\n item.id =t.identifier('c$'+item._class);\n body.push(t.expressionStatement(t.callExpression(\n t.memberExpression(\n t.identifier('asx'),\n t.identifier('c$')\n ),[item])));\n return;\n }else{\n locals.push(item.id);\n }\n break;\n }\n body.push(item);\n });\n\n var definer = [];\n\n\n\n if(Object.keys(this.imports).length){\n\n Object.keys(this.imports).forEach(key=>{\n var items = this.imports[key];\n if(items['*'] && typeof items['*']=='string'){\n this.imports[key]=items['*'];\n }\n });\n definer.push(t.property('init',\n t.identifier('imports'),\n t.valueToNode(this.imports)\n ))\n }\n var exports;\n if(this.exports['*']){\n exports = this.exports['*'];\n delete this.exports['*'];\n }\n if(Object.keys(this.exports).length){\n definer.push(t.property('init',\n t.identifier('exports'),\n t.valueToNode(this.exports)\n ))\n }\n if(body.length){\n if(exports){\n var ret = [];\n Object.keys(exports).forEach(key=>{\n var val = exports[key];\n if(typeof val=='string') {\n ret.push(t.property('init',\n t.literal(key), t.identifier(val == '*' ? key : val)\n ))\n }else{\n ret.push(t.property('init',\n t.literal(key), val\n ))\n }\n });\n body.push(t.returnStatement(\n t.objectExpression(ret)\n ));\n }\n var initializer = t.functionExpression(null, [t.identifier('asx')], t.blockStatement(body));\n definer.push(t.property('init',\n t.identifier('execute'),\n initializer\n ))\n }\n definitions.forEach(item=>{\n\n if(item._class){\n definer.push(t.property('init',\n t.literal('.'+item._class),\n item\n ))\n }else{\n definer.push(t.property('init',\n t.literal(':'+item.id.name),\n item\n ))\n }\n\n })\n definer = t.objectExpression(definer);\n\n\n\n /*\n var definer = t.functionExpression(null, [t.identifier(\"module\")], t.blockStatement(body));\n if(options.bind){\n definer = t.callExpression(\n t.memberExpression(\n definer,\n t.identifier(\"bind\")\n ),[\n t.callExpression(t.identifier(\"eval\"),[t.literal(\"this.global=this\")])\n ]\n );\n }*/\n var body = [];\n var definer = util.template(\"asx-module\",{\n MODULE_NAME: t.literal(this.getModuleName()),\n MODULE_BODY: definer\n });\n if(options.runtime){\n var rt = util.template(\"asx-runtime\")\n //rt._compact = true;\n body.push(t.expressionStatement(rt));\n }\n body.push(t.expressionStatement(definer))\n program.body = body;\n }", "function replaceWith(replacement, whateverAllowed) {\n\t this.resync();\n\n\t if (this.removed) {\n\t throw new Error(\"You can't replace this node, we've already removed it\");\n\t }\n\n\t if (replacement instanceof _index4[\"default\"]) {\n\t replacement = replacement.node;\n\t }\n\n\t if (!replacement) {\n\t throw new Error(\"You passed `path.replaceWith()` a falsy node, use `path.dangerouslyRemove()` instead\");\n\t }\n\n\t if (this.node === replacement) {\n\t return;\n\t }\n\n\t if (this.isProgram() && !t.isProgram(replacement)) {\n\t throw new Error(\"You can only replace a Program root node with another Program node\");\n\t }\n\n\t // normalise inserting an entire AST\n\t if (t.isProgram(replacement) && !this.isProgram()) {\n\t replacement = replacement.body;\n\t whateverAllowed = true;\n\t }\n\n\t if (Array.isArray(replacement)) {\n\t if (whateverAllowed) {\n\t return this.replaceWithMultiple(replacement);\n\t } else {\n\t throw new Error(\"Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`\");\n\t }\n\t }\n\n\t if (typeof replacement === \"string\") {\n\t // triggers an error\n\t return this.replaceWithSourceString();\n\t }\n\n\t if (this.isNodeType(\"Statement\") && t.isExpression(replacement)) {\n\t if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {\n\t // replacing a statement with an expression so wrap it in an expression statement\n\t replacement = t.expressionStatement(replacement);\n\t }\n\t }\n\n\t if (this.isNodeType(\"Expression\") && t.isStatement(replacement)) {\n\t if (!this.canSwapBetweenExpressionAndStatement(replacement)) {\n\t // replacing an expression with a statement so let's explode it\n\t return this.replaceExpressionWithStatements([replacement]);\n\t }\n\t }\n\n\t var oldNode = this.node;\n\t if (oldNode) t.inheritsComments(replacement, oldNode);\n\n\t // replace the node\n\t this.node = this.container[this.key] = replacement;\n\t this.type = replacement.type;\n\n\t // potentially create new scope\n\t this.setScope();\n\t}", "compileAST(match, { operator, rhs, lhs }) {\n let expression = this.compileASTExpression(match, { lhs, operator, rhs })\n if (this.parenthesize && !(expression instanceof AST.ParenthesizedExpression)) {\n expression = new AST.ParenthesizedExpression(match, { expression })\n }\n if (this.shouldNegateOutput(operator)) expression = new AST.NotExpression(match, { expression })\n return expression\n }", "appendToTree(Node) {\n this.tree = {...this.tree, ...Node};\n }", "function evaluate(ast, environment){\n return ast;\n}", "function evaluate(ast, environment){\n return ast;\n}", "function handleNode(node) {\n const value = node.value;\n if (value.type === \"TextNode\") {\n if (!value.chars.startsWith(\"`\") || !value.chars.endsWith(\"`\")) {\n return;\n }\n node.value = {\n type: \"MustacheStatement\",\n path: {\n type: \"PathExpression\",\n original: \"e\",\n this: false,\n parts: [\"e\"],\n data: false,\n log: null\n },\n params: [\n {\n type: \"StringLiteral\",\n value: JSON.stringify(\"'\" + value.chars + \"'\")\n .slice(0, -2)\n .slice(2),\n original: value.chars,\n loc: null\n },\n {\n type: \"PathExpression\",\n original: \"this\",\n this: true,\n parts: [],\n data: false,\n loc: null\n }\n ],\n hash: {\n type: \"Hash\",\n pairs: [],\n loc: null\n },\n loc: null,\n escaped: true,\n strip: {\n open: false,\n close: false\n }\n };\n }\n }", "function print(ast) {\n return (0,_visitor_mjs__WEBPACK_IMPORTED_MODULE_0__.visit)(ast, {\n leave: printDocASTReducer\n });\n}", "function print(ast) {\n return (0,_visitor_mjs__WEBPACK_IMPORTED_MODULE_0__.visit)(ast, {\n leave: printDocASTReducer\n });\n}", "function tracer(ast, env) {\n env = (env==undefined?new Environment():env)\n// console.log(env.depth)\n// console.log(\"tracer: \",ast)\n// console.log(\"tracer, trace so far: \",global_trace)\n// console.log(env)\n switch (ast.type) {\n //First the statements:\n case 'Program':\n case 'BlockStatement':\n var ret\n for (a in ast.body) {\n ret = tracer(ast.body[a],env)\n }\n return ret\n \n case 'ExpressionStatement':\n return tracer(ast.expression, env)\n \n //comment out because church compile uses ternary op, not if...\n // case 'IfStatement':\n // var test = tracer(ast.test,env)\n // if(test instanceof Abstract) {\n // var ret = new Abstract()\n // var cons = tracer(ast.consequent,env)\n // cons = (cons instanceof Abstract)? cons.id : cons //FIXME to string?\n // var alt = tracer(ast.alternate, env)\n // alt = (alt instanceof Abstract)? alt.id : alt\n // var tracestring = \"var \"+ret.id+\" = \"+test.id+\"?\"+cons+\":\"+alt+\";\"\n // extendTrace(tracestring)\n //\n // return ret\n // }\n // return test?tracer(ast.consequent,env):tracer(ast.alternate, env)\n \n case 'ReturnStatement':\n var val = tracer(ast.argument, env)\n var e ={thrown_return: true, val: val}\n throw e\n \n case 'VariableDeclaration':\n env.bind(ast.declarations[0].id.name, tracer(ast.declarations[0].init,env))\n return undefined\n \n \n //Next the expresisons:\n case 'FunctionExpression':\n //represent a closure as the FunctionExpression AST with a field for enclosing env.\n// //eagerly trace through closures:\n// var clostrace = trace_closure(ast.body,ast.params,env)\n// var newast = esprima.parse(\"var dummy =\"+clostrace).body[0].declarations[0].init //esprima can't directly parse function so wrap in id...\n// newast.env = env\n ast.env = env\n return ast\n \n case 'ArrayExpression':\n var ret = []\n for (a in ast.elements) {\n ret.push(tracer(ast.elements[a],env))\n }\n return ret\n \n case 'UnaryExpression':\n var op\n switch (ast.operator) {\n case \"-\": op = \"minus\"; break;\n default: throw new Error(\"Tracer doesn't know how to handle Unary Operator: \",ast.operator)\n }\n ast.callee = {type: 'Identifier', name: op}\n ast.arguments = [ ast.argument ]\n case 'CallExpression':\n var args = []\n var abstract_args=false\n for(var a in ast.arguments) {\n var val = tracer(ast.arguments[a], env)\n args.push(val)\n if(isAbstract(val) || isClosure(val)) {abstract_args=true}\n }\n var fn = tracer(ast.callee,env)\n \n// console.log(\"tracer call: \", fn, \"\\n\",args,\"\\n\",abstract_args )\n \n if(isClosure(fn)) {\n if(env.depth==max_trace_depth) {\n //depth maxed out, don't trace branches, just generate code for this call:\n var ret = new Abstract()\n extendTrace(\"var \"+ret.id +\" = \"+escodegen.generate(ast))\n console.log(\"Tracer warning: max_trace_depth reached, generating original code. (This might be broken.)\")\n return ret\n }\n var callenv = new Environment(fn.env)\n callenv.bind(\"arguments\",args) //make arguments keyword bound to current call args\n for(a in fn.params) {\n callenv.bind(fn.params[a].name,args[a]) //bind args to params\n }\n try {\n tracer(fn.body,callenv)\n } catch (e) {\n if (e.thrown_return) {return e.val}\n throw e\n }\n return undefined\n }\n \n //if callee isn't a closure and operator or any args are abstract, emit new assignment into trace.\n //if the fn is list or pair, go ahead and do it, even with abstract args to ennable allocation removal. NOTE: could abstracts in lists screw up other things?\n var isadtcons = (fn == list) || (fn == pair)\n var fnisrandom = (fn == random)\n if(fnisrandom || isAbstract(fn) || (abstract_args && !isadtcons)) {\n var ret = new Abstract()\n// if(isAbstract(fn)){var fnstring = valString(fn)} else {var fnstring = escodegen.generate(ast.callee)}\n var fnstring = isAbstract(fn) ? valString(fn) : escodegen.generate(ast.callee)\n var argstrings = []\n for(var a in args){\n// argstrings.push(valString(args[a]))\n //if arg is a closure eagerly evaluate it to a trace.\n if(isClosure(args[a])) {\n //TODO: we trace closures more times than needed. trace when closure is created?\n argstrings.push(trace_closure(args[a].body,args[a].params,args[a].env))\n } else {\n argstrings.push(valString(args[a]))\n }\n }\n extendTrace(\"var \"+ret.id+\" = \"+fnstring+\"(\"+argstrings.join(\",\")+\");\")\n return ret\n }\n //otherwise just do the fn:\n return fn.apply(fn,args)\n \n \n case 'ConditionalExpression':\n var test = tracer(ast.test,env)\n if(isAbstract(test)) {\n var ret = new Abstract()\n extendTrace(\"if(\"+valString(test)+\") {\")\n var cons = valString(tracer(ast.consequent,env))\n extendTrace(\"var \"+ret.id+\" = \"+cons +\";}\")\n extendTrace(\" else {\")\n var alt = valString(tracer(ast.alternate, env))\n extendTrace(\"var \"+ret.id+\" = \"+alt +\";}\")\n return ret\n }\n return test?tracer(ast.consequent,env):tracer(ast.alternate, env)\n \n case 'MemberExpression':\n var ob = tracer(ast.object,env)\n if (!ast.computed) {\n var v = ob[ast.property.name]\n if(v instanceof Object){v.sourcename = ob.sourcename+\".\"+ast.property.name}\n return v\n } else {\n throw new Error(\"Have not implemented computed member reference.\")\n }\n \n case 'Identifier':\n //lookup in interpreter environment:\n var v = env.lookup(ast.name)\n //if not found, assume it will be defined in js environment for interpreter:\n if(v == undefined){\n v = eval(ast.name); //FIXME: better way to do this?\n if(v instanceof Object){v.sourcename = ast.name}\n }\n return v\n \n case 'Literal':\n return ast.value\n \n default:\n throw new Error(\"Tracer dosen't know how to handle \"+ast.type+\" in: \"+escodegen.generate(ast))\n }\n}", "function update($, node) {\n if (node.type !== $.node.type) {\n throw Error(`Invalid update for a \"${$.node.type}\" node`);\n }\n updateAttrs($, node);\n updateEvents($, node);\n updateChildren($, node);\n $.node = node;\n}", "function asrNode (id, x, y) {\n\t// TODO\n}", "function replaceWith(replacement, whateverAllowed) {\n\t this.resync();\n\n\t if (this.removed) {\n\t throw new Error(\"You can't replace this node, we've already removed it\");\n\t }\n\n\t if (replacement instanceof _index4[\"default\"]) {\n\t replacement = replacement.node;\n\t }\n\n\t if (!replacement) {\n\t throw new Error(\"You passed `path.replaceWith()` a falsy node, use `path.dangerouslyRemove()` instead\");\n\t }\n\n\t if (this.node === replacement) {\n\t return;\n\t }\n\n\t if (this.isProgram() && !t.isProgram(replacement)) {\n\t throw new Error(\"You can only replace a Program root node with another Program node\");\n\t }\n\n\t // normalise inserting an entire AST\n\t if (t.isProgram(replacement) && !this.isProgram()) {\n\t replacement = replacement.body;\n\t whateverAllowed = true;\n\t }\n\n\t if (Array.isArray(replacement)) {\n\t if (whateverAllowed) {\n\t return this.replaceWithMultiple(replacement);\n\t } else {\n\t throw new Error(\"Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`\");\n\t }\n\t }\n\n\t if (typeof replacement === \"string\") {\n\t // triggers an error\n\t return this.replaceWithSourceString();\n\t }\n\n\t // replacing a statement with an expression so wrap it in an expression statement\n\t if (this.isNodeType(\"Statement\") && t.isExpression(replacement) && !this.canHaveVariableDeclarationOrExpression()) {\n\t replacement = t.expressionStatement(replacement);\n\t }\n\n\t // replacing an expression with a statement so let's explode it\n\t if (this.isNodeType(\"Expression\") && t.isStatement(replacement)) {\n\t return this.replaceExpressionWithStatements([replacement]);\n\t }\n\n\t var oldNode = this.node;\n\t if (oldNode) t.inheritsComments(replacement, oldNode);\n\n\t // replace the node\n\t this.node = this.container[this.key] = replacement;\n\t this.type = replacement.type;\n\n\t // potentially create new scope\n\t this.setScope();\n\t}", "function toExpression(node) {\n if (t.isExpressionStatement(node)) {\n node = node.expression;\n }\n\n if (t.isClass(node)) {\n node.type = \"ClassExpression\";\n } else if (t.isFunction(node)) {\n node.type = \"FunctionExpression\";\n }\n\n if (t.isExpression(node)) {\n return node;\n } else {\n throw new Error(\"cannot turn \" + node.type + \" to an expression\");\n }\n}", "function print(ast) {\n return visit(ast, {\n leave: printDocASTReducer\n });\n} // TODO: provide better type coverage in future", "_modifySpan(span, dtsEntry, astDeclaration, dtsKind) {\n const previousSpan = span.previousSibling;\n let recurseChildren = true;\n switch (span.kind) {\n case ts.SyntaxKind.JSDocComment:\n // If the @packagedocumentation comment seems to be attached to one of the regular API items,\n // omit it. It gets explictly emitted at the top of the file.\n if (span.node.getText().match(/(?:\\s|\\*)@packagedocumentation(?:\\s|\\*)/g)) {\n span.modification.skipAll();\n }\n // For now, we don't transform JSDoc comment nodes at all\n recurseChildren = false;\n break;\n case ts.SyntaxKind.ExportKeyword:\n case ts.SyntaxKind.DefaultKeyword:\n case ts.SyntaxKind.DeclareKeyword:\n // Delete any explicit \"export\" or \"declare\" keywords -- we will re-add them below\n span.modification.skipAll();\n break;\n case ts.SyntaxKind.InterfaceKeyword:\n case ts.SyntaxKind.ClassKeyword:\n case ts.SyntaxKind.EnumKeyword:\n case ts.SyntaxKind.NamespaceKeyword:\n case ts.SyntaxKind.ModuleKeyword:\n case ts.SyntaxKind.TypeKeyword:\n case ts.SyntaxKind.FunctionKeyword:\n // Replace the stuff we possibly deleted above\n let replacedModifiers = '';\n // Add a declare statement for root declarations (but not for nested declarations)\n if (!astDeclaration.parent) {\n replacedModifiers += 'declare ';\n }\n if (dtsEntry.exported) {\n replacedModifiers = 'export ' + replacedModifiers;\n }\n if (previousSpan && previousSpan.kind === ts.SyntaxKind.SyntaxList) {\n // If there is a previous span of type SyntaxList, then apply it before any other modifiers\n // (e.g. \"abstract\") that appear there.\n previousSpan.modification.prefix = replacedModifiers + previousSpan.modification.prefix;\n }\n else {\n // Otherwise just stick it in front of this span\n span.modification.prefix = replacedModifiers + span.modification.prefix;\n }\n break;\n case ts.SyntaxKind.VariableDeclaration:\n if (!span.parent) {\n // The VariableDeclaration node is part of a VariableDeclarationList, however\n // the Entry.followedSymbol points to the VariableDeclaration part because\n // multiple definitions might share the same VariableDeclarationList.\n //\n // Since we are emitting a separate declaration for each one, we need to look upwards\n // in the ts.Node tree and write a copy of the enclosing VariableDeclarationList\n // content (e.g. \"var\" from \"var x=1, y=2\").\n const list = TypeScriptHelpers_1.TypeScriptHelpers.matchAncestor(span.node, [ts.SyntaxKind.VariableDeclarationList, ts.SyntaxKind.VariableDeclaration]);\n if (!list) {\n throw new Error('Unsupported variable declaration');\n }\n const listPrefix = list.getSourceFile().text\n .substring(list.getStart(), list.declarations[0].getStart());\n span.modification.prefix = 'declare ' + listPrefix + span.modification.prefix;\n span.modification.suffix = ';';\n }\n break;\n case ts.SyntaxKind.Identifier:\n let nameFixup = false;\n const identifierSymbol = this._typeChecker.getSymbolAtLocation(span.node);\n if (identifierSymbol) {\n const followedSymbol = TypeScriptHelpers_1.TypeScriptHelpers.followAliases(identifierSymbol, this._typeChecker);\n const referencedDtsEntry = this._dtsEntriesBySymbol.get(followedSymbol);\n if (referencedDtsEntry) {\n if (!referencedDtsEntry.nameForEmit) {\n // This should never happen\n throw new Error('referencedEntry.uniqueName is undefined');\n }\n span.modification.prefix = referencedDtsEntry.nameForEmit;\n nameFixup = true;\n // For debugging:\n // span.modification.prefix += '/*R=FIX*/';\n }\n }\n if (!nameFixup) {\n // For debugging:\n // span.modification.prefix += '/*R=KEEP*/';\n }\n break;\n }\n if (recurseChildren) {\n for (const child of span.children) {\n let childAstDeclaration = astDeclaration;\n // Should we trim this node?\n let trimmed = false;\n if (SymbolAnalyzer_1.SymbolAnalyzer.isAstDeclaration(child.kind)) {\n childAstDeclaration = this._astSymbolTable.getChildAstDeclarationByNode(child.node, astDeclaration);\n const releaseTag = this._getReleaseTagForAstSymbol(childAstDeclaration.astSymbol);\n if (!this._shouldIncludeReleaseTag(releaseTag, dtsKind)) {\n const modification = child.modification;\n // Yes, trim it and stop here\n const name = childAstDeclaration.astSymbol.localName;\n modification.omitChildren = true;\n modification.prefix = `/* Excluded from this release type: ${name} */`;\n modification.suffix = '';\n if (child.children.length > 0) {\n // If there are grandchildren, then keep the last grandchild's separator,\n // since it often has useful whitespace\n modification.suffix = child.children[child.children.length - 1].separator;\n }\n if (child.nextSibling) {\n // If the thing we are trimming is followed by a comma, then trim the comma also.\n // An example would be an enum member.\n if (child.nextSibling.kind === ts.SyntaxKind.CommaToken) {\n // Keep its separator since it often has useful whitespace\n modification.suffix += child.nextSibling.separator;\n child.nextSibling.modification.skipAll();\n }\n }\n trimmed = true;\n }\n }\n if (!trimmed) {\n this._modifySpan(child, dtsEntry, childAstDeclaration, dtsKind);\n }\n }\n }\n }", "function xmlFlow( ast){\n\tvisit( ast, unflowedTest, function( node, parents){\n\n\t\tconsole.log(\"WALK\", node)\n\t\tconst closeTest= closeTests[ lastTag]\n\n\t\tlet values= []\n\t\tfor( let w of walkUntil( node, parents, closeTest)) {\n\t\t\tconsole.log({w})\n\t\t\tvalues.push( w.value)\n\t\t}\n\n\t\tnode.value= values.join(\"\")\n\t\tconsole.log(\"walk over\", node.value)\n\t}, true) // deleteing stuff so start from bottom\n}", "getAst() {\n\n return {\n type: 'string',\n val: this.value\n };\n }", "function print(ast) {\n return Object(_visitor_mjs__WEBPACK_IMPORTED_MODULE_0__[\"visit\"])(ast, {\n leave: printDocASTReducer\n });\n} // TODO: provide better type coverage in future", "expand(preventRecursion) {\n if (!this.isExpanded) {\n this.isExpanded = true\n\n this.expansionErrors = []\n\n // Types of nodes\n // -1: raw, needs parsing\n // 0: Plaintext\n // 1: Tag (\"#symbol.mod.mod2.mod3#\" or \"#[pushTarget:pushRule]symbol.mod\")\n // 2: Action (\"[pushTarget:pushRule], [pushTarget:POP]\", more in the future)\n\n switch (this.type) {\n // Raw rule\n case -1:\n\n this.expandChildren(this.raw, preventRecursion)\n break\n\n // Plaintext, do nothing but copy text into finsihed text\n case 0:\n this.finishedText = this.raw\n break\n\n // Tag\n case 1: {\n // Parse to find any actions, and figure out what the symbol is\n this.preactions = []\n this.postactions = []\n\n const parsed = Parser.parseTag(this.raw)\n\n // Break into symbol actions and modifiers\n this.symbol = parsed.symbol\n this.modifiers = parsed.modifiers\n\n // Create all the preactions from the raw syntax\n parsed.preactions.forEach((preaction, i) => {\n this.preactions[i] = new NodeAction(this, preaction.raw)\n })\n\n // Make undo actions for all preactions (pops for each push)\n this.preactions.forEach(pa => {\n if (pa.type === 0) {\n this.postactions.push(pa.createUndo())\n }\n })\n\n // Activate all the preactions\n this.preactions.forEach(pa => pa.activate())\n\n this.finishedText = this.raw\n\n // Expand (passing the node, this allows tracking of recursion depth)\n const selectedRule = this.grammar.selectRule(this.symbol, this, this.errors)\n\n this.expandChildren(selectedRule, preventRecursion)\n\n // Apply modifiers\n this.modifiers.forEach(modName => {\n let modParams = []\n if (modName.indexOf('(') > 0) {\n const regExp = /\\(([^)]+)\\)/\n\n const results = regExp.exec(modName)\n if (results && results.length >= 2) {\n modParams = results[1].split(',')\n modName = modName.substring(0, modName.indexOf('('))\n }\n }\n\n const mod = this.grammar.modifiers[modName]\n\n // Missing modifier?\n if (mod) {\n this.finishedText = mod(this.finishedText, modParams)\n } else {\n this.errors.push('Missing modifier ' + modName)\n this.finishedText += '((.' + modName + '))'\n }\n })\n\n // Perform post-actions\n this.postactions.forEach(pa => pa.activate())\n break\n }\n case 2:\n // Just a bare action? Expand it!\n this.action = new NodeAction(this, this.raw)\n this.action.activate()\n\n // No visible text for an action\n this.finishedText = ''\n break\n default:\n\n }\n }\n }", "function t(e,n,r){switch(e.type){case\"VariableDeclaration\":e.declarations.forEach(function(e,n){t(e.init,n,r)});break;case\"BinaryExpression\":case\"LogicalExpression\":e.operator&&i[e.operator]?(e.type=\"CallExpression\",e.callee={type:\"MemberExpression\",computed:!1,object:e.right,property:{type:\"Identifier\",name:i[e.operator]}},t(e.left,n,r),t(e.right,n,r),e.arguments=[e.left]):(t(e.left,n,r),t(e.right,n,r));break;case\"ExpressionStatement\":t(e.expression,n,r);break;case\"CallExpression\":e.arguments.forEach(function(e,n){t(e,n,r)});break;case\"AssignmentExpression\":if(e.operator&&i[e.operator]){var o=e.right;e.right={type:\"BinaryExpression\",operator:e.operator.replace(/=/,\"\").trim(),left:e.left,right:o},e.operator=\"=\",t(e.left,n,r),t(e.right,n,r)}else t(e.right,n,r);break;case\"UnaryExpression\":e.operator&&i[e.operator]?(e.type=\"CallExpression\",e.callee={type:\"MemberExpression\",computed:!1,object:e.argument,property:{type:\"Identifier\",name:\"+\"===e.operator||\"-\"===e.operator?i[\"u\"+e.operator]:i[e.operator]}},t(e.argument,n,r),e.arguments=[]):t(e.argument,n,r);break;case\"UpdateExpression\":e.operator&&i[e.operator]&&(e.type=\"CallExpression\",e.callee={type:\"MemberExpression\",computed:!1,object:e.argument,property:{type:\"Identifier\",name:i[e.operator]}},t(e.argument,n,r),e.arguments=[]);break;//We don't ned to transform following nodes! Phew!\ncase\"Literal\":case\"Identifier\":case\"BlockStatement\":case\"FunctionExpression\":}}", "function emitSerializedTypeReferenceNode(node) {\n var location = node.parent;\n while (ts.isDeclaration(location) || ts.isTypeNode(location)) {\n location = location.parent;\n }\n // Clone the type name and parent it to a location outside of the current declaration.\n var typeName = ts.cloneEntityName(node.typeName, location);\n var result = resolver.getTypeReferenceSerializationKind(typeName);\n switch (result) {\n case ts.TypeReferenceSerializationKind.Unknown:\n var temp = createAndRecordTempVariable(0 /* Auto */);\n write(\"(typeof (\");\n emitNodeWithoutSourceMap(temp);\n write(\" = \");\n emitEntityNameAsExpression(typeName, /*useFallback*/ true);\n write(\") === 'function' && \");\n emitNodeWithoutSourceMap(temp);\n write(\") || Object\");\n break;\n case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:\n emitEntityNameAsExpression(typeName, /*useFallback*/ false);\n break;\n case ts.TypeReferenceSerializationKind.VoidType:\n write(\"void 0\");\n break;\n case ts.TypeReferenceSerializationKind.BooleanType:\n write(\"Boolean\");\n break;\n case ts.TypeReferenceSerializationKind.NumberLikeType:\n write(\"Number\");\n break;\n case ts.TypeReferenceSerializationKind.StringLikeType:\n write(\"String\");\n break;\n case ts.TypeReferenceSerializationKind.ArrayLikeType:\n write(\"Array\");\n break;\n case ts.TypeReferenceSerializationKind.ESSymbolType:\n if (languageVersion < 2 /* ES6 */) {\n write(\"typeof Symbol === 'function' ? Symbol : Object\");\n }\n else {\n write(\"Symbol\");\n }\n break;\n case ts.TypeReferenceSerializationKind.TypeWithCallSignature:\n write(\"Function\");\n break;\n case ts.TypeReferenceSerializationKind.ObjectType:\n write(\"Object\");\n break;\n }\n }", "insertAfterNode(ref){this.startNode=ref;this.endNode=ref.nextSibling;}", "compileASTExpression(match, { lhs, operator }) {\n throw new TypeError(\"Must implement compileASTExpression()\")\n }", "function print(ast) {\n return Object(_visitor_mjs__WEBPACK_IMPORTED_MODULE_0__[\"visit\"])(ast, {\n leave: printDocASTReducer\n });\n}", "function node(){}", "function modify(tree) {\n\t// These structures store which objects and storage elements are tainted\n\ttree.unshift(esprima.parse('var TSobjects = new Array();'));\n\ttree.unshift(esprima.parse('var TSlocalStorage = new Array();'));\n\ttree.unshift(esprima.parse('var TSsessionStorage = new Array();'));\n\n\t// Loop through each line in the method\n\tfor (i = 0; i < tree.length; i++) {\n\t\t// Check the syntax\n\t\tswitch(tree[i].type) {\n\t\t\tcase 'VariableDeclaration':\n\t\t\t\ti += taintVariableDeclaration(tree, i);\n\t\t\t\tbreak;\n\t\t\tcase \"IfStatement\":\n\t\t\t\ttaintIfStatement(tree[i]);\n\t\t\t\tbreak;\n\t\t\tcase \"ExpressionStatement\":\n\t\t\t\ti += taintExpressionStatement(tree, i);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n}", "function RNode(){}", "insertAfterNode(ref){this.startNode=ref;this.endNode=ref.nextSibling}", "function _node2string(node) {\n return node.source || stringify(node);\n}", "function traverseReplace(node, parent, scope, remaps) {\n if (t.isIdentifier(node)) {\n replace(node, parent, scope, remaps);\n }\n\n if (t.isAssignmentExpression(node)) {\n var ids = t.getBindingIdentifiers(node);\n for (var name in ids) {\n replace(ids[name], parent, scope, remaps);\n }\n }\n\n scope.traverse(node, replaceVisitor, remaps);\n}", "function transpileSassAst(ast) {\n return ast.flatMap(rs => flatten(rs));\n}", "function autocast( s ) {\n if ( typeof(s) == 'object' ) {\n traverse( s, process );\n return s;\n }\n\n return _cast( s );\n }", "function NodeDef(){}", "function traverseReplace(node, parent, scope, remaps) {\n\t if (t.isIdentifier(node)) {\n\t replace(node, parent, scope, remaps);\n\t }\n\n\t if (t.isAssignmentExpression(node)) {\n\t var ids = t.getBindingIdentifiers(node);\n\t for (var name in ids) {\n\t replace(ids[name], parent, scope, remaps);\n\t }\n\t }\n\n\t scope.traverse(node, replaceVisitor, remaps);\n\t}", "function traverseReplace(node, parent, scope, remaps) {\n\t if (t.isIdentifier(node)) {\n\t replace(node, parent, scope, remaps);\n\t }\n\n\t if (t.isAssignmentExpression(node)) {\n\t var ids = t.getBindingIdentifiers(node);\n\t for (var name in ids) {\n\t replace(ids[name], parent, scope, remaps);\n\t }\n\t }\n\n\t scope.traverse(node, replaceVisitor, remaps);\n\t}", "async changeSubNode(asp, node, newSubNode, mode=\"edit\") {\n let index = this.app.state.aspects.indexOf(asp)\n\n // edits an aspect in the current build\n if (mode === \"edit\") {\n let state = cloneDeep(this.app.state.aspects)\n\n state[index].nodes[node] = newSubNode\n\n await this.app.setState({aspects: state})\n }\n // edits an aspect in the Ascension popup/preview\n else if (mode === \"preview-edit\") {\n let state = cloneDeep(this.app.state.currentlyViewedAspect)\n\n state.nodes[node] = newSubNode\n\n await this.app.setState({currentlyViewedAspect: state})\n }\n\n this.app.closeContext()\n }", "function toAST(concrete) {\n let rule = concrete.rule,\n production = concrete.production,\n term = production[0],\n expr1 = production[1];\n let Aterm = termToAST(term);\n let Aexpr1 = expr1ToAST(Aterm, expr1);\n return Aexpr1;\n}", "function print(ast) {\n return (0, _visitor.visit)(ast, {\n leave: printDocASTReducer\n });\n} // TODO: provide better type coverage in future", "function print(ast) {\n return (0, _visitor.visit)(ast, {\n leave: printDocASTReducer\n });\n} // TODO: provide better type coverage in future", "function print(ast) {\n return (0, _visitor.visit)(ast, {\n leave: printDocASTReducer\n });\n} // TODO: provide better type coverage in future", "function church_tree_to_esprima_ast(church_tree) {\n\tvar heads_to_helpers = {\n\t\t\"lambda\": make_function_expression,\n\t\t\"if\": make_if_expression,\n\t\t\"quote\": make_quoted_expression\n\t}\n\n\tfunction make_declaration(church_tree) {\n\t\tvalidate_variable(church_tree.children[1]);\n\n\t\tvar name = church_tree.children[1].text;\n\t\tvar val = make_expression(church_tree.children[2]);\n\n\t\tvar node = deep_copy(declaration_node);\n\t\tnode[\"declarations\"][0][\"id\"][\"name\"] = name;\n\t\tnode[\"declarations\"][0][\"init\"] = val;\n\t\treturn node;\n\t}\n\n\tfunction make_marginalize(lambda_args, mh_query) {\n\t\t// TODO\n\t\tvar call_expression = deep_copy(call_expression_node);\n\t\tcall_expression[\"callee\"] = {\"type\": \"Identifier\", \"name\": \"marginalize\"};\n\n\t\tvar computation = make_query_computation(mh_query.slice(3, -1), mh_query[mh_query.length - 1], lambda_args);\n\n\t\tcall_expression[\"arguments\"] = [\n\t\t\tcomputation,\n\t\t\t{\"type\": \"Identifier\", \"name\": \"traceMH\"},\n\t\t\tmake_expression(mh_query[1]),\n\t\t\tmake_expression(mh_query[2])];\n\t\treturn call_expression;\n\t}\n\n\tfunction make_function_expression(church_tree) {\n\t\tvar lambda_args = church_tree.children[1];\n\t\tvar church_actions = church_tree.children.slice(2);\n\t\tif (church_actions.length == 1 && util.is_leaf(church_actions[0]) && church_actions[0].text == \"embedded-mh-query\") {\n\t\t\treturn make_marginalize(lambda_args, church_actions[0]);\n\t\t}\n\n\t\tvar func_expression = deep_copy(function_expression_node);\n\t\tfunc_expression[\"body\"][\"body\"] = make_expression_statement_list(church_actions.slice(0, -1));\n\t\tfunc_expression[\"body\"][\"body\"].push(make_return_statement(church_actions[church_actions.length-1]));\n\t\tif (!util.is_leaf(lambda_args)) {\n\t\t\tfor (var i = 0; i < lambda_args.children.length; i++) {\n\t\t\t\tvalidate_variable(lambda_args.children[i]);\n\t\t\t\tfunc_expression[\"params\"].push(make_leaf_expression(lambda_args.children[i]));\n\t\t\t}\n\t\t} else {\n\t\t\tvalidate_variable(lambda_args);\n\t\t\tvar variadic = deep_copy(variadic_header);\n\t\t\tvariadic[\"declarations\"][0][\"id\"][\"name\"] = lambda_args.text;\n\t\t\tfunc_expression[\"body\"][\"body\"].unshift(variadic);\n\t\t}\n\t\treturn func_expression;\n\t}\n\n\tfunction make_call_expression(church_tree) {\n\t\tvar call_expression = deep_copy(call_expression_node);\n\t\tvar callee = church_tree.children[0];\n\t\tvar args = church_tree.children.slice(1);\n\n\t\tcall_expression[\"callee\"] = make_expression(callee);\n\t\tcall_expression[\"arguments\"] = make_expression_list(args);\n\t\tcall_expression[\"loc\"] = make_location(church_tree);\n\t\treturn call_expression;\n\t}\n\n\tfunction make_return_statement(church_tree) {\n\t\tvar return_statement = deep_copy(return_statement_node);\n\t\treturn_statement[\"argument\"] = make_expression(church_tree);\n\t\treturn return_statement;\n\t}\n\n\n function make_if_expression(church_tree) {\n var conditional_expression = deep_copy(conditional_expression_node)\n conditional_expression.test = make_expression(church_tree.children[1])\n conditional_expression.consequent = make_expression(church_tree.children[2])\n if(church_tree.children[3]) {\n conditional_expression.alternate = make_expression(church_tree.children[3])\n } else {\n conditional_expression.alternate = {type: \"Identifier\", name: \"undefined\"}\n }\n \n\t\treturn conditional_expression;\n\t}\n\n\tfunction make_quoted_expression(church_tree) {\n\t\tfunction quote_helper(quoted) {\n\t\t\tif (!util.is_leaf(quoted)) {\n\t\t\t\tif (quoted.children.length == 0) {\n\t\t\t\t\treturn make_leaf_expression(quoted);\n\t\t\t\t} else {\n\t\t\t\t\tvar array = deep_copy(array_node);\n\t\t\t\t\tvar proper_list = true;\n\t\t\t\t\tfor (var i = 0; i < quoted.children.length; i++) {\n\t\t\t\t\t\tif (quoted.children[i].text == \".\") {\n\t\t\t\t\t\t\tif (i != quoted.children.length - 2) {\n\t\t\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", quoted.children[i].start, quoted.children[i].end, \"Invalid dot\");\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tproper_list = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tarray[\"elements\"].push(quote_helper(quoted.children[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (proper_list) {\n\t\t\t\t\t\tarray[\"elements\"].push({\"type\": \"Literal\", \"name\": null, \"value\": null});\n\t\t\t\t\t}\n\t\t\t\t\treturn array;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (util.is_identifier(quoted.text)) {\n\t\t\t\t\tvar copy = deep_copy(quoted)\n\t\t\t\t\tcopy.text = '\"' + copy.text + '\"'\n\t\t\t\t\treturn make_leaf_expression(copy);\n\t\t\t\t} else {\n\t\t\t\t\treturn make_leaf_expression(quoted);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn quote_helper(church_tree.children[1]);\n\t}\n\n\tfunction make_expression(church_tree) {\n\t\tif (util.is_leaf(church_tree) || church_tree.children.length == 0) {\n\t\t\treturn make_leaf_expression(church_tree);\n\t\t} else {\n\t\t\tif (!util.is_leaf(church_tree) && church_tree.children.length > 0) {\n\t\t\t\tif (church_tree.children[0].text in heads_to_helpers) {\n\t\t\t\t\treturn heads_to_helpers[church_tree.children[0].text](church_tree);\n\t\t\t\t} else {\n\t\t\t\t\treturn make_call_expression(church_tree);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction make_leaf_expression(church_leaf) {\n\t\tvar expression = deep_copy(expression_node);\n\t\tif (!util.is_leaf(church_leaf) && church_leaf.children.length == 0) {\n\t\t\texpression = {\n\t\t\t\ttype: \"ArrayExpression\",\n\t\t\t\telements: [{\"type\": \"Literal\", \"name\": null, \"value\": null}]\n\t\t\t}\n\t\t} else if (church_leaf.text == \".\") {\n\t\t\tthrow util.make_church_error(\"SyntaxError\", church_leaf.start, church_leaf.end, \"Invalid dot\");\n\t\t} else if (church_leaf.text == undefined) {\n\t\t\texpression[\"type\"] = \"Identifier\";\n\t\t\texpression[\"name\"] = \"undefined\";\n\t\t} else if (util.boolean_aliases[church_leaf.text] != undefined) {\n\t\t\texpression[\"type\"] = \"Literal\";\n\t\t\texpression[\"value\"] = util.boolean_aliases[church_leaf.text];\n\t\t} else if (util.is_identifier(church_leaf.text)) {\n\t\t\texpression = {type: 'Identifier', name: church_leaf.text}\n\t\t} else {\n\t\t\tvar value = get_value_of_string_or_number(church_leaf.text);\n\t\t\tif (typeof value == \"number\" && value < 0) {\n\t\t\t\texpression[\"type\"] = \"UnaryExpression\";\n\t\t\t\texpression[\"operator\"] = \"-\"\n\t\t\t\texpression[\"argument\"] = {\"type\": \"Literal\", \"value\": -value}\n\t\t\t} else {\n\t\t\t\texpression[\"type\"] = \"Literal\";\n\t\t\t\texpression[\"value\"] = value\n\t\t\t}\n\n\t\t}\n\t\texpression[\"loc\"] = make_location(church_leaf);\n\t\treturn expression;\n\t}\n\n\tfunction make_expression_list(church_trees) {\n\t\tvar body = []\n\t\tfor (var i = 0; i < church_trees.length; i++) {\n\t\t\tbody.push(make_expression(church_trees[i]));\n\t\t}\n\t\treturn body;\n\t}\n\n\tfunction make_expression_statement(church_tree) {\n\t\tif (!util.is_leaf(church_tree) && church_tree.children.length > 1 && church_tree.children[0].text == \"define\") {\n\t\t\treturn make_declaration(church_tree);\n\t\t} else {\n\t\t\tvar expr_statement = deep_copy(expression_statement_node);\n\t\t\texpr_statement[\"expression\"] = make_expression(church_tree);\n\t\t\treturn expr_statement;\n\t\t}\n\t}\n\n\tfunction make_expression_statement_list(church_trees) {\n\t\tvar body = []\n\t\tfor (var i = 0; i < church_trees.length; i++) {\n\t\t\tbody.push(make_expression_statement(church_trees[i]));\n\t\t}\n\t\treturn body;\n\t}\n\n\n\tvar ast = deep_copy(program_node);\n\tvar body = make_expression_statement_list(church_tree.children);\n\n \n\tast[\"body\"] = body;\n\tast = estraverse.replace(ast, renameIdentifiers)\n\treturn ast;\n}", "function visit(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n visit_(null, node, visitor_, Object.freeze([]));\n}", "function print(ast) {\n return visit(ast, {\n leave: printDocASTReducer\n });\n } // TODO: provide better type coverage in future", "function NodeDef() {}", "function NodeDef() {}", "function NodeDef() {}", "function ex3_update_node(node_name, field_name, value) {\n get_node(node_name)[field_name] = value;\n // Update everything\n update_all();\n}" ]
[ "0.67154425", "0.611703", "0.5962941", "0.5861715", "0.5789381", "0.5730407", "0.56855476", "0.56544405", "0.5600378", "0.5600378", "0.55380404", "0.55380404", "0.5503671", "0.545443", "0.545443", "0.5417217", "0.53931147", "0.53647095", "0.53430986", "0.5317483", "0.53174305", "0.53056896", "0.52984494", "0.52692485", "0.52328247", "0.51883787", "0.5175183", "0.51657325", "0.5146435", "0.51374096", "0.5077782", "0.5076632", "0.50687915", "0.5016607", "0.5015141", "0.49577087", "0.4931137", "0.49191037", "0.49072713", "0.48928437", "0.4890082", "0.48847556", "0.48627272", "0.48585892", "0.48584387", "0.48427778", "0.48408258", "0.48373884", "0.48373884", "0.48351038", "0.48119625", "0.4806704", "0.4798603", "0.47651693", "0.47593176", "0.47575673", "0.47452405", "0.47452405", "0.4738063", "0.47286883", "0.47286883", "0.47268662", "0.4717427", "0.47159714", "0.47104168", "0.4710235", "0.4706624", "0.47019476", "0.46906582", "0.46895522", "0.4676225", "0.46745118", "0.46617967", "0.46572885", "0.46536902", "0.4652435", "0.46507257", "0.46504307", "0.4643541", "0.46401605", "0.4639974", "0.46288177", "0.46237236", "0.4618569", "0.46164766", "0.45990255", "0.45914027", "0.45914027", "0.45913252", "0.45861796", "0.45838076", "0.45838076", "0.45838076", "0.45749825", "0.45694214", "0.45644626", "0.45473835", "0.45473835", "0.45473835", "0.4546572" ]
0.49954167
35
Returns the source of an identifier
function source(node) { return exploded.slice(node.range[0], node.range[1]).join("") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resolveId ( source, importer ) {\n return source;\n }", "get sourceId() {\n\t\treturn this.__sourceId;\n\t}", "getIdentifier () {\n return (this._identifier);\n }", "getSourceId(source) {\n let sourceId = this.sourceIds.get(source);\n if (sourceId === undefined) {\n sourceId = `${this.sourceIds.size}`;\n this.sourceIds.set(source, sourceId);\n }\n return sourceId;\n }", "get source() {\n return this.getStringAttribute('source');\n }", "getSource() {\n const child = this.oneChild();\n if (child) {\n return child.getSource();\n }\n return this._source;\n }", "source() {\n return internal(this).source;\n }", "function source( id ){\n return document.getElementById( id ).innerHTML ;\n}", "function getSource()/*:Object*/ {\n return this._source$aqE4;\n }", "function getSource(v, record) {\n if (record.geonet_info && record.geonet_info.source) {\n return record.geonet_info.source[0].value;\n } else {\n return '';\n }\n }", "get sourceDbSnapshotIdentifier() {\n return this.getStringAttribute('source_db_snapshot_identifier');\n }", "get source() {\n\t\treturn this._source;\n\t}", "id(_firstChar, _restChars) {\n if(!memory.has(this.sourceString)) {\n throw new Error (`${this.sourceString} has not been defined`);\n }\n return memory.get(this.sourceString);\n }", "function getCurrentSource() {\r\n return getSource(localStorage.getObject('selectedSource'));\r\n}", "get identifier() { return this._identifier; }", "function getSource() {\n\t var node = this.node;\n\t if (node.end) {\n\t return this.hub.file.code.slice(node.start, node.end);\n\t } else {\n\t return \"\";\n\t }\n\t}", "function getSource() {\n\t var node = this.node;\n\t if (node.end) {\n\t return this.hub.file.code.slice(node.start, node.end);\n\t } else {\n\t return \"\";\n\t }\n\t}", "function getSource() {\n\t var node = this.node;\n\t if (node.end) {\n\t return this.hub.file.code.slice(node.start, node.end);\n\t } else {\n\t return \"\";\n\t }\n\t}", "function getSource() {\n\t var node = this.node;\n\t if (node.end) {\n\t return this.hub.file.code.slice(node.start, node.end);\n\t } else {\n\t return \"\";\n\t }\n\t}", "function getSource() {\n\t var node = this.node;\n\t if (node.end) {\n\t return this.hub.file.code.slice(node.start, node.end);\n\t } else {\n\t return \"\";\n\t }\n\t}", "get source () {\n\t\treturn this._source;\n\t}", "get source () {\n\t\treturn this._source;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "function getName(identifier){\n return identifier.name\n}", "function getName(identifier){\n return identifier.name\n}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get source() {\n\t\treturn this.__source;\n\t}", "get source() {\n\t\treturn this.__source;\n\t}", "get source() {\n\t\treturn this.__source;\n\t}", "function findSourceEntryFromEvent_(event) {\n if (!('params' in event) || !('source_dependency' in event.params)) {\n return undefined;\n } else {\n var id = event.params.source_dependency.id;\n return SourceTracker.getInstance().getSourceEntry(id);\n }\n }", "function getSource() {\n var node = this.node;\n if (node.end) {\n return this.hub.file.code.slice(node.start, node.end);\n } else {\n return \"\";\n }\n}", "getSourceOwner() {\n return this.source_owner;\n }", "function getSourceByID(id) {\n var deferred = new $.Deferred();\n\n $.ajax(MAINdotlua + '?get='+ id)\n .fail(deferred.reject)\n .done(deferred.resolve);\n\n return deferred;\n }", "function _getSource() {\n var application = 'axe', version = '', src;\n if (typeof axe !== 'undefined' && axe._audit && !axe._audit.application) {\n application = axe._audit.application;\n }\n if (typeof axe !== 'undefined') {\n version = axe.version;\n }\n src = application + '.' + version;\n return src;\n }", "get identifier() {\n return this._researchSubject.researchStudy.identifier.value || \"\";\n }", "function returnID(value,source) {\n\n var result;\n if (source) {\n for (var i = 0; i < source.length; i++) {\n if (value === source[i].value) {\n result = source[i].id;\n }\n }\n }\n return result;\n}", "function getSource(id) {\n return query(\n `SELECT id, name, environment, encoding, created_at, updated_at\n FROM source\n WHERE id = $id\n AND deleted_at IS NULL;`,\n {\n $id: id\n }\n ).then(resultSet => (resultSet.length > 0 ? resultSet[0] : null));\n}", "function source(re) {\n return (re && re.source) || re;\n }", "function stringToSourceActorId(s) {\n return s;\n}", "function getFunctionSource_(source) {\n var r = new RegExp(\"^\\\\(\" + commentStart + \"(\" + varName + \")\\\\([^\\\\)]*\\\\)=\" + commentEnd);\n r.lastIndex = 0;\n var x = r.exec(source);\n if(x && source.length > x[0].length && source[x[0].length] == \"(\") {\n var endInclusive = getEndOffsetInclusiveFormula_(source, x[0].length);\n return source.substring(x[0].length, endInclusive + 1);\n }\n return undefined;\n}", "function source(re) {\n return (re && re.source) || re\n }", "function getSource(options) {\n return String(options.model.data.get(options.mimeType));\n }", "getIdentifier() { return this.docIdentifier; }", "scriptSource(func) {\n return %FunctionGetScriptSource(func);\n }", "resolveId ( source ) {\n //console.log(source)\n if (source.indexOf('/rollup/rollup') > -1) {\n //console.log('Got Rollup resolve')\n //return source; // this signals that rollup should not ask other plugins or check the file system to find this id\n\t\t }\n/*\n\t\t if ([\n'../Bundle',\n'../Graph',\n'../utils/ensureArray',\n//'../utils/error',\n'../utils/fs',\n'../utils/options/normalizeInputOptions',\n'../utils/options/normalizeOutputOptions',\n'../utils/options/options',\n'../utils/path',\n'../utils/PluginDriver',\n'../utils/pluginUtils',\n'../utils/sourceMappingURL',\n'../utils/timers',].includes(source)) {\n\tconsole.log('Got resolve:' )\n\treturn '/home/frank/Projekte/rollup/src/lib-entry.ts'\n}\n*/\n\n return null; // other ids should be handled as usually\n }", "get name () { return Metadata.getClassMetaValue(Object.getPrototypeOf(this), 'source', 'name'); }", "function getFilename(source, rawSourceURL = getRawSourceURL(source.url)) {\n const {\n id\n } = source;\n\n if (!rawSourceURL) {\n return getFormattedSourceId(id);\n }\n\n const {\n filename\n } = (0, _sourcesTree.getURL)(source);\n return getRawSourceURL(filename);\n}", "function extractPrimarySource(sourceMap) {\n if (!sourceMap) {\n //HACK?\n return 0; //in this case (e.g. a Vyper contract with an old-style\n //source map) we infer that it was compiled by itself\n }\n return parseInt(sourceMap.match(/^[^:]*:[^:]*:([^:]*):/)[1] || \"0\");\n}", "function getAirOpSourceById(sourceId, isAirbase) {\n var op = editingOpIdx == -1 ? newOp : airOps[editingOpIdx];\n \n for (var i = 0; i < op.AirOpSources.length; i++) {\n if (op.AirOpSources[i].SourceId == sourceId) {\n if (op.AirOpSources[i].SourceType == \"BAS\" && isAirbase) return op.AirOpSources[i];\n if (op.AirOpSources[i].SourceType != \"BAS\" && !isAirbase) return op.AirOpSources[i];\n }\n }\n return null;\n}", "get identifier() {\n if (this._uid) {\n return this._uid;\n } else {\n return this._id;\n }\n }", "resolveId ( source ) {\n if (source === 'virtual-module') {\n return source; // this signals that rollup should not ask other plugins or check the file system to find this id\n }\n return null; // other ids should be handled as usually\n }", "function getSourceNode(nodeModel) {\n var source;\n if (nodeModel.get('type') === 'source') {\n source = nodeModel;\n } else {\n var primarySource = nodeModel.getPrimarySource && nodeModel.getPrimarySource();\n if (primarySource && primarySource.get('type') === 'source') {\n source = primarySource;\n } else {\n source = getSourceNode(primarySource);\n }\n }\n\n return source;\n}", "IdentifierAsName(identCst, _as, optName) {\n const sourceMap = this.args.sourceMap;\n const idContext = this.args.idContext;\n const name = identCst.sourceString;\n let asName;\n if (optName.numChildren > 0) {\n asName = optName.child(0).sourceString;\n } else {\n asName = null;\n }\n return new Alias(this.sourceLoc(sourceMap), _as.id(idContext), name, asName);\n }", "function getDatabaseCompoundURL(source, id) {\n const _source = source && source.toLowerCase();\n if (databaseBaseURLs[_source]) {\n return databaseBaseURLs[_source].replace(\"{{id}}\", id);\n } else {\n return \"\";\n }\n}", "function getIdentifier(gxObject) {\n let id = null;\n if (gxObject.identifiers) {\n id = getFirst(gxObject.identifiers[\"http://gedcomx.org/Persistent\"]);\n if (id === null) {\n id = getFirst(gxObject.identifiers[\"http://gedcomx.org/Primary\"]);\n if (id === null) {\n for (let idType in gxObject.identifiers) {\n if (gxObject.identifiers.hasOwnProperty(idType)) {\n id = getFirst(gxObject.identifiers[idType]);\n if (id !== null) {\n return id;\n }\n }\n }\n }\n }\n }\n return id;\n}", "function getID(idWithName)\n{\n //returns the id from the name on the search bar\n return idWithName.split(\".\")[0];\n}", "get sourcePatientInfo () {\n\t\treturn this._sourcePatientInfo;\n\t}", "function getEntityIDFromWhereFragment(wherePredicate) {\n if (!wherePredicate || wherePredicate.preds) return undefined;\n // validation occurs inside of the toODataFragment call here.\n if (wherePredicate.expr1Source.toUpperCase() === 'ID') {\n return wherePredicate.expr2Source\n } else {\n return undefined;\n }\n }", "function getIdentifier(info) {\n return getIdentifierRecursive(info.path);\n}", "function resolveSourceElement(context, internalContext) {\n let elemId = resolveSourceElementId(context, internalContext);\n return mona_dish_2.DQ.byId(elemId.value, true);\n}", "function getSource(name) {\r\n var sources = localStorage.getObject('sources');\r\n var selected_name = name.split('::');\r\n var category = selected_name[0], source_name = selected_name[1];\r\n\r\n for (var i in sources) {\r\n if (i == category) {\r\n for (var j in sources[i]) {\r\n if (j == source_name) {\r\n sources[i][j].category = i;\r\n sources[i][j].name = j;\r\n return sources[i][j];\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n}", "sourcePropertyName (propertyName) {\n return propertyName;\n }", "_getUniqueIdentifier(sourceFile, baseName) {\n if (this.isUniqueIdentifierName(sourceFile, baseName)) {\n this._recordUsedIdentifier(sourceFile, baseName);\n return ts.createIdentifier(baseName);\n }\n let name = null;\n let counter = 1;\n do {\n name = `${baseName}_${counter++}`;\n } while (!this.isUniqueIdentifierName(sourceFile, name));\n this._recordUsedIdentifier(sourceFile, name);\n return ts.createIdentifier(name);\n }", "function Hh(t){if(t instanceof no[\"default\"])return t.id;if(t instanceof wr)return t.get(\"id\");throw new Error(\"Illegal source argument\")}", "function getSourceLine(lineNo) {\n\t\tif ((lineNo >= 1) && (lineNo <= sourceList.length)) {\n\t\t\treturn sourceList[lineNo - 1];\n\t\t}\n\t\telse {\n\t\t\treturn null;\n\t\t}\n\t}", "function $getEventSource(e) {\r\n\t\treturn e.srcElement || e.target;\r\n\t}", "function identifer() {\n\t var result = (0, _parser.repeat1)((0, _parser.choice)((0, _parser.range)('a', 'z'), (0, _parser.range)('A', 'Z'), (0, _parser.ch)('_'), (0, _parser.ch)('$')));\n\t return (0, _parser.action)(result, function (ast) {\n\t return {\n\t type: 'identifer',\n\t value: ast.join('')\n\t };\n\t });\n\t}", "getId() {\n return this.user ? this.user[this.config.identifierKey] : null;\n }", "function getToolSymbolAt(x, y)\r\n{\r\n let toolAtCell = document.getElementById(\"a\" + y + x);\r\n let toolSymbolFor = toolAtCell.getAttribute(\"src\");\r\n return toolSymbolFor;\r\n}", "function getIdentifierVariableName(path) {\n if (path.isIdentifier() && path.parentPath.isCallExpression() && path.parentPath.parentPath.isVariableDeclarator()) {\n const variableName = path.parentPath.parentPath.node.id.name;\n return variableName;\n }\n\n return '';\n}", "getValue(source) {\n Observable.track(source, this.name);\n return source[this.fieldName];\n }", "function xmpGetSource () {\n//console.log(\"xmpGetSource filePath\",filePath);\n execute (\"xmpget source \" + filePath).then (result => {\n notesDia (namepic, filePath, \"Anteckningar till \", result, \"Spara\", \"Spara och stäng\", \"Stäng\");\n hideKeyboard ();\n });\n }", "function sourceFromStacktrace() {\n\ttry {\n\t\tthrow new Error();\n\t} catch ( e ) {\n\t\tif (e.stacktrace) {\n\t\t\t// Opera\n\t\t\treturn e.stacktrace.split(\"\\n\")[6];\n\t\t} else if (e.stack) {\n\t\t\t// Firefox, Chrome\n\t\t\treturn e.stack.split(\"\\n\")[4];\n\t\t}\n\t}\n}", "function sourceFromStacktrace() {\n\ttry {\n\t\tthrow new Error();\n\t} catch ( e ) {\n\t\tif (e.stacktrace) {\n\t\t\t// Opera\n\t\t\treturn e.stacktrace.split(\"\\n\")[6];\n\t\t} else if (e.stack) {\n\t\t\t// Firefox, Chrome\n\t\t\treturn e.stack.split(\"\\n\")[4];\n\t\t}\n\t}\n}", "getSourceFromEditor() {\n return this.getProgramFromEditor()\n }" ]
[ "0.697314", "0.6805347", "0.66996", "0.64324826", "0.63143957", "0.6301391", "0.6252789", "0.6216562", "0.614984", "0.6107986", "0.6096205", "0.5918836", "0.5869289", "0.5854014", "0.5845814", "0.5838256", "0.5838256", "0.5838256", "0.5838256", "0.5838256", "0.58195627", "0.58195627", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.58189577", "0.5771089", "0.5771089", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5735828", "0.5735828", "0.5735828", "0.57346886", "0.57187206", "0.56897646", "0.568787", "0.5683503", "0.5676096", "0.5641213", "0.56254095", "0.56233424", "0.55843186", "0.5583055", "0.55353075", "0.55198145", "0.54845595", "0.54770404", "0.54592603", "0.5455891", "0.5441509", "0.54414237", "0.5440662", "0.54389673", "0.5427105", "0.5408519", "0.5403637", "0.5377636", "0.5346416", "0.53309226", "0.5330137", "0.53271246", "0.5299552", "0.5290788", "0.52896166", "0.5286249", "0.5275942", "0.523831", "0.5228296", "0.5210344", "0.52063054", "0.51965266", "0.51864564", "0.5185051", "0.5178062", "0.51620704", "0.5155616", "0.5155616", "0.51361835" ]
0.0
-1
Ensure the condition is true, otherwise throw an error. This is only to have a better contract semantic, i.e. another safety net to catch a logic error. The condition shall be fulfilled in normal case. Do NOT use this to enforce a certain condition on any user input.
function assert(condition, message) { /* istanbul ignore if */ if (!condition) { throw new Error('ASSERT: ' + message); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check(condition, message) {\n if (condition === false) {\n throw new Error(message);\n }\n }", "function check(condition, message) {\n if (!condition) {\n throw Error(message)\n }\n}", "function invariant(condition, message) {\n var booleanCondition = Boolean(condition);\n /* istanbul ignore else */\n\n if (!booleanCondition) {\n throw new Error(message);\n }\n}", "function invariant(condition) {\n if (!condition) {\n throw new Error('Invariant Violation');\n }\n}", "function invariant$3(condition, message) {\n /* istanbul ignore else */\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n /* istanbul ignore else */\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n /* istanbul ignore else */\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n /* istanbul ignore else */\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n /* istanbul ignore else */\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n /* istanbul ignore else */\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n /* istanbul ignore else */\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n /* istanbul ignore else */\n if (!condition) {\n throw new Error(message);\n }\n}", "function invariant(condition, message) {\n /* istanbul ignore else */\n if (!condition) {\n throw new Error(message);\n }\n}", "function requires(condition) {\n var message = arguments[1] === undefined ? \"A precondition has been violated.\" : arguments[1];\n\n if (!condition) {\n throw new Error(message);\n }\n }", "function invariant(condition, message) {\n\t /* istanbul ignore else */\n\t if (!condition) {\n\t throw new Error(message);\n\t }\n\t}", "function ensureState(condition, error)\n{\n if (!condition) {\n let err = new Error(error);\n console.log(`${error}: ` + err.stack);\n throw err;\n }\n}", "function invariant(condition, message) {\n\t if (!condition) {\n\t throw new Error(message);\n\t }\n\t}", "function assert(condition, message)\n{\n if (!condition)\n throw new Error(message);\n}", "function assert(condition, msg) {\n if (!condition) {\n throw new Error(msg);\n }\n}", "function assert(condition,message){ /* istanbul ignore if */if(!condition){throw new Error('ASSERT: ' + message);}}", "function assert (message, condition) {\n if (!condition) throw message;\n}", "function assert(condition, optionalMessage) {\n if (! condition) {\n throw new Error(optionalMessage || \"assertion failure\");\n }\n}", "function assert(condition, message = 'assertion failed') {\n if (!condition) {\n throw new Error(message);\n }\n}", "function assert(condition, message) {\n /* istanbul ignore if */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n /* istanbul ignore next */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n /* istanbul ignore next */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message)\n\t\t{\n\t\t\t/* istanbul ignore if */\n\t\t\tif (!condition)\n\t\t\t{\n\t\t\t\tthrow new Error('ASSERT: ' + message);\n\t\t\t}\n\t\t}", "function assert(condition, message) {\n /* istanbul ignore if */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, optionalMessage) {\n if (!condition) {\n throw new Error(optionalMessage || \"assertion failure\");\n }\n}", "function assert(condition, optionalMessage) {\n if (!condition) {\n throw new Error(optionalMessage || \"assertion failure\");\n }\n}", "assert(condition) {\n if (!condition) {\n throw \"Assert failed!\"\n }\n }", "function assert(condition, message) {\n /* istanbul ignore if */\n if (!condition) {\n throw new Error(\"ASSERT: \" + message);\n }\n}", "function assert(condition, optionalMessage) {\n if (!condition) {\n throw new Error(optionalMessage || \"assertion failure\");\n }\n}", "function assert(cond) {\n if (!cond) {\n throw new Error(\"assertion error\");\n }\n}", "function assert (condition, message) {\n if (!condition) {\n console.error(message)\n }\n}", "function assert(condition, optionalMessage) {\r\n if (!condition) {\r\n throw new Error(optionalMessage || \"assertion failure\");\r\n }\r\n}", "function assert(condition, optionalMessage) {\r\n if (!condition) {\r\n throw new Error(optionalMessage || \"assertion failure\");\r\n }\r\n}", "function assert(condition, optionalMessage) {\r\n if (!condition) {\r\n throw new Error(optionalMessage || \"assertion failure\");\r\n }\r\n}", "function assert(condition, optionalMessage) {\r\n if (!condition) {\r\n throw new Error(optionalMessage || \"assertion failure\");\r\n }\r\n}", "function assert(condition, optionalMessage) {\r\n if (!condition) {\r\n throw new Error(optionalMessage || \"assertion failure\");\r\n }\r\n}", "function assert(condition, optionalMessage) {\r\n if (!condition) {\r\n throw new Error(optionalMessage || \"assertion failure\");\r\n }\r\n}", "function assert(condition, message) {\n /* istanbul ignore next */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n}", "function assert(condition, message) {\n /* istanbul ignore next */\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n}", "function assert(condition, message) {\n\t if (!condition) {\n\t throw new Error('ASSERT: ' + message);\n\t }\n\t }", "function assert(condition, message) {\n\t /* istanbul ignore if */\n\t if (!condition) {\n\t throw new Error('ASSERT: ' + message);\n\t }\n\t }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }", "function assert(cond) {\n if (!cond) throw new Error('Assertion error');\n }", "function assert (condition, message) { // Message may be undefined\r\n if (!condition) {\r\n throw AssertionError (message, new Error ());\r\n }\r\n }", "function invariant(condition, message) {\n if (condition) {\n return;\n } // Condition not passed\n // In production we strip the message but still throw\n\n\n if (isProduction) {\n throw new Error(prefix);\n } // When not in production we allow the message to pass through\n // *This block will be removed in production builds*\n\n\n throw new Error(prefix + \": \" + (message || ''));\n}", "function invariant(condition, message) {\n if (condition) {\n return;\n } // Condition not passed\n // In production we strip the message but still throw\n\n\n if (isProduction) {\n throw new Error(prefix);\n } // When not in production we allow the message to pass through\n // *This block will be removed in production builds*\n\n\n throw new Error(prefix + \": \" + (message || ''));\n}", "function assert(condition, message) {\r\n if (!condition) {\r\n throw new Error('Assertion failed' + (message ? ': ' + message : ''));\r\n }\r\n}", "function assert(condition, message) {\n\t'use strict';\n\tif (!condition) {\n message = message || \"Assertion failed\";\n if (typeof Error !== \"undefined\") {\n\t\tthrow new Error(message);\n }\n throw message;\n\t}\n }", "function assert(condition, errorText)\n{\n if (!condition)\n {\n error(errorText);\n }\n}", "function assert (condition, ...vargs) {\n if (! condition) {\n throw new Interrupt.Error(Interrupt.Error.options.apply(Interrupt.Error, [{ $callee: assert }].concat(vargs)))\n }\n}", "function assert(condition, message) {\n if (!condition) {\n message = message || \"Assertion failed\";\n if (typeof Error !== \"undefined\") {\n throw new Error(message);\n }\n throw message; // Fallback\n }\n}", "function assert(condition = true, message = \"Unknown Assert\") {\n\tif (typeof(condition) != \"boolean\") {\n\t\tthrow \"Can use assert only with boolean values\";\n\t}\n\n\tif (!condition) {\n\t\tthrow message;\n\t}\n}", "function invariant(condition, format) {\n for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n\n validateFormat(format);\n\n if (!condition) {\n var error;\n\n if (format === undefined) {\n error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var argIndex = 0;\n error = new Error(format.replace(/%s/g, function () {\n return String(args[argIndex++]);\n }));\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // Skip invariant's own stack frame.\n\n throw error;\n }\n}", "function invariant(condition, format) {\n for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n\n validateFormat(format);\n\n if (!condition) {\n var error;\n\n if (format === undefined) {\n error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var argIndex = 0;\n error = new Error(format.replace(/%s/g, function () {\n return String(args[argIndex++]);\n }));\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // Skip invariant's own stack frame.\n\n throw error;\n }\n}", "function internalAssert(condition, message) {\n if (!condition) {\n throw new AssertionError({\n message,\n actual: false,\n expected: true,\n operator: '=='\n });\n }\n}", "function checkCondition(condition, message) {\n if (condition) {\n return true;\n } else {\n alert(message);\n return false;\n }\n}", "function invariant(condition, format, a, b, c, d, e, f) {\r\n\t if (process.env.NODE_ENV !== 'production') {\r\n\t if (format === undefined) {\r\n\t throw new Error('invariant requires an error message argument');\r\n\t }\r\n\t }\r\n\t\r\n\t if (!condition) {\r\n\t var error;\r\n\t if (format === undefined) {\r\n\t error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\r\n\t } else {\r\n\t var args = [a, b, c, d, e, f];\r\n\t var argIndex = 0;\r\n\t error = new Error(format.replace(/%s/g, function () {\r\n\t return args[argIndex++];\r\n\t }));\r\n\t error.name = 'Invariant Violation';\r\n\t }\r\n\t\r\n\t error.framesToPop = 1; // we don't care about invariant's own frame\r\n\t throw error;\r\n\t }\r\n\t}", "function assert (condition, message) {\r\n if (!condition) {\r\n throw new Error((\"[vue-router] \" + message))\r\n }\r\n}", "function invariant(condition, format, a, b, c, d, e, f) {\n\t\t if (false) {\n\t\t if (format === undefined) {\n\t\t throw new Error('invariant requires an error message argument');\n\t\t }\n\t\t }\n\n\t\t if (!condition) {\n\t\t var error;\n\t\t if (format === undefined) {\n\t\t error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n\t\t } else {\n\t\t var args = [a, b, c, d, e, f];\n\t\t var argIndex = 0;\n\t\t error = new Error(format.replace(/%s/g, function () {\n\t\t return args[argIndex++];\n\t\t }));\n\t\t error.name = 'Invariant Violation';\n\t\t }\n\n\t\t error.framesToPop = 1; // we don't care about invariant's own frame\n\t\t throw error;\n\t\t }\n\t\t}", "function invariant(condition, format, a, b, c, d, e, f) {\n\t\t if (false) {\n\t\t if (format === undefined) {\n\t\t throw new Error('invariant requires an error message argument');\n\t\t }\n\t\t }\n\n\t\t if (!condition) {\n\t\t var error;\n\t\t if (format === undefined) {\n\t\t error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n\t\t } else {\n\t\t var args = [a, b, c, d, e, f];\n\t\t var argIndex = 0;\n\t\t error = new Error(format.replace(/%s/g, function () {\n\t\t return args[argIndex++];\n\t\t }));\n\t\t error.name = 'Invariant Violation';\n\t\t }\n\n\t\t error.framesToPop = 1; // we don't care about invariant's own frame\n\t\t throw error;\n\t\t }\n\t\t}" ]
[ "0.72930515", "0.7207999", "0.6812781", "0.6765069", "0.66446507", "0.6640108", "0.6640108", "0.6640108", "0.6640108", "0.6640108", "0.6640108", "0.6636474", "0.6636474", "0.6636474", "0.6636474", "0.6636474", "0.6636474", "0.6636474", "0.6636474", "0.6628533", "0.6478385", "0.6469459", "0.64349186", "0.64143336", "0.62813413", "0.6191362", "0.61905104", "0.61013407", "0.60628194", "0.60411805", "0.60381615", "0.60381615", "0.6036927", "0.6036927", "0.6029969", "0.601967", "0.6016347", "0.60158575", "0.60158575", "0.6014989", "0.60019857", "0.6001291", "0.59962755", "0.59832996", "0.59826124", "0.59826124", "0.59826124", "0.59826124", "0.59826124", "0.59826124", "0.597753", "0.597753", "0.5949295", "0.593299", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5925095", "0.5894682", "0.58116794", "0.5803018", "0.5803018", "0.5772851", "0.5747067", "0.57045", "0.56878126", "0.56760645", "0.5642082", "0.5574049", "0.5574049", "0.55650866", "0.55463225", "0.55380845", "0.5537791", "0.55315894", "0.55315894" ]
0.60113925
48
7.6 Identifier Names and Identifiers
function isIdentifierStart(ch) { return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) (ch >= 0x41 && ch <= 0x5A) || // A..Z (ch >= 0x61 && ch <= 0x7A) || // a..z (ch === 0x5C) || // \ (backslash) ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function identifer() {\n\t var result = (0, _parser.repeat1)((0, _parser.choice)((0, _parser.range)('a', 'z'), (0, _parser.range)('A', 'Z'), (0, _parser.ch)('_'), (0, _parser.ch)('$')));\n\t return (0, _parser.action)(result, function (ast) {\n\t return {\n\t type: 'identifer',\n\t value: ast.join('')\n\t };\n\t });\n\t}", "Identifier() {\n const name = this._eat('IDENTIFIER').value;\n return {\n type: 'Identifier',\n name,\n };\n }", "function parseIdentifier() {\n next();\n state.tokens[state.tokens.length - 1].type = TokenType.name;\n}", "function getName(identifier){\n return identifier.name\n}", "function getName(identifier){\n return identifier.name\n}", "function parseIdent(liberal) {\n var node = startNode();\n node.name = tokType === _name ? tokVal : (liberal && !options.forbidReserved && tokType.keyword) ||\n unexpected();\n tokRegexpAllowed = false;\n next();\n return finishNode(node, \"Identifier\");\n }", "IsValidIdentifier() {\n\n }", "function Identifier(name, parent_type) {\n this.name = name;\n this.parent_type = parent_type;\n this.prop_name = undefined;\n this.prop_index = undefined;\n}", "function strtoid(name) {\n return new js.Identifier(name);\n}", "function read_ident() {\n // Get number of characters in identifier\n var id = read_while(is_id);\n // Determine the identifier type and return a token of that type\n return {\n type : is_keyword(id) ? \"kw\" : \"var\",\n value : id,\n };\n }", "function Identifier(node) {\n this.push(node.name);\n}", "function createInternalIdentifier({name, surname}) {\n return `ID-INT:${name}-${surname}`;\n}", "function Identifier(node) {\n\t this.push(node.name);\n\t}", "function Identifier(node) {\n\t this.push(node.name);\n\t}", "function GeneralIdentifier() {\n OptionalVector();\n Params();\n return;\n }", "function toIdentifier(name) {\n\t if (t.isIdentifier(name)) return name.name;\n\n\t name = name + \"\";\n\n\t // replace all non-valid identifiers with dashes\n\t name = name.replace(/[^a-zA-Z0-9$_]/g, \"-\");\n\n\t // remove all dashes and numbers from start of name\n\t name = name.replace(/^[-0-9]+/, \"\");\n\n\t // camel case\n\t name = name.replace(/[-\\s]+(.)?/g, function (match, c) {\n\t return c ? c.toUpperCase() : \"\";\n\t });\n\n\t if (!t.isValidIdentifier(name)) {\n\t name = \"_\" + name;\n\t }\n\n\t return name || \"_\";\n\t}", "function toIdentifier(name) {\n\t if (t.isIdentifier(name)) return name.name;\n\n\t name = name + \"\";\n\n\t // replace all non-valid identifiers with dashes\n\t name = name.replace(/[^a-zA-Z0-9$_]/g, \"-\");\n\n\t // remove all dashes and numbers from start of name\n\t name = name.replace(/^[-0-9]+/, \"\");\n\n\t // camel case\n\t name = name.replace(/[-\\s]+(.)?/g, function (match, c) {\n\t return c ? c.toUpperCase() : \"\";\n\t });\n\n\t if (!t.isValidIdentifier(name)) {\n\t name = \"_\" + name;\n\t }\n\n\t return name || \"_\";\n\t}", "function isIdentifier(name) {\n if (name.length === 0) {\n return false;\n }\n if (!IS_IDENTIFIER_START[name.charCodeAt(0)]) {\n return false;\n }\n for (let i = 1; i < name.length; i++) {\n if (!IS_IDENTIFIER_CHAR[name.charCodeAt(i)]) {\n return false;\n }\n }\n return !RESERVED_WORDS.has(name);\n}", "function toIdentifier(name) {\n if (t.isIdentifier(name)) return name.name;\n\n name = name + \"\";\n\n // replace all non-valid identifiers with dashes\n name = name.replace(/[^a-zA-Z0-9$_]/g, \"-\");\n\n // remove all dashes and numbers from start of name\n name = name.replace(/^[-0-9]+/, \"\");\n\n // camel case\n name = name.replace(/[-\\s]+(.)?/g, function (match, c) {\n return c ? c.toUpperCase() : \"\";\n });\n\n if (!t.isValidIdentifier(name)) {\n name = \"_\" + name;\n }\n\n return name || \"_\";\n}", "function a (name)\n{\n return (typeof name == \"string\") ? memory.identifiers[name] : name;\n}", "isIdentifier() {\n // The Parser.TOKENS regexp ensures that we only have to check\n // the first character of a token to know what kind of token it is.\n var c = this.tokens[this.tokenIndex][0];\n return c >= \"a\" && c <= \"z\" || c >= \"A\" && c <= \"Z\";\n }", "isIdentifier() {\n // The Parser.TOKENS regexp ensures that we only have to check\n // the first character of a token to know what kind of token it is.\n const c = this.tokens[this.tokenIndex][0];\n return (c >= \"a\" && c <= \"z\") || (c >= \"A\" && c <= \"Z\");\n }", "parseIdentifierName() {\n let name = '';\n while (true) {\n const c = this.peek();\n if (isIdentifierStart(c) || isIdentifierContinue(c) || c === '$') {\n name += this.next();\n } else {\n break;\n }\n }\n return name;\n }", "function invalid identifier () {}", "function toIdentifier(str){return str.split(' ').map(function(token){return token.slice(0,1).toUpperCase()+token.slice(1);}).join('').replace(/[^ _0-9a-z]/gi,'');}", "['@_name']() {\n super['@_name']();\n if (this._value.name) return;\n\n this._value.name = this._node.declarations[0].id.name;\n }", "function toIdentifier(name){\n\tvar parts = name.split(/\\W+/)\n\tparts = _.map(parts, function(part){\n\t\treturn part.replace(/^./, function(chr){ return chr.toUpperCase() })\n\t})\n\t\n\treturn parts.join('')\n}", "function Const(){ return Identifier.apply(this,arguments) }", "tryIdentifier(...additionalTokenKinds) {\n const identifier = this.tryConsume(DiagnosticMessages_1.DiagnosticMessages.expectedIdentifier(), TokenKind_1.TokenKind.Identifier, ...additionalTokenKinds);\n if (identifier) {\n // force the name into an identifier so the AST makes some sense\n identifier.kind = TokenKind_1.TokenKind.Identifier;\n return identifier;\n }\n }", "function JSXIdentifier(node) {\n\t this.push(node.name);\n\t}", "function JSXIdentifier(node) {\n\t this.push(node.name);\n\t}", "GetIDsOfNames() {\n\n }", "GetIDsOfNames() {\n\n }", "function JSXIdentifier(node) {\n this.push(node.name);\n}", "function isIdentifierPart(ch) {\n\t // Generated by `tools/generate-identifier-regex.js`.\n\t var NonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]');\n\n\t return ch === 36 || ch === 95 || // $ (dollar) and _ (underscore)\n\t ch >= 65 && ch <= 90 || // A..Z\n\t ch >= 97 && ch <= 122 || // a..z\n\t ch >= 48 && ch <= 57 || // 0..9\n\t ch === 92 || // \\ (backslash)\n\t ch >= 0x80 && NonAsciiIdentifierPart.test(String.fromCharCode(ch));\n\t }", "function isIdentifierPart(ch) {\n\t // Generated by `tools/generate-identifier-regex.js`.\n\t var NonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]');\n\n\t return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)\n\t (ch >= 65 && ch <= 90) || // A..Z\n\t (ch >= 97 && ch <= 122) || // a..z\n\t (ch >= 48 && ch <= 57) || // 0..9\n\t (ch === 92) || // \\ (backslash)\n\t ((ch >= 0x80) && NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n\t }", "function isIdentifierPart(ch) {\n\t // Generated by `tools/generate-identifier-regex.js`.\n\t var NonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]');\n\n\t return ch === 36 || ch === 95 || // $ (dollar) and _ (underscore)\n\t ch >= 65 && ch <= 90 || // A..Z\n\t ch >= 97 && ch <= 122 || // a..z\n\t ch >= 48 && ch <= 57 || // 0..9\n\t ch === 92 || // \\ (backslash)\n\t ch >= 0x80 && NonAsciiIdentifierPart.test(String.fromCharCode(ch));\n\t }", "function isIdentifierPart(ch) {\n\t // Generated by `tools/generate-identifier-regex.js`.\n\t var NonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]');\n\n\t return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)\n\t (ch >= 65 && ch <= 90) || // A..Z\n\t (ch >= 97 && ch <= 122) || // a..z\n\t (ch >= 48 && ch <= 57) || // 0..9\n\t (ch === 92) || // \\ (backslash)\n\t ((ch >= 0x80) && NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n\t }", "function isIdentifierPart(ch) {\n\t // Generated by `tools/generate-identifier-regex.js`.\n\t var NonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]');\n\n\t return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)\n\t (ch >= 65 && ch <= 90) || // A..Z\n\t (ch >= 97 && ch <= 122) || // a..z\n\t (ch >= 48 && ch <= 57) || // 0..9\n\t (ch === 92) || // \\ (backslash)\n\t ((ch >= 0x80) && NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n\t }", "function isIdentifierPart(ch) {\n\t // Generated by `tools/generate-identifier-regex.js`.\n\t var NonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]');\n\n\t return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)\n\t (ch >= 65 && ch <= 90) || // A..Z\n\t (ch >= 97 && ch <= 122) || // a..z\n\t (ch >= 48 && ch <= 57) || // 0..9\n\t (ch === 92) || // \\ (backslash)\n\t ((ch >= 0x80) && NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n\t }", "function isIdentifierName(node) {\n var parent = node.parent;\n switch (parent.kind) {\n case 145 /* PropertyDeclaration */:\n case 144 /* PropertySignature */:\n case 147 /* MethodDeclaration */:\n case 146 /* MethodSignature */:\n case 149 /* GetAccessor */:\n case 150 /* SetAccessor */:\n case 255 /* EnumMember */:\n case 253 /* PropertyAssignment */:\n case 172 /* PropertyAccessExpression */:\n // Name in member declaration or property name in property access\n return parent.name === node;\n case 139 /* QualifiedName */:\n // Name on right hand side of dot in a type query\n if (parent.right === node) {\n while (parent.kind === 139 /* QualifiedName */) {\n parent = parent.parent;\n }\n return parent.kind === 158 /* TypeQuery */;\n }\n return false;\n case 169 /* BindingElement */:\n case 234 /* ImportSpecifier */:\n // Property name in binding element or import specifier\n return parent.propertyName === node;\n case 238 /* ExportSpecifier */:\n // Any name in an export specifier\n return true;\n }\n return false;\n }", "function isIdentifierPart(ch) {\n // Generated by `tools/generate-identifier-regex.js`.\n var NonAsciiIdentifierPartOnly = /[0-9_\\xB7\\u0300-\\u036F\\u0387\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u0669\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u06F0-\\u06F9\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07C0-\\u07C9\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08D3-\\u08E1\\u08E3-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096F\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09E6-\\u09EF\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A66-\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AE6-\\u0AEF\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B62\\u0B63\\u0B66-\\u0B6F\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C04\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CE6-\\u0CEF\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0D62\\u0D63\\u0D66-\\u0D6F\\u0D82\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0E50-\\u0E59\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102B-\\u103E\\u1040-\\u1049\\u1056-\\u1059\\u105E-\\u1060\\u1062-\\u1064\\u1067-\\u106D\\u1071-\\u1074\\u1082-\\u108D\\u108F-\\u109D\\u135D-\\u135F\\u1369-\\u1371\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u194F\\u19D0-\\u19DA\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AB0-\\u1ABD\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BB0-\\u1BB9\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1C40-\\u1C49\\u1C50-\\u1C59\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF2-\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DF9\\u1DFB-\\u1DFF\\u200C\\u200D\\u203F\\u2040\\u2054\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA620-\\uA629\\uA66F\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8D0-\\uA8D9\\uA8E0-\\uA8F1\\uA8FF-\\uA909\\uA926-\\uA92D\\uA947-\\uA953\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9D0-\\uA9D9\\uA9E5\\uA9F0-\\uA9F9\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA50-\\uAA59\\uAA7B-\\uAA7D\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF10-\\uFF19\\uFF3F]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD801[\\uDCA0-\\uDCA9]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDD30-\\uDD39\\uDF46-\\uDF50]|\\uD804[\\uDC00-\\uDC02\\uDC38-\\uDC46\\uDC66-\\uDC6F\\uDC7F-\\uDC82\\uDCB0-\\uDCBA\\uDCF0-\\uDCF9\\uDD00-\\uDD02\\uDD27-\\uDD34\\uDD36-\\uDD3F\\uDD45\\uDD46\\uDD73\\uDD80-\\uDD82\\uDDB3-\\uDDC0\\uDDC9-\\uDDCC\\uDDD0-\\uDDD9\\uDE2C-\\uDE37\\uDE3E\\uDEDF-\\uDEEA\\uDEF0-\\uDEF9\\uDF00-\\uDF03\\uDF3B\\uDF3C\\uDF3E-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF62\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74]|\\uD805[\\uDC35-\\uDC46\\uDC50-\\uDC59\\uDC5E\\uDCB0-\\uDCC3\\uDCD0-\\uDCD9\\uDDAF-\\uDDB5\\uDDB8-\\uDDC0\\uDDDC\\uDDDD\\uDE30-\\uDE40\\uDE50-\\uDE59\\uDEAB-\\uDEB7\\uDEC0-\\uDEC9\\uDF1D-\\uDF2B\\uDF30-\\uDF39]|\\uD806[\\uDC2C-\\uDC3A\\uDCE0-\\uDCE9\\uDE01-\\uDE0A\\uDE33-\\uDE39\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE5B\\uDE8A-\\uDE99]|\\uD807[\\uDC2F-\\uDC36\\uDC38-\\uDC3F\\uDC50-\\uDC59\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD45\\uDD47\\uDD50-\\uDD59\\uDD8A-\\uDD8E\\uDD90\\uDD91\\uDD93-\\uDD97\\uDDA0-\\uDDA9\\uDEF3-\\uDEF6]|\\uD81A[\\uDE60-\\uDE69\\uDEF0-\\uDEF4\\uDF30-\\uDF36\\uDF50-\\uDF59]|\\uD81B[\\uDF51-\\uDF7E\\uDF8F-\\uDF92]|\\uD82F[\\uDC9D\\uDC9E]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD835[\\uDFCE-\\uDFFF]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A\\uDD50-\\uDD59]|\\uDB40[\\uDD00-\\uDDEF]/;\n\n return isIdentifierStart(ch) ||\n (ch >= 48 && ch <= 57) || // 0..9\n ((ch >= 0x80) && NonAsciiIdentifierPartOnly.test(fromCodePoint(ch)));\n }", "get identifier() { return this._identifier; }", "visitIdentifier(identifier) {\n // For identifiers that aren't listed in the className data, the whole check can be\n // skipped safely.\n if (!this.data.some(data => data.replace === identifier.text)) {\n return;\n }\n // For namespace imports that are referring to Angular Material or the CDK, we store the\n // namespace name in order to be able to safely find identifiers that don't belong to the\n // developer's application.\n if (imports_1.isNamespaceImportNode(identifier) && module_specifiers_1.isMaterialImportDeclaration(identifier)) {\n this.trustedNamespaces.add(identifier.text);\n return this._createFailureWithReplacement(identifier);\n }\n // For export declarations that are referring to Angular Material or the CDK, the identifier\n // can be immediately updated to the new name.\n if (imports_1.isExportSpecifierNode(identifier) && module_specifiers_1.isMaterialExportDeclaration(identifier)) {\n return this._createFailureWithReplacement(identifier);\n }\n // For import declarations that are referring to Angular Material or the CDK, the name of\n // the import identifiers. This allows us to identify identifiers that belong to Material and\n // the CDK, and we won't accidentally touch a developer's identifier.\n if (imports_1.isImportSpecifierNode(identifier) && module_specifiers_1.isMaterialImportDeclaration(identifier)) {\n this.trustedIdentifiers.add(identifier.text);\n return this._createFailureWithReplacement(identifier);\n }\n // In case the identifier is part of a property access expression, we need to verify that the\n // property access originates from a namespace that has been imported from Material or the CDK.\n if (ts.isPropertyAccessExpression(identifier.parent)) {\n const expression = identifier.parent.expression;\n if (ts.isIdentifier(expression) && this.trustedNamespaces.has(expression.text)) {\n return this._createFailureWithReplacement(identifier);\n }\n }\n else if (this.trustedIdentifiers.has(identifier.text)) {\n return this._createFailureWithReplacement(identifier);\n }\n }", "function isIdentifierPart(ch) {\n // Generated by `tools/generate-identifier-regex.js`.\n var NonAsciiIdentifierPartOnly = /[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u0669\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u06F0-\\u06F9\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07C0-\\u07C9\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08E4-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096F\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09E6-\\u09EF\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A66-\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B62\\u0B63\\u0B66-\\u0B6F\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CE6-\\u0CEF\\u0D01-\\u0D03\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0D62\\u0D63\\u0D66-\\u0D6F\\u0D82\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0E50-\\u0E59\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102B-\\u103E\\u1040-\\u1049\\u1056-\\u1059\\u105E-\\u1060\\u1062-\\u1064\\u1067-\\u106D\\u1071-\\u1074\\u1082-\\u108D\\u108F-\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u194F\\u19B0-\\u19C0\\u19C8\\u19C9\\u19D0-\\u19D9\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AB0-\\u1ABD\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BB0-\\u1BB9\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1C40-\\u1C49\\u1C50-\\u1C59\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF2-\\u1CF4\\u1CF8\\u1CF9\\u1DC0-\\u1DF5\\u1DFC-\\u1DFF\\u200C\\u200D\\u203F\\u2040\\u2054\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA620-\\uA629\\uA66F\\uA674-\\uA67D\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA880\\uA881\\uA8B4-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F1\\uA900-\\uA909\\uA926-\\uA92D\\uA947-\\uA953\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9D0-\\uA9D9\\uA9E5\\uA9F0-\\uA9F9\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA50-\\uAA59\\uAA7B-\\uAA7D\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF10-\\uFF19\\uFF3F]/;\n\n return isIdentifierStart(ch) ||\n ((ch >= 0x80) && NonAsciiIdentifierPartOnly.test(String.fromCharCode(ch)));\n }", "function isIdentifier(node) {\n return node.kind === ts.SyntaxKind.Identifier;\n}", "function isIdentifierLike(token) {\n var ttl = token.type.label;\n return ttl == \"name\" || ttl == \"num\" || ttl == \"privateId\" || !!token.type.keyword;\n }", "getIdentifier () {\n return (this._identifier);\n }", "function characterId(name) {\n return name + \"-character\";\n}", "function eid(name) {\n return 'Svgjs' + capitalize(name) + did++;\n} // Deep new id assignment", "enterNameIdentifier(ctx) {\n\t}", "function isIdentifierPart(ch) {\n // Generated by `tools/generate-identifier-regex.js`.\n var NonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]');\n\n return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)\n (ch >= 65 && ch <= 90) || // A..Z\n (ch >= 97 && ch <= 122) || // a..z\n (ch >= 48 && ch <= 57) || // 0..9\n (ch === 92) || // \\ (backslash)\n ((ch >= 0x80) && NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n }", "jsx_parseIdentifier() {\n let node = this.startNode();\n if (this.type === tok.jsxName)\n node.name = this.value;\n else if (this.type.keyword)\n node.name = this.type.keyword;\n else\n this.unexpected();\n this.next();\n return this.finishNode(node, 'JSXIdentifier');\n }", "setIdentifier (value) {\n this._identifier = value;\n }", "function identifierMatcher(name) {\n return function (node) {\n return node && node.type === 'Identifier' && node.name === name;\n };\n }", "function toIdentifier (str) {\n\t return str.split(' ').map(function (token) {\n\t return token.slice(0, 1).toUpperCase() + token.slice(1)\n\t }).join('').replace(/[^ _0-9a-z]/gi, '')\n\t}", "function isValidIdentifier(name) {\n\t if (typeof name !== \"string\" || _esutils2[\"default\"].keyword.isReservedWordES6(name, true)) {\n\t return false;\n\t } else {\n\t return _esutils2[\"default\"].keyword.isIdentifierNameES6(name);\n\t }\n\t}", "function isValidIdentifier(name) {\n\t if (typeof name !== \"string\" || _esutils2[\"default\"].keyword.isReservedWordES6(name, true)) {\n\t return false;\n\t } else {\n\t return _esutils2[\"default\"].keyword.isIdentifierNameES6(name);\n\t }\n\t}", "function isValidIdentifier(name) {\n\t if (typeof name !== \"string\" || _esutils2[\"default\"].keyword.isReservedWordES6(name, true)) {\n\t return false;\n\t } else {\n\t return _esutils2[\"default\"].keyword.isIdentifierNameES6(name);\n\t }\n\t}", "function isValidIdentifier(name) {\n\t if (typeof name !== \"string\" || _esutils2[\"default\"].keyword.isReservedWordES6(name, true)) {\n\t return false;\n\t } else {\n\t return _esutils2[\"default\"].keyword.isIdentifierNameES6(name);\n\t }\n\t}", "function identify() {\r\n return this.name.toUpperCase();\r\n}", "jsx_parseIdentifier() {\n var node = this.startNode();\n if (this.type === tok.jsxName)\n { node.name = this.value; }\n else if (this.type.keyword)\n { node.name = this.type.keyword; }\n else\n { this.unexpected(); }\n this.next();\n return this.finishNode(node, 'JSXIdentifier');\n }", "function isIdentifierChar(code) {\n\t if (code < 48) return code === 36;\n\t if (code < 58) return true;\n\t if (code < 65) return false;\n\t if (code < 91) return true;\n\t if (code < 97) return code === 95;\n\t if (code < 123) return true;\n\t if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n\t return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n\t}", "function isIdentifierChar(code) {\n\t if (code < 48) return code === 36;\n\t if (code < 58) return true;\n\t if (code < 65) return false;\n\t if (code < 91) return true;\n\t if (code < 97) return code === 95;\n\t if (code < 123) return true;\n\t if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n\t return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n\t}", "function isIdentifierChar(code) {\n\t if (code < 48) return code === 36;\n\t if (code < 58) return true;\n\t if (code < 65) return false;\n\t if (code < 91) return true;\n\t if (code < 97) return code === 95;\n\t if (code < 123) return true;\n\t if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n\t return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n\t}", "function isIdentifierChar(code) {\n\t if (code < 48) return code === 36;\n\t if (code < 58) return true;\n\t if (code < 65) return false;\n\t if (code < 91) return true;\n\t if (code < 97) return code === 95;\n\t if (code < 123) return true;\n\t if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n\t return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n\t}", "function isIdentifierChar(code) {\n\t if (code < 48) return code === 36;\n\t if (code < 58) return true;\n\t if (code < 65) return false;\n\t if (code < 91) return true;\n\t if (code < 97) return code === 95;\n\t if (code < 123) return true;\n\t if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n\t return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n\t}", "function isIdentifierChar(code) {\n\t if (code < 48) return code === 36;\n\t if (code < 58) return true;\n\t if (code < 65) return false;\n\t if (code < 91) return true;\n\t if (code < 97) return code === 95;\n\t if (code < 123) return true;\n\t if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n\t return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n\t}", "function isIdentifierChar(code) {\n\t if (code < 48) return code === 36;\n\t if (code < 58) return true;\n\t if (code < 65) return false;\n\t if (code < 91) return true;\n\t if (code < 97) return code === 95;\n\t if (code < 123) return true;\n\t if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n\t return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n\t}", "function isIdentifierChar(code) {\n\t if (code < 48) return code === 36;\n\t if (code < 58) return true;\n\t if (code < 65) return false;\n\t if (code < 91) return true;\n\t if (code < 97) return code === 95;\n\t if (code < 123) return true;\n\t if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n\t return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n\t}", "function isIdentifierChar(code) {\n\t if (code < 48) return code === 36;\n\t if (code < 58) return true;\n\t if (code < 65) return false;\n\t if (code < 91) return true;\n\t if (code < 97) return code === 95;\n\t if (code < 123) return true;\n\t if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n\t return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n\t}", "function isIdentifierChar(code) {\n if (code < 48) return code === 36;\n if (code < 58) return true;\n if (code < 65) return false;\n if (code < 91) return true;\n if (code < 97) return code === 95;\n if (code < 123) return true;\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n}", "function isIdentifierChar(code) {\n if (code < 48) return code === 36;\n if (code < 58) return true;\n if (code < 65) return false;\n if (code < 91) return true;\n if (code < 97) return code === 95;\n if (code < 123) return true;\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n}", "function isIdentifierChar(code) {\n if (code < 48) return code === 36;\n if (code < 58) return true;\n if (code < 65) return false;\n if (code < 91) return true;\n if (code < 97) return code === 95;\n if (code < 123) return true;\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);\n}", "function isValidIdentifier(name /*: string*/) /*: boolean*/ {\n\t if (typeof name !== \"string\" || _esutils2[\"default\"].keyword.isReservedWordES6(name, true)) {\n\t return false;\n\t } else {\n\t return _esutils2[\"default\"].keyword.isIdentifierNameES6(name);\n\t }\n\t}", "function setID (identifier) {\n if (identifier.longname) {\n identifier.id = identifier.longname\n }\n if (identifier.kind === 'constructor') {\n identifier.id = identifier.longname + '()'\n }\n if (identifier.isExported) {\n identifier.id = identifier.longname + '--' + identifier.codeName\n }\n return identifier\n}", "function createIdentifier(prefix, name, value) {\n var hashedString = (0, _hash.default)(name + stringifyValueWithProperty(value, name));\n return true ? prefix + \"-\" + name + \"-\" + hashedString : undefined;\n}", "function is_ident(a,b) {\n\tvar identical = false;\n\tif (typeof(a)==typeof(b)) {\n\t\tif (a==b) {\n\t\t\tidentical = true; }}\n\treturn identical; }", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "function format_identifier(id) {\n \n\tvar new_id;\n\tif (id[0].match(\"[a-zA-Z_$]\")) {\n\t\tnew_id = id[0];\n\t} else {\n\t\tnew_id = convert_char(id[0]);\n\t}\n\tfor (var j = 1; j < id.length; j++) {\n\t\tif (id[j].match(\"[0-9a-zA-Z_$]\")) {\n\t\t\tnew_id = new_id + id[j];\n\t\t} else {\n\t\t\tnew_id = new_id + convert_char(id[j]);\n\t\t}\n\t}\n \n\treturn new_id;\n\n \n}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}" ]
[ "0.7836606", "0.7385199", "0.7291059", "0.7141224", "0.7141224", "0.7018309", "0.70124626", "0.6906519", "0.689609", "0.68921226", "0.6889619", "0.68158567", "0.6810275", "0.6810275", "0.6807493", "0.67689055", "0.67689055", "0.6741417", "0.6687659", "0.6661118", "0.6644244", "0.656008", "0.6553124", "0.64987946", "0.64943856", "0.6463507", "0.646319", "0.6456986", "0.64548", "0.64542544", "0.64542544", "0.64413226", "0.64413226", "0.643683", "0.6435637", "0.6435637", "0.6435637", "0.6435637", "0.6435637", "0.6435637", "0.64309907", "0.64283156", "0.6415615", "0.64155793", "0.64142436", "0.63938844", "0.63820314", "0.63604647", "0.63468385", "0.6341951", "0.63373214", "0.6337216", "0.6336315", "0.6334787", "0.6323067", "0.6296131", "0.62939787", "0.62939787", "0.62939787", "0.62939787", "0.627818", "0.627622", "0.62652326", "0.62652326", "0.62652326", "0.62652326", "0.62652326", "0.62652326", "0.62652326", "0.62652326", "0.62652326", "0.6256863", "0.6256863", "0.6256863", "0.62376976", "0.6229191", "0.6223984", "0.6200852", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.61963457", "0.6188692", "0.61736315", "0.61736315", "0.61736315", "0.61736315", "0.61736315", "0.61736315", "0.61736315", "0.61736315" ]
0.0
-1
7.6.1.2 Future Reserved Words
function isFutureReservedWord(id) { switch (id) { case 'class': case 'enum': case 'export': case 'extends': case 'import': case 'super': return true; default: return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reserved(){}", "function isFutureReservedWord(id) {\n return false;\n }", "function isReserved(str){var c=(str+'').charCodeAt(0);return c===0x24||c===0x5F;}", "function isReserved(str){var c=(str+'').charCodeAt(0);return c===0x24||c===0x5F;}", "function isReserved(str){var c=(str+'').charCodeAt(0);return c===0x24||c===0x5F;}", "function isReservedMemberName(name) {\n return name.charCodeAt(0) === 95 /* _ */ &&\n name.charCodeAt(1) === 95 /* _ */ &&\n name.charCodeAt(2) !== 95 /* _ */ &&\n name.charCodeAt(2) !== 64 /* at */;\n }", "function isFutureReservedWord(id) {\n switch (id) {\n case 'enum':\n case 'export':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }", "function isFutureReservedWord(id) {\n\t switch (id) {\n\t case 'enum':\n\t case 'export':\n\t case 'import':\n\t case 'super':\n\t return true;\n\t default:\n\t return false;\n\t }\n\t }", "function isFutureReservedWord(id) {\n\t switch (id) {\n\t case 'class':\n\t case 'enum':\n\t case 'export':\n\t case 'extends':\n\t case 'import':\n\t case 'super':\n\t return true;\n\t default:\n\t return false;\n\t }\n\t }", "static isReservedInternalKeyword(key) {\n return key.startsWith('@__');\n }", "static isReservedInternalKeyword(key) {\n return key.startsWith('@__');\n }", "function isReserved(str) {\n\t\t var c = (str + '').charCodeAt(0);\n\t\t return c === 0x24 || c === 0x5F;\n\t\t}", "function isFutureReservedWord(id) {\n switch (id) {\n case 'enum':\n case 'export':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }", "function isFutureReservedWord(id) {\n switch (id) {\n case 'enum':\n case 'export':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }", "function isFutureReservedWord(id) {\n switch (id) {\n case 'enum':\n case 'export':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }", "function isFutureReservedWord(id) {\n switch (id) {\n case 'enum':\n case 'export':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }", "function isFutureReservedWord(id) {\n switch (id) {\n case 'enum':\n case 'export':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }", "function isFutureReservedWord$904(id$1055) {\n switch (id$1055) {\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }", "function isReserved(key) {\n return (key === \"add\" || key === \"delete\");\n}", "protected internal function m252() {}", "function dwscripts_isSQLReservedWord(theStr)\n{\n var retVal = false;\n \n // Use the Server Model version if it exists\n var serverObj = dwscripts.getServerImplObject();\n if (serverObj != null && serverObj.isSQLReservedWord != null)\n {\n retVal = serverObj.isSQLReservedWord(theStr);\n }\n else\n {\n if (dwscripts.SQL_RESERVED_WORDS == null)\n {\n var a = new Array\n (\n \"absolute\",\n \"access\",\n \"action\",\n \"ada\",\n \"add\",\n \"admin\",\n \"after\",\n \"aggregate\",\n \"alias\",\n \"all\",\n \"allocate\",\n \"alphanumeric\",\n \"alter\",\n \"and\",\n \"any\",\n \"application\",\n \"are\",\n \"array\",\n \"as\",\n \"asc\",\n \"assertion\",\n \"assistant\",\n \"at\",\n \"audit\",\n \"authorization\",\n \"autoincrement\",\n \"avg\",\n \"before\",\n \"begin\",\n \"between\",\n \"binary\",\n \"bit\",\n \"bit_length\",\n \"blob\",\n \"boolean\",\n \"both\",\n \"breadth\",\n \"by\",\n \"byte\",\n \"call\",\n \"cascade\",\n \"cascaded\",\n \"case\",\n \"cast\",\n \"catalog\",\n \"char\",\n \"character\",\n \"character_length\",\n \"char_length\",\n \"check\",\n \"class\",\n \"clob\",\n \"close\",\n \"cluster\",\n \"coalesce\",\n \"cobol\",\n \"collate\",\n \"collation\",\n \"column\",\n \"comment\",\n \"commit\",\n \"compactdatabase\",\n \"completion\",\n \"compress\",\n \"connect\",\n \"connection\",\n \"constraint\",\n \"constraints\",\n \"constructor\",\n \"container\",\n \"continue\",\n \"convert\",\n \"corresponding\",\n \"count\",\n \"counter\",\n \"create\",\n \"createdatabase\",\n \"createfield\",\n \"creategroup\",\n \"createindex\",\n \"createobject\",\n \"createproperty\",\n \"createrelation\",\n \"createtabledef\",\n \"createuser\",\n \"createworkspace\",\n \"cross\",\n \"cube\",\n \"currency\",\n \"current\",\n \"current_date\",\n \"current_path\",\n \"current_role\",\n \"current_time\",\n \"current_timestam\",\n \"current_timestamp\",\n \"current_user\",\n \"currentuser\",\n \"cursor\",\n \"cycle\",\n \"data\",\n \"database\",\n \"date\",\n \"datetime\",\n \"day\",\n \"deallocate\",\n \"dec\",\n \"decimal\",\n \"declare\",\n \"default\",\n \"deferrable\",\n \"deferred\",\n \"delete\",\n \"depth\",\n \"deref\",\n \"desc\",\n \"describe\",\n \"description\",\n \"descriptor\",\n \"destroy\",\n \"destructor\",\n \"deterministic\",\n \"diagnostics\",\n \"dictionary\",\n \"disallow\",\n \"disconnect\",\n \"displacement\",\n \"distinct\",\n \"distinctrow\",\n \"document\",\n \"domain\",\n \"double\",\n \"drop\",\n \"dynamic\",\n \"each\",\n \"echo\",\n \"else\",\n \"end\",\n \"end-exec\",\n \"equals\",\n \"eqv\",\n \"error\",\n \"escape\",\n \"every\",\n \"except\",\n \"exception\",\n \"exclusive\",\n \"exec\",\n \"execute\",\n \"exists\",\n \"exit\",\n \"external\",\n \"extract\",\n \"false\",\n \"fetch\",\n \"field\",\n \"fields\",\n \"file\",\n \"fillcache\",\n \"first\",\n \"float\",\n \"float4\",\n \"float8\",\n \"for\",\n \"foreign\",\n \"form\",\n \"forms\",\n \"fortran\",\n \"found\",\n \"free\",\n \"from\",\n \"full\",\n \"function\",\n \"general\",\n \"get\",\n \"getobject\",\n \"getoption\",\n \"global\",\n \"go\",\n \"goto\",\n \"gotopage\",\n \"grant\",\n \"group\",\n \"group by\",\n \"grouping\",\n \"guid\",\n \"having\",\n \"host\",\n \"hour\",\n \"identified\",\n \"identity\",\n \"idle\",\n \"ieeedouble\",\n \"ieeesingle\",\n \"if\",\n \"ignore\",\n \"immediate\",\n \"imp\",\n \"in\",\n \"include\",\n \"increment\",\n \"index\",\n \"indexes\",\n \"indicator\",\n \"initial\",\n \"initialize\",\n \"initially\",\n \"inner\",\n \"inout\",\n \"input\",\n \"insensitive\",\n \"insert\",\n \"inserttext\",\n \"int\",\n \"integer\",\n \"integer1\",\n \"integer2\",\n \"integer4\",\n \"intersect\",\n \"interval\",\n \"into\",\n \"is\",\n \"isolation\",\n \"iterate\",\n \"join\",\n \"key\",\n \"language\",\n \"large\",\n \"last\",\n \"lastmodified\",\n \"lateral\",\n \"leading\",\n \"left\",\n \"less\",\n \"level\",\n \"like\",\n \"limit\",\n \"local\",\n \"localtime\",\n \"localtimestamp\",\n \"locator\",\n \"lock\",\n \"logical\",\n \"logical1\",\n \"long\",\n \"longbinary\",\n \"longtext\",\n \"lower\",\n \"map\",\n \"match\",\n \"max\",\n \"maxextents\",\n \"min\",\n \"minus\",\n \"minute\",\n \"mlslabel\",\n \"mode\",\n \"modifies\",\n \"modify\",\n \"module\",\n \"month\",\n \"mumps\",\n \"names\",\n \"national\",\n \"natural\",\n \"nchar\",\n \"nclob\",\n \"new\",\n \"next\",\n \"no\",\n \"noaudit\",\n \"nocompress\",\n \"none\",\n \"not\",\n \"nowait\",\n \"null\",\n \"nullif\",\n \"number\",\n \"numeric\",\n \"object\",\n \"octet_length\",\n \"of\",\n \"off\",\n \"offline\",\n \"old\",\n \"on\",\n \"online\",\n \"only\",\n \"open\",\n \"operation\",\n \"option\",\n \"or\",\n \"order\",\n \"ordinality\",\n \"out\",\n \"outer\",\n \"output\",\n \"overlaps\",\n \"pad\",\n \"parameter\",\n \"parameters\",\n \"partial\",\n \"pascal\",\n \"path\",\n \"pctfree\",\n \"pli\",\n \"position\",\n \"postfix\",\n \"precision\",\n \"prefix\",\n \"preorder\",\n \"prepare\",\n \"preserve\",\n \"primary\",\n \"prior\",\n \"privileges\",\n \"procedure\",\n \"public\",\n \"raw\",\n \"read\",\n \"reads\",\n \"real\",\n \"recursive\",\n \"ref\",\n \"references\",\n \"referencing\",\n \"relative\",\n \"rename\",\n \"resource\",\n \"restrict\",\n \"result\",\n \"returns\",\n \"revoke\",\n \"right\",\n \"role\",\n \"rollback\",\n \"rollup\",\n \"routine\",\n \"row\",\n \"rowid\",\n \"rownum\",\n \"rows\",\n \"savepoint\",\n \"schema\",\n \"scope\",\n \"scroll\",\n \"search\",\n \"second\",\n \"section\",\n \"select\",\n \"sequence\",\n \"session\",\n \"session_user\",\n \"set\",\n \"sets\",\n \"share\",\n \"size\",\n \"smallint\",\n \"some\",\n \"space\",\n \"specific\",\n \"specifictype\",\n \"sql\",\n \"sqlca\",\n \"sqlcode\",\n \"sqlerror\",\n \"sqlexception\",\n \"sqlstate\",\n \"sqlwarning\",\n \"start\",\n \"state\",\n \"statement\",\n \"static\",\n \"structure\",\n \"substring\",\n \"successful\",\n \"sum\",\n \"synonym\",\n \"sysdate\",\n \"system\",\n \"system_user\",\n \"table\",\n \"temporary\",\n \"terminate\",\n \"than\",\n \"then\",\n \"time\",\n \"timestamp\",\n \"timezone_hour\",\n \"timezone_minute\",\n \"to\",\n \"trailing\",\n \"transaction\",\n \"translate\",\n \"translation\",\n \"treat\",\n \"trigger\",\n \"trim\",\n \"true\",\n \"uid\",\n \"under\",\n \"union\",\n \"unique\",\n \"unknown\",\n \"unnest\",\n \"update\",\n \"upper\",\n \"usage\",\n \"user\",\n \"using\",\n \"validate\",\n \"value\",\n \"values\",\n \"varchar\",\n \"varchar2\",\n \"variable\",\n \"varying\",\n \"view\",\n \"when\",\n \"whenever\",\n \"where\",\n \"with \",\n \"with\",\n \"without\",\n \"work\",\n \"write\",\n \"year\",\n \"zone\"\n );\n\n dwscripts.SQL_RESERVED_WORDS = a;\n }\n\n if (dwscripts.SQL_RESERVED_WORDS != null)\n {\n var word = theStr.toLowerCase();\n\n if (dwscripts.findInArray(dwscripts.SQL_RESERVED_WORDS, word) != -1)\n {\n retVal = true;\n }\n }\n }\n \n return retVal;\n}", "function isReserved(str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F;\n }", "function isFutureReservedWord(id) {\n switch (id) {\n\n // Future reserved words.\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n }\n\n return false;\n }", "function isFutureReservedWord(id) {\n switch (id) {\n\n // Future reserved words.\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n }\n\n return false;\n }", "function isFutureReservedWord(id) {\n switch (id) {\n\n // Future reserved words.\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n }\n\n return false;\n }", "function isFutureReservedWord(id) {\n switch (id) {\n\n // Future reserved words.\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n }\n\n return false;\n }", "function isFutureReservedWord(id) {\n switch (id) {\n\n // Future reserved words.\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n }\n\n return false;\n }", "function isFutureReservedWord(id) {\n switch (id) {\n\n // Future reserved words.\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n }\n\n return false;\n }", "function isFutureReservedWord(id) {\n switch (id) {\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n // case 'super':\n return true;\n default:\n return false;\n }\n }", "function isReserved (str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F\n\t}", "function isReserved (str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F\n\t}", "function isReserved (str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F\n\t}", "function isReserved (str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F\n\t}", "function isReserved (str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F\n\t}", "function isReserved (str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F\n\t}", "function isReserved (str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F\n\t}", "function isReserved (str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F\n\t}", "function isReserved(str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F;\n\t}", "function isReserved(str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F;\n\t}", "function isReserved(str) {\n\t var c = (str + '').charCodeAt(0);\n\t return c === 0x24 || c === 0x5F;\n\t}", "function isReserved (str) {\n\t var c = (str + '').charCodeAt(0)\n\t return c === 0x24 || c === 0x5F\n\t}", "function isFutureReservedWord(id) {\n switch (id) {\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n }", "function isFutureReservedWord(id) {\n switch (id) {\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }", "function isFutureReservedWord(id) {\n switch (id) {\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }", "transient protected internal function m189() {}", "function isReserved (str) {\r\n var c = (str + '').charCodeAt(0);\r\n return c === 0x24 || c === 0x5F\r\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n }", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n }", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n }", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n }", "function isReservedWord(token) {\n\treturn token === \"T\" || token === \"F\" || token === \"and\" || token === \"or\" ||\n\t token === \"not\" || token === \"iff\" || token === \"implies\" ||\n\t token === \"true\" || token === \"false\";\n}", "function invalid identifier () {}", "function isFutureReservedWord(id)\n\t\t{\n\t\t\tswitch (id)\n\t\t\t{\n\t\t\t\tcase 'class':\n\t\t\t\tcase 'enum':\n\t\t\t\tcase 'export':\n\t\t\t\tcase 'extends':\n\t\t\t\tcase 'import':\n\t\t\t\tcase 'super':\n\t\t\t\t\treturn true;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "function isReserved(str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n }", "function isReserved(str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n }", "function isReserved(str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F;\n }", "function isReserved(str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F;\n }", "static final private internal function m106() {}", "static transient final private protected public internal function m39() {}", "function missingLetters() {}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}", "function isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}" ]
[ "0.72495985", "0.6624807", "0.63884044", "0.63884044", "0.63884044", "0.63262403", "0.6323935", "0.63224894", "0.62571216", "0.6222904", "0.6222904", "0.61849046", "0.6172429", "0.6172429", "0.6172429", "0.6172429", "0.6172429", "0.61564004", "0.6147203", "0.6132719", "0.60980296", "0.60883904", "0.60862124", "0.60862124", "0.60862124", "0.60862124", "0.60862124", "0.60862124", "0.6078264", "0.60780317", "0.60780317", "0.60780317", "0.60780317", "0.60780317", "0.60780317", "0.60780317", "0.60780317", "0.6070651", "0.6070651", "0.6070651", "0.6059365", "0.60487455", "0.60441196", "0.6035757", "0.6035757", "0.603175", "0.5991943", "0.5991304", "0.5991304", "0.5991304", "0.5991304", "0.59616596", "0.5961555", "0.59579915", "0.5939465", "0.5939465", "0.5933701", "0.5933701", "0.5917251", "0.59074265", "0.5894009", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962", "0.5893962" ]
0.59695417
63
Return true if there is a line terminator before the next token.
function peekLineTerminator() { var pos, line, start, found; pos = index; line = lineNumber; start = lineStart; skipComment(); found = lineNumber !== line; index = pos; lineNumber = line; lineStart = start; return found; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function peekLineTerminator$928() {\n return lookahead$891.lineNumber !== lineNumber$881;\n }", "function peekLineTerminator() {\n var pos, line, start, found;\n \n pos = index;\n line = lineNumber;\n start = lineStart;\n skipComment();\n found = lineNumber !== line;\n index = pos;\n lineNumber = line;\n lineStart = start;\n \n return found;\n }", "function peekLineTerminator() {\n\t var pos, line, start, found;\n\n\t pos = index;\n\t line = lineNumber;\n\t start = lineStart;\n\t skipComment();\n\t found = lineNumber !== line;\n\t index = pos;\n\t lineNumber = line;\n\t lineStart = start;\n\n\t return found;\n\t }", "get hasLineTerminator() {\n\t\treturn this.state.hasLineTerminator;\n\t}", "function peekLineTerminator()\n\t\t{\n\t\t\tvar pos, line, start, found;\n\t\t\tpos = index;\n\t\t\tline = lineNumber;\n\t\t\tstart = lineStart;\n\t\t\tskipComment();\n\t\t\tfound = lineNumber !== line;\n\t\t\tindex = pos;\n\t\t\tlineNumber = line;\n\t\t\tlineStart = start;\n\t\t\treturn found;\n\t\t}", "function peekLineTerminator() {\n var pos, line, start, found;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n skipComment();\n found = lineNumber !== line;\n index = pos;\n lineNumber = line;\n lineStart = start;\n\n return found;\n }", "function peekLineTerminator() {\n var pos, line, start, found;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n skipComment();\n found = lineNumber !== line;\n index = pos;\n lineNumber = line;\n lineStart = start;\n\n return found;\n }", "eol() { return this.pos >= this.string.length; }", "function peekLineTerminator() {\n var pos, line, start, found;\n pos = index;\n line = lineNumber;\n start = lineStart;\n skipComment();\n found = lineNumber !== line;\n index = pos;\n lineNumber = line;\n lineStart = start;\n return found;\n } // Throw an exception", "get isNextTokenColon() {\n\t\twhile(!this.isEnd)\n\t\t{\n\t\t\tvar nextChar = this.peekChar(0);\n\n\t\t\tif(jsc.TextUtils.isWhitespace(nextChar) || jsc.TextUtils.isLineTerminator(nextChar))\n\t\t\t{\n\t\t\t\tthis.position++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\treturn (this.getChar() === ':');\n\t}", "function isLineTerminator(ch) {\n\t return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n\t }", "function isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n }", "function isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n }", "function isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n }", "function isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n }", "get atEOF() {\n return this.index >= this.tokens.length;\n }", "get atEOF() {\n return this.index >= this.tokens.length;\n }", "function peekLineTerminator(){var pos,line,start,found;pos = index;line = lineNumber;start = lineStart;skipComment();found = lineNumber !== line;index = pos;lineNumber = line;lineStart = start;return found;} // Throw an exception", "eatNewline ( ) {\n\t\tconst ch = this.char();\n\n\t\tif ( ch === '\\r' ) {\n\t\t\tthis.next();\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ch === '\\n') {\n\t\t\tthis.next();\n\t\t\tthis.eatOptional( '\\r' );\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "function matchNewLine() {\n\t\tvar pattern = /^\\n/;\n\t\tvar x = lexString.match(pattern);\n\t\tif(x !== null) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "function isLineDelimiter(token, stack) {\n if (token.isArrayLiteral) {\n return true;\n }\n var ttl = token.type.label;\n var top = stack[stack.length - 1];\n return ttl == \";\" && top != \"(\"\n || ttl == \"{\"\n || ttl == \",\" && top != \"(\"\n || ttl == \":\" && (top == \"case\" || top == \"default\");\n }", "function startsWithNL(str) { return str && str[str[0] === '\\r' ? 1 : 0] === '\\n'; }", "function startsWithNL(str) { return str && str[str[0] === '\\r' ? 1 : 0] === '\\n'; }", "hasMoreTokens() {\n return this._cursor < this._string.length;\n }", "isNextLineIndented(ignoreComments = true) {\n var EOF, currentIndentation, ret;\n currentIndentation = this.getCurrentLineIndentation();\n EOF = !this.moveToNextLine();\n if (ignoreComments) {\n while (!EOF && this.isCurrentLineEmpty()) {\n EOF = !this.moveToNextLine();\n }\n } else {\n while (!EOF && this.isCurrentLineBlank()) {\n EOF = !this.moveToNextLine();\n }\n }\n if (EOF) {\n return false;\n }\n ret = false;\n if (this.getCurrentLineIndentation() > currentIndentation) {\n ret = true;\n }\n this.moveToPreviousLine();\n return ret;\n }", "hasMoreTokens () {\n return this.currentTokenIndex + 1 < this.tokens.length\n }", "function eof() {\n return peek() === \"\";\n }", "function eof() {\n return peek() == \"\";\n }", "function isEOL(ch) {\n return ch === '\\n';\n }", "function startLine(token) {\n return token.startLine || token.line;\n }", "hasMoreTokens() {\n return this.pos < this.length;\n }", "eof() {\n return this.peek() == '';\n }", "isEOF() {\n return this._cursor === this._string.length;\n }", "function isTokenSeparated(stream) {\n return stream.sol() ||\n stream.string.charAt(stream.start - 1) == \" \" ||\n stream.string.charAt(stream.start - 1) == \"\\t\";\n }", "moveToNextLine() {\n if (this.currentLineNb >= this.lines.length - 1) {\n return false;\n }\n this.currentLine = this.lines[++this.currentLineNb];\n return true;\n }", "eof(): boolean {\n return this.position >= this.input.length;\n }", "function hasMore_Tokens()\n{\n if (this.tokensReturned < this.tokens.length)\n {\n return true;\n } // end if\n else\n {\n return false;\n } // end else\n}", "nextLine() {\n this._bufferService.buffer.x = 0;\n this.index();\n return true;\n }", "function iseol(c) {\n\treturn (c == '\\n');\n}", "function eof() {\n return peek() == null;\n }", "function needsSpaceAfter(token, lastToken) {\n if (lastToken) {\n if (lastToken.type.isLoop) {\n return true;\n }\n if (lastToken.type.isAssign) {\n return true;\n }\n if (lastToken.type.binop != null) {\n return true;\n }\n\n var ltt = lastToken.type.label;\n if (ltt == \"?\") {\n return true;\n }\n if (ltt == \":\") {\n return true;\n }\n if (ltt == \",\") {\n return true;\n }\n if (ltt == \";\") {\n return true;\n }\n if (ltt == \"${\") {\n return true;\n }\n if (ltt == \"num\" && token.type.label == \".\") {\n return true;\n }\n\n var ltk = lastToken.type.keyword;\n var ttl = token.type.label;\n if (ltk != null && ttl != \".\") {\n if (ltk == \"break\" || ltk == \"continue\" || ltk == \"return\") {\n return token.type.label != \";\";\n }\n if (ltk != \"debugger\"\n && ltk != \"null\"\n && ltk != \"true\"\n && ltk != \"false\"\n && ltk != \"this\"\n && ltk != \"default\") {\n return true;\n }\n }\n\n if (ltt == \")\" && (token.type.label != \")\"\n && token.type.label != \"]\"\n && token.type.label != \";\"\n && token.type.label != \",\"\n && token.type.label != \".\")) {\n return true;\n }\n\n if (isIdentifierLike(token) && isIdentifierLike(lastToken)) {\n // We must emit a space to avoid merging the tokens.\n return true;\n }\n\n if (token.type.label == \"{\" && lastToken.type.label == \"name\") {\n return true;\n }\n }\n\n if (token.type.isAssign) {\n return true;\n }\n if (token.type.binop != null && lastToken) {\n return true;\n }\n if (token.type.label == \"?\") {\n return true;\n }\n\n return false;\n }", "function shouldInsertEmptyLineAfter( node ) {\n\t\tconst { originalText } = options;\n\t\tconst nextCharIndex = getNextNonSpaceNonCommentCharacterIndex$3( originalText, node, options.locEnd );\n\t\tconst nextChar = originalText.charAt( nextCharIndex ); // if it is cut off by a parenthesis, we only account for one typed empty\n\t\t// line after that parenthesis\n\n\t\tif ( nextChar === ')' ) {\n\t\t\treturn isNextLineEmptyAfterIndex$2( originalText, nextCharIndex + 1, options.locEnd );\n\t\t}\n\n\t\treturn isNextLineEmpty$2( originalText, node, options.locEnd );\n\t}", "function isNewline(code) {\n return code === 0x000A || code === 0x000D || code === 0x000C;\n}", "function isDelim(token, code) {\n return token !== null && token.type === DELIM && token.value.charCodeAt(0) === code;\n}", "function shouldInsertEmptyLineAfter(node) {\n const {\n originalText\n } = options;\n const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex$4(originalText, node, locEnd$a);\n const nextChar = originalText.charAt(nextCharIndex); // if it is cut off by a parenthesis, we only account for one typed empty\n // line after that parenthesis\n\n if (nextChar === \")\") {\n return nextCharIndex !== false && isNextLineEmptyAfterIndex$2(originalText, nextCharIndex + 1);\n }\n\n return isNextLineEmpty$6(originalText, node, locEnd$a);\n }", "get eof() { return this._pointer >= this._length; }", "function appendNewline(token, write, stack) {\n if (isLineDelimiter(token, stack)) {\n write(\"\\n\", token.loc.start.line, token.loc.start.column);\n return true;\n }\n return false;\n }", "moreTokens() {\n return this.currentToken < this.tokens.length;\n }", "hasMoreCommands() {\n return this._lineReader.hasNextLine()\n }", "function canInsertSemicolon() {\n return match(TokenType.eof) || match(TokenType.braceR) || hasPrecedingLineBreak();\n}", "lineFeed() {\n // make buffer local for faster access\n const buffer = this._bufferService.buffer;\n this._dirtyRowService.markDirty(buffer.y);\n if (this._optionsService.options.convertEol) {\n buffer.x = 0;\n }\n buffer.y++;\n if (buffer.y === buffer.scrollBottom + 1) {\n buffer.y--;\n this._onRequestScroll.fire(this._eraseAttrData());\n }\n else if (buffer.y >= this._bufferService.rows) {\n buffer.y = this._bufferService.rows - 1;\n }\n // If the end of the line is hit, prevent this action from wrapping around to the next line.\n if (buffer.x >= this._bufferService.cols) {\n buffer.x--;\n }\n this._dirtyRowService.markDirty(buffer.y);\n this._onLineFeed.fire();\n return true;\n }", "isCurrentLineComment() {\n var ltrimmedLine;\n // Checking explicitly the first char of the trim is faster than loops or strpos\n ltrimmedLine = Utils.ltrim(this.currentLine, ' ');\n return ltrimmedLine.charAt(0) === '#';\n }", "eof() {\n return this.at === this.buffer.byteLength;\n }", "function is_complete(text) {\n return !(text.length >= eol.length && text.substring(text.length - eol.length, text.length) == eol);\n}", "function extendCommentToNextLine(line, pos) {\n if (line.trim().startsWith(';') && line.slice(pos).trim().length && line.slice(0, pos).trim().length) {\n return true;\n }\n return false;\n}", "function isTokenOnSameLine(left, right) {\n return left.loc.end.line === right.loc.start.line;\n}", "function isPreviousLineEmpty(text, node) {\n let idx = locStart$1(node) - 1;\n idx = skipSpaces(text, idx, { backwards: true });\n idx = skipNewline(text, idx, { backwards: true });\n idx = skipSpaces(text, idx, { backwards: true });\n const idx2 = skipNewline(text, idx, { backwards: true });\n return idx !== idx2;\n}", "isCurrentLineEmpty() {\n var trimmedLine;\n trimmedLine = Utils.trim(this.currentLine, ' ');\n return trimmedLine.length === 0 || trimmedLine.charAt(0) === '#';\n }", "function canInsertSemicolon() {\n return (\n this.match(tt.eof) ||\n this.match(tt.braceR) ||\n this.hasPrecedingLineBreak()\n );\n}", "endToken({token, counter}) {\n\t\tif (['blank', 'end'].includes(token.name)) {\n\t\t\tthis.listener.nextPattern({syntax: 'invalid', token: token, counter: counter});\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}", "endToken({token, counter}) {\n\t\tif (['blank', 'end'].includes(token.name)) {\n\t\t\tthis.listener.nextPattern({syntax: 'invalid', token: token, counter: counter});\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}", "endToken({token, counter}) {\n\t\tif (['blank', 'end'].includes(token.name)) {\n\t\t\tthis.listener.nextPattern({syntax: 'invalid', token: token, counter: counter});\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}", "isSelectionOnLastLine() {\n return this.getLineIndex(this.end) >= this.lineBreaks_.length - 1;\n }", "lineToken({chunk = this.chunk, offset = 0} = {}) {\r\n\t\t\t\tvar backslash, diff, endsContinuationLineIndentation, indent, match, minLiteralLength, newIndentLiteral, noNewlines, prev, ref, size;\r\n\t\t\t\tif (!(match = MULTI_DENT.exec(chunk))) {\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t\tindent = match[0];\r\n\t\t\t\tprev = this.prev();\r\n\t\t\t\tbackslash = (prev != null ? prev[0] : void 0) === '\\\\';\r\n\t\t\t\tif (!((backslash || ((ref = this.seenFor) != null ? ref.endsLength : void 0) < this.ends.length) && this.seenFor)) {\r\n\t\t\t\t\tthis.seenFor = false;\r\n\t\t\t\t}\r\n\t\t\t\tif (!((backslash && this.seenImport) || this.importSpecifierList)) {\r\n\t\t\t\t\tthis.seenImport = false;\r\n\t\t\t\t}\r\n\t\t\t\tif (!((backslash && this.seenExport) || this.exportSpecifierList)) {\r\n\t\t\t\t\tthis.seenExport = false;\r\n\t\t\t\t}\r\n\t\t\t\tsize = indent.length - 1 - indent.lastIndexOf('\\n');\r\n\t\t\t\tnoNewlines = this.unfinished();\r\n\t\t\t\tnewIndentLiteral = size > 0 ? indent.slice(-size) : '';\r\n\t\t\t\tif (!/^(.?)\\1*$/.exec(newIndentLiteral)) {\r\n\t\t\t\t\tthis.error('mixed indentation', {\r\n\t\t\t\t\t\toffset: indent.length\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn indent.length;\r\n\t\t\t\t}\r\n\t\t\t\tminLiteralLength = Math.min(newIndentLiteral.length, this.indentLiteral.length);\r\n\t\t\t\tif (newIndentLiteral.slice(0, minLiteralLength) !== this.indentLiteral.slice(0, minLiteralLength)) {\r\n\t\t\t\t\tthis.error('indentation mismatch', {\r\n\t\t\t\t\t\toffset: indent.length\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn indent.length;\r\n\t\t\t\t}\r\n\t\t\t\tif (size - this.continuationLineAdditionalIndent === this.indent) {\r\n\t\t\t\t\tif (noNewlines) {\r\n\t\t\t\t\t\tthis.suppressNewlines();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.newlineToken(offset);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn indent.length;\r\n\t\t\t\t}\r\n\t\t\t\tif (size > this.indent) {\r\n\t\t\t\t\tif (noNewlines) {\r\n\t\t\t\t\t\tif (!backslash) {\r\n\t\t\t\t\t\t\tthis.continuationLineAdditionalIndent = size - this.indent;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (this.continuationLineAdditionalIndent) {\r\n\t\t\t\t\t\t\tprev.continuationLineIndent = this.indent + this.continuationLineAdditionalIndent;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.suppressNewlines();\r\n\t\t\t\t\t\treturn indent.length;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!this.tokens.length) {\r\n\t\t\t\t\t\tthis.baseIndent = this.indent = size;\r\n\t\t\t\t\t\tthis.indentLiteral = newIndentLiteral;\r\n\t\t\t\t\t\treturn indent.length;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdiff = size - this.indent + this.outdebt;\r\n\t\t\t\t\tthis.token('INDENT', diff, {\r\n\t\t\t\t\t\toffset: offset + indent.length - size,\r\n\t\t\t\t\t\tlength: size\r\n\t\t\t\t\t});\r\n\t\t\t\t\tthis.indents.push(diff);\r\n\t\t\t\t\tthis.ends.push({\r\n\t\t\t\t\t\ttag: 'OUTDENT'\r\n\t\t\t\t\t});\r\n\t\t\t\t\tthis.outdebt = this.continuationLineAdditionalIndent = 0;\r\n\t\t\t\t\tthis.indent = size;\r\n\t\t\t\t\tthis.indentLiteral = newIndentLiteral;\r\n\t\t\t\t} else if (size < this.baseIndent) {\r\n\t\t\t\t\tthis.error('missing indentation', {\r\n\t\t\t\t\t\toffset: offset + indent.length\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tendsContinuationLineIndentation = this.continuationLineAdditionalIndent > 0;\r\n\t\t\t\t\tthis.continuationLineAdditionalIndent = 0;\r\n\t\t\t\t\tthis.outdentToken({\r\n\t\t\t\t\t\tmoveOut: this.indent - size,\r\n\t\t\t\t\t\tnoNewlines,\r\n\t\t\t\t\t\toutdentLength: indent.length,\r\n\t\t\t\t\t\toffset,\r\n\t\t\t\t\t\tindentSize: size,\r\n\t\t\t\t\t\tendsContinuationLineIndentation\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\treturn indent.length;\r\n\t\t\t}", "isEnd(line, pos) {\n // an also do: if undefined? both ending program, or loop with entire as string is ok. becaeu we dont care what fault happens.\n if (this.curr >= this.input.length) { // change so it know which one it is. unclosed \"token\"?\n throw new SyntaxError(\"Unexpected end of input. Unclosed comment or string starting at line \" + line + \":\" + pos);\n }\n // undefined check?\n }", "function getTokenSkipNewline () {\n do {\n getToken();\n }\n while (token === '\\n');\n }", "function hasCurrentCharacter(tokenizer) {\n return tokenizer._currentIndex < tokenizer._textLength;\n}", "function hasCurrentCharacter(tokenizer) {\n return tokenizer._currentIndex < tokenizer._textLength;\n}", "function getTokenSkipNewline () {\n do {\n getToken();\n }\n while (token == '\\n');\n }", "function checkPreviousLine() {\n if (/^\\s*[\\/\\/]/gi.test(previousLine)) {\n stdout.splice(-1);\n }\n}", "isNextLineUnIndentedCollection(currentIndentation = null) {\n var notEOF, ret;\n if (currentIndentation == null) {\n currentIndentation = this.getCurrentLineIndentation();\n }\n notEOF = this.moveToNextLine();\n while (notEOF && this.isCurrentLineEmpty()) {\n notEOF = this.moveToNextLine();\n }\n if (false === notEOF) {\n return false;\n }\n ret = false;\n if (this.getCurrentLineIndentation() === currentIndentation && this.isStringUnIndentedCollectionItem(this.currentLine)) {\n ret = true;\n }\n this.moveToPreviousLine();\n return ret;\n }", "function isEndOfSentence(c)\r\n{\r\n if(!c || c.length < 1) return false;\r\n return DELIMITERS.includes(c) || SOFT_SEPARATORS.includes(c); // mini hack: comma isn't used for making the next uppercase, but we cannot end the line with that one!\r\n}", "function emptyLine(input)\n{\n\treturn input.length == 0;\n}", "function matchEnd() {\n\t\tvar pattern = /^\\$/;\n\t\tvar x = lexString.match(pattern);\n\t\tif(x !== null) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "isCurrentLineBlank() {\n return '' === Utils.trim(this.currentLine, ' ');\n }", "function hasCurrentCharacter(tokenizer) {\n return tokenizer._currentIndex < tokenizer._textLength;\n }", "processWhiteSpace(type, length) {\n if(type === this.Token.WhiteSpace) {\n this.skipToken(length);\n return true;\n } else if(type === this.Token.LineTerminatorSequence) {\n this.newLine(length);\n this.skipToken(length);\n return true;\n } else if(type === this.Token.Comment) {\n if(this.collectComment) {\n this.collectComment(this.makeToken(type, length));\n } else {\n this.skipToken(length);\n }\n return true;\n }\n return false;\n }", "eof() {\n return this.length === this.buffer.byteLength;\n }", "function getToken() {\n\t\tlastToken = thisToken;\n\t\tif (thisTokenNumber < t.length) {\n\t\t\tthisToken = t[thisTokenNumber];\n\t\t\tthisTokenNumber++;\n\t\t\treturn true;\n\t\t}\n\t\tthisToken = false;\n\t\treturn false;\n\t}", "function end_multi_line_comment(line) {\n if (single_line_comment(line)) {\n return false;\n }\n return !!line.match(/.*\\*\\//);\n }" ]
[ "0.75550944", "0.7486989", "0.74281865", "0.74191064", "0.74170375", "0.7395164", "0.7395164", "0.7299317", "0.7146332", "0.69136053", "0.6864579", "0.68360275", "0.6830869", "0.6830869", "0.6830869", "0.6827602", "0.6827602", "0.68084955", "0.66874665", "0.6642971", "0.6630073", "0.6558335", "0.6558335", "0.6515065", "0.64808357", "0.6473355", "0.6472209", "0.6444705", "0.64056724", "0.6395325", "0.63806045", "0.6369855", "0.633932", "0.63219273", "0.6318142", "0.6250858", "0.6204927", "0.618586", "0.6170553", "0.616971", "0.6168451", "0.61556876", "0.6155463", "0.6124619", "0.612207", "0.608077", "0.6076805", "0.6054439", "0.60201627", "0.60143006", "0.5999706", "0.5989631", "0.59885013", "0.59453326", "0.59305835", "0.5927659", "0.5864238", "0.5863735", "0.5855999", "0.58419263", "0.58419263", "0.58419263", "0.5823844", "0.58238196", "0.5822617", "0.5817613", "0.58029526", "0.58029526", "0.57810074", "0.5766499", "0.57661104", "0.57517743", "0.5750341", "0.5708354", "0.5704162", "0.56774926", "0.5677284", "0.567641", "0.5669187", "0.56470996" ]
0.7454905
19
Throw an exception because of the token.
function throwUnexpected(token) { if (token.type === Token.EOF) { throwError(token, Messages.UnexpectedEOS); } if (token.type === Token.NumericLiteral) { throwError(token, Messages.UnexpectedNumber); } if (token.type === Token.StringLiteral) { throwError(token, Messages.UnexpectedString); } if (token.type === Token.Identifier) { throwError(token, Messages.UnexpectedIdentifier); } if (token.type === Token.Keyword) { if (isFutureReservedWord(token.value)) { throwError(token, Messages.UnexpectedReserved); } else if (strict && isStrictModeReservedWord(token.value)) { throwErrorTolerant(token, Messages.StrictReservedWord); return; } throwError(token, Messages.UnexpectedToken, token.value); } // BooleanLiteral, NullLiteral, or Punctuator. throwError(token, Messages.UnexpectedToken, token.value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function throwUnexpected(token) {\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function checkToken(token) {\n if (!token) {\n throw new Error('No access token found');\n }\n}", "function throwUnexpected(token) {\n if (token.type === TokenEOF) {\n throwError(token, MessageUnexpectedEOS);\n }\n\n if (token.type === TokenNumericLiteral) {\n throwError(token, MessageUnexpectedNumber);\n }\n\n if (token.type === TokenStringLiteral) {\n throwError(token, MessageUnexpectedString);\n }\n\n if (token.type === TokenIdentifier) {\n throwError(token, MessageUnexpectedIdentifier);\n }\n\n if (token.type === TokenKeyword) {\n throwError(token, MessageUnexpectedReserved);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, MessageUnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n \n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n \n if (token.type === Token.StringLiteral || token.type === Token.JSXText) {\n throwError(token, Messages.UnexpectedString);\n }\n \n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n \n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n \n if (token.type === Token.Template) {\n throwError(token, Messages.UnexpectedTemplate, token.value.raw);\n }\n \n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n if (token.type === Token.Template) {\n throwError(token, Messages.UnexpectedTemplate, token.value.raw);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n\t if (token.type === Token.EOF) {\n\t throwError(token, Messages.UnexpectedEOS);\n\t }\n\n\t if (token.type === Token.NumericLiteral) {\n\t throwError(token, Messages.UnexpectedNumber);\n\t }\n\n\t if (token.type === Token.StringLiteral) {\n\t throwError(token, Messages.UnexpectedString);\n\t }\n\n\t if (token.type === Token.Identifier) {\n\t throwError(token, Messages.UnexpectedIdentifier);\n\t }\n\n\t if (token.type === Token.Keyword) {\n\t if (isFutureReservedWord(token.value)) {\n\t throwError(token, Messages.UnexpectedReserved);\n\t } else if (strict && isStrictModeReservedWord(token.value)) {\n\t throwErrorTolerant(token, Messages.StrictReservedWord);\n\t return;\n\t }\n\t throwError(token, Messages.UnexpectedToken, token.value);\n\t }\n\n\t // BooleanLiteral, NullLiteral, or Punctuator.\n\t throwError(token, Messages.UnexpectedToken, token.value);\n\t }", "function throwUnexpected(token) {\n if (token.type === TokenEOF) {\n throwError(token, MessageUnexpectedEOS);\n }\n\n if (token.type === TokenNumericLiteral) {\n throwError(token, MessageUnexpectedNumber);\n }\n\n if (token.type === TokenStringLiteral) {\n throwError(token, MessageUnexpectedString);\n }\n\n if (token.type === TokenIdentifier) {\n throwError(token, MessageUnexpectedIdentifier);\n }\n\n if (token.type === TokenKeyword) {\n throwError(token, MessageUnexpectedReserved);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, MessageUnexpectedToken, token.value);\n}", "function throwUnexpected(token) {\n if (token.type === TokenEOF) {\n throwError(token, MessageUnexpectedEOS);\n }\n\n if (token.type === TokenNumericLiteral) {\n throwError(token, MessageUnexpectedNumber);\n }\n\n if (token.type === TokenStringLiteral) {\n throwError(token, MessageUnexpectedString);\n }\n\n if (token.type === TokenIdentifier) {\n throwError(token, MessageUnexpectedIdentifier);\n }\n\n if (token.type === TokenKeyword) {\n throwError(token, MessageUnexpectedReserved);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, MessageUnexpectedToken, token.value);\n}", "function throwUnexpected(token) {\n var s;\n\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwError(token, Messages.StrictReservedWord);\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral || token.type === Token.JSXText) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n if (token.type === Token.Template) {\n throwError(token, Messages.UnexpectedTemplate, token.value.raw);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral || token.type === Token.JSXText) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n if (token.type === Token.Template) {\n throwError(token, Messages.UnexpectedTemplate, token.value.raw);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral || token.type === Token.XJSText) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n if (token.type === Token.Template) {\n throwError(token, Messages.UnexpectedTemplate, token.value.raw);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral || token.type === Token.XJSText) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n if (token.type === Token.Template) {\n throwError(token, Messages.UnexpectedTemplate, token.value.raw);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral || token.type === Token.XJSText) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n if (token.type === Token.Template) {\n throwError(token, Messages.UnexpectedTemplate, token.value.raw);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral || token.type === Token.XJSText) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n if (token.type === Token.Template) {\n throwError(token, Messages.UnexpectedTemplate, token.value.raw);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral || token.type === Token.XJSText) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n if (token.type === Token.Template) {\n throwError(token, Messages.UnexpectedTemplate, token.value.raw);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }", "function unexpectedTokenError(token, message)\n\t\t{\n\t\t\tvar msg = Messages.UnexpectedToken;\n\t\t\tif (token)\n\t\t\t{\n\t\t\t\tmsg = message ? message : (token.type === Token.EOF) ? Messages.UnexpectedEOS : (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier : (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber : (token.type === Token.StringLiteral) ? Messages.UnexpectedString : Messages.UnexpectedToken;\n\t\t\t\tif (token.type === Token.Keyword)\n\t\t\t\t{\n\t\t\t\t\tif (isFutureReservedWord(token.value))\n\t\t\t\t\t{\n\t\t\t\t\t\tmsg = Messages.UnexpectedReserved;\n\t\t\t\t\t}\n\t\t\t\t\telse if (strict && isStrictModeReservedWord(token.value))\n\t\t\t\t\t{\n\t\t\t\t\t\tmsg = Messages.StrictReservedWord;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmsg = msg.replace('%0', token ? token.value : 'ILLEGAL');\n\t\t\treturn (token && typeof token.lineNumber === 'number') ? createError(token.lineNumber, token.start, msg) : createError(lineNumber, index, msg);\n\t\t}", "unhandled(context) {\n const truncated = JSON.stringify(context.string.length > 13 ? `${context.string.slice(0, 15)}...` : context.string);\n const state = State[context.state];\n const message = `failed to tokenize ${truncated}, unhandled state ${state}.`;\n throw new InvalidTokenError(context.getLocation(1), message);\n }", "function unexpectedTokenError(token, message) {\n var value, msg = message || Messages.UnexpectedToken;\n\n if (token) {\n if (!message) {\n msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :\n (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :\n (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :\n (token.type === Token.StringLiteral) ? Messages.UnexpectedString :\n (token.type === Token.Template) ? Messages.UnexpectedTemplate :\n Messages.UnexpectedToken;\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n msg = Messages.UnexpectedReserved;\n } else if (strict && isStrictModeReservedWord(token.value)) {\n msg = Messages.StrictReservedWord;\n }\n }\n }\n\n value = (token.type === Token.Template) ? token.value.raw : token.value;\n } else {\n value = 'ILLEGAL';\n }\n\n msg = msg.replace('%0', value);\n\n return (token && typeof token.lineNumber === 'number') ?\n createError(token.lineNumber, token.start, msg) :\n createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);\n }", "function unexpectedTokenError(token, message) {\n\t var value, msg = message || Messages.UnexpectedToken;\n\n\t if (token) {\n\t if (!message) {\n\t msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :\n\t (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :\n\t (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :\n\t (token.type === Token.StringLiteral) ? Messages.UnexpectedString :\n\t (token.type === Token.Template) ? Messages.UnexpectedTemplate :\n\t Messages.UnexpectedToken;\n\n\t if (token.type === Token.Keyword) {\n\t if (isFutureReservedWord(token.value)) {\n\t msg = Messages.UnexpectedReserved;\n\t } else if (strict && isStrictModeReservedWord(token.value)) {\n\t msg = Messages.StrictReservedWord;\n\t }\n\t }\n\t }\n\n\t value = (token.type === Token.Template) ? token.value.raw : token.value;\n\t } else {\n\t value = 'ILLEGAL';\n\t }\n\n\t msg = msg.replace('%0', value);\n\n\t return (token && typeof token.lineNumber === 'number') ?\n\t createError(token.lineNumber, token.start, msg) :\n\t createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);\n\t }", "function unexpectedTokenError(token, message) {\n var value, msg = message || Messages.UnexpectedToken;\n\n if (token) {\n if (!message) {\n msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :\n (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :\n (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :\n (token.type === Token.StringLiteral) ? Messages.UnexpectedString :\n (token.type === Token.Template) ? Messages.UnexpectedTemplate :\n Messages.UnexpectedToken;\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n msg = Messages.UnexpectedReserved;\n } else if (strict && isStrictModeReservedWord(token.value)) {\n msg = Messages.StrictReservedWord;\n }\n }\n }\n\n value = (token.type === Token.Template) ? token.value.raw : token.value;\n } else {\n value = 'ILLEGAL';\n }\n\n msg = msg.replace('%0', value);\n\n return (token && typeof token.lineNumber === 'number') ?\n createError(token.lineNumber, token.start, msg) :\n createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);\n }", "function unexpectedTokenError(token, message) {\n var value, msg = message || Messages.UnexpectedToken;\n\n if (token) {\n if (!message) {\n msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :\n (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :\n (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :\n (token.type === Token.StringLiteral) ? Messages.UnexpectedString :\n (token.type === Token.Template) ? Messages.UnexpectedTemplate :\n Messages.UnexpectedToken;\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n msg = Messages.UnexpectedReserved;\n } else if (strict && isStrictModeReservedWord(token.value)) {\n msg = Messages.StrictReservedWord;\n }\n }\n }\n\n value = (token.type === Token.Template) ? token.value.raw : token.value;\n } else {\n value = 'ILLEGAL';\n }\n\n msg = msg.replace('%0', value);\n\n return (token && typeof token.lineNumber === 'number') ?\n createError(token.lineNumber, token.start, msg) :\n createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);\n }", "function unexpectedTokenError(token, message) {\n var value, msg = message || Messages.UnexpectedToken;\n\n if (token) {\n if (!message) {\n msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :\n (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :\n (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :\n (token.type === Token.StringLiteral) ? Messages.UnexpectedString :\n (token.type === Token.Template) ? Messages.UnexpectedTemplate :\n Messages.UnexpectedToken;\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n msg = Messages.UnexpectedReserved;\n } else if (strict && isStrictModeReservedWord(token.value)) {\n msg = Messages.StrictReservedWord;\n }\n }\n }\n\n value = (token.type === Token.Template) ? token.value.raw : token.value;\n } else {\n value = 'ILLEGAL';\n }\n\n msg = msg.replace('%0', value);\n\n return (token && typeof token.lineNumber === 'number') ?\n createError(token.lineNumber, token.start, msg) :\n createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);\n }", "function unexpectedTokenError(token, message) {\n var value, msg = message || Messages.UnexpectedToken;\n\n if (token) {\n if (!message) {\n msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :\n (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :\n (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :\n (token.type === Token.StringLiteral) ? Messages.UnexpectedString :\n (token.type === Token.Template) ? Messages.UnexpectedTemplate :\n Messages.UnexpectedToken;\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n msg = Messages.UnexpectedReserved;\n } else if (strict && isStrictModeReservedWord(token.value)) {\n msg = Messages.StrictReservedWord;\n }\n }\n }\n\n value = (token.type === Token.Template) ? token.value.raw : token.value;\n } else {\n value = 'ILLEGAL';\n }\n\n msg = msg.replace('%0', value);\n\n return (token && typeof token.lineNumber === 'number') ?\n createError(token.lineNumber, token.start, msg) :\n createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);\n }", "function unexpectedTokenError(token, message) {\n var value, msg = message || Messages.UnexpectedToken;\n\n if (token) {\n if (!message) {\n msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :\n (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :\n (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :\n (token.type === Token.StringLiteral) ? Messages.UnexpectedString :\n (token.type === Token.Template) ? Messages.UnexpectedTemplate :\n Messages.UnexpectedToken;\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n msg = Messages.UnexpectedReserved;\n } else if (strict && isStrictModeReservedWord(token.value)) {\n msg = Messages.StrictReservedWord;\n }\n }\n }\n\n value = (token.type === Token.Template) ? token.value.raw : token.value;\n } else {\n value = 'ILLEGAL';\n }\n\n msg = msg.replace('%0', value);\n\n return (token && typeof token.lineNumber === 'number') ?\n createError(token.lineNumber, token.start, msg) :\n createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);\n }", "function unexpected() {\n raise(tokStart, \"Unexpected token\");\n }", "function unexpectedTokenError(token, message) {\n var msg = Messages.UnexpectedToken;\n\n if (token) {\n msg = message ? message :\n (token.type === Token.EOF) ? Messages.UnexpectedEOS :\n (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :\n (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :\n (token.type === Token.StringLiteral) ? Messages.UnexpectedString :\n Messages.UnexpectedToken;\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n msg = Messages.UnexpectedReserved;\n } else if (strict && isStrictModeReservedWord(token.value)) {\n msg = Messages.StrictReservedWord;\n }\n }\n }\n\n msg = msg.replace('%0', token ? token.value : 'ILLEGAL');\n\n return (token && typeof token.lineNumber === 'number') ?\n createError(token.lineNumber, token.start, msg) :\n createError(lineNumber, index, msg);\n }", "errorStuck(context) {\n const state = State[context.state];\n const message = `failed to tokenize ${context.getTruncatedLine()}, state ${state} failed to consume data or change state.`;\n throw new InvalidTokenError(context.getLocation(1), message);\n }", "checkExceptions(checkToken) {\n for (var token in this.reservedTokens) {\n if (this.reservedTokens[token] == checkToken) {\n return token;\n }\n }\n return undefined;\n }", "_error(message, token) {\n const err = new Error(`${message} on line ${token.line}.`);\n err.context = {\n token: token,\n line: token.line,\n previousToken: this._lexer.previousToken\n };\n this._callback(err);\n this._callback = noop;\n }", "async function validateToken(token) {\n var type = typeof token;\n if(type !== \"string\") {\n throw new Error(`Expected token to be a string, received '${type}'`);\n }\n\n if(typeof DatabaseInfo.tokens[token] === \"undefined\") {\n throw new Error(\"Invalid or non-existent token.\");\n }\n\n return token;\n }", "_error(message, token) {\n var err = new Error(message + ' on line ' + token.line + '.');\n err.context = {\n token: token,\n line: token.line,\n previousToken: this._lexer.previousToken\n };\n\n this._callback(err);\n\n this._callback = noop;\n }", "expectToken(kind) {\n const token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return token;\n }\n\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`,\n );\n }", "function parseError(text, token)\n{\n error('parse error: ' + text + ' ' + token.pos);\n}", "nextToken() {\n if (this.tokenIndex === this.tokens.length) {\n throw new Error(\"Unexpectedly reached end of input.\");\n }\n this.tokenIndex++;\n }", "throwUnexpectedToken(symbol, line, column) {\n const lineSource = this._string.split('\\n')[line - 1];\n let lineData = '';\n\n if (lineSource) {\n const pad = ' '.repeat(column);\n lineData = '\\n\\n' + lineSource + '\\n' + pad + '^\\n';\n }\n\n throw new SyntaxError(\n `${lineData}Unexpected token: \"${symbol}\" ` +\n `at ${line}:${column}.`\n );\n }", "throwUnexpectedToken(symbol, line, column) {\n const lineSource = this._string.split('\\n')[line - 1];\n let lineData = '';\n\n if (lineSource) {\n const pad = ' '.repeat(column);\n lineData = '\\n\\n' + lineSource + '\\n' + pad + '^\\n';\n }\n\n throw new SyntaxError(\n `${lineData}Unexpected token: \"${symbol}\" ` +\n `at ${line}:${column}.`\n );\n }", "function throwUnexpected$931(token$1273) {\n if (token$1273.type === Token$869.EOF) {\n throwError$929(token$1273, Messages$874.UnexpectedEOS);\n }\n if (token$1273.type === Token$869.NumericLiteral) {\n throwError$929(token$1273, Messages$874.UnexpectedNumber);\n }\n if (token$1273.type === Token$869.StringLiteral) {\n throwError$929(token$1273, Messages$874.UnexpectedString);\n }\n if (token$1273.type === Token$869.Identifier) {\n throwError$929(token$1273, Messages$874.UnexpectedIdentifier);\n }\n if (token$1273.type === Token$869.Keyword) {\n if (isFutureReservedWord$904(token$1273.value)) {\n } // sweet.js allows future reserved words\n // throwError(token, Messages.UnexpectedReserved);\n else if (strict$879 && isStrictModeReservedWord$905(token$1273.value)) {\n throwErrorTolerant$930(token$1273, Messages$874.StrictReservedWord);\n return;\n }\n throwError$929(token$1273, Messages$874.UnexpectedToken, token$1273.value);\n }\n if (token$1273.type === Token$869.Template) {\n throwError$929(token$1273, Messages$874.UnexpectedTemplate, token$1273.value.raw);\n }\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError$929(token$1273, Messages$874.UnexpectedToken, token$1273.value);\n }", "unexpected(atToken) {\n const token =\n atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;\n return syntaxError(\n this._lexer.source,\n token.start,\n `Unexpected ${getTokenDesc(token)}.`,\n );\n }", "throwUnexpectedToken(symbol, line, column) {\n const lineSource = this._originalString.split('\\n')[line - 1];\n let lineData = '';\n\n if (lineSource) {\n const pad = ' '.repeat(column);\n lineData = '\\n\\n' + lineSource + '\\n' + pad + '^\\n';\n }\n\n throw new SyntaxError(\n `${lineData}Unexpected token: \"${symbol}\" ` +\n `at ${line}:${column}.`\n );\n }", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return Object(_error__WEBPACK_IMPORTED_MODULE_3__[\"syntaxError\"])(lexer.source, token.start, \"Unexpected \".concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_4__[\"getTokenDesc\"])(token)));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return Object(_error__WEBPACK_IMPORTED_MODULE_3__[\"syntaxError\"])(lexer.source, token.start, \"Unexpected \".concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_4__[\"getTokenDesc\"])(token)));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return Object(_error__WEBPACK_IMPORTED_MODULE_2__[\"syntaxError\"])(lexer.source, token.start, \"Unexpected \".concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_3__[\"getTokenDesc\"])(token)));\n}", "function expectToken(lexer, kind) {\n var token = lexer.token;\n\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_3__[\"syntaxError\"])(lexer.source, token.start, \"Expected \".concat(kind, \", found \").concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_4__[\"getTokenDesc\"])(token)));\n}", "function expectToken(lexer, kind) {\n var token = lexer.token;\n\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_3__[\"syntaxError\"])(lexer.source, token.start, \"Expected \".concat(kind, \", found \").concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_4__[\"getTokenDesc\"])(token)));\n}", "function expectToken(lexer, kind) {\n var token = lexer.token;\n\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n\n throw Object(_error_syntaxError__WEBPACK_IMPORTED_MODULE_3__[\"syntaxError\"])(lexer.source, token.start, \"Expected \".concat(kind, \", found \").concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_5__[\"getTokenDesc\"])(token)));\n}", "function unexpected() {\n input.croak(`Unexpected token: ${JSON.stringify(input.peek())}`);\n }", "function expectToken(lexer, kind) {\n var token = lexer.token;\n\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n\n throw syntaxError(lexer.source, token.start, \"Expected \".concat(kind, \", found \").concat(getTokenDesc(token)));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, \"Unexpected \".concat((0, _lexer.getTokenDesc)(token)));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return Object(_error_syntaxError__WEBPACK_IMPORTED_MODULE_3__[\"syntaxError\"])(lexer.source, token.start, \"Unexpected \".concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_5__[\"getTokenDesc\"])(token)));\n}", "function alertInvalidCsrfToken() {\n\tvalidate_alert( _(\"invalidTokenTitle\"), _(\"invalidTokenMsg\"));\n}", "function unexpected(lexer, atToken) {\n\t var token = atToken || lexer.token;\n\t return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n\t}", "function unexpected(lexer, atToken) {\n\t var token = atToken || lexer.token;\n\t return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n\t}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return syntaxError(lexer.source, token.start, \"Unexpected \".concat(getTokenDesc(token)));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "function unexpected(lexer, atToken) {\n var token = atToken || lexer.token;\n return (0, _error.syntaxError)(lexer.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "eat(expectedTokenType) {\n try {\n if (this.currentToken && this.currentToken.type.toUpperCase() == expectedTokenType) {\n this.currentToken = this.lexer.getNextToken();\n return true;\n } else {\n let errMessage = `Expected ${expectedTokenType}: `;\n errMessage += this.currentToken ? `got ${this.currentToken.type}` : `No current token`;\n throw new ParserException(errMessage, this.currentToken);\n }\n } catch (e) {\n throw e\n }\n }", "isError() { return this.type==Token.ERROR }", "isError() { return this.type==Token.ERROR }", "static validateParams(token) {\n if (token === undefined) {\n throw Error(\"client requires a 'token'\");\n }\n }", "unexpected(pos, messageOrType) {\n if (messageOrType == null) messageOrType = 'Unexpected token';\n if (typeof messageOrType !== 'string') messageOrType = `Unexpected token, expected \"${messageOrType.label}\"`;\n throw this.raise(pos != null ? pos : this.state.start, messageOrType);\n }", "function AuthorizationRequiredException() {}", "function unexpected(parser, atToken) {\n\t var token = atToken || parser.token;\n\t return (0, _error.syntaxError)(parser.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n\t}", "function ErrorNodeImpl(token) {\n\tTerminalNodeImpl.call(this, token);\n\treturn this;\n}", "function ErrorNodeImpl(token) {\n\tTerminalNodeImpl.call(this, token);\n\treturn this;\n}", "function unexpected(lexer$$1, atToken) {\n var token = atToken || lexer$$1.token;\n return (0, error.syntaxError)(lexer$$1.source, token.start, 'Unexpected ' + (0, lexer.getTokenDesc)(token));\n}", "function unexpected(parser, atToken) {\n var token = atToken || parser.token;\n return (0, _error.syntaxError)(parser.source, token.start, 'Unexpected ' + (0, _lexer.getTokenDesc)(token));\n}", "function error(message) {\n throw new errors.CompileError('LexError', message, token(Token.INVALID));\n }", "function expect(lexer, kind) {\n var token = lexer.token;\n\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_2__[\"syntaxError\"])(lexer.source, token.start, \"Expected \".concat(kind, \", found \").concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_3__[\"getTokenDesc\"])(token)));\n}", "function AuthTokenError(message) {\r\n\t this.name = 'AuthTokenError';\r\n\t this.message = message;\r\n\t if (Error.captureStackTrace && !isStrict) {\r\n\t Error.captureStackTrace(this, arguments.callee);\r\n\t } else {\r\n\t this.stack = (new Error()).stack;\r\n\t }\r\n\t}", "function unexpected(message = \"Unexpected token\", pos = state.start) {\n if (state.error) {\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const err = new SyntaxError(message);\n err.pos = pos;\n state.error = err;\n state.pos = input.length;\n finishToken(TokenType.eof);\n}", "function sendTokenFailure(error) {\n return {\n type: SEND_TOKEN_FAILURE,\n payload: {\n error,\n },\n };\n}", "function AuthTokenError(message) {\n this.name = 'AuthTokenError';\n this.message = message;\n if (Error.captureStackTrace && !isStrict) {\n Error.captureStackTrace(this, arguments.callee);\n } else {\n this.stack = (new Error()).stack;\n }\n}", "function AuthTokenError(message) {\n this.name = 'AuthTokenError';\n this.message = message;\n if (Error.captureStackTrace && !isStrict) {\n Error.captureStackTrace(this, arguments.callee);\n } else {\n this.stack = (new Error()).stack;\n }\n}", "function throwError(error) {\n \tthrow new SyntaxError(error);\n }", "function expect(parser, kind) {\n\t var token = parser.token;\n\t if (token.kind === kind) {\n\t advance(parser);\n\t return token;\n\t }\n\t throw (0, _error.syntaxError)(parser.source, token.start, 'Expected ' + (0, _lexer.getTokenKindDesc)(kind) + ', found ' + (0, _lexer.getTokenDesc)(token));\n\t}", "_syntaxError(message) {\n log.error(\"Syntax Error:\",message);\n throw message;\n }", "function handlerError(token, ex) {\n //store the exception\n token.result.exception = ex;\n finalizeTest(token, ex);\n }" ]
[ "0.7725581", "0.7725581", "0.7725581", "0.7140519", "0.69908136", "0.6965912", "0.6947362", "0.6947362", "0.69460917", "0.6942947", "0.6921778", "0.6921778", "0.69079626", "0.68972546", "0.68972546", "0.6895765", "0.6895765", "0.6895765", "0.6895765", "0.6895765", "0.68803674", "0.68798226", "0.6867255", "0.6827633", "0.67859805", "0.67859805", "0.67859805", "0.67859805", "0.67859805", "0.6744811", "0.66974825", "0.66959554", "0.66901404", "0.656839", "0.6426682", "0.6415564", "0.6377648", "0.63412195", "0.6266748", "0.6266451", "0.6266451", "0.6196554", "0.61808616", "0.61725867", "0.61677676", "0.61677676", "0.61618865", "0.61543864", "0.61543864", "0.61195636", "0.6102014", "0.60986435", "0.60969186", "0.60964596", "0.6054132", "0.6043747", "0.6043747", "0.60137045", "0.6007978", "0.6007978", "0.6007978", "0.6007978", "0.6007978", "0.6007978", "0.6007978", "0.6007978", "0.6007978", "0.6007978", "0.59881973", "0.59705323", "0.59705323", "0.59085363", "0.5867599", "0.5862673", "0.5849289", "0.58459437", "0.58459437", "0.5823602", "0.58225566", "0.58116716", "0.58057207", "0.58050007", "0.57694036", "0.5762899", "0.5762383", "0.5762383", "0.57542354", "0.5747818", "0.5736863", "0.5734213" ]
0.689666
23
Expect the next token to match the specified punctuator. If not, an exception will be thrown.
function expect(value) { var token = lex(); if (token.type !== Token.Punctuator || token.value !== value) { throwUnexpected(token); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isPunctuatorToken(token) {\n var kind = token.kind;\n return kind === _tokenKind.TokenKind.BANG || kind === _tokenKind.TokenKind.DOLLAR || kind === _tokenKind.TokenKind.AMP || kind === _tokenKind.TokenKind.PAREN_L || kind === _tokenKind.TokenKind.PAREN_R || kind === _tokenKind.TokenKind.SPREAD || kind === _tokenKind.TokenKind.COLON || kind === _tokenKind.TokenKind.EQUALS || kind === _tokenKind.TokenKind.AT || kind === _tokenKind.TokenKind.BRACKET_L || kind === _tokenKind.TokenKind.BRACKET_R || kind === _tokenKind.TokenKind.BRACE_L || kind === _tokenKind.TokenKind.PIPE || kind === _tokenKind.TokenKind.BRACE_R;\n}", "function isPunctuatorToken(token) {\n var kind = token.kind;\n return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R;\n}", "function expect(value){var token=lex();if(token.type !== Token.Punctuator || token.value !== value){throwUnexpected(token);}} // Expect the next token to match the specified keyword.", "function expect(value) {\n var token = lex();\n\n if (token.type !== TokenPunctuator || token.value !== value) {\n throwUnexpected(token);\n }\n } // Return true if the next token matches the specified punctuator.", "function isPunctuatorToken(token) {\n var kind = token.kind;\n return kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BANG || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].DOLLAR || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].AMP || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PAREN_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PAREN_R || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].SPREAD || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].COLON || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].EQUALS || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].AT || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACKET_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACKET_R || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACE_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PIPE || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACE_R;\n}", "function isPunctuatorToken(token) {\n var kind = token.kind;\n return kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BANG || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].DOLLAR || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].AMP || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].PAREN_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].PAREN_R || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].SPREAD || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].COLON || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].EQUALS || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].AT || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACKET_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACKET_R || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACE_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].PIPE || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACE_R;\n}", "function expectContextualKeyword(keyword){return expectKeyword(keyword,true);} // Return true if the next token matches the specified punctuator.", "function G(e){var t=M();(t.type!==Xt.Keyword||t.value!==e)&&W(t)}// Return true if the next token matches the specified punctuator.", "function expect(value) {\n var token = lex();\n\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n } // Expect the next token to match the specified keyword.", "function expect(value) {\n\t var token = lex();\n\t if (token.type !== Token.Punctuator || token.value !== value) {\n\t throwUnexpected(token);\n\t }\n\t }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }", "function expect(value) {\n\t var token = lex();\n\t if (token.type !== Token.Punctuator || token.value !== value) {\n\t throwUnexpectedToken(token);\n\t }\n\t }", "function expect(value)\n\t\t{\n\t\t\tvar token = lex();\n\t\t\tif (token.type !== Token.Punctuator || token.value !== value)\n\t\t\t{\n\t\t\t\tthrowUnexpectedToken(token);\n\t\t\t}\n\t\t}", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpected(token);\n }\n } // Return true if the next token matches the specified punctuator.", "function Y(e){var t=M();(t.type!==Xt.Punctuator||t.value!==e)&&W(t)}// Expect the next token to match the specified keyword.", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n\t return lookahead.type === Token.Punctuator && lookahead.value === value;\n\t }", "function expect(value) {\n var token = lex();\n if (token.type !== TokenPunctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== TokenPunctuator || token.value !== value) {\n throwUnexpected(token);\n }\n}", "function expect(value) {\n var token = lex();\n if (token.type !== TokenPunctuator || token.value !== value) {\n throwUnexpected(token);\n }\n}", "function match(value) {\n\t return lookahead.type === Token.Punctuator && lookahead.value === value;\n\t }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n var token = lookahead();\n return token.type === Token.Punctuator && token.value === value;\n }", "function match(value) {\n var token = lookahead();\n return token.type === Token.Punctuator && token.value === value;\n }", "function match(value) {\n var token = lookahead();\n return token.type === Token.Punctuator && token.value === value;\n }", "function match(value) {\n var token = lookahead();\n return token.type === Token.Punctuator && token.value === value;\n }", "function match(value) {\n var token = lookahead();\n return token.type === Token.Punctuator && token.value === value;\n }", "function match(value) {\n return lookahead.type === TokenPunctuator && lookahead.value === value;\n}", "function match(value) {\n return lookahead.type === TokenPunctuator && lookahead.value === value;\n}", "function checkPunctuators(token, values) {\n return token.type === \"(punctuator)\" && _.contains(values, token.value);\n }", "function match(value) {\n return lookahead.type === TokenPunctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "skipPunc(ch) {\n if (this.isPunc(ch)) this.input.next();\n else this.input.croak(`Expecting punctuation: '${ch}'`);\n }", "function skip_punc(char) {\n if (is_punc(char)) {\n input.next();\n } else {\n input.croak(`Expected punctuation: \"${char}\"`);\n }\n }", "function match(value)\n\t\t{\n\t\t\treturn lookahead.type === Token.Punctuator && lookahead.value === value;\n\t\t}", "function isBigPunctuator(n) {\n if (!n || n.type !== \"PunctuationNode\") {\n return false\n }\n\n switch (n.value) {\n case \".\":\n case \"…\":\n case \"?\":\n case \"!\":\n return true;\n }\n return false;\n}", "function expect$932(value$1274) {\n var token$1275 = lex$925();\n if (token$1275.type !== Token$869.Punctuator || token$1275.value !== value$1274) {\n throwUnexpected$931(token$1275);\n }\n }", "_readBlankNodePunctuation(token) {\n let next;\n switch (token.type) {\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n case ',':\n next = this._readObject;\n break;\n default:\n return this._error(`Expected punctuation to follow \"${this._object.id}\"`, token);\n }\n // A quad has been completed now, so return it\n this._emit(this._subject, this._predicate, this._object, this._graph);\n return next;\n }", "function V(){var e;return dt.type!==Xe.Punctuator?!1:(e=dt.value,\"=\"===e||\"*=\"===e||\"/=\"===e||\"%=\"===e||\"+=\"===e||\"-=\"===e||\"<<=\"===e||\">>=\"===e||\">>>=\"===e||\"&=\"===e||\"^=\"===e||\"|=\"===e)}", "_readBlankNodePunctuation(token) {\n var next;\n\n switch (token.type) {\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n\n case ',':\n next = this._readObject;\n break;\n\n default:\n return this._error('Expected punctuation to follow \"' + this._object.id + '\"', token);\n } // A quad has been completed now, so return it\n\n\n this._emit(this._subject, this._predicate, this._object, this._graph);\n\n return next;\n }", "function Z(e){return dt.type===Xe.Punctuator&&dt.value===e}", "eat(expectedTokenType) {\n try {\n if (this.currentToken && this.currentToken.type.toUpperCase() == expectedTokenType) {\n this.currentToken = this.lexer.getNextToken();\n return true;\n } else {\n let errMessage = `Expected ${expectedTokenType}: `;\n errMessage += this.currentToken ? `got ${this.currentToken.type}` : `No current token`;\n throw new ParserException(errMessage, this.currentToken);\n }\n } catch (e) {\n throw e\n }\n }", "function isPunctChar(char) {\n return UNICODE_PUNCT_RE.test(char);\n}", "function expectToken(lexer, kind) {\n var token = lexer.token;\n\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_3__[\"syntaxError\"])(lexer.source, token.start, \"Expected \".concat(kind, \", found \").concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_4__[\"getTokenDesc\"])(token)));\n}" ]
[ "0.7801693", "0.7778668", "0.7762108", "0.7759114", "0.7650924", "0.7637846", "0.75821304", "0.7418861", "0.73362464", "0.7310497", "0.72198737", "0.7217579", "0.7217579", "0.7170513", "0.71258837", "0.709807", "0.709807", "0.709807", "0.709807", "0.709807", "0.709807", "0.70860016", "0.7073789", "0.70489043", "0.70290905", "0.70290905", "0.70085883", "0.6999591", "0.6906905", "0.6906905", "0.68206733", "0.68114686", "0.6794866", "0.6794866", "0.6794866", "0.6794866", "0.6794866", "0.67612565", "0.67612565", "0.6734867", "0.6700746", "0.6691254", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.6430933", "0.6407574", "0.63923526", "0.6344422", "0.61931014", "0.6121628", "0.60285866", "0.6021282", "0.58558494", "0.5785487", "0.5699609", "0.56869113" ]
0.7039598
41
Expect the next token to match the specified keyword. If not, an exception will be thrown.
function expectKeyword(keyword) { var token = lex(); if (token.type !== Token.Keyword || token.value !== keyword) { throwUnexpected(token); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword,contextual){var token=lex();if(token.type !== (contextual?Token.Identifier:Token.Keyword) || token.value !== keyword){throwUnexpected(token);}} // Expect the next token to match the specified contextual keyword.", "function expectKeyword(keyword)\n\t\t{\n\t\t\tvar token = lex();\n\t\t\tif (token.type !== Token.Keyword || token.value !== keyword)\n\t\t\t{\n\t\t\t\tthrowUnexpectedToken(token);\n\t\t\t}\n\t\t}", "function expectKeyword(keyword) {\n\t var token = lex();\n\t if (token.type !== Token.Keyword || token.value !== keyword) {\n\t throwUnexpectedToken(token);\n\t }\n\t }", "function expectKeyword(kw) {\n if (matchKeyword(kw)) next()\n else raise(`Expecting keyword: [${kw}]`)\n }", "function expectKeyword(keyword) {\n var token = lex();\n\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpected(token);\n }\n } // Return true if the next token matches the specified punctuator.", "function expect(value){var token=lex();if(token.type !== Token.Punctuator || token.value !== value){throwUnexpected(token);}} // Expect the next token to match the specified keyword.", "function expectKeyword(keyword, contextual) {\n var token = lex();\n if (token.type !== (contextual ? Token.Identifier : Token.Keyword) ||\n token.value !== keyword) {\n throwUnexpected(token);\n }\n }", "function expectKeyword(keyword, contextual) {\n var token = lex();\n if (token.type !== (contextual ? Token.Identifier : Token.Keyword) ||\n token.value !== keyword) {\n throwUnexpected(token);\n }\n }", "function expectKeyword(keyword, contextual) {\n var token = lex();\n if (token.type !== (contextual ? Token.Identifier : Token.Keyword) ||\n token.value !== keyword) {\n throwUnexpected(token);\n }\n }", "function expectKeyword(keyword, contextual) {\n var token = lex();\n if (token.type !== (contextual ? Token.Identifier : Token.Keyword) ||\n token.value !== keyword) {\n throwUnexpected(token);\n }\n }", "function expectKeyword(keyword, contextual) {\n var token = lex();\n if (token.type !== (contextual ? Token.Identifier : Token.Keyword) ||\n token.value !== keyword) {\n throwUnexpected(token);\n }\n }", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n\n if (token.kind === _lexer__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_2__[\"syntaxError\"])(lexer.source, token.start, \"Expected \\\"\".concat(value, \"\\\", found \").concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_3__[\"getTokenDesc\"])(token)));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n\n if (token.kind === _lexer__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_3__[\"syntaxError\"])(lexer.source, token.start, \"Expected \\\"\".concat(value, \"\\\", found \").concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_4__[\"getTokenDesc\"])(token)));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n\n if (token.kind === _lexer__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_3__[\"syntaxError\"])(lexer.source, token.start, \"Expected \\\"\".concat(value, \"\\\", found \").concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_4__[\"getTokenDesc\"])(token)));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n\n if (token.kind === _tokenKind__WEBPACK_IMPORTED_MODULE_4__[\"TokenKind\"].NAME && token.value === value) {\n lexer.advance();\n } else {\n throw Object(_error_syntaxError__WEBPACK_IMPORTED_MODULE_3__[\"syntaxError\"])(lexer.source, token.start, \"Expected \\\"\".concat(value, \"\\\", found \").concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_5__[\"getTokenDesc\"])(token)));\n }\n}", "function expectContextualKeyword(keyword){return expectKeyword(keyword,true);} // Return true if the next token matches the specified punctuator.", "function expect(value) {\n var token = lex();\n\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n } // Expect the next token to match the specified keyword.", "function matchKeyword(keyword) {\n return lookahead.type === TokenKeyword && lookahead.value === keyword;\n}", "function matchKeyword(keyword) {\n return lookahead.type === TokenKeyword && lookahead.value === keyword;\n}", "function matchKeyword(keyword) {\n var token = lookahead();\n return token.type === Token.Keyword && token.value === keyword;\n }", "function matchKeyword(keyword) {\n var token = lookahead();\n return token.type === Token.Keyword && token.value === keyword;\n }", "function matchKeyword(keyword) {\n var token = lookahead();\n return token.type === Token.Keyword && token.value === keyword;\n }", "function matchKeyword(keyword) {\n var token = lookahead();\n return token.type === Token.Keyword && token.value === keyword;\n }", "function matchKeyword(keyword) {\n var token = lookahead();\n return token.type === Token.Keyword && token.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === TokenKeyword && lookahead.value === keyword;\n }", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n\n throw (0, _error.syntaxError)(lexer.source, token.start, \"Expected \\\"\".concat(value, \"\\\", found \").concat((0, _lexer.getTokenDesc)(token)));\n}", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function expectKeyword(parser, value) {\n var token = parser.token;\n if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n advance(parser);\n return token;\n }\n throw (0, _error.syntaxError)(parser.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n}", "function matchKeyword(keyword) {\n\t return lookahead.type === Token.Keyword && lookahead.value === keyword;\n\t }", "expectKeyword(value) {\n const token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this._lexer.advance();\n } else {\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Expected \"${value}\", found ${getTokenDesc(token)}.`,\n );\n }\n }", "function expectKeyword(lexer, value) {\n\t var token = lexer.token;\n\t if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n\t lexer.advance();\n\t return token;\n\t }\n\t throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n\t}", "function expectKeyword(lexer, value) {\n\t var token = lexer.token;\n\t if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n\t lexer.advance();\n\t return token;\n\t }\n\t throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n\t}", "function expectKeyword(lexer, value) {\n var token = lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n lexer.advance();\n return token;\n }\n\n throw syntaxError(lexer.source, token.start, \"Expected \\\"\".concat(value, \"\\\", found \").concat(getTokenDesc(token)));\n}", "function expectContextualKeyword(keyword) {\n return expectKeyword(keyword, true);\n }", "function expectContextualKeyword(keyword) {\n return expectKeyword(keyword, true);\n }", "function expectContextualKeyword(keyword) {\n return expectKeyword(keyword, true);\n }", "function expectContextualKeyword(keyword) {\n return expectKeyword(keyword, true);\n }", "function expectKeyword$933(keyword$1276) {\n var token$1277 = lex$925();\n if (token$1277.type !== Token$869.Keyword || token$1277.value !== keyword$1276) {\n throwUnexpected$931(token$1277);\n }\n }", "function expectContextualKeyword(keyword) {\n return expectKeyword(keyword, true);\n }", "function expectKeyword(parser, value) {\n\t var token = parser.token;\n\t if (token.kind === _lexer.TokenKind.NAME && token.value === value) {\n\t advance(parser);\n\t return token;\n\t }\n\t throw (0, _error.syntaxError)(parser.source, token.start, 'Expected \"' + value + '\", found ' + (0, _lexer.getTokenDesc)(token));\n\t}", "function expectKeyword(lexer$$1, value) {\n var token = lexer$$1.token;\n if (token.kind === lexer.TokenKind.NAME && token.value === value) {\n lexer$$1.advance();\n return token;\n }\n throw (0, error.syntaxError)(lexer$$1.source, token.start, 'Expected \"' + value + '\", found ' + (0, lexer.getTokenDesc)(token));\n}", "function matchKeyword(keyword) {\n\t return lookahead.type === Token.Keyword && lookahead.value === keyword;\n\t }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function Y(e){var t=M();(t.type!==Xt.Punctuator||t.value!==e)&&W(t)}// Expect the next token to match the specified keyword.", "function matchKeyword(keyword)\n\t\t{\n\t\t\treturn lookahead.type === Token.Keyword && lookahead.value === keyword;\n\t\t}", "function matchKeyword(keyword, contextual) {\n var expectedType = contextual ? Token.Identifier : Token.Keyword;\n return lookahead.type === expectedType && lookahead.value === keyword;\n }", "function matchKeyword(keyword, contextual) {\n var expectedType = contextual ? Token.Identifier : Token.Keyword;\n return lookahead.type === expectedType && lookahead.value === keyword;\n }" ]
[ "0.8155771", "0.81005055", "0.81005055", "0.81005055", "0.81005055", "0.81005055", "0.81005055", "0.8097621", "0.8045432", "0.8024153", "0.79775137", "0.79143566", "0.76446414", "0.76335007", "0.76152503", "0.76152503", "0.76152503", "0.76152503", "0.73900604", "0.7388385", "0.7388385", "0.73159266", "0.7283401", "0.7236679", "0.7217338", "0.7217338", "0.71874434", "0.71874434", "0.71874434", "0.71874434", "0.71874434", "0.7179633", "0.7175216", "0.7175216", "0.7175216", "0.7175216", "0.7175216", "0.7175216", "0.7175216", "0.7175216", "0.7175216", "0.7175216", "0.7115379", "0.71119004", "0.71119004", "0.71115905", "0.7103133", "0.7103013", "0.710008", "0.70962626", "0.70962626", "0.7080837", "0.7059281", "0.7059281", "0.7059281", "0.7059281", "0.7047767", "0.70469517", "0.70042807", "0.7003158", "0.6994505", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.698073", "0.6945428", "0.67656493", "0.6672559", "0.6658318" ]
0.8070497
21
Return true if the next token matches the specified punctuator.
function match(value) { return lookahead.type === Token.Punctuator && lookahead.value === value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function G(e){var t=M();(t.type!==Xt.Keyword||t.value!==e)&&W(t)}// Return true if the next token matches the specified punctuator.", "function isPunctuatorToken(token) {\n var kind = token.kind;\n return kind === _tokenKind.TokenKind.BANG || kind === _tokenKind.TokenKind.DOLLAR || kind === _tokenKind.TokenKind.AMP || kind === _tokenKind.TokenKind.PAREN_L || kind === _tokenKind.TokenKind.PAREN_R || kind === _tokenKind.TokenKind.SPREAD || kind === _tokenKind.TokenKind.COLON || kind === _tokenKind.TokenKind.EQUALS || kind === _tokenKind.TokenKind.AT || kind === _tokenKind.TokenKind.BRACKET_L || kind === _tokenKind.TokenKind.BRACKET_R || kind === _tokenKind.TokenKind.BRACE_L || kind === _tokenKind.TokenKind.PIPE || kind === _tokenKind.TokenKind.BRACE_R;\n}", "function isPunctuatorToken(token) {\n var kind = token.kind;\n return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R;\n}", "function isPunctuatorToken(token) {\n var kind = token.kind;\n return kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BANG || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].DOLLAR || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].AMP || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].PAREN_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].PAREN_R || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].SPREAD || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].COLON || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].EQUALS || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].AT || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACKET_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACKET_R || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACE_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].PIPE || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACE_R;\n}", "function isPunctuatorToken(token) {\n var kind = token.kind;\n return kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BANG || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].DOLLAR || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].AMP || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PAREN_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PAREN_R || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].SPREAD || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].COLON || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].EQUALS || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].AT || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACKET_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACKET_R || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACE_L || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PIPE || kind === _tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACE_R;\n}", "function checkPunctuators(token, values) {\n return token.type === \"(punctuator)\" && _.contains(values, token.value);\n }", "function expectContextualKeyword(keyword){return expectKeyword(keyword,true);} // Return true if the next token matches the specified punctuator.", "function match(value) {\n var token = lookahead();\n return token.type === Token.Punctuator && token.value === value;\n }", "function match(value) {\n var token = lookahead();\n return token.type === Token.Punctuator && token.value === value;\n }", "function match(value) {\n var token = lookahead();\n return token.type === Token.Punctuator && token.value === value;\n }", "function match(value) {\n var token = lookahead();\n return token.type === Token.Punctuator && token.value === value;\n }", "function match(value) {\n var token = lookahead();\n return token.type === Token.Punctuator && token.value === value;\n }", "function match(value) {\n\t return lookahead.type === Token.Punctuator && lookahead.value === value;\n\t }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n\t return lookahead.type === Token.Punctuator && lookahead.value === value;\n\t }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }", "function expect(value) {\n var token = lex();\n\n if (token.type !== TokenPunctuator || token.value !== value) {\n throwUnexpected(token);\n }\n } // Return true if the next token matches the specified punctuator.", "function match(value)\n\t\t{\n\t\t\treturn lookahead.type === Token.Punctuator && lookahead.value === value;\n\t\t}", "function match(value) {\n return lookahead.type === TokenPunctuator && lookahead.value === value;\n}", "function match(value) {\n return lookahead.type === TokenPunctuator && lookahead.value === value;\n}", "function match(value) {\n return lookahead.type === TokenPunctuator && lookahead.value === value;\n }", "function isBigPunctuator(n) {\n if (!n || n.type !== \"PunctuationNode\") {\n return false\n }\n\n switch (n.value) {\n case \".\":\n case \"…\":\n case \"?\":\n case \"!\":\n return true;\n }\n return false;\n}", "function isPunctChar(char) {\n return UNICODE_PUNCT_RE.test(char);\n}", "function expect(value){var token=lex();if(token.type !== Token.Punctuator || token.value !== value){throwUnexpected(token);}} // Expect the next token to match the specified keyword.", "function expectKeyword(keyword) {\n var token = lex();\n\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpected(token);\n }\n } // Return true if the next token matches the specified punctuator.", "function isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}", "function isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}", "function isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}", "function isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}", "function isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}", "function isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}", "function isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}", "function isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}", "function isPunctChar(ch) {\n\t return UNICODE_PUNCT_RE.test(ch);\n\t}", "function Y(e){var t=M();(t.type!==Xt.Punctuator||t.value!==e)&&W(t)}// Expect the next token to match the specified keyword.", "function isPunctChar(ch) {\n return regex.test(ch);\n}", "function isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n} // Markdown ASCII punctuation characters.", "function isPunctChar(ch) {\n return regex$4.test(ch);\n }", "function is_punc(char) {\n var tok = input.peek();\n return tok && tok.type === \"punc\" && (!char || tok.value === char) && tok; \n }", "isPunc(ch) {\n const tok = this.input.peek();\n return tok && tok.type === \"punc\" && (!ch || tok.value === ch) && tok;\n }", "function V(){var e;return dt.type!==Xe.Punctuator?!1:(e=dt.value,\"=\"===e||\"*=\"===e||\"/=\"===e||\"%=\"===e||\"+=\"===e||\"-=\"===e||\"<<=\"===e||\">>=\"===e||\">>>=\"===e||\"&=\"===e||\"^=\"===e||\"|=\"===e)}", "function isTokenChar(c){\n\tvar tokenPattern = /[\\s]+/;\n\treturn tokenPattern.test(c);\n}", "isToken(symbol) {\n return this.isTerminal(symbol) ||\n this.getLexVars().indexOf(symbol) !== -1;\n }", "function Z(e){return dt.type===Xe.Punctuator&&dt.value===e}", "function expect(value) {\n var token = lex();\n\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n } // Expect the next token to match the specified keyword.", "function expect(value) {\n\t var token = lex();\n\t if (token.type !== Token.Punctuator || token.value !== value) {\n\t throwUnexpected(token);\n\t }\n\t }", "function peek(tok) {\n if (typeof(tok) === 'string') {\n return input.charAt(i) === tok;\n } else {\n return !!tok.test(chunks[j]);\n }\n }", "function is_punc(char) {\n return \",;(){}[]\".indexOf(char) >= 0;\n }", "function hasCurrentCharacter(tokenizer) {\n return tokenizer._currentIndex < tokenizer._textLength;\n}", "function hasCurrentCharacter(tokenizer) {\n return tokenizer._currentIndex < tokenizer._textLength;\n}", "function needsSpaceAfter(token, lastToken) {\n if (lastToken) {\n if (lastToken.type.isLoop) {\n return true;\n }\n if (lastToken.type.isAssign) {\n return true;\n }\n if (lastToken.type.binop != null) {\n return true;\n }\n\n var ltt = lastToken.type.label;\n if (ltt == \"?\") {\n return true;\n }\n if (ltt == \":\") {\n return true;\n }\n if (ltt == \",\") {\n return true;\n }\n if (ltt == \";\") {\n return true;\n }\n if (ltt == \"${\") {\n return true;\n }\n if (ltt == \"num\" && token.type.label == \".\") {\n return true;\n }\n\n var ltk = lastToken.type.keyword;\n var ttl = token.type.label;\n if (ltk != null && ttl != \".\") {\n if (ltk == \"break\" || ltk == \"continue\" || ltk == \"return\") {\n return token.type.label != \";\";\n }\n if (ltk != \"debugger\"\n && ltk != \"null\"\n && ltk != \"true\"\n && ltk != \"false\"\n && ltk != \"this\"\n && ltk != \"default\") {\n return true;\n }\n }\n\n if (ltt == \")\" && (token.type.label != \")\"\n && token.type.label != \"]\"\n && token.type.label != \";\"\n && token.type.label != \",\"\n && token.type.label != \".\")) {\n return true;\n }\n\n if (isIdentifierLike(token) && isIdentifierLike(lastToken)) {\n // We must emit a space to avoid merging the tokens.\n return true;\n }\n\n if (token.type.label == \"{\" && lastToken.type.label == \"name\") {\n return true;\n }\n }\n\n if (token.type.isAssign) {\n return true;\n }\n if (token.type.binop != null && lastToken) {\n return true;\n }\n if (token.type.label == \"?\") {\n return true;\n }\n\n return false;\n }", "hasMoreTokens () {\n return this.currentTokenIndex + 1 < this.tokens.length\n }", "function expect(value) {\n\t var token = lex();\n\t if (token.type !== Token.Punctuator || token.value !== value) {\n\t throwUnexpectedToken(token);\n\t }\n\t }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value)\n\t\t{\n\t\t\tvar token = lex();\n\t\t\tif (token.type !== Token.Punctuator || token.value !== value)\n\t\t\t{\n\t\t\t\tthrowUnexpectedToken(token);\n\t\t\t}\n\t\t}", "function match(currentToken, expectedToken) {\n if (currentToken.value.match(expectedToken.pattern)) {\n\n return true;\n\n } else {\n\n false;\n\n }\n }", "function hasCurrentCharacter(tokenizer) {\n return tokenizer._currentIndex < tokenizer._textLength;\n }", "static isValidToken (token) {\n\t\tif (!token || typeof token !== \"string\" || !token.trim()) return false;\n\t\treturn !!/{::[^:]+::}/.exec(token);\n\t}", "function match$934(value$1278) {\n return lookahead$891.type === Token$869.Punctuator && lookahead$891.value === value$1278;\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpectedToken(token);\n }\n }", "get isNextTokenColon() {\n\t\twhile(!this.isEnd)\n\t\t{\n\t\t\tvar nextChar = this.peekChar(0);\n\n\t\t\tif(jsc.TextUtils.isWhitespace(nextChar) || jsc.TextUtils.isLineTerminator(nextChar))\n\t\t\t{\n\t\t\t\tthis.position++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\treturn (this.getChar() === ':');\n\t}", "function isReservedWord(token) {\n\treturn token === \"T\" || token === \"F\" || token === \"and\" || token === \"or\" ||\n\t token === \"not\" || token === \"iff\" || token === \"implies\" ||\n\t token === \"true\" || token === \"false\";\n}", "function contains(token) {\n\t\t\t\t\ttoken = generalTokenChecks(token);\n\n\t\t\t\t\t//Split the underlying string on spaces to get the list of tokens.\n\t\t\t\t\tvar tokenList = splitUnderlyingString.call(this);\n\n\t\t\t\t\t//Return true if token is a case-sensitive match for one of the tokens in the list \n\t\t\t\t\t//found in the previous step, or false otherwise\n\t\t\t\t\tfor (var i = 0; i < tokenList.length; i++) {\n\t\t\t\t\t\tif (tokenList[i] === token) {\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\treturn false;\n\t\t\t\t}", "function _isComparsion(token){\n\t\treturn token.type === \"operator\" && /!=|==|>=|>|<|<=/.test(token.content);\n\t}", "isTokenType(type) { return this.lexeme[type] !== undefined }", "function matchOp() {\n\t\tvar pattern = /^(\\+|-)/;\n\t\tvar x = lexString.match(pattern);\n\t\tif(x !== null) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "function containsDelimiter(word)\r\n{\r\n for(var i = 0; i < DELIMITERS.length; i++)\r\n {\r\n if(word.includes(DELIMITERS[i])) return true;\r\n }\r\n return false;\r\n}", "skipPunc(ch) {\n if (this.isPunc(ch)) this.input.next();\n else this.input.croak(`Expecting punctuation: '${ch}'`);\n }" ]
[ "0.81115025", "0.7977586", "0.7975386", "0.78996557", "0.78870416", "0.75935584", "0.75342286", "0.7402483", "0.7402483", "0.7402483", "0.7402483", "0.7402483", "0.7318751", "0.7315256", "0.7315256", "0.7219272", "0.71747214", "0.7152664", "0.7146625", "0.7103193", "0.7091807", "0.7091807", "0.70910376", "0.67414796", "0.6654991", "0.64370275", "0.64086676", "0.6391552", "0.6391552", "0.6391552", "0.6391552", "0.6391552", "0.6391552", "0.6391552", "0.6391552", "0.63817346", "0.6365297", "0.63136756", "0.6307663", "0.6273678", "0.6140932", "0.6089147", "0.6011344", "0.5973666", "0.59625673", "0.5836589", "0.57414985", "0.5645856", "0.5641367", "0.562335", "0.56142265", "0.56142265", "0.5585131", "0.5560989", "0.55520433", "0.5540844", "0.55354166", "0.5516573", "0.5485606", "0.54640836", "0.5462621", "0.5427813", "0.5427813", "0.54182065", "0.54182065", "0.54182065", "0.54182065", "0.54182065", "0.54182065", "0.54106045", "0.5409633", "0.54025334", "0.53872067", "0.538373", "0.5370736", "0.5332821", "0.5320041" ]
0.71755666
36
Return true if the next token matches the specified keyword
function matchKeyword(keyword) { return lookahead.type === Token.Keyword && lookahead.value === keyword; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function matchKeyword(keyword) {\n var token = lookahead();\n return token.type === Token.Keyword && token.value === keyword;\n }", "function matchKeyword(keyword) {\n var token = lookahead();\n return token.type === Token.Keyword && token.value === keyword;\n }", "function matchKeyword(keyword) {\n var token = lookahead();\n return token.type === Token.Keyword && token.value === keyword;\n }", "function matchKeyword(keyword) {\n var token = lookahead();\n return token.type === Token.Keyword && token.value === keyword;\n }", "function matchKeyword(keyword) {\n var token = lookahead();\n return token.type === Token.Keyword && token.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === TokenKeyword && lookahead.value === keyword;\n}", "function matchKeyword(keyword) {\n return lookahead.type === TokenKeyword && lookahead.value === keyword;\n}", "function matchKeyword(keyword) {\n return lookahead.type === TokenKeyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n\t return lookahead.type === Token.Keyword && lookahead.value === keyword;\n\t }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n\t return lookahead.type === Token.Keyword && lookahead.value === keyword;\n\t }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }", "function matchKeyword(keyword)\n\t\t{\n\t\t\treturn lookahead.type === Token.Keyword && lookahead.value === keyword;\n\t\t}", "isKeyword(word) { return this.keywords.test(word) }", "function matchKeyword(kw) {\n const tok = peek()\n return tok.type === Token.Keyword && tok.value === kw\n }", "function expectContextualKeyword(keyword){return expectKeyword(keyword,true);} // Return true if the next token matches the specified punctuator.", "function matchKeyword(keyword, contextual) {\n var expectedType = contextual ? Token.Identifier : Token.Keyword;\n return lookahead.type === expectedType && lookahead.value === keyword;\n }", "function matchKeyword(keyword, contextual) {\n var expectedType = contextual ? Token.Identifier : Token.Keyword;\n return lookahead.type === expectedType && lookahead.value === keyword;\n }", "function matchKeyword(keyword, contextual) {\n var expectedType = contextual ? Token.Identifier : Token.Keyword;\n return lookahead.type === expectedType && lookahead.value === keyword;\n }", "function matchKeyword(keyword, contextual) {\n var expectedType = contextual ? Token.Identifier : Token.Keyword;\n return lookahead.type === expectedType && lookahead.value === keyword;\n }", "function matchKeyword(keyword, contextual) {\n var expectedType = contextual ? Token.Identifier : Token.Keyword;\n return lookahead.type === expectedType && lookahead.value === keyword;\n }", "function expectKeyword(keyword) {\n var token = lex();\n\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpected(token);\n }\n } // Return true if the next token matches the specified punctuator.", "isKeyword() {\n let text = this._value;\n return IdentifierState.keywords.find(elem => {\n return elem === text;\n });\n }", "function Y(e){var t=M();(t.type!==Xt.Punctuator||t.value!==e)&&W(t)}// Expect the next token to match the specified keyword.", "function expectKeyword(keyword,contextual){var token=lex();if(token.type !== (contextual?Token.Identifier:Token.Keyword) || token.value !== keyword){throwUnexpected(token);}} // Expect the next token to match the specified contextual keyword.", "match(tokenKind) {\n if (this.check(tokenKind)) {\n this.current++; //advance\n return true;\n }\n return false;\n }", "function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }", "function matchContextualKeyword(keyword) {\n return matchKeyword(keyword, true);\n }", "function matchContextualKeyword(keyword) {\n return matchKeyword(keyword, true);\n }", "function matchContextualKeyword(keyword) {\n return matchKeyword(keyword, true);\n }", "function matchContextualKeyword(keyword) {\n return matchKeyword(keyword, true);\n }", "function matchContextualKeyword(keyword) {\n return matchKeyword(keyword, true);\n }", "function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }", "function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }", "function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }", "function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }", "function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }", "function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }", "function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }", "function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }", "function matchContextualKeyword(keyword) {\n return lookahead.type === Token.Identifier && lookahead.value === keyword;\n }", "function matchContextualKeyword(keyword) {\n\t return lookahead.type === Token.Identifier && lookahead.value === keyword;\n\t }", "function matchKeyword$935(keyword$1279) {\n return lookahead$891.type === Token$869.Keyword && lookahead$891.value === keyword$1279;\n }", "function match(currentToken, expectedToken) {\n if (currentToken.value.match(expectedToken.pattern)) {\n\n return true;\n\n } else {\n\n false;\n\n }\n }", "matchAny(...tokenKinds) {\n for (let tokenKind of tokenKinds) {\n if (this.check(tokenKind)) {\n this.current++; //advance\n return true;\n }\n }\n return false;\n }", "function keywordMatch(mode, keywords) {\n var keyword = keywords[0];\n\n if (language[KEY_INSENSITIVE]) {\n keyword = keyword.toLowerCase();\n }\n\n return own.call(mode.keywords, keyword) && mode.keywords[keyword];\n }", "function keywordMatch(mode, keywords) {\n var keyword = keywords[0]\n\n if (language[keyInsensitive]) {\n keyword = keyword.toLowerCase()\n }\n\n return own.call(mode.keywords, keyword) && mode.keywords[keyword]\n }", "function match(data, keyword) {\n\t if (typeof data === 'number') {\n\t data = '' + data;\n\t }\n\t if (typeof data === 'string') {\n\t return data.toLowerCase().indexOf(keyword) !== -1;\n\t }\n\t if (typeof data !== 'object' || data === null) {\n\t return false;\n\t }\n\t if (data instanceof Array) {\n\t for (let i = 0; i < data.length; i++) {\n\t if (match(data[i], keyword)) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t }\n\t for (const key in data) {\n\t if (match(data[key], keyword)) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t}", "function expect(value){var token=lex();if(token.type !== Token.Punctuator || token.value !== value){throwUnexpected(token);}} // Expect the next token to match the specified keyword.", "function is_keyword(x) {\n return keywords.indexOf(` ${x} `) >= 0;\n }", "function contains(token) {\n\t\t\t\t\ttoken = generalTokenChecks(token);\n\n\t\t\t\t\t//Split the underlying string on spaces to get the list of tokens.\n\t\t\t\t\tvar tokenList = splitUnderlyingString.call(this);\n\n\t\t\t\t\t//Return true if token is a case-sensitive match for one of the tokens in the list \n\t\t\t\t\t//found in the previous step, or false otherwise\n\t\t\t\t\tfor (var i = 0; i < tokenList.length; i++) {\n\t\t\t\t\t\tif (tokenList[i] === token) {\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\treturn false;\n\t\t\t\t}", "function wordMatch(word,offset) {\n if (offset==undefined) offset = -1;\n var i=0;\n for (;i<word.length && json.charAt(at+i+offset)==word.charAt(i);i++) {}\n if (i>=word.length) {\n at += offset+i;\n next();\n return true;\n }\n return false;\n }", "function G(e){var t=M();(t.type!==Xt.Keyword||t.value!==e)&&W(t)}// Return true if the next token matches the specified punctuator.", "function is_kw(kw) {\n var tok = input.peek();\n return tok && tok.type === \"kw\" && (!kw || tok.value === kw) && tok; \n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function peek(tok) {\n if (typeof(tok) === 'string') {\n return input.charAt(i) === tok;\n } else {\n return !!tok.test(chunks[j]);\n }\n }", "function isWordFound(phrase, word) {\n var tokenObjs = nlp.tokenize(phrase);\n //console.log(\"tokenObjs = \", tokenObjs);\n var tokens = tokenObjs[0].tokens.map(obj => obj.text);\n //console.log(\"tokens = \", tokens);\n return (tokens.indexOf(word) !== -1);\n }", "function expectKeyword(keyword)\n\t\t{\n\t\t\tvar token = lex();\n\t\t\tif (token.type !== Token.Keyword || token.value !== keyword)\n\t\t\t{\n\t\t\t\tthrowUnexpectedToken(token);\n\t\t\t}\n\t\t}", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpectedToken(token);\n }\n }", "function expectKeyword(keyword) {\n\t var token = lex();\n\t if (token.type !== Token.Keyword || token.value !== keyword) {\n\t throwUnexpectedToken(token);\n\t }\n\t }", "function sc_isKeyword(s) {\n return (typeof s === \"string\") &&\n\t(s.charAt(0) === sc_KEYWORD_PREFIX);\n}", "function expectContextualKeyword(keyword) {\n return expectKeyword(keyword, true);\n }", "function isExpressionKeyword (pos) {\r\n switch (source.charCodeAt(pos)) {\r\n case 100/*d*/:\r\n switch (source.charCodeAt(pos - 1)) {\r\n case 105/*i*/:\r\n // void\r\n return readPrecedingKeyword(pos - 2, 'vo');\r\n case 108/*l*/:\r\n // yield\r\n return readPrecedingKeyword(pos - 2, 'yie');\r\n default:\r\n return false;\r\n }\r\n case 101/*e*/:\r\n switch (source.charCodeAt(pos - 1)) {\r\n case 115/*s*/:\r\n switch (source.charCodeAt(pos - 2)) {\r\n case 108/*l*/:\r\n // else\r\n return readPrecedingKeyword1(pos - 3, 101/*e*/);\r\n case 97/*a*/:\r\n // case\r\n return readPrecedingKeyword1(pos - 3, 99/*c*/);\r\n default:\r\n return false;\r\n }\r\n case 116/*t*/:\r\n // delete\r\n return readPrecedingKeyword(pos - 2, 'dele');\r\n default:\r\n return false;\r\n }\r\n case 102/*f*/:\r\n if (source.charCodeAt(pos - 1) !== 111/*o*/ || source.charCodeAt(pos - 2) !== 101/*e*/)\r\n return false;\r\n switch (source.charCodeAt(pos - 3)) {\r\n case 99/*c*/:\r\n // instanceof\r\n return readPrecedingKeyword(pos - 4, 'instan');\r\n case 112/*p*/:\r\n // typeof\r\n return readPrecedingKeyword(pos - 4, 'ty');\r\n default:\r\n return false;\r\n }\r\n case 110/*n*/:\r\n // in, return\r\n return readPrecedingKeyword1(pos - 1, 105/*i*/) || readPrecedingKeyword(pos - 1, 'retur');\r\n case 111/*o*/:\r\n // do\r\n return readPrecedingKeyword1(pos - 1, 100/*d*/);\r\n case 114/*r*/:\r\n // debugger\r\n return readPrecedingKeyword(pos - 1, 'debugge');\r\n case 116/*t*/:\r\n // await\r\n return readPrecedingKeyword(pos - 1, 'awai');\r\n case 119/*w*/:\r\n switch (source.charCodeAt(pos - 1)) {\r\n case 101/*e*/:\r\n // new\r\n return readPrecedingKeyword1(pos - 2, 110/*n*/);\r\n case 111/*o*/:\r\n // throw\r\n return readPrecedingKeyword(pos - 2, 'thr');\r\n default:\r\n return false;\r\n }\r\n }\r\n return false;\r\n }", "firstToken({token, counter}) {\n\t\tif (token.name === 'AND') {\n\t\t\tthis.listener.candidates = this.listener.candidates.filter(c=> c.name === 'AND');\n\t\t\tthis.listener.checking = 'middleTokens';\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function contains(words, token)\n{\n\ttoken = token.toLowerCase()\n\tfor (var i = 0; i < words.length; i++)\n\t{\n\t\tvar w = words[i].toLowerCase()\n\t\t//console.log(w)\n\t\t//console.log(w + \" \" + token + \" \" + token.replace(\"/\\W/g\", '') + \" \" + levenstein(w, token) + \" \" + levenstein(w, token.replace(/\\W/g, '')))\n\t\tif (token == w) return i + 1\n\t\tif (levenstein(w, token) <= 0.3 || levenstein(w, token.replace(/\\W/g, '')) <= 0.3)\n\t\t{\n\t\t\tif (token.length > 2)\n\t\t\t\treturn i + 1 // || levenstein(w, token.replace(/\\W/g, '')) <= 0.3) return true\n\t\t}\n\t}\n\n\treturn false\n}", "function expectContextualKeyword(keyword) {\n return expectKeyword(keyword, true);\n }", "function expectContextualKeyword(keyword) {\n return expectKeyword(keyword, true);\n }", "function expectContextualKeyword(keyword) {\n return expectKeyword(keyword, true);\n }", "function expectContextualKeyword(keyword) {\n return expectKeyword(keyword, true);\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpected(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpected(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpected(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpected(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpected(token);\n }\n }", "function expectKeyword(keyword) {\n var token = lex();\n if (token.type !== Token.Keyword || token.value !== keyword) {\n throwUnexpected(token);\n }\n }" ]
[ "0.7892951", "0.7892951", "0.7892951", "0.7892951", "0.7892951", "0.7697651", "0.7697651", "0.7678987", "0.76190984", "0.76168966", "0.75312674", "0.7516023", "0.7516023", "0.74989873", "0.7440836", "0.7424621", "0.7352427", "0.72979057", "0.72525215", "0.72525215", "0.72525215", "0.72525215", "0.70192206", "0.69131035", "0.67993915", "0.67163366", "0.66449857", "0.6629756", "0.66167444", "0.6600262", "0.6600262", "0.6600262", "0.6600262", "0.6581075", "0.6581075", "0.6581075", "0.6581075", "0.6581075", "0.6581075", "0.6581075", "0.6581075", "0.6581075", "0.65503085", "0.65263516", "0.6507981", "0.6504583", "0.64825916", "0.6449775", "0.6438923", "0.6429546", "0.64097697", "0.63286877", "0.630458", "0.6260858", "0.6232006", "0.6193787", "0.614536", "0.6126144", "0.6091777", "0.6090543", "0.6090543", "0.6090543", "0.6090543", "0.6090543", "0.6090543", "0.6069256", "0.59916675", "0.5983539", "0.59774715", "0.5972679", "0.59586626", "0.59482557", "0.59482557", "0.59482557", "0.59482557", "0.5943013", "0.5943013", "0.5943013", "0.5943013", "0.5943013", "0.5943013" ]
0.75327355
26
Return true if the next token is an assignment operator
function matchAssign() { var op; if (lookahead.type !== Token.Punctuator) { return false; } op = lookahead.value; return op === '=' || op === '*=' || op === '/=' || op === '%=' || op === '+=' || op === '-=' || op === '<<=' || op === '>>=' || op === '>>>=' || op === '&=' || op === '^=' || op === '|='; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_isAssignmentOperator(tokenType) {\n return tokenType === 'SIMPLE_ASSIGN' || tokenType === 'COMPLEX_ASSIGN';\n }", "function matchAssign() {\n var token = lookahead(),\n op = token.value;\n\n if (token.type !== Token.Punctuator) {\n return false;\n }\n return op === '=' ||\n op === '*=' ||\n op === '/=' ||\n op === '%=' ||\n op === '+=' ||\n op === '-=' ||\n op === '<<=' ||\n op === '>>=' ||\n op === '>>>=' ||\n op === '&=' ||\n op === '^=' ||\n op === '|=';\n }", "function matchAssign() {\n var token = lookahead(),\n op = token.value;\n\n if (token.type !== Token.Punctuator) {\n return false;\n }\n return op === '=' ||\n op === '*=' ||\n op === '/=' ||\n op === '%=' ||\n op === '+=' ||\n op === '-=' ||\n op === '<<=' ||\n op === '>>=' ||\n op === '>>>=' ||\n op === '&=' ||\n op === '^=' ||\n op === '|=';\n }", "function matchAssign() {\n var token = lookahead(),\n op = token.value;\n\n if (token.type !== Token.Punctuator) {\n return false;\n }\n return op === '=' ||\n op === '*=' ||\n op === '/=' ||\n op === '%=' ||\n op === '+=' ||\n op === '-=' ||\n op === '<<=' ||\n op === '>>=' ||\n op === '>>>=' ||\n op === '&=' ||\n op === '^=' ||\n op === '|=';\n }", "function matchAssign() {\n var token = lookahead(),\n op = token.value;\n\n if (token.type !== Token.Punctuator) {\n return false;\n }\n return op === '=' ||\n op === '*=' ||\n op === '/=' ||\n op === '%=' ||\n op === '+=' ||\n op === '-=' ||\n op === '<<=' ||\n op === '>>=' ||\n op === '>>>=' ||\n op === '&=' ||\n op === '^=' ||\n op === '|=';\n }", "function matchAssign() {\n var token = lookahead(),\n op = token.value;\n\n if (token.type !== Token.Punctuator) {\n return false;\n }\n return op === '=' ||\n op === '*=' ||\n op === '/=' ||\n op === '%=' ||\n op === '+=' ||\n op === '-=' ||\n op === '<<=' ||\n op === '>>=' ||\n op === '>>>=' ||\n op === '&=' ||\n op === '^=' ||\n op === '|=';\n }", "function matchAssign()\n\t\t{\n\t\t\tvar op;\n\t\t\tif (lookahead.type !== Token.Punctuator)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\top = lookahead.value;\n\t\t\treturn op === '=' || op === '*=' || op === '/=' || op === '%=' || op === '+=' || op === '-=' || op === '<<=' || op === '>>=' || op === '>>>=' || op === '&=' || op === '^=' || op === '|=';\n\t\t}", "function matchAssign() {\n var op;\n \n if (lookahead.type !== Token.Punctuator) {\n return false;\n }\n op = lookahead.value;\n return op === '=' ||\n op === '*=' ||\n op === '/=' ||\n op === '%=' ||\n op === '+=' ||\n op === '-=' ||\n op === '<<=' ||\n op === '>>=' ||\n op === '>>>=' ||\n op === '&=' ||\n op === '^=' ||\n op === '|=';\n }", "function matchAssign() {\n var op;\n\n if (lookahead.type !== Token.Punctuator) {\n return false;\n }\n op = lookahead.value;\n return op === '=' ||\n op === '*=' ||\n op === '/=' ||\n op === '%=' ||\n op === '+=' ||\n op === '-=' ||\n op === '<<=' ||\n op === '>>=' ||\n op === '>>>=' ||\n op === '&=' ||\n op === '^=' ||\n op === '|=';\n }", "function matchAssign() {\n\t var op;\n\n\t if (lookahead.type !== Token.Punctuator) {\n\t return false;\n\t }\n\t op = lookahead.value;\n\t return op === '=' ||\n\t op === '*=' ||\n\t op === '/=' ||\n\t op === '%=' ||\n\t op === '+=' ||\n\t op === '-=' ||\n\t op === '<<=' ||\n\t op === '>>=' ||\n\t op === '>>>=' ||\n\t op === '&=' ||\n\t op === '^=' ||\n\t op === '|=';\n\t }", "function matchAssign$937() {\n var op$1281;\n if (lookahead$891.type !== Token$869.Punctuator) {\n return false;\n }\n op$1281 = lookahead$891.value;\n return op$1281 === '=' || op$1281 === '*=' || op$1281 === '/=' || op$1281 === '%=' || op$1281 === '+=' || op$1281 === '-=' || op$1281 === '<<=' || op$1281 === '>>=' || op$1281 === '>>>=' || op$1281 === '&=' || op$1281 === '^=' || op$1281 === '|=';\n }", "function isAssignmentOperator(op) {\n return ASSIGNMENT_OPERATORS.indexOf(op) >= 0;\n}", "AssignmentOperator() {\n if (this._lookahead.type === 'SIMPLE_ASSIGN') {\n return this._eat('SIMPLE_ASSIGN');\n }\n return this._eat('COMPLEX_ASSIGN');\n }", "function checkAssignmentExpression(node) {\n if (node.operator !== '=') {\n // the other operators can make sense\n return;\n }\n\n if (areExpressionsEquivalent(node.left, node.right)) {\n // TODO: good way to get the lhs and provide better error message\n context.report(node, \"A variable is set to itself, which may be a logic bug or a typo.\");\n }\n }", "function _isComparsion(token){\n\t\treturn token.type === \"operator\" && /!=|==|>=|>|<|<=/.test(token.content);\n\t}", "function isAnAssignmentConcat(node) {\n return node.type === 'AssignmentExpression' &&\n node.operator === '+=';\n}", "AssignmentExpression() {\n const left = this.LogicalORExpression();\n\n if (!this._isAssignmentOperator(this._lookahead.type)) {\n return left;\n }\n\n return {\n type: 'AssignmentExpression',\n operator: this.AssignmentOperator().value,\n left: this._checkValidAssignmentTarget(left),\n right: this.AssignmentExpression(),\n };\n }", "\"AssignmentExpression[operator='='][right.type='LogicalExpression']\"(assignment) {\n if (!astUtils.isSameReference(assignment.left, assignment.right.left)) {\n return;\n }\n\n const descriptor = {\n messageId: \"assignment\",\n node: assignment,\n data: { operator: `${assignment.right.operator}=` }\n };\n const suggestion = {\n messageId: \"useLogicalOperator\",\n data: { operator: `${assignment.right.operator}=` },\n *fix(ruleFixer) {\n if (sourceCode.getCommentsInside(assignment).length > 0) {\n return;\n }\n\n // No need for parenthesis around the assignment based on precedence as the precedence stays the same even with changed operator\n const assignmentOperatorToken = getOperatorToken(assignment);\n\n // -> foo ||= foo || bar\n yield ruleFixer.insertTextBefore(assignmentOperatorToken, assignment.right.operator);\n\n // -> foo ||= bar\n const logicalOperatorToken = getOperatorToken(assignment.right);\n const firstRightOperandToken = sourceCode.getTokenAfter(logicalOperatorToken);\n\n yield ruleFixer.removeRange([assignment.right.range[0], firstRightOperandToken.range[0]]);\n }\n };\n\n context.report(createConditionalFixer(descriptor, suggestion, cannotBeGetter(assignment.left)));\n }", "assignment_statement(lhsToken) {\n const startToken = this.currentToken;\n\n try {\n let lhs = new AST.VarNode(lhsToken);\n let opToken = this.currentToken;\n this.eat(Lexer.TokenTypes.ASSIGN); // Assume that caller checks next token is ASSIGN\n let rhs = this.expr();\n return new AST.AssignmentNode(lhs, opToken, rhs);\n } catch (e) {\n throw new ParserException('Error processing ASSIGNMENT_STATMENT', startToken, e);\n }\n }", "processComplexAssignment() {\n const index = this.tokens.currentIndex();\n const identifierToken = this.tokens.tokens[index - 1];\n if (identifierToken.type !== TokenType.name) {\n return false;\n }\n if (identifierToken.shadowsGlobal) {\n return false;\n }\n if (index >= 2 && this.tokens.matches1AtIndex(index - 2, TokenType.dot)) {\n return false;\n }\n const assignmentSnippet = this.importProcessor.resolveExportBinding(\n this.tokens.identifierNameForToken(identifierToken),\n );\n if (!assignmentSnippet) {\n return false;\n }\n this.tokens.appendCode(` = ${assignmentSnippet}`);\n this.tokens.copyToken();\n return true;\n }", "static parseBoolOp(parseTokens) {\n this.match([\"==\", \"!=\"], parseTokens[tokenPointer], false);\n }", "function parseAssignment() {\n let token, expr;\n\n expr = parseConcat();\n\n if (typeof expr !== 'undefined' && expr.Identifier) {\n token = lexer.peek();\n if (matchOp(token, '=')) {\n lexer.next();\n return {\n 'Assignment': {\n name: expr,\n value: parseAssignment()\n }\n };\n }\n return expr;\n }\n\n return expr;\n }", "function matchEqual() {\n\t\tvar pattern = /^=/;\n\t\tvar x = lexString.match(pattern);\n\t\tif(x !== null) {\n\t\t\treturn true;\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "function is_op(op) {\n var tok = input.peek();\n return tok && tok.type === \"op\" && (!op || tok.value === op) && tok; \n }", "'LogicalExpression[right.type=\"AssignmentExpression\"][right.operator=\"=\"]'(logical) {\n\n // Right side has to be parenthesized, otherwise would be parsed as (foo || foo) = bar which is illegal\n if (isReference(logical.left) && astUtils.isSameReference(logical.left, logical.right.left)) {\n const descriptor = {\n messageId: \"logical\",\n node: logical,\n data: { operator: `${logical.operator}=` }\n };\n const suggestion = {\n messageId: \"convertLogical\",\n data: { operator: `${logical.operator}=` },\n *fix(ruleFixer) {\n if (sourceCode.getCommentsInside(logical).length > 0) {\n return;\n }\n\n const parentPrecedence = astUtils.getPrecedence(logical.parent);\n const requiresOuterParenthesis = logical.parent.type !== \"ExpressionStatement\" && (\n parentPrecedence === -1 ||\n astUtils.getPrecedence({ type: \"AssignmentExpression\" }) < parentPrecedence\n );\n\n if (!astUtils.isParenthesised(sourceCode, logical) && requiresOuterParenthesis) {\n yield ruleFixer.insertTextBefore(logical, \"(\");\n yield ruleFixer.insertTextAfter(logical, \")\");\n }\n\n // Also removes all opening parenthesis\n yield ruleFixer.removeRange([logical.range[0], logical.right.range[0]]); // -> foo = bar)\n\n // Also removes all ending parenthesis\n yield ruleFixer.removeRange([logical.right.range[1], logical.range[1]]); // -> foo = bar\n\n const operatorToken = getOperatorToken(logical.right);\n\n yield ruleFixer.insertTextBefore(operatorToken, logical.operator); // -> foo ||= bar\n }\n };\n const fix = cannotBeGetter(logical.left) || accessesSingleProperty(logical.left);\n\n context.report(createConditionalFixer(descriptor, suggestion, fix));\n }\n }", "isOperator() {\n return \"+-/\".indexOf(this.char) !== -1\n // return \"+-/\".includes(this.char)\n }", "function needsSpaceAfter(token, lastToken) {\n if (lastToken) {\n if (lastToken.type.isLoop) {\n return true;\n }\n if (lastToken.type.isAssign) {\n return true;\n }\n if (lastToken.type.binop != null) {\n return true;\n }\n\n var ltt = lastToken.type.label;\n if (ltt == \"?\") {\n return true;\n }\n if (ltt == \":\") {\n return true;\n }\n if (ltt == \",\") {\n return true;\n }\n if (ltt == \";\") {\n return true;\n }\n if (ltt == \"${\") {\n return true;\n }\n if (ltt == \"num\" && token.type.label == \".\") {\n return true;\n }\n\n var ltk = lastToken.type.keyword;\n var ttl = token.type.label;\n if (ltk != null && ttl != \".\") {\n if (ltk == \"break\" || ltk == \"continue\" || ltk == \"return\") {\n return token.type.label != \";\";\n }\n if (ltk != \"debugger\"\n && ltk != \"null\"\n && ltk != \"true\"\n && ltk != \"false\"\n && ltk != \"this\"\n && ltk != \"default\") {\n return true;\n }\n }\n\n if (ltt == \")\" && (token.type.label != \")\"\n && token.type.label != \"]\"\n && token.type.label != \";\"\n && token.type.label != \",\"\n && token.type.label != \".\")) {\n return true;\n }\n\n if (isIdentifierLike(token) && isIdentifierLike(lastToken)) {\n // We must emit a space to avoid merging the tokens.\n return true;\n }\n\n if (token.type.label == \"{\" && lastToken.type.label == \"name\") {\n return true;\n }\n }\n\n if (token.type.isAssign) {\n return true;\n }\n if (token.type.binop != null && lastToken) {\n return true;\n }\n if (token.type.label == \"?\") {\n return true;\n }\n\n return false;\n }", "function parseAssignment() {\n var token, expr;\n\n expr = parseAdditive();\n\n if (typeof expr !== 'undefined' && expr.Identifier) {\n token = lexer.peek();\n if (matchOp(token, '=')) {\n lexer.next();\n return {\n 'Assignment': {\n name: expr,\n value: parseAssignment()\n }\n };\n }\n return expr;\n }\n\n return expr;\n }", "function operator(op) {\n if (op == '+' || op == '-' ||\n op == '^' || op == '*' ||\n op == '/' || op == '(' ||\n op == ')') {\n return true;\n }\n else\n return false;\n}", "function isOperator(ch){\n return (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '%');\n }", "function matchOp() {\n\t\tvar pattern = /^(\\+|-)/;\n\t\tvar x = lexString.match(pattern);\n\t\tif(x !== null) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "function checkOperator(lastChar){\n\t\tif(lastChar === \"+\" || lastChar === \"-\" || lastChar === \"/\" || lastChar === \"*\")\n\t\t\treturn true;\n\t\treturn false;\n\t}", "function isAssignmentStatement(statement) {\n return ts.isExpressionStatement(statement) && isAssignment(statement.expression) &&\n ts.isIdentifier(statement.expression.left);\n }", "function operator(op)\n{\n if(op=='+' || op=='-' || op=='^' || op=='*' || op=='/' || op=='(' || op==')')\n {\n return true;\n }\n else\n return false;\n}", "function parseAssignmentStatement() {\n CST.addBranchNode(\"AssignmentStatement\");\n parseID();\n if (match([\"T_assign\"], false, false)) {\n parseExpr();\n log(\"Assignment Statement\");\n }\n else {\n errorlog(\"Parse Error - Expected = to assign ID to something, got \" + tokens[currentToken].tokenName);\n }\n CST.backtrack();\n}", "function is_op_char(char) {\n return \"+-*/%=&|<>!\".indexOf(char) >= 0;\n }", "function ruleAssign() {\n\tvar parent;\n\tvar node;\n\tvar tmp;\n\n\tif (accept(\"LX_ID\") &&\n\t [\"ASSIGN\", \"PLUSSET\", \"MINUSSET\", \"MULTSET\", \"DIVSET\", \"MODULOSET\", \"ANDSET\",\n\t \"ORSET\", \"XORSET\", \"LSHIFTSET\", \"RSHIFTSET\"].indexOf(_lex[0].name.substr(3)) >= 0) {\n\t node = {name:_lex[0].name, children:[]};\n\t node.children.push({name:_curr.name, val:_curr.val});\n\t shift();\n\t shift();\n\t if (!(tmp = operatorPipeline(0)))\n\t\treturn (false);\n\t node.children.push(tmp);\n\t} else if (!(node = operatorPipeline(0)))\n\t return (false);\n\treturn (node);\n }", "_checkValidAssignmentTarget(node) {\n if (node.type === 'Identifier') {\n return node;\n }\n throw new SyntaxError('Invalid left-hand side in assignment expression');\n }", "firstToken({token, counter}) {\n\t\tif (token.name === 'operator') {\n\t\t\tthis.listener.candidates = this.listener.candidates.filter(c=> c.name === 'operator');\n\t\t\tthis.openOperator = token.value;\n\t\t\tthis.listener.checking = 'middleTokens';\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function visitPlusEquals(node) {\n node.operator = '=';\n node.right = b.callExpression(\n b.memberExpression(node.left, b.identifier('concat'), false),\n [node.right]\n );\n}", "function isOperator(str) {\n if (str == \"(\" || str == \")\" || str == \"+\" || str == \"-\" || str == \"*\" || str == \"/\" || str == \".\")return true;\n return false;\n}", "function parse_AssignmentStatement() {\n tree.addNode('AssignmentStatement', 'branch');\n\n parse_ID();\n //tree.endChildren();\n\n match('=', parseCounter);\n parseCounter++;\n parse_Expr();\n //tree.endChildren();\n tree.endChildren();\n}", "lastOutputCharHasOperator() {\n const { output } = this.state;\n if (/[/+\\-x]/.test(output.charAt(output.length - 1))) {\n return true;\n }\n return false;\n }", "function isOperator(ch) {\n var x = ch.match(\"^[A-Za-z0-9]+$\")===null;\n return x;\n}", "function parseAssign(lexer)\n{\n // TODO: addExpr(expr)\n // - add a constant, a an ident, or a unary operator\n // - top down descent from root expression\n // - updates acceptUnary, acceptBinary?\n\n // TODO: parentheses\n // - parse recursively, ASTParen protects priority\n\n // TODO: function call\n // - like a binary operator\n // - must bind to the right base\n // - finding current base depends on priority of call\n // - can't steal from .\n\n print('assign expr');\n\n // Current root expression\n var rootExpr = undefined;\n\n // Current rightmost expression\n //var rightExpr = undefined;\n\n var acceptUnary = true;\n var acceptBinary = false;\n\n // TODO: add more checks\n\n // TODO: addUnary vs addBinary ************************\n\n /**\n Add an expression on the right side of the tree\n */\n function addExpr(tree, expr, parent)\n {\n function complete(expr)\n {\n return (\n (expr instanceof ASTUnOp && expr.numChildren() === 1) ||\n (expr instanceof ASTBinOp && expr.numChildren() === 2) ||\n (expr instanceof ASTAssign && expr.numChildren() === 2)\n );\n }\n\n //print('**** adding expr: ' + expr);\n\n // Identifier\n // Constant\n // Unary operator\n // Parenthesized binary operator\n if (\n expr instanceof ASTIdent ||\n expr instanceof ASTConst ||\n expr instanceof ASTUnOp ||\n (expr instanceof ASTBinOp && expr.numChildren() === 2))\n {\n print('*** adding unary');\n\n if (complete(tree) === true)\n {\n addExpr(tree.lastChild(), expr, tree);\n }\n else\n {\n if (rootExpr === undefined)\n {\n rootExpr = expr;\n }\n else\n {\n // Make this a child of the tree node\n tree.addChild(expr);\n\n // Recompute the tree expression position\n tree.calcPos();\n }\n\n if (expr instanceof ASTUnOp)\n {\n acceptUnary = true;\n acceptBinary = false;\n }\n else\n {\n acceptUnary = false;\n acceptBinary = true;\n }\n }\n }\n\n else if (expr instanceof ASTBinOp)\n {\n if (!(tree instanceof ASTUnOp) &&\n complete(tree) === true && \n complete(tree.lastChild()) === true)\n {\n addExpr(tree.lastChild(), expr, tree);\n }\n else\n {\n var treePri = tree.priority(); \n var exprPri = expr.priority();\n\n // If this expression has higher priority than the tree node\n if (exprPri > treePri)\n {\n //if (rightExpr.numChildren() < 2)\n // parseError('malformed expression', t);\n\n // Take the tree node's last child and\n // place the new node under the tree node\n expr.addChild(tree.lastChild());\n tree.children[tree.children.length-1] = expr;\n }\n else\n {\n // Make the tree node the first child of this node\n expr.addChild(tree);\n \n // Replace the top node by the new expression\n if (parent)\n parent.children[parent.children.length-1] = expr;\n else\n rootExpr = expr;\n }\n\n acceptUnary = true;\n acceptBinary = false;\n }\n }\n\n else if (expr instanceof ASTAssign)\n {\n if (tree.numChildren() > 0)\n {\n addExpr(tree.lastChild(), expr, tree);\n }\n else\n {\n expr.addChild(tree);\n\n if (parent)\n parent.children[parent.children.length-1] = expr;\n else\n rootExpr = expr;\n }\n\n acceptUnary = true;\n acceptBinary = false;\n }\n\n else\n {\n error('unsupported expression');\n }\n }\n\n\n\n\n\n\n\n\n\n\n\n // Until the expression is parsed\n for (;;)\n {\n // Peek at the current token\n var t = lexer.peekToken();\n\n // Terminal subexpression\n if (acceptUnary === true &&\n (\n t.type === 'number' ||\n t.type === 'string' ||\n t.type === 'true' ||\n t.type === 'false' ||\n t.type === 'null' ||\n t.type === 'ident'\n ))\n { \n print('terminal expr');\n\n var expr = undefined;\n\n lexer.readToken();\n \n // Number or string constant\n if (t.type === 'number' ||\n t.type === 'string')\n {\n expr = new ASTConst(t.value);\n }\n\n // true/false/null constant\n else if (\n t.type === 'true' ||\n t.type === 'false' ||\n t.type === 'null')\n {\n var val;\n if (t.type === 'true')\n val = true;\n else if (t.type === 'false')\n val = false;\n else\n val === 'null';\n\n expr = new ASTConst(val);\n }\n\n // Identifier\n else if (t.type === 'ident')\n {\n expr = new ASTIdent(t.value);\n }\n\n // Set the expression position\n expr.pos = t.pos;\n\n /*\n // If there is no rightmost expression\n if (rightExpr === undefined)\n {\n rightExpr = expr;\n rootExpr = expr;\n }\n else\n {\n // Make this a child of the right expression\n rightExpr.addChild(expr);\n\n // Recompute the right expression position\n rightExpr.calcPos();\n }\n */\n\n addExpr(rootExpr, expr);\n }\n\n // Unary operator\n else if (\n acceptUnary === true &&\n t.type in ASTUnOp.ops)\n {\n print('unary op');\n\n lexer.readToken();\n\n var expr = new ASTUnOp(t.type);\n\n expr.pos = t.pos;\n\n /*\n // TODO: factor this common code\n // If there is no rightmost expression\n if (rightExpr === undefined)\n {\n rightExpr = expr;\n rootExpr = expr;\n }\n else\n {\n // TODO: does this now become the right expression????\n\n // Make this a child of the right expression\n rightExpr.addChild(expr);\n\n // Recompute the right expression position\n rightExpr.calcPos();\n }\n */\n\n addExpr(rootExpr, expr);\n }\n\n // Binary operator\n else if (\n acceptBinary === true &&\n t.type in ASTBinOp.ops)\n {\n if (rootExpr === undefined)\n parseError('unexpected operator', t);\n\n lexer.readToken();\n\n var binExpr = new ASTBinOp(t.type);\n\n /*\n // If this operator has higher priority than the\n // current expression operator\n if (rightExpr instanceof ASTBinOp &&\n ASTBinOp.ops[t.type] > ASTBinOp.ops[rightExpr.op])\n {\n if (rightExpr.numChildren() < 2)\n parseError('malformed expression', t);\n\n binExpr.addChild(rightExpr.children[1]);\n\n rightExpr.children[1] = binExpr;\n rightExpr = binExpr;\n }\n else\n {\n binExpr.addChild(rightExpr);\n\n rightExpr = binExpr;\n rootExpr = binExpr;\n }\n */\n\n addExpr(rootExpr, binExpr);\n }\n\n // TODO\n // Assignment expression\n else if (\n acceptBinary === true &&\n t.type in ASTAssign.ops)\n {\n if (rootExpr === undefined)\n parseError('unexpected operator', t);\n\n lexer.readToken();\n\n var expr = new ASTAssign(t.type);\n\n addExpr(rootExpr, expr);\n }\n\n // Start of a parenthesized expression\n else if (\n acceptUnary === true &&\n t.type === '(')\n {\n //print('paren expr*******');\n\n lexer.readToken();\n\n var expr = parseExpr(lexer);\n\n //print('sub expr: ' + expr);\n\n var lt = lexer.readToken();\n\n if (lt.type !== ')')\n parseError('expected closing parenthesis', lt);\n\n /*\n // If there is no rightmost expression\n if (rightExpr === undefined)\n {\n rightExpr = expr;\n rootExpr = expr;\n }\n else\n {\n // Make this a child of the right expression\n rightExpr.addChild(expr);\n\n // Recompute the top expression position\n rightExpr.calcPos();\n }\n */\n\n addExpr(rootExpr, expr);\n }\n\n // TODO\n // TODO: call expression\n // TODO\n\n // Unrecognized token\n else\n {\n print('end of expression');\n\n // Stop the expression parsing\n break;\n }\n }\n\n if (rootExpr === undefined)\n parseError('expression parsing failed', t);\n\n return rootExpr;\n}", "function BOT_wordIsEqu(word) {\r\n\tif(word == \"eq\") return(true) \r\n}", "function AssignmentExpression(node) {\n if (t.isObjectPattern(node.left)) {\n return true;\n } else {\n return ConditionalExpression.apply(undefined, arguments);\n }\n}", "function AssignmentExpression(node) {\n\t if (t.isObjectPattern(node.left)) {\n\t return true;\n\t } else {\n\t return ConditionalExpression.apply(undefined, arguments);\n\t }\n\t}", "function AssignmentExpression(node) {\n\t if (t.isObjectPattern(node.left)) {\n\t return true;\n\t } else {\n\t return ConditionalExpression.apply(undefined, arguments);\n\t }\n\t}", "static parseAssignmentStatement(parseTokens) {\n _Functions.log(\"PARSER - parseAssignmentStatement()\");\n CSTTree.addNode(\"AssignmentStatement\", \"branch\");\n ASTTree.addNode(\"AssignmentStatement\", \"branch\");\n this.parseId(parseTokens);\n this.parseAssignmentOp(parseTokens);\n this.parseExpr(parseTokens);\n CSTTree.climbTree();\n ASTTree.climbTree();\n }", "function parseAssignmentExpression() {\n var token, expr, right, list, startToken;\n\n startToken = lookahead;\n token = lookahead;\n\n if (!state.allowYield && matchKeyword('yield')) {\n return parseYieldExpression();\n }\n\n expr = parseConditionalExpression();\n\n if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {\n isAssignmentTarget = isBindingElement = false;\n list = reinterpretAsCoverFormalsList(expr);\n\n if (list) {\n firstCoverInitializedNameError = null;\n return parseArrowFunctionExpression(list, new WrappingNode(startToken));\n }\n\n return expr;\n }\n\n if (matchAssign()) {\n if (!isAssignmentTarget) {\n tolerateError(Messages.InvalidLHSInAssignment);\n }\n\n // ECMA-262 12.1.1\n if (strict && expr.type === Syntax.Identifier) {\n if (isRestrictedWord(expr.name)) {\n tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);\n }\n if (isStrictModeReservedWord(expr.name)) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n }\n }\n\n if (!match('=')) {\n isAssignmentTarget = isBindingElement = false;\n } else {\n reinterpretExpressionAsPattern(expr);\n }\n\n token = lex();\n right = isolateCoverGrammar(parseAssignmentExpression);\n expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);\n firstCoverInitializedNameError = null;\n }\n\n return expr;\n }", "function parseAssignmentExpression() {\n\t var token, expr, right, list, startToken;\n\n\t startToken = lookahead;\n\t token = lookahead;\n\n\t if (!state.allowYield && matchKeyword('yield')) {\n\t return parseYieldExpression();\n\t }\n\n\t expr = parseConditionalExpression();\n\n\t if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {\n\t isAssignmentTarget = isBindingElement = false;\n\t list = reinterpretAsCoverFormalsList(expr);\n\n\t if (list) {\n\t firstCoverInitializedNameError = null;\n\t return parseArrowFunctionExpression(list, new WrappingNode(startToken));\n\t }\n\n\t return expr;\n\t }\n\n\t if (matchAssign()) {\n\t if (!isAssignmentTarget) {\n\t tolerateError(Messages.InvalidLHSInAssignment);\n\t }\n\n\t // ECMA-262 12.1.1\n\t if (strict && expr.type === Syntax.Identifier) {\n\t if (isRestrictedWord(expr.name)) {\n\t tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);\n\t }\n\t if (isStrictModeReservedWord(expr.name)) {\n\t tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n\t }\n\t }\n\n\t if (!match('=')) {\n\t isAssignmentTarget = isBindingElement = false;\n\t } else {\n\t reinterpretExpressionAsPattern(expr);\n\t }\n\n\t token = lex();\n\t right = isolateCoverGrammar(parseAssignmentExpression);\n\t expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);\n\t firstCoverInitializedNameError = null;\n\t }\n\n\t return expr;\n\t }", "function expressionIsComplete() {\n return !(left === \"\" || right === \"\" || operator === \"\"); \n}", "function isOperator(value) {\r\n if (value == \"\") {\r\n return false;\r\n }\r\n\r\n switch (value) {\r\n case \"/\": \r\n return true;\r\n break;\r\n case \"x\": \r\n return true;\r\n break;\r\n case \"+\": \r\n return true;\r\n break;\r\n case \"-\": \r\n return true;\r\n break;\r\n \r\n default:\r\n return false;\r\n break;\r\n }\r\n}", "function checkForOpperand(char){\n if(char == \"+\"){\n return false;\n }else if(char == \"-\"){\n return false;\n }else if(char == \"/\"){\n return false;\n }else if(char == \"=\"){\n return false;\n }else if(char == \"*\"){\n return false;\n }else if(char == \"%\"){\n return false;\n }else if(char == \".\"){\n return false;\n }else{\n return true;\n }\n}", "literalToken() {\r\n\t\t\t\tvar match, message, origin, prev, ref, ref1, ref2, ref3, ref4, ref5, skipToken, tag, token, value;\r\n\t\t\t\tif (match = OPERATOR.exec(this.chunk)) {\r\n\t\t\t\t\t[value] = match;\r\n\t\t\t\t\tif (CODE.test(value)) {\r\n\t\t\t\t\t\tthis.tagParameters();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvalue = this.chunk.charAt(0);\r\n\t\t\t\t}\r\n\t\t\t\ttag = value;\r\n\t\t\t\tprev = this.prev();\r\n\t\t\t\tif (prev && indexOf.call(['=', ...COMPOUND_ASSIGN], value) >= 0) {\r\n\t\t\t\t\tskipToken = false;\r\n\t\t\t\t\tif (value === '=' && ((ref = prev[1]) === '||' || ref === '&&') && !prev.spaced) {\r\n\t\t\t\t\t\tprev[0] = 'COMPOUND_ASSIGN';\r\n\t\t\t\t\t\tprev[1] += '=';\r\n\t\t\t\t\t\tif ((ref1 = prev.data) != null ? ref1.original : void 0) {\r\n\t\t\t\t\t\t\tprev.data.original += '=';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tprev[2].range = [prev[2].range[0], prev[2].range[1] + 1];\r\n\t\t\t\t\t\tprev[2].last_column += 1;\r\n\t\t\t\t\t\tprev[2].last_column_exclusive += 1;\r\n\t\t\t\t\t\tprev = this.tokens[this.tokens.length - 2];\r\n\t\t\t\t\t\tskipToken = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (prev && prev[0] !== 'PROPERTY') {\r\n\t\t\t\t\t\torigin = (ref2 = prev.origin) != null ? ref2 : prev;\r\n\t\t\t\t\t\tmessage = isUnassignable(prev[1], origin[1]);\r\n\t\t\t\t\t\tif (message) {\r\n\t\t\t\t\t\t\tthis.error(message, origin[2]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (skipToken) {\r\n\t\t\t\t\t\treturn value.length;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (value === '(' && (prev != null ? prev[0] : void 0) === 'IMPORT') {\r\n\t\t\t\t\tprev[0] = 'DYNAMIC_IMPORT';\r\n\t\t\t\t}\r\n\t\t\t\tif (value === '{' && this.seenImport) {\r\n\t\t\t\t\tthis.importSpecifierList = true;\r\n\t\t\t\t} else if (this.importSpecifierList && value === '}') {\r\n\t\t\t\t\tthis.importSpecifierList = false;\r\n\t\t\t\t} else if (value === '{' && (prev != null ? prev[0] : void 0) === 'EXPORT') {\r\n\t\t\t\t\tthis.exportSpecifierList = true;\r\n\t\t\t\t} else if (this.exportSpecifierList && value === '}') {\r\n\t\t\t\t\tthis.exportSpecifierList = false;\r\n\t\t\t\t}\r\n\t\t\t\tif (value === ';') {\r\n\t\t\t\t\tif (ref3 = prev != null ? prev[0] : void 0, indexOf.call(['=', ...UNFINISHED], ref3) >= 0) {\r\n\t\t\t\t\t\tthis.error('unexpected ;');\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.seenFor = this.seenImport = this.seenExport = false;\r\n\t\t\t\t\ttag = 'TERMINATOR';\r\n\t\t\t\t} else if (value === '*' && (prev != null ? prev[0] : void 0) === 'EXPORT') {\r\n\t\t\t\t\ttag = 'EXPORT_ALL';\r\n\t\t\t\t} else if (indexOf.call(MATH, value) >= 0) {\r\n\t\t\t\t\ttag = 'MATH';\r\n\t\t\t\t} else if (indexOf.call(COMPARE, value) >= 0) {\r\n\t\t\t\t\ttag = 'COMPARE';\r\n\t\t\t\t} else if (indexOf.call(COMPOUND_ASSIGN, value) >= 0) {\r\n\t\t\t\t\ttag = 'COMPOUND_ASSIGN';\r\n\t\t\t\t} else if (indexOf.call(UNARY, value) >= 0) {\r\n\t\t\t\t\ttag = 'UNARY';\r\n\t\t\t\t} else if (indexOf.call(UNARY_MATH, value) >= 0) {\r\n\t\t\t\t\ttag = 'UNARY_MATH';\r\n\t\t\t\t} else if (indexOf.call(SHIFT, value) >= 0) {\r\n\t\t\t\t\ttag = 'SHIFT';\r\n\t\t\t\t} else if (value === '?' && (prev != null ? prev.spaced : void 0)) {\r\n\t\t\t\t\ttag = 'BIN?';\r\n\t\t\t\t} else if (prev) {\r\n\t\t\t\t\tif (value === '(' && !prev.spaced && (ref4 = prev[0], indexOf.call(CALLABLE, ref4) >= 0)) {\r\n\t\t\t\t\t\tif (prev[0] === '?') {\r\n\t\t\t\t\t\t\tprev[0] = 'FUNC_EXIST';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttag = 'CALL_START';\r\n\t\t\t\t\t} else if (value === '[' && (((ref5 = prev[0], indexOf.call(INDEXABLE, ref5) >= 0) && !prev.spaced) || (prev[0] === '::'))) { // `.prototype` can’t be a method you can call.\r\n\t\t\t\t\t\ttag = 'INDEX_START';\r\n\t\t\t\t\t\tswitch (prev[0]) {\r\n\t\t\t\t\t\t\tcase '?':\r\n\t\t\t\t\t\t\t\tprev[0] = 'INDEX_SOAK';\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\ttoken = this.makeToken(tag, value);\r\n\t\t\t\tswitch (value) {\r\n\t\t\t\t\tcase '(':\r\n\t\t\t\t\tcase '{':\r\n\t\t\t\t\tcase '[':\r\n\t\t\t\t\t\tthis.ends.push({\r\n\t\t\t\t\t\t\ttag: INVERSES[value],\r\n\t\t\t\t\t\t\torigin: token\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase ')':\r\n\t\t\t\t\tcase '}':\r\n\t\t\t\t\tcase ']':\r\n\t\t\t\t\t\tthis.pair(value);\r\n\t\t\t\t}\r\n\t\t\t\tthis.tokens.push(this.makeToken(tag, value));\r\n\t\t\t\treturn value.length;\r\n\t\t\t}", "function isBasicOperator(str) {\n if (str == \"+\" || str == \"-\" || str == \"*\" || str == \"/\") return true;\n return false;\n}", "get isAssignment() {\n return true;\n }", "recognizeOperator(){\r\n console.log(\"in recognizeOperator()\");\r\n let character = this.input.charAt(this.position);\r\n\r\n if(CharUtils.isComparisonOperator(character)){\r\n return this.recognizeComparisonOperator();\r\n }\r\n\r\n if(CharUtils.isArithmeticOperator(character)){\r\n return this.recognizeArithmeticOperator();\r\n }\r\n }", "function parseAssignmentExpression() {\n var token, expr, right, list, startToken;\n\n startToken = lookahead;\n token = lookahead;\n\n if (!state.allowYield && matchKeyword('yield')) {\n return parseYieldExpression();\n }\n\n expr = parseConditionalExpression();\n\n if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {\n isAssignmentTarget = isBindingElement = false;\n list = reinterpretAsCoverFormalsList(expr);\n\n if (list) {\n firstCoverInitializedNameError = null;\n return parseArrowFunctionExpression(list, new WrappingNode(startToken));\n }\n\n return expr;\n }\n\n if (matchAssign()) {\n if (!isAssignmentTarget) {\n tolerateError(Messages.InvalidLHSInAssignment);\n }\n\n // ECMA-262 12.1.1\n if (strict && expr.type === Syntax.Identifier) {\n if (isRestrictedWord(expr.name)) {\n tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);\n }\n if (isStrictModeReservedWord(expr.name)) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n }\n }\n\n if (!match('=')) {\n isAssignmentTarget = isBindingElement = false;\n } else {\n reinterpretExpressionAsPattern(expr);\n }\n\n token = lex();\n right = isolateCoverGrammar(parseAssignmentExpression);\n expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);\n firstCoverInitializedNameError = null;\n }\n\n return expr;\n }", "function parseAssignmentExpression() {\n var token, expr, right, list, startToken;\n\n startToken = lookahead;\n token = lookahead;\n\n if (!state.allowYield && matchKeyword('yield')) {\n return parseYieldExpression();\n }\n\n expr = parseConditionalExpression();\n\n if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {\n isAssignmentTarget = isBindingElement = false;\n list = reinterpretAsCoverFormalsList(expr);\n\n if (list) {\n firstCoverInitializedNameError = null;\n return parseArrowFunctionExpression(list, new WrappingNode(startToken));\n }\n\n return expr;\n }\n\n if (matchAssign()) {\n if (!isAssignmentTarget) {\n tolerateError(Messages.InvalidLHSInAssignment);\n }\n\n // ECMA-262 12.1.1\n if (strict && expr.type === Syntax.Identifier) {\n if (isRestrictedWord(expr.name)) {\n tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);\n }\n if (isStrictModeReservedWord(expr.name)) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n }\n }\n\n if (!match('=')) {\n isAssignmentTarget = isBindingElement = false;\n } else {\n reinterpretExpressionAsPattern(expr);\n }\n\n token = lex();\n right = isolateCoverGrammar(parseAssignmentExpression);\n expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);\n firstCoverInitializedNameError = null;\n }\n\n return expr;\n }", "function parseAssignmentExpression() {\n var token, expr, right, list, startToken;\n\n startToken = lookahead;\n token = lookahead;\n\n if (!state.allowYield && matchKeyword('yield')) {\n return parseYieldExpression();\n }\n\n expr = parseConditionalExpression();\n\n if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {\n isAssignmentTarget = isBindingElement = false;\n list = reinterpretAsCoverFormalsList(expr);\n\n if (list) {\n firstCoverInitializedNameError = null;\n return parseArrowFunctionExpression(list, new WrappingNode(startToken));\n }\n\n return expr;\n }\n\n if (matchAssign()) {\n if (!isAssignmentTarget) {\n tolerateError(Messages.InvalidLHSInAssignment);\n }\n\n // ECMA-262 12.1.1\n if (strict && expr.type === Syntax.Identifier) {\n if (isRestrictedWord(expr.name)) {\n tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);\n }\n if (isStrictModeReservedWord(expr.name)) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n }\n }\n\n if (!match('=')) {\n isAssignmentTarget = isBindingElement = false;\n } else {\n reinterpretExpressionAsPattern(expr);\n }\n\n token = lex();\n right = isolateCoverGrammar(parseAssignmentExpression);\n expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);\n firstCoverInitializedNameError = null;\n }\n\n return expr;\n }", "function isOperator(value){\n return value === \"÷\" || value === \"x\" || value === \"+\" || value === \"-\"\n}", "function checkOperator(){\n let op = calculator.operator;\n if (op === '%' || op === '÷' || op === '×' || op === '-' || op === '+'){\n return calculator.operator;\n }\n else {\n return false;\n }\n}", "function isOperators(str){\n if (str == \"(\" || str == \")\" || str == \"+\" || str == \"-\" || str == \"*\" || str == \"/\")return true;\n return false;\n}", "function is_operator(x) {\n switch (x) {\n case \"+\":\n return true;\n break;\n case \"-\":\n return true;\n break;\n case \"x\":\n return true;\n break;\n case \"/\":\n return true;\n break;\n case \"^\":\n return true;\n break;\n default:\n return false;\n }\n\n}", "function AssignmentOperator(){\nequalAssOP();\naddAssigOp();\nsubAssigOp();\n}", "function isPropertyWriteExpression(node) {\n if (!ts.isBinaryExpression(node)) {\n return false;\n }\n if (node.operatorToken.getText().trim() !== '=') {\n return false;\n }\n if (!ts.isPropertyAccessExpression(node.left) ||\n node.left.expression.getFullText().trim() === '') {\n return false;\n }\n // TODO: Destructuring assigments aren't covered. This would be a potential\n // bypass, but I doubt we'd catch bugs, so fixing it seems low priority\n // overall.\n return true;\n}", "function assigment() {\n\t\tvar variable = lastToken;\n\t\tvar op = thisToken;\n\t\tregisterCount = 2;\n\t\tif (localVarTable.indexOf(variable) > -1) {\n\t\t\tpreviousToken();\n\t\t\tlocalVarToken();\n\t\t} else {\n\t\t\tgetToken();\n\t\t\texecut();\n\t\t\tif (getRangOperation(thisToken) > 0)\n\t\t\t\texecut();\n\t\t\tgetToken();\n\t\t\tif (getRangOperation(thisToken) > 0)\n\t\t\t\texecut();\n\t\t\tregisterCount--;\n\t\t\tif (op == '+=') {\n\t\t\t\tasm.push(' LDI R' + (registerCount + 1) + ',(_' + variable + ')');\n\t\t\t\tasm.push(' ADD R' + registerCount + ',R' + (registerCount + 1));\n\t\t\t} else if (op == '-=') {\n\t\t\t\tasm.push(' LDI R' + (registerCount + 1) + ',(_' + variable + ')');\n\t\t\t\tasm.push(' SUB R' + (registerCount + 1) + ',R' + registerCount);\n\t\t\t\tasm.push(' MOV R' + registerCount + ',R' + (registerCount + 1));\n\t\t\t} else if (op == '*=') {\n\t\t\t\tasm.push(' LDI R' + (registerCount + 1) + ',(_' + variable + ')');\n\t\t\t\tasm.push(' MUL R' + registerCount + ',R' + (registerCount + 1));\n\t\t\t} else if (op == '/=') {\n\t\t\t\tasm.push(' LDI R' + (registerCount + 1) + ',(_' + variable + ')');\n\t\t\t\tasm.push(' DIV R' + (registerCount + 1) + ',R' + registerCount);\n\t\t\t\tasm.push(' MOV R' + registerCount + ',R' + (registerCount + 1));\n\t\t\t}\n\t\t\tasm.push(' STI (_' + variable + '),R' + registerCount);\n\t\t}\n\t\tpreviousToken();\n\t}", "isAsterisk() {\n return this.char === \"*\" && this.peek() !== \"=\" // the *= combo constitutes a attribute operator instead\n }", "function isWriteAccess(node) {\n if (node.kind === 69 /* Identifier */ && ts.isDeclarationName(node)) {\n return true;\n }\n var parent = node.parent;\n if (parent) {\n if (parent.kind === 186 /* PostfixUnaryExpression */ || parent.kind === 185 /* PrefixUnaryExpression */) {\n return true;\n }\n else if (parent.kind === 187 /* BinaryExpression */ && parent.left === node) {\n var operator = parent.operatorToken.kind;\n return 56 /* FirstAssignment */ <= operator && operator <= 68 /* LastAssignment */;\n }\n }\n return false;\n }", "function tokenValueIs(val, type)\n{\n\treturn (val & type) == type\n}", "function checkIfLastOperator() {\n var lastChar = screenContent.substr(screenContent.length - 1);\n var operator = [\"+\", \"-\", \"*\", \"/\", \".\"];\n for (i = 0; i < operator.length; i++) {\n if (operator[i] === lastChar) {\n return true;\n }\n }\n return false;\n }", "function allow() {\n // two value stacks and one character stack\n return numStack.length >= 2 && operatorStack.length >= 1;\n }", "function AssignmentExpression(node, print) {\n\t // todo: add cases where the spaces can be dropped when in compact mode\n\t print.plain(node.left);\n\n\t var spaces = node.operator === \"in\" || node.operator === \"instanceof\";\n\t spaces = true; // todo: https://github.com/babel/babel/issues/1835\n\t this.space(spaces);\n\n\t this.push(node.operator);\n\n\t if (!spaces) {\n\t // space is mandatory to avoid outputting <!--\n\t // http://javascript.spec.whatwg.org/#comment-syntax\n\t spaces = node.operator === \"<\" && t.isUnaryExpression(node.right, { prefix: true, operator: \"!\" }) && t.isUnaryExpression(node.right.argument, { prefix: true, operator: \"--\" });\n\t }\n\n\t this.space(spaces);\n\n\t print.plain(node.right);\n\t}", "set LeftParen(value) {}", "processPostIncDec() {\n const index = this.tokens.currentIndex();\n const identifierToken = this.tokens.tokens[index];\n const operatorToken = this.tokens.tokens[index + 1];\n if (identifierToken.type !== TokenType.name) {\n return false;\n }\n if (identifierToken.shadowsGlobal) {\n return false;\n }\n if (index >= 1 && this.tokens.matches1AtIndex(index - 1, TokenType.dot)) {\n return false;\n }\n const identifierName = this.tokens.identifierNameForToken(identifierToken);\n const assignmentSnippet = this.importProcessor.resolveExportBinding(identifierName);\n if (!assignmentSnippet) {\n return false;\n }\n const operatorCode = this.tokens.rawCodeForToken(operatorToken);\n // We might also replace the identifier with something like exports.x, so\n // do that replacement here as well.\n const base = this.importProcessor.getIdentifierReplacement(identifierName) || identifierName;\n if (operatorCode === \"++\") {\n this.tokens.replaceToken(`(${base} = ${assignmentSnippet} = ${base} + 1, ${base} - 1)`);\n } else if (operatorCode === \"--\") {\n this.tokens.replaceToken(`(${base} = ${assignmentSnippet} = ${base} - 1, ${base} + 1)`);\n } else {\n throw new Error(`Unexpected operator: ${operatorCode}`);\n }\n this.tokens.removeToken();\n return true;\n }", "function validateNode(node) {\n return [\n node.type === \"AssignmentExpression\" && node.left.type === \"MemberExpression\"\n ];\n}", "isOperator(value) {\n return [\"+\", \"-\", \"*\", \"/\", \"%\", \"x²\", \"√\"].indexOf(value) > -1;\n }", "function isOperatorStart(input, index) {\n\treturn tryReadOperator(input, index) !== null;\n}" ]
[ "0.82661015", "0.79970014", "0.79970014", "0.79970014", "0.79970014", "0.79970014", "0.79240716", "0.7854814", "0.7833919", "0.77979654", "0.7244828", "0.72382146", "0.70757514", "0.6765353", "0.6678297", "0.6469518", "0.6445563", "0.6394306", "0.63458574", "0.63150585", "0.6313534", "0.6170923", "0.6105199", "0.60815495", "0.6075203", "0.6021178", "0.5999282", "0.5894337", "0.5880145", "0.58746797", "0.57989275", "0.5796311", "0.5757478", "0.5737577", "0.5733731", "0.57336473", "0.57277095", "0.5717187", "0.57102114", "0.5698381", "0.56903785", "0.5684819", "0.5675225", "0.56606936", "0.56561387", "0.5643604", "0.56279486", "0.5566661", "0.5566661", "0.55520856", "0.5549504", "0.55455995", "0.5539361", "0.5526864", "0.55150074", "0.5511057", "0.55093086", "0.5505826", "0.5456173", "0.5436966", "0.5436966", "0.5436966", "0.5435638", "0.54158294", "0.54123276", "0.5402337", "0.5401667", "0.5394314", "0.53729594", "0.5347866", "0.5336291", "0.53205216", "0.5319213", "0.53128195", "0.52976626", "0.5276238", "0.5263662", "0.5258514", "0.5246592", "0.52325284" ]
0.79334086
26
Return true if provided expression is LeftHandSideExpression
function isLeftHandSide(expr) { return expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isLeftHandSide(expr) {\n switch (expr.type) {\n case 'AssignmentExpression':\n case 'BinaryExpression':\n case 'ConditionalExpression':\n case 'LogicalExpression':\n case 'SequenceExpression':\n case 'UnaryExpression':\n case 'UpdateExpression':\n return false;\n }\n return true;\n }", "function isLeftHandSide(node) {\n const parent = node.parent;\n // a++\n if (parent.type === utils_1.AST_NODE_TYPES.UpdateExpression) {\n return true;\n }\n // a + b\n if ((parent.type === utils_1.AST_NODE_TYPES.BinaryExpression ||\n parent.type === utils_1.AST_NODE_TYPES.LogicalExpression ||\n parent.type === utils_1.AST_NODE_TYPES.AssignmentExpression) &&\n node === parent.left) {\n return true;\n }\n // a ? b : c\n if (parent.type === utils_1.AST_NODE_TYPES.ConditionalExpression &&\n node === parent.test) {\n return true;\n }\n // a(b)\n if (parent.type === utils_1.AST_NODE_TYPES.CallExpression && node === parent.callee) {\n return true;\n }\n // a`b`\n if (parent.type === utils_1.AST_NODE_TYPES.TaggedTemplateExpression &&\n node === parent.tag) {\n return true;\n }\n return false;\n}", "function isLeftHandSide(expr)\n\t\t{\n\t\t\treturn expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression;\n\t\t}", "function isLeftHandSide(expr) {\n return expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression;\n }", "function left_is_object(node) {\n if (node instanceof AST_Object) return true;\n if (node instanceof AST_Sequence) return left_is_object(node.expressions[0]);\n if (node.TYPE === \"Call\") return left_is_object(node.expression);\n if (node instanceof AST_PrefixedTemplateString) return left_is_object(node.prefix);\n if (node instanceof AST_Dot || node instanceof AST_Sub) return left_is_object(node.expression);\n if (node instanceof AST_Chain) return left_is_object(node.expression);\n if (node instanceof AST_Conditional) return left_is_object(node.condition);\n if (node instanceof AST_Binary) return left_is_object(node.left);\n if (node instanceof AST_UnaryPostfix) return left_is_object(node.expression);\n return false;\n}", "function isExpression(node) {\n return node != null && EXPRESSIONS.indexOf(node.type) >= 0;\n}", "function isLeft(either) {\n return either.isLeft;\n }", "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "function isExpression(node) {\n return CodeGenerator.Expression.hasOwnProperty(node.type);\n }", "function isExpression(node, typescript) {\n var _a;\n return typescript.isExpressionNode(node) || typescript.isIdentifier(node) || ((_a = typescript.isPrivateIdentifier) === null || _a === void 0 ? void 0 : _a.call(typescript, node));\n}", "function isCompoundPowerLeft(node, fnReferences) {\n // unary expressions and values with units should be parenthesized\n // in power expressions.\n var isCompound =\n (node.type === 'unary-expr') ||\n ((node.type === 'primary') && node.children.unit);\n\n return isCompound || isTextuallyComplexReference(node, fnReferences);\n}", "function Binary(node, parent) {\n\t if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) {\n\t return true;\n\t }\n\n\t if (t.isUnaryLike(parent)) {\n\t return true;\n\t }\n\n\t if (t.isMemberExpression(parent) && parent.object === node) {\n\t return true;\n\t }\n\n\t if (t.isBinary(parent)) {\n\t var parentOp = parent.operator;\n\t var parentPos = PRECEDENCE[parentOp];\n\n\t var nodeOp = node.operator;\n\t var nodePos = PRECEDENCE[nodeOp];\n\n\t if (parentPos > nodePos) {\n\t return true;\n\t }\n\n\t // Logical expressions with the same precedence don't need parens.\n\t if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) {\n\t return true;\n\t }\n\t }\n\t}", "function Binary(node, parent) {\n if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) {\n return true;\n }\n\n if (t.isUnaryLike(parent)) {\n return true;\n }\n\n if (t.isMemberExpression(parent) && parent.object === node) {\n return true;\n }\n\n if (t.isBinary(parent)) {\n var parentOp = parent.operator;\n var parentPos = PRECEDENCE[parentOp];\n\n var nodeOp = node.operator;\n var nodePos = PRECEDENCE[nodeOp];\n\n if (parentPos > nodePos) {\n return true;\n }\n\n // Logical expressions with the same precedence don't need parens.\n if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) {\n return true;\n }\n }\n}", "function isFirstInStatement(printStack) {\n\t var considerArrow = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];\n\n\t var i = printStack.length - 1;\n\t var node = printStack[i];\n\t i--;\n\t var parent = printStack[i];\n\t while (i > 0) {\n\t if (t.isExpressionStatement(parent, { expression: node })) {\n\t return true;\n\t }\n\n\t if (considerArrow && t.isArrowFunctionExpression(parent, { body: node })) {\n\t return true;\n\t }\n\n\t if (t.isCallExpression(parent, { callee: node }) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isMemberExpression(parent, { object: node }) || t.isConditional(parent, { test: node }) || t.isBinary(parent, { left: node }) || t.isAssignmentExpression(parent, { left: node })) {\n\t node = parent;\n\t i--;\n\t parent = printStack[i];\n\t } else {\n\t return false;\n\t }\n\t }\n\n\t return false;\n\t}", "validateExpression() {\n for (let i = 0; i < this.expression.length - 1; i++) {\n if (this.expression[i] in OperatorMap && this.expression[i + 1] in OperatorMap) {\n if (this.expression[i] !== \"(\" && this.expression[i] !== \")\" &&\n this.expression[i + 1] !== \"(\" && this.expression[i + 1] !== \")\" && this.expression[i + 1] !== \"-\") {\n return false;\n }\n }\n }\n\n return true;\n }", "function isFnExpression(node) {\n return (node && (node.type === 'FunctionExpression' ||\n node.type === 'ArrowFunctionExpression'));\n }", "function parseLeftHandSideExpression() {\n var quasi, expr, property, startToken;\n assert(state.allowIn, 'callee of new expression always allow in keyword.');\n\n startToken = lookahead;\n\n if (matchKeyword('super') && state.inFunctionBody) {\n expr = new Node();\n lex();\n expr = expr.finishSuper();\n if (!match('[') && !match('.')) {\n throwUnexpectedToken(lookahead);\n }\n } else {\n expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n }\n\n for (; ;) {\n if (match('[')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else if (match('.')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (lookahead.type === Token.Template && lookahead.head) {\n quasi = parseTemplateLiteral();\n expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n } else {\n break;\n }\n }\n return expr;\n }", "function expressionIsComplete() {\n return !(left === \"\" || right === \"\" || operator === \"\"); \n}", "function isBooleanExpression(_x11) {\n var _left;\n\n var _again2 = true;\n\n _function2: while (_again2) {\n var node = _x11;\n _again2 = false;\n\n if (node.type === 'BinaryExpression' && BOOLEAN_BINARY_OPERATORS.indexOf(node.operator) > -1) {\n return true;\n } else if (node.type === 'LogicalExpression') {\n if (!(_left = isBooleanExpression(node.left))) {\n return _left;\n }\n\n _x11 = node.right;\n _again2 = true;\n continue _function2;\n } else {\n return false;\n }\n }\n }", "function test(expression, lexeme) {\n var match = expression && expression.exec(lexeme)\n return match && match.index === 0\n}", "function parseLeftHandSideExpression() {\n\t var quasi, expr, property, startToken;\n\t assert(state.allowIn, 'callee of new expression always allow in keyword.');\n\n\t startToken = lookahead;\n\n\t if (matchKeyword('super') && state.inFunctionBody) {\n\t expr = new Node();\n\t lex();\n\t expr = expr.finishSuper();\n\t if (!match('[') && !match('.')) {\n\t throwUnexpectedToken(lookahead);\n\t }\n\t } else {\n\t expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n\t }\n\n\t for (;;) {\n\t if (match('[')) {\n\t isBindingElement = false;\n\t isAssignmentTarget = true;\n\t property = parseComputedMember();\n\t expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n\t } else if (match('.')) {\n\t isBindingElement = false;\n\t isAssignmentTarget = true;\n\t property = parseNonComputedMember();\n\t expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n\t } else if (lookahead.type === Token.Template && lookahead.head) {\n\t quasi = parseTemplateLiteral();\n\t expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n\t } else {\n\t break;\n\t }\n\t }\n\t return expr;\n\t }", "function test(expression, lexeme) {\n var match = expression && expression.exec(lexeme);\n return match && match.index === 0;\n}", "LeftHandSideExpression() {\n return this.PrimaryExpression();\n }", "function parseLeftHandSideExpression() {\n var quasi, expr, property, startToken;\n assert(state.allowIn, 'callee of new expression always allow in keyword.');\n\n startToken = lookahead;\n\n if (matchKeyword('super') && state.inFunctionBody) {\n expr = new Node();\n lex();\n expr = expr.finishSuper();\n if (!match('[') && !match('.')) {\n throwUnexpectedToken(lookahead);\n }\n } else {\n expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n }\n\n for (;;) {\n if (match('[')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else if (match('.')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (lookahead.type === Token.Template && lookahead.head) {\n quasi = parseTemplateLiteral();\n expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n } else {\n break;\n }\n }\n return expr;\n }", "function parseLeftHandSideExpression() {\n var quasi, expr, property, startToken;\n assert(state.allowIn, 'callee of new expression always allow in keyword.');\n\n startToken = lookahead;\n\n if (matchKeyword('super') && state.inFunctionBody) {\n expr = new Node();\n lex();\n expr = expr.finishSuper();\n if (!match('[') && !match('.')) {\n throwUnexpectedToken(lookahead);\n }\n } else {\n expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n }\n\n for (;;) {\n if (match('[')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else if (match('.')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (lookahead.type === Token.Template && lookahead.head) {\n quasi = parseTemplateLiteral();\n expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n } else {\n break;\n }\n }\n return expr;\n }", "function parseLeftHandSideExpression() {\n var quasi, expr, property, startToken;\n assert(state.allowIn, 'callee of new expression always allow in keyword.');\n\n startToken = lookahead;\n\n if (matchKeyword('super') && state.inFunctionBody) {\n expr = new Node();\n lex();\n expr = expr.finishSuper();\n if (!match('[') && !match('.')) {\n throwUnexpectedToken(lookahead);\n }\n } else {\n expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n }\n\n for (;;) {\n if (match('[')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else if (match('.')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (lookahead.type === Token.Template && lookahead.head) {\n quasi = parseTemplateLiteral();\n expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n } else {\n break;\n }\n }\n return expr;\n }", "function hasPrecedence(op1, op2) {\n if (op2 == \"(\" || op2 == \")\") {\n return false;\n }\n if ((op1 == \"*\" || op1 == \"/\") && (op2 == \"+\" || op2 == \"-\")) {\n return false;\n } else {\n return true;\n }\n}", "function isParenthesizedArrowFunctionExpression() {\n if (token() === 17 /* OpenParenToken */ || token() === 25 /* LessThanToken */ || token() === 118 /* AsyncKeyword */) {\n return lookAhead(isParenthesizedArrowFunctionExpressionWorker);\n }\n if (token() === 34 /* EqualsGreaterThanToken */) {\n // ERROR RECOVERY TWEAK:\n // If we see a standalone => try to parse it as an arrow function expression as that's\n // likely what the user intended to write.\n return 1 /* True */;\n }\n // Definitely not a parenthesized arrow function.\n return 0 /* False */;\n }", "function Binary(node, parent) {\n\t if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) {\n\t return true;\n\t }\n\n\t if (t.isUnaryLike(parent)) {\n\t return true;\n\t }\n\n\t if (t.isMemberExpression(parent) && parent.object === node) {\n\t return true;\n\t }\n\n\t if (t.isBinary(parent)) {\n\t var parentOp = parent.operator;\n\t var parentPos = PRECEDENCE[parentOp];\n\n\t var nodeOp = node.operator;\n\t var nodePos = PRECEDENCE[nodeOp];\n\n\t if (parentPos > nodePos) {\n\t return true;\n\t }\n\n\t if (parentPos === nodePos && parent.right === node) {\n\t return true;\n\t }\n\t }\n\t}", "function isExpressionWithEvaluationEffect(node) {\n return !(ts.isLiteralExpression(node) || ts.isIdentifier(node) || node.kind === ts.SyntaxKind.ThisKeyword);\n}", "function lua_true(op) {\n return op != null && op !== false;\n}", "isChainable() {\r\n\t\t\t\t\tvar ref1;\r\n\t\t\t\t\treturn (ref1 = this.operator) === '<' || ref1 === '>' || ref1 === '>=' || ref1 === '<=' || ref1 === '===' || ref1 === '!==';\r\n\t\t\t\t}", "function parseLeftHandSideExpressionAllowCall() {\n var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n startToken = lookahead;\n state.allowIn = true;\n\n if (matchKeyword('super') && state.inFunctionBody) {\n expr = new Node();\n lex();\n expr = expr.finishSuper();\n if (!match('(') && !match('.') && !match('[')) {\n throwUnexpectedToken(lookahead);\n }\n } else {\n expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n }\n\n for (; ;) {\n if (match('.')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n isBindingElement = false;\n isAssignmentTarget = false;\n args = parseArguments();\n expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n } else if (match('[')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else if (lookahead.type === Token.Template && lookahead.head) {\n quasi = parseTemplateLiteral();\n expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n } else {\n break;\n }\n }\n state.allowIn = previousAllowIn;\n\n return expr;\n }", "function ConditionalExpression(node, parent) {\n\t if (t.isUnaryLike(parent)) {\n\t return true;\n\t }\n\n\t if (t.isBinary(parent)) {\n\t return true;\n\t }\n\n\t if (t.isCallExpression(parent) || t.isNewExpression(parent)) {\n\t if (parent.callee === node) {\n\t return true;\n\t }\n\t }\n\n\t if (t.isConditionalExpression(parent) && parent.test === node) {\n\t return true;\n\t }\n\n\t if (t.isMemberExpression(parent) && parent.object === node) {\n\t return true;\n\t }\n\n\t return false;\n\t}", "function ConditionalExpression(node, parent) {\n\t if (t.isUnaryLike(parent)) {\n\t return true;\n\t }\n\n\t if (t.isBinary(parent)) {\n\t return true;\n\t }\n\n\t if (t.isCallExpression(parent) || t.isNewExpression(parent)) {\n\t if (parent.callee === node) {\n\t return true;\n\t }\n\t }\n\n\t if (t.isConditionalExpression(parent) && parent.test === node) {\n\t return true;\n\t }\n\n\t if (t.isMemberExpression(parent) && parent.object === node) {\n\t return true;\n\t }\n\n\t return false;\n\t}", "function AssignmentExpression(node) {\n if (t.isObjectPattern(node.left)) {\n return true;\n } else {\n return ConditionalExpression.apply(undefined, arguments);\n }\n}", "function FunctionExpression(node, parent) {\n // function () {};\n if (t.isExpressionStatement(parent)) {\n return true;\n }\n\n // (function test() {}).name;\n if (t.isMemberExpression(parent) && parent.object === node) {\n return true;\n }\n\n // (function () {})();\n if (t.isCallExpression(parent) && parent.callee === node) {\n return true;\n }\n}", "function parseLeftHandSideExpressionAllowCall() {\n\t var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n\t startToken = lookahead;\n\t state.allowIn = true;\n\n\t if (matchKeyword('super') && state.inFunctionBody) {\n\t expr = new Node();\n\t lex();\n\t expr = expr.finishSuper();\n\t if (!match('(') && !match('.') && !match('[')) {\n\t throwUnexpectedToken(lookahead);\n\t }\n\t } else {\n\t expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n\t }\n\n\t for (;;) {\n\t if (match('.')) {\n\t isBindingElement = false;\n\t isAssignmentTarget = true;\n\t property = parseNonComputedMember();\n\t expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n\t } else if (match('(')) {\n\t isBindingElement = false;\n\t isAssignmentTarget = false;\n\t args = parseArguments();\n\t expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n\t } else if (match('[')) {\n\t isBindingElement = false;\n\t isAssignmentTarget = true;\n\t property = parseComputedMember();\n\t expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n\t } else if (lookahead.type === Token.Template && lookahead.head) {\n\t quasi = parseTemplateLiteral();\n\t expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n\t } else {\n\t break;\n\t }\n\t }\n\t state.allowIn = previousAllowIn;\n\n\t return expr;\n\t }", "function parseExpression() {\n var left = parseTerm();\n var op = tokens[position];\n while (op === '+' || op === '-') {\n ++position;\n var right = parseTerm();\n left = new BinaryOperation(left, op, right);\n op = tokens[position];\n }\n return left;\n }", "function isLeftChild(node) {\n return node === node.parent.left;\n}", "function isUnaryLiteral(node) {\n if (isLiteral(node)) return true;\n if (node.type != 'UnaryExpression') return false;\n if (!isLiteral(node.argument)) return false;\n if (['-', '+', '!', '~', 'typeof'].indexOf(node.operator) == -1) return false;\n\n return true;\n }", "function ConditionalExpression(node, parent) {\n if (t.isUnaryLike(parent)) {\n return true;\n }\n\n if (t.isBinary(parent)) {\n return true;\n }\n\n if (t.isCallExpression(parent) || t.isNewExpression(parent)) {\n if (parent.callee === node) {\n return true;\n }\n }\n\n if (t.isConditionalExpression(parent) && parent.test === node) {\n return true;\n }\n\n if (t.isMemberExpression(parent) && parent.object === node) {\n return true;\n }\n\n return false;\n}", "function parseLeftHandSideExpressionAllowCall() {\n var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n startToken = lookahead;\n state.allowIn = true;\n\n if (matchKeyword('super') && state.inFunctionBody) {\n expr = new Node();\n lex();\n expr = expr.finishSuper();\n if (!match('(') && !match('.') && !match('[')) {\n throwUnexpectedToken(lookahead);\n }\n } else {\n expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n }\n\n for (;;) {\n if (match('.')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n isBindingElement = false;\n isAssignmentTarget = false;\n args = parseArguments();\n expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n } else if (match('[')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else if (lookahead.type === Token.Template && lookahead.head) {\n quasi = parseTemplateLiteral();\n expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n } else {\n break;\n }\n }\n state.allowIn = previousAllowIn;\n\n return expr;\n }", "function parseLeftHandSideExpressionAllowCall() {\n var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n startToken = lookahead;\n state.allowIn = true;\n\n if (matchKeyword('super') && state.inFunctionBody) {\n expr = new Node();\n lex();\n expr = expr.finishSuper();\n if (!match('(') && !match('.') && !match('[')) {\n throwUnexpectedToken(lookahead);\n }\n } else {\n expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n }\n\n for (;;) {\n if (match('.')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n isBindingElement = false;\n isAssignmentTarget = false;\n args = parseArguments();\n expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n } else if (match('[')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else if (lookahead.type === Token.Template && lookahead.head) {\n quasi = parseTemplateLiteral();\n expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n } else {\n break;\n }\n }\n state.allowIn = previousAllowIn;\n\n return expr;\n }", "function parseLeftHandSideExpressionAllowCall() {\n var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n startToken = lookahead;\n state.allowIn = true;\n\n if (matchKeyword('super') && state.inFunctionBody) {\n expr = new Node();\n lex();\n expr = expr.finishSuper();\n if (!match('(') && !match('.') && !match('[')) {\n throwUnexpectedToken(lookahead);\n }\n } else {\n expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);\n }\n\n for (;;) {\n if (match('.')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n isBindingElement = false;\n isAssignmentTarget = false;\n args = parseArguments();\n expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n } else if (match('[')) {\n isBindingElement = false;\n isAssignmentTarget = true;\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else if (lookahead.type === Token.Template && lookahead.head) {\n quasi = parseTemplateLiteral();\n expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);\n } else {\n break;\n }\n }\n state.allowIn = previousAllowIn;\n\n return expr;\n }", "function FunctionExpression(node, parent) {\n\t // function () {};\n\t if (t.isExpressionStatement(parent)) {\n\t return true;\n\t }\n\n\t // (function test() {}).name;\n\t if (t.isMemberExpression(parent) && parent.object === node) {\n\t return true;\n\t }\n\n\t // (function () {})();\n\t if (t.isCallExpression(parent) && parent.callee === node) {\n\t return true;\n\t }\n\t}", "function FunctionExpression(node, parent) {\n\t // function () {};\n\t if (t.isExpressionStatement(parent)) {\n\t return true;\n\t }\n\n\t // (function test() {}).name;\n\t if (t.isMemberExpression(parent) && parent.object === node) {\n\t return true;\n\t }\n\n\t // (function () {})();\n\t if (t.isCallExpression(parent) && parent.callee === node) {\n\t return true;\n\t }\n\t}", "function isFirstInStatement(printStack /*: Array<Object>*/) /*: boolean*/ {\n\t var i = printStack.length - 1;\n\t var node = printStack[i];\n\t i--;\n\t var parent = printStack[i];\n\t while (i > 0) {\n\t if (t.isExpressionStatement(parent, { expression: node })) {\n\t return true;\n\t }\n\n\t if (t.isCallExpression(parent, { callee: node }) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isMemberExpression(parent, { object: node }) || t.isConditional(parent, { test: node }) || t.isBinary(parent, { left: node }) || t.isAssignmentExpression(parent, { left: node })) {\n\t node = parent;\n\t i--;\n\t parent = printStack[i];\n\t } else {\n\t return false;\n\t }\n\t }\n\n\t return false;\n\t}", "function isThisExpression(node, typescript) {\n return node.kind === typescript.SyntaxKind.ThisKeyword;\n}", "function AssignmentExpression(node) {\n\t if (t.isObjectPattern(node.left)) {\n\t return true;\n\t } else {\n\t return ConditionalExpression.apply(undefined, arguments);\n\t }\n\t}", "function AssignmentExpression(node) {\n\t if (t.isObjectPattern(node.left)) {\n\t return true;\n\t } else {\n\t return ConditionalExpression.apply(undefined, arguments);\n\t }\n\t}", "statementNeedsParens(): boolean {\n return this.expression.statementShouldAddParens();\n }", "function operator(op) {\n if (op == '+' || op == '-' ||\n op == '^' || op == '*' ||\n op == '/' || op == '(' ||\n op == ')') {\n return true;\n }\n else\n return false;\n}", "function isLodashCallExpression(node) {\n return true;\n}", "function expressionContainsSuperKeyword(expression, typescript) {\n if (isSuperExpression(expression, typescript))\n return true;\n else if (typescript.isPropertyAccessExpression(expression)) {\n return expressionContainsSuperKeyword(expression.expression, typescript) || expressionContainsSuperKeyword(expression.name, typescript);\n }\n else if (typescript.isElementAccessExpression(expression)) {\n return expressionContainsSuperKeyword(expression.expression, typescript) || expressionContainsSuperKeyword(expression.argumentExpression, typescript);\n }\n else if (typescript.isParenthesizedExpression(expression))\n return expressionContainsSuperKeyword(expression.expression, typescript);\n else if (typescript.isAsExpression(expression))\n return expressionContainsSuperKeyword(expression.expression, typescript);\n else if (typescript.isTypeAssertion(expression))\n return expressionContainsSuperKeyword(expression.expression, typescript);\n else {\n return false;\n }\n}", "function isLeftHandSide$939(expr$1284) {\n return expr$1284.type === Syntax$872.Identifier || expr$1284.type === Syntax$872.MemberExpression;\n }", "UnaryExpression() {\n let operator;\n switch (this._lookahead.type) {\n case 'ADDITIVE_OPERATOR':\n operator = this._eat('ADDITIVE_OPERATOR').value;\n break;\n case 'LOGICAL_NOT':\n operator = this._eat('LOGICAL_NOT').value;\n break;\n }\n if (operator != null) {\n return {\n type: 'UnaryExpression',\n operator,\n argument: this.UnaryExpression(), // chained expressions: --x\n };\n }\n return this.LeftHandSideExpression();\n }", "function parentheses(expression){\n let stack = new Stack();\n for(let i=0; i<expression.length; i++){\n if(expression[i] === '('){\n stack.push('(');\n }\n if(expression[i] === ')'){\n if(stack.top === null){\n return false; \n }\n stack.pop();\n }\n }\n if(stack.top === null){\n return true;\n }\n else false;\n}", "function mightBeExpression(str, fields) {\n fields = fields || [];\n if (fields.indexOf(str.trim()) > -1) return true;\n return /[(){}./*?:&|=[+-]/.test(str);\n }", "function has_unfolded_expression(str)\n{\n\treturn str.indexOf('[]') != -1;\n}", "function and() {\n return _.reduce(arrgs(arguments), function (result, exp) {\n return result && truthy(_.isFunction(exp) ? exp() : exp);\n }, true);\n}", "function Expression() {\n AddExpression();\n if (currentClass() == RELATIONAL_OPERATOR || currentClass() == LOGICAL_OPERATOR) {\n nextToken();\n Expression();\n return;\n }\n return;\n }", "function and(x) {\n return function(y) {\n return x && y;\n };\n }", "static isExpressioned(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.SpreadAssignment;\r\n }", "function is_left(x0, y0, x1, y1, x2, y2) {\n return ( ((x1 - x0) * (y2 - y0)) - ((x2 - x0) * (y1 - y0)) );\n}", "function reportLeftRecursion(ast) {\n var visitedRules = [];\n\n var check = visitor.build({\n rule: function(node) {\n visitedRules.push(node.name);\n check(node.expression);\n visitedRules.pop(node.name);\n },\n\n sequence: function(node) {\n arrays.every(node.elements, function(element) {\n check(element);\n\n return !asts.alwaysAdvancesOnSuccess(ast, element);\n });\n },\n\n rule_ref: function(node) {\n if (arrays.contains(visitedRules, node.name)) {\n throw new GrammarError(\n \"Left recursion detected for rule \\\"\" + node.name + \"\\\".\",\n node.location\n );\n }\n\n check(asts.findRule(ast, node.name));\n }\n });\n\n check(ast);\n }", "function expression(content) {\n var left = term(content);\n // alert(\"exp-left: \" + left);\n var t = getToken(content);\n while (true) {\n if (t == \"+\") {\n left += term(content);\n t = getToken(content);\n }\n else if (t == \"-\") {\n left -= term(content);\n t = getToken(content);\n }\n else {\n putToken(t, content);\n return left;\n }\n }\n}", "function matchOp() {\n\t\tvar pattern = /^(\\+|-)/;\n\t\tvar x = lexString.match(pattern);\n\t\tif(x !== null) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "function isCallExpression(node) {\n return node.kind === ts.SyntaxKind.CallExpression;\n}", "function isWeakPrecedenceParent(node) {\n const parent = node.parent;\n if (parent.type === utils_1.AST_NODE_TYPES.UpdateExpression ||\n parent.type === utils_1.AST_NODE_TYPES.UnaryExpression ||\n parent.type === utils_1.AST_NODE_TYPES.BinaryExpression ||\n parent.type === utils_1.AST_NODE_TYPES.LogicalExpression ||\n parent.type === utils_1.AST_NODE_TYPES.ConditionalExpression ||\n parent.type === utils_1.AST_NODE_TYPES.AwaitExpression) {\n return true;\n }\n if (parent.type === utils_1.AST_NODE_TYPES.MemberExpression &&\n parent.object === node) {\n return true;\n }\n if ((parent.type === utils_1.AST_NODE_TYPES.CallExpression ||\n parent.type === utils_1.AST_NODE_TYPES.NewExpression) &&\n parent.callee === node) {\n return true;\n }\n if (parent.type === utils_1.AST_NODE_TYPES.TaggedTemplateExpression &&\n parent.tag === node) {\n return true;\n }\n return false;\n}", "function comparePrecedenceToBinaryPlus(expression) {\n // All binary expressions have lower precedence than '+' apart from '*', '/', and '%'\n // which have greater precedence and '-' which has equal precedence.\n // All unary operators have a higher precedence apart from yield.\n // Arrow functions and conditionals have a lower precedence,\n // although we convert the former into regular function expressions in ES5 mode,\n // and in ES6 mode this function won't get called anyway.\n //\n // TODO (drosen): Note that we need to account for the upcoming 'yield' and\n // spread ('...') unary operators that are anticipated for ES6.\n switch (expression.kind) {\n case 187 /* BinaryExpression */:\n switch (expression.operatorToken.kind) {\n case 37 /* AsteriskToken */:\n case 39 /* SlashToken */:\n case 40 /* PercentToken */:\n return 1 /* GreaterThan */;\n case 35 /* PlusToken */:\n case 36 /* MinusToken */:\n return 0 /* EqualTo */;\n default:\n return -1 /* LessThan */;\n }\n case 190 /* YieldExpression */:\n case 188 /* ConditionalExpression */:\n return -1 /* LessThan */;\n default:\n return 1 /* GreaterThan */;\n }\n }", "function shouldAddParenthesesToChainElement(path) {\n // Babel, this was implemented before #13735, can use `path.match` as estree does\n const { node, parent, grandparent, key } = path;\n if (\n (node.type === \"OptionalMemberExpression\" ||\n node.type === \"OptionalCallExpression\") &&\n ((key === \"object\" && parent.type === \"MemberExpression\") ||\n (key === \"callee\" &&\n (parent.type === \"CallExpression\" ||\n parent.type === \"NewExpression\")) ||\n (parent.type === \"TSNonNullExpression\" &&\n grandparent.type === \"MemberExpression\" &&\n grandparent.object === parent))\n ) {\n return true;\n }\n\n // ESTree, same logic as babel\n if (\n path.match(\n () => node.type === \"CallExpression\" || node.type === \"MemberExpression\",\n (node, name) => name === \"expression\" && node.type === \"ChainExpression\",\n ) &&\n (path.match(\n undefined,\n undefined,\n (node, name) =>\n (name === \"callee\" &&\n ((node.type === \"CallExpression\" && !node.optional) ||\n node.type === \"NewExpression\")) ||\n (name === \"object\" &&\n node.type === \"MemberExpression\" &&\n !node.optional),\n ) ||\n path.match(\n undefined,\n undefined,\n (node, name) =>\n name === \"expression\" && node.type === \"TSNonNullExpression\",\n (node, name) => name === \"object\" && node.type === \"MemberExpression\",\n ))\n ) {\n return true;\n }\n\n // Babel treat `(a?.b!).c` and `(a?.b)!.c` the same, https://github.com/babel/babel/discussions/15077\n // Use this to align with babel\n if (\n path.match(\n () => node.type === \"CallExpression\" || node.type === \"MemberExpression\",\n (node, name) =>\n name === \"expression\" && node.type === \"TSNonNullExpression\",\n (node, name) => name === \"expression\" && node.type === \"ChainExpression\",\n (node, name) => name === \"object\" && node.type === \"MemberExpression\",\n )\n ) {\n return true;\n }\n\n // This function only handle cases above\n return false;\n}", "function parseMaybeUnary() {\n if (isTypeScriptEnabled && !isJSXEnabled && eat(TokenType.lessThan)) {\n tsParseTypeAssertion();\n return false;\n }\n if (\n isContextual(ContextualKeyword._module) &&\n lookaheadCharCode() === charCodes.leftCurlyBrace &&\n !hasFollowingLineBreak()\n ) {\n parseModuleExpression();\n return false;\n }\n if (state.type & TokenType.IS_PREFIX) {\n next();\n parseMaybeUnary();\n return false;\n }\n\n const wasArrow = parseExprSubscripts();\n if (wasArrow) {\n return true;\n }\n while (state.type & TokenType.IS_POSTFIX && !canInsertSemicolon()) {\n // The tokenizer calls everything a preincrement, so make it a postincrement when\n // we see it in that context.\n if (state.type === TokenType.preIncDec) {\n state.type = TokenType.postIncDec;\n }\n next();\n }\n return false;\n}", "function Left$prototype$equals(other) {\n return other.isLeft && Z.equals (this.value, other.value);\n }", "function isValid(left, right) {\n return (!util.isTokenOnSameLine(left, right) ||\n sourceCode.isSpaceBetween(left, right) === always);\n }", "get isLeft() {\n return this.args.isLeft ?? true;\n }", "function checkForDisallowedESSymbolOperand(operator) {\n var offendingSymbolOperand = maybeTypeOfKind(leftType, 512 /* ESSymbol */) ? left :\n maybeTypeOfKind(rightType, 512 /* ESSymbol */) ? right :\n undefined;\n if (offendingSymbolOperand) {\n error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator));\n return false;\n }\n return true;\n }", "function parseExprOps(noIn) {\n const startTokenIndex = state.tokens.length;\n const wasArrow = parseMaybeUnary();\n if (wasArrow) {\n return true;\n }\n parseExprOp(startTokenIndex, -1, noIn);\n return false;\n}" ]
[ "0.8215102", "0.74610543", "0.70854646", "0.685377", "0.6403905", "0.6375215", "0.63261646", "0.62065786", "0.6187234", "0.6187234", "0.6187234", "0.6187234", "0.6169254", "0.61390203", "0.5947404", "0.5928136", "0.5927452", "0.5848139", "0.5823447", "0.58146197", "0.57984775", "0.5770925", "0.5766344", "0.5748043", "0.5718877", "0.5715152", "0.5701275", "0.5701275", "0.5701275", "0.5698663", "0.5681928", "0.5662275", "0.5639883", "0.5635561", "0.5598104", "0.559149", "0.5577892", "0.5577892", "0.55689645", "0.5555412", "0.55524534", "0.55400413", "0.55322546", "0.55142826", "0.55079657", "0.55043334", "0.55043334", "0.55043334", "0.5501149", "0.5501149", "0.54611564", "0.5443408", "0.54376316", "0.54376316", "0.54142016", "0.5411762", "0.5380903", "0.5366154", "0.5354859", "0.53508383", "0.5319765", "0.5315926", "0.5314073", "0.5313598", "0.53005695", "0.5275674", "0.5275289", "0.5270983", "0.526307", "0.5260903", "0.5251109", "0.5251065", "0.5236989", "0.52326953", "0.5228601", "0.5210682", "0.5210055", "0.52042735", "0.51929015", "0.5189875", "0.5189109" ]
0.6991114
21
11.1.6 The Grouping Operator
function parseGroupExpression() { var expr; expect('('); expr = parseExpression(); expect(')'); return expr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseGroupExpression() {\n var expr, marker, typeAnnotation;\n \n expect('(');\n \n ++state.parenthesizedCount;\n \n marker = markerCreate();\n \n expr = parseExpression();\n \n if (match(':')) {\n typeAnnotation = parseTypeAnnotation();\n expr = markerApply(marker, delegate.createTypeCast(\n expr,\n typeAnnotation\n ));\n }\n \n expect(')');\n \n return expr;\n }", "function parseGroupExpression() {\n var expr, marker, typeAnnotation;\n\n expect('(');\n\n ++state.parenthesizedCount;\n\n marker = markerCreate();\n\n expr = parseExpression();\n\n if (match(':')) {\n typeAnnotation = parseTypeAnnotation();\n expr = markerApply(marker, delegate.createTypeCast(\n expr,\n typeAnnotation\n ));\n }\n\n expect(')');\n\n return expr;\n }", "function parseGroupExpression() {\n var expr, marker, typeAnnotation;\n\n expect('(');\n\n ++state.parenthesizedCount;\n\n marker = markerCreate();\n\n expr = parseExpression();\n\n if (match(':')) {\n typeAnnotation = parseTypeAnnotation();\n expr = markerApply(marker, delegate.createTypeCast(\n expr,\n typeAnnotation\n ));\n }\n\n expect(')');\n\n return expr;\n }", "function parseGroupExpression() {\n\t var expr;\n\n\t expect('(');\n\n\t ++state.parenthesisCount;\n\n\t expr = parseExpression();\n\n\t expect(')');\n\n\t return expr;\n\t }", "function group(xs){\r\n return groupBy(Eq.eq, xs);\r\n}", "function parseGroupExpression$949() {\n var expr$1320;\n expect$932('(');\n ++state$893.parenthesizedCount;\n expr$1320 = parseExpression$969();\n expect$932(')');\n return expr$1320;\n }", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesizedCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesizedCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesizedCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesizedCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesizedCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }", "function l$1(e){return e&&\"group\"===e.type}", "function determineGroup(op) {\n switch (op) {\n case \"+\":\n return add;\n break;\n case \"-\":\n return subtract;\n break;\n default:\n return lastSpecial;\n break;\n }\n }", "function parseGroupExpression()\n\t\t{\n\t\t\tvar expr;\n\t\t\texpect('(');\n\t\t\tif (match(')'))\n\t\t\t{\n\t\t\t\tlex();\n\t\t\t\treturn PlaceHolders.ArrowParameterPlaceHolder;\n\t\t\t}\n\t\t\t++state.parenthesisCount;\n\t\t\texpr = parseExpression();\n\t\t\texpect(')');\n\t\t\treturn expr;\n\t\t}", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesizedCount;\n\n state.allowArrowFunction = !state.allowArrowFunction;\n expr = parseExpression();\n state.allowArrowFunction = false;\n\n if (expr.type !== Syntax.ArrowFunctionExpression) {\n expect(')');\n }\n\n return expr;\n }", "function Group(_) {\n /* istanbul ignore next */\n return null;\n}", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n if (match(')')) {\n lex();\n return PlaceHolders.ArrowParameterPlaceHolder;\n }\n\n ++state.parenthesisCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesisCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesisCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }", "function group() {\n return wrap('group', and(\n displayName,\n literal(':'),\n opt(groupList),\n literal(';'),\n invis(opt(cfws))\n )());\n }", "function group() {\n return wrap('group', and(\n displayName,\n literal(':'),\n opt(groupList),\n literal(';'),\n invis(opt(cfws))\n )());\n }", "function group() {\n return wrap('group', and(\n displayName,\n literal(':'),\n opt(groupList),\n literal(';'),\n invis(opt(cfws))\n )());\n }", "function group() {\n return wrap('group', and(\n displayName,\n literal(':'),\n opt(groupList),\n literal(';'),\n invis(opt(cfws))\n )());\n }", "function group(expr) {\n dbg('Parsing group:');\n dbg(expr);\n // If the expression is down to a single term, just return the\n // expression containing that term.\n if (expr.length == 1) {\n dbg('Reached bottom: ' + expr[0]);\n return expr;\n }\n // Generate the different possible groupings of this list of terms.\n var grouping_options = [];\n for (var i=1; i < expr.length; i += 2) {\n // Split the list into two pieces, one on the left side of the\n // current point in the list, the other on the right side.\n var operator = expr[i];\n var before = expr.slice(0, i);\n var after = expr.slice(i+1);\n dbg('operator: ' + operator);\n dbg('before:');\n dbg(before);\n dbg('after:');\n dbg(after);\n // For side of the split, call this function recursively to get\n // all the possible groupings within that sublist.\n var beforeGroups = group(before);\n var afterGroups = group(after);\n // Generate all the possible pairings of left-side groupings and\n // right-side groupings.\n for (var b=0; b < beforeGroups.length; b++) {\n for (var a=0; a < afterGroups.length; a++) {\n grouping_options.push(\n [beforeGroups[b], operator, afterGroups[a]]);\n }\n }\n }\n dbg('return:');\n dbg(grouping_options.map(str));\n return grouping_options;\n }", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n}", "function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n}", "function groupBy(f) {\n return as => groupBy_(as, f);\n}", "[Symbol.iterator]()\n {\n return new GroupIterator(this);\n }", "getGroupingSeparator() {}", "function _gobbleGroup(context) {\n context.index++;\n var node = _gobbleExpression(context);\n _gobbleSpaces(context);\n if (context.expr.charCodeAt(context.index) === CPAREN_CODE) {\n context.index++;\n return node;\n }\n _throwError('Unclosed (', context.index);\n }", "function groupBy(list, key) {\n throw 'not implemented';\n}", "processGroup(group) {\n\n }", "group(val) {\n if (!val) {\n return this._group;\n }\n this._group = val;\n return this;\n }", "function l(e) {\n return e && \"group\" === e.type;\n }", "function groupBy(array, f) {\n\t\t\t\t\t\t\t var groups = {};\n\t\t\t\t\t\t\t array.forEach(function (o) {\n\t\t\t\t\t\t\t\t\t var group = JSON.stringify(f(o));\n\t\t\t\t\t\t\t\t\t groups[group] = groups[group] || [];\n\t\t\t\t\t\t\t\t\t groups[group].push(o);\n\t\t\t\t\t\t\t });\n\t\t\t\t\t\t\t return Object.keys(groups).map(function (group) {\n\t\t\t\t\t\t\t\t\t return groups[group];\n\t\t\t\t\t\t\t });\n\t\t\t\t\t }", "function getGroup() { return group; }", "function htmlGroup (arrElement){\n return ((arrElement.grouped == true) ? \" class='hmrc-s-grouped' \" : \" class='hmrc-s-single' \")\n}", "get groupingIdentifier() {\n return this.fields.groupingIdentifier;\n }", "function groupBy(eq, xs){\r\n if(!xs.length)\r\n return emptyListOf(xs);\r\n var a = uncons(xs),\r\n b = span(function(e){ return eq(x, e) }, xs);\r\n return cons(cons(a.head, b.ys), groupBy(eq, b.zs));\r\n}", "function Group(props) {\n\tvar children = React.Children.toArray(props.children).filter(Boolean);\n\tif (children.length === 1) {\n\t\treturn children;\n\t}\n\n\t// Insert separators\n\tvar separator = props.separator;\n\tvar separatorIsElement = React.isValidElement(separator);\n\tvar items = [children.shift()];\n\tchildren.forEach(function(item, index) {\n\t\tif (separatorIsElement) {\n\t\t\tvar key = 'separator-' + (item.key || index);\n\t\t\tseparator = React.cloneElement(separator, { key: key });\n\t\t}\n\t\titems.push(separator, item);\n\t});\n\n\treturn items;\n}", "function groupBy( array , f )\n{\n var groups = {};\n array.forEach( function( o )\n {\n var group = JSON.stringify( f(o) );\n groups[group] = groups[group] || [];\n groups[group].push( o ); \n });\n return Object.keys(groups).map( function( group )\n {\n return groups[group]; \n })\n}", "function explorableGroup(options) {\n let group;\n\n group = options.where\n .append(\"g\");\n\n return group;\n}", "function groupBy(f) {\n return function(xs) {\n if (xs.length === 0) return [];\n var x0 = xs[0]; // :: a\n var active = [x0]; // :: Array a\n var result = [active]; // :: Array (Array a)\n for (var idx = 1; idx < xs.length; idx += 1) {\n var x = xs[idx];\n if (f (x0) (x)) active.push (x); else result.push (active = [x0 = x]);\n }\n return result;\n };\n }", "get groupingBehavior () {\n\t\treturn this._groupingBehavior;\n\t}", "get group(){ return this.__group; }", "function groupBy(arr, group) {\n var groups = {};\n //forEach element in the array\n //var elementGroup = get the group by calling century function on the person\n //see if that group is already in groups object, if not, add it to groups object\n arr.forEach(function(element){\n var elementGroup = group(element);\n //console.log(elementGroup);\n if (elementGroup in groups) {\n groups[elementGroup].push(element);\n }else {\n groups[elementGroup] = [element]; \n }\n });\n\n return groups;\n}", "function parseGroup(tok) {\n\tvar startPosition = tok.position();\n\ttok.consume(\"(\");\n\tvar items = [];\n\twhile (true) {\n\t\tvar next = tok.peek();\n\t\tif (next == null)\n\t\t\tthrow {message: \"Element, group, or closing parenthesis expected\", start: tok.position()};\n\t\telse if (next == \"(\")\n\t\t\titems.push(parseGroup(tok));\n\t\telse if (/^[A-Za-z][a-z]*$/.test(next))\n\t\t\titems.push(parseElement(tok));\n\t\telse if (next == \")\") {\n\t\t\ttok.consume(\")\");\n\t\t\tif (items.length == 0)\n\t\t\t\tthrow {message: \"Empty group\", start: startPosition, end: tok.position()};\n\t\t\tbreak;\n\t\t} else\n\t\t\tthrow {message: \"Element, group, or closing parenthesis expected\", start: tok.position()};\n\t}\n\t\n\treturn new Group(items, parseOptionalNumber(tok));\n}", "static reduceConsecutiveSameStyleBlocksToOne(groups) {\n var newLineOp = DeltaInsertOp.createNewLineOp();\n return groups.map(function (elm) {\n if (!Array.isArray(elm)) {\n if (elm instanceof BlockGroup && !elm.ops.length) {\n elm.ops.push(newLineOp);\n }\n return elm;\n }\n var groupsLastInd = elm.length - 1;\n elm[0].ops = flatten(elm.map((g, i) => {\n if (!g.ops.length) {\n return [newLineOp];\n }\n return g.ops.concat(i < groupsLastInd ? [newLineOp] : []);\n }));\n return elm[0];\n });\n }", "function groupAny(groupFunction) {\n if (isEmpty()) {\n return [[]];\n }\n var arrInit = [[cardsArr.first()]];\n return cardsArr.from(1).reduce(function (arr, next) {\n var currentArr = arr.last();\n var prev = currentArr.last();\n if (groupFunction(prev, next)) {\n //console.log(\"\"+next.asString+\" is grouped with \"+prev.asString);\n currentArr.push(next);\n } else {\n // else put in new group\n //console.log(\"\"+next.asString+\" is put in new group\");\n arr.push([next]);\n }\n return arr;\n }, arrInit).sortBy(function (arr) {\n // sort group arr so that longest arr comes last\n return arr.length;\n }); // [ [S,S,S,S,S] , [D,D] ] -> [ [D,D], [S,S,S,S,S] ] ->\n }", "static from(iter) {\n let outputGroup = new Group();\n let thisIter = iter[Symbol.iterator]();\n let currentVal = thisIter.next();\n\n //loops over the iterable until done is true\n while(!currentVal.done) {\n if(!outputGroup.has(currentVal.value)) {\n outputGroup.add(currentVal.value);\n }\n currentVal = thisIter.next();\n }\n\n //returns the new Group with the iterable's values, non-repeating!\n return outputGroup;\n }", "_groupTags(tags) {\n if (tags.length === 0) {\n return [];\n }\n const hasMessageBlocks = (tags[0] instanceof Tags.TagMessageBlock);\n const groups = [];\n let curGroup;\n\n for (let i of tags) {\n if (hasMessageBlocks && i instanceof Tags.TagMessageBlock && i.isStarting ||\n !hasMessageBlocks && i instanceof Tags.TagTransactionReferenceNumber) {\n groups.push(curGroup = []); // Statement starting tag -> start new group\n }\n curGroup.push(i);\n }\n return groups;\n }", "function getSemigroup(S) {\n return T.getSemigroup(E.getSemigroup(S));\n}", "function group (frame) {\n let v, name, op;\n const entries = fields.map((field, index) => {\n name = ops[index];\n op = scalar_operations.get('count');\n if (name) {\n op = scalar_operations.get(name);\n if (!op) {\n op = scalar_operations.get('count');\n warn(`Operation ${name} is not supported, use count`);\n }\n }\n return {\n field: field,\n as: as[index] || field,\n op: op\n };\n });\n\n return frame.dimension(groupby).group().reduce((o, record) => {\n return entries.reduce((oo, entry) => {\n v = 0;\n if (entry.as in oo) v = oo[entry.as];\n oo[entry.as] = entry.op(v, record[entry.field]);\n return oo;\n }, o);\n }, null, Object).all().map(d => {\n d.value[groupby] = d.key;\n return d.value;\n });\n }", "function groupingTestCases() {\n return [\n {\n message: 'USER FIELD: A to Z',\n fieldName: 'USER NAME',\n groupDirection: 'Group A to Z',\n expectedGroups: ['Angela Leon', 'Chris Baker', 'Jon Neil'],\n expectedRecords: [\n ['Planning', 'Workstation purchase', '03-21-2009', '04-10-2009', '-15250284452.47152052910053 weeks', '9900%'],\n ['Planning', 'Server purchase', '03-16-2009', '04-10-2009', '-15250284452.47152052910053 weeks', '10000%'],\n ['Development', 'Upgrade DBMS', '03-19-2009', '04-28-2009', '-15250284452.47152052910053 weeks', '9900%'],\n ['Development', 'Install latest software', '03-31-2009', '04-28-2009', '-15250284452.47152052910053 weeks', '10000%']\n ]\n },\n {\n message: 'TEXT FIELD: Z to A',\n fieldName: 'PROJECT PHASE',\n groupDirection: 'Group Z to A',\n expectedGroups: ['Planning', 'Development'],\n expectedRecords: [\n ['Angela Leon', 'Workstation purchase', '03-21-2009', '04-10-2009', '-15250284452.47152052910053 weeks', '9900%'],\n ['Chris Baker', 'Server purchase', '03-16-2009', '04-10-2009', '-15250284452.47152052910053 weeks', '10000%'],\n ['Chris Baker', 'Upgrade DBMS', '03-19-2009', '04-28-2009', '-15250284452.47152052910053 weeks', '9900%'],\n ['Jon Neil', 'Install latest software', '03-31-2009', '04-28-2009', '-15250284452.47152052910053 weeks', '10000%']\n ]\n },\n {\n message: 'DATE FIELD: oldest to newest',\n fieldName: 'FINISH DATE',\n groupDirection: 'Group oldest to newest',\n expectedGroups: ['04-10-2009', '04-28-2009'],\n expectedRecords: [\n ['Angela Leon', 'Planning', 'Workstation purchase', '03-21-2009', '-15250284452.47152052910053 weeks', '9900%'],\n ['Chris Baker', 'Planning', 'Server purchase', '03-16-2009', '-15250284452.47152052910053 weeks', '10000%'],\n ['Chris Baker', 'Development', 'Upgrade DBMS', '03-19-2009', '-15250284452.47152052910053 weeks', '9900%'],\n ['Jon Neil', 'Development', 'Install latest software', '03-31-2009', '-15250284452.47152052910053 weeks', '10000%'],\n\n ]\n },\n {\n message: 'NUMERIC FIELD: Duration field lowest to highest',\n fieldName: 'DURATION TAKEN',\n groupDirection: 'Group lowest to highest',\n expectedGroups: ['(Empty)'], //TODO report a bug on below. The header says empty after grouping\n expectedRecords: [\n ['Angela Leon', 'Planning', 'Workstation purchase', '03-21-2009', '04-10-2009', '9900%'],\n ['Chris Baker', 'Planning', 'Server purchase', '03-16-2009', '04-10-2009', '10000%'],\n ['Chris Baker', 'Development', 'Upgrade DBMS', '03-19-2009', '04-28-2009', '9900%'],\n ['Jon Neil', 'Development', 'Install latest software', '03-31-2009', '04-28-2009', '10000%']\n ]\n },\n ];\n }", "function obsGroupList() {\n return opts.strict ? null : wrap('obs-group-list', and(\n star(and(\n invis(opt(cfws)),\n literal(',')\n ), 1),\n invis(opt(cfws))\n )());\n }", "function obsGroupList() {\n return opts.strict ? null : wrap('obs-group-list', and(\n star(and(\n invis(opt(cfws)),\n literal(',')\n ), 1),\n invis(opt(cfws))\n )());\n }", "function obsGroupList() {\n return opts.strict ? null : wrap('obs-group-list', and(\n star(and(\n invis(opt(cfws)),\n literal(',')\n ), 1),\n invis(opt(cfws))\n )());\n }", "function obsGroupList() {\n return opts.strict ? null : wrap('obs-group-list', and(\n star(and(\n invis(opt(cfws)),\n literal(',')\n ), 1),\n invis(opt(cfws))\n )());\n }", "function parseGroupExpression() {\n var expr, expressions, startToken, i;\n\n expect('(');\n\n if (match(')')) {\n lex();\n if (!match('=>')) {\n expect('=>');\n }\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: []\n };\n }\n\n startToken = lookahead;\n if (match('...')) {\n expr = parseRestElement();\n expect(')');\n if (!match('=>')) {\n expect('=>');\n }\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: [expr]\n };\n }\n\n isBindingElement = true;\n expr = inheritCoverGrammar(parseAssignmentExpression);\n\n if (match(',')) {\n isAssignmentTarget = false;\n expressions = [expr];\n\n while (startIndex < length) {\n if (!match(',')) {\n break;\n }\n lex();\n\n if (match('...')) {\n if (!isBindingElement) {\n throwUnexpectedToken(lookahead);\n }\n expressions.push(parseRestElement());\n expect(')');\n if (!match('=>')) {\n expect('=>');\n }\n isBindingElement = false;\n for (i = 0; i < expressions.length; i++) {\n reinterpretExpressionAsPattern(expressions[i]);\n }\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: expressions\n };\n }\n\n expressions.push(inheritCoverGrammar(parseAssignmentExpression));\n }\n\n expr = new WrappingNode(startToken).finishSequenceExpression(expressions);\n }\n\n\n expect(')');\n\n if (match('=>')) {\n if (!isBindingElement) {\n throwUnexpectedToken(lookahead);\n }\n\n if (expr.type === Syntax.SequenceExpression) {\n for (i = 0; i < expr.expressions.length; i++) {\n reinterpretExpressionAsPattern(expr.expressions[i]);\n }\n } else {\n reinterpretExpressionAsPattern(expr);\n }\n\n expr = {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr]\n };\n }\n isBindingElement = false;\n return expr;\n }", "rowGroup(slice) {\n\n let boolArray = slice.map( (row) => {\n return this.row(row)\n }) \n\n let expr = boolArray[0]\n\n for(let i = 0; i < boolArray.length - 1; i++) {\n let row = slice[i]\n let operator = row[0].relationToNext === \"OR\" ? \"||\" : \"&&\"\n expr += operator + boolArray[i +1]\n }\n\n return eval(expr)\n }", "function GroupBy(source, getKey, compares) {\n var tree = new algorithm.BTree.binaryTree(compares);\n var key;\n var list;\n for (var _i = 0, source_5 = source; _i < source_5.length; _i++) {\n var obj = source_5[_i];\n key = getKey(obj);\n list = tree.find(key);\n if (list) {\n list.push(obj);\n }\n else {\n tree.add(key, [obj]);\n }\n }\n // TypeScript.logging.log(tree);\n return tree\n .AsEnumerable()\n .Select(function (node) {\n return new Group(node.key, node.value);\n });\n }", "function parseGroupExpression() {\n\t var expr, expressions, startToken, i, params = [];\n\n\t expect('(');\n\n\t if (match(')')) {\n\t lex();\n\t if (!match('=>')) {\n\t expect('=>');\n\t }\n\t return {\n\t type: PlaceHolders.ArrowParameterPlaceHolder,\n\t params: [],\n\t rawParams: []\n\t };\n\t }\n\n\t startToken = lookahead;\n\t if (match('...')) {\n\t expr = parseRestElement(params);\n\t expect(')');\n\t if (!match('=>')) {\n\t expect('=>');\n\t }\n\t return {\n\t type: PlaceHolders.ArrowParameterPlaceHolder,\n\t params: [expr]\n\t };\n\t }\n\n\t isBindingElement = true;\n\t expr = inheritCoverGrammar(parseAssignmentExpression);\n\n\t if (match(',')) {\n\t isAssignmentTarget = false;\n\t expressions = [expr];\n\n\t while (startIndex < length) {\n\t if (!match(',')) {\n\t break;\n\t }\n\t lex();\n\n\t if (match('...')) {\n\t if (!isBindingElement) {\n\t throwUnexpectedToken(lookahead);\n\t }\n\t expressions.push(parseRestElement(params));\n\t expect(')');\n\t if (!match('=>')) {\n\t expect('=>');\n\t }\n\t isBindingElement = false;\n\t for (i = 0; i < expressions.length; i++) {\n\t reinterpretExpressionAsPattern(expressions[i]);\n\t }\n\t return {\n\t type: PlaceHolders.ArrowParameterPlaceHolder,\n\t params: expressions\n\t };\n\t }\n\n\t expressions.push(inheritCoverGrammar(parseAssignmentExpression));\n\t }\n\n\t expr = new WrappingNode(startToken).finishSequenceExpression(expressions);\n\t }\n\n\n\t expect(')');\n\n\t if (match('=>')) {\n\t if (expr.type === Syntax.Identifier && expr.name === 'yield') {\n\t return {\n\t type: PlaceHolders.ArrowParameterPlaceHolder,\n\t params: [expr]\n\t };\n\t }\n\n\t if (!isBindingElement) {\n\t throwUnexpectedToken(lookahead);\n\t }\n\n\t if (expr.type === Syntax.SequenceExpression) {\n\t for (i = 0; i < expr.expressions.length; i++) {\n\t reinterpretExpressionAsPattern(expr.expressions[i]);\n\t }\n\t } else {\n\t reinterpretExpressionAsPattern(expr);\n\t }\n\n\t expr = {\n\t type: PlaceHolders.ArrowParameterPlaceHolder,\n\t params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr]\n\t };\n\t }\n\t isBindingElement = false;\n\t return expr;\n\t }", "function parseGroupExpression() {\n var expr, expressions, startToken, i, params = [];\n\n expect('(');\n\n if (match(')')) {\n lex();\n if (!match('=>')) {\n expect('=>');\n }\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: [],\n rawParams: []\n };\n }\n\n startToken = lookahead;\n if (match('...')) {\n expr = parseRestElement(params);\n expect(')');\n if (!match('=>')) {\n expect('=>');\n }\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: [expr]\n };\n }\n\n isBindingElement = true;\n expr = inheritCoverGrammar(parseAssignmentExpression);\n\n if (match(',')) {\n isAssignmentTarget = false;\n expressions = [expr];\n\n while (startIndex < length) {\n if (!match(',')) {\n break;\n }\n lex();\n\n if (match('...')) {\n if (!isBindingElement) {\n throwUnexpectedToken(lookahead);\n }\n expressions.push(parseRestElement(params));\n expect(')');\n if (!match('=>')) {\n expect('=>');\n }\n isBindingElement = false;\n for (i = 0; i < expressions.length; i++) {\n reinterpretExpressionAsPattern(expressions[i]);\n }\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: expressions\n };\n }\n\n expressions.push(inheritCoverGrammar(parseAssignmentExpression));\n }\n\n expr = new WrappingNode(startToken).finishSequenceExpression(expressions);\n }\n\n\n expect(')');\n\n if (match('=>')) {\n if (expr.type === Syntax.Identifier && expr.name === 'yield') {\n return {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: [expr]\n };\n }\n\n if (!isBindingElement) {\n throwUnexpectedToken(lookahead);\n }\n\n if (expr.type === Syntax.SequenceExpression) {\n for (i = 0; i < expr.expressions.length; i++) {\n reinterpretExpressionAsPattern(expr.expressions[i]);\n }\n } else {\n reinterpretExpressionAsPattern(expr);\n }\n\n expr = {\n type: PlaceHolders.ArrowParameterPlaceHolder,\n params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr]\n };\n }\n isBindingElement = false;\n return expr;\n }", "function groupAll() {\n\n // reducing does nothing because currently we can't choose how the database will aggregate data\n var groupAllObj = {\n reduce: function () { return groupAllObj; },\n reduceCount: function () { return groupAllObj; },\n reduceSum: function () { return groupAllObj; },\n dispose: function () {},\n value: function () { return getData(null, false)[0].value; }\n };\n\n return groupAllObj;\n }", "function groupBy2(xs, prop) {\n var grouped = {};\n for (var i=0; i<xs.length; i++) {\n var p = xs[i][prop];\n if (!grouped[p]) { grouped[p] = []; }\n grouped[p].push(xs[i]);\n }\n return grouped;\n}", "function groupIncrement() {\n\t if (++k === groupCapacity) {\n\t reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);\n\t groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);\n\t groupCapacity = crossfilter_capacity(groupWidth);\n\t }\n\t }", "function getSemigroup(S) {\n return R.getSemigroup(TE.getSemigroup(S));\n}", "function groupByInvestments(filter){\n\n\t//remove group_by if present\n\tvar mFilter = filter.clone();\n\n\tvar report_year = mFilter.getConstraintData(\"report_year\")[0];\n\tvar report_quarter = mFilter.getConstraintData(\"report_qurater\")[0];\n\tvar groupBy = mFilter.getConstraintData(\"group_by\")[0];\n\n\n\tvar select = squel.select().from(config.table);\n\n\tselect.field(\"report_year\");\n\tselect.field(\"report_qurater\");\n\tselect.field(groupBy +\" AS name\");\n\tselect.field('sum(fair_value)', 'fair_value');\n\n\n\t//dont need year and quarter in where's, add last 4 q's later\n\tmFilter.removeField(\"report_year\");\n\tmFilter.removeField(\"report_qurater\");\n\n\t//apply filter constraints to WHERE clause\n\tprepareWheres(select, mFilter);\n\n\t//add last quarters to constraints\n\taddLastQuartersToQuery(select, report_year, report_quarter, 4);\n\n\tselect.group(\"report_year\");\n\tselect.group(\"report_qurater\");\n\tselect.group(groupBy);\n\n\tselect.order(\"report_year\",false);\n\tselect.order(\"report_qurater\",false);\n\tselect.order(\"fair_value\",false);\n\n\tselect = select.toString();\n\n\treturn db.queryp(select);\n\n}", "function group(behavior, partition) {\n return function(obj, iteratee, context) {\n var result = partition ? [[], []] : {};\n iteratee = _cb(iteratee, context);\n each(obj, function(value, index) {\n var key = iteratee(value, index, obj);\n behavior(result, value, key);\n });\n return result;\n };\n}", "function groupBy(arr, func) {\n\t\tvar groups = {};\n\t\tarr.forEach(function(ele) {\n\t\t\tvar res = func(ele);\n\t\t\tif(groups[res]) {\n\t\t\t\tgroups[res].push(ele);\n\t\t\t} else groups[res] = [ele];\n\t\t});\n\t\treturn groups;\n\t}", "_openGroup() {\n if (this._isPrimary) {\n // Only start a group is there are child groups\n if (this._childGroups.length === 0) {\n return;\n }\n\n const logDetails = this._logs.shift();\n if (this._isFirefox) {\n // Firefox doesn't support colors logs in console.group.\n this._printLogDetails(logDetails);\n return;\n }\n\n // Print the colored message with console.group\n logDetails.logFunc = console.group;\n this._printLogDetails(logDetails);\n } else {\n console.groupCollapsed(this._groupTitle);\n }\n }", "function getPriceGroups(){\n\tlet result = _.groupBy(pizzaToppingPrices, (item) => {\n\t\t//this will return based on item passes in and value\n return Math.floor(item.price / 1.0) \n })\n\treturn result;\n}", "get groupable() {\n return this.isLeaf && this.data.groupable;\n }", "get groupable() {\n return this.isLeaf && this.data.groupable;\n }", "function groupList() {\n return wrap('group-list', or(\n mailboxList,\n invis(cfws),\n obsGroupList\n )());\n }", "function groupList() {\n return wrap('group-list', or(\n mailboxList,\n invis(cfws),\n obsGroupList\n )());\n }", "function groupList() {\n return wrap('group-list', or(\n mailboxList,\n invis(cfws),\n obsGroupList\n )());\n }", "function groupList() {\n return wrap('group-list', or(\n mailboxList,\n invis(cfws),\n obsGroupList\n )());\n }", "function groupBy( array , f ){\n\t\t\tvar groups = {}, retorno = {};\n\n\t\t\tarray.forEach( function( o ){\n\t\t\t\tvar group = JSON.stringify( f(o) );\n\t\t\t\tgroups[group] = groups[group] || [];\n\t\t\t\tgroups[group].push( o );\n\t\t\t\tvar x = parseInt(o.id_canal);\n\t\t\t\tretorno[x] = groups[group];\t\t\t\t\n\n\t\t\t});\n\n\t\t\treturn retorno;\n\n\t\t}", "get group() {\n\t\treturn this.__group;\n\t}", "function group(behavior, partition) {\n return function(obj, iteratee, context) {\n var result = partition ? [[], []] : {};\n iteratee = cb(iteratee, context);\n each(obj, function(value, index) {\n var key = iteratee(value, index, obj);\n behavior(result, value, key);\n });\n return result;\n };\n }", "function group(behavior, partition) {\n return function(obj, iteratee, context) {\n var result = partition ? [[], []] : {};\n iteratee = cb(iteratee, context);\n each(obj, function(value, index) {\n var key = iteratee(value, index, obj);\n behavior(result, value, key);\n });\n return result;\n };\n }", "function group(behavior, partition) {\n return function(obj, iteratee, context) {\n var result = partition ? [[], []] : {};\n iteratee = cb(iteratee, context);\n each(obj, function(value, index) {\n var key = iteratee(value, index, obj);\n behavior(result, value, key);\n });\n return result;\n };\n }", "function group(behavior, partition) {\n return function(obj, iteratee, context) {\n var result = partition ? [[], []] : {};\n iteratee = cb(iteratee, context);\n each(obj, function(value, index) {\n var key = iteratee(value, index, obj);\n behavior(result, value, key);\n });\n return result;\n };\n }", "function group(behavior, partition) {\n return function(obj, iteratee, context) {\n var result = partition ? [[], []] : {};\n iteratee = cb(iteratee, context);\n each(obj, function(value, index) {\n var key = iteratee(value, index, obj);\n behavior(result, value, key);\n });\n return result;\n };\n }", "function group(behavior, partition) {\n return function(obj, iteratee, context) {\n var result = partition ? [[], []] : {};\n iteratee = cb(iteratee, context);\n each(obj, function(value, index) {\n var key = iteratee(value, index, obj);\n behavior(result, value, key);\n });\n return result;\n };\n }" ]
[ "0.71333575", "0.7000005", "0.7000005", "0.68837637", "0.67481023", "0.671131", "0.6657709", "0.6657709", "0.6657709", "0.6657709", "0.6657709", "0.665646", "0.65677977", "0.65664375", "0.65365386", "0.6527018", "0.65123206", "0.649026", "0.64882904", "0.64882904", "0.64575475", "0.64575475", "0.64575475", "0.64575475", "0.64564675", "0.64515", "0.64515", "0.6392633", "0.6313189", "0.62665004", "0.6250522", "0.61889523", "0.6086762", "0.6081556", "0.60764825", "0.6032593", "0.6023053", "0.59610116", "0.5960593", "0.59460616", "0.593198", "0.5914874", "0.5874681", "0.585602", "0.58136517", "0.58011806", "0.57996184", "0.57472205", "0.5736004", "0.5725241", "0.5687519", "0.5678596", "0.56740284", "0.5669638", "0.5660996", "0.56529593", "0.56529593", "0.56529593", "0.56529593", "0.5620016", "0.5608148", "0.5602479", "0.56012714", "0.56010085", "0.56003636", "0.5591569", "0.55914015", "0.558988", "0.55823505", "0.55743885", "0.55455256", "0.55430764", "0.5534746", "0.55045897", "0.55045897", "0.5478565", "0.5478565", "0.5478565", "0.5478565", "0.54738915", "0.5469695", "0.54669917", "0.54669917", "0.54669917", "0.54669917", "0.54669917", "0.54669917" ]
0.66095614
25
11.5 Multiplicative Operators 11.6 Additive Operators 11.7 Bitwise Shift Operators 11.8 Relational Operators 11.9 Equality Operators 11.10 Binary Bitwise Operators 11.11 Binary Logical Operators
function parseBinaryExpression() { var marker, markers, expr, token, prec, stack, right, operator, left, i; marker = lookahead; left = parseUnaryExpression(); token = lookahead; prec = binaryPrecedence(token, state.allowIn); if (prec === 0) { return left; } token.prec = prec; lex(); markers = [marker, lookahead]; right = parseUnaryExpression(); stack = [left, token, right]; while ((prec = binaryPrecedence(lookahead, state.allowIn)) > 0) { // Reduce: make a binary expression from the three topmost entries. while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { right = stack.pop(); operator = stack.pop().value; left = stack.pop(); expr = delegate.createBinaryExpression(operator, left, right); markers.pop(); marker = markers[markers.length - 1]; delegate.markEnd(expr, marker); stack.push(expr); } // Shift. token = lex(); token.prec = prec; stack.push(token); markers.push(lookahead); expr = parseUnaryExpression(); stack.push(expr); } // Final reduce to clean-up the stack. i = stack.length - 1; expr = stack[i]; markers.pop(); while (i > 1) { expr = delegate.createBinaryExpression(stack[i - 1].value, stack[i - 2], expr); i -= 2; marker = markers.pop(); delegate.markEnd(expr, marker); } return expr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function withBitwiseOperator(n) {\n if (n < 1) {\n return false;\n } else {\n return (n & n - 1) === 0;\n }\n}", "AND_R(op, r1){\n this.register_A = r1 & this.register_A;\n this.zero_flag = this.register_A === 0;\n this.carry_flag = false;\n this.subtraction_flag = false;\n this.half_carry_flag = true;\n }", "function logic(operatorBits, logicalOperator, writeStatus, result, firstOp, flexOpFirstPart, flexOpSecondPart) {\n\t\tassert(arguments.length == 6 || arguments.length == 7, \"Argument count wrong, expected 3 or 4, got \" + (arguments.length - 3));\n\t\tvar setResult = setRegisterFunction(result);\n\t\tvar getFirstOp = getRegisterFunction(firstOp);\n\t\tvar secOpEval = evalFlexibleOperatorFunction(flexOpFirstPart, flexOpSecondPart, writeStatus);\n\t\tvar getSecondOp = secOpEval[0];\n\t\tvar secondaryI = secOpEval[1];\n\t\tvar secondaryBC = secOpEval[2];\n\t\treturn {\n\t\t\tfunc: function() {\n\t\t\t\tsetResult(logicalOperator(writeStatus, getFirstOp(), getSecondOp()));\n\t\t\t},\n\t\t\tbytecode: 0x00000000 | secondaryI << 25 | operatorBits << 21 | writeStatus << 20 | parseRegister(result) << 16 | parseRegister(firstOp) << 12 | secOpEval[2] << 0\n\t\t};\n\t}", "function aes_mul(a, b) {\n\t\tvar res = 0;\n\t\twhile(a > 0) {\n\t\tif((a&1) != 0)\n\t\t\tres = res ^ b;\t\t// \"add\" to the result\n\t\t\ta >>>= 1;\t\t\t// shift a to get next higher-order bit\n\t\t\tb <<= 1;\t\t\t// shift multiplier also\n\t\t}\n\t\t// now reduce it modulo x**8 + x**4 + x**3 + x + 1\n\t\tvar hbit = 0x10000;\t\t// bit to test if we need to take action\n\t\tvar modulus = 0x11b00;\t// modulus - XOR by this to change value\n\t\twhile(hbit >= 0x100) {\n\t\t\tif ((res & hbit) != 0) {\n\t\t\t\tres ^= modulus;\t// XOR with the modulus\n\t\t\t}\n\t\t\t// prepare for the next loop\n\t\t\thbit >>= 1;\n\t\t\tmodulus >>= 1;\n\t\t}\n\t\treturn res;\n\t}", "function parseMultiplicative() {\n let token, expr;\n expr = parseUnary();\n token = lexer.peek();\n while (matchOp(token, '*') || matchOp(token, '/')) {\n token = lexer.next();\n expr = {\n 'Binary': {\n operator: token.value,\n left: expr,\n right: parseUnary()\n }\n };\n token = lexer.peek();\n }\n return expr;\n }", "MultiplicativeExpression() {\n return this._BinaryExpression('UnaryExpression', 'MULTIPLICATIVE_OPERATOR');\n }", "function op_and(x, y)\n{\n return x & y;\n}", "function gmul(a, b) {\n let p = 0,\n counter,\n carry;\n\n for (counter = 0; counter < 8; counter++) {\n if (b & 1) {\n p ^= a;\n }\n\n carry = a & 0x80; // detect if x^8 term is about to be generated\n\n a = (a << 1) & 0xff;\n\n if (carry) {\n a ^= 0xc3;\n } // replace x^8 with x^7 + x^6 + x + 1\n\n b >>= 1;\n }\n\n return p & 0xff;\n } // It is required only this values for R function", "function sc_bitAnd(x, y) {\n return x & y;\n}", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function op_and(x,y) { return x&y; }", "function bitwiseAND()\n{\n\t//7 decimal is equal to 111 binary\n\t//5 decimal is equal to 101 binary\n\t//So, the comparison below will return 0101, which it will display as a 5\n\tdocument.getElementById(\"bitAND\").innerHTML = 7 & 5;\n}", "function op_and(x, y) { return x & y; }", "function op_and(x, y) {\r\n\t return x & y;\r\n\t}", "function op_and(x, y) {\r\n\t return x & y;\r\n\t}", "function op_and(x, y) {\n return x & y\n}", "function op_and(x, y) {\n return x & y\n}", "function op_and(x, y) {\n return x & y\n}", "function op_and(x, y) {\n return x & y\n}", "function op_and(x, y) {\n return x & y\n}", "function op_and(x, y) {\n return x & y\n}", "function op_and(x, y) {\n return x & y\n}", "function op_and(x, y) {\n return x & y;\n}", "function op_and(x, y) {\n return x & y;\n}", "function multiplicativeExpr(stream, a) { return binaryL(unaryExpr, stream, a, ['*','div','mod']); }", "function multiplicativeExpr(stream, a) { return binaryL(unaryExpr, stream, a, ['*','div','mod']); }", "logical_shift(rhs) {\n if (typeof rhs !== 'number') {\n throw new Error('Invalid rhs in logical_shift: ' + rhs);\n }\n let res = new BitvalN(this.nbits());\n for (let i = 0; i < this.nbits(); ++i) {\n let src = i + rhs;\n res.bit[i] = src < 0 || src >= this.nbits() ? new Bitval(0) : this.bit[src];\n }\n return res;\n }", "function op_and(x, y) {\n return x & y;\n}", "gf_mult(a, b, m) {\n let res = 0;\n while (b !== 0) {\n if ((b & 1) !== 0)\n res ^= a;\n a <<= 1;\n b >>>= 1;\n if (a >= 256)\n a ^= m;\n }\n return res;\n }", "function op_and(x, y) {\n\t return x & y\n\t}", "function op_and(x, y) {\n\t return x & y\n\t}", "function f() {\n var x = 0;\n var tmp = 0;\n assertEquals(0, x /= (tmp = 798469700.4090232, tmp));\n assertEquals(0, x *= (2714102322.365509));\n assertEquals(0, x *= x);\n assertEquals(139516372, x -= (tmp = -139516372, tmp));\n assertEquals(1, x /= (x%(2620399703.344006)));\n assertEquals(0, x >>>= x);\n assertEquals(-2772151192.8633175, x -= (tmp = 2772151192.8633175, tmp));\n assertEquals(-2786298206.8633175, x -= (14147014));\n assertEquals(1509750523, x |= ((1073767916)-(tmp = 919311632.2789925, tmp)));\n assertEquals(2262404051.926751, x += ((752653528.9267509)%x));\n assertEquals(-270926893, x |= (tmp = 1837232194, tmp));\n assertEquals(0.17730273401688765, x /= ((tmp = -2657202795, tmp)-(((((x|(tmp = -1187733892.282897, tmp))-x)<<(556523578))-x)+(-57905508.42881298))));\n assertEquals(122483.56550261026, x *= ((((tmp = 2570017060.15193, tmp)%((-1862621126.9968336)>>x))>>(x>>(tmp = 2388674677, tmp)))>>>(-2919657526.470434)));\n assertEquals(0, x ^= x);\n assertEquals(0, x <<= (tmp = 2705124845.0455265, tmp));\n assertEquals(0, x &= (-135286835.07069612));\n assertEquals(-0, x *= ((tmp = -165810479.10020828, tmp)|x));\n assertEquals(248741888, x += ((735976871.1308595)<<(-2608055185.0700903)));\n assertEquals(139526144, x &= (tmp = -1454301068, tmp));\n assertEquals(-0.047221345672746884, x /= (tmp = -2954726130.994727, tmp));\n assertEquals(0, x <<= (x>>x));\n assertEquals(0, x >>>= ((x+(912111201.488966))-(tmp = 1405800042.6070075, tmp)));\n assertEquals(-1663642733, x |= (((-1663642733.5700119)<<(x^x))<<x));\n assertEquals(-914358272, x <<= ((((-308411676)-(-618261840.9113789))%(-68488626.58621716))-x));\n assertEquals(-1996488704, x &= (-1358622641.5848842));\n assertEquals(-345978263, x += (1650510441));\n assertEquals(3, x >>>= (-1106714178.701668));\n assertEquals(1, x %= (((x>>(x>>(tmp = -3052773846.817114, tmp)))*(tmp = 1659218887.379526, tmp))&x));\n assertEquals(-943225672, x += (-943225673));\n assertEquals(-0.41714300120060854, x /= (tmp = 2261156652, tmp));\n assertEquals(0, x >>>= ((3107060934.8863482)<<(tmp = 1902730887, tmp)));\n assertEquals(0, x &= x);\n assertEquals(1476628, x |= ((tmp = -2782899841.390033, tmp)>>>(2097653770)));\n assertEquals(0.0008887648921591833, x /= ((tmp = 1661438264.5253348, tmp)%((tmp = 2555939813, tmp)*(-877024323.6515315))));\n assertEquals(0, x <<= (tmp = -2366551345, tmp));\n assertEquals(0, x &= (tmp = 1742843591, tmp));\n assertEquals(0, x -= x);\n assertEquals(4239, x += ((-3183564176.232031)>>>(349622674.1255014)));\n assertEquals(-67560, x -= ((2352742295)>>>x));\n assertEquals(-67560, x &= x);\n assertEquals(-0.00003219917807302283, x /= (2098190203.699741));\n assertEquals(0, x -= x);\n assertEquals(0, x >>= ((((tmp = -869086522.8358297, tmp)/(187820779))-(tmp = -2000970995.1931965, tmp))|(1853528755.6064696)));\n assertEquals(0, x >>= (-3040509919));\n assertEquals(0, x %= (((tmp = -2386688049.194946, tmp)<<(tmp = -669711391, tmp))|x));\n assertEquals(0, x %= (tmp = -298431511.4839926, tmp));\n assertEquals(0, x /= (2830845091.2793818));\n assertEquals(0, x /= ((((-2529926178)|x)^((tmp = 2139313707.0894063, tmp)%((-1825768525.0541775)-(-952600362.7758243))))+x));\n assertEquals(NaN, x /= x);\n assertEquals(NaN, x -= x);\n assertEquals(NaN, x /= (tmp = -432944480, tmp));\n assertEquals(0, x <<= (((((x^((-1777523727)+(2194962794)))>>>(((((-590335134.8224905)%(x*(2198198974)))|(tmp = -2068556796, tmp))/(1060765637))*(-147051676)))/((tmp = -477350113.92686677, tmp)<<((x/(2018712621.0397925))^((tmp = 491163813.3921983, tmp)+(((x|((((x%(1990073256.812654))%((-2024388518.9599915)>>((tmp = 223182187, tmp)*(-722241065))))>>>(tmp = 2517147885.305745, tmp))%(1189996239.11222)))&x)%(-306932860))))))&((tmp = 1117802724.485684, tmp)+((-1391614045)-x)))%((((x>>((2958453447)*x))^(((410825859)|(((tmp = -1119269292.5495896, tmp)>>>(((((((x%(tmp = 648541746.6059314, tmp))*((-2304508480)<<((((x^(1408199888.1454597))|((251623937)|x))/((-382389946.9984102)|(tmp = -2082681143.5893767, tmp)))-(((tmp = 631243472, tmp)>>>(1407556544))/(((x>>>x)>>>(tmp = -6329025.47865057, tmp))>>>(tmp = 948664752.543093, tmp))))))/((((-183248880)>>x)&x)&x))>>x)&(((-978737284.8492057)%(tmp = 2983300011.737006, tmp))&(tmp = 2641937234.2954116, tmp)))<<x)>>(2795416632.9722223)))%((((tmp = -50926632, tmp)/x)&(((tmp = -2510786916, tmp)/x)/(-699755674)))|((((tmp = 1411792593, tmp)>>(924286570.2637128))>>((1609997725)>>(2735658951.0762663)))*(tmp = 726205435, tmp)))))<<(tmp = -2135055357.3156831, tmp)))/(tmp = 1408695065, tmp))^(tmp = -1343267739.8562133, tmp))));\n assertEquals(0, x %= (-437232116));\n assertEquals(-2463314518.2747326, x -= (2463314518.2747326));\n assertEquals(109, x >>= (2401429560));\n assertEquals(-2687641732.0253763, x += (-2687641841.0253763));\n assertEquals(-2336375490019484000, x *= (tmp = 869303174.6678596, tmp));\n assertEquals(5.458650430363785e+36, x *= x);\n assertEquals(0, x |= ((((-1676972008.797291)*x)*((tmp = 2606991807, tmp)-x))<<x));\n assertEquals(0, x &= ((-3053393759.3496876)+(-1431008367)));\n assertEquals(-856728369, x |= (x-(((((764337872)/x)<<((x|(((tmp = 1409368192.1268077, tmp)+(tmp = -848083676, tmp))|(-2797102463.7915916)))^x))/x)^(tmp = 856728369.0589117, tmp))));\n assertEquals(-0, x %= x);\n assertEquals(1116550103, x ^= (-3178417193));\n assertEquals(1116550103, x %= (tmp = -1482481942, tmp));\n assertEquals(133, x >>>= x);\n assertEquals(-1.381429241671034e-7, x /= ((tmp = -962771116.8101778, tmp)^x));\n assertEquals(-1092268961, x |= ((tmp = 3202672531, tmp)-((x-(tmp = 845529357, tmp))>>(tmp = -868680593, tmp))));\n assertEquals(-1092268961, x %= (tmp = 2670840415.304719, tmp));\n assertEquals(-122794480, x %= (tmp = 969474481, tmp));\n assertEquals(-297606521542193600, x *= (2423614820));\n assertEquals(72460064, x >>>= (tmp = -1230798655, tmp));\n assertEquals(-203714325373689600, x *= (-2811401400));\n assertEquals(2154914048, x >>>= (((2241377026.001436)/x)+x));\n assertEquals(1177864081, x ^= (tmp = -968513903, tmp));\n assertEquals(35947664, x &= (-2086226758.2704995));\n assertEquals(20795732539020670, x += (x*(578500247)));\n assertEquals(-892004992, x >>= x);\n assertEquals(-7023661.354330708, x /= ((((((1740714214)%((tmp = -459699286, tmp)+(tmp = -1700187400, tmp)))>>(tmp = -3170295237, tmp))+(tmp = -497509780, tmp))+((1971976144.6197853)+(661992813.6077721)))>>>(-1683802728)));\n assertEquals(-1634205696, x <<= x);\n assertEquals(-7, x >>= (-3187653764.930914));\n assertEquals(-5.095345981491203, x -= ((tmp = 748315289, tmp)/(tmp = -392887780, tmp)));\n assertEquals(1486531570, x &= (1486531570.9300508));\n assertEquals(5670, x >>= (((tmp = -2486758205.26425, tmp)*(732510414))|x));\n assertEquals(5670, x >>= (((-1811879946.2553763)%(1797475764))/(((tmp = -2159923884, tmp)|x)+(tmp = -1774410807, tmp))));\n assertEquals(38, x %= (x>>>x));\n assertEquals(-151134215, x ^= (((tmp = -2593085609.5622163, tmp)+((tmp = -814992345.7516887, tmp)-(534809571)))|(tmp = -232678571, tmp)));\n assertEquals(-234881024, x <<= x);\n assertEquals(-234881024, x <<= (x>>>x));\n assertEquals(55169095435288580, x *= x);\n assertEquals(0, x >>= (tmp = 1176612256, tmp));\n assertEquals(0, x <<= (1321866341.2486475));\n assertEquals(0, x %= (x-(-602577995)));\n assertEquals(0, x >>>= (((((tmp = -125628635.79970193, tmp)^(tmp = 1294209955.229382, tmp))&(((tmp = -2353256654.0725203, tmp)|((-1136743028.9425385)|((((950703429.1110399)-(x>>>x))/((((x%(-252705869.21126103))/((tmp = 886957620, tmp)<<(x%((tmp = -1952249741, tmp)*(tmp = -1998149844, tmp)))))|(tmp = 1933366713, tmp))|((tmp = -2957141565, tmp)>>>(tmp = 1408598804, tmp))))+(((((((-2455002047.4910946)%(tmp = -528017836, tmp))&((-2693432769)/(tmp = 2484427670.9045153, tmp)))%(-356969659))-((((((tmp = 3104828644.0753174, tmp)%(x>>>(tmp = 820832137.8175925, tmp)))*((tmp = 763080553.9260503, tmp)+(3173597855)))<<(((-510785437)^x)<<(x|(((x*(x%((tmp = -1391951515, tmp)/x)))-x)|(x-((-522681793.93221474)/((2514619703.2162743)*(2936688324))))))))|x)>>>(-2093210042)))&(763129279.3651779))&x))))-x))%(((-1331164821)&(tmp = 1342684586, tmp))<<(x<<(tmp = 2675008614.588005, tmp))))>>((2625292569.8984914)+(-3185992401))));\n assertEquals(0, x *= (tmp = 671817215.1147974, tmp));\n assertEquals(-1608821121, x ^= ((tmp = 2686146175.04077, tmp)>>>x));\n assertEquals(-0, x %= x);\n assertEquals(-0, x /= ((tmp = 286794551.0720866, tmp)|(x%x)));\n assertEquals(0, x <<= (x|(tmp = 1095503996.2285218, tmp)));\n assertEquals(443296752, x ^= (443296752));\n assertEquals(110824188, x >>= ((184708570)>>(x&x)));\n assertEquals(0.7908194935161674, x /= ((((167151154.63381648)&((tmp = -1434120690, tmp)-(tmp = 2346173080, tmp)))/(56656051.87305987))^(140138414)));\n assertEquals(-0.9027245492678485, x *= ((tmp = 1724366578, tmp)/(((2979477411)<<(((897038568)>>(tmp = 348960298, tmp))%(281056223.2037884)))^((((-1383133388)-(((-1379748375)-((x>>(x&(tmp = 2456582046, tmp)))>>>(-2923911755.565961)))&x))<<(-2825791731))^(tmp = -1979992970, tmp)))));\n assertEquals(0, x &= (2482304279));\n assertEquals(-0, x *= (-2284213673));\n assertEquals(0, x <<= ((2874381218.015819)|x));\n assertEquals(0, x *= (x>>>(tmp = 2172786480, tmp)));\n assertEquals(0, x &= (-1638727867.2978938));\n assertEquals(0, x %= ((tmp = -2213947368.285817, tmp)>>x));\n assertEquals(0, x >>>= (tmp = -531324706, tmp));\n assertEquals(0, x %= (tmp = -2338792486, tmp));\n assertEquals(0, x <<= (((tmp = 351012164, tmp)<<(x|((tmp = -3023836638.5337825, tmp)^(-2678806692))))|x));\n assertEquals(0, x %= (x-(tmp = -3220231305.45039, tmp)));\n assertEquals(0, x <<= (-2132833261));\n assertEquals(0, x >>>= x);\n assertEquals(0, x %= ((2544970469)+(((-2633093458.5911965)&(644108176))-(x>>>(tmp = -949043718, tmp)))));\n assertEquals(-2750531265, x += (-2750531265));\n assertEquals(0, x >>= x);\n assertEquals(0, x *= ((tmp = 1299005700, tmp)-x));\n assertEquals(0, x >>= x);\n assertEquals(-1785515304, x -= (((((-806054462.5563161)/x)>>>x)+(1785515304))|((tmp = 2937069788.9396844, tmp)/x)));\n assertEquals(-3810117159.173689, x -= (2024601855.1736891));\n assertEquals(-6.276064139320051, x /= (607087033.3053156));\n assertEquals(134217727, x >>>= (((x%(tmp = 924293127, tmp))^x)|((x>>>(x&((((tmp = -413386639, tmp)/(x>>(tmp = 599075308.8479941, tmp)))^(tmp = -1076703198, tmp))*((tmp = -2239117284, tmp)>>(655036983)))))-x)));\n assertEquals(134217727, x %= (tmp = 2452642261.038778, tmp));\n assertEquals(-569504740360507, x *= ((tmp = -1086243941, tmp)>>(tmp = 1850668904.4885683, tmp)));\n assertEquals(113378806, x >>>= (tmp = -2558233435, tmp));\n assertEquals(979264375, x -= (((x>>(1950008052))%((2917183569.0209)*(tmp = 1184250640.446752, tmp)))|((((tmp = -691875212, tmp)-(-2872881803))>>(tmp = 44162204.97461021, tmp))^(tmp = 865885647, tmp))));\n assertEquals(-1127813632, x <<= ((((tmp = -2210499281, tmp)>>>x)-(tmp = 2359697240, tmp))-x));\n assertEquals(-1707799657, x ^= (653518231.3995534));\n assertEquals(2916579668449318000, x *= x);\n assertEquals(2916579669254640600, x += (x&(tmp = 2986558026.399422, tmp)));\n assertEquals(870995175, x ^= (2598813927.8991632));\n assertEquals(870995175, x %= (-2857038782));\n assertEquals(1869503575895591000, x *= (x|(x|(((tmp = 2478650307.4118147, tmp)*((tmp = 2576240847.476932, tmp)>>>x))<<x))));\n assertEquals(-134947790, x |= ((tmp = 1150911808, tmp)*((2847735464)/(-2603172652.929262))));\n assertEquals(-137053182, x -= ((tmp = 2155921819.0929346, tmp)>>>(x-(((-1960937402)-(-1907735074.2875962))%((1827808310)^(tmp = -2788307127, tmp))))));\n assertEquals(-134824702, x |= (((2912578752.2395406)^(x%(((-2585660111.0638976)<<(((((tmp = 747742706, tmp)%(-1630261205))&((((x|(x|(-2619903144.278758)))|((2785710568.8651934)>>((-968301967.5982246)<<(x&x))))>>((x>>>((x>>>(tmp = -1402085797.0310762, tmp))*((tmp = -323729645.2250068, tmp)<<(tmp = 2234667799, tmp))))>>>(-167003745)))>>((924665972.4681011)<<x)))>>>x)<<((((x+x)+x)-(((tmp = 2399203431.0526247, tmp)-(-2872533271))-(((tmp = 914778794.2087344, tmp)-(tmp = 806353942.9502392, tmp))|(((tmp = 262924334.99231672, tmp)&x)|(tmp = -460248836.5602243, tmp)))))/x)))%((-1681000689)/(tmp = -2805054623.654228, tmp)))))*(tmp = 957346233.9619625, tmp)));\n assertEquals(-3274838, x %= ((((tmp = 3155450543.3524327, tmp)>>>x)<<(tmp = 2103079652.3410985, tmp))>>x));\n assertEquals(-3274838, x |= ((((tmp = 2148004645.639173, tmp)>>>(tmp = -1285119223, tmp))<<(((((-711596054)>>>(tmp = -2779776371.3473206, tmp))^(((((tmp = -1338880329.383915, tmp)<<((-1245247254.477341)>>x))*(tmp = -2649052844.20065, tmp))>>((1734345880.4600453)%(x/(2723093117.118899))))*(1252918475.3285656)))<<(2911356885))^x))<<(-1019761103)));\n assertEquals(1703281954, x &= (((tmp = 1036570471.7412028, tmp)+((tmp = 3043119517, tmp)%(2374310816.8346715)))%(tmp = -2979155076, tmp)));\n assertEquals(1741588391, x |= ((tmp = 1230009575.6003838, tmp)>>>(-1247515003.8152597)));\n assertEquals(72869474.64782429, x %= (tmp = 1668718916.3521757, tmp));\n assertEquals(770936242.104203, x += (698066767.4563787));\n assertEquals(-0.2820604726420833, x /= (tmp = -2733230342, tmp));\n assertEquals(403480578, x |= ((969730374)&(tmp = 1577889835, tmp)));\n assertEquals(-1669557233, x ^= ((-1616812135)+(tmp = -456209292, tmp)));\n assertEquals(-1630427, x >>= ((2327783031.1175823)/(226947662.4579488)));\n assertEquals(131022, x >>>= ((tmp = -1325018897.2482083, tmp)>>(x&((((((-1588579772.9240348)<<(tmp = -1775580288.356329, tmp))<<(tmp = -1021528325.2075481, tmp))>>((tmp = 2373033451.079956, tmp)*(tmp = 810304612, tmp)))-((tmp = -639152097, tmp)<<(tmp = 513879484, tmp)))&(2593958513)))));\n assertEquals(1, x >>= ((3033200222)-x));\n assertEquals(-561146816.4851823, x += (tmp = -561146817.4851823, tmp));\n assertEquals(-4.347990105831158, x /= ((((-1270435902)*x)%((tmp = 637328492.7386824, tmp)-(x>>(-749100689))))%(x+x)));\n assertEquals(-1, x >>= x);\n assertEquals(1, x *= x);\n assertEquals(111316849706694460, x += ((966274056)*(x|(115202150))));\n assertEquals(-1001883840, x >>= x);\n assertEquals(-1001883840, x &= x);\n assertEquals(-3006880758, x += ((((-2275110637.4054556)/((x+(tmp = -1390035090.4324536, tmp))>>(-5910593)))&(tmp = 378982420, tmp))|(tmp = 2289970378.568629, tmp)));\n assertEquals(314474, x >>>= (x>>((tmp = -228007336.31281257, tmp)%(tmp = 1127648013, tmp))));\n assertEquals(-17694827, x ^= ((tmp = 2095133598.1849852, tmp)|(-1978322311)));\n assertEquals(1, x /= x);\n assertEquals(1, x %= (-2323617209.7531185));\n assertEquals(0, x >>>= (x*(tmp = -1574455400.489434, tmp)));\n assertEquals(0, x >>= (3131854684));\n assertEquals(2853609824, x += ((-231012098)-(tmp = -3084621922, tmp)));\n assertEquals(8143089027629311000, x *= x);\n assertEquals(313052685, x ^= (tmp = 2962303501, tmp));\n assertEquals(4776, x >>= (tmp = 2271457232, tmp));\n assertEquals(0.000002812258572702285, x /= (tmp = 1698279115, tmp));\n assertEquals(0, x >>>= (tmp = 1698465782.0927145, tmp));\n assertEquals(0, x <<= x);\n assertEquals(0, x |= ((x<<((-1824760240.3040407)<<(2798263764.39145)))&(tmp = 1795988253.0493627, tmp)));\n assertEquals(1782206945, x ^= (-2512760351.7881565));\n assertEquals(7610569113843172000, x *= (((tmp = -44415823.92972565, tmp)&(tmp = 1402483498.9421625, tmp))+(tmp = 2909778666, tmp)));\n assertEquals(15221138227873292000, x += (x-(tmp = -186948658.394145, tmp)));\n assertEquals(0, x -= x);\n assertEquals(-2238823252, x -= ((tmp = 2238823252, tmp)+x));\n assertEquals(0, x -= x);\n assertEquals(0, x >>= (2976069570));\n assertEquals(0, x >>= ((tmp = -2358157433, tmp)/x));\n assertEquals(-949967713, x ^= (tmp = -949967713, tmp));\n assertEquals(-1, x >>= x);\n assertEquals(-1522291702.1977966, x *= (1522291702.1977966));\n assertEquals(-1522291702, x >>= ((((2290279800)|x)|(1793154434.6798015))&((-1161390929.0766077)>>>x)));\n assertEquals(83894274, x &= (tmp = 1571058486, tmp));\n assertEquals(43186847.90522933, x += ((tmp = -1131332988.0947707, tmp)%x));\n assertEquals(0, x >>= (tmp = -1968312707.269359, tmp));\n assertEquals(0, x &= (2507747643.26175));\n assertEquals(0, x %= (tmp = 3190525303.366887, tmp));\n assertEquals(-1968984602, x ^= (((x/(x|(-1607062026.5338054)))<<(tmp = 2207669861.8770065, tmp))+(tmp = 2325982694.956348, tmp)));\n assertEquals(554, x >>>= (((tmp = -2302283871.993821, tmp)>>>(-3151835112))|(((((x%(-1534374264))/((731246012)<<(((883830997.1194847)<<(((-1337895080.1937215)/(tmp = 3166402571.8157315, tmp))^(tmp = -1563897595.5799441, tmp)))>>(tmp = -556816951.0537591, tmp))))>>(-2682203577))<<(x/((1654294674.865079)+x)))/((x^(-2189474695.4259806))/(-475915245.7363057)))));\n assertEquals(1372586111, x ^= (1372586581));\n assertEquals(1166831229, x -= ((-834168138)&(762573579)));\n assertEquals(2333662456, x -= ((x>>x)-x));\n assertEquals(-1961304840, x &= x);\n assertEquals(-2130143128, x &= (2982852718.0711775));\n assertEquals(1073741824, x <<= (-1446978661.6426942));\n assertEquals(2097152, x >>>= ((-1424728215)-(((127872198)%(tmp = -2596923298, tmp))&x)));\n assertEquals(2097152, x >>>= x);\n assertEquals(0, x &= (x/(tmp = -518419194.42994523, tmp)));\n assertEquals(0, x >>= ((x/(-1865078245))%(tmp = 2959239210, tmp)));\n assertEquals(-0, x *= ((x|(-1721307400))|(-3206147171.9491577)));\n assertEquals(0, x >>>= ((-694741143)&(tmp = -2196513947.699142, tmp)));\n assertEquals(0, x <<= x);\n assertEquals(0, x &= ((tmp = 2037824385.8836646, tmp)+((tmp = 1203034986.4647732, tmp)/(x>>>(((-1374881234)/(899771270.3237157))+((-2296524362.8020077)|(-1529870870)))))));\n assertEquals(0, x >>= (tmp = 2770637816, tmp));\n assertEquals(0, x ^= x);\n assertEquals(-1861843456, x |= ((632402668)*((x|(tmp = -1032952662.8269436, tmp))|(tmp = 2671272511, tmp))));\n assertEquals(-1861843456, x >>= (((x>>>x)+x)<<(-1600908842)));\n assertEquals(-58182608, x >>= (x-(tmp = -2496617861, tmp)));\n assertEquals(-3636413, x >>= (tmp = -400700028, tmp));\n assertEquals(-7272826, x += x);\n assertEquals(-1, x >>= ((tmp = -3184897005.3614545, tmp)-((-1799843014)|(tmp = 2832132915, tmp))));\n assertEquals(-121800925.94209385, x *= (121800925.94209385));\n assertEquals(-30450232, x >>= (-979274206.6261561));\n assertEquals(-30450232, x >>= (tmp = -1028204832.5078967, tmp));\n assertEquals(-30450232, x |= x);\n assertEquals(965888871, x ^= (((((-2157753481.3375635)*((tmp = -1810667184.8165767, tmp)&((tmp = 2503908344.422232, tmp)|x)))>>(x>>(1601560785)))<<x)^(tmp = 943867311.6380403, tmp)));\n assertEquals(7546006, x >>>= x);\n assertEquals(7546006, x <<= ((tmp = 1388931761.780241, tmp)*(x-(tmp = -1245147647.0070577, tmp))));\n assertEquals(12985628, x += (x&(-1520746354)));\n assertEquals(12985628, x &= x);\n assertEquals(12985628, x %= (tmp = 308641965, tmp));\n assertEquals(685733278, x |= ((tmp = -1275653544, tmp)-((tmp = -1956798010.3773859, tmp)%(tmp = 2086889575.643448, tmp))));\n assertEquals(679679376, x &= (2860752368));\n assertEquals(1770773904, x |= (x<<(3200659207)));\n assertEquals(1224886544, x &= (-585733767.6876519));\n assertEquals(1224886544, x %= ((tmp = -114218494, tmp)-x));\n assertEquals(1208109328, x &= (tmp = 1854361593, tmp));\n assertEquals(18434, x >>>= x);\n assertEquals(-349394636955256100, x *= (x*(-1028198742)));\n assertEquals(-519536600.7713163, x %= (-1054085356.9120367));\n assertEquals(-1610612736, x ^= ((tmp = -3126078854, tmp)&x));\n assertEquals(-2637321565906333700, x *= (1637464740.5658746));\n assertEquals(-2637321568051070500, x -= ((tmp = -1006718806, tmp)<<(3005848133.106345)));\n assertEquals(368168695, x ^= (x^(tmp = 368168695.6881037, tmp)));\n assertEquals(43, x >>>= x);\n assertEquals(-2081297089, x |= ((167169305.77248895)+(-2248466405.3199244)));\n assertEquals(-2474622167, x -= (tmp = 393325078, tmp));\n assertEquals(-135109701, x %= (-1169756233));\n assertEquals(0, x ^= x);\n assertEquals(0, x >>= (((((tmp = -164768854, tmp)/(tmp = -1774989993.1909926, tmp))+x)-((-921438912)>>(tmp = -191772028.69249105, tmp)))-(tmp = 558728578.22033, tmp)));\n assertEquals(0, x %= (tmp = 2188003745, tmp));\n assertEquals(0, x <<= (((tmp = -999335540, tmp)>>((((325101977)/(tmp = -3036991542, tmp))<<(tmp = -213302488, tmp))+x))|(tmp = -1054204587, tmp)));\n assertEquals(0, x &= ((2844053429.4720345)>>>x));\n assertEquals(NaN, x %= x);\n assertEquals(NaN, x -= (-1481729275.9118822));\n assertEquals(NaN, x *= (tmp = 1098314618.2397528, tmp));\n assertEquals(-1073741824, x ^= ((tmp = 1718545772, tmp)<<(((tmp = -81058910, tmp)-(2831123087.424368))+(tmp = 576710057.2361784, tmp))));\n assertEquals(-2921155898.4793186, x -= (1847414074.4793184));\n assertEquals(-1295646720, x <<= (2178621744));\n assertEquals(-0.8906779709597907, x /= ((tmp = -2840292585.6837263, tmp)<<(x&((tmp = 892527695.6172305, tmp)>>>x))));\n assertEquals(0, x <<= (((tmp = 3149667213.298993, tmp)>>(tmp = 1679370761.7226725, tmp))^(115417747.21537328)));\n assertEquals(0, x |= x);\n assertEquals(0, x %= ((-1112849427)>>(-1245508870.7514496)));\n assertEquals(0, x &= x);\n assertEquals(0, x |= x);\n assertEquals(0, x >>>= ((3144100694.930459)>>>(tmp = 2408610503, tmp)));\n assertEquals(0, x <<= ((tmp = 2671709754.0318713, tmp)%x));\n assertEquals(0, x >>>= (x|((tmp = -3048578701, tmp)-(674147224))));\n assertEquals(NaN, x %= x);\n assertEquals(0, x &= ((tmp = -2084883715, tmp)|(((((-3008427069)+(875536047.4283574))>>>x)%(tmp = -450003426.1091652, tmp))%(((-2956878433.269356)|(x/((((x%((((((x<<(((tmp = -1581063482.510351, tmp)^x)-(tmp = 1364458217, tmp)))^((tmp = 1661446342, tmp)+(1307091014)))/(342270750.9901335))>>>(x&((1760980812.898993)&((tmp = 2878165745.6401143, tmp)/(((tmp = -981178013, tmp)/(-2338761668.29912))>>(-958462630))))))*((1807522840)^((tmp = 1885835034, tmp)^(-2538647938))))*(1673607540.0854697)))%x)>>x)<<x)))<<(853348877.2407281)))));\n assertEquals(0, x >>>= x);\n assertEquals(-1162790279, x -= (1162790279));\n assertEquals(-1162790279, x >>= (((-490178658)*x)/((((((tmp = -1883861998.6699312, tmp)/(tmp = -2369967345.240594, tmp))+(3142759868.266447))&(508784917.8158537))&x)>>(-2129532322))));\n assertEquals(-1360849740.9829152, x -= (x+(1360849740.9829152)));\n assertEquals(1928392181, x ^= (-602670783));\n assertEquals(19478708.898989897, x /= (((-2617861994)>>(tmp = 797256920, tmp))%(-1784987906)));\n assertEquals(-8648903.575540157, x *= (((tmp = 673979276, tmp)/(-1517908716))%(x/x)));\n assertEquals(-8648903.575540157, x %= ((((643195610.4221292)>>>(tmp = 2342669302, tmp))>>>(tmp = -1682965878, tmp))^((tmp = -208158937.63443017, tmp)>>((907286989)&(x<<(448634893))))));\n assertEquals(1399288769, x ^= (tmp = -1407486728, tmp));\n assertEquals(0, x &= (((1999255838.815517)/(tmp = 564646001, tmp))/(-3075888101.3274765)));\n assertEquals(0, x ^= ((-78451711.59404826)%x));\n assertEquals(-1351557131, x |= (2943410165));\n assertEquals(1715626371, x -= (-3067183502));\n assertEquals(71434240, x &= ((-1800066426)<<(((((x<<(-324796375))+x)<<(tmp = 2696824955.735132, tmp))^x)%(tmp = 444916469, tmp))));\n assertEquals(71434240, x >>>= (((x&((x%x)|x))+(tmp = 2226992348.3050146, tmp))<<(-305526260)));\n assertEquals(0, x -= (x%(tmp = 582790928.5832802, tmp)));\n assertEquals(0, x *= ((x%(1865155340))>>>((x<<(2600488191))^(-308995123))));\n assertEquals(0, x >>= (x&(-3120043868.8531103)));\n assertEquals(0, x |= x);\n assertEquals(-0, x *= (tmp = -172569944, tmp));\n assertEquals(0, x <<= (-1664372874));\n assertEquals(1377713344.6784928, x += (tmp = 1377713344.6784928, tmp));\n assertEquals(1377713344, x |= x);\n assertEquals(-232833282, x |= (tmp = 2685870654, tmp));\n assertEquals(84639, x -= (((((2778531079.998492)%(2029165314))>>>(tmp = -468881172.3729558, tmp))^x)|((x>>>((((x%(3044318992.943596))&(1996754328.2214756))^(1985227172.7485228))%(tmp = -1984848676.1347625, tmp)))|((tmp = 2637662639, tmp)<<x))));\n assertEquals(0, x ^= x);\n assertEquals(1237720303, x -= (-1237720303));\n assertEquals(2, x >>= (-2148785379.428976));\n assertEquals(2, x &= (tmp = -3087007874, tmp));\n assertEquals(0, x %= x);\n assertEquals(0, x >>>= x);\n assertEquals(0, x >>>= x);\n assertEquals(0, x += x);\n assertEquals(0, x &= (2055693082));\n assertEquals(-1349456492, x += (x^(-1349456492.315998)));\n assertEquals(671088640, x <<= (x>>(-2030805724.5472062)));\n assertEquals(-417654580004782100, x *= (tmp = -622353822, tmp));\n assertEquals(1538160360, x |= (195983080.56698656));\n assertEquals(733, x >>>= (tmp = 661085269, tmp));\n assertEquals(657, x &= (-1611460943.993404));\n assertEquals(431649, x *= x);\n assertEquals(863298, x += x);\n assertEquals(0, x &= ((1899423003)/((472439729)>>((tmp = 2903738952, tmp)+(tmp = 2164601630.3456993, tmp)))));\n assertEquals(0, x &= (x>>>(tmp = 1939167951.2828958, tmp)));\n assertEquals(1557813284, x |= (x-(-1557813284)));\n assertEquals(72876068, x &= (662438974.2372154));\n assertEquals(0.6695448637501589, x /= (tmp = 108844189.45702457, tmp));\n assertEquals(0, x -= x);\n assertEquals(2944889412, x += (2944889412));\n assertEquals(3787980288, x -= ((((tmp = -2003814373.2301111, tmp)<<x)>>>(tmp = -3088357284.4405823, tmp))-(843090884)));\n assertEquals(1, x >>>= (729274079));\n assertEquals(1, x %= (-148002187.33869123));\n assertEquals(3073988415.673201, x *= (tmp = 3073988415.673201, tmp));\n assertEquals(4839166225.673201, x += (tmp = 1765177810, tmp));\n assertEquals(4529373898.673201, x += (-309792327));\n assertEquals(3097903.090496063, x %= (-150875866.51942348));\n assertEquals(1270874112, x <<= ((((((tmp = -960966763.1418135, tmp)>>((((-3208596981.613482)>>>(tmp = 746403937.6913509, tmp))>>>(-2190042854.066803))/(2449323432)))*(-1272232665.791577))<<(-99306767.7209444))^((-1942103828)/((1570981655)/(tmp = 2381666337, tmp))))+(tmp = -1946759395.1558368, tmp)));\n assertEquals(1273845956, x |= (tmp = -3197282108.6120167, tmp));\n assertEquals(159230744, x >>= (((tmp = -1036031403.8108604, tmp)>>>(((3084964493)>>((x*x)^x))+(((2980108409.352001)^x)-(tmp = -2501685423.513927, tmp))))&(326263839)));\n assertEquals(-370091747145550100, x *= (tmp = -2324248055.674161, tmp));\n assertEquals(143384219.54999557, x /= (tmp = -2581119096, tmp));\n assertEquals(1843396287, x |= (tmp = 1842718767, tmp));\n assertEquals(2.4895593465813803, x /= (740450831));\n assertEquals(2.4895593465813803, x %= ((((((((-3175333618)>>>((tmp = -1403880166, tmp)<<(tmp = -134875360, tmp)))>>>(2721317334.998084))<<(x&(tmp = 2924634208.1484184, tmp)))*((((x>>(tmp = -200319931.15328693, tmp))-(tmp = -495128933, tmp))+((-788052518.6610589)*((((tmp = 107902557, tmp)&(1221562660))%(x<<(((3155498059)*(((tmp = -1354381139.4897022, tmp)^(tmp = 3084557138.332852, tmp))*((((tmp = 1855251464.8464525, tmp)/((-1857403525.2008865)>>x))|x)-(-2061968455.0023944))))*(1917481864.84619))))^(x-(-508176709.52712965)))))+((((x%(-1942063404))+(x%(tmp = 855152281.180481, tmp)))|(-522863804))>>x)))>>>((tmp = -2515550553, tmp)&(((((-801095375)-(tmp = -2298729336.9792976, tmp))^x)/(tmp = 2370468053, tmp))>>(x|(tmp = -900008879, tmp)))))>>>(((tmp = -810295719.9509168, tmp)*((tmp = -1306212963.6226444, tmp)/(((tmp = 3175881540.9514832, tmp)|(-1439142297.819246))+((tmp = -134415617, tmp)|((-245801870)+x)))))>>(tmp = 1889815478, tmp)))-(((tmp = 597031177, tmp)%(858071823.7655672))+((tmp = 2320838665.8243756, tmp)|((938555608)<<(2351739219.6461897))))));\n assertEquals(6.197905740150709, x *= x);\n assertEquals(1, x /= x);\n assertEquals(0, x >>= (-1639664165.9076233));\n assertEquals(0, x >>= (-3135317748.801177));\n assertEquals(0, x &= (3185479232.5325994));\n assertEquals(-0, x *= ((-119759439.19668174)/(tmp = 2123964608, tmp)));\n assertEquals(0, x /= (-1183061929.2827876));\n assertEquals(0, x <<= (-1981831198));\n assertEquals(0, x >>= ((((x<<(((((((-2133752838)&((tmp = -3045157736.9331336, tmp)>>>(x%x)))>>x)%(tmp = 3082217039, tmp))&(tmp = 270770770.97558427, tmp))|((-2212037556)^((((((2089224421)|(tmp = 360979560, tmp))<<x)%((tmp = -1679487690.6940534, tmp)+((173021423)|((tmp = 560900612, tmp)+((244376267.58977115)^x)))))<<(tmp = 2534513699, tmp))^x)))>>>(2915907189.4873834)))+(x*x))%(1637581117))%(tmp = 2363861105.3786244, tmp)));\n assertEquals(0, x &= ((-2765495757.873004)&(1727406493)));\n assertEquals(NaN, x -= (((((-1419667515.2616255)|x)-(150530256.48022234))%((((x|x)<<x)>>>(x^x))+x))-((-1216384577.3749187)*(495244398))));\n assertEquals(NaN, x += (x^((tmp = 2472035493, tmp)+x)));\n assertEquals(NaN, x %= ((tmp = -1753037412.885754, tmp)|((tmp = 2507058310, tmp)<<(1475945705))));\n assertEquals(-1008981005, x |= ((tmp = -1140889842.6099494, tmp)-(tmp = -131908837, tmp)));\n assertEquals(999230327.5872104, x -= (tmp = -2008211332.5872104, tmp));\n assertEquals(975810, x >>= (((-1211913874)*x)>>>((-2842129009)>>(x&(tmp = -1410865834, tmp)))));\n assertEquals(7623, x >>= ((tmp = -1051327071, tmp)-(((tmp = -237716102.8005445, tmp)|((2938903833.416546)&x))|(((-1831064579)^x)/((tmp = 2999232092, tmp)-(981996301.2875179))))));\n assertEquals(0, x -= x);\n assertEquals(0, x %= (x|(tmp = -666201160.5810485, tmp)));\n assertEquals(-1347124100, x |= (-1347124100));\n assertEquals(-0, x %= (x&x));\n assertEquals(-661607963, x ^= (tmp = -661607963.3794863, tmp));\n assertEquals(3465, x >>>= (-828119020.8056595));\n assertEquals(-268431991, x -= (((tmp = -1386256352, tmp)^((tmp = 743629575, tmp)%((x*((tmp = -1719517658, tmp)>>(2019516558)))<<((2637317661)|x))))<<(tmp = -51637065, tmp)));\n assertEquals(1578876380, x += ((tmp = 1847308371, tmp)&(((((((tmp = 1487934776.1893163, tmp)%(tmp = 1423264469.3137975, tmp))|(((2653260792.5668964)/(-2417905016.043802))>>>(2097411118.4501896)))^x)^(((tmp = -71334226, tmp)|x)>>>(tmp = -2771758874.7696714, tmp)))^((tmp = -1464849031.3240793, tmp)%(tmp = 2349739690.6430283, tmp)))/x)));\n assertEquals(3269293934, x += (1690417554));\n assertEquals(4025392608.031957, x -= (((tmp = 268501120.7225704, tmp)<<(tmp = 2841620654.8903794, tmp))+((tmp = 1606704462.8455591, tmp)/((-2601879963)/(tmp = 2966620168.989736, tmp)))));\n assertEquals(7, x >>>= (x^(-1913800035)));\n assertEquals(1.4326776816275493e-8, x /= ((((tmp = -2703417892, tmp)/x)^((-2693772270.396241)>>>((x-(tmp = 615999818.5666655, tmp))>>((((2308121439.3702726)<<((-1794701502)>>(x+(tmp = -2253406035.972883, tmp))))<<((tmp = -197103799.0624652, tmp)|(629975898)))>>>x))))>>>((tmp = 2833656803, tmp)^(x^(tmp = -1580436025, tmp)))));\n assertEquals(0, x >>>= (tmp = 1525372830.2126007, tmp));\n assertEquals(0, x %= ((2354010949.24469)>>>(x<<x)));\n assertEquals(0, x ^= (((1112335059.6922574)*(tmp = -1874363935, tmp))&(((((2154894295.8360596)<<x)&(tmp = -270736315.13505507, tmp))&x)>>>(-2205692260.552064))));\n assertEquals(0, x >>>= (x<<((1488533932)*(tmp = 1707754286, tmp))));\n assertEquals(0, x >>= (((tmp = 1232547376.463387, tmp)%((x>>(711691823.1608362))>>>x))>>(((895039781.7478573)*(((((-334946524)&x)*(tmp = -1214529640, tmp))^(tmp = -1586820245, tmp))*(1062595445)))+x)));\n assertEquals(0, x *= (1863299863.2631998));\n assertEquals(0, x /= (tmp = 1858428705.1330547, tmp));\n assertEquals(0, x &= x);\n assertEquals(611788028, x += (x^(611788028.1510412)));\n assertEquals(1, x /= x);\n assertEquals(0, x >>= ((tmp = -1617320707.1784317, tmp)-((-2139400380)-(-1402777976))));\n assertEquals(0, x >>= (415866827.34665));\n assertEquals(-1990811897, x -= (tmp = 1990811897, tmp));\n assertEquals(-1990811895, x += ((x>>>(tmp = -2175453282.769696, tmp))&(tmp = -1459450498.7327478, tmp)));\n assertEquals(-2377017935.149517, x += (-386206040.1495173));\n assertEquals(1946129845, x |= (tmp = -2890956796.936539, tmp));\n assertEquals(0, x %= x);\n assertEquals(0, x <<= (1616188263));\n assertEquals(-1081213596, x ^= (tmp = 3213753700, tmp));\n assertEquals(3213753700, x >>>= (tmp = -3211181312, tmp));\n assertEquals(-1081213596, x &= x);\n assertEquals(-1081213583, x ^= (((tmp = 1599988273.4926577, tmp)>>((((-1061394954.6331315)^x)+((-1835761078)*x))+(x%(tmp = -696221869, tmp))))/((tmp = -1156966790.3436491, tmp)^x)));\n assertEquals(0, x ^= x);\n assertEquals(NaN, x /= x);\n assertEquals(NaN, x += (-1257400530.9263027));\n assertEquals(NaN, x /= (753062089));\n assertEquals(NaN, x *= ((tmp = 305418865.57012296, tmp)^(((-2797769706)+((((tmp = -33288276.988654375, tmp)%(tmp = 1242979846, tmp))|(-316574800))-((tmp = -1766083579.4203427, tmp)*(((x*(tmp = -2400342309.2349987, tmp))>>(tmp = 2632061795, tmp))^(tmp = -1001440809, tmp)))))^((((x-(tmp = -1469542637.6925495, tmp))-x)-(3184196890))%(((((((633226688)*((tmp = -2692547856, tmp)>>(((tmp = -1244311756, tmp)>>>x)+((1746013631.405202)>>>(941829464.1962085)))))%(x-x))+(995681795))-(tmp = -3047070551.3642616, tmp))/(1968259705))-((-2853237880)^(tmp = -2746628223.4540343, tmp)))))));\n assertEquals(0, x >>= x);\n assertEquals(0.5713172378854926, x += (((x+(((x+x)/(tmp = 2642822318, tmp))*(-2590095885.4280834)))|(tmp = -1769210836, tmp))/(tmp = -3096722308.8665104, tmp)));\n assertEquals(-0.000002311097780334994, x /= ((2269858877.9010344)>>(-2992512915.984787)));\n assertEquals(-0.000002311097780334994, x %= (-1139222821));\n assertEquals(-0.000004622195560669988, x += x);\n assertEquals(1, x /= x);\n assertEquals(1, x >>>= (((3002169429.6061807)/(-3068577366))>>>((tmp = -1844537620, tmp)%((((tmp = 2087505119, tmp)>>>x)+x)&(2179989542)))));\n assertEquals(-534213071, x *= (-534213071));\n assertEquals(-534213077.3716287, x -= (((tmp = -2390432951.154034, tmp)^x)/(-290501980)));\n assertEquals(1836305, x >>>= (x&x));\n assertEquals(1836305, x %= ((x|((3070123855)^(49986396)))+((-1863644960.4202995)>>>((tmp = 1886126804.6019692, tmp)^x))));\n assertEquals(28692, x >>>= ((2561362139.491764)>>(((((tmp = -1347469854.7413375, tmp)/(((x|(x+x))^((x^(tmp = -2737413775.4595394, tmp))^x))<<(((tmp = 225344844.07128417, tmp)&x)&(tmp = 145794498, tmp))))*x)<<(1424529187))/((-2924344715)/(tmp = -2125770148, tmp)))));\n assertEquals(-2089419535.2717648, x += (-2089448227.2717648));\n assertEquals(18957929, x ^= (tmp = 2186590872, tmp));\n assertEquals(-708972800, x -= (727930729));\n assertEquals(-4198593, x |= (799483455.1885371));\n assertEquals(-1, x >>= (-2330654693.6413193));\n assertEquals(-1, x |= (((tmp = -116877155, tmp)>>>((((tmp = -1677422314.1333556, tmp)/(tmp = -3108738499.0798397, tmp))%((x&(x/x))%((tmp = -695607185.1561592, tmp)-(tmp = 2302449181.622259, tmp))))^(((-1482743646.5604773)^((897705064)>>>x))-(tmp = -2933836669, tmp))))%(((tmp = -2991584625, tmp)|(((x>>x)+(-1101066835))-x))>>(-33192973.819939613))));\n assertEquals(-1, x &= x);\n assertEquals(-524288, x <<= (-1177513101.3087924));\n assertEquals(1978770334.9189441, x += (tmp = 1979294622.9189441, tmp));\n assertEquals(901783582, x &= ((-368584615)^(((((-478030699.2647903)<<x)<<x)+(tmp = 708725752, tmp))^((tmp = -3081556856, tmp)/(tmp = 1149958711.0676727, tmp)))));\n assertEquals(-1480333211.8654308, x += (tmp = -2382116793.865431, tmp));\n assertEquals(956930239.6783283, x *= ((tmp = 956930239.6783283, tmp)/x));\n assertEquals(1277610.4668602513, x /= ((tmp = 1571029828, tmp)>>(tmp = 2417481141, tmp)));\n assertEquals(-1077333228, x ^= (tmp = 3218755006, tmp));\n assertEquals(-50218, x |= (tmp = -1044436526.6435988, tmp));\n assertEquals(-1, x >>= (-154655245.18921852));\n assertEquals(0.00006276207290978003, x *= (((tmp = 2234286992.9800305, tmp)>>(tmp = 2132564046.0696363, tmp))/((((tmp = -2565534644.3428087, tmp)>>>(tmp = 2622809851.043325, tmp))>>>((tmp = 311277386, tmp)&x))-(tmp = -2003980974, tmp))));\n assertEquals(0, x %= x);\n assertEquals(1282114076, x += ((((422838227)>>>((tmp = 1024613366.1899053, tmp)-((368275340)<<(((tmp = -3066121318, tmp)+(-2319101378))&x))))^(x>>(tmp = 1920136319.803412, tmp)))^(1282264803.3968434)));\n assertEquals(-277097604, x |= (-283585688.9123297));\n assertEquals(553816692, x &= (x&(tmp = 554082036.676608, tmp)));\n assertEquals(658505728, x <<= x);\n assertEquals(658505728, x &= (x%(2846071230)));\n assertEquals(39, x >>= (334728536.5172192));\n assertEquals(0, x -= x);\n assertEquals(0, x += x);\n assertEquals(0, x &= (tmp = -335285336, tmp));\n assertEquals(0, x <<= (tmp = 1255594828.3430014, tmp));\n assertEquals(0, x %= (-630772751.1248167));\n assertEquals(NaN, x /= ((((x&(tmp = -1576090612, tmp))%x)>>>x)*((-1038073094.2787619)>>>x)));\n assertEquals(NaN, x += x);\n assertEquals(NaN, x -= (((tmp = -2663887803, tmp)&((x+(-1402421046))/x))/(-2675654483)));\n assertEquals(NaN, x %= (x&(tmp = 672002093, tmp)));\n assertEquals(0, x |= x);\n assertEquals(-2698925754, x += (tmp = -2698925754, tmp));\n assertEquals(-2057748993, x += ((tmp = -2263466497, tmp)^x));\n assertEquals(1, x /= x);\n assertEquals(-2769559719.4045835, x -= (2769559720.4045835));\n assertEquals(-1.3964174646069973, x /= (tmp = 1983332198, tmp));\n assertEquals(-2140716624.3964174, x += (tmp = -2140716623, tmp));\n assertEquals(0, x <<= ((2589073007)-(-816764911.8571186)));\n assertEquals(-2837097288.161354, x -= (tmp = 2837097288.161354, tmp));\n assertEquals(-1445059927.161354, x += (tmp = 1392037361, tmp));\n assertEquals(155197984, x &= (tmp = -2694712730.924674, tmp));\n assertEquals(155197984, x |= (x>>>(tmp = 69118015.20305443, tmp)));\n assertEquals(155197984, x >>>= (((x^(-1353660241))*x)<<(((((x%(tmp = -1905584634, tmp))>>>(tmp = -860171244.5963638, tmp))&(-1084415001.7039547))+(x-(((tmp = 298064661, tmp)>>x)>>((tmp = 378629912.383446, tmp)-(x%x)))))+(((3212580683)/(((((x^x)>>(tmp = -1502887218, tmp))<<x)%(-142779025))|(((tmp = 1361745708, tmp)*(((((tmp = 1797072528.0673332, tmp)+x)%(tmp = 167297609, tmp))%(-287345856.1791787))^(((((((x*(tmp = -640510459.1514752, tmp))<<(x^(tmp = 1387982082.5646644, tmp)))>>(tmp = 2473373497.467914, tmp))^((234025940)*x))+(tmp = 520098202.9546956, tmp))*(x*(tmp = -362929250.1775775, tmp)))^(-2379972900))))*(tmp = -1385817972, tmp))))+(-1788631834)))));\n assertEquals(0, x >>= ((tmp = -18671049, tmp)/((tmp = 651261550.6716013, tmp)>>(-58105114.70740628))));\n assertEquals(0, x *= ((((x>>(tmp = 2256492150.737681, tmp))<<(x<<(((-2738910707)&x)<<(1892428322))))*(tmp = 1547934638, tmp))>>((((319464033.7888391)|(((((tmp = 2705641070, tmp)<<((tmp = 1566904759.36666, tmp)*((-682175559.7540412)&(-691692016.3021002))))%(tmp = 1118101737, tmp))|(902774462))<<x))^((tmp = -388997180, tmp)<<(x<<((((((-88462733)+(x>>>x))%x)*(tmp = -20297481.556210756, tmp))>>>(1927423855.1719701))-((2047811185.6278129)-(tmp = 2952219346.72126, tmp))))))|(-1685518403.7513878))));\n assertEquals(0, x /= (tmp = 1858074757.563318, tmp));\n assertEquals(-1351623058, x ^= (-1351623058.4756806));\n assertEquals(1, x /= x);\n assertEquals(0, x ^= x);\n assertEquals(0, x -= (x&(997878144.9798675)));\n assertEquals(-0, x /= (-2769731277));\n assertEquals(0, x >>>= ((-2598508325)>>(-1355571351)));\n assertEquals(0, x >>>= x);\n assertEquals(0, x -= (x&(tmp = 1672810223, tmp)));\n assertEquals(-924449908.1999881, x -= (924449908.1999881));\n assertEquals(-0, x %= x);\n assertEquals(-0, x /= (tmp = 2007131382.059545, tmp));\n assertEquals(-0, x += x);\n assertEquals(225132064, x += ((((tmp = -2422670578.1260514, tmp)|x)+x)^(1660142894.7066057)));\n assertEquals(Infinity, x /= (x-x));\n assertEquals(0, x ^= x);\n assertEquals(0, x <<= x);\n assertEquals(-2455424946.732606, x -= (2455424946.732606));\n assertEquals(1208029258, x &= ((tmp = 1823728509, tmp)+x));\n assertEquals(1.3682499724725645, x /= ((((tmp = 1267938464.3854322, tmp)%((tmp = 2510853574, tmp)+(((2979355693.866435)-(tmp = 1989726095.7746763, tmp))<<x)))%((-1382092141.1627176)+(((-901799353)+((-2936414080.8254457)>>>(2515004943.0865674)))-(2532799222.353197))))<<(tmp = -2168058960.2694826, tmp)));\n assertEquals(0.13799826710735907, x %= ((-1090423235)/(tmp = 2659024727, tmp)));\n assertEquals(0, x >>= (1688542889.082693));\n assertEquals(0, x <<= x);\n assertEquals(NaN, x %= ((((tmp = 1461037539, tmp)<<((x<<(tmp = 2101282906.5302017, tmp))>>(-2792197742)))%(((x%x)^(((tmp = 1399565526, tmp)^(tmp = 643902, tmp))-((tmp = -1449543738, tmp)|x)))/x))*(x<<(471967867))));\n assertEquals(0, x &= ((tmp = -2121748100.6824129, tmp)>>(tmp = -2817271480.6497793, tmp)));\n assertEquals(0, x &= (3169130964.6291866));\n assertEquals(-0, x /= (-2303316806));\n assertEquals(0, x <<= (tmp = 120185946.51617038, tmp));\n assertEquals(449448375, x ^= ((((tmp = -836410266.014014, tmp)/x)&((x>>>(tmp = -2602671283, tmp))+x))+(tmp = 449448375, tmp)));\n assertEquals(202003841790140640, x *= x);\n assertEquals(202003840800829020, x += (((tmp = -1339865843, tmp)+(tmp = 350554234.15375435, tmp))<<((((((tmp = -1798499687.8208885, tmp)>>(((x-(x^x))|((tmp = 463627396.23932934, tmp)/(2714928060)))&(tmp = 3048222568.1103754, tmp)))&(-3127578553))<<(tmp = -2569797028.8299003, tmp))&x)<<((tmp = 2104393646, tmp)/((tmp = 2314471015.742891, tmp)<<((2704090554.1746845)>>(((tmp = 1935999696, tmp)*(((1348554815)>>>x)>>>(146665093.82445252)))%x)))))));\n assertEquals(202003841764125400, x -= (tmp = -963296372.2846234, tmp));\n assertEquals(-413485056, x <<= (tmp = -2474480506.6054573, tmp));\n assertEquals(-3171894580.186845, x += ((tmp = -1261111102, tmp)+(tmp = -1497298422.1868448, tmp)));\n assertEquals(17136, x >>= (tmp = 3055058160, tmp));\n assertEquals(17136, x %= (tmp = 1706784063.3577294, tmp));\n assertEquals(17136, x >>= ((tmp = 2161213808, tmp)*x));\n assertEquals(-17136, x /= ((((tmp = -1492618154, tmp)>>x)|(1381949066))>>(tmp = 2014457960, tmp)));\n assertEquals(-34272, x += x);\n assertEquals(-1498690902, x += (-1498656630));\n assertEquals(-1168674482, x ^= (486325220));\n assertEquals(-1168674482, x <<= ((x^x)*x));\n assertEquals(794521557347068000, x *= (-679848469));\n assertEquals(1.3330392590424505e+26, x *= (tmp = 167778866, tmp));\n assertEquals(0, x <<= (tmp = -2501540637.3664584, tmp));\n assertEquals(0, x >>>= (x-(x*(-890638026.1825848))));\n assertEquals(0, x %= ((-285010538.2813468)&(1314684460.7634423)));\n assertEquals(0, x -= x);\n assertEquals(0, x *= x);\n assertEquals(NaN, x %= (x*(x<<x)));\n assertEquals(NaN, x %= (x<<(((tmp = -1763171810.601149, tmp)&(-138151449.18303752))^(x|x))));\n assertEquals(0, x |= (x>>x));\n assertEquals(0, x &= (tmp = 1107152048, tmp));\n assertEquals(0, x >>= (1489117056.8200984));\n assertEquals(518749976, x ^= (518749976.20107937));\n assertEquals(356718654, x += (tmp = -162031322, tmp));\n assertEquals(356718654, x %= (((x>>>((tmp = -373747439.09634733, tmp)*(tmp = 563665566, tmp)))*(tmp = 2853322586.588251, tmp))*((1303537213)%(-2995314284))));\n assertEquals(5573728, x >>= (tmp = -2095997978, tmp));\n assertEquals(5573728, x <<= x);\n assertEquals(5573728, x >>= (((((tmp = 1745399178.334154, tmp)<<(tmp = 2647999783.8219824, tmp))^(tmp = 1571286759, tmp))%x)/(2166250345.181711)));\n assertEquals(10886, x >>>= ((682837289)+(x*x)));\n assertEquals(170, x >>>= x);\n assertEquals(169.95167497151652, x -= (((tmp = 527356024.19706845, tmp)+((tmp = 1263164619.2954736, tmp)|(tmp = 2942471886, tmp)))/((3017909419.131321)+(tmp = 2137746252.8006272, tmp))));\n assertEquals(-1915170061, x ^= (tmp = -1915170214, tmp));\n assertEquals(206045792, x &= (((tmp = 887031922, tmp)>>>x)-((-1861922770)|(9633541))));\n assertEquals(-1940321674, x |= (tmp = -2012149162.1817405, tmp));\n assertEquals(-1940321674, x &= x);\n assertEquals(1128412272.160699, x += (tmp = 3068733946.160699, tmp));\n assertEquals(0.47486363523180236, x /= (tmp = 2376286976.807289, tmp));\n assertEquals(-1.4931079540252477e-10, x /= (tmp = -3180370407.5892467, tmp));\n assertEquals(0, x |= (((1220765170.5933602)*(884017786))*((x%(tmp = -2538196897.226384, tmp))<<(x^x))));\n assertEquals(-525529894, x += (tmp = -525529894, tmp));\n assertEquals(1621426184, x &= ((3046517714)*(((((-162481040.8033898)+(x/((x&(1489724492))/((x|(tmp = 943542303, tmp))>>>((-1840491388.1365871)<<(2338177232))))))+(((-2268887573.2430763)>>>(((tmp = 2919141667, tmp)+((tmp = 1326295559.692003, tmp)<<(-2256653815)))>>>(((((tmp = 1602731976.7514615, tmp)*(856036244.3730336))^x)>>>((((2846316421.252943)&(915324162))%(tmp = 1144577211.0221815, tmp))%x))*(x*x))))%(tmp = -2641416560, tmp)))*(x+(x>>>x)))>>x)));\n assertEquals(1621426184, x %= (tmp = 1898223948, tmp));\n assertEquals(-3.383396676504762, x /= ((tmp = 2211088034.5234556, tmp)^x));\n assertEquals(7120923705.122882, x *= (((((tmp = 2632382342.914504, tmp)/(-615440284.1762738))&(2162453853.6658797))<<(-849038082.5298986))|(tmp = -2104667110.5603983, tmp)));\n assertEquals(-1469010887, x &= x);\n assertEquals(850767635866964700, x *= (tmp = -579143179.5338116, tmp));\n assertEquals(0, x %= x);\n assertEquals(-571457, x |= ((2849326490.8464212)|(tmp = 1450592063, tmp)));\n assertEquals(-571457, x &= x);\n assertEquals(-0.00018638416434019244, x /= (3066016912.021368));\n assertEquals(0, x <<= (2058262829));\n assertEquals(NaN, x %= ((x|((x%x)>>>x))%((tmp = -2970314895.6974382, tmp)+x)));\n assertEquals(NaN, x *= (-698693934.9483855));\n assertEquals(NaN, x += (-100150720.64391875));\n assertEquals(NaN, x %= x);\n assertEquals(NaN, x -= (-530301478));\n assertEquals(NaN, x /= (1507673244));\n assertEquals(0, x <<= (x%(tmp = 2977838420.857235, tmp)));\n assertEquals(0, x <<= (tmp = 3200877763, tmp));\n assertEquals(0, x <<= (tmp = -2592127060, tmp));\n assertEquals(NaN, x -= (((((((1930632619)*(3018666359))<<((tmp = 2676511886, tmp)&(-2786714482.25468)))%x)-(-633193192))<<((tmp = 403293598, tmp)*(-2765170226)))%x));\n assertEquals(530062092, x |= (tmp = 530062092, tmp));\n assertEquals(129409, x >>>= x);\n assertEquals(-152430382316341.78, x *= (-1177896300.229055));\n assertEquals(-304860764632683.56, x += x);\n assertEquals(0, x ^= x);\n assertEquals(0, x %= (tmp = -63071565.367660046, tmp));\n assertEquals(0, x &= ((((tmp = -1007464338, tmp)<<(x<<((x^(tmp = -726826835, tmp))|x)))>>>x)*(((tmp = 469293335.9161849, tmp)<<(((((tmp = 1035077379, tmp)*(tmp = -555174353.7567515, tmp))&(3109222796.8286266))-(((((x-(tmp = 1128900353.6650414, tmp))|(tmp = 3119921303, tmp))&((-1353827690)&(x%((-924615958)&x))))>>>x)+(tmp = 1167787910, tmp)))+x))%((605363594)>>(1784370958.269381)))));\n assertEquals(0, x %= (2953812835.9781704));\n assertEquals(0, x -= x);\n assertEquals(0, x <<= x);\n assertEquals(-901209266, x += (-901209266));\n assertEquals(-901209266, x &= x);\n assertEquals(404, x >>>= (-3195686249));\n assertEquals(824237108, x ^= (824237472));\n assertEquals(497790936.1853996, x /= ((tmp = 1253776028, tmp)/(757207285)));\n assertEquals(497790936, x >>>= ((tmp = -2212598336, tmp)<<(x^(1335355792.9363852))));\n assertEquals(0, x %= x);\n assertEquals(-2659887352.6415873, x += (tmp = -2659887352.6415873, tmp));\n assertEquals(1635079945, x |= ((x&(1234659380))>>((((tmp = 2694276886.979136, tmp)|x)^((tmp = 132795582, tmp)<<((-1089828902)>>>x)))<<((((tmp = -2098728613.0310376, tmp)<<(x/(tmp = -2253865599, tmp)))*((x+(x>>>((48633053.82579231)-(385301592))))*(tmp = -1847454853.333535, tmp)))/((-540428068.8583717)+x)))));\n assertEquals(1, x /= x);\n assertEquals(33554432, x <<= ((((2803140769)<<x)|(tmp = -1965793804, tmp))>>>(tmp = -2273336965.575082, tmp)));\n assertEquals(67108864, x += x);\n assertEquals(9007199254740992, x *= (x+((x>>x)%(2674760854))));\n assertEquals(55369784, x %= (x|(-170725544.20038843)));\n assertEquals(55369784, x %= (-1186186787));\n assertEquals(0, x ^= x);\n assertEquals(0, x <<= x);\n assertEquals(NaN, x /= ((-2968110098)-((x/(x|(((((x|((x&((-130329882)>>>(((-135670650)|(x<<(tmp = 1280371822, tmp)))^x)))-(-1183024707.2230911)))&(-1072829280))>>>(-340696948.41492534))>>>(tmp = 436308526.4938295, tmp))<<(((tmp = 3113787500, tmp)*((2038309320)>>>(-1818917055)))&((2808000707)/(774731251))))))%x)));\n assertEquals(0, x |= (x*(tmp = -843074864, tmp)));\n assertEquals(0, x &= (tmp = -752261173.8090212, tmp));\n assertEquals(0, x >>>= (tmp = 1532349931.7517128, tmp));\n assertEquals(0, x <<= ((tmp = -8628768, tmp)-((((tmp = 225928543, tmp)%(x>>>(x+x)))^((tmp = -2051536806.5249376, tmp)-x))-((tmp = -2274310376.9964137, tmp)%(tmp = 2251342739, tmp)))));\n assertEquals(0, x >>= (1011388449));\n assertEquals(0, x += x);\n assertEquals(0, x >>>= x);\n assertEquals(-0, x *= ((-1781234179.8663826)>>(((1514201119.9761915)>>(((((1174857164.90042)^(tmp = 1124973934, tmp))^x)+((-1059246013.8834443)<<(2997611138.4876065)))%(((798188010)*(-1428293122))>>>(tmp = -3087267036.8035297, tmp))))<<x)));\n assertEquals(1752554372, x ^= (tmp = -2542412924, tmp));\n assertEquals(1752554372, x %= (tmp = 3037553410.2298307, tmp));\n assertEquals(1859383977, x -= (x^(2446603103)));\n assertEquals(1183048193, x &= ((tmp = -962336957, tmp)/(x/x)));\n assertEquals(67738157, x %= ((((tmp = -1813911745.5223546, tmp)+x)<<(x-(((-1980179168)^x)|x)))|(1913769561.1308007)));\n assertEquals(67698724, x &= ((1801574998.3142045)*((tmp = -2057492249, tmp)/((1713854494.72282)>>x))));\n assertEquals(0, x -= x);\n assertEquals(-25232836, x -= ((tmp = 25232836, tmp)|x));\n assertEquals(-49, x >>= (x+((tmp = 2201204630.2897243, tmp)|(-1929326509))));\n assertEquals(-1605632, x <<= x);\n assertEquals(-165965313, x += (tmp = -164359681, tmp));\n assertEquals(9.220413724941365e-10, x /= (((((tmp = 2579760013.0808706, tmp)*(tmp = -2535370639.9805303, tmp))>>((tmp = 2138199747.0301933, tmp)-(tmp = -2698019325.0972376, tmp)))*(tmp = -425284716, tmp))/((-1951538149.6611228)/(x^(2632919130)))));\n assertEquals(0, x &= x);\n assertEquals(0, x &= ((-645189137)/(tmp = 800952748, tmp)));\n assertEquals(0, x &= (tmp = -1773606925, tmp));\n assertEquals(0, x += x);\n assertEquals(0, x >>>= (tmp = 211399355.0741787, tmp));\n assertEquals(0, x <<= ((-1317040231.5737965)/((((((tmp = 838897586.0147077, tmp)|((-1902447594)|(tmp = 404942728.83034873, tmp)))^(2462760692.2907705))%((((((x%(tmp = -2888980287, tmp))<<(-368505224.49609876))-((x>>>(532513369))&(((((((tmp = -1298067543, tmp)^(tmp = -3130435881.100909, tmp))>>x)/(tmp = -3041161992, tmp))>>(x|(-431685991.95776653)))^((tmp = 1031777777, tmp)^((-105610810)>>>((-631433779)>>(tmp = -2577780871.167671, tmp)))))%(tmp = -3170517650.088039, tmp))))-(((tmp = 2175146237.968785, tmp)-((384631158.50508535)>>((893912279.4646157)|(tmp = -1478803924.5338967, tmp))))%(x/(-1089156420))))<<(tmp = -2024709456, tmp))>>x))*(tmp = -1423824994.6993582, tmp))%(tmp = 1739143409, tmp))));\n assertEquals(-1799353648, x |= ((-1799353648.3589036)>>>((((x&(-923571640.1012449))%x)+((tmp = 971885508, tmp)>>((tmp = -2207464428.2123804, tmp)+(-3108177894.0459776))))-(-2048954486.7014258))));\n assertEquals(-3666808032.2958965, x -= (tmp = 1867454384.2958965, tmp));\n assertEquals(-260069478915415100, x *= (tmp = 70925305.23136711, tmp));\n assertEquals(1142096768, x &= (tmp = 1866401706.9144325, tmp));\n assertEquals(1, x >>>= (tmp = 2701377150.5717473, tmp));\n assertEquals(1865946805, x |= (tmp = -2429020492, tmp));\n assertEquals(1424222287, x ^= ((((tmp = 433781338, tmp)>>(x>>>((-2914418422.4829016)/(tmp = 1600920669, tmp))))|(tmp = 588320482.9566053, tmp))>>>((((((x+(tmp = -2556387365.5071325, tmp))+(tmp = -2381889946.1830974, tmp))/(3154278191))>>>(-1069701268.8022757))>>(((tmp = 182049089.28866422, tmp)>>x)>>>(tmp = -447146173, tmp)))/(x-(2103883357.0929923)))));\n assertEquals(0, x ^= x);\n assertEquals(0, x -= (x%(3036884806)));\n assertEquals(0, x >>>= (tmp = -652793480.3870945, tmp));\n assertEquals(0, x += x);\n assertEquals(304031003, x ^= ((tmp = -900156495, tmp)^(-666397014.0711515)));\n assertEquals(1, x /= x);\n assertEquals(-1974501681, x |= (x^(-1974501681.4628205)));\n assertEquals(-1.3089278317616264, x /= (((-1723703186.962839)>>>x)|((2061022161.6239533)<<x)));\n assertEquals(-1, x |= (tmp = -1987006457, tmp));\n assertEquals(-0.14285714285714285, x /= ((((((x|(-1767793799.7595732))-(-1391656680))<<x)|(x>>(tmp = -2301588485.2811003, tmp)))>>>(((tmp = 1812723993, tmp)>>>((x^(((tmp = -3154100157.951021, tmp)%((tmp = -1254955564.4553523, tmp)-(((x>>>(((-1762886343)*x)*x))*(x^(x*(-750918563.4387553))))*x)))|((x>>x)>>(x<<((((-1766797454.5634143)^(tmp = -2251474340, tmp))-(-787637516.5276759))<<((1390653368)^(-1937605249.245374)))))))|(((tmp = 1156611894, tmp)<<x)<<(x>>((((x+(tmp = 2170166060.881797, tmp))&(x>>>(tmp = -1749295923.1498983, tmp)))>>(((-1014973878)|x)&(1302866805.684057)))*(tmp = 560439074.4002491, tmp))))))|(-2758270803.4510045)))&x));\n assertEquals(0, x |= x);\n assertEquals(0, x += ((x>>((x+(tmp = -2776680860.870219, tmp))-(((688502468)<<(((tmp = 475364260.57888806, tmp)<<x)+(329071671)))/(-1097134948))))*(tmp = -1281834214.3416953, tmp)));\n assertEquals(0, x *= ((((1159762330)<<(tmp = -1892429200, tmp))%x)<<x));\n assertEquals(0, x >>>= (-770595225));\n assertEquals(NaN, x += (((x>>x)/(tmp = 281621135, tmp))/x));\n assertEquals(0, x >>= (1363890241));\n assertEquals(1639023942.9945002, x += (1639023942.9945002));\n assertEquals(-2568590958567747000, x *= (-1567146697));\n assertEquals(1793554700, x ^= (tmp = 3215813388.405799, tmp));\n assertEquals(437879, x >>= x);\n assertEquals(1339485943, x |= (1339220210));\n assertEquals(1, x /= x);\n assertEquals(512, x <<= (2509226729.1477118));\n assertEquals(512, x <<= ((x>>(1326274040.7181284))<<(tmp = -760670199, tmp)));\n assertEquals(1, x /= (x<<(x^x)));\n assertEquals(0, x >>>= (((((1382512625.8298302)&(x>>>x))*(tmp = -815316595, tmp))>>>x)-(-95538051)));\n assertEquals(-544344229.3548596, x -= (tmp = 544344229.3548596, tmp));\n assertEquals(-1088688458.7097192, x += x);\n assertEquals(-1022850479579041900, x *= (939525418.3104812));\n assertEquals(2069622661, x |= (-2632744187.7721186));\n assertEquals(-1353480538017756400, x -= ((tmp = 1308085980, tmp)*((x>>>(-629663391.5165792))&(tmp = 3182319856.674114, tmp))));\n assertEquals(1.3702811563654176e+27, x *= ((((3061414617.6321163)/(tmp = 2628865442, tmp))+(-1549548261))+(x&((tmp = 809684398, tmp)|(x^(tmp = 801765002, tmp))))));\n assertEquals(0, x >>>= ((-2988504159)&((tmp = -260444190.02252054, tmp)^(2178729442.260293))));\n assertEquals(-1518607002, x -= (tmp = 1518607002, tmp));\n assertEquals(724566016, x <<= (tmp = 1042915731.7055794, tmp));\n assertEquals(707584, x >>>= (-208959862.93305588));\n assertEquals(0, x >>>= (((tmp = 877181764, tmp)>>(-970697753.3318911))%x));\n assertEquals(0, x ^= x);\n assertEquals(0, x += x);\n assertEquals(0, x <<= x);\n assertEquals(0, x /= (x^((x/(-2903618412.4936123))+(tmp = 1169288899, tmp))));\n assertEquals(0, x >>>= x);\n assertEquals(-1302645245, x ^= ((1855892732.3544865)+(tmp = 1136429319.5633948, tmp)));\n assertEquals(0, x ^= x);\n assertEquals(0, x &= (-1384534597.409375));\n assertEquals(-0, x /= (tmp = -680466419.8289509, tmp));\n assertEquals(-0, x *= (318728599.95017374));\n assertEquals(NaN, x %= (x>>(2019695267)));\n assertEquals(0, x >>= (tmp = 1280789995, tmp));\n assertEquals(0, x *= (tmp = 2336951458, tmp));\n assertEquals(0, x >>= ((2981466013.758637)%(731947033)));\n assertEquals(0, x -= x);\n assertEquals(0, x ^= x);\n assertEquals(0, x /= ((((3068070149.1452317)>>x)%(((1448965452)*((tmp = -2961594129, tmp)+(1829082104.0681171)))>>(-2331499703)))>>>(tmp = -3206314941.2626476, tmp)));\n assertEquals(0, x >>= (x%(1869217101.9823673)));\n assertEquals(0, x <<= (x+x));\n assertEquals(0, x >>>= ((1202130282)>>>x));\n assertEquals(0, x += x);\n assertEquals(2603245248.6273212, x += (tmp = 2603245248.6273212, tmp));\n assertEquals(-1691864471, x ^= (x>>>(2504513614.117516)));\n assertEquals(136835305, x -= ((-1618979896)&(-746953306)));\n assertEquals(-2568499564.1261334, x += (tmp = -2705334869.1261334, tmp));\n assertEquals(1038075700, x ^= (1530399136));\n assertEquals(2076151400, x += x);\n assertEquals(-524018410.1751909, x -= ((2398973627.175191)-(-201196183)));\n assertEquals(0.327110599608614, x /= ((3181340288.602796)&x));\n assertEquals(0.327110599608614, x %= (tmp = -2284484060, tmp));\n assertEquals(0, x |= x);\n assertEquals(403217947.5779772, x += (tmp = 403217947.5779772, tmp));\n assertEquals(403217947, x |= x);\n assertEquals(-Infinity, x *= ((58693583.845808744)+(((tmp = -1527787016, tmp)*x)/((((2532689893.3191843)/(tmp = 2781746479.850424, tmp))|(((((460850355.9211761)/((((tmp = 626683450, tmp)<<((tmp = 1349974710, tmp)-((tmp = -1349602292, tmp)/(-2199808871.1229663))))>>((x/(-3092436372.3078623))&(tmp = -1190631012.0323825, tmp)))^((-2907082828.4552956)-(tmp = 1858683340.1157017, tmp))))^(-1513755598.5398848))%x)/x))&(1147739260.136806)))));\n assertEquals(0, x &= (tmp = -3047356844.109563, tmp));\n assertEquals(637934616, x -= (tmp = -637934616, tmp));\n assertEquals(-1553350083, x ^= (-2056266203.094929));\n assertEquals(-0.13467351026547192, x %= ((tmp = 824736251, tmp)/(2544186314)));\n assertEquals(1, x /= x);\n assertEquals(1, x |= x);\n assertEquals(0, x >>>= (2166609431.9515543));\n assertEquals(0, x <<= (x|(tmp = 121899222.14603412, tmp)));\n assertEquals(0, x *= (1300447849.6595674));\n assertEquals(0, x %= (tmp = -2360500865.3944597, tmp));\n assertEquals(0, x %= (tmp = -1693401247, tmp));\n assertEquals(0, x >>= x);\n assertEquals(0, x /= (471265307));\n assertEquals(257349748, x ^= (257349748.689448));\n assertEquals(257349748, x &= x);\n assertEquals(981, x >>>= (tmp = -1959001422, tmp));\n assertEquals(0, x >>= ((-79932778.18114972)/x));\n assertEquals(0, x <<= (((-2599621472)^(tmp = 662071103, tmp))%(tmp = -2675822640.7641535, tmp)));\n assertEquals(0, x &= (tmp = 2582354953.878623, tmp));\n assertEquals(0, x /= ((-953254484)/((-2571632163.376176)-(tmp = -342034471, tmp))));\n assertEquals(0, x <<= ((x-(tmp = -3013057672, tmp))&(tmp = -3204761036, tmp)));\n assertEquals(0, x ^= ((x&((515934453)>>>x))/x));\n assertEquals(1, x |= ((-1914707646.2075093)>>>(tmp = -1918045025, tmp)));\n assertEquals(-2002844120.8792589, x += (tmp = -2002844121.8792589, tmp));\n assertEquals(573030794, x >>>= (tmp = 1707788162, tmp));\n assertEquals(1.917619109627369, x /= ((1909436830.484202)%((123114323)<<(tmp = -1288988388.6444468, tmp))));\n assertEquals(-1400358045, x |= (-1400358046));\n assertEquals(-2043022529.4273133, x += (tmp = -642664484.4273133, tmp));\n assertEquals(-81408068.86728716, x %= (tmp = -980807230.2800131, tmp));\n assertEquals(0.1436896445024992, x /= (((tmp = 3201789924.913518, tmp)%(tmp = -962242528.6008646, tmp))^((tmp = -338830119.55884504, tmp)*(tmp = -916120166, tmp))));\n assertEquals(0.1436896445024992, x %= (tmp = 2598469263, tmp));\n assertEquals(0, x *= (x-x));\n assertEquals(-1409286144, x += (((-111514798.64745283)|(2372059654))<<(tmp = 175644313, tmp)));\n assertEquals(-2393905467.0073113, x += (-984619323.0073113));\n assertEquals(-835111172.0073113, x %= (x^(-765900532.5585573)));\n assertEquals(-835111172.0073113, x %= (tmp = -946478116, tmp));\n assertEquals(-100, x >>= ((-1020515908)>>(((x&((x^(169474253.53811646))>>(-221739002)))+x)*((201939882.92880356)/(tmp = -50402570, tmp)))));\n assertEquals(2131506964, x &= (tmp = -2163460268, tmp));\n assertEquals(1074275840, x &= ((-1561930379.8719592)*(tmp = -2871750052.876917, tmp)));\n assertEquals(-954232605.5377102, x -= (tmp = 2028508445.5377102, tmp));\n assertEquals(-29, x >>= (-279577351.87217045));\n assertEquals(-232, x <<= x);\n assertEquals(-70, x |= (215185578));\n assertEquals(-1, x >>= (x>>(-1691303095)));\n assertEquals(1, x /= x);\n assertEquals(3149465364.2236686, x *= (3149465364.2236686));\n assertEquals(3304787832.3790073, x += (tmp = 155322468.15533853, tmp));\n assertEquals(100068712.23500109, x %= (tmp = 3204719120.1440063, tmp));\n assertEquals(91628864, x &= (tmp = 629090241, tmp));\n assertEquals(-113202292046379710, x *= (-1235443583));\n assertEquals(122, x >>>= (tmp = 3196555256, tmp));\n assertEquals(122, x >>>= (((2226535734)-x)^(2248399036.393125)));\n assertEquals(6.904199169070746e-8, x /= (tmp = 1767040564.9149356, tmp));\n assertEquals(-212687449.99999994, x += ((((2244322375)*(((2515994102)^x)>>x))<<(x-(-832407685.3251972)))^(2266670502)));\n assertEquals(366515938514778750, x *= (tmp = -1723260768.3940866, tmp));\n assertEquals(366515938514778750, x += ((-1643386193.9159095)/(tmp = 425161225.95316494, tmp)));\n assertEquals(654872716.4123061, x /= ((-1377382984)-(tmp = -1937058061.811642, tmp)));\n assertEquals(654872716, x &= x);\n assertEquals(-86260926.17813063, x -= (tmp = 741133642.1781306, tmp));\n assertEquals(1052176592, x >>>= x);\n assertEquals(2020882856, x ^= (-3107796616));\n assertEquals(0, x <<= ((606939871.9812952)|(tmp = -3127138319.1557302, tmp)));\n assertEquals(NaN, x -= ((x%((1120711400.2242608)%x))*(tmp = -930171286.7999947, tmp)));\n assertEquals(NaN, x %= (3215044180));\n assertEquals(NaN, x %= (tmp = 2882893804.20102, tmp));\n assertEquals(NaN, x %= ((217170359.5778643)^x));\n assertEquals(0, x &= ((-1095125960.9903677)>>(x^(-2227981276))));\n assertEquals(-748549860, x += (-748549860));\n assertEquals(1816208256, x <<= (-610872411.3826082));\n assertEquals(201400576, x &= (((tmp = 1910394603.4836266, tmp)<<x)^x));\n assertEquals(0, x %= x);\n assertEquals(NaN, x %= x);\n assertEquals(0, x <<= (((((2670901339.6696005)%(2180020861))*((2134469504)/(2237096063.0680027)))*((tmp = 1203829756, tmp)>>((765467065)+(x|(2673651811.9494815)))))<<((-1463378514)|(((x/(tmp = -1075050081, tmp))-((-879974865)+x))>>>(tmp = 2172883926, tmp)))));\n assertEquals(433013198, x ^= (433013198.2833413));\n assertEquals(0, x >>= ((((-2404431196)%(x%(tmp = 1443152875.8809233, tmp)))&(x|((1414364997.0517852)/((tmp = -435854369, tmp)+(tmp = 2737625141, tmp)))))|(((tmp = 2241746562.2197237, tmp)^(tmp = -1606928010.1992552, tmp))|((tmp = -3083227418.686173, tmp)>>(tmp = -2717460410, tmp)))));\n assertEquals(0, x >>= x);\n assertEquals(0, x *= ((tmp = 2302521322, tmp)>>>(((((((tmp = 344089066.9725498, tmp)%(tmp = 1765830559, tmp))-x)|x)^(((-2450263325)/(tmp = 371928405.17475057, tmp))>>>(1330100413.7731652)))^(((173024329)%(tmp = -2927276187, tmp))+(x>>>(-1042229940.308507))))|(((((tmp = 379074096, tmp)+((142762508)-((-2773070834.526266)-(x&((tmp = 57957493, tmp)<<(2189553500))))))+((36991093)+(tmp = 339487168.58069587, tmp)))*(-1257565451))&(tmp = 645233114, tmp)))));\n assertEquals(-2644503151.1185284, x += (-2644503151.1185284));\n assertEquals(-5289006302.237057, x += x);\n assertEquals(-4008773824.2370567, x -= (tmp = -1280232478, tmp));\n assertEquals(1975449413, x |= ((tmp = 1957832005.4285066, tmp)>>((1681236712.9715524)&(-675823978))));\n assertEquals(-146472960, x <<= (-648510672.5644083));\n assertEquals(-3, x |= (((((x>>>(tmp = 2271744104, tmp))+(tmp = -210058133.30147195, tmp))+(tmp = -2827493425, tmp))/(tmp = 765962538, tmp))%(tmp = 1048631551, tmp)));\n assertEquals(1, x /= x);\n assertEquals(0, x >>= (1070524782.5154183));\n assertEquals(0, x <<= (462502504));\n assertEquals(0, x %= (540589670.0730014));\n assertEquals(NaN, x %= x);\n assertEquals(NaN, x /= ((-1268640098)%x));\n assertEquals(NaN, x %= (1741157613.744652));\n assertEquals(NaN, x += x);\n assertEquals(NaN, x %= ((x|(tmp = 1992323492.7000637, tmp))*x));\n assertEquals(NaN, x /= ((tmp = -2271503368.0341196, tmp)>>((tmp = 1224449194, tmp)>>>(tmp = 2976803997, tmp))));\n assertEquals(NaN, x += (tmp = -1078313742.1633894, tmp));\n assertEquals(NaN, x += (-787923311));\n assertEquals(NaN, x %= x);\n assertEquals(-1299878219, x ^= (2995089077));\n assertEquals(536887953, x &= ((625660571.2651105)&(x^(((tmp = 950150725.2319129, tmp)+(-2122154205.466675))/(tmp = 1754964696.974752, tmp)))));\n assertEquals(4096, x >>>= x);\n assertEquals(1, x /= x);\n assertEquals(-82508517, x ^= (((-930231800)%(tmp = -423861640.4356506, tmp))+x));\n assertEquals(-82508517, x &= (x&x));\n assertEquals(-479519, x %= ((tmp = 1861364600.595756, tmp)|x));\n assertEquals(479518, x ^= (((x>>(-1539139751.6860313))>>(tmp = -456165734, tmp))|(-2786433531)));\n assertEquals(959036, x += x);\n assertEquals(29, x >>>= ((tmp = -1049329009.7632706, tmp)^(((((((1117739997)/(((-841179741.4939663)*(-1211599672))>>>((-413696355)%(tmp = -1753423217.2170188, tmp))))<<(tmp = 1599076219.09274, tmp))>>>(-1382960317))^(((x^(tmp = 515115394, tmp))>>>(tmp = -388476217, tmp))>>>(x/x)))^x)<<(136327532.213817))));\n assertEquals(24, x &= (2388755418));\n assertEquals(0, x >>>= (tmp = -405535917, tmp));\n assertEquals(0, x &= (tmp = -1427139674, tmp));\n assertEquals(NaN, x /= (x^((1530470340)%x)));\n assertEquals(0, x |= ((x>>(-1429690909.8472774))*((((tmp = 2033516515, tmp)/(1314782862))>>>x)>>(tmp = 1737186497.6441216, tmp))));\n assertEquals(0, x -= x);\n assertEquals(0, x %= (3115422786));\n assertEquals(-0, x *= (x+(tmp = -2558930842.267017, tmp)));\n assertEquals(NaN, x %= x);\n assertEquals(0, x &= (2695531252.254449));\n assertEquals(-613178182, x ^= (-613178182));\n assertEquals(54, x >>>= (x%(((tmp = 2277868389, tmp)^((((tmp = -1143932265.3616111, tmp)^((x&((x-((-2100384445.7850044)|(tmp = 908075129.3456883, tmp)))*x))+(((tmp = 1031013284.0275401, tmp)*((((tmp = -233393205, tmp)>>>(tmp = -111859419, tmp))*(-1199307178))|(tmp = -1998399599, tmp)))>>>((((-731759641.9036775)>>>(tmp = 2147849691, tmp))>>>(tmp = -2121899736, tmp))>>>(x>>>x)))))>>((1900348757.360562)^(tmp = 2726336203.6149445, tmp)))>>>((x*((tmp = -2697628471.0234947, tmp)%((x^(tmp = -2751379613.9474974, tmp))*x)))+(x>>(tmp = 42868998.384643435, tmp)))))+(598988941))));\n assertEquals(34, x &= ((tmp = 2736218794.4991407, tmp)%(2169273288.1339874)));\n assertEquals(2.086197133417468, x /= ((tmp = 2176358852.297597, tmp)%x));\n assertEquals(2, x <<= (((tmp = -1767330075, tmp)|(-3107230779.8512735))&x));\n assertEquals(4194304, x <<= (tmp = 1061841749.105744, tmp));\n assertEquals(48609515, x ^= (44415211.320786595));\n assertEquals(48609515, x %= (1308576139));\n assertEquals(23735, x >>>= ((-324667786)-x));\n assertEquals(23735, x <<= ((-1270911229)<<(((((tmp = -882992909.2692418, tmp)+(tmp = 394833767.947718, tmp))-x)<<(702856751))/x)));\n assertEquals(-31080872939240, x *= (tmp = -1309495384, tmp));\n assertEquals(-14625.31935626114, x /= ((668084131)+(1457057357)));\n assertEquals(-14625.31935626114, x %= (266351304.6585492));\n assertEquals(-12577, x |= (-945583977.619837));\n assertEquals(-4097, x |= ((tmp = -2621808583.2322493, tmp)-(tmp = -2219802863.9072213, tmp)));\n assertEquals(-1004843865, x &= ((-1004839768)+((tmp = 2094772311, tmp)/(-1340720370.275643))));\n assertEquals(-31401371, x >>= ((2035921047)>>>((tmp = -1756995278, tmp)>>>(-537713689))));\n assertEquals(1791746374.016472, x -= ((tmp = -1823147745, tmp)-(x/(tmp = -1906333520, tmp))));\n assertEquals(3.7289343120517406, x /= (tmp = 480498240, tmp));\n assertEquals(7.457868624103481, x += x);\n assertEquals(234881024, x <<= (-781128807.2532628));\n assertEquals(67108864, x &= (tmp = -2060391332, tmp));\n assertEquals(-605958718, x -= (673067582));\n assertEquals(-605958718, x <<= ((x%x)&((tmp = 1350579401.0801518, tmp)|x)));\n assertEquals(-109268090.4715271, x %= (tmp = -496690627.5284729, tmp));\n assertEquals(-109268090, x <<= (((-2004197436.8023896)%((x|((tmp = 271117765.61283946, tmp)-((1595775845.0754795)*(555248692.2512416))))/x))<<x));\n assertEquals(-652725370, x &= (-543590449));\n assertEquals(0.321858133298825, x /= (tmp = -2027990914.2267523, tmp));\n assertEquals(1959498446, x ^= (1959498446));\n assertEquals(1959498446, x &= (x%(tmp = 3155552362.973523, tmp)));\n assertEquals(14949, x >>>= ((tmp = 586618136, tmp)>>>(tmp = 699144121.9458897, tmp)));\n assertEquals(-28611391568319.285, x *= (tmp = -1913933478.3811147, tmp));\n assertEquals(1680557633, x &= (((tmp = 2606436319.199714, tmp)<<(1575299025.6917372))|((-1092689109)/(735420388))));\n assertEquals(1680361024, x &= ((tmp = 1860756552.2186172, tmp)|(-360434860.1699109)));\n assertEquals(820488, x >>>= (1788658731));\n assertEquals(820488, x >>= (-1555444352));\n assertEquals(2104296413, x ^= (2103543509));\n assertEquals(16843328, x &= ((x<<((-2920883149)/(1299091676)))-(((((tmp = 3199460211, tmp)+(-237287821.61504316))&(tmp = -1524515028.3596857, tmp))-(tmp = -700644414.6785603, tmp))+(-180715428.86124516))));\n assertEquals(1326969834, x |= (tmp = -2968063574.793867, tmp));\n assertEquals(0, x %= (x>>>(tmp = 1350490461.0012388, tmp)));\n assertEquals(0, x &= ((-2620439260.902854)+x));\n assertEquals(-1775533561, x |= ((-1775533561)|(((x>>>((861896808.2264911)>>>(970216466.6532537)))%x)%(tmp = 2007357223.8893046, tmp))));\n assertEquals(-1775533561, x &= x);\n assertEquals(-23058877.415584415, x /= ((tmp = -3002439857, tmp)>>((((x-(tmp = 1583620685.137125, tmp))|x)%(-2568798248.6863875))^x)));\n assertEquals(-577.4155844151974, x %= (((-1440361053.047877)+((tmp = 821546785.0910633, tmp)-(((tmp = 1023830881.1444875, tmp)/(-754884477))+(tmp = 651938896.6258571, tmp))))>>(tmp = 346467413.8959185, tmp)));\n assertEquals(-1, x >>= (tmp = 2993867511, tmp));\n assertEquals(-1, x |= (tmp = 823150253.4916545, tmp));\n assertEquals(-0, x %= x);\n assertEquals(-0, x /= ((tmp = 997969036, tmp)&((((tmp = 928480121, tmp)>>(((-2610875857.086055)>>>(tmp = -2251704283, tmp))|x))+(10781750))>>x)));\n assertEquals(0, x >>>= ((tmp = -1872319523, tmp)>>>(-278173884)));\n assertEquals(0, x |= (x/(x*x)));\n assertEquals(0, x %= ((77912826.10575807)^(tmp = 2770214585.3019757, tmp)));\n assertEquals(0, x &= (tmp = 722275824, tmp));\n assertEquals(-1417226266, x |= (tmp = 2877741030.1195555, tmp));\n assertEquals(0, x ^= x);\n assertEquals(0, x %= (tmp = -1740126105, tmp));\n assertEquals(910709964, x |= (tmp = 910709964, tmp));\n assertEquals(-1744830464, x <<= (tmp = -2445932551.1762686, tmp));\n assertEquals(318767104, x >>>= (tmp = -2465332061.628887, tmp));\n assertEquals(301989888, x &= (-2771167302.022801));\n assertEquals(301989888, x |= x);\n assertEquals(37748736, x >>= (tmp = -835820125, tmp));\n assertEquals(1474977371, x ^= (tmp = -2857738661.6610327, tmp));\n assertEquals(470467500, x += (-1004509871));\n assertEquals(0.30466562575942585, x /= (((tmp = 1515955042, tmp)<<(x+((1607647367)-(tmp = 1427642709.697169, tmp))))^x));\n assertEquals(1.0348231148499734e-10, x /= (tmp = 2944132397, tmp));\n assertEquals(0, x >>= (x>>>(tmp = -2847037519.569043, tmp)));\n assertEquals(NaN, x /= x);\n assertEquals(0, x >>>= (-1817784819.9058492));\n assertEquals(0, x >>= x);\n assertEquals(-0, x *= ((tmp = -1387748473, tmp)|(x+(352432111))));\n assertEquals(-0, x *= (((-2591789329)/(tmp = -2144460203, tmp))>>(tmp = -568837912.5033123, tmp)));\n assertEquals(0, x <<= (-2963600437.305708));\n assertEquals(0, x &= ((588720662)>>>x));\n assertEquals(1561910729, x += (1561910729));\n assertEquals(0, x ^= x);\n assertEquals(-0, x *= (-2722445702));\n assertEquals(0, x &= (tmp = -2738643199.732308, tmp));\n assertEquals(0, x /= (((1859901899.227291)>>>((tmp = -1067365693, tmp)+((-1975435278)|x)))|((1844023313.3719304)&(tmp = -624215417.0227654, tmp))));\n assertEquals(NaN, x %= x);\n assertEquals(NaN, x %= (-2852766277));\n assertEquals(0, x <<= (-1482859558));\n assertEquals(0, x >>= x);\n assertEquals(-1196775786, x += (tmp = -1196775786, tmp));\n assertEquals(-68176201, x |= ((tmp = 2336517643, tmp)+x));\n assertEquals(0, x ^= x);\n assertEquals(0, x <<= x);\n assertEquals(0, x >>= (2969141362.868086));\n assertEquals(NaN, x %= x);\n assertEquals(0, x >>= ((x-((((tmp = -905994835, tmp)|(tmp = 2850569869.33876, tmp))<<((-2405056608.27147)>>(tmp = 1280271785, tmp)))&(-1942926558)))*(tmp = 707499803.177796, tmp)));\n assertEquals(0, x &= ((-697565829.8780258)+((2978584888.549406)%x)));\n assertEquals(0, x >>= (748642824.4181392));\n assertEquals(0, x += x);\n assertEquals(0, x >>>= (-1701028721));\n assertEquals(92042539, x -= ((-92042539)|(x*(x%(-293705541.00228095)))));\n assertEquals(0, x %= x);\n assertEquals(0, x >>= x);\n assertEquals(0, x %= (-2278672472.458228));\n assertEquals(0, x %= (((-2374117528.0359464)/((tmp = -2809986062, tmp)|(tmp = 895734980, tmp)))&(tmp = 1564711307.41494, tmp)));\n assertEquals(0, x >>>= x);\n assertEquals(0, x += x);\n assertEquals(-0, x /= ((tmp = -2749286790.3666043, tmp)<<(x^(-2966741582.324482))));\n assertEquals(0, x *= x);\n assertEquals(0, x >>>= x);\n assertEquals(-1882562314, x ^= (2412404982.782115));\n assertEquals(-806620, x %= (((tmp = 1527219936.5232096, tmp)*(-1139841417))>>>(tmp = 201632907.3236668, tmp)));\n assertEquals(-1613240, x += x);\n assertEquals(-1664766177387640, x *= (1031939561));\n assertEquals(-9.478083550117849e+23, x *= (tmp = 569334221.1571662, tmp));\n assertEquals(-8.462574598319509e+21, x /= ((x-(tmp = -2985531211.114498, tmp))>>(tmp = 174615992.91117632, tmp)));\n assertEquals(1638924288, x <<= (((((x>>((-1823401733.4788911)+((tmp = 1362371590, tmp)>>>x)))^(tmp = -56634380, tmp))/(tmp = 2387980757.1540084, tmp))%((((tmp = -3175469977, tmp)^(tmp = -1816794042, tmp))+(232726694))*(tmp = 822706176, tmp)))/(tmp = 1466729893.836311, tmp)));\n assertEquals(2686072821796307000, x *= x);\n assertEquals(-1007977445.9812208, x /= (-2664814408.800125));\n assertEquals(-1007977445, x &= x);\n assertEquals(322314656346249100, x *= (tmp = -319763758.54942775, tmp));\n assertEquals(197436885.26815608, x /= (tmp = 1632494637, tmp));\n assertEquals(-67191339, x |= ((-399580815.1746769)/((1335558363)/(tmp = 224694526, tmp))));\n assertEquals(1229588737, x &= (tmp = 1296763683.5732255, tmp));\n assertEquals(1229588737, x -= ((((1171546503)|((tmp = -2701891308, tmp)%(-2155432197.022206)))/(-306122816.85682726))>>x));\n assertEquals(4162606632, x -= (tmp = -2933017895, tmp));\n assertEquals(1.6487311395551163, x /= (2524733434.1748486));\n assertEquals(-1929308648.9913044, x += (-1929308650.6400356));\n assertEquals(-3858617297.982609, x += x);\n assertEquals(788529152, x <<= (x^(1401824663)));\n assertEquals(6160384, x >>>= ((((((x>>>x)>>((((x*(tmp = -1958877151, tmp))>>>(1310891043))-(tmp = 564909413.9962088, tmp))%(-175978438)))%x)|((tmp = -1193552419.7837512, tmp)*(tmp = 1508330424.9068346, tmp)))|(1428324616.3303494))-((1828673751)/(tmp = 1281364779, tmp))));\n assertEquals(6160384, x |= x);\n assertEquals(1, x /= x);\n assertEquals(1, x &= (tmp = -855689741, tmp));\n assertEquals(0, x >>>= x);\n assertEquals(-1088569655.3528988, x -= (tmp = 1088569655.3528988, tmp));\n assertEquals(-1088569655, x >>= ((tmp = 2429646226.626727, tmp)<<((-1539293782.4487276)>>(x^((tmp = 1140855945.537702, tmp)+x)))));\n assertEquals(-311, x %= ((x/x)<<x));\n assertEquals(1.2007722007722008, x /= (x|(tmp = 448796341.87655175, tmp)));\n assertEquals(3, x |= (x+x));\n assertEquals(-9.32416092168023e-10, x /= (-3217447688));\n assertEquals(0, x >>= (615837464.0921166));\n assertEquals(0, x >>>= (tmp = -2993750670.683118, tmp));\n assertEquals(0, x >>>= (x%x));\n assertEquals(1610612736, x ^= ((-1322905256.6770213)<<(-2567950598)));\n assertEquals(1693676493, x ^= (83063757.63660407));\n assertEquals(-758030371, x ^= (tmp = -1239274480, tmp));\n assertEquals(-758030371, x %= (tmp = 1961339006, tmp));\n assertEquals(-1509754528, x ^= (tmp = 1960027837, tmp));\n assertEquals(-1509754528, x <<= x);\n assertEquals(-1509754528, x -= (((tmp = -50690205.33559728, tmp)/((tmp = -1364565380, tmp)<<(tmp = 2585052504, tmp)))<<(tmp = -2356889596, tmp)));\n assertEquals(1, x >>>= (-3204164321));\n assertEquals(1, x *= x);\n assertEquals(1114370230.591965, x *= ((tmp = 1114370229.591965, tmp)+x));\n assertEquals(-4.886305275432552, x /= ((-228059887.33344483)%(2841553631.3685856)));\n assertEquals(2.358309397373389e-9, x /= (((x*(tmp = 203428818.08174622, tmp))&(x-(((510438355)*x)+x)))+x));\n assertEquals(0, x >>>= ((tmp = 1444810010, tmp)&(tmp = -3135701995.2235208, tmp)));\n assertEquals(0, x /= (1865982928.6819582));\n assertEquals(0, x *= x);\n assertEquals(2078726016.3772051, x -= (tmp = -2078726016.3772051, tmp));\n assertEquals(1580337898, x ^= ((tmp = -2714629398.447015, tmp)^x));\n assertEquals(1268363034, x -= ((x+((tmp = 1144068248.3834887, tmp)&(-954104940.155973)))<<(tmp = 1270573731.7828264, tmp)));\n assertEquals(1744830464, x <<= (((1444869551.7830744)>>>((((x+(tmp = -904688528, tmp))<<x)-((tmp = 121151912.85873199, tmp)/(tmp = -2414150217.66479, tmp)))|(((-472906698)|(3215236833.8417764))+(907737193.9056952))))-((x&(-732223723))|(-221800427.7392578))));\n assertEquals(717338523283226600, x *= (x^(tmp = -2407450097.0604715, tmp)));\n assertEquals(402653184, x >>= ((-3191405201.168252)*((tmp = -1941299639.695196, tmp)|(((x>>(((3215741220)>>>x)/(x+x)))^(((tmp = -2144862025.9842231, tmp)|((tmp = -1966913385, tmp)&x))%x))*((tmp = -1124749626.6112225, tmp)/(tmp = 837842574, tmp))))));\n assertEquals(402653184, x &= ((x|x)>>x));\n assertEquals(134217728, x &= ((2720231644.3849487)*x));\n assertEquals(134217726.75839183, x -= ((2438054684.738043)/(((((-984359711)*(x|((tmp = 177559682, tmp)^x)))/(-1253443505))/((2727868438.416792)*(x+((x<<(((tmp = 3023774345, tmp)&(-705699616.0846889))/x))<<x))))^(1963626488.548761))));\n assertEquals(1, x /= x);\n assertEquals(245781494, x += ((tmp = 2551445099, tmp)^(2528486814)));\n assertEquals(-1474427807, x ^= (-1497868393.342241));\n assertEquals(-1057271682, x += ((((((x>>x)%(-1556081693))|(x/(((1166243186.6325684)-(((tmp = 2870118257.1019487, tmp)/(x+(-69909960)))^(2270610694.671496)))/((1463187204.5849519)-x))))-x)-(x<<(-3077313003)))%x));\n assertEquals(-1065725846, x &= ((tmp = -1808223767, tmp)|(-481628214.3871765)));\n assertEquals(-1065725846, x ^= (x&(((tmp = -1785170598, tmp)-(tmp = -2525350446.346484, tmp))/((((((-1783948056)^(tmp = 3027265884.41588, tmp))|((((tmp = 2195362566.2237773, tmp)<<(-2919444619))<<((tmp = -2507253075.2897573, tmp)^(x^((tmp = 1067516137, tmp)+((667737752)^(x*(tmp = -1187604212.7293758, tmp)))))))%(-617406719.5140038)))*(tmp = 511060465.6632478, tmp))*((tmp = 2580189800.752836, tmp)|((((tmp = 2357895660, tmp)%((-814381220)*(x-((x>>>(((x<<x)<<(tmp = 1919573020, tmp))-x))>>>((-2756011312.136148)>>(tmp = -1603458856, tmp))))))/((tmp = -1609199312, tmp)&(-3127643445)))%x)))<<(-2261731798)))));\n assertEquals(1.6020307924030301, x /= (tmp = -665234308.2628405, tmp));\n assertEquals(-1120020556.697667, x *= (tmp = -699125486.2321637, tmp));\n assertEquals(-215875188, x -= (((((tmp = -1307845034, tmp)>>>((((-2820720421)^x)-(((x<<x)|(tmp = -3042092997.57406, tmp))+(((-1294857544)+((tmp = -668029108.1487186, tmp)>>(x<<x)))^(912144065.5274727))))^(389671596.2983854)))|(-2774264897.146559))%(x-((tmp = 1378085269, tmp)^x)))+((-1659377450.5247462)&(((1613063452.834885)>>>((-344896580.0694165)>>>((-13450558)+x)))^x))));\n assertEquals(1, x /= x);\n assertEquals(0, x >>>= (2355750790));\n assertEquals(1969435421.4409347, x += (1969435421.4409347));\n assertEquals(0, x -= x);\n assertEquals(0, x >>>= (((x*((-1022802960.6953495)<<(tmp = -2848428731.8339424, tmp)))^(-1630921485))%(1532937011)));\n assertEquals(0, x <<= ((x+((x^(x^(tmp = 2017651860, tmp)))&(((x<<(((tmp = -1913317290.8189478, tmp)|(x-((((x%((tmp = -3035245210, tmp)+(-2270863807)))>>>((-2351852712)*(x^(-2422943296.0239563))))&((((-1578312517)%x)*x)*(-65592270.28452802)))>>>(tmp = 1104329727.2094703, tmp))))-(tmp = -1431159990.3340137, tmp)))&x)|((tmp = -2589292678.801344, tmp)&(x+((((tmp = -2557773457.456996, tmp)>>(451910805.309445))-x)>>(((tmp = -1937832765.7654495, tmp)^x)%x)))))))%x));\n assertEquals(0, x %= (tmp = -626944459, tmp));\n assertEquals(-732310021, x |= (tmp = -732310021, tmp));\n assertEquals(-732310021, x |= x);\n assertEquals(671352839, x ^= (x-((-3087309090.7153115)|x)));\n assertEquals(134479872, x &= (tmp = 2357183984, tmp));\n assertEquals(18084835973136384, x *= x);\n assertEquals(0, x <<= ((1040482277)-(tmp = -357113781.82650447, tmp)));\n assertEquals(74957, x |= ((((tmp = -70789345.7489841, tmp)%(tmp = 1415750131, tmp))&x)|((307027314)>>(2284275468))));\n assertEquals(9, x >>>= x);\n assertEquals(0, x &= (x&((x*((x*(x%x))%(x>>x)))/x)));\n assertEquals(-1872875060, x |= (2422092236.6850452));\n assertEquals(9, x >>>= (-382763684));\n assertEquals(4608, x <<= x);\n assertEquals(40.480234260614935, x /= (((((((tmp = 814638767.5666755, tmp)&((tmp = 2081507162, tmp)^(x>>>(1460148331.2229118))))&(tmp = 1187669197.7318723, tmp))<<(412000677.93339765))^((tmp = 556111951, tmp)>>(tmp = -2232569601.292395, tmp)))&(-3006386864))/x));\n assertEquals(32, x &= (-3053435209.383913));\n assertEquals(418357217, x ^= (418357185));\n assertEquals(204275, x >>= ((-1188650337.9010527)^((51494580)%(-2544545273))));\n assertEquals(982392804, x += (((x+(((tmp = -982596937.9757051, tmp)+x)%(-2298479347)))^((((tmp = 1610297674.0732534, tmp)>>>x)*(((x>>(-2746780903.08599))&(-2376190704.247188))^(((20545353)/(tmp = 1468302977, tmp))-(x<<x))))>>(((-1434332028.0447056)/((tmp = 1983686888, tmp)&((tmp = 2324500847, tmp)%(394330230.6163173))))%(((-1129687479.2158055)+((-3127595161)*((-3066570223)&((tmp = 3192134577.4963055, tmp)/(-2697915283.3233275)))))+(-1112243977.5306559)))))|(x&(-2622725228))));\n assertEquals(-2735750653096133600, x *= (-2784782870.9218984));\n assertEquals(-1876329472, x |= ((((((2752866171)<<(-1681590319))/x)>>((tmp = 1451415208, tmp)>>>(1126858636.6634417)))+(((tmp = 2165569430.4844217, tmp)/x)^(((tmp = -1675421843.4364457, tmp)-(-2187743422.2866993))|x)))*x));\n assertEquals(3520612287495799000, x *= x);\n assertEquals(-200278016, x |= ((((-2379590931)%((((-1558827450.833285)&x)>>(-665140792))-((tmp = -445783631.05567217, tmp)+(tmp = 93938389.53113222, tmp))))/(3103476273.734701))^x));\n assertEquals(-9178285062592.75, x *= ((2042671875.7211144)%(((tmp = 589269308.0452716, tmp)/x)<<(-130695915.9934752))));\n assertEquals(60048960, x |= (x<<x));\n assertEquals(60048960, x <<= ((((((tmp = -2793966650, tmp)/(-2882180652))&(((x<<((tmp = -384468710, tmp)+(2236162820.9930468)))>>>((((969371919)>>((tmp = -3153268403.2565875, tmp)-((((573811084)/x)^(tmp = -968372697.4844134, tmp))>>>(((-3096129189)>>x)/(tmp = 830228804.6249363, tmp)))))<<(((1243972633.3592157)|x)&((-1687610429)&(tmp = -1945063977.458529, tmp))))<<(((tmp = -217456781.37068868, tmp)-(400259171.68077815))^x)))>>>x))%(((2728450651.300167)/(((-2713666705.089135)%(tmp = 740472459, tmp))^x))|x))^x)*(-2463032364)));\n assertEquals(60048960, x %= (tmp = -442107222.9513445, tmp));\n assertEquals(-1573781504, x <<= (960581227));\n assertEquals(1297, x >>>= (tmp = -1692919563, tmp));\n assertEquals(1297, x &= x);\n assertEquals(-3113308397155.233, x *= (tmp = -2400391979.3024154, tmp));\n assertEquals(-3115513013486.233, x -= (2204616331));\n assertEquals(-3113809649082.233, x -= (-1703364404));\n assertEquals(0, x >>>= (((-1181206665)-(550946816.586771))|(tmp = -2346300456, tmp)));\n assertEquals(0, x %= (tmp = 1649529739.2785435, tmp));\n assertEquals(0, x ^= ((tmp = -2452761827.2870226, tmp)%(((1090281070.5550141)/(tmp = 992149154.6500508, tmp))*(x<<((((((x>>>x)|((tmp = -2410892363, tmp)%(tmp = 2585150431.0231533, tmp)))/x)*(tmp = 1541294271, tmp))+x)&((97566561.77126992)&((((-640933510.1287451)&(((((x>>>((-1821077041)<<((tmp = -1138504062.093695, tmp)-(tmp = -181292160, tmp))))%x)-(x>>((x&(((tmp = 1067551355, tmp)/(x|(1004837864.8550552)))&(x-(-103229639.25084043))))&((tmp = 2064184671.210937, tmp)+((((tmp = -2245728052, tmp)|(1538407002.8365717))+(x<<((x>>((76549490)/(tmp = 628901902.6084052, tmp)))<<((x<<x)^(-1907669184)))))+(-1409123688))))))>>>((((-1911547456.933543)-((-512313175)+((tmp = -2620903017, tmp)^(tmp = 2148757592.244808, tmp))))<<((-1740876865)>>>x))+((tmp = 691314720.9488736, tmp)<<(614057604.4104803))))|(x^((tmp = -3040687.291528702, tmp)/(x^(((x+(-2899641915))^((tmp = -1220211746, tmp)/x))%x))))))^(tmp = 119850608, tmp))%(2091975696))))))));\n assertEquals(291273239, x -= (tmp = -291273239, tmp));\n assertEquals(2206394018, x += (1915120779));\n assertEquals(235641480, x <<= (x&(x&(-1810963865.1415658))));\n assertEquals(28764, x >>= ((tmp = -1927011875, tmp)^((tmp = -1986461808, tmp)|((-868139264.8399222)*((421956566)%(3068424525))))));\n assertEquals(-99780626900900, x *= ((tmp = -1512869526.3223472, tmp)+(tmp = -1956071751, tmp)));\n assertEquals(51218520, x &= (((-2353401311)>>>x)-(2216842509)));\n assertEquals(51218520, x >>>= ((tmp = -1534539302.6990812, tmp)<<x));\n assertEquals(-2147483648, x <<= (-292608644));\n assertEquals(-2147483648, x |= ((((((x<<((-2981292735)-x))>>((tmp = 2540545320.96558, tmp)&(tmp = -2343790880, tmp)))>>>((((((x^((-172697043.94487858)/((2627260337)>>(2879112814.1247935))))&(tmp = 3000943191, tmp))<<(tmp = 1094830905, tmp))-x)>>>x)>>((((tmp = 3095796200, tmp)^(x|(tmp = 1460377694, tmp)))<<(x^(tmp = -357546193, tmp)))/((2729539495)>>x))))%(tmp = 268894171.74961245, tmp))|(x>>(tmp = 2735650924, tmp)))/(-2197885357.09768)));\n assertEquals(-2147483648, x |= x);\n assertEquals(-1967162776824578000, x *= (tmp = 916031551, tmp));\n assertEquals(-2147483648, x &= x);\n assertEquals(-457743917756973060, x *= (tmp = 213153622, tmp));\n assertEquals(0, x >>>= ((((tmp = 2930076928.480559, tmp)+(x^x))<<(tmp = -1349755597.1280541, tmp))|(x+(2865632849))));\n assertEquals(0, x <<= ((x>>x)-(x>>(-2629977861))));\n assertEquals(0, x <<= x);\n assertEquals(NaN, x /= x);\n assertEquals(0, x |= x);\n assertEquals(0, x >>>= x);\n assertEquals(749327478, x |= ((tmp = 749327478, tmp)^(x>>(tmp = 881107862, tmp))));\n assertEquals(1897869364, x += (1148541886));\n assertEquals(463347, x >>>= (tmp = -726431220, tmp));\n assertEquals(-395990542, x += (-396453889));\n assertEquals(-2824792585.1675367, x -= (2428802043.1675367));\n assertEquals(-2147483648, x <<= (tmp = -1420072385.9175675, tmp));\n assertEquals(8388608, x >>>= (-2211390680.488455));\n assertEquals(8388608, x >>= (((x/(x|(((x^(((tmp = -2175960170.8055067, tmp)|((tmp = -1964957385.9669886, tmp)/(tmp = -475033330, tmp)))&((x|((tmp = 1386597019.2014387, tmp)>>((tmp = -2406589229.8801174, tmp)+x)))<<(tmp = -844032843.8415492, tmp))))>>(x^x))|x)))-((x&((tmp = 1858138856, tmp)*(-3156357504)))%x))<<(((2046448340)+x)/(-2645926916))));\n assertEquals(8359470765396279, x *= ((tmp = 871437183.7888144, tmp)-(-125089387.17460155)));\n assertEquals(0, x ^= x);\n assertEquals(-303039014, x += ((tmp = -2475713214, tmp)|(-372871718.2343409)));\n assertEquals(2655126577, x -= (-2958165591));\n assertEquals(1830332793, x ^= (tmp = -212161208, tmp));\n assertEquals(1830332793, x ^= (((2352454407.0126333)<<((((tmp = 3083552367, tmp)/x)-(-1243111279))-((tmp = -1669093976, tmp)%(((-757485455)-(tmp = -116051602, tmp))<<x))))>>(((((-2235071915.9536905)>>(tmp = -1284656185, tmp))-x)>>((-1807028069.7202528)>>>((x%((tmp = -3070857953.311804, tmp)+((tmp = 2759633693.441942, tmp)%((169489938)*(-1582267384)))))<<(x^((tmp = -787578860, tmp)<<x)))))>>((x/(x|(409464362)))-(tmp = -64033017, tmp)))));\n assertEquals(397605933.90319204, x %= (tmp = 716363429.548404, tmp));\n assertEquals(186400, x &= (((x%(-1745754586))>>>x)<<(x&(x&((-2163627752)-((1784050895)+(((-2864781121.899456)>>>x)&x)))))));\n assertEquals(186400, x %= (tmp = -423209729, tmp));\n assertEquals(186400, x <<= ((x<<(x+(1232575114.4447284)))*x));\n assertEquals(1386299, x ^= ((tmp = -1074209615, tmp)>>>(x>>>((tmp = -1456741008.2654872, tmp)>>((1724761067)>>(-2016103779.9084842))))));\n assertEquals(347302967.20758367, x -= (-345916668.20758367));\n assertEquals(1.9325619389304094, x /= (179711170.03359854));\n assertEquals(-3703324711.628227, x *= (tmp = -1916277371, tmp));\n assertEquals(-920980517031624800, x *= (tmp = 248690187.53332615, tmp));\n assertEquals(0, x &= (((tmp = -2753945953.082594, tmp)*x)-(172907186)));\n assertEquals(-0, x /= (((((-2744323543.187253)>>((tmp = 2663112845, tmp)>>(((-121791600)+(x^x))*(2758944252.4214177))))|x)/(tmp = -2746716631.6805267, tmp))-x));\n assertEquals(0, x ^= ((tmp = 983113117, tmp)&((2638307333)+((((tmp = 3076361304.56189, tmp)<<(-2663410588.5895214))%((-1109962112)-(tmp = -2381021732, tmp)))%((tmp = 410559095, tmp)&x)))));\n assertEquals(0, x <<= (tmp = 1510895336.5111506, tmp));\n assertEquals(0, x <<= (tmp = -1688348296.2730422, tmp));\n assertEquals(2269471424, x -= (-2269471424));\n assertEquals(-2022580224, x ^= (x%((tmp = 160999480.21415842, tmp)&x)));\n assertEquals(-2077171712, x &= (tmp = 3032415014.3817654, tmp));\n assertEquals(270727, x >>>= (2973489165.1553965));\n assertEquals(270727, x |= x);\n assertEquals(-1895894537, x |= ((tmp = -1895903118.129186, tmp)|x));\n assertEquals(-1895894537, x -= ((((((((3143124509)>>>(-2866190144.8724117))*((x>>((961021882)*(tmp = 2363055833.8634424, tmp)))/((2032785518)+((2713643671.3420825)>>((-447782997.0173557)*((tmp = 1174918125.3178625, tmp)*((((tmp = -541539365.548115, tmp)%(-359633101))|(1765169562.2880063))+(tmp = -2512371966.374508, tmp))))))))/x)>>(x*((((-847238927.6399388)&(857288850))%(-2427015402))^((2221426567)%(x+x)))))>>>x)<<((tmp = 2009453564.2808268, tmp)>>((2924411494)<<(x>>(tmp = -1240031020.8711805, tmp)))))%(tmp = 3118159353, tmp)));\n assertEquals(0, x ^= x);\n assertEquals(0, x %= (-30151583));\n assertEquals(-1035186736, x ^= ((tmp = -517593368, tmp)<<(tmp = 3216155585, tmp)));\n assertEquals(49740, x >>>= x);\n assertEquals(49740, x %= (640223506));\n assertEquals(388, x >>>= ((x>>(tmp = 3161620923.50496, tmp))+(2605183207)));\n assertEquals(776, x += x);\n assertEquals(-97905, x ^= ((((((tmp = 145447047.8783008, tmp)^(((x>>>(tmp = 3014858214.2409887, tmp))>>>(629911626.132971))>>(((x+((369309637.229408)-x))<<(-2661038814.9204755))*(x+(x%(3025191323.4780884))))))+x)*(-482550691))|(-632782135))/x));\n assertEquals(-97905, x %= ((((-492914681)-((-2508632959.269368)&(tmp = 1209318291, tmp)))>>(-723512989.459533))>>>(((-528429623.985692)&(x^(tmp = -925044503, tmp)))-(-1696531234))));\n assertEquals(9585389025, x *= x);\n assertEquals(-715425728, x <<= ((583763091)<<(-1223615295)));\n assertEquals(-520093696, x <<= ((tmp = -1891357699.671592, tmp)*(((tmp = 3206095739.5163193, tmp)+(-2908596651.798733))>>>((tmp = -2820415686, tmp)>>(x|((((tmp = -566367675.6250327, tmp)*(-959117054))>>((((-187457085.89686918)*x)*(tmp = -2394776877.5373516, tmp))>>>x))|(((tmp = 80478970.46290505, tmp)<<(tmp = 2173570349.493097, tmp))-(x/((-2896765964)-((x/((tmp = 198741535.7034216, tmp)%(436741457)))%(tmp = 2936044280.0587225, tmp)))))))))));\n assertEquals(-2520.5909527086624, x /= ((211290893.06029093)>>(663265322)));\n assertEquals(-2520.5909527086624, x %= (x^((1057915688)<<(tmp = 1914820571.1142511, tmp))));\n assertEquals(1, x >>>= (((894963408.7746166)+(tmp = -2888351666, tmp))|x));\n assertEquals(-1989841636629996300, x += ((1424670316.224575)*((-2144149843.0876865)|((((421479301.0983993)|((3082651798)^(tmp = -271906497, tmp)))>>x)+((tmp = -178372083, tmp)%x)))));\n assertEquals(17935384255.088326, x /= (((((((tmp = 1168194849.2361898, tmp)>>>(-107316520.53815603))>>>(x^(((x%((x>>>(((-2456622387)/x)&((2124689803)|(((-1130151701)^(2796315158))>>x))))-((-884686033.5491502)>>>((-2371185318.5358763)&x))))+(tmp = 558422989, tmp))|((tmp = -420359120.0596726, tmp)/((-1820568437.0587764)&(2298602280.266465))))))>>(x-((tmp = -1164568978, tmp)^x)))^x)-x)+x));\n assertEquals(134233150, x &= ((x>>(((tmp = 98498118.13041973, tmp)-(804574397))/(tmp = -1564490985.7904541, tmp)))+x));\n assertEquals(4, x >>= (449610809));\n assertEquals(1912543790, x |= (1912543790));\n assertEquals(2487274263, x += (tmp = 574730473, tmp));\n assertEquals(-2140759118, x ^= (tmp = 338055333.9701035, tmp));\n assertEquals(311607367, x += (2452366485));\n assertEquals(9509, x >>= (372113647.84365284));\n assertEquals(-2001075684.1562128, x += (-2001085193.1562128));\n assertEquals(-638703280, x ^= (((tmp = 1096152237, tmp)&x)|((2707404245.0966487)-(((tmp = 1550233654.9691348, tmp)+(tmp = 2008619647, tmp))&((tmp = -2653266325, tmp)+(tmp = -280936332, tmp))))));\n assertEquals(-101811850, x |= (-2250090202));\n assertEquals(-13, x >>= ((-561312810.0218933)|(tmp = 79838949.86521482, tmp)));\n assertEquals(-13, x >>= ((tmp = -936543584, tmp)/(1180727664.1746705)));\n assertEquals(-1547, x *= (((tmp = 1005197689, tmp)>>>x)>>>(tmp = 34607588, tmp)));\n assertEquals(2393209, x *= x);\n assertEquals(2393209, x |= x);\n assertEquals(0, x >>= (-2691279235.1215696));\n assertEquals(0, x *= (((896175510.4920144)*((((tmp = 1770236555.7788959, tmp)%(537168585.7310632))/x)&(tmp = 1094337576, tmp)))&(((x-x)-x)>>x)));\n assertEquals(-1922620126, x ^= (-1922620126));\n assertEquals(3.43481396325761, x /= (tmp = -559745053.6088333, tmp));\n assertEquals(0, x >>= x);\n assertEquals(0, x >>>= (tmp = 2106956255.6602135, tmp));\n assertEquals(-1339003770, x ^= ((tmp = 2955963526.960022, tmp)+x));\n assertEquals(-0, x *= ((((tmp = 368669994, tmp)>>>(x*x))<<(tmp = 2355889375, tmp))&(tmp = -2267550563.9174895, tmp)));\n assertEquals(0, x >>= (753848520.8946902));\n assertEquals(0, x >>>= x);\n assertEquals(0, x %= ((tmp = -2872753234.2257266, tmp)|x));\n assertEquals(NaN, x %= (x>>>(tmp = 890474186.0898918, tmp)));\n assertEquals(NaN, x %= ((tmp = 1341133992.284471, tmp)&(tmp = -2979219283.794898, tmp)));\n assertEquals(NaN, x += (-2865467651.1743298));\n assertEquals(NaN, x += ((-1424445677)%(x^(tmp = 1150366884, tmp))));\n assertEquals(0, x &= (x+((tmp = 1499426534, tmp)+x)));\n assertEquals(0, x |= (((((tmp = -2413914642, tmp)<<((x>>>x)^(1218748804)))+((((-1085643932.2642736)-(-1199134221.533854))>>(tmp = 2148778719, tmp))-((tmp = 1589158782.0040946, tmp)/(tmp = -2485474016.1575155, tmp))))>>>(x>>x))/(2230919719)));\n assertEquals(0, x %= ((tmp = -2576387170.517563, tmp)>>>((tmp = -2362334915.919525, tmp)>>>(((3096453582)-(700067891.4834484))^(2396394772.9253683)))));\n assertEquals(-1798103432, x ^= (((((tmp = 2396144191, tmp)*(x>>>(1512158325)))&(((-1256228298.5444434)&(((-2963136043.434966)&((tmp = 2472984854, tmp)+(tmp = -454900927, tmp)))%(tmp = 484255852.65332687, tmp)))>>((x%x)-x)))&(tmp = 929723984, tmp))^(tmp = -1798103432.5838807, tmp)));\n assertEquals(-2137913344, x &= ((((x|(-2970116473))&(((x/x)/((tmp = 2853070005, tmp)>>>x))%(((tmp = -3123344846, tmp)/((2224296621.6742916)-(tmp = -2246403296.455411, tmp)))+((x&(((x^(x*(2829687641)))+x)&(tmp = 988992521, tmp)))^x))))<<((((-820608336)^(tmp = 2851897085, tmp))>>(tmp = -402427624, tmp))>>>x))-(((x*(((-2287402266.4821453)%(tmp = -520664172.1831205, tmp))^(x/(1875488837))))<<(tmp = 402393637, tmp))&(tmp = 1576638746.3047547, tmp))));\n assertEquals(-2827557853031924000, x *= (tmp = 1322578326.6507945, tmp));\n assertEquals(6.424459501778244e+27, x *= (tmp = -2272087729.3065624, tmp));\n assertEquals(-1586887483, x |= (-1586887483));\n assertEquals(-567868980691736100, x *= (tmp = 357850816, tmp));\n assertEquals(1489101591, x ^= (x%(x|(421921075))));\n assertEquals(-801213804822328000, x *= (x|(-672326904.6888077)));\n assertEquals(612257233.6612054, x /= (((tmp = -350127617, tmp)>>>(-1140467595.9752212))<<((x^x)+(-3117914887))));\n assertEquals(19097.231243331422, x /= ((x^(tmp = -570012517, tmp))>>>x));\n assertEquals(0, x >>= ((x%(((-2347648358)%((x-(tmp = -456496327, tmp))|(x^(-1977407615.4582832))))<<(x/(tmp = -2021394626.214082, tmp))))%(tmp = -949323000.2442119, tmp)));\n assertEquals(0, x <<= x);\n assertEquals(NaN, x %= (x^(x>>(((tmp = 597147546.7701412, tmp)&(((((-972400689.6267757)|(tmp = -2390675341.6367044, tmp))|(tmp = 1890069123.9831812, tmp))<<(((1606974563)-(tmp = -2211617255.8450356, tmp))&((((x+((2433096953)&(-2527357746.681596)))*(tmp = -313956807.55609417, tmp))|((tmp = -2146031047.968496, tmp)/(tmp = 2851650714.68952, tmp)))>>(((tmp = 2630692376.6265225, tmp)-(tmp = -3162222598, tmp))>>((tmp = 1915552466, tmp)*(x>>>(-2413248225.7536864)))))))&(x%((((1218471556)|x)+(tmp = -849693122.6355379, tmp))+x))))>>>(x/((tmp = 689889363, tmp)/x))))));\n assertEquals(0, x >>>= (45649573.23297));\n assertEquals(0, x >>>= (tmp = 1084439432.771266, tmp));\n assertEquals(NaN, x /= x);\n assertEquals(NaN, x *= (tmp = 1642750077, tmp));\n assertEquals(0, x >>>= (tmp = -1944001182.0778434, tmp));\n assertEquals(1682573000, x |= (tmp = -2612394296.2858696, tmp));\n assertEquals(3041823595, x -= (((tmp = 720576773, tmp)|(x^(-1068335724.2253149)))>>(x*(-2501017061))));\n assertEquals(6083647190, x += x);\n assertEquals(-6536258988089986000, x *= ((tmp = 632312939.6147232, tmp)|((-1621821634)+(((tmp = -2281369913.562131, tmp)&((tmp = -381226774, tmp)|x))&(664399051)))));\n assertEquals(4.272268155938712e+37, x *= x);\n assertEquals(733271152, x %= (-1345127171));\n assertEquals(847089925, x ^= (tmp = 432620917.57699084, tmp));\n assertEquals(1337073824, x <<= x);\n assertEquals(-25810602, x ^= (tmp = 2982414838, tmp));\n assertEquals(-25282209, x |= ((tmp = -2927596922, tmp)>>>(-2404046645.01413)));\n assertEquals(639190091919681, x *= x);\n assertEquals(173568320, x &= ((((tmp = -718515534.4119437, tmp)&(tmp = 2989263401, tmp))<<x)|((tmp = 537073030.5331153, tmp)-(tmp = 883595389.314624, tmp))));\n assertEquals(0, x -= x);\n assertEquals(0, x >>>= (tmp = -1844717424.917882, tmp));\n assertEquals(0, x >>= (tmp = -462881544.2225325, tmp));\n assertEquals(0, x >>= x);\n assertEquals(-1868450038, x ^= (2426517258.6111603));\n assertEquals(1, x /= x);\n assertEquals(1175936039.4202638, x += (tmp = 1175936038.4202638, tmp));\n assertEquals(-127916015, x ^= ((x/(1841969600.3012052))-(tmp = 1099467723, tmp)));\n assertEquals(395713785658171900, x *= (-3093543726));\n assertEquals(395713787128560900, x += (((((-717204758)*(tmp = -588182129.6898501, tmp))-x)+(tmp = 20638023, tmp))^x));\n assertEquals(-962609355, x |= ((x^(-3118556619.912983))<<((tmp = 876126864, tmp)&x)));\n assertEquals(-962609355, x %= (tmp = -2079049990, tmp));\n}", "function add (x, y) {\n while(y) {\n x^=y, y=(y&x^y)<<1; \n } \n return x;\n}", "function thumb2_logic_op(/* int */ op)\n{\n return (op < 8);\n}", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }" ]
[ "0.6431488", "0.6282463", "0.62678695", "0.62574637", "0.6253815", "0.6229634", "0.6229469", "0.6180219", "0.61788404", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.616927", "0.61689585", "0.6154644", "0.6128481", "0.6128481", "0.6107816", "0.6107816", "0.6107816", "0.6107816", "0.6107816", "0.6107816", "0.6107816", "0.61037534", "0.61037534", "0.6096426", "0.6096426", "0.60933554", "0.6093354", "0.60921776", "0.6043392", "0.6043392", "0.60386163", "0.60131586", "0.600595", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912", "0.5990912" ]
0.0
-1
kind may be `const` or `let` Both are experimental and not in the specification yet. see and
function parseConstLetDeclaration(kind) { var declarations, startToken; startToken = lookahead; expectKeyword(kind); declarations = parseVariableDeclarationList(kind); consumeSemicolon(); return delegate.markEnd(delegate.createVariableDeclaration(declarations, kind), startToken); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseConstLetDeclaration(kind) {\n var declarations, marker = markerCreate();\n \n expectKeyword(kind);\n \n declarations = parseVariableDeclarationList(kind);\n \n consumeSemicolon();\n \n return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));\n }", "function parseConstLetDeclaration(kind) {\n var declarations;\n\n delegate.markStart();\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return delegate.markEnd(delegate.createVariableDeclaration(declarations, kind));\n }", "function parseConstLetDeclaration(kind)\n\t\t{\n\t\t\tvar declarations, node = new Node();\n\t\t\texpectKeyword(kind);\n\t\t\tdeclarations = parseVariableDeclarationList(kind);\n\t\t\tconsumeSemicolon();\n\t\t\treturn node.finishVariableDeclaration(declarations, kind);\n\t\t}", "function parseConstLetDeclaration(kind) {\n var declarations, node = new Node();\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return node.finishVariableDeclaration(declarations, kind);\n }", "function parseConstLetDeclaration(kind) {\n var declarations, marker = markerCreate();\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));\n }", "function parseConstLetDeclaration(kind) {\n var declarations, marker = markerCreate();\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));\n }", "function parseConstLetDeclaration(kind) {\n var declarations, marker = markerCreate();\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));\n }", "function parseConstLetDeclaration(kind) {\n var declarations, marker = markerCreate();\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));\n }", "function parseConstLetDeclaration(kind) {\n var declarations, marker = markerCreate();\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));\n }", "function parseConstLetDeclaration(kind) {\n var declarations, marker = markerCreate();\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));\n }", "function parseConstLetDeclaration(kind) {\n var declarations;\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return delegate.createVariableDeclaration(declarations, kind);\n }", "function parseConstLetDeclaration(kind) {\n var declarations;\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return delegate.createVariableDeclaration(declarations, kind);\n }", "function parseConstLetDeclaration(kind) {\n var declarations;\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return delegate.createVariableDeclaration(declarations, kind);\n }", "function parseConstLetDeclaration(kind) {\n var declarations;\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return {\n type: Syntax.VariableDeclaration,\n declarations: declarations,\n kind: kind\n };\n }", "function parseConstLetDeclaration(kind) {\n var declarations;\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return {\n type: Syntax.VariableDeclaration,\n declarations: declarations,\n kind: kind\n };\n }", "function parseConstLetDeclaration(kind) {\n var declarations;\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return {\n type: Syntax.VariableDeclaration,\n declarations: declarations,\n kind: kind\n };\n }", "function parseConstLetDeclaration(kind) {\n var declarations;\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return {\n type: Syntax.VariableDeclaration,\n declarations: declarations,\n kind: kind\n };\n }", "function parseConstLetDeclaration(kind) {\n var declarations;\n\n expectKeyword(kind);\n\n declarations = parseVariableDeclarationList(kind);\n\n consumeSemicolon();\n\n return {\n type: Syntax.VariableDeclaration,\n declarations: declarations,\n kind: kind\n };\n }", "function parseConstLetDeclaration(kind){var declarations,marker=markerCreate();expectKeyword(kind);declarations = parseVariableDeclarationList(kind);consumeSemicolon();return markerApply(marker,delegate.createVariableDeclaration(declarations,kind));} // people.mozilla.org/~jorendorff/es6-draft.html", "get kind () {\n\t\treturn this._kind;\n\t}", "function parseConstLetDeclaration(kind) {\n var declarations;\n delegate.markStart();\n expectKeyword(kind);\n declarations = parseVariableDeclarationList(kind);\n consumeSemicolon();\n return delegate.markEnd(delegate.createVariableDeclaration(declarations, kind));\n } // 12.3 Empty Statement", "['@_kind']() {\n super['@_kind']();\n if (this._value.kind) return;\n this._value.kind = 'external';\n }", "function kindToString(kind) {\n return ts.SyntaxKind[kind];\n}", "function getTokenKindDesc(kind) {\n\t return tokenDescription[kind];\n\t}", "get kind() {\n\t\treturn this.__kind;\n\t}", "function getTokenKindDesc(kind) {\n return tokenDescription[kind];\n}", "['@_kind']() {\n super['@_kind']();\n if (this._value.kind) return;\n\n this._value.kind = 'variable';\n }", "function isKind(val, kind){\n\t return kindOf(val) === kind;\n\t }", "function isKind(val, kind){\n\t return kindOf(val) === kind;\n\t }", "function kindMapping(kind) {\n if (kind === \"graph\") kind = \"datapoints\";\n if (kind === \"meter\") kind = \"number\";\n return kind;\n }", "function isKind(val, kind){\n return kindOf_1(val) === kind;\n }", "function isKind(val, kind){\n return kindOf(val) === kind;\n }", "function isKind(val, kind){\n return kindOf(val) === kind;\n }", "function isKind(val, kind){\n return kindOf(val) === kind;\n }", "function parseLexicalBinding(kind, options) {\n var init = null, id, node = new Node(), params = [];\n\n id = parsePattern(params, kind);\n\n // ECMA-262 12.2.1\n if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {\n tolerateError(Messages.StrictVarName);\n }\n\n if (kind === 'const') {\n if (!matchKeyword('in') && !matchContextualKeyword('of')) {\n expect('=');\n init = isolateCoverGrammar(parseAssignmentExpression);\n }\n } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {\n expect('=');\n init = isolateCoverGrammar(parseAssignmentExpression);\n }\n\n return node.finishVariableDeclarator(id, init);\n }", "function parseLexicalBinding(kind, options) {\n\t var init = null, id, node = new Node(), params = [];\n\n\t id = parsePattern(params, kind);\n\n\t // ECMA-262 12.2.1\n\t if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {\n\t tolerateError(Messages.StrictVarName);\n\t }\n\n\t if (kind === 'const') {\n\t if (!matchKeyword('in') && !matchContextualKeyword('of')) {\n\t expect('=');\n\t init = isolateCoverGrammar(parseAssignmentExpression);\n\t }\n\t } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {\n\t expect('=');\n\t init = isolateCoverGrammar(parseAssignmentExpression);\n\t }\n\n\t return node.finishVariableDeclarator(id, init);\n\t }", "function parseLexicalBinding(kind, options) {\n var init = null, id, node = new Node(), params = [];\n\n id = parsePattern(params, kind);\n\n // ECMA-262 12.2.1\n if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {\n tolerateError(Messages.StrictVarName);\n }\n\n if (kind === 'const') {\n if (!matchKeyword('in') && !matchContextualKeyword('of')) {\n expect('=');\n init = isolateCoverGrammar(parseAssignmentExpression);\n }\n } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {\n expect('=');\n init = isolateCoverGrammar(parseAssignmentExpression);\n }\n\n return node.finishVariableDeclarator(id, init);\n }", "function parseLexicalBinding(kind, options) {\n var init = null, id, node = new Node(), params = [];\n\n id = parsePattern(params, kind);\n\n // ECMA-262 12.2.1\n if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {\n tolerateError(Messages.StrictVarName);\n }\n\n if (kind === 'const') {\n if (!matchKeyword('in') && !matchContextualKeyword('of')) {\n expect('=');\n init = isolateCoverGrammar(parseAssignmentExpression);\n }\n } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {\n expect('=');\n init = isolateCoverGrammar(parseAssignmentExpression);\n }\n\n return node.finishVariableDeclarator(id, init);\n }", "function parseLexicalBinding(kind, options) {\n var init = null, id, node = new Node(), params = [];\n\n id = parsePattern(params, kind);\n\n // ECMA-262 12.2.1\n if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {\n tolerateError(Messages.StrictVarName);\n }\n\n if (kind === 'const') {\n if (!matchKeyword('in') && !matchContextualKeyword('of')) {\n expect('=');\n init = isolateCoverGrammar(parseAssignmentExpression);\n }\n } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {\n expect('=');\n init = isolateCoverGrammar(parseAssignmentExpression);\n }\n\n return node.finishVariableDeclarator(id, init);\n }", "function stringifySyntaxKind(kind, typescript) {\n if (kind === typescript.SyntaxKind.NumericLiteral)\n return \"NumericLiteral\";\n return typescript.SyntaxKind[kind];\n}", "function hasKind(node, kind) {\n return node !== undefined && node.kind === kind;\n }", "setDeclarationKind(kind) {\r\n if (this.getDeclarationKind() === kind)\r\n return this;\r\n if (kind === NamespaceDeclarationKind_1.NamespaceDeclarationKind.Global) {\r\n const declarationKindKeyword = this.getDeclarationKindKeyword();\r\n this.getNameNode().replaceWithText(\"global\");\r\n if (declarationKindKeyword != null)\r\n manipulation_1.removeChildren({\r\n children: [declarationKindKeyword],\r\n removeFollowingNewLines: true,\r\n removeFollowingSpaces: true\r\n });\r\n }\r\n else {\r\n const declarationKindKeyword = this.getDeclarationKindKeyword();\r\n if (declarationKindKeyword != null)\r\n declarationKindKeyword.replaceWithText(kind);\r\n else\r\n manipulation_1.insertIntoParentTextRange({\r\n parent: this,\r\n insertPos: this.getNameNode().getStart(),\r\n newText: kind + \" \"\r\n });\r\n }\r\n return this;\r\n }", "_$kind() {\n super._$kind();\n this._value.kind = 'class';\n }", "function isKind(val, kind) {\n return '[object ' + kind + ']' === Object.prototype.toString.call(val);\n }", "function parseVariableIdentifier(kind) {\n\t var token, node = new Node();\n\n\t token = lex();\n\n\t if (token.type === Token.Keyword && token.value === 'yield') {\n\t if (strict) {\n\t tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n\t } if (!state.allowYield) {\n\t throwUnexpectedToken(token);\n\t }\n\t } else if (token.type !== Token.Identifier) {\n\t if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) {\n\t tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n\t } else {\n\t if (strict || token.value !== 'let' || kind !== 'var') {\n\t throwUnexpectedToken(token);\n\t }\n\t }\n\t } else if (state.sourceType === 'module' && token.type === Token.Identifier && token.value === 'await') {\n\t tolerateUnexpectedToken(token);\n\t }\n\n\t return node.finishIdentifier(token.value);\n\t }", "function parseVariableIdentifier(kind) {\n var token, node = new Node();\n\n token = lex();\n\n if (token.type === Token.Keyword && token.value === 'yield') {\n if (strict) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n } if (!state.allowYield) {\n throwUnexpectedToken(token);\n }\n } else if (token.type !== Token.Identifier) {\n if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n } else {\n if (strict || token.value !== 'let' || kind !== 'var') {\n throwUnexpectedToken(token);\n }\n }\n } else if (state.sourceType === 'module' && token.type === Token.Identifier && token.value === 'await') {\n tolerateUnexpectedToken(token);\n }\n\n return node.finishIdentifier(token.value);\n }", "function parseVariableIdentifier(kind) {\n var token, node = new Node();\n\n token = lex();\n\n if (token.type === Token.Keyword && token.value === 'yield') {\n if (strict) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n } if (!state.allowYield) {\n throwUnexpectedToken(token);\n }\n } else if (token.type !== Token.Identifier) {\n if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n } else {\n if (strict || token.value !== 'let' || kind !== 'var') {\n throwUnexpectedToken(token);\n }\n }\n } else if (state.sourceType === 'module' && token.type === Token.Identifier && token.value === 'await') {\n tolerateUnexpectedToken(token);\n }\n\n return node.finishIdentifier(token.value);\n }", "function parseVariableIdentifier(kind) {\n var token, node = new Node();\n\n token = lex();\n\n if (token.type === Token.Keyword && token.value === 'yield') {\n if (strict) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n } if (!state.allowYield) {\n throwUnexpectedToken(token);\n }\n } else if (token.type !== Token.Identifier) {\n if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n } else {\n if (strict || token.value !== 'let' || kind !== 'var') {\n throwUnexpectedToken(token);\n }\n }\n } else if (state.sourceType === 'module' && token.type === Token.Identifier && token.value === 'await') {\n tolerateUnexpectedToken(token);\n }\n\n return node.finishIdentifier(token.value);\n }", "function parseVariableIdentifier(kind) {\n var token, node = new Node();\n\n token = lex();\n\n if (token.type === Token.Keyword && token.value === 'yield') {\n if (strict) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n } if (!state.allowYield) {\n throwUnexpectedToken(token);\n }\n } else if (token.type !== Token.Identifier) {\n if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) {\n tolerateUnexpectedToken(token, Messages.StrictReservedWord);\n } else {\n if (strict || token.value !== 'let' || kind !== 'var') {\n throwUnexpectedToken(token);\n }\n }\n } else if (state.sourceType === 'module' && token.type === Token.Identifier && token.value === 'await') {\n tolerateUnexpectedToken(token);\n }\n\n return node.finishIdentifier(token.value);\n }", "function getTokenKindDesc(kind) {\n return isPunctuatorTokenKind(kind) ? `\"${kind}\"` : kind;\n}", "function convertPostKind(kind) {\n switch (kind) {\n case \"i\":\n return \"idea\"\n case \"qa\":\n return \"q/a\"\n case \"u\":\n return \"update\"\n default:\n return \"something did a big bad\"\n }\n}", "get kind() {\n throw new Error('Sub-class to implement.');\n }", "function parseConstLetDeclaration$976(kind$1400) {\n var declarations$1401;\n expectKeyword$933(kind$1400);\n declarations$1401 = parseVariableDeclarationList$974(kind$1400);\n consumeSemicolon$938();\n return delegate$888.createVariableDeclaration(declarations$1401, kind$1400);\n }", "function getTokenKindDesc(kind) {\n return Object(_lexer_mjs__WEBPACK_IMPORTED_MODULE_7__[\"isPunctuatorTokenKind\"])(kind) ? \"\\\"\".concat(kind, \"\\\"\") : kind;\n}", "function getTokenKindDesc(kind) {\n return Object(_lexer_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isPunctuatorTokenKind\"])(kind) ? \"\\\"\".concat(kind, \"\\\"\") : kind;\n}", "function getTokenKindDesc(kind) {\n return (0,_lexer_mjs__WEBPACK_IMPORTED_MODULE_2__.isPunctuatorTokenKind)(kind) ? \"\\\"\".concat(kind, \"\\\"\") : kind;\n}", "function getTokenKindDesc(kind) {\n return (0,_lexer_mjs__WEBPACK_IMPORTED_MODULE_2__.isPunctuatorTokenKind)(kind) ? \"\\\"\".concat(kind, \"\\\"\") : kind;\n}", "function getTokenKindDesc(kind) {\n return isPunctuatorTokenKind(kind) ? \"\\\"\".concat(kind, \"\\\"\") : kind;\n}", "_$kind() {\n super._$kind();\n this._value.kind = 'member';\n }", "function getTokenKindDesc(kind) {\n return (0, _lexer.isPunctuatorTokenKind)(kind) ? \"\\\"\".concat(kind, \"\\\"\") : kind;\n}", "function getTokenKindDesc(kind) {\n return (0, _lexer.isPunctuatorTokenKind)(kind) ? \"\\\"\".concat(kind, \"\\\"\") : kind;\n}", "function getTokenKindDesc(kind) {\n return (0, _lexer.isPunctuatorTokenKind)(kind) ? \"\\\"\".concat(kind, \"\\\"\") : kind;\n}", "formatKind() {\n throw new Error('not implemented')\n }", "function expect(lexer$$1, kind) {\n var token = lexer$$1.token;\n if (token.kind === kind) {\n lexer$$1.advance();\n return token;\n }\n throw (0, error.syntaxError)(lexer$$1.source, token.start, 'Expected ' + kind + ', found ' + (0, lexer.getTokenDesc)(token));\n}", "function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {\n const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;\n const sourceFile = new ParseSourceFile('', sourceFileName);\n return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));\n }", "function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {\n const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;\n const sourceFile = new ParseSourceFile('', sourceFileName);\n return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));\n}", "function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {\n const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;\n const sourceFile = new ParseSourceFile('', sourceFileName);\n return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));\n}", "function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {\n const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;\n const sourceFile = new ParseSourceFile('', sourceFileName);\n return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));\n}", "function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {\n const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;\n const sourceFile = new ParseSourceFile('', sourceFileName);\n return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));\n}", "expectToken(kind) {\n const token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return token;\n }\n\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`,\n );\n }", "function expect(lexer, kind) {\n\t var token = lexer.token;\n\t if (token.kind === kind) {\n\t lexer.advance();\n\t return token;\n\t }\n\t throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n\t}", "function expect(lexer, kind) {\n\t var token = lexer.token;\n\t if (token.kind === kind) {\n\t lexer.advance();\n\t return token;\n\t }\n\t throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n\t}", "function isSupported(kind) {\n console.log('supported', kind);\n const divNotSupported = document.getElementById('notSupported');\n divNotSupported.classList.toggle('hidden', true);\n butSet.removeAttribute('disabled');\n butClear.removeAttribute('disabled');\n badgeVal.removeAttribute('disabled'); \n}", "function expect(lexer, kind) {\n var token = lexer.token;\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expect(lexer, kind) {\n var token = lexer.token;\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expect(lexer, kind) {\n var token = lexer.token;\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expect(lexer, kind) {\n var token = lexer.token;\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expect(lexer, kind) {\n var token = lexer.token;\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expect(lexer, kind) {\n var token = lexer.token;\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expect(lexer, kind) {\n var token = lexer.token;\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expect(lexer, kind) {\n var token = lexer.token;\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expect(lexer, kind) {\n var token = lexer.token;\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function expect(lexer, kind) {\n var token = lexer.token;\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));\n}", "function isSupported(kind) {\n console.log('supported', kind);\n const divNotSupported = document.getElementById('notSupported');\n divNotSupported.classList.toggle('hidden', true);\n butSet.removeAttribute('disabled');\n butClear.removeAttribute('disabled');\n inputBadgeVal.removeAttribute('disabled'); \n \n butMakeXHR.removeAttribute('disabled');\n}", "function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {\n var sourceFileName = \"in \" + kind + \" \" + typeName + \" in \" + sourceUrl;\n var sourceFile = new ParseSourceFile('', sourceFileName);\n return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));\n}", "function zD(){this.kind=5}", "isMatch(kind, value) {\n return (\n this._kind === kind && (typeof value === 'undefined' || this._value === value)\n );\n }", "function kindToResource(kind, humanize) {\n if (!kind) {\n return \"\";\n }\n var resource = kind;\n if (humanize) {\n var humanizeKind = $filter(\"humanizeKind\");\n resource = humanizeKind(resource);\n }\n resource = String(resource).toLowerCase();\n if (resource === 'endpoints' || resource === 'securitycontextconstraints') {\n // no-op, plural is the singular\n }\n else if (resource[resource.length-1] === 's') {\n resource = resource + 'es';\n }\n else if (resource[resource.length-1] === 'y') {\n resource = resource.substring(0, resource.length-1) + 'ies';\n }\n else {\n resource = resource + 's';\n }\n\n return resource;\n }", "function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {\n var sourceFileName = \"in \".concat(kind, \" \").concat(typeName, \" in \").concat(sourceUrl);\n var sourceFile = new ParseSourceFile('', sourceFileName);\n return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));\n }", "function expect(lexer, kind) {\n var token = lexer.token;\n\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n\n throw (0, _error.syntaxError)(lexer.source, token.start, \"Expected \".concat(kind, \", found \").concat((0, _lexer.getTokenDesc)(token)));\n}", "function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {\n var sourceFileName = \"in \".concat(kind, \" \").concat(typeName, \" in \").concat(sourceUrl);\n var sourceFile = new ParseSourceFile('', sourceFileName);\n return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));\n}", "function key(kind, key) {\n \n}", "function checkKind(expected, actual) {\n if (expected !== actual) {\n throw new Error(\"Expected \" + ts.tokenToString(expected) + \", found instead \" + kindToString(actual));\n }\n}", "expectOptionalToken(kind) {\n const token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return true;\n }\n\n return false;\n }", "function isListTerminator(kind) {\n if (token() === 1 /* EndOfFileToken */) {\n // Being at the end of the file ends all lists.\n return true;\n }\n switch (kind) {\n case 1 /* BlockStatements */:\n case 2 /* SwitchClauses */:\n case 4 /* TypeMembers */:\n case 5 /* ClassMembers */:\n case 6 /* EnumMembers */:\n case 12 /* ObjectLiteralMembers */:\n case 9 /* ObjectBindingElements */:\n case 21 /* ImportOrExportSpecifiers */:\n return token() === 16 /* CloseBraceToken */;\n case 3 /* SwitchClauseStatements */:\n return token() === 16 /* CloseBraceToken */ || token() === 71 /* CaseKeyword */ || token() === 77 /* DefaultKeyword */;\n case 7 /* HeritageClauseElement */:\n return token() === 15 /* OpenBraceToken */ || token() === 83 /* ExtendsKeyword */ || token() === 106 /* ImplementsKeyword */;\n case 8 /* VariableDeclarations */:\n return isVariableDeclaratorListTerminator();\n case 17 /* TypeParameters */:\n // Tokens other than '>' are here for better error recovery\n return token() === 27 /* GreaterThanToken */ || token() === 17 /* OpenParenToken */ || token() === 15 /* OpenBraceToken */ || token() === 83 /* ExtendsKeyword */ || token() === 106 /* ImplementsKeyword */;\n case 11 /* ArgumentExpressions */:\n // Tokens other than ')' are here for better error recovery\n return token() === 18 /* CloseParenToken */ || token() === 23 /* SemicolonToken */;\n case 15 /* ArrayLiteralMembers */:\n case 19 /* TupleElementTypes */:\n case 10 /* ArrayBindingElements */:\n return token() === 20 /* CloseBracketToken */;\n case 16 /* Parameters */:\n // Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery\n return token() === 18 /* CloseParenToken */ || token() === 20 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/;\n case 18 /* TypeArguments */:\n // Tokens other than '>' are here for better error recovery\n return token() === 27 /* GreaterThanToken */ || token() === 17 /* OpenParenToken */;\n case 20 /* HeritageClauses */:\n return token() === 15 /* OpenBraceToken */ || token() === 16 /* CloseBraceToken */;\n case 13 /* JsxAttributes */:\n return token() === 27 /* GreaterThanToken */ || token() === 39 /* SlashToken */;\n case 14 /* JsxChildren */:\n return token() === 25 /* LessThanToken */ && lookAhead(nextTokenIsSlash);\n case 22 /* JSDocFunctionParameters */:\n return token() === 18 /* CloseParenToken */ || token() === 54 /* ColonToken */ || token() === 16 /* CloseBraceToken */;\n case 23 /* JSDocTypeArguments */:\n return token() === 27 /* GreaterThanToken */ || token() === 16 /* CloseBraceToken */;\n case 25 /* JSDocTupleTypes */:\n return token() === 20 /* CloseBracketToken */ || token() === 16 /* CloseBraceToken */;\n case 24 /* JSDocRecordMembers */:\n return token() === 16 /* CloseBraceToken */;\n }\n }", "function expect(lexer, kind) {\n var token = lexer.token;\n\n if (token.kind === kind) {\n lexer.advance();\n return token;\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_2__[\"syntaxError\"])(lexer.source, token.start, \"Expected \".concat(kind, \", found \").concat(Object(_lexer__WEBPACK_IMPORTED_MODULE_3__[\"getTokenDesc\"])(token)));\n}", "function sample() {\r\n const a = 5;\r\n \r\n if (true) {\r\n let a = 10; \r\n console.log(\"const with let: \" + a); // Output: const with let: 10\r\n }\r\n}" ]
[ "0.71001256", "0.70202017", "0.701235", "0.6968589", "0.69573486", "0.69573486", "0.69573486", "0.69573486", "0.69573486", "0.69573486", "0.6845873", "0.6845873", "0.6845873", "0.6629786", "0.6629786", "0.6629786", "0.6629786", "0.6629786", "0.65741307", "0.64181757", "0.6370154", "0.6351632", "0.6316445", "0.62155724", "0.6170593", "0.61303645", "0.6052981", "0.5963154", "0.5963154", "0.59303975", "0.58891714", "0.58664805", "0.58664805", "0.58664805", "0.58240944", "0.5780737", "0.5688483", "0.5688483", "0.5688483", "0.5621596", "0.5591118", "0.5560422", "0.5554815", "0.55164605", "0.55147713", "0.55042106", "0.54861224", "0.54861224", "0.54861224", "0.5398625", "0.5356374", "0.5353297", "0.5345098", "0.53250337", "0.53232294", "0.53063226", "0.53063226", "0.5304681", "0.5280423", "0.5254713", "0.5254713", "0.5254713", "0.5221889", "0.5184116", "0.5173842", "0.5165643", "0.5165643", "0.5165643", "0.5165643", "0.51295", "0.51276284", "0.51276284", "0.5111071", "0.5095788", "0.5095788", "0.5095788", "0.5095788", "0.5095788", "0.5095788", "0.5095788", "0.5095788", "0.5095788", "0.5095788", "0.5042058", "0.504089", "0.5017711", "0.50129884", "0.49928772", "0.4980366", "0.49624044", "0.4945426", "0.49425384", "0.49259415", "0.49257874", "0.4913869", "0.48839217", "0.48836732" ]
0.6870043
13
12.7 The continue statement
function parseContinueStatement() { var label = null, key; expectKeyword('continue'); // Optimize the most common form: 'continue;'. if (source.charCodeAt(index) === 0x3B) { lex(); if (!state.inIteration) { throwError({}, Messages.IllegalContinue); } return delegate.createContinueStatement(null); } if (peekLineTerminator()) { if (!state.inIteration) { throwError({}, Messages.IllegalContinue); } return delegate.createContinueStatement(null); } if (lookahead.type === Token.Identifier) { label = parseVariableIdentifier(); key = '$' + label.name; if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { throwError({}, Messages.UnknownLabel, label.name); } } consumeSemicolon(); if (label === null && !state.inIteration) { throwError({}, Messages.IllegalContinue); } return delegate.createContinueStatement(label); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseContinueStatement() {\n var label = null, marker = markerCreate();\n \n expectKeyword('continue');\n \n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 59) {\n lex();\n \n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n \n return markerApply(marker, delegate.createContinueStatement(null));\n }\n \n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n \n return markerApply(marker, delegate.createContinueStatement(null));\n }\n \n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n \n if (!state.labelSet.has(label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n \n consumeSemicolon();\n \n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n \n return markerApply(marker, delegate.createContinueStatement(label));\n }", "continueStatement() {\n return new Statement_1.ContinueStatement({\n continue: this.advance(),\n loopType: this.tryConsume(DiagnosticMessages_1.DiagnosticMessages.expectedToken(TokenKind_1.TokenKind.While, TokenKind_1.TokenKind.For), TokenKind_1.TokenKind.While, TokenKind_1.TokenKind.For)\n });\n }", "function parseContinueStatement() {\n var label = null, marker = markerCreate();\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!state.labelSet.has(label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(label));\n }", "function parseContinueStatement() {\n var label = null, marker = markerCreate();\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!state.labelSet.has(label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(label));\n }", "function parseContinueStatement() {\n var label = null, key, marker = markerCreate();\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(label));\n }", "function parseContinueStatement() {\n var label = null, key, marker = markerCreate();\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(label));\n }", "function parseContinueStatement() {\n var label = null, key, marker = markerCreate();\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(label));\n }", "function parseContinueStatement() {\n var label = null, key, marker = markerCreate();\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return markerApply(marker, delegate.createContinueStatement(label));\n }", "function parseContinueStatement() {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return delegate.createContinueStatement(null);\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return delegate.createContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return delegate.createContinueStatement(label);\n }", "function parseContinueStatement() {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return delegate.createContinueStatement(null);\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return delegate.createContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return delegate.createContinueStatement(label);\n }", "function parseContinueStatement() {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return delegate.createContinueStatement(null);\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return delegate.createContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return delegate.createContinueStatement(label);\n }", "function parseContinueStatement(node)\n\t\t{\n\t\t\tvar label = null, key;\n\t\t\texpectKeyword('continue');\n\t\t\t// Optimize the most common form: 'continue;'.\n\t\t\tif (source.charCodeAt(index) === 0x3B)\n\t\t\t{\n\t\t\t\tlex();\n\t\t\t\tif (!state.inIteration)\n\t\t\t\t{\n\t\t\t\t\tthrowError(Messages.IllegalContinue);\n\t\t\t\t}\n\t\t\t\treturn node.finishContinueStatement(null);\n\t\t\t}\n\t\t\tif (peekLineTerminator())\n\t\t\t{\n\t\t\t\tif (!state.inIteration)\n\t\t\t\t{\n\t\t\t\t\tthrowError(Messages.IllegalContinue);\n\t\t\t\t}\n\t\t\t\treturn node.finishContinueStatement(null);\n\t\t\t}\n\t\t\tif (lookahead.type === Token.Identifier)\n\t\t\t{\n\t\t\t\tlabel = parseVariableIdentifier();\n\t\t\t\tkey = '$' + label.name;\n\t\t\t\tif (!Object.prototype.hasOwnProperty.call(state.labelSet, key))\n\t\t\t\t{\n\t\t\t\t\tthrowError(Messages.UnknownLabel, label.name);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconsumeSemicolon();\n\t\t\tif (label === null && !state.inIteration)\n\t\t\t{\n\t\t\t\tthrowError(Messages.IllegalContinue);\n\t\t\t}\n\t\t\treturn node.finishContinueStatement(label);\n\t\t}", "function parseContinueStatement(node) {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(startIndex) === 0x3B) {\n lex();\n\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(label);\n }", "function parseContinueStatement$990() {\n var label$1438 = null, key$1439;\n expectKeyword$933('continue');\n // Optimize the most common form: 'continue;'.\n if (lookahead$891.value.charCodeAt(0) === 59) {\n lex$925();\n if (!state$893.inIteration) {\n throwError$929({}, Messages$874.IllegalContinue);\n }\n return delegate$888.createContinueStatement(null);\n }\n if (peekLineTerminator$928()) {\n if (!state$893.inIteration) {\n throwError$929({}, Messages$874.IllegalContinue);\n }\n return delegate$888.createContinueStatement(null);\n }\n if (lookahead$891.type === Token$869.Identifier) {\n label$1438 = parseVariableIdentifier$972();\n key$1439 = '$' + label$1438.name;\n if (!Object.prototype.hasOwnProperty.call(state$893.labelSet, key$1439)) {\n throwError$929({}, Messages$874.UnknownLabel, label$1438.name);\n }\n }\n consumeSemicolon$938();\n if (label$1438 === null && !state$893.inIteration) {\n throwError$929({}, Messages$874.IllegalContinue);\n }\n return delegate$888.createContinueStatement(label$1438);\n }", "ContinueStatement(node) {\n if (node.label) {\n markContinueStatementsOnCurrentSegmentsAsUsed();\n }\n if (\n node.label ||\n !astUtils.isInLoop(node) ||\n isInFinally(node) ||\n\n // Ignore `continue` statements in unreachable places (https://github.com/eslint/eslint/issues/11647).\n !scopeInfo.codePath.currentSegments.some(s => s.reachable)\n ) {\n return;\n }\n\n for (const segment of scopeInfo.codePath.currentSegments) {\n const info = segmentInfoMap.get(segment);\n\n if (info) {\n info.uselessContinues.push(node);\n info.returned = true;\n }\n }\n scopeInfo.uselessContinues.push(node);\n }", "function parseContinueStatement(node) {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(index) === 0x3B) {\n lex();\n\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(label);\n }", "function parseContinueStatement(node) {\n\t var label = null, key;\n\n\t expectKeyword('continue');\n\n\t // Optimize the most common form: 'continue;'.\n\t if (source.charCodeAt(startIndex) === 0x3B) {\n\t lex();\n\n\t if (!state.inIteration) {\n\t throwError(Messages.IllegalContinue);\n\t }\n\n\t return node.finishContinueStatement(null);\n\t }\n\n\t if (hasLineTerminator) {\n\t if (!state.inIteration) {\n\t throwError(Messages.IllegalContinue);\n\t }\n\n\t return node.finishContinueStatement(null);\n\t }\n\n\t if (lookahead.type === Token.Identifier) {\n\t label = parseVariableIdentifier();\n\n\t key = '$' + label.name;\n\t if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n\t throwError(Messages.UnknownLabel, label.name);\n\t }\n\t }\n\n\t consumeSemicolon();\n\n\t if (label === null && !state.inIteration) {\n\t throwError(Messages.IllegalContinue);\n\t }\n\n\t return node.finishContinueStatement(label);\n\t }", "function De(){var e,t=null;\n// Optimize the most common form: 'continue;'.\n// Optimize the most common form: 'continue;'.\nreturn G(\"continue\"),59===at.charCodeAt(lt)?(M(),mt.inIteration||j({},rt.IllegalContinue),pt.createContinueStatement(null)):U()?(mt.inIteration||j({},rt.IllegalContinue),pt.createContinueStatement(null)):(dt.type===Xe.Identifier&&(t=be(),e=\"$\"+t.name,Object.prototype.hasOwnProperty.call(mt.labelSet,e)||j({},rt.UnknownLabel,t.name)),H(),null!==t||mt.inIteration||j({},rt.IllegalContinue),pt.createContinueStatement(t))}", "function parseContinueStatement(node) {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(startIndex) === 0x3B) {\n lex();\n\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(label);\n }", "function parseContinueStatement(node) {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(startIndex) === 0x3B) {\n lex();\n\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(label);\n }", "function parseContinueStatement(node) {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(startIndex) === 0x3B) {\n lex();\n\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(label);\n }", "function parseContinueStatement(node) {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(startIndex) === 0x3B) {\n lex();\n\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(label);\n }", "function parseContinueStatement(node) {\n var label = null, key;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source.charCodeAt(startIndex) === 0x3B) {\n lex();\n\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError(Messages.IllegalContinue);\n }\n\n return node.finishContinueStatement(label);\n }", "function parseContinueStatement() {\n var token, label = null;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source[index] === ';') {\n lex();\n \n if (!inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: null\n };\n }\n\n if (peekLineTerminator()) {\n if (!inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: null\n };\n }\n\n token = lookahead();\n if (token.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!Object.prototype.hasOwnProperty.call(labelSet, label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: label\n };\n }", "function a120571()\n{\n while(0)\n {\n try\n {\n }\n catch(e)\n {\n continue;\n }\n }\n}", "function bug1() {\n var x;\n while (true) { ++x; continue; }\n}", "function parseContinueStatement() {\n var token, label = null;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source[index] === ';') {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: null\n };\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: null\n };\n }\n\n token = lookahead();\n if (token.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: label\n };\n }", "function parseContinueStatement() {\n var token, label = null;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source[index] === ';') {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: null\n };\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: null\n };\n }\n\n token = lookahead();\n if (token.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: label\n };\n }", "function parseContinueStatement() {\n var token, label = null;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source[index] === ';') {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: null\n };\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: null\n };\n }\n\n token = lookahead();\n if (token.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: label\n };\n }", "function parseContinueStatement() {\n var token, label = null;\n\n expectKeyword('continue');\n\n // Optimize the most common form: 'continue;'.\n if (source[index] === ';') {\n lex();\n\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: null\n };\n }\n\n if (peekLineTerminator()) {\n if (!state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: null\n };\n }\n\n token = lookahead();\n if (token.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !state.inIteration) {\n throwError({}, Messages.IllegalContinue);\n }\n\n return {\n type: Syntax.ContinueStatement,\n label: label\n };\n }", "function continue_Loop() {\n for(y=0; y < 10; y++) { \n if (y === 4) {continue;} //when y is 4 it jumps over one iteration in the loop\n //and will not display \"The number is 4\"\n content += \"The number is \" + y + \"<br>\";\n }\n document.getElementById(\"continues\").innerHTML = content;\n}", "get continue() { return this._continue; }", "function LabeledContinue( limit, expect ) {\n i = 0;\n result1 = \"pass\";\n result2 = \"pass\";\n\n woohoo: {\n do {\n i++;\n if ( ! (i < limit) ) {\n break woohoo;\n result1 = \"fail: evaluated statement after a labeled break\";\n }\n } while ( true );\n\n result2 = \"failed: broke out of loop, but not out of labeled block\";\n }\n\n testcases[tc++] = new TestCase(\n SECTION,\n \"do while ( \" + i +\" < \" + limit +\" )\",\n expect,\n i );\n\n testcases[tc++] = new TestCase(\n SECTION,\n \"breaking out of a do... while loop\",\n \"pass\",\n result1 );\n\n\n testcases[tc++] = new TestCase(\n SECTION,\n \"breaking out of a labeled do...while loop\",\n \"pass\",\n result2 );\n}", "skip(opSt) { return false; }", "enterContinue_stmt(ctx) {\n\t}", "function skipCommentAndContinue() {\n nextComment(null, dumpComment);\n}", "continue() {\n let parent = this.node.parent;\n return parent ? indentFrom(parent, this.pos, this.base) : 0;\n }", "function continueOrFail(e, pf) {\n return fa => continueOrFail_(fa, e, pf);\n}", "exitContinue_stmt(ctx) {\n\t}", "function evaluateContinueStatement({ node, environment, reporting }) {\n setInLexicalEnvironment({ env: environment, path: CONTINUE_SYMBOL, value: true, reporting, node });\n}", "function continueOrFail(e, pf, __trace) {\n return self => continueOrFail_(self, e, pf, __trace);\n}", "function useContinue(array, index) {\n for (var i = 0; i < array.length; i++) {\n if (i === index) {\n continue; //This tells to go to the next iteration\n }\n console.log(array[i]);\n }\n}", "function continueOrFailM(e, pf) {\n return fa => continueOrFailM_(fa, e, pf);\n}", "function continueOrFailWith(e, pf) {\n return fa => continueOrFailWith_(fa, e, pf);\n}", "function checkContinue() {\n \t\tloopOn = defaultTrue( currentPart.loop );\n \tif ( loopOn ) requestAnimFrame( demo_loop );\n }", "function continueOrFailM(e, pf, __trace) {\n return self => continueOrFailM_(self, e, pf, __trace);\n}", "function skip(){\n\t\n}", "static continue(command, ignore = false, rest = null) {\n return new Flag(\"continue\", { command, ignore, rest });\n }", "function ___R$$priv$project$rome$$internal$compiler$lint$rules$js$noUnnecessaryContinue_ts$containsParentLoopLabel(\n\t\tpath,\n\t\tparentPath,\n\t) {\n\t\tif (\n\t\t\tpath.node.type === \"JSContinueStatement\" &&\n\t\t\tpath.node.label !== undefined\n\t\t) {\n\t\t\tif (\n\t\t\t\tparentPath.parent.type === \"JSLabeledStatement\" &&\n\t\t\t\tpath.node.label.name === parentPath.parent.label.name\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "function continueOrFailWithM(e, pf) {\n return fa => continueOrFailWithM_(fa, e, pf);\n}", "function continueOrFail_(self, e, pf, __trace) {\n return continueOrFailM_(self, e, x => O.map_(pf(x), _succeed.succeed), __trace);\n}", "function iterContinue(value) {\n return { value, done: false };\n}", "function setContinueResponse() {//this is a mutator method. function sets up all of the methods. mush have a bracket and open/close parenthesis\r\n if (continueResponse != null) {//if loop. The parameter says continueResponse cant equal null\r\n continueResponse = -1;//continueResponse is assigned a value of -1\r\n while (continueResponse !== 0 && continueResponse !== 1) { //while loop. if continueResponse meets this condition then it will do what is inside of the brackets.\r\n continueResponse = Number(PROMPT.question(`\\nDo you want to continue? [0=no, 1=yes]: `)); //user will be asked to put in a value of 1 or 0\r\n }\r\n } else {//if the code doesn't meet whats above, and there are no other possible options, an else statement is used\r\n continueResponse = 1;// continueResponse will equal 1\r\n }\r\n}", "function eachContinue(array, fn) {\n var length = array.length;\n for (var i = 0; i < length; ++i) {\n if (!fn(array[i], i)) {\n break;\n }\n }\n}", "continue() {\n this.disable = false;\n this.add(null, null, true);\n }", "function skip(state, handleElse)\n{\n var prog = state.prog;\n var ip = state.ip;\n var nesting = 1;\n var ins;\n\n do {\n ins = prog[++ip];\n if (ins === 0x58) // IF\n nesting++;\n else if (ins === 0x59) // EIF\n nesting--;\n else if (ins === 0x40) // NPUSHB\n ip += prog[ip + 1] + 1;\n else if (ins === 0x41) // NPUSHW\n ip += 2 * prog[ip + 1] + 1;\n else if (ins >= 0xB0 && ins <= 0xB7) // PUSHB\n ip += ins - 0xB0 + 1;\n else if (ins >= 0xB8 && ins <= 0xBF) // PUSHW\n ip += (ins - 0xB8 + 1) * 2;\n else if (handleElse && nesting === 1 && ins === 0x1B) // ELSE\n break;\n } while (nesting > 0);\n\n state.ip = ip;\n}", "logContinue(node, typescript) {\n if (this.logLevel < 30 /* DEBUG */)\n return;\n console.log(`${chalk.yellow(`continue`)} encountered within ${chalk.yellow(stringifySyntaxKind(node.kind, typescript))}`);\n }", "function skip(state, handleElse) {\n var prog = state.prog;\n var ip = state.ip;\n var nesting = 1;\n var ins;\n\n do {\n ins = prog[++ip];\n if (ins === 0x58) {\n // IF\n nesting++;\n } else if (ins === 0x59) {\n // EIF\n nesting--;\n } else if (ins === 0x40) {\n // NPUSHB\n ip += prog[ip + 1] + 1;\n } else if (ins === 0x41) {\n // NPUSHW\n ip += 2 * prog[ip + 1] + 1;\n } else if (ins >= 0xb0 && ins <= 0xb7) {\n // PUSHB\n ip += ins - 0xb0 + 1;\n } else if (ins >= 0xb8 && ins <= 0xbf) {\n // PUSHW\n ip += (ins - 0xb8 + 1) * 2;\n } else if (handleElse && nesting === 1 && ins === 0x1b) {\n // ELSE\n break;\n }\n } while (nesting > 0);\n\n state.ip = ip;\n }", "function skip(e){\n\tif(e.keyCode==32){\n\t\tnext = \"next\";\n\t\tround++;\n\t}\n\telse if(e.keyCode==13)\n\t\tnext = \"skip\";\n}", "function matchYield(){return state.yieldAllowed && matchKeyword('yield',!strict);}", "__skipStep() {\n this.skipStep();\n }", "function skip(state, handleElse)\n{\n const prog = state.prog;\n let ip = state.ip;\n let nesting = 1;\n let ins;\n\n do {\n ins = prog[++ip];\n if (ins === 0x58) // IF\n nesting++;\n else if (ins === 0x59) // EIF\n nesting--;\n else if (ins === 0x40) // NPUSHB\n ip += prog[ip + 1] + 1;\n else if (ins === 0x41) // NPUSHW\n ip += 2 * prog[ip + 1] + 1;\n else if (ins >= 0xB0 && ins <= 0xB7) // PUSHB\n ip += ins - 0xB0 + 1;\n else if (ins >= 0xB8 && ins <= 0xBF) // PUSHW\n ip += (ins - 0xB8 + 1) * 2;\n else if (handleElse && nesting === 1 && ins === 0x1B) // ELSE\n break;\n } while (nesting > 0);\n\n state.ip = ip;\n}", "function stopEval() {\n G.continue = false;\n}", "function checkSkip() {\n if(thisObj.state != YT_PLAY) return false\n if(getQueryVariable('v') != curVideoId()) return false\n if(!needSkip()) return false\n doSkip()\n }", "function eachContinue(object, fn) {\n for (var key in object) {\n if (hasKey(object, key)) {\n if (!fn(key, object[key])) {\n break;\n }\n }\n }\n}", "shouldContinue(candidate) {\n return sum(candidate) <= this.sum;\n }", "function LoopyLighthouse() {\n var start = 100;\n var end = 200;\n\n for (var i = start; i <= end; i++) {\n var isMultipleOfFour = i % 4 === 0;\n var isMultipleOfThree = i % 3 === 0;\n\n if (isMultipleOfThree && isMultipleOfFour) {\n console.log('LoopyLighthouse');\n continue;\n }\n\n if (isMultipleOfThree) {\n console.log('Loopy');\n continue;\n }\n\n if (isMultipleOfFour) {\n console.log('Lighthouse');\n continue;\n }\n\n console.log(i);\n }\n\n}", "function continueOrFail_(fa, e, pf) {\n return continueOrFailM_(fa, e, x => O.map_(pf(x), P.succeed));\n}", "function Skip() { return Skip }", "if (/*ret DOES NOT contain any hint on any of the arguments (lock is cracked)*/) {\n break; //Break loop (since further attempts are not neccessary)\n }", "_continue() {\n let immediateStep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n animation_Animator.cancelFrame(this._nextFrame);\n this._nextFrame = null;\n if (immediateStep) return this._stepImmediate();\n if (this._paused) return this;\n this._nextFrame = animation_Animator.frame(this._step);\n return this;\n }", "function continueOrFailM_(self, e, pf, __trace) {\n return core.chain_(self, a => O.getOrElse_(pf(a), () => core.fail(e())), __trace);\n}", "next() {}", "nextstep(step) {}", "function continueOrRetry(pf) {\n return fa => continueOrRetry_(fa, pf);\n}", "function IteratorStep(iteratorRecord) { // eslint-disable-line no-unused-vars\n\t\t// 1. Let result be ? IteratorNext(iteratorRecord).\n\t\tvar result = IteratorNext(iteratorRecord);\n\t\t// 2. Let done be ? IteratorComplete(result).\n\t\tvar done = IteratorComplete(result);\n\t\t// 3. If done is true, return false.\n\t\tif (done === true) {\n\t\t\treturn false;\n\t\t}\n\t\t// 4. Return result.\n\t\treturn result;\n\t}", "continueIfEnabled(callback) {\r\n if (!this.continueEnabled) {\r\n return;\r\n }\r\n callback();\r\n this.continueEnabled = false;\r\n if (!this.continueTimeout) {\r\n this.continueTimeout = setTimeout(() => {\r\n this.continueEnabled = true;\r\n this.continueTimeout = null;\r\n }, 1000);\r\n }\r\n }", "if (/*ret DOES NOT contain any hint on the result (lock is cracked)*/) {\n break; //Break loop (since further attempts are not neccessary)\n }", "function intGoNext(){\n goNext(0);\n }", "function condition() {\n const message = (previousBlockNumber == currentBlockNumber) ? 'not yet' : 'next block found';\n verbose(`waitNextBlock: condition: previous:${previousBlockNumber} current:${currentBlockNumber} - ${message}`);\n if (currentBlockNumber === undefined) return true;\n if (previousBlockNumber === undefined) return true;\n // keep going while current is same as previous\n return previousBlockNumber == currentBlockNumber ;\n }", "function skipToNext () {\n\n\t\tcurrentlyPressed = null;\n\t\tvar skipText;\n\t\tif ( currentSection == 'buttons' ) {\n\n\t\t\tskipText = buttons[ currentButton ].description;\n\t\t\tbuttons[ currentButton ].accepted = null;\n\t\t\tnextButton();\n\n\t\t} else {\n\n\t\t\tskipText = (axis[ currentAxis ].description ? axis[ currentAxis ].description + \" / \" : \"\" );\n\t\t\tskipText += ( axisDirection ? axis[ currentAxis ].plus : axis[ currentAxis ].minus );\n\t\t\taxis[ currentAxis ][ 'accepted' + axisDirection ] = null;\n\t\t\tnextAxis();\n\n\t\t}\n\n\t\t// set error text\n\t\terror.render.text = \"^N^0Skipped ^B\" + skipText;\n\t}", "function check_next(args, next) {\n ret = a.t.call(args)\n if (ret.includes(\"is missing\") || ret.includes(\"unlocked\") || ret.includes(\"Denied\")) {\n return true\n }\n }", "function continuePrompt(){\n inquirer.prompt({\n type: \"confirm\",\n name: \"continue\",\n message: \"Continue....?\",\n }).then((answer) => {\n if (answer.continue){\n showMainMenu();\n } else{\n exit();\n }\n })\n}", "function advance(initial, iter, loopcond, exitcond) {\n while (loopcond(initial)) {\n initial = iter.next();\n if (exitcond(initial)) {\n return initial;\n }\n }\n return initial;\n}", "function iteratorStep(iteratorRecord) {\n\t\t// 1. Let result be ? IteratorNext(iteratorRecord).\n\t\tvar result = iteratorNext(iteratorRecord);\n\t\t// 2. Let done be ? IteratorComplete(result).\n\t\tvar done = iteratorComplete(result);\n\t\t// 3. If done is true, return false.\n\t\tif (done === true) {\n\t\t\treturn false;\n\t\t}\n\t\t// 4. Return result.\n\t\treturn result;\n\t}", "skipNext() {\n let id = this.props.trackId;\n const nodes = this.props.audioNodes;\n\n if ( (id + 1) <= (nodes.length - 1) ) {\n\n nodes[id].item.pause();\n\n id = id + 1;\n setCurrTrack(id);\n\n this.play(id);\n this.props.onItemActive(id);\n }\n\n }", "continue(){\n for(let peer of this.peers){\n this.usePeer(peer);\n }\n }", "function continueOrFailM_(fa, e, pf) {\n return P.chain_(fa, a => O.getOrElse_(pf(a), () => P.fail(e)));\n}", "onCodePathEnd() {\n for (const node of scopeInfo.uselessContinues) {\n context.report({\n node,\n loc: node.loc,\n messageId: \"unnecessaryContinue\",\n fix(fixer) {\n if (isRemovable(node) && !sourceCode.getCommentsInside(node).length) {\n\n /*\n * Extend the replacement range to include the\n * entire function to avoid conflicting with\n * no-else-return.\n * https://github.com/eslint/eslint/issues/8026\n */\n return new FixTracker(fixer, sourceCode)\n .retainEnclosingFunction(node)\n .remove(node);\n }\n return null;\n }\n });\n }\n\n scopeInfo = scopeInfo.upper;\n }", "function continueOrFailWith_(fa, e, pf) {\n return continueOrFailWithM_(fa, e, x => O.map_(pf(x), P.succeed));\n}", "function continueExecution() {\n clearBoard();\n hero.positionAtHome();\n hero.setImage('normal');\n hero.setLives(hero.getLives()-1);\n hero.draw();\n isNextLife = true;\n }", "function skip() {\n\t this.shouldSkip = true;\n\t}", "function skip() {\n\t this.shouldSkip = true;\n\t}", "function next(){\n if(!debug){_next()};\n}", "moveNext() {\n const _ = this;\n _._assertBadState();\n try {\n switch (_._state) {\n case 0 /* Before */:\n _._yielder = _._yielder || yielder();\n _._state = 1 /* Active */;\n const initializer = _._initializer;\n if (initializer)\n initializer();\n // fall through\n case 1 /* Active */:\n if (_._tryGetNext(_._yielder)) {\n return true;\n }\n else {\n this.dispose();\n _._state = 2 /* Completed */;\n return false;\n }\n default:\n return false;\n }\n }\n catch (e) {\n this.dispose();\n _._state = 3 /* Faulted */;\n throw e;\n }\n }", "function skip(){\r\n\tanswers[count] = 'skip';\r\n\tcount++ \r\n\tupdateItems();\r\n}" ]
[ "0.7148657", "0.6988531", "0.6957503", "0.6957503", "0.69189596", "0.69189596", "0.69189596", "0.69189596", "0.6844112", "0.6844112", "0.6844112", "0.68307775", "0.6830707", "0.6818726", "0.6808828", "0.67890716", "0.67604464", "0.67429197", "0.67416614", "0.67416614", "0.67416614", "0.67416614", "0.67416614", "0.6713877", "0.6662386", "0.6660628", "0.6648344", "0.6648344", "0.6648344", "0.6648344", "0.6615365", "0.66066617", "0.65653354", "0.6554358", "0.64701575", "0.642443", "0.6338424", "0.63283765", "0.63213074", "0.6293123", "0.61774755", "0.61455137", "0.61257184", "0.61155546", "0.6115325", "0.6036013", "0.60047054", "0.5931473", "0.5858788", "0.58570784", "0.5819078", "0.58178806", "0.57472974", "0.57247406", "0.571177", "0.57014436", "0.5691696", "0.56694514", "0.56690747", "0.5635186", "0.56188095", "0.56142277", "0.5596757", "0.55893373", "0.55413157", "0.55329907", "0.5531103", "0.5529918", "0.55167335", "0.5510977", "0.5492865", "0.5489512", "0.54673094", "0.5462935", "0.5460271", "0.5450982", "0.5428145", "0.54163957", "0.5407541", "0.5402731", "0.53923315", "0.5388153", "0.5374649", "0.5371672", "0.5359252", "0.53587395", "0.535764", "0.5351681", "0.53512365", "0.5331682", "0.5318038", "0.5317628", "0.5317628", "0.5299666", "0.5291253", "0.52893764" ]
0.6850173
11
12.8 The break statement
function parseBreakStatement() { var label = null, key; expectKeyword('break'); // Catch the very common case first: immediately a semicolon (U+003B). if (source.charCodeAt(index) === 0x3B) { lex(); if (!(state.inIteration || state.inSwitch)) { throwError({}, Messages.IllegalBreak); } return delegate.createBreakStatement(null); } if (peekLineTerminator()) { if (!(state.inIteration || state.inSwitch)) { throwError({}, Messages.IllegalBreak); } return delegate.createBreakStatement(null); } if (lookahead.type === Token.Identifier) { label = parseVariableIdentifier(); key = '$' + label.name; if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { throwError({}, Messages.UnknownLabel, label.name); } } consumeSemicolon(); if (label === null && !(state.inIteration || state.inSwitch)) { throwError({}, Messages.IllegalBreak); } return delegate.createBreakStatement(label); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Break() {}", "function parseBreakStatement() {\n var label = null, marker = markerCreate();\n \n expectKeyword('break');\n \n // Catch the very common case first: immediately a semicolon (char #59).\n if (source.charCodeAt(index) === 59) {\n lex();\n \n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n \n return markerApply(marker, delegate.createBreakStatement(null));\n }\n \n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n \n return markerApply(marker, delegate.createBreakStatement(null));\n }\n \n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n \n if (!state.labelSet.has(label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n \n consumeSemicolon();\n \n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n \n return markerApply(marker, delegate.createBreakStatement(label));\n }", "function parseBreakStatement() {\n var label = null, key, marker = markerCreate();\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (char #59).\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(label));\n }", "function parseBreakStatement() {\n var label = null, key, marker = markerCreate();\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (char #59).\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(label));\n }", "function parseBreakStatement() {\n var label = null, key, marker = markerCreate();\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (char #59).\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(label));\n }", "function parseBreakStatement() {\n var label = null, key, marker = markerCreate();\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (char #59).\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(label));\n }", "function parseBreakStatement() {\n var label = null, marker = markerCreate();\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (char #59).\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!state.labelSet.has(label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(label));\n }", "function parseBreakStatement() {\n var label = null, marker = markerCreate();\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (char #59).\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(null));\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!state.labelSet.has(label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return markerApply(marker, delegate.createBreakStatement(label));\n }", "function parseBreakStatement$991() {\n var label$1440 = null, key$1441;\n expectKeyword$933('break');\n // Catch the very common case first: immediately a semicolon (char #59).\n if (lookahead$891.value.charCodeAt(0) === 59) {\n lex$925();\n if (!(state$893.inIteration || state$893.inSwitch)) {\n throwError$929({}, Messages$874.IllegalBreak);\n }\n return delegate$888.createBreakStatement(null);\n }\n if (peekLineTerminator$928()) {\n if (!(state$893.inIteration || state$893.inSwitch)) {\n throwError$929({}, Messages$874.IllegalBreak);\n }\n return delegate$888.createBreakStatement(null);\n }\n if (lookahead$891.type === Token$869.Identifier) {\n label$1440 = parseVariableIdentifier$972();\n key$1441 = '$' + label$1440.name;\n if (!Object.prototype.hasOwnProperty.call(state$893.labelSet, key$1441)) {\n throwError$929({}, Messages$874.UnknownLabel, label$1440.name);\n }\n }\n consumeSemicolon$938();\n if (label$1440 === null && !(state$893.inIteration || state$893.inSwitch)) {\n throwError$929({}, Messages$874.IllegalBreak);\n }\n return delegate$888.createBreakStatement(label$1440);\n }", "function parseBreakStatement() {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (char #59).\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return delegate.createBreakStatement(null);\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return delegate.createBreakStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return delegate.createBreakStatement(label);\n }", "function parseBreakStatement() {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (char #59).\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return delegate.createBreakStatement(null);\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return delegate.createBreakStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return delegate.createBreakStatement(label);\n }", "function parseBreakStatement() {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (char #59).\n if (source.charCodeAt(index) === 59) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return delegate.createBreakStatement(null);\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return delegate.createBreakStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return delegate.createBreakStatement(label);\n }", "function breakToken() {\n\t\tvar lastSwitch = {\n\t\t\tblock: 0,\n\t\t\tlabe: 0\n\t\t};\n\t\tif (switchStack.length > 0) {\n\t\t\tlastSwitch = switchStack[switchStack.length - 1];\n\t\t\tasm.push(' JMP end_switch_' + lastSwitch.labe);\n\t\t} else\n\t\t\tputError(lineCount, 14, '');\n\t\t//info(\"\" + lineCount + \" missing switch construct\");\n\t}", "function parseBreakStatement(node) {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(lastIndex) === 0x3B) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n } else if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(label);\n }", "function parseBreakStatement(node) {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(index) === 0x3B) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(label);\n }", "function parseBreakStatement(node) {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(lastIndex) === 0x3B) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n } else if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(label);\n }", "function parseBreakStatement(node) {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(lastIndex) === 0x3B) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n } else if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(label);\n }", "function parseBreakStatement(node) {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(lastIndex) === 0x3B) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n } else if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(label);\n }", "function parseBreakStatement(node)\n\t\t{\n\t\t\tvar label = null, key;\n\t\t\texpectKeyword('break');\n\t\t\t// Catch the very common case first: immediately a semicolon (U+003B).\n\t\t\tif (source.charCodeAt(index) === 0x3B)\n\t\t\t{\n\t\t\t\tlex();\n\t\t\t\tif (!(state.inIteration || state.inSwitch))\n\t\t\t\t{\n\t\t\t\t\tthrowError(Messages.IllegalBreak);\n\t\t\t\t}\n\t\t\t\treturn node.finishBreakStatement(null);\n\t\t\t}\n\t\t\tif (peekLineTerminator())\n\t\t\t{\n\t\t\t\tif (!(state.inIteration || state.inSwitch))\n\t\t\t\t{\n\t\t\t\t\tthrowError(Messages.IllegalBreak);\n\t\t\t\t}\n\t\t\t\treturn node.finishBreakStatement(null);\n\t\t\t}\n\t\t\tif (lookahead.type === Token.Identifier)\n\t\t\t{\n\t\t\t\tlabel = parseVariableIdentifier();\n\t\t\t\tkey = '$' + label.name;\n\t\t\t\tif (!Object.prototype.hasOwnProperty.call(state.labelSet, key))\n\t\t\t\t{\n\t\t\t\t\tthrowError(Messages.UnknownLabel, label.name);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconsumeSemicolon();\n\t\t\tif (label === null && !(state.inIteration || state.inSwitch))\n\t\t\t{\n\t\t\t\tthrowError(Messages.IllegalBreak);\n\t\t\t}\n\t\t\treturn node.finishBreakStatement(label);\n\t\t}", "function parseBreakStatement(node) {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(lastIndex) === 0x3B) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(label);\n }", "function parseBreakStatement(node) {\n var label = null, key;\n\n expectKeyword('break');\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(lastIndex) === 0x3B) {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (hasLineTerminator) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(null);\n }\n\n if (lookahead.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n key = '$' + label.name;\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n throwError(Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError(Messages.IllegalBreak);\n }\n\n return node.finishBreakStatement(label);\n }", "function parseBreakStatement(node) {\n\t var label = null, key;\n\n\t expectKeyword('break');\n\n\t // Catch the very common case first: immediately a semicolon (U+003B).\n\t if (source.charCodeAt(lastIndex) === 0x3B) {\n\t lex();\n\n\t if (!(state.inIteration || state.inSwitch)) {\n\t throwError(Messages.IllegalBreak);\n\t }\n\n\t return node.finishBreakStatement(null);\n\t }\n\n\t if (hasLineTerminator) {\n\t if (!(state.inIteration || state.inSwitch)) {\n\t throwError(Messages.IllegalBreak);\n\t }\n\t } else if (lookahead.type === Token.Identifier) {\n\t label = parseVariableIdentifier();\n\n\t key = '$' + label.name;\n\t if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {\n\t throwError(Messages.UnknownLabel, label.name);\n\t }\n\t }\n\n\t consumeSemicolon();\n\n\t if (label === null && !(state.inIteration || state.inSwitch)) {\n\t throwError(Messages.IllegalBreak);\n\t }\n\n\t return node.finishBreakStatement(label);\n\t }", "function isLoopBreak(st) {\n return st instanceof ReturnStatement || st instanceof BreakStatement;\n}", "function parseBreakStatement() {\n var token, label = null;\n\n expectKeyword('break');\n\n // Optimize the most common form: 'break;'.\n if (source[index] === ';') {\n lex();\n \n if (!(inIteration || inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: null\n };\n }\n\n if (peekLineTerminator()) {\n if (!(inIteration || inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: null\n };\n }\n\n token = lookahead();\n if (token.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!Object.prototype.hasOwnProperty.call(labelSet, label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(inIteration || inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: label\n };\n }", "exitBreak_stmt(ctx) {\n\t}", "function breakTheLoop() {\n for (let i = 0; i < 45; i++) {\n console.log(i);\n break;\n }\n}", "function isBreaking(stmt, path) {\n\t if (stmt.isBreakStatement()) {\n\t return _isBreaking(stmt, path);\n\t }\n\n\t var isBroken = false;\n\t var result = {\n\t break: false,\n\t bail: false\n\t };\n\n\t stmt.traverse({\n\t BreakStatement: function BreakStatement(breakPath) {\n\t // if we already detected a break statement,\n\t if (isBroken) return;\n\n\t result = _isBreaking(breakPath, path);\n\n\t if (result.bail || result.break) {\n\t isBroken = true;\n\t }\n\t }\n\t });\n\n\t return result;\n\n\t function _isBreaking(breakPath, path) {\n\t var label = breakPath.get(\"label\");\n\n\t if (label.node !== null) {\n\t // labels are fn scoped and not accessible by inner functions\n\t // path is the switch statement\n\t if (!isSameFunctionScope(path, breakPath)) {\n\t // we don't have to worry about this break statement\n\t return {\n\t break: false,\n\t bail: false\n\t };\n\t }\n\n\t // here we handle the break labels\n\t // if they are outside switch, we bail out\n\t // if they are within the case, we keep them\n\t var _isAncestor = isAncestor(path.scope.getBinding(label.node.name).path, path);\n\n\t return {\n\t bail: _isAncestor,\n\t break: _isAncestor\n\t };\n\t }\n\n\t // set the flag that it is indeed breaking\n\t var isBreak = true;\n\n\t // this flag is to capture\n\t // switch(0) { case 0: while(1) if (x) break; }\n\t var possibleRunTimeBreak = false;\n\n\t // and compute if it's breaking the correct thing\n\t var parent = breakPath.parentPath;\n\n\t while (parent !== stmt.parentPath) {\n\t // loops and nested switch cases\n\t if (parent.isLoop() || parent.isSwitchCase()) {\n\t // invalidate all the possible runtime breaks captured\n\t // while (1) { if (x) break; }\n\t possibleRunTimeBreak = false;\n\n\t // and set that it's not breaking our switch statement\n\t isBreak = false;\n\t break;\n\t }\n\t //\n\t // this is a special case and depends on\n\t // the fact that SwitchStatement is handled in the\n\t // exit hook of the traverse\n\t //\n\t // switch (0) {\n\t // case 0: if (x) break;\n\t // }\n\t //\n\t // here `x` is runtime only.\n\t // in this case, we need to bail out. So we depend on exit hook\n\t // of switch so that, it would have visited the IfStatement first\n\t // before the SwitchStatement and would have removed the\n\t // IfStatement if it was a compile time determined\n\t //\n\t if (parent.isIfStatement()) {\n\t possibleRunTimeBreak = true;\n\t }\n\t parent = parent.parentPath;\n\t }\n\n\t return {\n\t break: possibleRunTimeBreak || isBreak,\n\t bail: possibleRunTimeBreak\n\t };\n\t }\n\t }", "function parseBreakStatement() {\n var token, label = null;\n\n expectKeyword('break');\n\n // Optimize the most common form: 'break;'.\n if (source[index] === ';') {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: null\n };\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: null\n };\n }\n\n token = lookahead();\n if (token.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: label\n };\n }", "function parseBreakStatement() {\n var token, label = null;\n\n expectKeyword('break');\n\n // Optimize the most common form: 'break;'.\n if (source[index] === ';') {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: null\n };\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: null\n };\n }\n\n token = lookahead();\n if (token.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: label\n };\n }", "function parseBreakStatement() {\n var token, label = null;\n\n expectKeyword('break');\n\n // Optimize the most common form: 'break;'.\n if (source[index] === ';') {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: null\n };\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: null\n };\n }\n\n token = lookahead();\n if (token.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: label\n };\n }", "function parseBreakStatement() {\n var token, label = null;\n\n expectKeyword('break');\n\n // Optimize the most common form: 'break;'.\n if (source[index] === ';') {\n lex();\n\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: null\n };\n }\n\n if (peekLineTerminator()) {\n if (!(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: null\n };\n }\n\n token = lookahead();\n if (token.type === Token.Identifier) {\n label = parseVariableIdentifier();\n\n if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) {\n throwError({}, Messages.UnknownLabel, label.name);\n }\n }\n\n consumeSemicolon();\n\n if (label === null && !(state.inIteration || state.inSwitch)) {\n throwError({}, Messages.IllegalBreak);\n }\n\n return {\n type: Syntax.BreakStatement,\n label: label\n };\n }", "function Oe(){var e,t=null;\n// Catch the very common case first: immediately a semicolon (U+003B).\n// Catch the very common case first: immediately a semicolon (U+003B).\nreturn G(\"break\"),59===at.charCodeAt(lt)?(M(),mt.inIteration||mt.inSwitch||j({},rt.IllegalBreak),pt.createBreakStatement(null)):U()?(mt.inIteration||mt.inSwitch||j({},rt.IllegalBreak),pt.createBreakStatement(null)):(dt.type===Xe.Identifier&&(t=be(),e=\"$\"+t.name,Object.prototype.hasOwnProperty.call(mt.labelSet,e)||j({},rt.UnknownLabel,t.name)),H(),null!==t||mt.inIteration||mt.inSwitch||j({},rt.IllegalBreak),pt.createBreakStatement(t))}", "breakBlock(i, j, info) {\n\t\tvar block = this.get(i, j);\n\t\tif(block.breakable && !block.isBreaking){\n\t\t\tblock.isBreaking = true;\n\t\t\tblock.breakTimer = 0;\n\t\t\tblock.koef = 1;\n\t\t\tif(info.side && block.id == 12) block.koef = 10;\n\t\t\tio.to('room' + this.room).emit('blockBreaking', block.physics.rpos, block.koef);\n\t\t\tthis.updateBlock(i, j, info);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function break_Loop() {\n for(y=0; y < 100; y++) { \n if (y === 12) {break;} //when y is 12 it jumps out of the for loop using 'break'\n content += \"The number is \" + y + \"<br>\";\n }\n document.getElementById(\"breakup\").innerHTML = content;\n}", "enterBreak_stmt(ctx) {\n\t}", "function useBreak(array, index) {\n for (var i = 0; i < array.length; i++) {\n if (i > index) {\n break;\n }\n console.log(array[i]);\n }\n}", "function evaluateCaseBlock({ node, evaluate, environment, reporting, statementTraversalStack }, switchExpression) {\n // Prepare a lexical environment for the case block\n const localEnvironment = cloneLexicalEnvironment(environment);\n // Define a new binding for a break symbol within the environment\n setInLexicalEnvironment({ env: localEnvironment, path: BREAK_SYMBOL, value: false, newBinding: true, reporting, node });\n for (const clause of node.clauses) {\n evaluate.nodeWithArgument(clause, localEnvironment, switchExpression, statementTraversalStack);\n // Check if a 'break', 'continue', or 'return' statement has been encountered, break the block\n if (pathInLexicalEnvironmentEquals(node, localEnvironment, true, BREAK_SYMBOL, CONTINUE_SYMBOL, RETURN_SYMBOL)) {\n break;\n }\n }\n}", "function debug_break(env, line) {\n\tthrow new DebugException(env, line);\n}", "function addBreak() {\n message.setBreak( true );\n}", "function labelledBlockTest() {\n label1:\n for (print(\"loop 1 part A\"); print(\"loop 1 part B\"), true; print(\"loop 1 part C\")) {\n print(\"loop 1 body\");\n break label1;\n }\n\n /* This should work the same as 'label1', but Duktape 0.9.0 fails with\n * an INVALID opcde after printing 'loop 2 body' when handling 'break label2'.\n */\n label2:\n {\n for (print(\"loop 2 part A\"); print(\"loop 2 part B\"), true; print(\"loop 2 part C\")) {\n print(\"loop 2 body\");\n break label2;\n }\n }\n\n print(\"after loop 2\");\n}", "function checkForBreak()\n\t\t\t{\n\t\t\t\tif (dialogueLabel.text[tempPosition] == \"^\"){\n\t\t\t\t\tdialogueLabel.text = dialogueLabel.text.replaceAt(tempPosition, \" \");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}", "function evaluateBreakStatement({ environment, reporting, node }) {\n setInLexicalEnvironment({ env: environment, path: BREAK_SYMBOL, value: true, reporting, node });\n}", "function loop_break(cod_info) {\n for (var sfb = 0; sfb < cod_info.sfbmax; sfb++)\n if (cod_info.scalefac[sfb]\n + cod_info.subblock_gain[cod_info.window[sfb]] == 0)\n return false;\n\n return true;\n }", "function loop_break(cod_info) {\n for (var sfb = 0; sfb < cod_info.sfbmax; sfb++)\n if (cod_info.scalefac[sfb]\n + cod_info.subblock_gain[cod_info.window[sfb]] == 0)\n return false;\n\n return true;\n }", "function breakDone() {\n clearInterval(timerInterval);\n started = false;\n startWork();\n }", "logBreak(node, typescript) {\n if (this.logLevel < 30 /* DEBUG */)\n return;\n console.log(`${chalk.yellow(`break`)} encountered within ${chalk.yellow(stringifySyntaxKind(node.kind, typescript))}`);\n }", "function breakNodes() {\n var startPath = new ElementPath(startNode.parent()),\n endPath = new ElementPath(endNode.parent()),\n breakStart = NULL,\n breakEnd = NULL;\n for (var i = 0; i < startPath.elements.length; i++) {\n var element = startPath.elements[ i ];\n\n if (element == startPath.block ||\n element == startPath.blockLimit)\n break;\n\n if (me.checkElementRemovable(element))\n breakStart = element;\n }\n for (i = 0; i < endPath.elements.length; i++) {\n element = endPath.elements[ i ];\n\n if (element == endPath.block ||\n element == endPath.blockLimit)\n break;\n\n if (me.checkElementRemovable(element))\n breakEnd = element;\n }\n\n if (breakEnd)\n endNode._4e_breakParent(breakEnd);\n if (breakStart)\n startNode._4e_breakParent(breakStart);\n }", "function thematicBreak(ctx, node, index, parent) {\n var macro = ctx.thematicBreak || defaultMacro;\n return macro(node);\n}", "function stopBreaking() {\n\t\tutils.zapApiCall(\"/break/action/continue\")\n\t\t\t.catch(utils.errorHandler);\n\n\t\tutils.loadTool(NAME)\n\t\t\t.then(tool => {\n\t\t\t\ttool.isRunning = false;\n\t\t\t\ttool.data = DATA.OFF;\n\t\t\t\ttool.icon = ICONS.OFF;\n\n\t\t\t\tutils.messageAllTabs(tool.panel, {action: 'broadcastUpdate', tool: {name: NAME, data: DATA.OFF, icon: ICONS.OFF}})\n\t\t\t\tutils.writeTool(tool)\n\t\t\t})\n\t\t\t.catch(utils.errorHandler);\n\t}", "function BreakThread() {\r\n}", "function LabeledContinue( limit, expect ) {\n i = 0;\n result1 = \"pass\";\n result2 = \"pass\";\n\n woohoo: {\n do {\n i++;\n if ( ! (i < limit) ) {\n break woohoo;\n result1 = \"fail: evaluated statement after a labeled break\";\n }\n } while ( true );\n\n result2 = \"failed: broke out of loop, but not out of labeled block\";\n }\n\n testcases[tc++] = new TestCase(\n SECTION,\n \"do while ( \" + i +\" < \" + limit +\" )\",\n expect,\n i );\n\n testcases[tc++] = new TestCase(\n SECTION,\n \"breaking out of a do... while loop\",\n \"pass\",\n result1 );\n\n\n testcases[tc++] = new TestCase(\n SECTION,\n \"breaking out of a labeled do...while loop\",\n \"pass\",\n result2 );\n}", "function manualBreak() {\n stopTimer();\n Vars.TimerRunnig = false;\n Vars.onBreak = true;\n Vars.Timer = Consts.POMODORO_DONE_TEXT;\n}", "function breakTimer() {}", "function scrollToLastBreak() {\n scroller.scrollTo( 'break' );\n}", "function breakEnds() {\n var onManualTakeBreak = Vars.onManualTakeBreak\n stopTimer();\n var msg;\n\n //Long break\n if (Vars.PomoSetCounter == Vars.UserData.PomoSetNum) {\n msg = onManualTakeBreak ? \"Break is 0ver\" : \"Long Break is over\";\n pomoReset();\n if (Vars.UserData.LongBreakNotify) {\n notifyHabitica(msg);\n }\n }\n\n //Break Extension on end\n else {\n msg = \"Back to work\";\n startBreakExtension(Vars.UserData.BreakExtention * 60);\n }\n\n //notify\n notify(\"Time's Up\", msg);\n //play sound\n playSound(Vars.UserData.breakEndSound, Vars.UserData.breakEndSoundVolume, false);\n}", "function br (ctx, node) {\n const macro = ctx.break ? ctx.break : defaultMacro\n return macro(node)\n}", "function shouldBreak(start, mid, end){\n\t\tvar all = [start].concat(mid).concat([end]);\n\t\tvar previous = all[all.length - 2];\n\t\tvar next = end;\n\t\t\n\t\t// Lookahead termintor for:\n\t\t// GB10. (E_Base | EBG) Extend* ?\tE_Modifier\n\t\tvar eModifierIndex = all.lastIndexOf(E_Modifier);\n\t\tif(eModifierIndex > 1 &&\n\t\t\tall.slice(1, eModifierIndex).every(function(c){return c == Extend}) &&\n\t\t\t[Extend, E_Base, E_Base_GAZ].indexOf(start) == -1){\n\t\t\treturn Break\n\t\t}\n\n\t\t// Lookahead termintor for:\n\t\t// GB12. ^ (RI RI)* RI\t?\tRI\n\t\t// GB13. [^RI] (RI RI)* RI\t?\tRI\n\t\tvar rIIndex = all.lastIndexOf(Regional_Indicator);\n\t\tif(rIIndex > 0 &&\n\t\t\tall.slice(1, rIIndex).every(function(c){return c == Regional_Indicator}) &&\n\t\t\t[Prepend, Regional_Indicator].indexOf(previous) == -1) { \n\t\t\tif(all.filter(function(c){return c == Regional_Indicator}).length % 2 == 1) {\n\t\t\t\treturn BreakLastRegional\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn BreakPenultimateRegional\n\t\t\t}\n\t\t}\n\t\t\n\t\t// GB3. CR X LF\n\t\tif(previous == CR && next == LF){\n\t\t\treturn NotBreak;\n\t\t}\n\t\t// GB4. (Control|CR|LF) ÷\n\t\telse if(previous == Control || previous == CR || previous == LF){\n\t\t\tif(next == E_Modifier && mid.every(function(c){return c == Extend})){\n\t\t\t\treturn Break\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn BreakStart\n\t\t\t}\n\t\t}\n\t\t// GB5. ÷ (Control|CR|LF)\n\t\telse if(next == Control || next == CR || next == LF){\n\t\t\treturn BreakStart;\n\t\t}\n\t\t// GB6. L X (L|V|LV|LVT)\n\t\telse if(previous == L && \n\t\t\t(next == L || next == V || next == LV || next == LVT)){\n\t\t\treturn NotBreak;\n\t\t}\n\t\t// GB7. (LV|V) X (V|T)\n\t\telse if((previous == LV || previous == V) && \n\t\t\t(next == V || next == T)){\n\t\t\treturn NotBreak;\n\t\t}\n\t\t// GB8. (LVT|T) X (T)\n\t\telse if((previous == LVT || previous == T) && \n\t\t\tnext == T){\n\t\t\treturn NotBreak;\n\t\t}\n\t\t// GB9. X (Extend|ZWJ)\n\t\telse if (next == Extend || next == ZWJ){\n\t\t\treturn NotBreak;\n\t\t}\n\t\t// GB9a. X SpacingMark\n\t\telse if(next == SpacingMark){\n\t\t\treturn NotBreak;\n\t\t}\n\t\t// GB9b. Prepend X\n\t\telse if (previous == Prepend){\n\t\t\treturn NotBreak;\n\t\t}\n\t\t\n\t\t// GB10. (E_Base | EBG) Extend* ?\tE_Modifier\n\t\tvar previousNonExtendIndex = all.indexOf(Extend) != -1 ? all.lastIndexOf(Extend) - 1 : all.length - 2;\n\t\tif([E_Base, E_Base_GAZ].indexOf(all[previousNonExtendIndex]) != -1 &&\n\t\t\tall.slice(previousNonExtendIndex + 1, -1).every(function(c){return c == Extend}) &&\n\t\t\tnext == E_Modifier){\n\t\t\treturn NotBreak;\n\t\t}\n\t\t\n\t\t// GB11. ZWJ ? (Glue_After_Zwj | EBG)\n\t\tif(previous == ZWJ && [Glue_After_Zwj, E_Base_GAZ].indexOf(next) != -1) {\n\t\t\treturn NotBreak;\n\t\t}\n\n\t\t// GB12. ^ (RI RI)* RI ? RI\n\t\t// GB13. [^RI] (RI RI)* RI ? RI\n\t\tif(mid.indexOf(Regional_Indicator) != -1) { \n\t\t\treturn Break;\n\t\t}\n\t\tif(previous == Regional_Indicator && next == Regional_Indicator) {\n\t\t\treturn NotBreak;\n\t\t}\n\n\t\t// GB999. Any ? Any\n\t\treturn BreakStart;\n\t}", "function evaluateCaseClause({ node, evaluate, environment, statementTraversalStack }, switchExpression) {\n const expressionResult = evaluate.expression(node.expression, environment, statementTraversalStack);\n // Stop immediately if the expression doesn't match the switch expression\n if (expressionResult !== switchExpression)\n return;\n for (const statement of node.statements) {\n evaluate.statement(statement, environment);\n // Check if a 'break', 'continue', or 'return' statement has been encountered, break the block\n if (pathInLexicalEnvironmentEquals(node, environment, true, BREAK_SYMBOL, CONTINUE_SYMBOL, RETURN_SYMBOL)) {\n break;\n }\n }\n}", "async function foo() {\n for (;;await[]) {\n break;\n }\n}", "function startBreak() {\n isWork = false;\n timerVal.textContent = break_time.textContent;\n runInterval();\n }", "function bug1() {\n var x;\n while (true) { ++x; continue; }\n}", "function shouldBreak(start, mid, end) {\n\t\t\tvar all = [start].concat(mid).concat([end]);\n\t\t\tvar previous = all[all.length - 2];\n\t\t\tvar next = end;\n\n\t\t\t// Lookahead termintor for:\n\t\t\t// GB10. (E_Base | EBG) Extend* ?\tE_Modifier\n\t\t\tvar eModifierIndex = all.lastIndexOf(E_Modifier);\n\t\t\tif (eModifierIndex > 1 && all.slice(1, eModifierIndex).every(function (c) {\n\t\t\t\treturn c == Extend;\n\t\t\t}) && [Extend, E_Base, E_Base_GAZ].indexOf(start) == -1) {\n\t\t\t\treturn Break;\n\t\t\t}\n\n\t\t\t// Lookahead termintor for:\n\t\t\t// GB12. ^ (RI RI)* RI\t?\tRI\n\t\t\t// GB13. [^RI] (RI RI)* RI\t?\tRI\n\t\t\tvar rIIndex = all.lastIndexOf(Regional_Indicator);\n\t\t\tif (rIIndex > 0 && all.slice(1, rIIndex).every(function (c) {\n\t\t\t\treturn c == Regional_Indicator;\n\t\t\t}) && [Prepend, Regional_Indicator].indexOf(previous) == -1) {\n\t\t\t\tif (all.filter(function (c) {\n\t\t\t\t\treturn c == Regional_Indicator;\n\t\t\t\t}).length % 2 == 1) {\n\t\t\t\t\treturn BreakLastRegional;\n\t\t\t\t} else {\n\t\t\t\t\treturn BreakPenultimateRegional;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// GB3. CR X LF\n\t\t\tif (previous == CR && next == LF) {\n\t\t\t\treturn NotBreak;\n\t\t\t}\n\t\t\t// GB4. (Control|CR|LF) ÷\n\t\t\telse if (previous == Control || previous == CR || previous == LF) {\n\t\t\t\t\tif (next == E_Modifier && mid.every(function (c) {\n\t\t\t\t\t\treturn c == Extend;\n\t\t\t\t\t})) {\n\t\t\t\t\t\treturn Break;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn BreakStart;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// GB5. ÷ (Control|CR|LF)\n\t\t\t\telse if (next == Control || next == CR || next == LF) {\n\t\t\t\t\t\treturn BreakStart;\n\t\t\t\t\t}\n\t\t\t\t\t// GB6. L X (L|V|LV|LVT)\n\t\t\t\t\telse if (previous == L && (next == L || next == V || next == LV || next == LVT)) {\n\t\t\t\t\t\t\treturn NotBreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// GB7. (LV|V) X (V|T)\n\t\t\t\t\t\telse if ((previous == LV || previous == V) && (next == V || next == T)) {\n\t\t\t\t\t\t\t\treturn NotBreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// GB8. (LVT|T) X (T)\n\t\t\t\t\t\t\telse if ((previous == LVT || previous == T) && next == T) {\n\t\t\t\t\t\t\t\t\treturn NotBreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// GB9. X (Extend|ZWJ)\n\t\t\t\t\t\t\t\telse if (next == Extend || next == ZWJ) {\n\t\t\t\t\t\t\t\t\t\treturn NotBreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// GB9a. X SpacingMark\n\t\t\t\t\t\t\t\t\telse if (next == SpacingMark) {\n\t\t\t\t\t\t\t\t\t\t\treturn NotBreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// GB9b. Prepend X\n\t\t\t\t\t\t\t\t\t\telse if (previous == Prepend) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn NotBreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t// GB10. (E_Base | EBG) Extend* ?\tE_Modifier\n\t\t\tvar previousNonExtendIndex = all.indexOf(Extend) != -1 ? all.lastIndexOf(Extend) - 1 : all.length - 2;\n\t\t\tif ([E_Base, E_Base_GAZ].indexOf(all[previousNonExtendIndex]) != -1 && all.slice(previousNonExtendIndex + 1, -1).every(function (c) {\n\t\t\t\treturn c == Extend;\n\t\t\t}) && next == E_Modifier) {\n\t\t\t\treturn NotBreak;\n\t\t\t}\n\n\t\t\t// GB11. ZWJ ? (Glue_After_Zwj | EBG)\n\t\t\tif (previous == ZWJ && [Glue_After_Zwj, E_Base_GAZ].indexOf(next) != -1) {\n\t\t\t\treturn NotBreak;\n\t\t\t}\n\n\t\t\t// GB12. ^ (RI RI)* RI ? RI\n\t\t\t// GB13. [^RI] (RI RI)* RI ? RI\n\t\t\tif (mid.indexOf(Regional_Indicator) != -1) {\n\t\t\t\treturn Break;\n\t\t\t}\n\t\t\tif (previous == Regional_Indicator && next == Regional_Indicator) {\n\t\t\t\treturn NotBreak;\n\t\t\t}\n\n\t\t\t// GB999. Any ? Any\n\t\t\treturn BreakStart;\n\t\t}", "function codeBlock(breaker){\n while (next()) {\n white();\n switch (ch) {\n case breaker :\n return;\n case '(' :\n codeBlock(')');\n break;\n case '[' :\n codeBlock(']');\n break;\n case '{' :\n codeBlock('}');\n break;\n case '\"' :\n case \"'\" :\n string(ch);\n at--;\n }\n }\n error('Unexpected end of code');\n }", "async breakLease(breakPeriod, options = {}) {\n var _a, _b, _c, _d, _e, _f;\n const { span, updatedOptions } = createSpan(\"BlobLeaseClient-breakLease\", options);\n if (this._isContainer &&\n ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) ||\n (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) ||\n ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) {\n throw new RangeError(\"The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable.\");\n }\n try {\n const operationOptions = Object.assign({ abortSignal: options.abortSignal, breakPeriod, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions));\n return await this._containerOrBlobOperation.breakLease(operationOptions);\n }\n catch (e) {\n span.setStatus({\n code: coreTracing.SpanStatusCode.ERROR,\n message: e.message,\n });\n throw e;\n }\n finally {\n span.end();\n }\n }", "async breakLease(breakPeriod, options = {}) {\n var _a, _b, _c, _d, _e, _f;\n const { span, updatedOptions } = createSpan(\"BlobLeaseClient-breakLease\", options);\n if (this._isContainer &&\n ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) ||\n (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) ||\n ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) {\n throw new RangeError(\"The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable.\");\n }\n try {\n const operationOptions = Object.assign({ abortSignal: options.abortSignal, breakPeriod, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions));\n return await this._containerOrBlobOperation.breakLease(operationOptions);\n }\n catch (e) {\n span.setStatus({\n code: coreTracing.SpanStatusCode.ERROR,\n message: e.message,\n });\n throw e;\n }\n finally {\n span.end();\n }\n }", "break(dir = 'both'){\n if (dir === 'next'){\n if (this.next != null){\n this.next.last = null;\n this.next = null;\n }\n }else if (dir === 'last'){\n if (this.last != null){\n this.last.next = null;\n this.last = null;\n }\n }else if(dir === 'both'){\n if (this.last != null){\n this.last.next = null;\n this.last = null;\n }\n if (this.next != null){\n this.next.last = null;\n this.next = null;\n }\n }\n }", "function startBreak(){\n //set that user is on a break\n isOnBreak = true;\n breakNumber = breakNow + 1;\n breakNow = breakNumber;\n if(breakNow !== 3) {\n //short break time\n itsTimeFor.text('Just a short break.');\n minutes.text('00');\n seconds.text('06');\n }\n else {\n //long break time\n itsTimeFor.text('You get a longer break!');\n minutes.text('00');\n seconds.text('07');\n breakNow = 0;\n }\n breakButton.hide();\n startTimer();\n }", "function startBreak() {\n stopTimer();\n var duration;\n if (Vars.PomoSetCounter == Vars.UserData.PomoSetNum) {\n duration = 60 * Vars.UserData.LongBreakDuration\n } else {\n duration = 60 * Vars.UserData.BreakDuration;\n }\n stopTimer();\n Vars.TimerRunnig = true;\n Vars.onBreak = true;\n startTimer(duration, duringBreak, breakEnds);\n}", "if (/*ret DOES NOT contain any hint on any of the arguments (lock is cracked)*/) {\n break; //Break loop (since further attempts are not neccessary)\n }", "function foretellBreak()\n\t\t\t{\n\t\t\t\tfor (n = tempPosition; n < dialogueLabel.text.length; n++){\n\t\t\t\t\tif (dialogueLabel.text[n] == \"^\"){\n\t\t\t\t\t\ttempPosition = n;\n\t\t\t\t\t\ttempLabel.text = dialogueLabel.text.substring(0, tempPosition);\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}", "function skipToBreak() {\n stopAmbientSound();\n stopTimer();\n var title = \"Time's Up\";\n var msg = \"Take a break\";\n Vars.PomoSetCounter++; //Updae set counter\n startBreak();\n notify(title, msg);\n}", "break() {\n this.write('log', '', null, false);\n }", "function do_chapter_break( opt )\n{\n\tfunction do_one_ref( ref )\n\t{\n\t\t// Insert the break early\n\t\tif ( opt.early )\n\t\t{\n\t\t\tif ( ref.c === opt.c && ref.v >= opt.v )\n\t\t\t{\n\t\t\t\tref.c++;\n\t\t\t\tref.v -= opt.v - 1;\n\t\t\t}\n\t\t\telse if ( ref.c === opt.c + 1 )\n\t\t\t{\n\t\t\t\tref.v += opt.count;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( ref.c === opt.c + 1 )\n\t\t\t{\n\t\t\t\tref.v -= opt.count;\n\t\t\t\tif ( ref.v < 1 )\n\t\t\t\t{\n\t\t\t\t\tref.c--;\n\t\t\t\t\tref.v += opt.v + opt.count - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdo_one_ref( opt.entity.start );\n\tdo_one_ref( opt.entity.end );\n}", "get simulatedBreak() {\n return this.options.simulateBreak || null;\n }", "function reduceBreak() {\n setBreakTime(prevTime => prevTime > 1 ? prevTime - 1 : prevTime);\n }", "break(action) {\n return Promise.resolve();\n }", "if (/*ret DOES NOT contain any hint on the result (lock is cracked)*/) {\n break; //Break loop (since further attempts are not neccessary)\n }", "function removeLastBreak() {\n message.setBreak( false );\n}", "function addBreak() {\n setBreakTime(prevTime => prevTime < 15 ? prevTime + 1 : prevTime);\n }", "function end_loop() {\r\n\tlet frame = stack.pop();\r\n\r\n\tlet new_index = frame.index_array[frame.index_index] + frame.step;\r\n\r\n\tframe.index_array[frame.index_index] = new_index;\r\n\r\n\tif (new_index <= frame.end_value) {\r\n\t\tstack.push(frame);\r\n\t\tPC = frame.pc;\r\n\t\treturn true;\r\n\t}\r\n\telse\r\n\t\treturn false;\r\n}", "exitWhile_stmt(ctx) {\n\t}", "onBreaking(i, j, source) {\n\t\tvar block = this.get(i, j);\n\t\tvar stoneCost = block.stoneCost;\n\t\tvar pl;\n\t\tif(source.side == 0) pl = rooms[this.room].players[source.gameId];\n\t\telse pl = rooms[this.room].viruses[source.gameId];\n\t\tif(pl) {\n\t\t\tpl.workers++;\n\t\t\tpl.stone += stoneCost;\n\t\t}\n\t\tif(this.checkCoords(i, j - 1) && this.get(i, j - 1).needBlock) {\n\t\t\tthis.breakBlock(i, j - 1, source);\n\t\t\tif(pl) {\n\t\t\t\tpl.workers--;\n\t\t\t}\n\t\t}\n\t\t// if(block.owner >= 0) {\n\t\t// \tvar owner = rooms[this.room].network[block.owner];\n\t\t// \tif(owner.side == 0) {\n\t\t// \t\towner = rooms[owner.room].players[owner.gameId];\n\t\t// \t}\n\t\t// \telse {\n\t\t// \t\towner = rooms[owner.room].viruses[owner.gameId];\n\n\t\t// \t\tif(owner.core.rpos.x == i && owner.core.rpos.y == j) {\n\t\t// \t\t\towner.alive = false;\n\t\t// \t\t}\n\t\t// \t}\n\t\t// }\n\t\tblock.id = 0;\n\t}", "jump() {\n\t\t// \n\t}", "function break_function() {\n var testV = 1;\n var pass1 = prompt('Please Enter Your Password','password');\n while (testV < 3) {\n if (pass1.toLowerCase() == \"letmein\") {\n break_rn = prompt(\"Which room would you like to add break time for?\");\n tbr = prompt(\"How long is the break time?\");\n for (var i = 0; i < rooms.length; i++) {\n if(break_rn == rooms[i].number){\n rooms[i].breakTime = tbr;\n break;\n }\n }\n loadRooms();\n break;\n } \n else {\n testV+=1;\n var pass1 = prompt('Access Denied - Password Incorrect, Please Try Again.','Password');\n }\n }\n //end while loop\n if (pass1.toLowerCase()!=\"password\" & testV ==3) \n history.go(-1);\n return \" \";\n}", "function ConditionBlock(entry, buffer, os) {\n // find out if there's anything before it on the same line. If there is,\n // and it's not a semi colon\n // it's not a block at all, just set the exit at the end of the line.\n let ch;\n let ros = os - 1;\n while ((ch = buffer[ros]) && ~_nb_white.indexOf(ch)) ros--;\n\n // if there is and it's not a ';' then it's not a block at all,\n // just set the exit at the end of the line\n if (~_eol.indexOf(ch)) {\n os += entry.length;\n while ((ch = buffer[os]) && !~_eol.indexOf(ch) && ch !== '#') os++;\n return {\n end: os\n };\n }\n // It's just a block then\n return Block(entry, buffer, os);\n}", "halt() {\n if (this.continuing_) {\n this.completeContinue_(false);\n }\n }", "function breakStage() {\r\n\t\ttimePassed = 0;\r\n\t\t$(\"#timeDisplay\").html($(\"#break\").html() + \":00\");\r\n\t\tstartTime = $(\"#break\").html() * 60;\r\n\t\t$(\"#timerType\").html(\"Break Time\");\r\n\t\tclearInterval(countdown);\r\n\t}", "implicitReturnWillBreak(): boolean {\n if (this.willPatchAsExpression()) {\n return false;\n } else {\n return super.implicitReturnWillBreak();\n }\n }", "function takeBreak(time) {\n //We have to return the id returned from the invocation of setInterval\n return setInterval(function() {alert(\"Take a break!\")}, time)\n }", "emergencyBreak() {\n this.node.report(\"item processor for item: \" + this.itemId + \" from parcel: \" + this.parcelId +\n \" :: emergencyBreak, state \" + this.processingState.val + \" itemState: \" + this.record.state.val,\n VerboseLevel.BASE);\n\n let doRollback = !this.processingState.isDone;\n\n this.processingState = ItemProcessingState.EMERGENCY_BREAK;\n\n this.stopDownloader();\n this.stopPoller();\n this.stopConsensusReceivedChecker();\n\n for (let ri of this.resyncingItems.values())\n if (!ri.isCommitFinished())\n ri.closeByTimeout();\n\n if (doRollback)\n this.rollback();\n else\n this.close();\n\n this.processingState = ItemProcessingState.FINISHED;\n }", "function bail(errstr) {\n console.error('%s: %s', MODNAME, errstr)\n next()\n }", "function peekLineTerminator$928() {\n return lookahead$891.lineNumber !== lineNumber$881;\n }", "insertBreak(editor) {\n editor.insertBreak();\n }", "insertBreak(editor) {\n editor.insertBreak();\n }", "_killswitch() {\n return;\n }", "handleStopOnEntryBreakpointAndContinue(notification) {\n return __awaiter(this, void 0, void 0, function* () {\n const hitBreakpoints = notification.hitBreakpoints;\n let allStopOnEntryBreakpoints = true;\n const pausedScriptId = notification.callFrames[0].location.scriptId;\n const pausedScriptUrl = this._chromeDebugAdapter.scriptsById.get(pausedScriptId).url;\n const mappedUrl = yield this._chromeDebugAdapter.pathTransformer.scriptParsed(pausedScriptUrl);\n // If there is a breakpoint which is not a stopOnEntry breakpoint, we appear as if we hit that one\n // This is particularly done for cases when we end up with a user breakpoint and a stopOnEntry breakpoint on the same line\n for (let bp of hitBreakpoints) {\n let regexAndFileNames = this._stopOnEntryBreakpointIdToRequestedFileName.get(bp);\n if (!regexAndFileNames) {\n notification.hitBreakpoints = [bp];\n allStopOnEntryBreakpoints = false;\n }\n else {\n const normalizedMappedUrl = __1.utils.canonicalizeUrl(mappedUrl);\n if (regexAndFileNames.fileSet.has(normalizedMappedUrl)) {\n regexAndFileNames.fileSet.delete(normalizedMappedUrl);\n assert(this._stopOnEntryRequestedFileNameToBreakpointId.delete(normalizedMappedUrl), `Expected to delete break-on-load information associated with url: ${normalizedMappedUrl}`);\n if (regexAndFileNames.fileSet.size === 0) {\n vscode_debugadapter_1.logger.log(`Stop on entry breakpoint hit for last remaining file. Removing: ${bp} created for: ${normalizedMappedUrl}`);\n yield this.removeBreakpointById(bp);\n assert(this._stopOnEntryRegexToBreakpointId.delete(regexAndFileNames.urlRegex), `Expected to delete break-on-load information associated with regexp: ${regexAndFileNames.urlRegex}`);\n }\n else {\n vscode_debugadapter_1.logger.log(`Stop on entry breakpoint hit but still has remaining files. Keeping: ${bp} that was hit for: ${normalizedMappedUrl} because it's still needed for: ${Array.from(regexAndFileNames.fileSet.entries()).join(', ')}`);\n }\n }\n }\n }\n // If all the breakpoints on this point are stopOnEntry breakpoints\n // This will be true in cases where it's a single breakpoint and it's a stopOnEntry breakpoint\n // This can also be true when we have multiple breakpoints and all of them are stopOnEntry breakpoints, for example in cases like index.js and index.bin.js\n // Suppose user puts breakpoints in both index.js and index.bin.js files, when the setBreakpoints function is called for index.js it will set a stopOnEntry\n // breakpoint on index.* files which will also match index.bin.js. Now when setBreakpoints is called for index.bin.js it will again put a stopOnEntry breakpoint\n // in itself. So when the file is actually loaded, we would have 2 stopOnEntry breakpoints */\n if (allStopOnEntryBreakpoints) {\n const pausedLocation = notification.callFrames[0].location;\n let shouldContinue = yield this.shouldContinueOnStopOnEntryBreakpoint(pausedLocation);\n if (shouldContinue) {\n return true;\n }\n }\n return false;\n });\n }" ]
[ "0.8167032", "0.73771197", "0.72918534", "0.72918534", "0.72918534", "0.72918534", "0.7251158", "0.7251158", "0.7250289", "0.7212528", "0.7212528", "0.7212528", "0.7203497", "0.7202599", "0.7123717", "0.711589", "0.711589", "0.711589", "0.7108482", "0.7108415", "0.7108415", "0.7102336", "0.70717573", "0.6985504", "0.69836986", "0.69659376", "0.69367397", "0.6893437", "0.6893437", "0.6893437", "0.6893437", "0.6766635", "0.6562957", "0.65110856", "0.6363912", "0.6303469", "0.6284572", "0.6282119", "0.62252593", "0.62051314", "0.6133878", "0.6001983", "0.595223", "0.595223", "0.59371567", "0.58914334", "0.5864741", "0.5847697", "0.5831741", "0.5820175", "0.57917583", "0.57814455", "0.57573694", "0.56958485", "0.5668677", "0.5663341", "0.5635605", "0.56136245", "0.5591539", "0.5583217", "0.5567032", "0.55587995", "0.55391306", "0.5537632", "0.5537632", "0.55236197", "0.5479731", "0.5473479", "0.5455574", "0.54546475", "0.5451213", "0.54504067", "0.53928167", "0.53871995", "0.5380005", "0.5376644", "0.5375414", "0.5361354", "0.53303427", "0.5310545", "0.5295353", "0.52917135", "0.52597594", "0.5252874", "0.5229414", "0.52111155", "0.5210641", "0.5194034", "0.5182719", "0.51309466", "0.5114833", "0.51127505", "0.5106306", "0.5106306", "0.50928396", "0.5081809" ]
0.7195099
18
12.9 The return statement
function parseReturnStatement() { var argument = null; expectKeyword('return'); if (!state.inFunctionBody) { throwErrorTolerant({}, Messages.IllegalReturn); } // 'return' followed by a space and an identifier is very common. if (source.charCodeAt(index) === 0x20) { if (isIdentifierStart(source.charCodeAt(index + 1))) { argument = parseExpression(); consumeSemicolon(); return delegate.createReturnStatement(argument); } } if (peekLineTerminator()) { return delegate.createReturnStatement(null); } if (!match(';')) { if (!match('}') && lookahead.type !== Token.EOF) { argument = parseExpression(); } } consumeSemicolon(); return delegate.createReturnStatement(argument); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Te(){var e=null;\n// 'return' followed by a space and an identifier is very common.\n// 'return' followed by a space and an identifier is very common.\nreturn G(\"return\"),mt.inFunctionBody||q({},rt.IllegalReturn),32===at.charCodeAt(lt)&&s(at.charCodeAt(lt+1))?(e=ge(),H(),pt.createReturnStatement(e)):U()?pt.createReturnStatement(null):(Z(\";\")||Z(\"}\")||dt.type===Xe.EOF||(e=ge()),H(),pt.createReturnStatement(e))}", "function emptyReturn() {return;}", "function returnFunction() {\r\n // return 1+1; // will return undefined.\r\n return 1+1;\r\n}", "returnStatement() {\n let tokens = { return: this.previous() };\n if (this.checkEndOfStatement()) {\n return new Statement_1.ReturnStatement(tokens);\n }\n let toReturn = this.check(TokenKind_1.TokenKind.Else) ? undefined : this.expression();\n return new Statement_1.ReturnStatement(tokens, toReturn);\n }", "function noReturn() {}", "function parseReturnStatement$992() {\n var argument$1442 = null;\n expectKeyword$933('return');\n if (!state$893.inFunctionBody) {\n throwErrorTolerant$930({}, Messages$874.IllegalReturn);\n }\n // 'return' followed by a space and an identifier is very common.\n if (isIdentifierStart$902(String(lookahead$891.value).charCodeAt(0))) {\n argument$1442 = parseExpression$969();\n consumeSemicolon$938();\n return delegate$888.createReturnStatement(argument$1442);\n }\n if (peekLineTerminator$928()) {\n return delegate$888.createReturnStatement(null);\n }\n if (!match$934(';')) {\n if (!match$934('}') && lookahead$891.type !== Token$869.EOF) {\n argument$1442 = parseExpression$969();\n }\n }\n consumeSemicolon$938();\n return delegate$888.createReturnStatement(argument$1442);\n }", "function dummyReturn(){\n}", "function returnTwo() {\n\treturn 2;\n}", "function return4 () {\n return 4;\n}", "function test4(num1, num2) {\n return num2; //num2 will be returned only and next return will not be returned because once the function identifies the first return statement the execution of the function stops.\n return num1 * num2;\n}", "function test() {\n console.log('Hi Roman');\n return 'return'; \n}", "ret() {\r\n return 0x00EE;\r\n }", "function returnTrue() {\n\t\t\treturn true;\n\t\t}", "function returnTrue() {\n\t\t\treturn true;\n\t\t}", "function returnTrue() {\n\t\t\treturn true;\n\t\t}", "function returnTrue() {\n\t\t\treturn true;\n\t\t}", "function parseReturnStatement() {\n var argument = null, marker = markerCreate();\n \n expectKeyword('return');\n \n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n \n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 32) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return markerApply(marker, delegate.createReturnStatement(argument));\n }\n }\n \n if (peekLineTerminator()) {\n return markerApply(marker, delegate.createReturnStatement(null));\n }\n \n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n \n consumeSemicolon();\n \n return markerApply(marker, delegate.createReturnStatement(argument));\n }", "function one(){\n\n return 'ONE';\n\n // Nothing after 'return' gets executed\n console.log('THIS WILL NOT WORK!');\n\n}", "function pastThePointOfReturn() {\n return \"I'm done!\";\n console.log(\"This will not be printed\");\n}", "function returnTwo() {\n return 2;\n }", "function returnTwo() {\n return 2\n}", "function myFun() {\n console.log(\"Hello\");\n return \"world\";\n console.log(\"byebye\");\n}", "function parseReturnStatement() {\n var argument = null, marker = markerCreate();\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 32) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return markerApply(marker, delegate.createReturnStatement(argument));\n }\n }\n\n if (peekLineTerminator()) {\n return markerApply(marker, delegate.createReturnStatement(null));\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createReturnStatement(argument));\n }", "function parseReturnStatement() {\n var argument = null, marker = markerCreate();\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 32) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return markerApply(marker, delegate.createReturnStatement(argument));\n }\n }\n\n if (peekLineTerminator()) {\n return markerApply(marker, delegate.createReturnStatement(null));\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createReturnStatement(argument));\n }", "function parseReturnStatement() {\n var argument = null, marker = markerCreate();\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 32) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return markerApply(marker, delegate.createReturnStatement(argument));\n }\n }\n\n if (peekLineTerminator()) {\n return markerApply(marker, delegate.createReturnStatement(null));\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createReturnStatement(argument));\n }", "function parseReturnStatement() {\n var argument = null, marker = markerCreate();\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 32) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return markerApply(marker, delegate.createReturnStatement(argument));\n }\n }\n\n if (peekLineTerminator()) {\n return markerApply(marker, delegate.createReturnStatement(null));\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createReturnStatement(argument));\n }", "function parseReturnStatement() {\n var argument = null, marker = markerCreate();\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 32) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return markerApply(marker, delegate.createReturnStatement(argument));\n }\n }\n\n if (peekLineTerminator()) {\n return markerApply(marker, delegate.createReturnStatement(null));\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createReturnStatement(argument));\n }", "function parseReturnStatement() {\n var argument = null, marker = markerCreate();\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 32) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return markerApply(marker, delegate.createReturnStatement(argument));\n }\n }\n\n if (peekLineTerminator()) {\n return markerApply(marker, delegate.createReturnStatement(null));\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createReturnStatement(argument));\n }", "function foo() {\n return \"hi\"\n return 2.312\n return 12\n return 0x12\n return true\n return undefined\n return null\n}", "function return5(){\n\treturn 5;\n}", "function parseReturnStatement(node)\n\t\t{\n\t\t\tvar argument = null;\n\t\t\texpectKeyword('return');\n\t\t\tif (!state.inFunctionBody)\n\t\t\t{\n\t\t\t\ttolerateError(Messages.IllegalReturn);\n\t\t\t}\n\t\t\t// 'return' followed by a space and an identifier is very common.\n\t\t\tif (source.charCodeAt(index) === 0x20)\n\t\t\t{\n\t\t\t\tif (isIdentifierStart(source.charCodeAt(index + 1)))\n\t\t\t\t{\n\t\t\t\t\targument = parseExpression();\n\t\t\t\t\tconsumeSemicolon();\n\t\t\t\t\treturn node.finishReturnStatement(argument);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (peekLineTerminator())\n\t\t\t{\n\t\t\t\treturn node.finishReturnStatement(null);\n\t\t\t}\n\t\t\tif (!match(';'))\n\t\t\t{\n\t\t\t\tif (!match('}') && lookahead.type !== Token.EOF)\n\t\t\t\t{\n\t\t\t\t\targument = parseExpression();\n\t\t\t\t}\n\t\t\t}\n\t\t\tconsumeSemicolon();\n\t\t\treturn node.finishReturnStatement(argument);\n\t\t}", "function ex2(){\n let first = 12\n return first // return \n }", "function add(num1, num2){\n console.log(num1+num2);\n return ; // <--- ki return korbe bola nai\n}", "function sayHi() {\n console.log(`hi`)\n return 10\n}", "function parseReturnStatement() {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 32) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return delegate.createReturnStatement(argument);\n }\n }\n\n if (peekLineTerminator()) {\n return delegate.createReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return delegate.createReturnStatement(argument);\n }", "function parseReturnStatement() {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 32) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return delegate.createReturnStatement(argument);\n }\n }\n\n if (peekLineTerminator()) {\n return delegate.createReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return delegate.createReturnStatement(argument);\n }", "function parseReturnStatement() {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 32) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return delegate.createReturnStatement(argument);\n }\n }\n\n if (peekLineTerminator()) {\n return delegate.createReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return delegate.createReturnStatement(argument);\n }", "parseReturn() {\n\t\t// skip the keyword\n\t\tthis.skip('keyword', 'ret');\n\n\t\tif (this.currentFunction === null) {\n\t\t\tthrow new ParserError(\n\t\t\t\t'E0003',\n\t\t\t\t'ReturnScopeError',\n\t\t\t\t'Unexpected return statement, \\'ret\\' should always be placed inside a function block.', \n\t\t\t\tthis.peek().position.line, \n\t\t\t\tthis.peek().position.column, \n\t\t\t\tthis.peek(),\n\t\t\t\tthis.module\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\ttype: 'returnStatement',\n\t\t\texpression: this.parseExpression()\n\t\t};\n\t}", "static returnStatement(value) {\r\n return (writer) => {\r\n writer.write(\"return \");\r\n writer.withHangingIndentationUnlessBlock(() => {\r\n writeValue(writer, value);\r\n writer.write(\";\");\r\n });\r\n };\r\n }", "function foo() {\n return;\n}", "function parseReturnStatement() {\n var token, argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source[index] === ' ') {\n if (isIdentifierStart(source[index + 1])) {\n argument = parseExpression();\n consumeSemicolon();\n return {\n type: Syntax.ReturnStatement,\n argument: argument\n };\n }\n }\n\n if (peekLineTerminator()) {\n return {\n type: Syntax.ReturnStatement,\n argument: null\n };\n }\n\n if (!match(';')) {\n token = lookahead();\n if (!match('}') && token.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return {\n type: Syntax.ReturnStatement,\n argument: argument\n };\n }", "function parseReturnStatement() {\n var token, argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source[index] === ' ') {\n if (isIdentifierStart(source[index + 1])) {\n argument = parseExpression();\n consumeSemicolon();\n return {\n type: Syntax.ReturnStatement,\n argument: argument\n };\n }\n }\n\n if (peekLineTerminator()) {\n return {\n type: Syntax.ReturnStatement,\n argument: null\n };\n }\n\n if (!match(';')) {\n token = lookahead();\n if (!match('}') && token.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return {\n type: Syntax.ReturnStatement,\n argument: argument\n };\n }", "function parseReturnStatement() {\n var token, argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source[index] === ' ') {\n if (isIdentifierStart(source[index + 1])) {\n argument = parseExpression();\n consumeSemicolon();\n return {\n type: Syntax.ReturnStatement,\n argument: argument\n };\n }\n }\n\n if (peekLineTerminator()) {\n return {\n type: Syntax.ReturnStatement,\n argument: null\n };\n }\n\n if (!match(';')) {\n token = lookahead();\n if (!match('}') && token.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return {\n type: Syntax.ReturnStatement,\n argument: argument\n };\n }", "function parseReturnStatement() {\n var token, argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source[index] === ' ') {\n if (isIdentifierStart(source[index + 1])) {\n argument = parseExpression();\n consumeSemicolon();\n return {\n type: Syntax.ReturnStatement,\n argument: argument\n };\n }\n }\n\n if (peekLineTerminator()) {\n return {\n type: Syntax.ReturnStatement,\n argument: null\n };\n }\n\n if (!match(';')) {\n token = lookahead();\n if (!match('}') && token.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return {\n type: Syntax.ReturnStatement,\n argument: argument\n };\n }", "function parseReturnStatement() {\n var token, argument = null;\n\n expectKeyword('return');\n\n if (!inFunctionBody) {\n throwErrorTolerant({}, Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source[index] === ' ') {\n if (isIdentifierStart(source[index + 1])) {\n argument = parseExpression();\n consumeSemicolon();\n return {\n type: Syntax.ReturnStatement,\n argument: argument\n };\n }\n }\n\n if (peekLineTerminator()) {\n return {\n type: Syntax.ReturnStatement,\n argument: null\n };\n }\n\n if (!match(';')) {\n token = lookahead();\n if (!match('}') && token.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return {\n type: Syntax.ReturnStatement,\n argument: argument\n };\n }", "function parseReturnStatement(node) {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n tolerateError(Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(lastIndex) === 0x20) {\n if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return node.finishReturnStatement(argument);\n }\n }\n\n if (hasLineTerminator) {\n // HACK\n return node.finishReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return node.finishReturnStatement(argument);\n }", "function returnType(arg) {\n return arg;\n}", "function returnObject()\n{\n if(someTrueThing)\n {\n return // <- Here will be introduce the automatically semi-colon\n {\n hi: 'hello'\n }\n }\n}", "function noResult(arg1, arg2){\r\n result = arg1 + arg2\r\n //we omit the return here\r\n}", "function returnBlock(expr) {\n\t return t.blockStatement([t.returnStatement(expr)]);\n\t}", "function returnBlock(expr) {\n\t return t.blockStatement([t.returnStatement(expr)]);\n\t}", "function a(b) {\r\n if (b < 10) {\r\n return 2;\r\n } else {\r\n return 4;\r\n }\r\n console.log(b);\r\n}", "function DefaultReturnValue() {}", "function returnSomething(value){\n\t\tconsole.log('c');\n\t\treturn value;\n\t}", "function returnFalse() {\n\t\treturn false;\n\t}", "function a(b){\n if(b<10) {\n return 2;\n }\n    else {\n return 4;\n }\n console.log(b);\n}", "function a(b){\n if(b<10) {\n return 2;\n }\n    else {\n return 4;\n }\n console.log(b);\n}", "function a(b) {\n if (b < 10) {\n return 2;\n }\n else {\n return 4;\n }\n console.log(b);\n}", "function returnFalse() {\n\treturn false;\n}", "function test() {\n\treturn console.log(true);\n\treturn console.log(false);\n}", "function a(b) {\n if (b < 10) {\n return 2;\n } else {\n return 4;\n }\n console.log(b);\n}", "function a(b) {\n if (b < 10) {\n return 2;\n } else {\n return 4;\n }\n console.log(b);\n}", "function parseReturnStatement(node) {\n\t var argument = null;\n\n\t expectKeyword('return');\n\n\t if (!state.inFunctionBody) {\n\t tolerateError(Messages.IllegalReturn);\n\t }\n\n\t // 'return' followed by a space and an identifier is very common.\n\t if (source.charCodeAt(lastIndex) === 0x20) {\n\t if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {\n\t argument = parseExpression();\n\t consumeSemicolon();\n\t return node.finishReturnStatement(argument);\n\t }\n\t }\n\n\t if (hasLineTerminator) {\n\t // HACK\n\t return node.finishReturnStatement(null);\n\t }\n\n\t if (!match(';')) {\n\t if (!match('}') && lookahead.type !== Token.EOF) {\n\t argument = parseExpression();\n\t }\n\t }\n\n\t consumeSemicolon();\n\n\t return node.finishReturnStatement(argument);\n\t }", "function a1(){\n\treturn 1;\n}", "function parseReturnStatement(node) {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n tolerateError(Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(lastIndex) === 0x20) {\n if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return node.finishReturnStatement(argument);\n }\n }\n\n if (hasLineTerminator) {\n // HACK\n return node.finishReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return node.finishReturnStatement(argument);\n }", "function parseReturnStatement(node) {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n tolerateError(Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(lastIndex) === 0x20) {\n if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return node.finishReturnStatement(argument);\n }\n }\n\n if (hasLineTerminator) {\n // HACK\n return node.finishReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return node.finishReturnStatement(argument);\n }", "function parseReturnStatement(node) {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n tolerateError(Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(lastIndex) === 0x20) {\n if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return node.finishReturnStatement(argument);\n }\n }\n\n if (hasLineTerminator) {\n // HACK\n return node.finishReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return node.finishReturnStatement(argument);\n }", "function parseReturnStatement(node) {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n tolerateError(Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(lastIndex) === 0x20) {\n if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return node.finishReturnStatement(argument);\n }\n }\n\n if (hasLineTerminator) {\n // HACK\n return node.finishReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return node.finishReturnStatement(argument);\n }", "function parseReturnStatement(node) {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n tolerateError(Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(lastIndex) === 0x20) {\n if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return node.finishReturnStatement(argument);\n }\n }\n\n if (hasLineTerminator) {\n // HACK\n return node.finishReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return node.finishReturnStatement(argument);\n }", "function returnArg() {\n\treturn arg;\n}", "function attempt() {\r\n return \"I have thrown by return\"\r\n}", "function sayHello() {\n console.log('hello'); // no return\n}", "function parseReturnStatement(node) {\n var argument = null;\n\n expectKeyword('return');\n\n if (!state.inFunctionBody) {\n tolerateError(Messages.IllegalReturn);\n }\n\n // 'return' followed by a space and an identifier is very common.\n if (source.charCodeAt(index) === 0x20) {\n if (isIdentifierStart(source.charCodeAt(index + 1))) {\n argument = parseExpression();\n consumeSemicolon();\n return node.finishReturnStatement(argument);\n }\n }\n\n if (peekLineTerminator()) {\n return node.finishReturnStatement(null);\n }\n\n if (!match(';')) {\n if (!match('}') && lookahead.type !== Token.EOF) {\n argument = parseExpression();\n }\n }\n\n consumeSemicolon();\n\n return node.finishReturnStatement(argument);\n }", "function evaluateReturnStatement({ node, environment, evaluate, stack, reporting, statementTraversalStack }) {\n setInLexicalEnvironment({ env: environment, path: RETURN_SYMBOL, value: true, reporting, node });\n // If it is a simple 'return', return undefined\n if (node.expression == null) {\n stack.push(undefined);\n }\n else {\n stack.push(evaluate.expression(node.expression, environment, statementTraversalStack));\n }\n}", "function a() {\n console.log('hello');\n return 15;\n}", "function returnHi() {\n return \"Hi!\";\n}", "function returnFalse() {\n\t\t\treturn false;\n\t\t}", "function returnFalse() {\n\t\t\treturn false;\n\t\t}", "function returnFalse() {\n\t\t\treturn false;\n\t\t}", "function returnFalse() {\n\t\t\treturn false;\n\t\t}", "function test() {\n return 1;\n }", "function exitNode(node, parent, scope, state) {\n if (node.type === 'ReturnStatement') {\n state.returnCount++;\n if (state.returnTypes == null || state.returnTypes.length === 0) {\n // we only care about typed return statements.\n return;\n }\n var validated = staticallyVerifyReturnType(node, state.returnTypes);\n if (typeof validated === 'object' && state.constants[validated.name]) {\n // the return value is a constant, let's see if we can infer the type\n var constant = state.constants[validated.name];\n var declarator = constant.path.parent.declarations[constant.path.key];\n validated = staticallyVerifyType(declarator.init, state.returnTypes);\n }\n\n if (validated === TYPE_INVALID) {\n throw this.errorWithNode('Function ' + (state.subject.id ? '\\'' + state.subject.id.name + '\\' ' : '') + 'return value violates contract, expected ' + createTypeNameList(state.returnTypes) + '.');\n } else if (validated === TYPE_VALID) {\n // no need to guard, has been statically verified.\n return;\n } else {\n if (parent.type !== 'BlockStatement' && parent.type !== \"Program\") {\n var ref = undefined;\n var block = [];\n if (node.argument === null) {\n ref = t.literal(null);\n } else if (node.argument === undefined) {\n ref = t.literal(undefined);\n } else if (node.argument.type === \"Literal\") {\n ref = node.argument;\n } else if (node.argument.type === \"Identifier\") {\n ref = node.argument;\n } else {\n ref = scope.generateUidIdentifierBasedOnNode(node.argument);\n scope.push({ id: ref });\n block.push(t.expressionStatement(t.assignmentExpression(\"=\", ref, node.argument)));\n }\n var guard = createReturnTypeGuard(ref, node, scope, state);\n if (!guard) {\n return;\n }\n block.push(guard);\n block.push(t.returnStatement(ref));\n return t.blockStatement(block);\n } else {\n var ref = createReferenceTo(this, node.argument, scope);\n var guard = createReturnTypeGuard(ref, node, scope, state);\n if (!guard) {\n return;\n }\n this.insertBefore(guard);\n return t.returnStatement(ref);\n }\n }\n } else if (node.type === 'VariableDeclaration') {\n var variableGuards = createVariableGuards(node, state.genericTypes);\n if (variableGuards.length === 0) {\n return;\n }\n if (parent.type === 'BlockStatement' || parent.type == 'Program') {\n this.insertAfter(variableGuards);\n } else if (parent.type === 'ForStatement' || parent.type === 'ForOfStatement' || parent.type === 'ForInStatement') {\n parent.body = t.blockStatement([].concat(variableGuards, parent.body.body));\n }\n // Can't insert type check here.\n }\n }", "function sum(a, b) {\n var c = a + b;\n //The return statement. A function always returns a value. If it doesn't return value explicitly, \n //it implicitly returns the value undefined.\n return c;\n}", "function returned() {\n console.log(\"The king hath returned from the hunt!\");\n}", "function f() {\n switch (1) {\n default:\n case 1:\n return 1;\n }\n }", "function add(num1, num2){\n console.log(num1 + num2);\n return // undefined as nothing is returnd\n}", "function returnHi() {\n return 'Hi!';\n}", "exitReturn_stmt(ctx) {\n\t}", "function returnBlock(expr) {\n return t.blockStatement([t.returnStatement(expr)]);\n}", "function square(x) { return x*x; } // A function that has a return statement", "function foo() {\n if (true) {\n if (true) {\n if (true) {\n throw 'error';\n } else {\n return 1;\n }\n } else {\n return 2;\n }\n } else {\n return 3;\n }\n}", "function returnMatchingParens() {\n\n}", "function a(b){\n if(b<10) {\n return 2;\n }\n else {\n return 4;\n }\n console.log(b);\n}", "function returnArg(arg) {\n return arg;\n}", "function two() {\n console.log('two');\n return 2;\n}", "function sum(a,b,c) {\n let d = a + b + c;\n return d; // returns the value of d\n // This line will never execute (Unreachable code)\n // console.log(\"Function Returned\");\n}" ]
[ "0.7398579", "0.7128506", "0.70846283", "0.70468366", "0.70187604", "0.6941721", "0.6923836", "0.6873398", "0.6865669", "0.6851207", "0.68086034", "0.6791364", "0.67525816", "0.67525816", "0.67525816", "0.67525816", "0.67394257", "0.6704941", "0.6620697", "0.6589073", "0.6583407", "0.65727055", "0.6566434", "0.6566434", "0.6566434", "0.6566434", "0.6566434", "0.6566434", "0.65503997", "0.654709", "0.65395296", "0.6518984", "0.65110874", "0.64985573", "0.6493958", "0.6493958", "0.6493958", "0.64932036", "0.64912724", "0.6471312", "0.64610815", "0.64610815", "0.64610815", "0.64610815", "0.64556164", "0.6453372", "0.6439383", "0.63860947", "0.63804317", "0.63528854", "0.63528854", "0.6339971", "0.63370353", "0.63341844", "0.63261414", "0.63086987", "0.63086987", "0.6301591", "0.629321", "0.62908053", "0.6290692", "0.6290692", "0.62892944", "0.6284403", "0.62836605", "0.62836605", "0.62836605", "0.62836605", "0.62836605", "0.6276345", "0.62748724", "0.62697816", "0.6266382", "0.6261672", "0.62572473", "0.62531245", "0.6227211", "0.6227211", "0.6227211", "0.6227211", "0.62127376", "0.62100244", "0.62095946", "0.62081003", "0.62078214", "0.6199556", "0.6176199", "0.6158381", "0.6153276", "0.61366093", "0.6136571", "0.6135325", "0.6135173", "0.6130702", "0.6116476", "0.61137164" ]
0.6491014
43
12.10 The with statement
function parseWithStatement() { var object, body; if (strict) { // TODO(ikarienator): Should we update the test cases instead? skipComment(); throwErrorTolerant({}, Messages.StrictModeWith); } expectKeyword('with'); expect('('); object = parseExpression(); expect(')'); body = parseStatement(); return delegate.createWithStatement(object, body); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseWithStatement() {\n var object, body, marker = markerCreate();\n \n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n \n expectKeyword('with');\n \n expect('(');\n \n object = parseExpression();\n \n expect(')');\n \n body = parseStatement();\n \n return markerApply(marker, delegate.createWithStatement(object, body));\n }", "function parseWithStatement$993() {\n var object$1443, body$1444;\n if (strict$879) {\n throwErrorTolerant$930({}, Messages$874.StrictModeWith);\n }\n expectKeyword$933('with');\n expect$932('(');\n object$1443 = parseExpression$969();\n expect$932(')');\n body$1444 = parseStatement$1000();\n return delegate$888.createWithStatement(object$1443, body$1444);\n }", "function parseWithStatement() {\n var object, body, marker = markerCreate();\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return markerApply(marker, delegate.createWithStatement(object, body));\n }", "function parseWithStatement() {\n var object, body, marker = markerCreate();\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return markerApply(marker, delegate.createWithStatement(object, body));\n }", "function parseWithStatement() {\n var object, body, marker = markerCreate();\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return markerApply(marker, delegate.createWithStatement(object, body));\n }", "function parseWithStatement() {\n var object, body, marker = markerCreate();\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return markerApply(marker, delegate.createWithStatement(object, body));\n }", "function parseWithStatement() {\n var object, body, marker = markerCreate();\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return markerApply(marker, delegate.createWithStatement(object, body));\n }", "function parseWithStatement() {\n var object, body, marker = markerCreate();\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return markerApply(marker, delegate.createWithStatement(object, body));\n }", "function parseWithStatement(node) {\n var object, body;\n\n if (strict) {\n tolerateError(Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return node.finishWithStatement(object, body);\n }", "function parseWithStatement() {\n var object, body;\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return delegate.createWithStatement(object, body);\n }", "function parseWithStatement() {\n var object, body;\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return delegate.createWithStatement(object, body);\n }", "function parseWithStatement() {\n var object, body;\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return delegate.createWithStatement(object, body);\n }", "function parseWithStatement() {\n var object, body;\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return delegate.createWithStatement(object, body);\n }", "function parseWithStatement(node) {\n\t var object, body;\n\n\t if (strict) {\n\t tolerateError(Messages.StrictModeWith);\n\t }\n\n\t expectKeyword('with');\n\n\t expect('(');\n\n\t object = parseExpression();\n\n\t expect(')');\n\n\t body = parseStatement();\n\n\t return node.finishWithStatement(object, body);\n\t }", "function parseWithStatement(node) {\n var object, body;\n\n if (strict) {\n tolerateError(Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return node.finishWithStatement(object, body);\n }", "function parseWithStatement(node) {\n var object, body;\n\n if (strict) {\n tolerateError(Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return node.finishWithStatement(object, body);\n }", "function parseWithStatement(node) {\n var object, body;\n\n if (strict) {\n tolerateError(Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return node.finishWithStatement(object, body);\n }", "function parseWithStatement(node) {\n var object, body;\n\n if (strict) {\n tolerateError(Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return node.finishWithStatement(object, body);\n }", "function parseWithStatement(node) {\n var object, body;\n\n if (strict) {\n tolerateError(Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return node.finishWithStatement(object, body);\n }", "function parseWithStatement(node)\n\t\t{\n\t\t\tvar object, body;\n\t\t\tif (strict)\n\t\t\t{\n\t\t\t\t// TODO(ikarienator): Should we update the test cases instead?\n\t\t\t\tskipComment();\n\t\t\t\ttolerateError(Messages.StrictModeWith);\n\t\t\t}\n\t\t\texpectKeyword('with');\n\t\t\texpect('(');\n\t\t\tobject = parseExpression();\n\t\t\texpect(')');\n\t\t\tbody = parseStatement();\n\t\t\treturn node.finishWithStatement(object, body);\n\t\t}", "function parseWithStatement() {\n var object, body;\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return {\n type: Syntax.WithStatement,\n object: object,\n body: body\n };\n }", "function parseWithStatement() {\n var object, body;\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return {\n type: Syntax.WithStatement,\n object: object,\n body: body\n };\n }", "function parseWithStatement() {\n var object, body;\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return {\n type: Syntax.WithStatement,\n object: object,\n body: body\n };\n }", "function parseWithStatement() {\n var object, body;\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return {\n type: Syntax.WithStatement,\n object: object,\n body: body\n };\n }", "function parseWithStatement() {\n var object, body;\n\n if (strict) {\n throwErrorTolerant({}, Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return {\n type: Syntax.WithStatement,\n object: object,\n body: body\n };\n }", "function parseWithStatement(node) {\n var object, body;\n\n if (strict) {\n // TODO(ikarienator): Should we update the test cases instead?\n skipComment();\n tolerateError(Messages.StrictModeWith);\n }\n\n expectKeyword('with');\n\n expect('(');\n\n object = parseExpression();\n\n expect(')');\n\n body = parseStatement();\n\n return node.finishWithStatement(object, body);\n }", "function WithStatement(node, print) {\n\t this.keyword(\"with\");\n\t this.push(\"(\");\n\t print.plain(node.object);\n\t this.push(\")\");\n\t print.block(node.body);\n\t}", "function WithStatement(node, print) {\n\t this.keyword(\"with\");\n\t this.push(\"(\");\n\t print.plain(node.object);\n\t this.push(\")\");\n\t print.block(node.body);\n\t}", "function WithStatement(node, print) {\n this.keyword(\"with\");\n this.push(\"(\");\n print.plain(node.object);\n this.push(\")\");\n print.block(node.body);\n}", "function SideEffect() {\n with ({}) {\n ;\n } // not inlinable\n}", "function Pe(){var e,t;\n// TODO(ikarienator): Should we update the test cases instead?\nreturn st&&(g(),q({},rt.StrictModeWith)),G(\"with\"),Y(\"(\"),e=ge(),Y(\")\"),t=qe(),pt.createWithStatement(e,t)}", "function o0(o1) {\n try {\nwith (o1)\n {\n try {\no1(\"MSEventObjPrototype\");\n}catch(e){}\n }try {\n\n}catch(e){};\n}catch(e){}\n\n try {\nreturn o1;\n}catch(e){}\n}", "with(...args) {\r\n this.builder.with.apply(this.builder, args);\r\n return this;\r\n }", "enterWith_stmt(ctx) {\n\t}", "with(context, fn, thisArg, ...args) {\n return this._getContextManager().with(context, fn, thisArg, ...args);\n }", "function ast_for_with_stmt(c, n0, is_async) {\n const n = is_async ? CHILD(n0, 1) : n0;\n var i;\n var items = [], body;\n\n REQ(n, SYM.with_stmt);\n\n for (i = 1; i < NCH(n) - 2; i += 2) {\n var item = ast_for_with_item(c, CHILD(n, i));\n items[(i - 1) / 2] = item;\n }\n\n body = astForSuite(c, CHILD(n, NCH(n) - 1));\n\n if (is_async) {\n return new Sk.astnodes.AsyncWith(items, body, LINENO(n0), n0.col_offset, n0.end_lineno, n0.end_col_offset);\n } else {\n return new Sk.astnodes.With(items, body, LINENO(n), n.col_offset, n.end_lineno, n.end_col_offset);\n }\n}", "function With(opts) {\n if (!(this instanceof With))\n return new With(opts);\n\n this.cql = 'WITH ';\n this.error = null;\n\n var result = this.process(opts);\n\n if (type(result) !== 'error') {\n this.cql += result;\n } else {\n this.error = result;\n }\n}", "function compile(spec) {\n return \"with (this) {\" +\n \" return [\" + spec + \"]\" +\n \"}\";\n }", "function o0(o1) {\n try {\nwith (o1)\n {\n try {\no1100 = \n function o3() {\n try {\nreturn o22 += 1;\n}catch(e){}\n },\n\n o4 =\n function o5() {\n try {\nreturn {\n test:\n function o6() { try {\nreturn \"5\";\n}catch(e){} }\n };\n}catch(e){}\n }\n}catch(e){}\n }try {\n\n}catch(e){};try {\n\n}catch(e){};\n}catch(o684 < 0x4000){}\n\n var o3 = o3 || undefined;\n var o57=new stdlib.Uint16Array(buffer);\n\n try {\nreturn { o1: o1, o3: o3, o5: o5 };\n}catch(e){}\n}", "exitWith_stmt(ctx) {\n\t}", "function localA()\n{\n var A = 'local A';\n\n with(new Object())\n {\n actual = A;\n expect = 'local A';\n }\n}", "function ast_for_with_item(c, n) {\n var context_expr, optional_vars;\n REQ(n, SYM.with_item);\n context_expr = ast_for_expr(c, CHILD(n, 0));\n if (NCH(n) == 3) {\n optional_vars = ast_for_expr(c, CHILD(n, 2));\n setContext(c, optional_vars, Sk.astnodes.Store, n);\n }\n\n return new Sk.astnodes.withitem(context_expr, optional_vars);\n}", "function bracket(aquire, use, release) {\n return function (r) {\n return TE.bracket(aquire(r), function (a) { return use(a)(r); }, function (a, e) { return release(a, e)(r); });\n };\n}", "function localB()\n{\n var B = 'local B';\n\n with(Number)\n {\n actual = B;\n expect = 'local B';\n }\n}", "function dispose() {}", "function _gobbleGroup(context) {\n context.index++;\n var node = _gobbleExpression(context);\n _gobbleSpaces(context);\n if (context.expr.charCodeAt(context.index) === CPAREN_CODE) {\n context.index++;\n return node;\n }\n _throwError('Unclosed (', context.index);\n }", "function f() {\n try {\n return 1;\n } finally {\n return 1;\n }\n }", "function f() { \"use strict\"; return this;}", "function semaphorize(method) {\n var current = null;\n return function () {\n if (current) {\n return current;\n }\n current = method.apply(this, arguments);\n current.finally(function () {\n current = null;\n });\n return current;\n }\n}", "function f() {\n {\n let x = \"lalala\"\n console.log(x) // lalala\n {\n console.log(x)\n // okay, block scoped name\n const x = \"sneaky\"\n const y = \"cucucu\"\n console.log(x)\n // error, const\n // x = \"foo\"\n }\n // error, already declared in block\n // let x = \"inner\"\n // error, y is declared inside an inner block\n // console.log(y)\n }\n }", "function f() {\n return function () { return function () { return function () {\n return function () { return function () { return function () {\n return function () { return function () { return function () {\n return function () { return function () { return function () {\n return function () { return function () { return function (a) {\n var v = a;\n\tassertEq(v, 42);\n\treturn function() { return v; };\n }; }; }; }; }; }; }; }; }; }; }; }; }; }; };\n}", "rawWith(args) {\r\n this.builder.rawWith.call(this.builder, args);\r\n return this;\r\n }", "function withScope(f){\r\n return function(scope, state, k){\r\n return f(scope)(scope, state, k);\r\n }\r\n}", "function g() { return function h () { return 1+1; };}", "function f2() {\n 'use strict'; // see strict mode\n return this;\n}", "function dispose() {\n }", "function g(){return function(){}}", "function sandboxWith(f) {\n return self => sandboxWith_(self, f);\n}", "function localD(obj)\n{\n var D = 'local D';\n\n with(obj)\n {\n actual = D;\n }\n\n if ('D' in obj)\n expect = obj.D;\n else\n expect = 'local D';\n}", "function RowContext() {}", "patchAsStatement() {\n let tryToken = this.getTryToken();\n let catchToken = this.getCatchToken();\n let thenTokenIndex = this.getThenTokenIndex();\n let finallyToken = this.getFinallyToken();\n\n // `try a` → `try { a`\n // ^^\n this.insert(tryToken.end, ` {`);\n if (this.body.inline()) {\n this.body.patch({ leftBrace: false });\n } else {\n if (catchToken || finallyToken) {\n this.body.patch({ leftBrace: false, rightBrace: false });\n // `try { a; catch err` → `try { a; } catch err`\n // ^^\n this.insert((catchToken || finallyToken).start, '} ');\n } else {\n this.body.patch({ leftBrace: false });\n }\n }\n\n if (thenTokenIndex) {\n let thenToken = this.sourceTokenAtIndex(thenTokenIndex);\n let nextToken = this.sourceTokenAtIndex(thenTokenIndex.next());\n // `try { a; } catch err then b` → `try { a; } catch err b`\n // ^^^^^\n this.remove(thenToken.start, nextToken.start);\n }\n\n if (this.catchAssignee || this.catchBody) {\n let afterCatchHeader =\n this.catchAssignee ?\n this.catchAssignee.outerEnd :\n catchToken ?\n catchToken.end :\n this.body.innerEnd;\n\n if (this.catchAssignee) {\n let addErrorParens = !this.catchAssignee.isSurroundedByParentheses();\n if (addErrorParens) {\n // `try { a; } catch err` → `try { a; } catch (err`\n // ^\n this.insert(this.catchAssignee.outerStart, '(');\n }\n this.catchAssignee.patch();\n if (addErrorParens) {\n // `try { a; } catch (err` → `try { a; } catch (err)`\n // ^\n this.insert(this.catchAssignee.outerEnd, ')');\n }\n } else if (this.catchBody) {\n // `try { a; } catch` → `try { a; } catch (error)`\n // ^^^^^^^^\n this.insert(afterCatchHeader, ` (${this.getErrorBinding()})`);\n }\n\n if (this.catchBody) {\n // `try { a; } catch (error)` → `try { a; } catch (error) {`\n // ^^\n this.insert(afterCatchHeader, ' {');\n this.catchBody.patch({ leftBrace: false });\n }\n } else if (!this.finallyBody) {\n // `try { a; }` → `try { a; } catch (error) {}`\n // ^^^^^^^^^^^^^^^^^\n this.insert(this.body.innerEnd, ` catch (${this.getErrorBinding()}) {}`);\n }\n\n if (this.finallyBody) {\n if (this.finallyBody.inline()) {\n this.finallyBody.patch();\n } else {\n // `try { a; } finally b` → `try { a; } finally { b`\n // ^^\n this.insert(finallyToken.end, ' {');\n this.finallyBody.patch({ leftBrace: false });\n }\n }\n }", "function sandboxWith_(self, f) {\n return unsandbox(f(sandbox(self)));\n}", "function LContext() {}", "function LContext() {}", "function LContext() {}", "function foo() {\n\ttry {\n\t\treturn 42;\n\t}\n\tfinally {\n\t\t// no `return .. ` here, so no override\n\t}\n}", "function outerFunction() {\n const basti = {\n name: 'basti',\n count: 0,\n };\n // return function() {\n // basti.count++;\n // console.log(basti.count);\n // return basti.name;\n // };\n return {\n getName() {\n basti.count++;\n return basti.name;\n },\n setName(name) {\n basti.name = name;\n },\n };\n}", "with (reporter) { return this.filter(reporter) }", "function mysteryScoping4() {\n let x = 'out of block';\n if (true) {\n let x = 'in block'\n console.log(x);\n }\n console.log(x);\n}", "enterBlock(ctx) {\n\t}", "function mysteryScoping4() {\n let x = 'out of block';\n if (true) {\n let x = 'in block';\n console.log(x);\n }\n console.log(x);\n}", "enterWrappedGraph(ctx) {\n\t}", "function mysteryScoping4() {\n let x = 'out of block';\n if (true) {\n let x = 'in block';\n console.log(x);\n }\n console.log(x);\n}", "function DbLockProvider() {\n\t}", "function it(title, spec) {\n indent.println(title)\n indent.increase()\n _tryFinally(spec, function() {\n indent.decrease()\n })\n}", "with(leftAmount, rightAmount) {\n const leftQuantity = assay.quantity(leftAmount);\n const rightQuantity = assay.quantity(rightAmount);\n return assay.make(strategy.with(leftQuantity, rightQuantity));\n }", "function aa() {\n return function() {}\n }", "with(name, expression) {\n const cte = (0, with_parser_js_1.parseCommonTableExpression)(name, expression);\n return new QueryCreator({\n ...this.#props,\n withNode: this.#props.withNode\n ? with_node_js_1.WithNode.cloneWithExpression(this.#props.withNode, cte)\n : with_node_js_1.WithNode.create(cte),\n });\n }", "enterWith_item(ctx) {\n\t}", "function bracketOnError_(acquire, use, release, __trace) {\n return (0, _bracketExit.bracketExit_)(acquire, use, (a, e) => e._tag === \"Success\" ? _core.unit : release(a, e), __trace);\n}", "function outer() {\n function inner() {};\n return inner;\n}", "function LContext() { }", "function LContext() { }", "function contextOfThis(){\n return this\n}", "async dispose() {\n try {\n return __classPrivateFieldGet(this, _BundlerContext_esbuildContext, \"f\")?.dispose();\n }\n finally {\n __classPrivateFieldSet(this, _BundlerContext_esbuildContext, undefined, \"f\");\n }\n }", "function f() {\n try {\n return 1;\n } catch {\n return 1;\n } finally {\n }\n }", "finally(fullfilled) {\n return this.exec().finally(fullfilled);\n }", "enterStmt(ctx) {\n\t}", "function newSyntax() {\n foo::bar();\n const { abc } = { ...oneTwoThree };\n return new.target;\n }", "function WithScope(outer, with_var) {\n Scope.call(this, outer, []);\n this.with_var = with_var;\n }", "function enterBlock(){\n blockContext = Object.create(blockContext)\n }", "function enterBlock(){\n blockContext = Object.create(blockContext)\n }", "function f() {\n return {\n get g() {\n function h() {\n }\n }\n };\n}", "function inBlock(style, terminator, nextTokenize) {\n return function(stream, state) {\n while (!stream.eol()) {\n if (stream.match(terminator)) {\n popContext(state);\n state.tokenize = nextTokenize;\n break;\n }\n stream.next();\n }\n return style;\n };\n }", "function LContext(){}", "function mysteryScoping2() {\n const x = 'out of block';\n if (true) {\n const x = 'in block';\n console.log(x);\n }\n console.log(x);\n}", "function mysteryScoping2() {\n const x = 'out of block';\n if (true) {\n const x = 'in block';\n console.log(x);\n }\n console.log(x);\n}" ]
[ "0.72355896", "0.72217697", "0.70689327", "0.70689327", "0.70689327", "0.70689327", "0.70689327", "0.70689327", "0.7018208", "0.69797736", "0.69797736", "0.69797736", "0.69797736", "0.69714904", "0.69078356", "0.69078356", "0.69078356", "0.69078356", "0.69078356", "0.6823942", "0.68205434", "0.68205434", "0.68205434", "0.68205434", "0.68205434", "0.6816062", "0.65899813", "0.65899813", "0.6545512", "0.6481197", "0.6250515", "0.6206678", "0.6123005", "0.60924196", "0.58377576", "0.5648855", "0.5630489", "0.5428066", "0.5275274", "0.5137496", "0.5100303", "0.5069659", "0.4950984", "0.49338835", "0.4915217", "0.48157036", "0.4787849", "0.47755516", "0.47616348", "0.47211078", "0.4709414", "0.4702794", "0.46755865", "0.46734574", "0.4649873", "0.46488726", "0.46459407", "0.46418515", "0.4628416", "0.462097", "0.4597776", "0.4589839", "0.45881015", "0.45881015", "0.45881015", "0.4587941", "0.45836148", "0.45829526", "0.45747724", "0.4571434", "0.45584947", "0.45543823", "0.45513225", "0.4550458", "0.4544916", "0.45415276", "0.45409885", "0.45395482", "0.45185483", "0.45145145", "0.45125142", "0.45088893", "0.45088893", "0.4507134", "0.45030406", "0.4492259", "0.4490557", "0.44801837", "0.44748002", "0.44723687", "0.44722044", "0.44722044", "0.44643268", "0.44635117", "0.44578105", "0.4455236", "0.4455236" ]
0.6894926
22
12.10 The swith statement
function parseSwitchCase() { var test, consequent = [], statement, startToken; startToken = lookahead; if (matchKeyword('default')) { lex(); test = null; } else { expectKeyword('case'); test = parseExpression(); } expect(':'); while (index < length) { if (match('}') || matchKeyword('default') || matchKeyword('case')) { break; } statement = parseStatement(); consequent.push(statement); } return delegate.markEnd(delegate.createSwitchCase(test, consequent), startToken); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function statement() {\n\n}", "function s(){}", "function n$1(n,t){return n?t?4:3:t?3:2}", "function o(e){switch(e.type){case V.BlockStatement:case V.BreakStatement:case V.CatchClause:case V.ContinueStatement:case V.ClassDeclaration:case V.ClassBody:case V.DirectiveStatement:case V.DoWhileStatement:case V.DebuggerStatement:case V.EmptyStatement:case V.ExpressionStatement:case V.ForStatement:case V.ForInStatement:case V.ForOfStatement:case V.FunctionDeclaration:case V.IfStatement:case V.LabeledStatement:case V.ModuleDeclaration:case V.Program:case V.ReturnStatement:case V.SwitchStatement:case V.SwitchCase:case V.ThrowStatement:case V.TryStatement:case V.VariableDeclaration:case V.VariableDeclarator:case V.WhileStatement:case V.WithStatement:return!0}return!1}", "function i(e){return a(e)||o(e)||s()}", "function solution(s) {\n\n}", "function fourth() {}", "function s(t){return t}", "function s(t,e,n,i,r){return r?(r[0]=t,r[1]=e,r[2]=n,r[3]=i,r):[t,e,n,i]}", "function Sd(){}", "function Sd(){}", "function If_other_stack_literal() {\r\n}", "function i(e, t) {\n return e ? t ? 4 : 3 : t ? 3 : 2;\n }", "static private internal function m121() {}", "function Cond() {\r\n}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}" ]
[ "0.6031139", "0.58516026", "0.5694981", "0.56540257", "0.5596952", "0.55756617", "0.5563063", "0.555822", "0.5548447", "0.5491659", "0.5491659", "0.54649895", "0.544847", "0.5446926", "0.5436133", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666", "0.54195666" ]
0.0
-1
12.13 The throw statement
function parseThrowStatement() { var argument; expectKeyword('throw'); if (peekLineTerminator()) { throwError({}, Messages.NewlineAfterThrow); } argument = parseExpression(); consumeSemicolon(); return delegate.createThrowStatement(argument); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function thrower(){throw new Error(\"this should not happen!\")}", "function Exception() {}", "function m(a){throw a;}", "function thrower() {\n throw new Error('thrown');\n}", "function Throw(){ return Statement.apply(this,arguments) }", "function Ne(){var e;return G(\"throw\"),U()&&j({},rt.NewlineAfterThrow),e=ge(),H(),pt.createThrowStatement(e)}", "function throwError() {\n throw -1;\n}", "function throwException() {\n throwExceptionInner();\n}", "function $throw(ex) {\n throw ex || this\n}", "function e(a) {\n throw a;\n}", "function throwError() {\n throw new Error('Malicious method invoked.');\n}", "function throwError() {\n throw new Error(\"some error message\");\n}", "function n(a){throw a;}", "function Exception() {\n return;\n}", "function throwError(){\n throw 'my error'\n}", "function bpException() {}", "function q(a){throw a;}", "function d(a) {\n throw a;\n }", "function alwaysThrows(){\n throw \"OH NOES\";\n}", "reThrow(error, filename, lineNumber) {\n if (error instanceof edge_error_1.EdgeError) {\n throw error;\n }\n const message = error.message.replace(/state\\./, '');\n throw new edge_error_1.EdgeError(message, 'E_RUNTIME_EXCEPTION', {\n filename: filename,\n line: lineNumber,\n col: 0,\n });\n }", "function parseThrowStatement() {\n var argument, marker = markerCreate();\n \n expectKeyword('throw');\n \n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n \n argument = parseExpression();\n \n consumeSemicolon();\n \n return markerApply(marker, delegate.createThrowStatement(argument));\n }", "function foo() {\n {\n throw 'error';\n }\n}", "function sc_raise(obj) {\n throw obj;\n}", "function tameException(ex) {\n if (ex && ex.UNCATCHABLE___) { throw ex; }\n try {\n switch (typeOf(ex)) {\n case 'string':\n case 'number':\n case 'boolean': \n case 'undefined': {\n // Immutable.\n return ex;\n }\n case 'object': {\n if (ex === null) { return null; }\n if (ex.throwable___) { return ex; }\n if (isInstanceOf(ex, Error)) { return primFreeze(ex); }\n return '' + ex;\n }\n case 'function': {\n // According to Pratap Lakhsman's \"JScript Deviations\" S2.11\n // If the caught object is a function, calling it within the catch\n // supplies the head of the scope chain as the \"this value\". The\n // called function can add properties to this object. This implies\n // that for code of this shape:\n // var x;\n // try {\n // // ...\n // } catch (E) {\n // E();\n // return s;\n // }\n // The reference to 'x' within the catch is not necessarily to the\n // local declaration of 'x'; this gives Catch the same performance\n // problems as with.\n\n // We return a different, powerless function instead.\n var name = '' + (ex.name || ex);\n function inLieuOfThrownFunction() {\n return 'In lieu of thrown function: ' + name;\n };\n return markFuncFreeze(inLieuOfThrownFunction, name);\n }\n default: {\n log('Unrecognized exception type: ' + (typeOf(ex)));\n return 'Unrecognized exception type: ' + (typeOf(ex));\n }\n }\n } catch (_) {\n // Can occur if coercion to string fails, or if ex has getters\n // that fail. This function must never throw an exception\n // because doing so would cause control to leave a catch block\n // before the handler fires.\n log('Exception during exception handling.');\n return 'Exception during exception handling.';\n }\n }", "function a$p(x) { throw(x); }", "function parseThrowStatement(node) {\n\t var argument;\n\n\t expectKeyword('throw');\n\n\t if (hasLineTerminator) {\n\t throwError(Messages.NewlineAfterThrow);\n\t }\n\n\t argument = parseExpression();\n\n\t consumeSemicolon();\n\n\t return node.finishThrowStatement(argument);\n\t }", "function exception_example( ) {\n\n\t//\n\t//\tTRY Block\n\t//\n\ttry {\n\t\t//\n\t\t// Werfe eine neue Exception vom Typ MyError\n\t\t//\n\t\tthrow new MyError(\"Banane\")\n\t}\n\t//\n\t//\tCATCH Block\n\t//\n\tcatch( err ) {\n\t\t\n\t\t//\n\t\t// Teste, ob ein Fehler vom Typ MyError geworfen wurde\n\t\t//\t\n\t\tif( err instanceof MyError ) {\n\t\t\tconsole.warn(\"A MyError occured\" ,err);\n\t\t}\n\t\t\n\t\t//\n\t\t// War die Exception nicht vom Typ MyError dann werfe die Exception weiter\n\t\t//\n\t\telse {\n\t\t\tthrow err;\n\t\t}\n\t}\n}", "function parseThrowStatement$996() {\n var argument$1453;\n expectKeyword$933('throw');\n if (peekLineTerminator$928()) {\n throwError$929({}, Messages$874.NewlineAfterThrow);\n }\n argument$1453 = parseExpression$969();\n consumeSemicolon$938();\n return delegate$888.createThrowStatement(argument$1453);\n }", "function parseThrowStatement(node)\n\t\t{\n\t\t\tvar argument;\n\t\t\texpectKeyword('throw');\n\t\t\tif (peekLineTerminator())\n\t\t\t{\n\t\t\t\tthrowError(Messages.NewlineAfterThrow);\n\t\t\t}\n\t\t\targument = parseExpression();\n\t\t\tconsumeSemicolon();\n\t\t\treturn node.finishThrowStatement(argument);\n\t\t}", "function parseThrowStatement(node) {\n var argument;\n\n expectKeyword('throw');\n\n if (hasLineTerminator) {\n throwError(Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return node.finishThrowStatement(argument);\n }", "throw (err) {\n return function (res, cb) {\n throw new Error(err)\n }\n }", "function parseThrowStatement() {\n var argument, marker = markerCreate();\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createThrowStatement(argument));\n }", "function parseThrowStatement() {\n var argument, marker = markerCreate();\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createThrowStatement(argument));\n }", "function parseThrowStatement() {\n var argument, marker = markerCreate();\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createThrowStatement(argument));\n }", "function parseThrowStatement() {\n var argument, marker = markerCreate();\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createThrowStatement(argument));\n }", "function parseThrowStatement() {\n var argument, marker = markerCreate();\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createThrowStatement(argument));\n }", "function parseThrowStatement() {\n var argument, marker = markerCreate();\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createThrowStatement(argument));\n }", "function error(message) {\n throw message;\n}", "function typedThrow(msg) {\n throw new Error(msg);\n }", "function typedThrow(msg) {\n throw new Error(msg);\n }", "function parseThrowStatement(node) {\n var argument;\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError(Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return node.finishThrowStatement(argument);\n }", "function throwError(msg) {\n throw new Error(msg);\n}", "function parseThrowStatement(node) {\n var argument;\n\n expectKeyword('throw');\n\n if (hasLineTerminator) {\n throwError(Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return node.finishThrowStatement(argument);\n }", "function parseThrowStatement(node) {\n var argument;\n\n expectKeyword('throw');\n\n if (hasLineTerminator) {\n throwError(Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return node.finishThrowStatement(argument);\n }", "function parseThrowStatement(node) {\n var argument;\n\n expectKeyword('throw');\n\n if (hasLineTerminator) {\n throwError(Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return node.finishThrowStatement(argument);\n }", "function parseThrowStatement(node) {\n var argument;\n\n expectKeyword('throw');\n\n if (hasLineTerminator) {\n throwError(Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return node.finishThrowStatement(argument);\n }", "function parseThrowStatement(node) {\n var argument;\n\n expectKeyword('throw');\n\n if (hasLineTerminator) {\n throwError(Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return node.finishThrowStatement(argument);\n }", "function throwsTest() {\n assert.throws(\n function() {\n throw new Error(\"Wrong value\");\n },\n function(err) {\n if ((err instanceof Error) && /value/.test(err)) {\n console.log(\"Error occur\");\n return true;\n }\n },\n \"unexpected error\"\n );\n}", "function a(f) { throw f; }", "function foo() {\n if (true) {\n throw 'error';\n }\n}", "_triggerException(e) {\n\t\tthrow e\n\t}", "function VeryBadError() {}", "function parseThrowStatement() {\n var argument;\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return {\n type: Syntax.ThrowStatement,\n argument: argument\n };\n }", "function parseThrowStatement() {\n var argument;\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return {\n type: Syntax.ThrowStatement,\n argument: argument\n };\n }", "function parseThrowStatement() {\n var argument;\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return {\n type: Syntax.ThrowStatement,\n argument: argument\n };\n }", "function parseThrowStatement() {\n var argument;\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return {\n type: Syntax.ThrowStatement,\n argument: argument\n };\n }", "function parseThrowStatement() {\n var argument;\n\n expectKeyword('throw');\n\n if (peekLineTerminator()) {\n throwError({}, Messages.NewlineAfterThrow);\n }\n\n argument = parseExpression();\n\n consumeSemicolon();\n\n return {\n type: Syntax.ThrowStatement,\n argument: argument\n };\n }", "function f(e) {\n try {\n throw 'throw';\n } catch (e) {\n print(e);\n }\n}", "function a$o(x) { throw(x); }", "logAndThrow(data) {\n console.error(data); // eslint-disable-line no-console\n throw data;\n }", "function ThrowingConstructorTest() {\n throw new Error('taco');\n}", "function throwError(message) {\n throw new Error(message);\n}", "function throwError(error) {\n \tthrow new SyntaxError(error);\n }", "function bomb() {\n throw 'boom!';\n}", "function exception_example_return( ) {\n\n\t//\n\t//\tTRY Block\n\t//\n\ttry {\n\t\t//\n\t\t// Werfe eine neue Exception vom Typ MyError\n\t\t//\n\t//\tthrow new MyError(\"Banane\")\n\t\treturn -1;\n\t}\n\t//\n\t//\tCATCH Block\n\t//\n\tcatch( err ) {\n\t\t\n\t\t//\n\t\t// Teste, ob ein Fehler vom Typ MyError geworfen wurde\n\t\t//\t\n\t\tif( err instanceof MyError ) {\n\t\t\tconsole.warn(\"A MyError occured\" ,err);\n\t\t}\n\t\t\n\t\t//\n\t\t// War die Exception nicht vom Typ MyError dann werfe die Exception weiter\n\t\t//\n\t\telse {\n\t\t\tthrow err;\n\t\t}\n\t\treturn -2;\n\t}\n\tfinally {\n\t\treturn 3;\n\t}\n}", "shouldHaveThrown() {\n throw new Error(\"Expected an error to be thrown, but no error was thrown.\");\n }", "function die(err) {\n throw E(err);\n}", "function die(err) {\n throw E(err);\n}", "function raise(msg) {\n if (typeof Error != 'undefined') {\n throw new Error(msg || 'Assertion Failed');\n } else {\n throw (msg);\n }\n}", "function MyException(message){exception(this);}", "_syntaxError(message) {\n log.error(\"Syntax Error:\",message);\n throw message;\n }", "function Ne(e,t){if(!e)throw new Error(t)}", "function textExceptionThrow(text, from, message) {\n if ( !optionsGlobal.isProduction ) {\n\n var line = exceptionHeader(that.library);\n\n var startLine = text.lastIndexOf(\"\\n\", from) + 1;\n var endLine = text.indexOf(\"\\n\", from);\n endLine = endLine > -1 ? endLine : text.length;\n\n var row = text.substring(startLine, endLine);\n var rows = text.split(\"\\n\"); // Split each token, string to char array\n\n // Find the rowIndex\n for ( var rowIndex = 0; rowIndex < rows.length; rowIndex++ ) {\n if ( rows[rowIndex] == row ) {\n break;\n }\n }\n\n var tokenIndex = from - startLine; // From start up to the token\n\n rows.splice(rowIndex, 0, line);\n rows.splice(rowIndex+2, 0, line);\n\n throw str(\n \"\\n\", line,\n \"\\nMoCP: Exception on (line, token) : (\", rowIndex + 1, \", \", tokenIndex + 1,\") \\n\",\n \"Message:\\n \", message,\n \"\\n\", line,\n \"\\n\\n\",\n rows.join(\"\\n\")\n );\n }\n\n }", "function throwTest() {\n\ttry {\n\t\tvar x = document.getElementById(\"num_input\").value;\n\n\t\tif (x == \"\") {\n\t\t\tthrow \"The value is null!\";\n\t\t}\n\n\t\tif (isNaN(x)) {\n\t\t\tthrow \"Is's not a number!\";\n\t\t}\n\n\t\tif (x > 10) {\n\t\t\tthrow \"too larger!\";\n\t\t}\n\n\t\tif (x < 5) {\n\t\t\tthrow \"too small!\";\n\t\t}\n\n\t\tthrow \"Right!!!\"\n\n\t} catch (err) {\n\t\tvar y = document.getElementById(\"error_hint\");\n\t\ty.innerHTML = \"Error: \" + err + \".\";\n\t}\n\n}", "run() {\n\t\tthrow new Error;\n\t}", "function catchIt() {\n try {\n throwIt();\n } catch (e) {\n console.log(e.stack); // print stack trace\n }\n}", "function rethrow(msg) {\n\treturn e => { console.log(e); throw new Error(msg); };\n}", "function neverReturns() {\n throw new Error('An Error!');\n}", "function error(message) {\r\n throw new Error(message);\r\n}", "function neverReturns() {\n throw new Error('An Error!');\n }", "function throwIt(exception) {\n try {\n throw exception;\n } catch (e) {\n console.log('Caught: ' + e);\n }\n}", "function exception(name){\n\n if(typeof name != 'string'){\n throw Error('its not a string')\n }else{\n alert('welcome ' + name)\n }\n\n}", "function throwError(message) {\r\n if (!message) {\r\n message = ERROR_MSG;\r\n }\r\n throw new Error((\"Inferno Error: \" + message));\r\n}", "function throwError() {\r\n var error = null;\r\n error = nlapiCreateError('INVD_UAT_REC', errMsg, true);\r\n throw error;\r\n }", "function throwError() {\r\n var error = null;\r\n error = nlapiCreateError('INVD_UAT_REC', errMsg, true);\r\n throw error;\r\n }", "function te(ec) {\n throw new Error(errorCodes[ec]);\n }", "function neverReturns() {\n throw new Error('an error!');\n}", "function neverReturns() {\n throw new Error('an error!');\n}", "function error(message) {\n throw new Error(message);\n}", "function error(message) {\n throw new Error(message);\n}", "function error(message) {\n throw new Error(message);\n}", "function error(message) {\n throw new Error(message);\n}", "function neverReturns() {\n throw new Error('An error!');\n}" ]
[ "0.82639456", "0.7707648", "0.7531231", "0.74871564", "0.7379285", "0.7368657", "0.73647875", "0.7271461", "0.72611165", "0.7259888", "0.7244121", "0.7199371", "0.7190658", "0.7184537", "0.714959", "0.7077943", "0.7010637", "0.7003125", "0.69730186", "0.6961365", "0.6960811", "0.69405854", "0.6919782", "0.69009817", "0.689053", "0.68849975", "0.68687344", "0.6825998", "0.68249863", "0.67948544", "0.6792957", "0.6783425", "0.6783425", "0.6783425", "0.6783425", "0.6783425", "0.6783425", "0.6765993", "0.6718194", "0.6718194", "0.670256", "0.66870844", "0.66839427", "0.66839427", "0.66839427", "0.66839427", "0.66839427", "0.66736364", "0.6670392", "0.66466415", "0.66428804", "0.6639397", "0.6633631", "0.6633631", "0.6633631", "0.6633631", "0.6633631", "0.6626189", "0.662278", "0.6567849", "0.65557414", "0.65312225", "0.6531003", "0.6524448", "0.65005744", "0.6489986", "0.64373904", "0.64373904", "0.64349234", "0.6425913", "0.6401813", "0.6395846", "0.6387774", "0.63813317", "0.63693535", "0.63612556", "0.6321559", "0.6308439", "0.63017976", "0.62668717", "0.6258022", "0.6242665", "0.623865", "0.6232901", "0.6232901", "0.6231992", "0.6227013", "0.6227013", "0.62168604", "0.62168604", "0.62168604", "0.62168604", "0.6216047" ]
0.6660329
54
12.14 The try statement
function parseCatchClause() { var param, body, startToken; startToken = lookahead; expectKeyword('catch'); expect('('); if (match(')')) { throwUnexpected(lookahead); } param = parseVariableIdentifier(); // 12.14.1 if (strict && isRestrictedWord(param.name)) { throwErrorTolerant({}, Messages.StrictCatchVariable); } expect(')'); body = parseBlock(); return delegate.markEnd(delegate.createCatchClause(param, body), startToken); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function a120571()\n{\n while(0)\n {\n try\n {\n }\n catch(e)\n {\n continue;\n }\n }\n}", "function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}", "function parseTryStatement() {\n var node = createNode(216 /* TryStatement */);\n parseExpected(100 /* TryKeyword */);\n node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);\n node.catchClause = token() === 72 /* CatchKeyword */ ? parseCatchClause() : undefined;\n // If we don't have a catch clause, then we must have a finally clause. Try to parse\n // one out no matter what.\n if (!node.catchClause || token() === 85 /* FinallyKeyword */) {\n parseExpected(85 /* FinallyKeyword */);\n node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);\n }\n return finishNode(node);\n }", "function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}", "try() {\n if (this.isOk()) {\n return this.value\n }\n throw this.error\n }", "function c(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}", "function doTryCatch() {\n try {\n var build = 1;\n } catch (e) {\n var f = build;\n }\n}", "attempt() {}", "function tryCatch(fn, obj, arg) { // 59\n try { // 60\n return { type: \"normal\", arg: fn.call(obj, arg) }; // 61\n } catch (err) { // 62\n return { type: \"throw\", arg: err }; // 63\n } // 64\n } // 65", "function simpleTryCatch() {\r\n const fs = require('fs');\r\n try {\r\n console.log(a[2])\r\n } catch (error) {\r\n console.log('error', error)\r\n }\r\n\r\n b = null;\r\n try {\r\n b.do(); \r\n } catch (error) {\r\n console.log('error', error) \r\n // recover\r\n }\r\n}", "function tryCatch(fn, obj, arg) { // 63\n try { // 64\n return { type: \"normal\", arg: fn.call(obj, arg) }; // 65\n } catch (err) { // 66\n return { type: \"throw\", arg: err }; // 67\n } // 68\n } // 69", "function tryCatch(fn,obj,arg){try{return{type:\"normal\",arg:fn.call(obj,arg)};}catch(err){return{type:\"throw\",arg:err};}}", "function tryCatch(fn,obj,arg){try{return{type:\"normal\",arg:fn.call(obj,arg)};}catch(err){return{type:\"throw\",arg:err};}}", "function tryCatch(fn,obj,arg){try{return{type:\"normal\",arg:fn.call(obj,arg)};}catch(err){return{type:\"throw\",arg:err};}}", "function tryCatch(fn,obj,arg){try{return{type:\"normal\",arg:fn.call(obj,arg)};}catch(err){return{type:\"throw\",arg:err};}}", "function tryCatch(fn,obj,arg){try{return{type:\"normal\",arg:fn.call(obj,arg)};}catch(err){return{type:\"throw\",arg:err};}}", "function tryCatch(fn,obj,arg){try{return {type:\"normal\",arg:fn.call(obj,arg)};}catch(err){return {type:\"throw\",arg:err};}}", "function f() {\n try {\n return 1;\n } catch {\n return 1;\n } finally {\n }\n }", "static try(fn) {\n try {\n return Ok(fn())\n } catch (error) {\n return Err(error)\n }\n }", "enterTry_stmt(ctx) {\n\t}", "function runTryCatch(func) {\n try {\n return func()\n }\n catch (e) {\n }\n}", "function attempt() {\r\n return \"I have thrown by return\"\r\n}", "function evaluateTryStatement({ node, evaluate, environment, reporting, statementTraversalStack }) {\n const executeTry = () => {\n setInLexicalEnvironment({ env: environment, reporting, newBinding: true, node, path: TRY_SYMBOL, value: true });\n // The Block will declare an environment of its own\n evaluate.statement(node.tryBlock, environment);\n };\n const executeCatch = (ex) => {\n clearBindingFromLexicalEnvironment(environment, TRY_SYMBOL);\n // The CatchClause will declare an environment of its own\n evaluate.nodeWithArgument(node.catchClause, environment, ex, statementTraversalStack);\n };\n const executeFinally = () => {\n clearBindingFromLexicalEnvironment(environment, TRY_SYMBOL);\n // The Block will declare an environment of its own\n evaluate.statement(node.finallyBlock, environment);\n };\n // A TryStatement must have either a catch or a finally block\n if (node.catchClause == null && node.finallyBlock == null) {\n throw new MissingCatchOrFinallyAfterTryError({ node });\n }\n // Follows the form: try {...} catch {...}\n else if (node.catchClause != null && node.finallyBlock == null) {\n try {\n executeTry();\n }\n catch (ex) {\n executeCatch(ex);\n }\n }\n // Follows the form: try {...} catch {...} finally {...}\n else if (node.catchClause != null && node.finallyBlock != null) {\n try {\n executeTry();\n }\n catch (ex) {\n executeCatch(ex);\n }\n finally {\n executeFinally();\n }\n }\n // Follows the form: try {...} finally {...}\n else if (node.catchClause == null && node.finallyBlock != null) {\n try {\n executeTry();\n }\n finally {\n executeFinally();\n }\n }\n}", "function fail() {\n try{\n console.log('this works')\n throw new Error('oh no')\n }\n catch(err){\n console.log('we have made an error')\n } finally{\n console.log('I still run')\n }\n console.log('!!!!!!!!!!!!!!') // this would never run, things only run in try catch\n}", "function attempt(func, errorFunc) {\n\t try {\n\t func();\n\t } catch (exception) {\n\t if (errorFunc) {\n\t errorFunc();\n\t }\n\t }\n\t }", "function t(fn) { fn().catch(()=>{}); }", "function a() {\n try {\n b()\n\n function b() {\n // let json = '{bad json}'\n // let user = JSON.parse(json); \n\n let user = {\n name: 'abdul'\n }\n console.log(user.name);\n c()\n\n function c() {\n try {\n // let json = '{bad json}'\n // let user = JSON.parse(json); \n\n let user = {\n name: 'majeed'\n }\n console.log(user.name);\n\n } catch (err) {\n console.log(err, \"---3---\")\n }\n d()\n\n function d() {\n try {\n // let json = '{bad json}'\n // let user = JSON.parse(json); \n\n let user = {\n name: 'bruce'\n }\n console.log(user.name);\n } catch (err) {\n console.log(err, \"inside the function err\")\n }\n }\n }\n }\n } catch (err) {\n console.log(err, \"Error caught\")\n }\n}", "function exception_example_return( ) {\n\n\t//\n\t//\tTRY Block\n\t//\n\ttry {\n\t\t//\n\t\t// Werfe eine neue Exception vom Typ MyError\n\t\t//\n\t//\tthrow new MyError(\"Banane\")\n\t\treturn -1;\n\t}\n\t//\n\t//\tCATCH Block\n\t//\n\tcatch( err ) {\n\t\t\n\t\t//\n\t\t// Teste, ob ein Fehler vom Typ MyError geworfen wurde\n\t\t//\t\n\t\tif( err instanceof MyError ) {\n\t\t\tconsole.warn(\"A MyError occured\" ,err);\n\t\t}\n\t\t\n\t\t//\n\t\t// War die Exception nicht vom Typ MyError dann werfe die Exception weiter\n\t\t//\n\t\telse {\n\t\t\tthrow err;\n\t\t}\n\t\treturn -2;\n\t}\n\tfinally {\n\t\treturn 3;\n\t}\n}", "function Fe(){var e,t,n;\n// 12.14.1\nreturn n=dt,G(\"catch\"),Y(\"(\"),Z(\")\")&&W(dt),e=be(),st&&f(e.name)&&q({},rt.StrictCatchVariable),Y(\")\"),t=we(),pt.markEnd(pt.createCatchClause(e,t),n)}", "function TryStatement(node, print) {\n\t this.keyword(\"try\");\n\t print.plain(node.block);\n\t this.space();\n\n\t // Esprima bug puts the catch clause in a `handlers` array.\n\t // see https://code.google.com/p/esprima/issues/detail?id=433\n\t // We run into this from regenerator generated ast.\n\t if (node.handlers) {\n\t print.plain(node.handlers[0]);\n\t } else {\n\t print.plain(node.handler);\n\t }\n\n\t if (node.finalizer) {\n\t this.space();\n\t this.push(\"finally \");\n\t print.plain(node.finalizer);\n\t }\n\t}", "function TryStatement(node, print) {\n\t this.keyword(\"try\");\n\t print.plain(node.block);\n\t this.space();\n\n\t // Esprima bug puts the catch clause in a `handlers` array.\n\t // see https://code.google.com/p/esprima/issues/detail?id=433\n\t // We run into this from regenerator generated ast.\n\t if (node.handlers) {\n\t print.plain(node.handlers[0]);\n\t } else {\n\t print.plain(node.handler);\n\t }\n\n\t if (node.finalizer) {\n\t this.space();\n\t this.push(\"finally \");\n\t print.plain(node.finalizer);\n\t }\n\t}", "function isTry(request) {\n if (request.kind === \"try\") {\n return request.request;\n }\n return null;\n}", "function f() {\n try {\n return 1;\n } finally {\n return 1;\n }\n }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return {\n\t type: \"normal\",\n\t arg: fn.call(obj, arg)\n\t };\n\t } catch (err) {\n\t return {\n\t type: \"throw\",\n\t arg: err\n\t };\n\t }\n\t }", "tryOp(errorType, op, ...params) {\n try {\n return op(...params);\n }\n catch (e) {\n throw new this.errClass(errorType, e);\n }\n }", "function tryCatch(fn, obj, arg) {\r\n try {\r\n return {\r\n type: 'normal',\r\n arg: fn.call(obj, arg)\r\n };\r\n } catch (err) {\r\n return {\r\n type: 'throw',\r\n arg: err\r\n };\r\n }\r\n }", "function bpException() {}", "function TryStatement(node, print) {\n this.keyword(\"try\");\n print.plain(node.block);\n this.space();\n\n // Esprima bug puts the catch clause in a `handlers` array.\n // see https://code.google.com/p/esprima/issues/detail?id=433\n // We run into this from regenerator generated ast.\n if (node.handlers) {\n print.plain(node.handlers[0]);\n } else {\n print.plain(node.handler);\n }\n\n if (node.finalizer) {\n this.space();\n this.push(\"finally \");\n print.plain(node.finalizer);\n }\n}", "function thisOrThrow(tryThis, orThrowMessage) {\n if (typeof tryThis !== 'undefined') {\n return tryThis;\n }\n throw new Error(orThrowMessage);\n}", "function f() {\n var res = 0;\n\n try {\n throw 1;\n } catch (e) {\n for (var i = 0; i < 10; i++) {\n res += 3;\n }\n }\n\n res;\n 30;\n}", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n\t try {\n\t return { type: \"normal\", arg: fn.call(obj, arg) };\n\t } catch (err) {\n\t return { type: \"throw\", arg: err };\n\t }\n\t }", "function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }", "function tryCatch(fn, obj, arg) {\n try {\n return {\n type: \"normal\",\n arg: fn.call(obj, arg),\n };\n } catch (err) {\n return {\n type: \"throw\",\n arg: err,\n };\n }\n }", "function foo() {\n\ttry {\n\t\treturn 42;\n\t}\n\tfinally {\n\t\t// no `return .. ` here, so no override\n\t}\n}", "function f()\n{\n try\n {\n eval(this.badSyntax);\n }\n catch(e)\n {\n return cnErrorCaught;\n }\n return cnErrorNotCaught;\n}", "function attempt(func, errorFunc) {\n try {\n func();\n } catch (exception) {\n if (errorFunc) {\n errorFunc();\n }\n }\n }", "function attempt(func, errorFunc) {\n try {\n func();\n } catch (exception) {\n if (errorFunc) {\n errorFunc();\n }\n }\n }", "function attempt(func, errorFunc) {\n try {\n func();\n } catch (exception) {\n if (errorFunc) {\n errorFunc();\n }\n }\n }", "function attempt(func, errorFunc) {\n try {\n func();\n } catch (exception) {\n if (errorFunc) {\n errorFunc();\n }\n }\n }", "function attempt(func, errorFunc) {\n try {\n func();\n } catch (exception) {\n if (errorFunc) {\n errorFunc();\n }\n }\n }" ]
[ "0.6898311", "0.67884636", "0.6755726", "0.6696703", "0.6651578", "0.6646401", "0.66031677", "0.64729017", "0.6433329", "0.63939315", "0.6387224", "0.6383057", "0.6383057", "0.6383057", "0.6383057", "0.6383057", "0.6362478", "0.6280455", "0.619323", "0.6102144", "0.60913664", "0.60841435", "0.60755235", "0.6054909", "0.6007401", "0.5950869", "0.5910166", "0.59084266", "0.5897991", "0.5864896", "0.5864896", "0.5858639", "0.5839039", "0.5837848", "0.5820786", "0.58163655", "0.58121836", "0.57907176", "0.5777705", "0.57747126", "0.57745576", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.5760709", "0.575205", "0.57468987", "0.5742544", "0.57272893", "0.57139766", "0.5709922", "0.5709922", "0.5709922", "0.5709922", "0.5709922" ]
0.0
-1
12.15 The debugger statement
function parseDebuggerStatement() { expectKeyword('debugger'); consumeSemicolon(); return delegate.createDebuggerStatement(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function je(){return G(\"debugger\"),H(),pt.createDebuggerStatement()}", "function dbg(x) {\n debugger;\n}", "debug() {}", "debug() {\n\t const vm = this.vm;\n\t if (vm.isWaitingForAnswer)\n\t return;\n\t this._stepOverCurrentLine();\n\t //continue to execute until it stops at another break point\n\t vm.state = vm.debugStateStart;\n\t return vm.state.debug();\n\t }", "function parseDebuggerStatement() {\n var marker = markerCreate();\n expectKeyword('debugger');\n \n consumeSemicolon();\n \n return markerApply(marker, delegate.createDebuggerStatement());\n }", "function JavaDebug() {\r\n}", "function devDebug(){\n\n}", "function debug()\n {\n var i;\n \n if (debugging)\n {\n for (i = 0; i < arguments.length; i++)\n {\n HTMLDebugInfo.innerHTML += arguments[i].toString() + \"<br>\";\n }\n } \n }", "function debug(v){return false;}", "Env(id){debugger;}", "function showDebugInfo() {\n\t\t\tconsole.log();\n\t\t}", "function parseDebuggerStatement$999() {\n expectKeyword$933('debugger');\n consumeSemicolon$938();\n return delegate$888.createDebuggerStatement();\n }", "function parseDebuggerStatement(node)\n\t\t{\n\t\t\texpectKeyword('debugger');\n\t\t\tconsumeSemicolon();\n\t\t\treturn node.finishDebuggerStatement();\n\t\t}", "function debug(message) {\r\n command_1.issueCommand('debug', {}, message);\r\n}", "function debug(message) {\r\n command_1.issueCommand('debug', {}, message);\r\n}", "function parseDebuggerStatement() {\n var marker = markerCreate();\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createDebuggerStatement());\n }", "function parseDebuggerStatement() {\n var marker = markerCreate();\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createDebuggerStatement());\n }", "function parseDebuggerStatement() {\n var marker = markerCreate();\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createDebuggerStatement());\n }", "function parseDebuggerStatement() {\n var marker = markerCreate();\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createDebuggerStatement());\n }", "function parseDebuggerStatement() {\n var marker = markerCreate();\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createDebuggerStatement());\n }", "function parseDebuggerStatement() {\n var marker = markerCreate();\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return markerApply(marker, delegate.createDebuggerStatement());\n }", "function parseDebuggerStatement(node) {\n\t expectKeyword('debugger');\n\n\t consumeSemicolon();\n\n\t return node.finishDebuggerStatement();\n\t }", "function parseDebuggerStatement(node) {\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return node.finishDebuggerStatement();\n }", "function potentiallyBuggyCode() {\n debugger; // 디버거를 돌리면(개발자 모드를 연 상태에서 실행을 시키면) 여기서 멈춘다.\n // do potentially buggy stuff to examine, step through, etc.\n var x = 10;\n console.log('x: ' + x);\n var y = 10;\n console.log('y: ' + y);\n var z = 10;\n console.log('z: ' + z);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand('debug', {}, message);\n}", "function debug(message) {\n command_1.issueCommand(\"debug\", {}, message);\n }", "function debugMessage() {\n if (debug) console.debug(arguments);\n}", "function debug() {\n if (attrs.isDebug) {\n //stringify func\n var stringified = scope + \"\";\n \n // parse variable names\n var groupVariables = stringified\n //match var x-xx= {};\n .match(/var\\s+([\\w])+\\s*=\\s*{\\s*}/gi)\n //match xxx\n .map(d => d.match(/\\s+\\w*/gi).filter(s => s.trim()))\n //get xxx\n .map(v => v[0].trim());\n \n //assign local variables to the scope\n groupVariables.forEach(v => {\n main[\"P_\" + v] = eval(v);\n });\n }\n }", "function debug() {\n\t\t\tconsole.log()\n\t\t\ttheInterface.emit('ui:startDebug');\n\t\t}", "function debug(s) {\n if (!debugOn) {\n return;\n }\n console.log(s);\n}", "function myFunction() {\n let myVar = 'hello again';\n // debugger;\n console.log('run after debugger');\n\n let obj = {\n name: 'fatma',\n method: function () {\n // debugger;\n console.log(this.name);\n }\n }\n obj.method();\n}", "function runWithDebugger(myfunction) {\n debugger;\n myfunction();\n}", "function i(t,e){window.console}", "function i(t,e){window.console}", "function DebugConsole() {\n}", "function DebugConsole() {\n}", "function DebugConsole() {\n}", "function debug(s) {\n\tvar debug = document.getElementById('debug');\n\tif (debug) {\n\t\tdebug.innerHTML = debug.innerHTML + '<br/>' + s;\n\t}\n}", "function parseDebuggerStatement(node) {\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return node.finishDebuggerStatement();\n }", "function parseDebuggerStatement(node) {\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return node.finishDebuggerStatement();\n }", "function parseDebuggerStatement(node) {\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return node.finishDebuggerStatement();\n }", "function parseDebuggerStatement(node) {\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return node.finishDebuggerStatement();\n }", "function parseDebuggerStatement(node) {\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return node.finishDebuggerStatement();\n }", "function parseDebuggerStatement(node) {\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return node.finishDebuggerStatement();\n }", "function _debug(str) {\n\tif (window.console && window.console.log) window.console.log(str);\n }", "function debug(s) {\n var debug = document.getElementById('debug');\n if (debug) {\n debug.innerHTML = debug.innerHTML + '<br/>' + s;\n }\n }", "function parseDebuggerStatement() {\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return {\n type: Syntax.DebuggerStatement\n };\n }", "function parseDebuggerStatement() {\n expectKeyword('debugger');\n\n consumeSemicolon();\n\n return {\n type: Syntax.DebuggerStatement\n };\n }" ]
[ "0.8074313", "0.77257836", "0.72598785", "0.7027484", "0.6939135", "0.69370955", "0.68971294", "0.6842765", "0.68419385", "0.67382675", "0.6726629", "0.6696662", "0.6649109", "0.6643033", "0.6643033", "0.6640355", "0.6640355", "0.6640355", "0.6640355", "0.6640355", "0.6640355", "0.6592405", "0.65834963", "0.65801036", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.65363264", "0.64921355", "0.6482054", "0.64402694", "0.64308816", "0.6421999", "0.6418454", "0.6384251", "0.6341476", "0.6341476", "0.63315684", "0.63315684", "0.63315684", "0.6329494", "0.6315391", "0.6315391", "0.6315391", "0.6315391", "0.6315391", "0.6315391", "0.63047755", "0.6303425", "0.6300923", "0.6300923" ]
0.64237094
81
Radix 2 FFT Adapted from Paul Bourke's C Implementation
function fftRadix2(dir, nrows, ncols, buffer, x_ptr, y_ptr) { dir |= 0 nrows |= 0 ncols |= 0 x_ptr |= 0 y_ptr |= 0 var nn,m,i,i1,j,k,i2,l,l1,l2 var c1,c2,t,t1,t2,u1,u2,z,row,a,b,c,d,k1,k2,k3 // Calculate the number of points nn = ncols m = bits.log2(nn) for(row=0; row<nrows; ++row) { // Do the bit reversal i2 = nn >> 1; j = 0; for(i=0;i<nn-1;i++) { if(i < j) { t = buffer[x_ptr+i] buffer[x_ptr+i] = buffer[x_ptr+j] buffer[x_ptr+j] = t t = buffer[y_ptr+i] buffer[y_ptr+i] = buffer[y_ptr+j] buffer[y_ptr+j] = t } k = i2 while(k <= j) { j -= k k >>= 1 } j += k } // Compute the FFT c1 = -1.0 c2 = 0.0 l2 = 1 for(l=0;l<m;l++) { l1 = l2 l2 <<= 1 u1 = 1.0 u2 = 0.0 for(j=0;j<l1;j++) { for(i=j;i<nn;i+=l2) { i1 = i + l1 a = buffer[x_ptr+i1] b = buffer[y_ptr+i1] c = buffer[x_ptr+i] d = buffer[y_ptr+i] k1 = u1 * (a + b) k2 = a * (u2 - u1) k3 = b * (u1 + u2) t1 = k1 - k3 t2 = k1 + k2 buffer[x_ptr+i1] = c - t1 buffer[y_ptr+i1] = d - t2 buffer[x_ptr+i] += t1 buffer[y_ptr+i] += t2 } k1 = c1 * (u1 + u2) k2 = u1 * (c2 - c1) k3 = u2 * (c1 + c2) u1 = k1 - k3 u2 = k1 + k2 } c2 = Math.sqrt((1.0 - c1) / 2.0) if(dir < 0) { c2 = -c2 } c1 = Math.sqrt((1.0 + c1) / 2.0) } // Scaling for inverse transform if(dir < 0) { var scale_f = 1.0 / nn for(i=0;i<nn;i++) { buffer[x_ptr+i] *= scale_f buffer[y_ptr+i] *= scale_f } } // Advance pointers x_ptr += ncols y_ptr += ncols } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FFT$1(){var _n=0,// order\n_bitrev=null,// bit reversal table\n_cstb=null;// sin/cos table\nvar _tre,_tim;this.init=function(n){if(n!==0&&(n&n-1)===0){_n=n;_setVariables();_makeBitReversal();_makeCosSinTable();}else{throw new Error('init: radix-2 required');}};// 1D-FFT\nthis.fft1d=function(re,im){fft(re,im,1);};// 1D-IFFT\nthis.ifft1d=function(re,im){var n=1/_n;fft(re,im,-1);for(var i=0;i<_n;i++){re[i]*=n;im[i]*=n;}};// 2D-FFT\nthis.fft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.fft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT\nthis.ifft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT, real-valued\n// only outputs the real valued part\nthis.real_ifft2d=function(re,im){var i2;var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nvar halfn=_n/2;var rowIdx=0;for(var x=0;x<_n;x+=2){//untangle\ni=x;i2=x+1;_tre[0]=re[0+i];_tim[0]=re[0+i2];_tre[_n/2]=re[halfn*_n+i];_tim[_n/2]=re[halfn*_n+i2];for(var x2=1;x2<halfn;x2++){rowIdx=x2*_n;_tre[x2]=re[rowIdx+i]-im[rowIdx+i2];_tre[_n-x2]=re[rowIdx+i]+im[rowIdx+i2];_tim[x2]=im[rowIdx+i]+re[rowIdx+i2];_tim[_n-x2]=re[rowIdx+i2]-im[rowIdx+i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;i2=x+1+y2*_n;re[i]=_tre[y2];re[i2]=_tim[y2];}}};// 2D-FFT, real-valued only\n// ignores the imaginary input\n// see:\n// http://www.inf.fu-berlin.de/lehre/SS12/SP-Par/download/fft1.pdf\n// http://cnx.org/content/m12021/latest/\n// http://images.apple.com/acg/pdf/g4fft.pdf\n// http://www.ti.com/lit/an/spra291/spra291.pdf\nthis.real_fft2d=function(re,im){var i=0,i2=0;// x-axis\nfor(var y=0;y<_n;y+=2){i=y*_n;i2=(y+1)*_n;// tangle\nfor(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=re[x1+i2];}this.fft1d(_tre,_tim);// untangle\nre[0+i]=_tre[0];re[0+i2]=_tim[0];im[0+i]=0;im[0+i2]=0;re[_n/2+i]=_tre[_n/2];re[_n/2+i2]=_tim[_n/2];im[_n/2+i]=0;im[_n/2+i2]=0;for(var x2=1;x2<_n/2;x2++){re[x2+i]=0.5*(_tre[x2]+_tre[_n-x2]);im[x2+i]=0.5*(_tim[x2]-_tim[_n-x2]);re[x2+i2]=0.5*(_tim[x2]+_tim[_n-x2]);im[x2+i2]=-0.5*(_tre[x2]-_tre[_n-x2]);re[_n-x2+i]=re[x2+i];im[_n-x2+i]=-im[x2+i];re[_n-x2+i2]=re[x2+i2];im[_n-x2+i2]=-im[x2+i2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// core operation of FFT\nfunction fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\n//butfly(re,im,inv,n4);\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}function _setVariables(){if(typeof Uint8Array!=='undefined'){_bitrev=new Uint8Array(_n);}else{_bitrev=new Array(_n);}if(typeof Float64Array!=='undefined'){_cstb=new Float64Array(_n*1.25);_tre=new Float64Array(_n);_tim=new Float64Array(_n);}else{_cstb=new Array(_n*1.25);_tre=new Array(_n);_tim=new Array(_n);}}// make bit reversal table\nfunction _makeBitReversal(){var i=0,j=0,k=0;_bitrev[0]=0;while(++i<_n){k=_n>>1;while(k<=j){j-=k;k>>=1;}j+=k;_bitrev[i]=j;}}// make trigonometric function table\nfunction _makeCosSinTable(){var n2=_n>>1,n4=_n>>2,n8=_n>>3,n2p4=n2+n4,t=Math.sin(Math.PI/_n),dc=2*t*t,ds=Math.sqrt(dc*(2-dc)),c=_cstb[n4]=1,s=_cstb[0]=0;t=2*dc;for(var i=1;i<n8;i++){c-=dc;dc+=t*c;s+=ds;ds-=t*s;_cstb[i]=s;_cstb[n4-i]=c;}if(n8!==0){_cstb[n8]=Math.sqrt(0.5);}for(var j=0;j<n4;j++){_cstb[n2-j]=_cstb[j];}for(var k=0;k<n2p4;k++){_cstb[k+n2]=-_cstb[k];}}}", "function fftRadix2(realVals, imagVals, size, inverse, cpuBackend) {\n if (size === 1) {\n return { real: realVals, imag: imagVals };\n }\n const data = backend_util.mergeRealAndImagArrays(realVals, imagVals);\n const half = size / 2;\n const evenComplex = backend_util.complexWithEvenIndex(data);\n const evenRealVals = evenComplex.real;\n const evenImagVals = evenComplex.imag;\n const evenShape = [evenRealVals.length];\n const evenRealInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenRealVals);\n const evenImagInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenImagVals);\n const evenTensorInfo = complex({ inputs: { real: evenRealInfo, imag: evenImagInfo }, backend: cpuBackend });\n const oddComplex = backend_util.complexWithOddIndex(data);\n const oddRealVals = oddComplex.real;\n const oddImagVals = oddComplex.imag;\n const oddShape = [oddRealVals.length];\n const oddRealInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddRealVals);\n const oddImagInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddImagVals);\n const oddTensorInfo = complex({ inputs: { real: oddRealInfo, imag: oddImagInfo }, backend: cpuBackend });\n // Recursive call for half part of original input.\n const $evenComplex = fftRadix2(evenRealVals, evenImagVals, half, inverse, cpuBackend);\n const $evenRealVals = $evenComplex.real;\n const $evenImagVals = $evenComplex.imag;\n const $evenShape = [$evenRealVals.length];\n const $evenRealInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenRealVals);\n const $evenImagInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenImagVals);\n const $evenTensorInfo = complex({\n inputs: { real: $evenRealInfo, imag: $evenImagInfo },\n backend: cpuBackend\n });\n const $oddComplex = fftRadix2(oddRealVals, oddImagVals, half, inverse, cpuBackend);\n const $oddRealVals = $oddComplex.real;\n const $oddImagVals = $oddComplex.imag;\n const $oddShape = [$oddRealVals.length];\n const $oddRealInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddRealVals);\n const $oddImagInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddImagVals);\n const $oddTensorInfo = complex({ inputs: { real: $oddRealInfo, imag: $oddImagInfo }, backend: cpuBackend });\n const e = backend_util.exponents(size, inverse);\n const eShape = [e.real.length];\n const eRealInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.real);\n const eImagInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.imag);\n const complexInfo = complex({ inputs: { real: eRealInfo, imag: eImagInfo }, backend: cpuBackend });\n const exponentInfo = multiply({ inputs: { a: complexInfo, b: $oddTensorInfo }, backend: cpuBackend });\n const addPart = add({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const subPart = sub({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const addPartReal = real({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartReal = real({ inputs: { input: subPart }, backend: cpuBackend });\n const addPartImag = imag({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartImag = imag({ inputs: { input: subPart }, backend: cpuBackend });\n const $real = concat({\n inputs: [addPartReal, subPartReal],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $imag = concat({\n inputs: [addPartImag, subPartImag],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $realVals = cpuBackend.data.get($real.dataId).values;\n const $imagVals = cpuBackend.data.get($imag.dataId).values;\n cpuBackend.disposeIntermediateTensorInfo(evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(eRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(eImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(complexInfo);\n cpuBackend.disposeIntermediateTensorInfo(exponentInfo);\n cpuBackend.disposeIntermediateTensorInfo(addPart);\n cpuBackend.disposeIntermediateTensorInfo(subPart);\n cpuBackend.disposeIntermediateTensorInfo(addPartReal);\n cpuBackend.disposeIntermediateTensorInfo(addPartImag);\n cpuBackend.disposeIntermediateTensorInfo(subPartReal);\n cpuBackend.disposeIntermediateTensorInfo(subPartImag);\n cpuBackend.disposeIntermediateTensorInfo($real);\n cpuBackend.disposeIntermediateTensorInfo($imag);\n return { real: $realVals, imag: $imagVals };\n}", "function FFT(){var _n=0,// order\n_bitrev=null,// bit reversal table\n_cstb=null;// sin/cos table\nvar _tre,_tim;this.init=function(n){if(n!==0&&(n&n-1)===0){_n=n;_setVariables();_makeBitReversal();_makeCosSinTable();}else{throw new Error(\"init: radix-2 required\");}};// 1D-FFT\nthis.fft1d=function(re,im){fft(re,im,1);};// 1D-IFFT\nthis.ifft1d=function(re,im){var n=1/_n;fft(re,im,-1);for(var i=0;i<_n;i++){re[i]*=n;im[i]*=n;}};// 2D-FFT\nthis.fft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.fft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT\nthis.ifft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// core operation of FFT\nfunction fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}// set variables\nfunction _setVariables(){if(typeof Uint8Array!=='undefined'){_bitrev=new Uint8Array(_n);}else{_bitrev=new Array(_n);}if(typeof Float64Array!=='undefined'){_cstb=new Float64Array(_n*1.25);_tre=new Float64Array(_n*_n);_tim=new Float64Array(_n*_n);}else{_cstb=new Array(_n*1.25);_tre=new Array(_n*_n);_tim=new Array(_n*_n);}}// make bit reversal table\nfunction _makeBitReversal(){var i=0,j=0,k=0;_bitrev[0]=0;while(++i<_n){k=_n>>1;while(k<=j){j-=k;k>>=1;}j+=k;_bitrev[i]=j;}}// make trigonometric function table\nfunction _makeCosSinTable(){var n2=_n>>1,n4=_n>>2,n8=_n>>3,n2p4=n2+n4,t=Math.sin(Math.PI/_n),dc=2*t*t,ds=Math.sqrt(dc*(2-dc)),c=_cstb[n4]=1,s=_cstb[0]=0;t=2*dc;for(var i=1;i<n8;i++){c-=dc;dc+=t*c;s+=ds;ds-=t*s;_cstb[i]=s;_cstb[n4-i]=c;}if(n8!==0){_cstb[n8]=Math.sqrt(0.5);}for(var j=0;j<n4;j++){_cstb[n2-j]=_cstb[j];}for(var k=0;k<n2p4;k++){_cstb[k+n2]=-_cstb[k];}}}", "function transformRadix2(real, imag) {\n // Initialization\n if (real.length != imag.length)\n throw \"Mismatched lengths\";\n var n = real.length;\n if (n == 1)\n // Trivial transform\n return;\n var levels = -1;\n for (var i = 0; i < 32; i++) {\n if (1 << i == n)\n levels = i;\n // Equal to log2(n)\n }\n if (levels == -1)\n throw \"Length is not a power of 2\";\n var cosTable = new Array(n / 2);\n var sinTable = new Array(n / 2);\n for (var i = 0; i < n / 2; i++) {\n cosTable[i] = Math.cos(2 * Math.PI * i / n);\n sinTable[i] = Math.sin(2 * Math.PI * i / n);\n }\n\n // Bit-reversed addressing permutation\n for (var i = 0; i < n; i++) {\n var j = reverseBits(i, levels);\n if (j > i) {\n var temp = real[i];\n real[i] = real[j];\n real[j] = temp;\n temp = imag[i];\n imag[i] = imag[j];\n imag[j] = temp;\n }\n }\n\n // Cooley-Tukey decimation-in-time radix-2 FFT\n for (var size = 2; size <= n; size *= 2) {\n var halfsize = size / 2;\n var tablestep = n / size;\n for (var i = 0; i < n; i += size) {\n for (var j = i, k = 0; j < i + halfsize; j++,\n k += tablestep) {\n var tpre = real[j + halfsize] * cosTable[k] + imag[j + halfsize] * sinTable[k];\n var tpim = -real[j + halfsize] * sinTable[k] + imag[j + halfsize] * cosTable[k];\n real[j + halfsize] = real[j] - tpre;\n imag[j + halfsize] = imag[j] - tpim;\n real[j] += tpre;\n imag[j] += tpim;\n }\n }\n }\n\n // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n function reverseBits(x, bits) {\n var y = 0;\n for (var i = 0; i < bits; i++) {\n y = (y << 1) | (x & 1);\n x >>>= 1;\n }\n return y;\n }\n}", "function fft_rx2 (re, im) {\n let N = re.length;\n if (N.toString(2) % 10) // return immediately if N is not power of 2\n return;\n else if (N <= 32) // if N is sufficiently small, compute dft directly\n return dft_direct(re, im);\n\n let W = discrete_circle(N); // N evenly spaced points around the unit circle\n im = im || re.map( a => 0 ); // set imaginary values to zero if not provided\n\n // compute N/2-point DFT for even and odd samples of input array\n let S_1 = fft_rx2(...[re, im].map( a => a.filter( (_, i) => !(i % 2) ) ));\n let S_2 = fft_rx2(...[re, im].map( a => a.filter( (_, i) => i % 2 ) ));\n\n // mutiply by twiddle factor. later, exploit symmetry W[k+N/2] = -W[k]\n let G_2 = S_2.map( (a, k) => cpx_mult(a, W[k % N]) );\n\n // combine for all frequencies k in N/2-1\n let X = [];\n for (let k of xrange(N/2)) {\n X[k] = cpx_add(S_1[k], G_2[k]);\n X[k + N/2] = cpx_sub(S_1[k], G_2[k]);\n }\n\n return X;\n}", "function transformRadix2(real, imag) {\n // Initialization\n var i, j, k;\n if (real.length !== imag.length)\n throw \"Mismatched lengths\";\n var n = real.length;\n if (n === 1) // Trivial transform\n return;\n var levels = -1;\n for (i = 0; i < 32; i++) {\n if (1 << i === n)\n levels = i; // Equal to log2(n)\n }\n if (levels === -1)\n throw \"Length is not a power of 2\";\n var cosTable = new Array(n / 2);\n var sinTable = new Array(n / 2);\n for (i = 0; i < n / 2; i++) {\n cosTable[i] = Math.cos(2 * Math.PI * i / n);\n sinTable[i] = Math.sin(2 * Math.PI * i / n);\n }\n\n // Bit-reversed addressing permutation\n for (i = 0; i < n; i++) {\n j = reverseBits(i, levels);\n if (j > i) {\n var temp = real[i];\n real[i] = real[j];\n real[j] = temp;\n temp = imag[i];\n imag[i] = imag[j];\n imag[j] = temp;\n }\n }\n\n // Cooley-Tukey decimation-in-time radix-2 FFT\n for (var size = 2; size <= n; size *= 2) {\n var halfsize = size / 2;\n var tablestep = n / size;\n for (i = 0; i < n; i += size) {\n for (j = i, k = 0; j < i + halfsize; j++, k += tablestep) {\n var tpre = real[j + halfsize] * cosTable[k] + imag[j + halfsize] * sinTable[k];\n var tpim = -real[j + halfsize] * sinTable[k] + imag[j + halfsize] * cosTable[k];\n real[j + halfsize] = real[j] - tpre;\n imag[j + halfsize] = imag[j] - tpim;\n real[j] += tpre;\n imag[j] += tpim;\n }\n }\n }\n\n // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n function reverseBits(x, bits) {\n var y = 0;\n for (var i = 0; i < bits; i++) {\n y = (y << 1) | (x & 1);\n x >>>= 1;\n }\n return y;\n }\n}", "function transformRadix2(real, imag) {\n\t // Initialization\n\t if (real.length != imag.length) throw \"Mismatched lengths\";\n\t var n = real.length;\n\t if (n == 1) // Trivial transform\n\t return;\n\t var levels = -1;\n\t for (var i = 0; i < 32; i++) {\n\t if (1 << i == n) levels = i; // Equal to log2(n)\n\t }\n\t if (levels == -1) throw \"Length is not a power of 2\";\n\t var cosTable = new Array(n / 2);\n\t var sinTable = new Array(n / 2);\n\t for (var i = 0; i < n / 2; i++) {\n\t cosTable[i] = Math.cos(2 * Math.PI * i / n);\n\t sinTable[i] = Math.sin(2 * Math.PI * i / n);\n\t }\n\n\t // Bit-reversed addressing permutation\n\t for (var i = 0; i < n; i++) {\n\t var j = reverseBits(i, levels);\n\t if (j > i) {\n\t var temp = real[i];\n\t real[i] = real[j];\n\t real[j] = temp;\n\t temp = imag[i];\n\t imag[i] = imag[j];\n\t imag[j] = temp;\n\t }\n\t }\n\n\t // Cooley-Tukey decimation-in-time radix-2 FFT\n\t for (var size = 2; size <= n; size *= 2) {\n\t var halfsize = size / 2;\n\t var tablestep = n / size;\n\t for (var i = 0; i < n; i += size) {\n\t for (var j = i, k = 0; j < i + halfsize; j++, k += tablestep) {\n\t var tpre = real[j + halfsize] * cosTable[k] + imag[j + halfsize] * sinTable[k];\n\t var tpim = -real[j + halfsize] * sinTable[k] + imag[j + halfsize] * cosTable[k];\n\t real[j + halfsize] = real[j] - tpre;\n\t imag[j + halfsize] = imag[j] - tpim;\n\t real[j] += tpre;\n\t imag[j] += tpim;\n\t }\n\t }\n\t }\n\n\t // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n\t function reverseBits(x, bits) {\n\t var y = 0;\n\t for (var i = 0; i < bits; i++) {\n\t y = y << 1 | x & 1;\n\t x >>>= 1;\n\t }\n\t return y;\n\t }\n\t}", "function fftRadix2(realVals, imagVals, size, inverse, cpuBackend) {\n if (size === 1) {\n return { real: realVals, imag: imagVals };\n }\n const data = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].mergeRealAndImagArrays(realVals, imagVals);\n const half = size / 2;\n const evenComplex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].complexWithEvenIndex(data);\n const evenRealVals = evenComplex.real;\n const evenImagVals = evenComplex.imag;\n const evenShape = [evenRealVals.length];\n const evenRealInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenRealVals);\n const evenImagInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenImagVals);\n const evenTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: evenRealInfo, imag: evenImagInfo }, backend: cpuBackend });\n const oddComplex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].complexWithOddIndex(data);\n const oddRealVals = oddComplex.real;\n const oddImagVals = oddComplex.imag;\n const oddShape = [oddRealVals.length];\n const oddRealInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddRealVals);\n const oddImagInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddImagVals);\n const oddTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: oddRealInfo, imag: oddImagInfo }, backend: cpuBackend });\n // Recursive call for half part of original input.\n const $evenComplex = fftRadix2(evenRealVals, evenImagVals, half, inverse, cpuBackend);\n const $evenRealVals = $evenComplex.real;\n const $evenImagVals = $evenComplex.imag;\n const $evenShape = [$evenRealVals.length];\n const $evenRealInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenRealVals);\n const $evenImagInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenImagVals);\n const $evenTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({\n inputs: { real: $evenRealInfo, imag: $evenImagInfo },\n backend: cpuBackend\n });\n const $oddComplex = fftRadix2(oddRealVals, oddImagVals, half, inverse, cpuBackend);\n const $oddRealVals = $oddComplex.real;\n const $oddImagVals = $oddComplex.imag;\n const $oddShape = [$oddRealVals.length];\n const $oddRealInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddRealVals);\n const $oddImagInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddImagVals);\n const $oddTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: $oddRealInfo, imag: $oddImagInfo }, backend: cpuBackend });\n const e = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].exponents(size, inverse);\n const eShape = [e.real.length];\n const eRealInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.real);\n const eImagInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.imag);\n const complexInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: eRealInfo, imag: eImagInfo }, backend: cpuBackend });\n const exponentInfo = Object(_kernels_Multiply__WEBPACK_IMPORTED_MODULE_6__[\"multiply\"])({ inputs: { a: complexInfo, b: $oddTensorInfo }, backend: cpuBackend });\n const addPart = Object(_kernels_Add__WEBPACK_IMPORTED_MODULE_1__[\"add\"])({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const subPart = Object(_kernels_Sub__WEBPACK_IMPORTED_MODULE_10__[\"sub\"])({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const addPartReal = Object(_kernels_Real__WEBPACK_IMPORTED_MODULE_7__[\"real\"])({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartReal = Object(_kernels_Real__WEBPACK_IMPORTED_MODULE_7__[\"real\"])({ inputs: { input: subPart }, backend: cpuBackend });\n const addPartImag = Object(_kernels_Imag__WEBPACK_IMPORTED_MODULE_5__[\"imag\"])({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartImag = Object(_kernels_Imag__WEBPACK_IMPORTED_MODULE_5__[\"imag\"])({ inputs: { input: subPart }, backend: cpuBackend });\n const $real = Object(_kernels_Concat__WEBPACK_IMPORTED_MODULE_3__[\"concat\"])({\n inputs: [addPartReal, subPartReal],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $imag = Object(_kernels_Concat__WEBPACK_IMPORTED_MODULE_3__[\"concat\"])({\n inputs: [addPartImag, subPartImag],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $realVals = cpuBackend.data.get($real.dataId).values;\n const $imagVals = cpuBackend.data.get($imag.dataId).values;\n cpuBackend.disposeIntermediateTensorInfo(evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(eRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(eImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(complexInfo);\n cpuBackend.disposeIntermediateTensorInfo(exponentInfo);\n cpuBackend.disposeIntermediateTensorInfo(addPart);\n cpuBackend.disposeIntermediateTensorInfo(subPart);\n cpuBackend.disposeIntermediateTensorInfo(addPartReal);\n cpuBackend.disposeIntermediateTensorInfo(addPartImag);\n cpuBackend.disposeIntermediateTensorInfo(subPartReal);\n cpuBackend.disposeIntermediateTensorInfo(subPartImag);\n cpuBackend.disposeIntermediateTensorInfo($real);\n cpuBackend.disposeIntermediateTensorInfo($imag);\n return { real: $realVals, imag: $imagVals };\n}", "function fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}// set variables", "function RealFFT( NumSamples, RealIn, RealOut, ImagOut)\n{\n\n var Half = NumSamples / 2;\n var i;\n\n var theta = Math.PI / Half;\n\n var tmpReal = new Float32Array(Half);\n var tmpImag = new Float32Array(Half);\n\n for (var i = 0; i < Half; i++) {\n tmpReal[i] = RealIn[2 * i];\n tmpImag[i] = RealIn[2 * i + 1];\n }\n\n ACFFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);\n\n var wtemp = (Math.sin(0.5 * theta));\n\n var wpr = -2.0 * wtemp * wtemp;\n var wpi = -1.0 * (Math.sin(theta));\n var wr = 1.0 + wpr;\n var wi = wpi;\n\n var i3;\n\n var h1r, h1i, h2r, h2i;\n\n for (var i = 1; i < Half / 2; i++) {\n\n i3 = Half - i;\n\n h1r = 0.5 * (RealOut[i] + RealOut[i3]);\n h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);\n h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);\n h2i = -0.5 * (RealOut[i] - RealOut[i3]);\n\n RealOut[i] = h1r + wr * h2r - wi * h2i;\n ImagOut[i] = h1i + wr * h2i + wi * h2r;\n RealOut[i3] = h1r - wr * h2r + wi * h2i;\n ImagOut[i3] = -h1i + wr * h2i + wi * h2r;\n\n wr = (wtemp = wr) * wpr - wi * wpi + wr;\n wi = wi * wpr + wtemp * wpi + wi;\n }\n\n RealOut[0] = (h1r = RealOut[0]) + ImagOut[0];\n ImagOut[0] = h1r - ImagOut[0];\n}", "function fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\n//butfly(re,im,inv,n4);\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}", "function ACFFT( NumSamples,\n InverseTransform,\n RealIn, ImagIn, RealOut, ImagOut)\n{\n var NumBits; /* Number of bits needed to store indices */\n var i, j, k, n;\n var BlockSize, BlockEnd;\n\n var angle_numerator = 2.0 * Math.PI;\n var tr, ti; /* temp real, temp imaginary */\n\n if (!IsPowerOfTwo(NumSamples)) {\n console.log(NumSamples + \" is not a power of two\");\n return 1;\n }\n\n if (!gFFTBitTable)\n ACInitFFT();\n\n if (!InverseTransform)\n angle_numerator = -angle_numerator;\n\n NumBits = NumberOfBitsNeeded(NumSamples);\n\n /*\n ** Do simultaneous data copy and bit-reversal ordering into outputs...\n */\n\n for (var i = 0; i < NumSamples; i++) {\n j = FastReverseBits(i, NumBits);\n RealOut[j] = RealIn[i];\n ImagOut[j] = (ImagIn === undefined) ? 0.0 : ImagIn[i];\n }\n\n /*\n ** Do the FFT itself...\n */\n\n BlockEnd = 1;\n for (BlockSize = 2; BlockSize <= NumSamples; BlockSize <<= 1) {\n\n var delta_angle = angle_numerator / BlockSize;\n\n var sm2 = Math.sin(-2 * delta_angle);\n var sm1 = Math.sin(-delta_angle);\n var cm2 = Math.cos(-2 * delta_angle);\n var cm1 = Math.cos(-delta_angle);\n var w = 2 * cm1;\n var ar0, ar1, ar2, ai0, ai1, ai2;\n\n for (var i = 0; i < NumSamples; i += BlockSize) {\n ar2 = cm2;\n ar1 = cm1;\n\n ai2 = sm2;\n ai1 = sm1;\n\n for (var j = i, n = 0; n < BlockEnd; j++, n++) {\n ar0 = w * ar1 - ar2;\n ar2 = ar1;\n ar1 = ar0;\n\n ai0 = w * ai1 - ai2;\n ai2 = ai1;\n ai1 = ai0;\n\n k = j + BlockEnd;\n tr = ar0 * RealOut[k] - ai0 * ImagOut[k];\n ti = ar0 * ImagOut[k] + ai0 * RealOut[k];\n\n RealOut[k] = RealOut[j] - tr;\n ImagOut[k] = ImagOut[j] - ti;\n\n RealOut[j] += tr;\n ImagOut[j] += ti;\n }\n }\n\n BlockEnd = BlockSize;\n }\n\n /*\n ** Need to normalize if inverse transform...\n */\n\n if (InverseTransform) {\n var denom = NumSamples;\n\n for (var i = 0; i < NumSamples; i++) {\n RealOut[i] /= denom;\n ImagOut[i] /= denom;\n }\n }\n}", "function fft(input) {\n var\n n = input.length,\n nHalf,\n even,\n odd,\n output = [],\n wnkMultiplied,\n wnk,\n k,\n r;\n\n if (n === 1) {\n return input;\n }\n\n // even and odd parts\n even = fft(getListHalf(input, 0));\n odd = fft(getListHalf(input, 1));\n\n // combine\n output.length = n;\n nHalf = n / 2;\n for (k = 0; k < nHalf; k++) {\n r = -2 * Math.PI * k / n;\n wnk = getComplexFromRadians(r);\n wnkMultiplied = complexMultiply(wnk, odd[k]);\n output[k] = complexAdd(even[k], wnkMultiplied);\n output[nHalf + k] = complexSubtract(even[k], wnkMultiplied);\n }\n\n return output;\n}", "function fft_2chan() {\n var splitter = audioContext.createChannelSplitter(2);\n var merger = audioContext.createChannelMerger(2);\n\n analyzer_left = audioContext.createAnalyser();\n analyzer_right = audioContext.createAnalyser();\n analyzer_left.fftSize = FFT_SIZE;\n analyzer_right.fftSize = FFT_SIZE;\n\n splitter.connect(analyzer_left, 0, 0);\n splitter.connect(analyzer_right, 1, 0);\n analyzer_left.connect(merger, 0, 0);\n analyzer_right.connect(merger, 0, 1);\n\n function input(n) {\n return [pin(splitter)];\n }\n\n function output(n) {\n return [pin(merger)];\n }\n\n this.input = input;\n this.output = output;\n}", "function fft(x) {\n return fftComplexDirection(x,false);\n}", "function fftBluestein(dir, nrows, ncols, buffer, x_ptr, y_ptr, scratch_ptr) {\n dir |= 0\n nrows |= 0\n ncols |= 0\n x_ptr |= 0\n y_ptr |= 0\n scratch_ptr |= 0\n\n // Initialize tables\n var m = bits.nextPow2(2 * ncols + 1)\n , cos_ptr = scratch_ptr\n , sin_ptr = cos_ptr + ncols\n , xs_ptr = sin_ptr + ncols\n , ys_ptr = xs_ptr + m\n , cft_ptr = ys_ptr + m\n , sft_ptr = cft_ptr + m\n , w = -dir * Math.PI / ncols\n , row, a, b, c, d, k1, k2, k3\n , i\n for(i=0; i<ncols; ++i) {\n a = w * ((i * i) % (ncols * 2))\n c = Math.cos(a)\n d = Math.sin(a)\n buffer[cft_ptr+(m-i)] = buffer[cft_ptr+i] = buffer[cos_ptr+i] = c\n buffer[sft_ptr+(m-i)] = buffer[sft_ptr+i] = buffer[sin_ptr+i] = d\n }\n for(i=ncols; i<=m-ncols; ++i) {\n buffer[cft_ptr+i] = 0.0\n }\n for(i=ncols; i<=m-ncols; ++i) {\n buffer[sft_ptr+i] = 0.0\n }\n\n fftRadix2(1, 1, m, buffer, cft_ptr, sft_ptr)\n \n //Compute scale factor\n if(dir < 0) {\n w = 1.0 / ncols\n } else {\n w = 1.0\n }\n \n //Handle direction\n for(row=0; row<nrows; ++row) {\n \n // Copy row into scratch memory, multiply weights\n for(i=0; i<ncols; ++i) {\n a = buffer[x_ptr+i]\n b = buffer[y_ptr+i]\n c = buffer[cos_ptr+i]\n d = -buffer[sin_ptr+i]\n k1 = c * (a + b)\n k2 = a * (d - c)\n k3 = b * (c + d)\n buffer[xs_ptr+i] = k1 - k3\n buffer[ys_ptr+i] = k1 + k2\n }\n //Zero out the rest\n for(i=ncols; i<m; ++i) {\n buffer[xs_ptr+i] = 0.0\n }\n for(i=ncols; i<m; ++i) {\n buffer[ys_ptr+i] = 0.0\n }\n \n // FFT buffer\n fftRadix2(1, 1, m, buffer, xs_ptr, ys_ptr)\n \n // Apply multiplier\n for(i=0; i<m; ++i) {\n a = buffer[xs_ptr+i]\n b = buffer[ys_ptr+i]\n c = buffer[cft_ptr+i]\n d = buffer[sft_ptr+i]\n k1 = c * (a + b)\n k2 = a * (d - c)\n k3 = b * (c + d)\n buffer[xs_ptr+i] = k1 - k3\n buffer[ys_ptr+i] = k1 + k2\n }\n \n // Inverse FFT buffer\n fftRadix2(-1, 1, m, buffer, xs_ptr, ys_ptr)\n \n // Copy result back into x/y\n for(i=0; i<ncols; ++i) {\n a = buffer[xs_ptr+i]\n b = buffer[ys_ptr+i]\n c = buffer[cos_ptr+i]\n d = -buffer[sin_ptr+i]\n k1 = c * (a + b)\n k2 = a * (d - c)\n k3 = b * (c + d)\n buffer[x_ptr+i] = w * (k1 - k3)\n buffer[y_ptr+i] = w * (k1 + k2)\n }\n \n x_ptr += ncols\n y_ptr += ncols\n }\n}", "function realFft(input, output) {\n\n var n = input.length,\n x = output, \n TWO_PI = 2*Math.PI,\n sqrt = Math.sqrt,\n n2, n4, n8, nn, \n t1, t2, t3, t4, \n i1, i2, i3, i4, i5, i6, i7, i8, \n st1, cc1, ss1, cc3, ss3,\n e, \n a,\n rval, ival, mag; \n\n _reverseBinPermute(output, input);\n\n for (var ix = 0, id = 4; ix < n; id *= 4) {\n for (var i0 = ix; i0 < n; i0 += id) {\n //sumdiff(x[i0], x[i0+1]); // {a, b} <--| {a+b, a-b}\n st1 = x[i0] - x[i0+1];\n x[i0] += x[i0+1];\n x[i0+1] = st1;\n } \n ix = 2*(id-1);\n }\n\n n2 = 2;\n nn = n >>> 1;\n\n while((nn = nn >>> 1)) {\n ix = 0;\n n2 = n2 << 1;\n id = n2 << 1;\n n4 = n2 >>> 2;\n n8 = n2 >>> 3;\n do {\n if(n4 !== 1) {\n for(i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1; \n x[i1] += t1;\n \n i1 += n8;\n i2 += n8;\n i3 += n8;\n i4 += n8;\n \n //sumdiff(x[i3], x[i4], t1, t2); // {s, d} <--| {a+b, a-b}\n t1 = x[i3] + x[i4];\n t2 = x[i3] - x[i4];\n \n t1 = -t1 * Math.SQRT1_2;\n t2 *= Math.SQRT1_2;\n \n // sumdiff(t1, x[i2], x[i4], x[i3]); // {s, d} <--| {a+b, a-b}\n st1 = x[i2];\n x[i4] = t1 + st1; \n x[i3] = t1 - st1;\n \n //sumdiff3(x[i1], t2, x[i2]); // {a, b, d} <--| {a+b, b, a-b}\n x[i2] = x[i1] - t2;\n x[i1] += t2;\n }\n } else {\n for(i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4]; \n x[i4] -= x[i3];\n \n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1; \n x[i1] += t1;\n }\n }\n \n ix = (id << 1) - n2;\n id = id << 2;\n } while (ix < n);\n \n e = TWO_PI / n2;\n\n for (var j = 1; j < n8; j++) {\n a = j * e;\n ss1 = Math.sin(a);\n cc1 = Math.cos(a);\n\n //ss3 = sin(3*a); cc3 = cos(3*a);\n cc3 = 4*cc1*(cc1*cc1-0.75);\n ss3 = 4*ss1*(0.75-ss1*ss1);\n \n ix = 0; id = n2 << 1;\n do {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0 + j;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n i5 = i0 + n4 - j;\n i6 = i5 + n4;\n i7 = i6 + n4;\n i8 = i7 + n4;\n \n //cmult(c, s, x, y, &u, &v)\n //cmult(cc1, ss1, x[i7], x[i3], t2, t1); // {u,v} <--| {x*c-y*s, x*s+y*c}\n t2 = x[i7]*cc1 - x[i3]*ss1; \n t1 = x[i7]*ss1 + x[i3]*cc1;\n \n //cmult(cc3, ss3, x[i8], x[i4], t4, t3);\n t4 = x[i8]*cc3 - x[i4]*ss3; \n t3 = x[i8]*ss3 + x[i4]*cc3;\n \n //sumdiff(t2, t4); // {a, b} <--| {a+b, a-b}\n st1 = t2 - t4;\n t2 += t4;\n t4 = st1;\n \n //sumdiff(t2, x[i6], x[i8], x[i3]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i6]; x[i8] = t2 + st1; x[i3] = t2 - st1;\n x[i8] = t2 + x[i6]; \n x[i3] = t2 - x[i6];\n \n //sumdiff_r(t1, t3); // {a, b} <--| {a+b, b-a}\n st1 = t3 - t1;\n t1 += t3;\n t3 = st1;\n \n //sumdiff(t3, x[i2], x[i4], x[i7]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i2]; x[i4] = t3 + st1; x[i7] = t3 - st1;\n x[i4] = t3 + x[i2]; \n x[i7] = t3 - x[i2];\n \n //sumdiff3(x[i1], t1, x[i6]); // {a, b, d} <--| {a+b, b, a-b}\n x[i6] = x[i1] - t1; \n x[i1] += t1;\n \n //diffsum3_r(t4, x[i5], x[i2]); // {a, b, s} <--| {a, b-a, a+b}\n x[i2] = t4 + x[i5]; \n x[i5] -= t4;\n }\n \n ix = (id << 1) - n2;\n id = id << 2;\n \n } while (ix < n);\n }\n }\n \n /* Scale output to have same norm as input. */\n var f = 1 / sqrt(n);\n for (var i = 0; i < n; i++)\n\t x[i] *= f;\n\n}", "function FFTM(x,y){this.x=x;this.y=y;}", "function FFTM(x,y){this.x=x;this.y=y;}", "forward(buffer) {\n var n = this.bufferSize,\n spectrum = this.spectrum,\n x = this.trans,\n TWO_PI = 2 * Math.PI,\n sqrt = Math.sqrt,\n i = n >>> 1,\n bSi = 2 / n,\n n2, n4, n8, nn,\n t1, t2, t3, t4,\n i1, i2, i3, i4, i5, i6, i7, i8,\n st1, cc1, ss1, cc3, ss3,\n e,\n a,\n rval, ival, mag;\n\n this.reverseBinPermute(x, buffer);\n\n for (var ix = 0, id = 4; ix < n; id *= 4) {\n for (var i0 = ix; i0 < n; i0 += id) {\n //sumdiff(x[i0], x[i0+1]); // {a, b} <--| {a+b, a-b}\n st1 = x[i0] - x[i0 + 1];\n x[i0] += x[i0 + 1];\n x[i0 + 1] = st1;\n }\n ix = 2 * (id - 1);\n }\n\n n2 = 2;\n nn = n >>> 1;\n\n while ((nn = nn >>> 1)) {\n ix = 0;\n n2 = n2 << 1;\n id = n2 << 1;\n n4 = n2 >>> 2;\n n8 = n2 >>> 3;\n do {\n if (n4 !== 1) {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1;\n x[i1] += t1;\n\n i1 += n8;\n i2 += n8;\n i3 += n8;\n i4 += n8;\n\n //sumdiff(x[i3], x[i4], t1, t2); // {s, d} <--| {a+b, a-b}\n t1 = x[i3] + x[i4];\n t2 = x[i3] - x[i4];\n\n t1 = -t1 * Math.SQRT1_2;\n t2 *= Math.SQRT1_2;\n\n // sumdiff(t1, x[i2], x[i4], x[i3]); // {s, d} <--| {a+b, a-b}\n st1 = x[i2];\n x[i4] = t1 + st1;\n x[i3] = t1 - st1;\n\n //sumdiff3(x[i1], t2, x[i2]); // {a, b, d} <--| {a+b, b, a-b}\n x[i2] = x[i1] - t2;\n x[i1] += t2;\n }\n } else {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1;\n x[i1] += t1;\n }\n }\n\n ix = (id << 1) - n2;\n id = id << 2;\n } while (ix < n);\n\n e = TWO_PI / n2;\n\n for (var j = 1; j < n8; j++) {\n a = j * e;\n ss1 = Math.sin(a);\n cc1 = Math.cos(a);\n\n //ss3 = sin(3*a); cc3 = cos(3*a);\n cc3 = 4 * cc1 * (cc1 * cc1 - 0.75);\n ss3 = 4 * ss1 * (0.75 - ss1 * ss1);\n\n ix = 0; id = n2 << 1;\n do {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0 + j;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n i5 = i0 + n4 - j;\n i6 = i5 + n4;\n i7 = i6 + n4;\n i8 = i7 + n4;\n\n //cmult(c, s, x, y, &u, &v)\n //cmult(cc1, ss1, x[i7], x[i3], t2, t1); // {u,v} <--| {x*c-y*s, x*s+y*c}\n t2 = x[i7] * cc1 - x[i3] * ss1;\n t1 = x[i7] * ss1 + x[i3] * cc1;\n\n //cmult(cc3, ss3, x[i8], x[i4], t4, t3);\n t4 = x[i8] * cc3 - x[i4] * ss3;\n t3 = x[i8] * ss3 + x[i4] * cc3;\n\n //sumdiff(t2, t4); // {a, b} <--| {a+b, a-b}\n st1 = t2 - t4;\n t2 += t4;\n t4 = st1;\n\n //sumdiff(t2, x[i6], x[i8], x[i3]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i6]; x[i8] = t2 + st1; x[i3] = t2 - st1;\n x[i8] = t2 + x[i6];\n x[i3] = t2 - x[i6];\n\n //sumdiff_r(t1, t3); // {a, b} <--| {a+b, b-a}\n st1 = t3 - t1;\n t1 += t3;\n t3 = st1;\n\n //sumdiff(t3, x[i2], x[i4], x[i7]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i2]; x[i4] = t3 + st1; x[i7] = t3 - st1;\n x[i4] = t3 + x[i2];\n x[i7] = t3 - x[i2];\n\n //sumdiff3(x[i1], t1, x[i6]); // {a, b, d} <--| {a+b, b, a-b}\n x[i6] = x[i1] - t1;\n x[i1] += t1;\n\n //diffsum3_r(t4, x[i5], x[i2]); // {a, b, s} <--| {a, b-a, a+b}\n x[i2] = t4 + x[i5];\n x[i5] -= t4;\n }\n\n ix = (id << 1) - n2;\n id = id << 2;\n\n } while (ix < n);\n }\n }\n\n while (--i) {\n rval = x[i];\n ival = x[n - i - 1];\n mag = bSi * sqrt(rval * rval + ival * ival);\n\n if (mag > this.peak) {\n this.peakBand = i;\n this.peak = mag;\n }\n\n spectrum[i] = mag;\n }\n\n spectrum[0] = bSi * x[0];\n\n return spectrum;\n }", "function doFFT(values) {\n\tvar data = new complex_array.ComplexArray(values.length);\n\tdata.real = new Float32Array(values);\n\tvar frequencies = data.FFT();\n\n\treturn frequencies;\n}", "function naiveDft(inreal, inimag, outreal, outimag, inverse) {\n if (inreal.length != inimag.length || inreal.length != outreal.length || outreal.length != outimag.length)\n throw \"Mismatched lengths\";\n\n var n = inreal.length;\n var coef = (inverse ? 2 : -2) * Math.PI;\n for (var k = 0; k < n; k++) { // For each output element\n var sumreal = 0;\n var sumimag = 0;\n for (var t = 0; t < n; t++) { // For each input element\n var angle = coef * (t * k % n) / n; // This is more accurate than t * k\n sumreal += inreal[t]*Math.cos(angle) - inimag[t]*Math.sin(angle);\n sumimag += inreal[t]*Math.sin(angle) + inimag[t]*Math.cos(angle);\n }\n outreal[k] = sumreal;\n outimag[k] = sumimag;\n }\n \n \n // compute the average of the intervals of outreal array\n // peak saves the time index of all peaks\n var peak = [0];\n for(i = 1; i < outreal.length-1; i++){\n if(outreal[i] > outreal[i-1] && outreal[i] > outreal[i+1]){\n peak.push(i);\n }\n }\n // interval saves the interval of all values in peak\n var interval = [];\n for(i = 0; i < peak.length-1; i++){\n interval.push(peak[i+1] - peak[i]);\n }\n // compute the mean value in interval array\n var sum = 0;\n for(i = 0; i < interval.length; i++){\n sum += interval[i];\n }\n var mean = Number((sum/interval.length).toFixed(3));\n // the scan rate is the inverse of mean interval\n var scanrate = Number((1000/mean).toFixed(2)); \n document.getElementById(\"scanrate\").innerHTML = \"<br />\" + scanrate + \"Hz\" \n + \"<br />\" + \"It means your keyboard refreshes every \" + mean + \"ms\" \n + \"<br /><br /><br /><br />\" + \"The computing approach is to look in to the pressing time that your keyboard is able to recognize. More data lies around specific time points, the interval of them is right the refreshing period of your keyboard.\";\n }", "function FFTNayuki(n) {\n \n this.n = n;\n this.levels = -1;\n\n for (var i = 0; i < 32; i++) {\n if (1 << i == n) {\n this.levels = i; // Equal to log2(n)\n }\n }\n if (this.levels == -1) {\n throw \"Length is not a power of 2\";\n }\n\n this.cosTable = new Array(n / 2);\n this.sinTable = new Array(n / 2);\n for (var i = 0; i < n / 2; i++) {\n this.cosTable[i] = Math.cos(2 * Math.PI * i / n);\n this.sinTable[i] = Math.sin(2 * Math.PI * i / n);\n }\n\n /* \n * Computes the discrete Fourier transform (DFT) of the given complex vector, storing the result back into the vector.\n * The vector's length must be equal to the size n that was passed to the object constructor, and this must be a power of 2. Uses the Cooley-Tukey decimation-in-time radix-2 algorithm.\n */\n this.forward = function(real, imag) {\n\n var n = this.n;\n \n // Bit-reversed addressing permutation\n for (var i = 0; i < n; i++) {\n var j = reverseBits(i, this.levels);\n if (j > i) {\n var temp = real[i];\n real[i] = real[j];\n real[j] = temp;\n temp = imag[i];\n imag[i] = imag[j];\n imag[j] = temp;\n }\n }\n \n // Cooley-Tukey decimation-in-time radix-2 FFT\n for (var size = 2; size <= n; size *= 2) {\n var halfsize = size / 2;\n var tablestep = n / size;\n for (var i = 0; i < n; i += size) {\n for (var j = i, k = 0; j < i + halfsize; j++, k += tablestep) {\n var tpre = real[j+halfsize] * this.cosTable[k] +\n imag[j+halfsize] * this.sinTable[k];\n var tpim = -real[j+halfsize] * this.sinTable[k] +\n imag[j+halfsize] * this.cosTable[k];\n real[j + halfsize] = real[j] - tpre;\n imag[j + halfsize] = imag[j] - tpim;\n real[j] += tpre;\n imag[j] += tpim;\n }\n }\n }\n \n // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n function reverseBits(x, bits) {\n var y = 0;\n for (var i = 0; i < bits; i++) {\n y = (y << 1) | (x & 1);\n x >>>= 1;\n }\n return y;\n }\n }\n\n /* \n * Computes the inverse discrete Fourier transform (IDFT) of the given complex vector, storing the result back into the vector.\n * The vector's length must be equal to the size n that was passed to the object constructor, and this must be a power of 2. This is a wrapper function. This transform does not perform scaling, so the inverse is not a true inverse.\n */\n this.inverse = function(real, imag) {\n forward(imag, real);\n }\n}", "function FourierTransform(bufferSize, sampleRate) {\n this.bufferSize = bufferSize;\n this.sampleRate = sampleRate;\n this.bandwidth = 2 / bufferSize * sampleRate / 2;\n\n this.spectrum = new Float32Array(bufferSize/2);\n this.real = new Float32Array(bufferSize);\n this.imag = new Float32Array(bufferSize);\n\n this.peakBand = 0;\n this.peak = 0;\n\n /**\n * Calculates the *middle* frequency of an FFT band.\n *\n * @param {Number} index The index of the FFT band.\n *\n * @returns The middle frequency in Hz.\n */\n this.getBandFrequency = function(index) {\n return this.bandwidth * index + this.bandwidth / 2;\n };\n\n this.calculateSpectrum = function() {\n var spectrum = this.spectrum,\n real = this.real,\n imag = this.imag,\n bSi = 2 / this.bufferSize,\n sqrt = Math.sqrt,\n rval,\n ival,\n mag;\n\n for (var i = 0, N = bufferSize/2; i < N; i++) {\n rval = real[i];\n ival = imag[i];\n mag = bSi * sqrt(rval * rval + ival * ival);\n\n if (mag > this.peak) {\n this.peakBand = i;\n this.peak = mag;\n }\n\n spectrum[i] = mag;\n }\n };\n}", "function PowerSpectrum( NumSamples, In, Out)\n{\n var Half = NumSamples / 2;\n var i;\n\n var theta = Math.PI / Half;\n\n var tmpReal = new Float32Array(Half);\n var tmpImag = new Float32Array(Half);\n var RealOut = new Float32Array(Half);\n var ImagOut = new Float32Array(Half);\n\n for (var i = 0; i < Half; i++) {\n tmpReal[i] = In[2 * i];\n tmpImag[i] = In[2 * i + 1];\n }\n\n ACFFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);\n\n var wtemp = (Math.sin(0.5 * theta));\n\n var wpr = -2.0 * wtemp * wtemp;\n var wpi = -1.0 * (Math.sin(theta));\n var wr = 1.0 + wpr;\n var wi = wpi;\n\n var i3;\n\n var h1r, h1i, h2r, h2i, rt, it;\n\n for (var i = 1; i < Half / 2; i++) {\n\n i3 = Half - i;\n\n h1r = 0.5 * (RealOut[i] + RealOut[i3]);\n h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);\n h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);\n h2i = -0.5 * (RealOut[i] - RealOut[i3]);\n\n rt = h1r + wr * h2r - wi * h2i;\n it = h1i + wr * h2i + wi * h2r;\n\n Out[i] = rt * rt + it * it;\n\n rt = h1r - wr * h2r + wi * h2i;\n it = -h1i + wr * h2i + wi * h2r;\n\n Out[i3] = rt * rt + it * it;\n\n wr = (wtemp = wr) * wpr - wi * wpi + wr;\n wi = wi * wpr + wtemp * wpi + wi;\n }\n\n rt = (h1r = RealOut[0]) + ImagOut[0];\n it = h1r - ImagOut[0];\n Out[0] = rt * rt + it * it;\n\n rt = RealOut[Half / 2];\n it = ImagOut[Half / 2];\n Out[Half / 2] = rt * rt + it * it;\n}", "function FFTDrawer(canvas, channel) {\n var canvasContext = canvas.getContext('2d');\n var curveColor = 'rgb(255,160,122)';\n var binCount = FFT_SIZE / 2;\n var data = new Float32Array(binCount);\n\n function drawCurve() {\n var width = canvas.width;\n var height = canvas.height;\n var pixelsPerDb = height / 96.0;\n\n canvasContext.clearRect(0, 0, width, height);\n\n /* Get the proper analyzer from the audio graph */\n var analyzer = (channel == 0) ? analyzer_left : analyzer_right;\n if (!analyzer || !get_global('enable_fft')) {\n requestAnimationFrame(drawCurve);\n return;\n }\n\n /* Draw decibel scale. */\n for (var db = -96.0; db <= 0; db += 12) {\n var y = height - (db + 96) * pixelsPerDb;\n canvasContext.strokeStyle = curveColor;\n canvasContext.strokeText(db.toFixed(0) + 'dB', 10, y);\n }\n\n /* Draw FFT */\n analyzer.getFloatFrequencyData(data);\n canvasContext.beginPath();\n canvasContext.lineWidth = 1;\n canvasContext.strokeStyle = curveColor;\n canvasContext.moveTo(0, height);\n\n var frequencyHz = new Float32Array(width);\n for (var i = 0; i < binCount; ++i) {\n var f = i / binCount;\n\n /* Convert to log frequency scale (octaves). */\n var noctaves = 10;\n f = 1 + Math.log(f) / (noctaves * Math.LN2);\n\n /* Draw the magnitude */\n var x = f * width;\n var y = height - (data[i] + 96) * pixelsPerDb;\n\n canvasContext.lineTo(x, y);\n }\n\n canvasContext.stroke();\n requestAnimationFrame(drawCurve);\n }\n\n function init() {\n requestAnimationFrame(drawCurve);\n }\n\n this.init = init;\n}", "function FourierTransform(bufferSize, sampleRate) {\n this.bufferSize = bufferSize;\n this.sampleRate = sampleRate;\n this.bandwidth = 2 / bufferSize * sampleRate / 2;\n\n this.spectrum = new Float32Array(bufferSize/2);\n this.real = new Float32Array(bufferSize);\n this.imag = new Float32Array(bufferSize);\n\n this.peakBand = 0;\n this.peak = 0;\n\n /**\n * Calculates the *middle* frequency of an FFT band.\n *\n * @param {Number} index The index of the FFT band.\n *\n * @returns The middle frequency in Hz.\n */\n this.getBandFrequency = function(index) {\n return this.bandwidth * index + this.bandwidth / 2;\n };\n\n this.calculateSpectrum = function() {\n var spectrum = this.spectrum,\n real = this.real,\n imag = this.imag,\n bSi = 2 / this.bufferSize,\n sqrt = Math.sqrt,\n rval, \n ival,\n mag;\n\n for (var i = 0, N = bufferSize/2; i < N; i++) {\n rval = real[i];\n ival = imag[i];\n mag = bSi * sqrt(rval * rval + ival * ival);\n\n if (mag > this.peak) {\n this.peakBand = i;\n this.peak = mag;\n }\n\n spectrum[i] = mag;\n }\n };\n}", "function FourierTransform(bufferSize, sampleRate) {\n this.bufferSize = bufferSize;\n this.sampleRate = sampleRate;\n this.bandwidth = 2 / bufferSize * sampleRate / 2;\n\n this.spectrum = new Float32Array(bufferSize/2);\n this.real = new Float32Array(bufferSize);\n this.imag = new Float32Array(bufferSize);\n\n this.peakBand = 0;\n this.peak = 0;\n\n /**\n * Calculates the *middle* frequency of an FFT band.\n *\n * @param {Number} index The index of the FFT band.\n *\n * @returns The middle frequency in Hz.\n */\n this.getBandFrequency = function(index) {\n return this.bandwidth * index + this.bandwidth / 2;\n };\n\n this.calculateSpectrum = function() {\n var spectrum = this.spectrum,\n real = this.real,\n imag = this.imag,\n bSi = 2 / this.bufferSize,\n sqrt = Math.sqrt,\n rval, \n ival,\n mag;\n\n for (var i = 0, N = bufferSize/2; i < N; i++) {\n rval = real[i];\n ival = imag[i];\n mag = bSi * sqrt(rval * rval + ival * ival);\n\n if (mag > this.peak) {\n this.peakBand = i;\n this.peak = mag;\n }\n\n spectrum[i] = mag;\n }\n };\n}", "function FourierTransform(bufferSize, sampleRate)\r\n{\r\n\tthis.bufferSize = bufferSize;\r\n\tthis.sampleRate = sampleRate;\r\n\tthis.bandwidth = bufferSize * sampleRate;\r\n\tthis.spectrum = new Float32Array(bufferSize/2);\r\n\tthis.real = new Float32Array(bufferSize);\r\n\tthis.imag = new Float32Array(bufferSize);\r\n\tthis.peakBand = 0;\r\n\tthis.peak = 0;\r\n\tthis.getBandFrequency = function(index)\r\n\t{\r\n\t\treturn this.bandwidth * index + this.bandwidth / 2;\r\n\t};\r\n\tthis.calculateSpectrum = function()\r\n\t{\r\n\t\tvar spectrum = this.spectrum,\r\n\t\treal = this.real,\r\n\t\timag = this.imag,\r\n\t\tbSi = 2 / this.bufferSize,\r\n\t\trval, ival, mag;\r\n\t\tthis.peak = this.peakBand = 0;\r\n\t\tfor (var i = 0, N = bufferSize*0.5; i < N; i++)\r\n\t\t{\r\n\t\t\trval = real[i];\r\n\t\t\tival = imag[i];\r\n\t\t\tmag = bSi * Math.sqrt(rval * rval + ival * ival);\r\n\t\t\tif (mag > this.peak)\r\n\t\t\t{\r\n\t\t\t\tthis.peakBand = i;\r\n\t\t\t\tthis.peak = mag;\r\n\t\t\t}\r\n\t\t\tspectrum[i] = mag;\r\n\t\t}\r\n\t};\r\n}", "function FFT (sampleRate, n, inverse) {\n\tvar args = [].slice.call(arguments);\n\targs[0] = this.sampleRate = isNaN(sampleRate) || sampleRate === null ? this.sampleRate : sampleRate;\n\targs[1] = this.bufferSize = isNaN(n) || n === null ? this.bufferSize : n;\n\targs[2] = !!inverse;\n\n\tthis.__super.apply(this, args.slice(1));\n}", "function FourierTransform(bufferSize, sampleRate) {\n this.bufferSize = bufferSize;\n this.sampleRate = sampleRate;\n this.bandwidth = 2 / bufferSize * sampleRate / 2;\n\n this.spectrum = array(bufferSize/2);\n this.real = array(bufferSize);\n this.imag = array(bufferSize);\n\n this.peakBand = 0;\n this.peak = 0;\n\n /**\n * Calculates the *middle* frequency of an FFT band.\n *\n * @param {Number} index The index of the FFT band.\n *\n * @returns The middle frequency in Hz.\n */\n this.getBandFrequency = function(index) {\n return this.bandwidth * index + this.bandwidth / 2;\n };\n\n this.calculateSpectrum = function() {\n var spectrum = this.spectrum,\n real = this.real,\n imag = this.imag,\n bSi = 2 / this.bufferSize,\n sqrt = Math.sqrt,\n rval, \n ival,\n mag;\n\n for (var i = 0, N = bufferSize/2; i < N; i++) {\n rval = real[i];\n ival = imag[i];\n mag = bSi * sqrt(rval * rval + ival * ival);\n\n if (mag > this.peak) {\n this.peakBand = i;\n this.peak = mag;\n }\n\n spectrum[i] = mag;\n }\n };\n}", "function FFT(bufferSize, sampleRate) {\n\t\tthis.bufferSize = bufferSize;\n\t\tthis.sampleRate = sampleRate;\n\t\tthis.spectrum = new Float32Array(bufferSize/2);\n\t\tthis.real = new Float32Array(bufferSize);\n\t\tthis.imag = new Float32Array(bufferSize);\n\t\tthis.reverseTable = new Uint32Array(bufferSize);\n\t\tthis.sinTable = new Float32Array(bufferSize);\n\t\tthis.cosTable = new Float32Array(bufferSize);\n\n\t\tvar limit = 1,\n\t\t\tbit = bufferSize >> 1;\n\n\t\twhile ( limit < bufferSize ) {\n\t\t\tfor ( var i = 0; i < limit; i++ ) {\n\t\t\t\tthis.reverseTable[i + limit] = this.reverseTable[i] + bit;\n\t\t\t}\n\n\t\t\tlimit = limit << 1;\n\t\t\tbit = bit >> 1;\n\t\t}\n\n\t\tfor ( var i = 0; i < bufferSize; i++ ) {\n\t\t\tthis.sinTable[i] = Math.sin(-Math.PI/i);\n\t\t\tthis.cosTable[i] = Math.cos(-Math.PI/i);\n\t\t}\n\t}", "function dft_direct (re, im) {\n let N = re.length;\n // is this necessary? should be able to do DFT with any N\n //if (N.toString(2) % 10) return; // check that N is a power of 2\n\n // array containing N evenly spaced points around the unit circle\n let W = discrete_circle(N);\n\n // debugger;\n // initialize imaginary values to zero if not provided\n im = im || re.map( a => 0 );\n\n // sum (x * W) over N points (0 to N-1), for all frequencies k in N\n return re.map( (_, k) =>\n re.map( (_, n) => cpx_mult([re[n], im[n]], W[n * k % N]) )\n .reduce( (a, b) => cpx_add(a, b) ));\n}", "_AMDF(buf, sampleRate) {\n var SIZE = buf.length; // set SIZE variable equal to buffer length 4096 => half a second\n var MAX_SAMPLES = Math.floor(SIZE / 2); // set MAX_SAMPLES = 4096/2 = 2048\n var best_offset = -1; // initialise best_offset to -1\n var best_correlation = 0; // initialise best_correlation to 0\n var rms = 0; // initialise rms to 0 (rms => root-mean-square)\n var foundGoodCorrelation = false; // initialise foundGoodCorrelation flag to false\n var correlations = new Array(MAX_SAMPLES); // create an array variable called correlations of size MAX_SAMPLES (2048)\n\n for (var i = 0; i < SIZE; i++) {\n var val = buf[i]; // val is equal to the (i)th value in the array\n rms += val * val; // rms is the summation of each value squared\n }\n rms = Math.sqrt(rms / SIZE); // set rms equal to the square root of rms/SIZE (square root of the average)\n if (rms < 0.01) // not enough signal\n return -1;\n\n var lastCorrelation = 1; // initialise lastCorrelation to 1 so that the first check won't be the best correlation\n for (var offset = 52; offset < 160; offset++) { // offset initialised to 52, goes through a for loop from 52 to 160, which will cover the notes that Singphony can render\n var correlation = 0; // re-set correlation to 0 at each offset value\n\n for (var i = 0; i < MAX_SAMPLES; i++) { // cycle through from 0 to 2048\n correlation += Math.abs((buf[i]) - (buf[i + offset])); // step through at each value and subtract the value at the offset from the value in the original buffer and keep adding that to the correlation value\n } // correlation will be a large enough positive float\n\n correlation = 1 - (correlation / MAX_SAMPLES); // set correlation to 1 - correlation/512\n correlations[offset] = correlation; // store it, for the tweaking we need to do below.\n if ((correlation > this.GOOD_ENOUGH_CORRELATION) && (correlation > lastCorrelation)) { // if the correlation value is higher than 0.9 and the previous correlation value\n foundGoodCorrelation = true; // set foundGoodCorrelation flag to true\n if (correlation > best_correlation) { //\n best_correlation = correlation; // update the best_correlation value to the latest correlation value\n best_offset = offset; // update best_offset to the latest offset value\n }\n } else if (foundGoodCorrelation) {\n // short-circuit - we found a good correlation, then a bad one, so we'd just be seeing copies from here.\n return sampleRate / best_offset;\n }\n lastCorrelation = correlation; // set lastCorrelation to latest correlation\n }\n return -1;\n }", "function FourierTransform(bufferSize, sampleRate) {\n this.bufferSize = bufferSize;\n this.sampleRate = sampleRate;\n this.bandwidth = 2 / bufferSize * sampleRate / 2;\n\n this.spectrum = new Float32Array(bufferSize/2);\n this.real = new Float32Array(bufferSize);\n this.imag = new Float32Array(bufferSize);\n\n this.peakBand = 0;\n this.peak = 0;\n\n /**\n * Calculates the *middle* frequency of an FFT band.\n *\n * @param {Number} index The index of the FFT band.\n *\n * @returns The middle frequency in Hz.\n */\n this.getBandFrequency = function(index) {\n return this.bandwidth * index + this.bandwidth / 2;\n };\n\n this.calculateSpectrum = function() {\n var spectrum = this.spectrum,\n real = this.real,\n imag = this.imag,\n bSi = 2 / this.bufferSize,\n sqrt = Math.sqrt,\n rval, \n ival,\n mag;\n\n for (var i = 0, N = bufferSize/2; i < N; i++) {\n rval = real[i];\n ival = imag[i];\n mag = bSi * sqrt(rval * rval + ival * ival);\n\n if (mag > this.peak) {\n this.peakBand = i;\n this.peak = mag;\n }\n\n spectrum[i] = mag;\n }\n };\n }", "function mapFreq(i){\n // var freq = i * SAMPLE_RATE / FFT_SIZE;\n var freq = i * SAMPLE_RATE / self.spectrum.length;\n return freq;\n }", "function Poll_FFT_DTMF()\r\n{\r\n //44100 / 1024 = 43,06 Hz saltos 21,533203125 Hz\r\n try\r\n {\r\n if (gb_use_mic_dtmf === false)\r\n {\r\n return;\r\n }\r\n\t \r\n let spectrum = gb_fft.analyze();\r\n let row= -1;\r\n let col= -1; \r\n \r\n //if (spectrum[31] > 250){row = 0;}\r\n if (spectrum[32] > 230){row = 0;}\r\n else{\r\n if (spectrum[35] > 230){row = 1;}\r\n else{\r\n if (spectrum[39] > 230){row = 2;}\r\n else{\r\n if (spectrum[43] > 230){row = 3;}\r\n\t}\r\n }\r\n }\r\n \r\n //if (spectrum[55] > 250){col = 0;}\r\n if (spectrum[56] > 230){col = 0;}\r\n else{\r\n //if (spectrum[61] > 250){col = 1;}\r\n if (spectrum[62] > 230){col = 1;} \r\n else{\r\n //if (spectrum[67] > 250){col = 2;}\r\n\tif (spectrum[68] > 230){col = 2;}\r\n else{\r\n if (spectrum[76] > 230){col = 3;}\r\n\t}\r\n }\r\n }\r\n \r\n //console.log('55:'+spectrum[55].toString()+' 56:'+spectrum[56].toString()+' 57:'+spectrum[57].toString());\r\n \t\r\n if ((row>-1) && (col>-1))\r\n { \r\n gb_fft_dtmf = RowColToDtmf(row,col);\r\n gb_cadDTMF = gb_fft_dtmf;\r\n if (gb_fft_dtmf_antes != gb_fft_dtmf){\t\r\n gb_fft_dtmf_antes = gb_fft_dtmf;\r\n cad_areaRX += gb_fft_dtmf;\t\r\n\tgb_buf_rcv_dtmf += gb_fft_dtmf;\r\n\tgb_event_new_data_dtmf = true;\r\n\tif (gb_fft_dtmf === '#'){\r\n\t gb_begin_sync_dtmf= true;\r\n }\r\n\r\n if (gb_use_fast === true)\r\n\t{ //Si es fast solo recibe un tono\r\n\t gb_buf_rcv_dtmf = '#' + DTMFStringToDoubleNumber(gb_fft_dtmf) + '*';\t \r\n\t gb_begin_sms = false; \r\n\t gb_end_sms = true;\r\n\t contIniAsteriscos = 1;\r\n\t}\r\n\telse\r\n\t{\r\n\t switch (gb_fft_dtmf)\r\n\t {\r\n \t case '#':\r\n\t gb_buf_rcv_dtmf = '#';\r\n\t gb_begin_sms = true; \r\n\t gb_end_sms = false;\r\n\t //gb_begin_sync_dtmf= true;\t \r\n\t break;\r\n\t case '*':\t \r\n\t contIniAsteriscos ++;\r\n\t gb_begin_sms = false; \r\n\t gb_end_sms = true;\r\n\t break;\r\n\t default:\t \r\n\t contIniAsteriscos = 0;\t \t \r\n\t break;\r\n\t }\t\r\n\t}\r\n\t\r\n\t\r\n gb_forceDraw = true;\r\n } \r\n }\r\n else\r\n {\r\n gb_fft_dtmf= gb_fft_dtmf_antes= '';\r\n } \r\n }\r\n catch(err)\r\n {\r\n DebugLog(err.message.toString());\r\n }\r\n}", "function naiveDft(inreal, inimag, outreal, outimag, inverse) {\n\tconst n = inreal.length;\n\tif (n != inimag.length || n != outreal.length || n != outimag.length)\n\t\tthrow new RangeError(\"Mismatched lengths\");\n\t\n\tconst coef = (inverse ? 2 : -2) * Math.PI;\n\tfor (let k = 0; k < n; k++) { // For each output element\n\t\tlet sumreal = 0;\n\t\tlet sumimag = 0;\n\t\tfor (let t = 0; t < n; t++) { // For each input element\n\t\t\tconst angle = coef * (t * k % n) / n; // This is more accurate than t * k\n\t\t\tsumreal += inreal[t] * Math.cos(angle) - inimag[t] * Math.sin(angle);\n\t\t\tsumimag += inreal[t] * Math.sin(angle) + inimag[t] * Math.cos(angle);\n\t\t}\n\t\toutreal[k] = sumreal;\n\t\toutimag[k] = sumimag;\n\t}\n}", "_renderSpectrogram () {\n\n\t\tvar windowSizeInSamples = this.sampleRate * this.windowSizeInSecs;\n\n\t\t// instance of FFT with windowSize N\n\t\t// this.myFFT = new this.FFT();\n\n\t\t// array holding FFT results paint[canvas width][canvas height]\n\t\tthis.paint = new Array(this.imgWidth);\n\n\t\t// Hz per pixel height\n\t\tthis.HzStep = (this.sampleRate / 2) / (this.N / 2);\n\n\t\t// upper Hz boundary to display\n\t\tthis.ceilingFreqFftIdx = Math.ceil(this.upperFreq / this.HzStep);\n\n\t\t// lower Hz boundary to display\n\t\tthis.floorFreqFftIdx = Math.floor(this.lowerFreq / this.HzStep); // -1 for value below display when lower>0\n\n\t\t// height between two interpolation points\n\t\tthis.pixelHeight = this.imgHeight / (this.ceilingFreqFftIdx - this.floorFreqFftIdx - 2);\n\n\t\t// ugly hack in order to support PhantomJS < 2.0 testing\n\t\tif (typeof Uint8ClampedArray === 'undefined') {\n\t\t\tUint8ClampedArray = Uint8Array;\n\t\t}\n\t\t// create new picture\n\t\tthis.resultImgArr = new Uint8ClampedArray(Math.ceil(this.imgWidth * this.imgHeight * 4));\n\t\t// create sin & cos tables + m var (prob. better place that some place else!)\n\t\tthis.createSinAndCosTables();\n\n\t\t// calculate i FFT runs, save result into paint and set maxPsd while doing so\n\t\tfor (var i = 0; i < this.imgWidth; i++) {\n\t\t\tthis.paint[i] = this.calcMagnitudeSpectrum(Math.round(i * this.samplesPerPxl), windowSizeInSamples);\n\t\t\tthis.maxPsd = (2 * Math.pow(this.totalMax, 2)) / this.N;\n\t\t}\n\n\t\t// draw spectrogram on png image with canvas width\n\t\t// one column is drawn per drawVerticalLineOfSpectogram\n\t\tfor (var j = 0; j < this.imgWidth; j++) {\n\t\t\tthis.drawVerticalLineOfSpectogram(j);\n\t\t}\n\n\t\treturn(this.resultImgArr.buffer);\n\n\n\t}", "function initFourierImage() {\r\n //event listeners\r\n function loadImage(loc) {\r\n var start = +new Date();\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //draw the initial image\r\n var img = new Image();\r\n img.addEventListener('load', function() {\r\n //make each canvas the image's exact size\r\n dims[0] = img.width;\r\n dims[1] = img.height;\r\n for (var ai = 0; ai < 4; ai++) {\r\n canvases[ai] = $s('#canvas'+ai);\r\n canvases[ai].width = dims[0], canvases[ai].height = dims[1];\r\n ctxs[ai] = canvases[ai].getContext('2d');\r\n }\r\n\r\n //draw the image to the canvas\r\n ctxs[0].drawImage(img, 0, 0, img.width, img.height);\r\n\r\n //grab the pixels\r\n var imageData = ctxs[0].getImageData(0, 0, dims[0], dims[1]);\r\n var h_es = []; //the h values\r\n for (var ai = 0; ai < imageData.data.length; ai+=4) {\r\n //greyscale, so you only need every 4th value\r\n h_es.push(imageData.data[ai]);\r\n }\r\n\r\n //initialize the h values\r\n h = function(n, m) {\r\n if (arguments.length === 0) return h_es;\r\n\r\n var idx = n*dims[0] + m;\r\n return h_es[idx];\r\n }; //create it in function form to make the code match the math\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to draw the image.');\r\n });\r\n img.src = loc;\r\n });\r\n }\r\n $s('#draw-cs-btn').addEventListener('click', function() {\r\n loadImage('cs.png');\r\n });\r\n $s('#draw-circle-btn').addEventListener('click', function() {\r\n loadImage('circle.png');\r\n });\r\n $s('#draw-grace-btn').addEventListener('click', function() {\r\n loadImage('grace.png');\r\n });\r\n\r\n $s('#transform-btn').addEventListener('click', function() {\r\n var start = +new Date();\r\n\r\n if (!h()) return alert('You need to draw an image to canvas 1 first.');\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //compute the h hat values\r\n var h_hats = [];\r\n FFT(h_hats, h());\r\n h_hats = shiftFFT(h_hats);\r\n\r\n //get the largest magnitude\r\n var maxMagnitude = 0;\r\n for (var ai = 0; ai < h_hats.length; ai++) {\r\n var mag = h_hats[ai].magnitude();\r\n if (mag > maxMagnitude) {\r\n maxMagnitude = mag;\r\n }\r\n }\r\n\r\n //apply a low or high pass filter\r\n var lpr = parseInt($s('#low-freq-radius').value); //low pass radius\r\n var hpr = parseInt($s('#high-freq-radius').value); //high \" \"\r\n var N = dims[1], M = dims[0];\r\n for (var k = 0; k < N; k++) {\r\n for (var l = 0; l < M; l++) {\r\n var idx = k*M + l;\r\n var dist = Math.pow(k-M/2, 2) + Math.pow(l-N/2, 2);\r\n if (dist > lpr*lpr && isNaN(hpr) ||\r\n dist < hpr*hpr && isNaN(lpr) ||\r\n dist < lpr*lpr && !isNaN(lpr) && !isNaN(hpr) ||\r\n dist > hpr*hpr && !isNaN(lpr) && !isNaN(hpr)) {\r\n h_hats[idx] = new Complex(0, 0);\r\n }\r\n }\r\n }\r\n\r\n //store them in a nice function to match the math\r\n $h = function(k, l) {\r\n if (arguments.length === 0) return h_hats;\r\n \r\n var idx = k*dims[0] + l;\r\n return h_hats[idx];\r\n };\r\n\r\n //draw the pixels\r\n var currImageData = ctxs[1].getImageData(0, 0, dims[0], dims[1]);\r\n var logOfMaxMag = Math.log(cc*maxMagnitude+1);\r\n for (var k = 0; k < dims[1]; k++) {\r\n for (var l = 0; l < dims[0]; l++) {\r\n var idxInPixels = 4*(dims[0]*k + l);\r\n currImageData.data[idxInPixels+3] = 255; //full alpha\r\n var color = Math.log(cc*$h(k, l).magnitude()+1);\r\n color = Math.round(255*(color/logOfMaxMag));\r\n for (var c = 0; c < 3; c++) { //RGB are the same, lol c++\r\n currImageData.data[idxInPixels+c] = color;\r\n }\r\n }\r\n }\r\n ctxs[1].putImageData(currImageData, 0, 0);\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to compute the FT.');\r\n });\r\n });\r\n\r\n $s('#reconstruct-btn').addEventListener('click', function() {\r\n var start = +new Date();\r\n\r\n if (!$h()) {\r\n return alert('You first need to compute the Fourier transform.');\r\n }\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //compute the h prime values\r\n var h_primes = [];\r\n var h_hats = $h();\r\n h_hats = unshiftFFT(h_hats);\r\n invFFT(h_primes, h_hats);\r\n\r\n //store them in a nice function to match the math\r\n h_ = function(n, m) {\r\n if (arguments.length === 0) return h_primes;\r\n\r\n var idx = n*dims[0] + m;\r\n return round(h_primes[idx], 2);\r\n };\r\n\r\n //draw the pixels\r\n var currImageData = ctxs[2].getImageData(0, 0, dims[0], dims[1]);\r\n for (var n = 0; n < dims[1]; n++) {\r\n for (var m = 0; m < dims[0]; m++) {\r\n var idxInPixels = 4*(dims[0]*n + m);\r\n currImageData.data[idxInPixels+3] = 255; //full alpha\r\n for (var c = 0; c < 3; c++) { //RGB are the same, lol c++\r\n currImageData.data[idxInPixels+c] = h_(n, m);\r\n }\r\n }\r\n }\r\n ctxs[2].putImageData(currImageData, 0, 0);\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to reconstruct the image.');\r\n });\r\n });\r\n\r\n $s('#difference-btn').addEventListener('click', function() {\r\n var start = +new Date();\r\n\r\n if (!h_()) {\r\n return alert('You haven\\'t reconstructed an image yet.');\r\n }\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //find the range of the errors\r\n var minError = Infinity;\r\n var maxError = 0;\r\n for (var n = 0; n < dims[1]; n++) {\r\n for (var m = 0; m < dims[0]; m++) {\r\n var error = h_(n, m) - h(n, m);\r\n if (error < minError) minError = error;\r\n if (error > maxError) maxError = error;\r\n }\r\n }\r\n\r\n //draw the pixels\r\n var currImageData = ctxs[3].getImageData(0, 0, dims[0], dims[1]);\r\n for (var n = 0; n < dims[1]; n++) {\r\n for (var m = 0; m < dims[0]; m++) {\r\n var idxInPixels = 4*(dims[0]*n + m); //idx in the pixels array\r\n var error = h_(n, m) - h(n, m);\r\n var color = getCoolColor(error, [minError, maxError]);\r\n for (var c = 0; c < 3; c++) {\r\n currImageData.data[idxInPixels+c] = color[c];\r\n }\r\n currImageData.data[idxInPixels+3] = 255; // fullalpha\t\t\r\n }\r\n }\r\n ctxs[3].putImageData(currImageData, 0, 0);\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to compute the difference.');\r\n });\r\n });\r\n\r\n //initialize the working variables\r\n canvases = [], ctxs = [];\r\n h = $h = h_ = function() { return false; };\r\n}", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }", "function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }" ]
[ "0.73435855", "0.7309792", "0.7209207", "0.7152813", "0.714766", "0.71119267", "0.6941669", "0.685232", "0.6794156", "0.67012745", "0.6682935", "0.6543265", "0.6356326", "0.6146801", "0.6014318", "0.60110235", "0.6010517", "0.5832049", "0.5832049", "0.57791466", "0.5729091", "0.5677532", "0.5669772", "0.56487155", "0.5644601", "0.5617952", "0.5582845", "0.5582845", "0.55626655", "0.5555525", "0.54802066", "0.5451415", "0.5379019", "0.53616434", "0.53589493", "0.52521074", "0.5175344", "0.514275", "0.5132305", "0.51230305", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942", "0.5087942" ]
0.7726817
0
Use Bluestein algorithm for npot FFTs Scratch memory required: 2 ncols + 4 bits.nextPow2(2ncols + 1)
function fftBluestein(dir, nrows, ncols, buffer, x_ptr, y_ptr, scratch_ptr) { dir |= 0 nrows |= 0 ncols |= 0 x_ptr |= 0 y_ptr |= 0 scratch_ptr |= 0 // Initialize tables var m = bits.nextPow2(2 * ncols + 1) , cos_ptr = scratch_ptr , sin_ptr = cos_ptr + ncols , xs_ptr = sin_ptr + ncols , ys_ptr = xs_ptr + m , cft_ptr = ys_ptr + m , sft_ptr = cft_ptr + m , w = -dir * Math.PI / ncols , row, a, b, c, d, k1, k2, k3 , i for(i=0; i<ncols; ++i) { a = w * ((i * i) % (ncols * 2)) c = Math.cos(a) d = Math.sin(a) buffer[cft_ptr+(m-i)] = buffer[cft_ptr+i] = buffer[cos_ptr+i] = c buffer[sft_ptr+(m-i)] = buffer[sft_ptr+i] = buffer[sin_ptr+i] = d } for(i=ncols; i<=m-ncols; ++i) { buffer[cft_ptr+i] = 0.0 } for(i=ncols; i<=m-ncols; ++i) { buffer[sft_ptr+i] = 0.0 } fftRadix2(1, 1, m, buffer, cft_ptr, sft_ptr) //Compute scale factor if(dir < 0) { w = 1.0 / ncols } else { w = 1.0 } //Handle direction for(row=0; row<nrows; ++row) { // Copy row into scratch memory, multiply weights for(i=0; i<ncols; ++i) { a = buffer[x_ptr+i] b = buffer[y_ptr+i] c = buffer[cos_ptr+i] d = -buffer[sin_ptr+i] k1 = c * (a + b) k2 = a * (d - c) k3 = b * (c + d) buffer[xs_ptr+i] = k1 - k3 buffer[ys_ptr+i] = k1 + k2 } //Zero out the rest for(i=ncols; i<m; ++i) { buffer[xs_ptr+i] = 0.0 } for(i=ncols; i<m; ++i) { buffer[ys_ptr+i] = 0.0 } // FFT buffer fftRadix2(1, 1, m, buffer, xs_ptr, ys_ptr) // Apply multiplier for(i=0; i<m; ++i) { a = buffer[xs_ptr+i] b = buffer[ys_ptr+i] c = buffer[cft_ptr+i] d = buffer[sft_ptr+i] k1 = c * (a + b) k2 = a * (d - c) k3 = b * (c + d) buffer[xs_ptr+i] = k1 - k3 buffer[ys_ptr+i] = k1 + k2 } // Inverse FFT buffer fftRadix2(-1, 1, m, buffer, xs_ptr, ys_ptr) // Copy result back into x/y for(i=0; i<ncols; ++i) { a = buffer[xs_ptr+i] b = buffer[ys_ptr+i] c = buffer[cos_ptr+i] d = -buffer[sin_ptr+i] k1 = c * (a + b) k2 = a * (d - c) k3 = b * (c + d) buffer[x_ptr+i] = w * (k1 - k3) buffer[y_ptr+i] = w * (k1 + k2) } x_ptr += ncols y_ptr += ncols } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function transformBluestein(real, imag) {\n // Find a power-of-2 convolution length m such that m >= n * 2 + 1\n var n = real.length;\n var m = 1;\n while (m < n * 2 + 1)\n m *= 2;\n\n // Trignometric tables\n var cosTable = new Array(n);\n var sinTable = new Array(n);\n for (var i = 0; i < n; i++) {\n var j = i * i % (n * 2);\n // This is more accurate than j = i * i\n cosTable[i] = Math.cos(Math.PI * j / n);\n sinTable[i] = Math.sin(Math.PI * j / n);\n }\n\n // Temporary vectors and preprocessing\n var areal = new Array(m);\n var aimag = new Array(m);\n for (var i = 0; i < n; i++) {\n areal[i] = real[i] * cosTable[i] + imag[i] * sinTable[i];\n aimag[i] = -real[i] * sinTable[i] + imag[i] * cosTable[i];\n }\n for (var i = n; i < m; i++)\n areal[i] = aimag[i] = 0;\n var breal = new Array(m);\n var bimag = new Array(m);\n breal[0] = cosTable[0];\n bimag[0] = sinTable[0];\n for (var i = 1; i < n; i++) {\n breal[i] = breal[m - i] = cosTable[i];\n bimag[i] = bimag[m - i] = sinTable[i];\n }\n for (var i = n; i <= m - n; i++)\n breal[i] = bimag[i] = 0;\n\n // Convolution\n var creal = new Array(m);\n var cimag = new Array(m);\n convolveComplex(areal, aimag, breal, bimag, creal, cimag);\n\n // Postprocessing\n for (var i = 0; i < n; i++) {\n real[i] = creal[i] * cosTable[i] + cimag[i] * sinTable[i];\n imag[i] = -creal[i] * sinTable[i] + cimag[i] * cosTable[i];\n }\n}", "function fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\n//butfly(re,im,inv,n4);\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}", "function fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}// set variables", "function transformBluestein(real, imag) {\n\t // Find a power-of-2 convolution length m such that m >= n * 2 + 1\n\t if (real.length != imag.length) throw \"Mismatched lengths\";\n\t var n = real.length;\n\t var m = 1;\n\t while (m < n * 2 + 1) m *= 2;\n\n\t // Trignometric tables\n\t var cosTable = new Array(n);\n\t var sinTable = new Array(n);\n\t for (var i = 0; i < n; i++) {\n\t var j = i * i % (n * 2); // This is more accurate than j = i * i\n\t cosTable[i] = Math.cos(Math.PI * j / n);\n\t sinTable[i] = Math.sin(Math.PI * j / n);\n\t }\n\n\t // Temporary vectors and preprocessing\n\t var areal = new Array(m);\n\t var aimag = new Array(m);\n\t for (var i = 0; i < n; i++) {\n\t areal[i] = real[i] * cosTable[i] + imag[i] * sinTable[i];\n\t aimag[i] = -real[i] * sinTable[i] + imag[i] * cosTable[i];\n\t }\n\t for (var i = n; i < m; i++) areal[i] = aimag[i] = 0;\n\t var breal = new Array(m);\n\t var bimag = new Array(m);\n\t breal[0] = cosTable[0];\n\t bimag[0] = sinTable[0];\n\t for (var i = 1; i < n; i++) {\n\t breal[i] = breal[m - i] = cosTable[i];\n\t bimag[i] = bimag[m - i] = sinTable[i];\n\t }\n\t for (var i = n; i <= m - n; i++) breal[i] = bimag[i] = 0;\n\n\t // Convolution\n\t var creal = new Array(m);\n\t var cimag = new Array(m);\n\t convolveComplex(areal, aimag, breal, bimag, creal, cimag);\n\n\t // Postprocessing\n\t for (var i = 0; i < n; i++) {\n\t real[i] = creal[i] * cosTable[i] + cimag[i] * sinTable[i];\n\t imag[i] = -creal[i] * sinTable[i] + cimag[i] * cosTable[i];\n\t }\n\t}", "function transformBluestein(real, imag) {\n // Find a power-of-2 convolution length m such that m >= n * 2 + 1\n if (real.length !== imag.length)\n throw \"Mismatched lengths\";\n var i, j;\n var n = real.length;\n var m = 1;\n while (m < n * 2 + 1)\n m *= 2;\n\n // Trignometric tables\n var cosTable = new Array(n);\n var sinTable = new Array(n);\n for (i = 0; i < n; i++) {\n j = i * i % (n * 2); // This is more accurate than j = i * i\n cosTable[i] = Math.cos(Math.PI * j / n);\n sinTable[i] = Math.sin(Math.PI * j / n);\n }\n\n // Temporary vectors and preprocessing\n var areal = new Array(m);\n var aimag = new Array(m);\n for (i = 0; i < n; i++) {\n areal[i] = real[i] * cosTable[i] + imag[i] * sinTable[i];\n aimag[i] = -real[i] * sinTable[i] + imag[i] * cosTable[i];\n }\n for (i = n; i < m; i++)\n areal[i] = aimag[i] = 0;\n var breal = new Array(m);\n var bimag = new Array(m);\n breal[0] = cosTable[0];\n bimag[0] = sinTable[0];\n for (i = 1; i < n; i++) {\n breal[i] = breal[m - i] = cosTable[i];\n bimag[i] = bimag[m - i] = sinTable[i];\n }\n for (i = n; i <= m - n; i++)\n breal[i] = bimag[i] = 0;\n\n // Convolution\n var creal = new Array(m);\n var cimag = new Array(m);\n convolveComplex(areal, aimag, breal, bimag, creal, cimag);\n\n // Postprocessing\n for (i = 0; i < n; i++) {\n real[i] = creal[i] * cosTable[i] + cimag[i] * sinTable[i];\n imag[i] = -creal[i] * sinTable[i] + cimag[i] * cosTable[i];\n }\n}", "function fftRadix2(dir, nrows, ncols, buffer, x_ptr, y_ptr) {\n dir |= 0\n nrows |= 0\n ncols |= 0\n x_ptr |= 0\n y_ptr |= 0\n var nn,m,i,i1,j,k,i2,l,l1,l2\n var c1,c2,t,t1,t2,u1,u2,z,row,a,b,c,d,k1,k2,k3\n \n // Calculate the number of points\n nn = ncols\n m = bits.log2(nn)\n \n for(row=0; row<nrows; ++row) { \n // Do the bit reversal\n i2 = nn >> 1;\n j = 0;\n for(i=0;i<nn-1;i++) {\n if(i < j) {\n t = buffer[x_ptr+i]\n buffer[x_ptr+i] = buffer[x_ptr+j]\n buffer[x_ptr+j] = t\n t = buffer[y_ptr+i]\n buffer[y_ptr+i] = buffer[y_ptr+j]\n buffer[y_ptr+j] = t\n }\n k = i2\n while(k <= j) {\n j -= k\n k >>= 1\n }\n j += k\n }\n \n // Compute the FFT\n c1 = -1.0\n c2 = 0.0\n l2 = 1\n for(l=0;l<m;l++) {\n l1 = l2\n l2 <<= 1\n u1 = 1.0\n u2 = 0.0\n for(j=0;j<l1;j++) {\n for(i=j;i<nn;i+=l2) {\n i1 = i + l1\n a = buffer[x_ptr+i1]\n b = buffer[y_ptr+i1]\n c = buffer[x_ptr+i]\n d = buffer[y_ptr+i]\n k1 = u1 * (a + b)\n k2 = a * (u2 - u1)\n k3 = b * (u1 + u2)\n t1 = k1 - k3\n t2 = k1 + k2\n buffer[x_ptr+i1] = c - t1\n buffer[y_ptr+i1] = d - t2\n buffer[x_ptr+i] += t1\n buffer[y_ptr+i] += t2\n }\n k1 = c1 * (u1 + u2)\n k2 = u1 * (c2 - c1)\n k3 = u2 * (c1 + c2)\n u1 = k1 - k3\n u2 = k1 + k2\n }\n c2 = Math.sqrt((1.0 - c1) / 2.0)\n if(dir < 0) {\n c2 = -c2\n }\n c1 = Math.sqrt((1.0 + c1) / 2.0)\n }\n \n // Scaling for inverse transform\n if(dir < 0) {\n var scale_f = 1.0 / nn\n for(i=0;i<nn;i++) {\n buffer[x_ptr+i] *= scale_f\n buffer[y_ptr+i] *= scale_f\n }\n }\n \n // Advance pointers\n x_ptr += ncols\n y_ptr += ncols\n }\n}", "function fftRadix2(realVals, imagVals, size, inverse, cpuBackend) {\n if (size === 1) {\n return { real: realVals, imag: imagVals };\n }\n const data = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].mergeRealAndImagArrays(realVals, imagVals);\n const half = size / 2;\n const evenComplex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].complexWithEvenIndex(data);\n const evenRealVals = evenComplex.real;\n const evenImagVals = evenComplex.imag;\n const evenShape = [evenRealVals.length];\n const evenRealInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenRealVals);\n const evenImagInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenImagVals);\n const evenTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: evenRealInfo, imag: evenImagInfo }, backend: cpuBackend });\n const oddComplex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].complexWithOddIndex(data);\n const oddRealVals = oddComplex.real;\n const oddImagVals = oddComplex.imag;\n const oddShape = [oddRealVals.length];\n const oddRealInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddRealVals);\n const oddImagInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddImagVals);\n const oddTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: oddRealInfo, imag: oddImagInfo }, backend: cpuBackend });\n // Recursive call for half part of original input.\n const $evenComplex = fftRadix2(evenRealVals, evenImagVals, half, inverse, cpuBackend);\n const $evenRealVals = $evenComplex.real;\n const $evenImagVals = $evenComplex.imag;\n const $evenShape = [$evenRealVals.length];\n const $evenRealInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenRealVals);\n const $evenImagInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenImagVals);\n const $evenTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({\n inputs: { real: $evenRealInfo, imag: $evenImagInfo },\n backend: cpuBackend\n });\n const $oddComplex = fftRadix2(oddRealVals, oddImagVals, half, inverse, cpuBackend);\n const $oddRealVals = $oddComplex.real;\n const $oddImagVals = $oddComplex.imag;\n const $oddShape = [$oddRealVals.length];\n const $oddRealInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddRealVals);\n const $oddImagInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddImagVals);\n const $oddTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: $oddRealInfo, imag: $oddImagInfo }, backend: cpuBackend });\n const e = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].exponents(size, inverse);\n const eShape = [e.real.length];\n const eRealInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.real);\n const eImagInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.imag);\n const complexInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: eRealInfo, imag: eImagInfo }, backend: cpuBackend });\n const exponentInfo = Object(_kernels_Multiply__WEBPACK_IMPORTED_MODULE_6__[\"multiply\"])({ inputs: { a: complexInfo, b: $oddTensorInfo }, backend: cpuBackend });\n const addPart = Object(_kernels_Add__WEBPACK_IMPORTED_MODULE_1__[\"add\"])({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const subPart = Object(_kernels_Sub__WEBPACK_IMPORTED_MODULE_10__[\"sub\"])({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const addPartReal = Object(_kernels_Real__WEBPACK_IMPORTED_MODULE_7__[\"real\"])({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartReal = Object(_kernels_Real__WEBPACK_IMPORTED_MODULE_7__[\"real\"])({ inputs: { input: subPart }, backend: cpuBackend });\n const addPartImag = Object(_kernels_Imag__WEBPACK_IMPORTED_MODULE_5__[\"imag\"])({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartImag = Object(_kernels_Imag__WEBPACK_IMPORTED_MODULE_5__[\"imag\"])({ inputs: { input: subPart }, backend: cpuBackend });\n const $real = Object(_kernels_Concat__WEBPACK_IMPORTED_MODULE_3__[\"concat\"])({\n inputs: [addPartReal, subPartReal],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $imag = Object(_kernels_Concat__WEBPACK_IMPORTED_MODULE_3__[\"concat\"])({\n inputs: [addPartImag, subPartImag],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $realVals = cpuBackend.data.get($real.dataId).values;\n const $imagVals = cpuBackend.data.get($imag.dataId).values;\n cpuBackend.disposeIntermediateTensorInfo(evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(eRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(eImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(complexInfo);\n cpuBackend.disposeIntermediateTensorInfo(exponentInfo);\n cpuBackend.disposeIntermediateTensorInfo(addPart);\n cpuBackend.disposeIntermediateTensorInfo(subPart);\n cpuBackend.disposeIntermediateTensorInfo(addPartReal);\n cpuBackend.disposeIntermediateTensorInfo(addPartImag);\n cpuBackend.disposeIntermediateTensorInfo(subPartReal);\n cpuBackend.disposeIntermediateTensorInfo(subPartImag);\n cpuBackend.disposeIntermediateTensorInfo($real);\n cpuBackend.disposeIntermediateTensorInfo($imag);\n return { real: $realVals, imag: $imagVals };\n}", "_precompute() {\n\t\t\tconst encTable = this._tables[0];\n\t\t\tconst decTable = this._tables[1];\n\t\t\tconst sbox = encTable[4];\n\t\t\tconst sboxInv = decTable[4];\n\t\t\tconst d = [];\n\t\t\tconst th = [];\n\t\t\tlet xInv, x2, x4, x8;\n\n\t\t\t// Compute double and third tables\n\t\t\tfor (let i = 0; i < 256; i++) {\n\t\t\t\tth[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i;\n\t\t\t}\n\n\t\t\tfor (let x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {\n\t\t\t\t// Compute sbox\n\t\t\t\tlet s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;\n\t\t\t\ts = s >> 8 ^ s & 255 ^ 99;\n\t\t\t\tsbox[x] = s;\n\t\t\t\tsboxInv[s] = x;\n\n\t\t\t\t// Compute MixColumns\n\t\t\t\tx8 = d[x4 = d[x2 = d[x]]];\n\t\t\t\tlet tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;\n\t\t\t\tlet tEnc = d[s] * 0x101 ^ s * 0x1010100;\n\n\t\t\t\tfor (let i = 0; i < 4; i++) {\n\t\t\t\t\tencTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;\n\t\t\t\t\tdecTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Compactify. Considerable speedup on Firefox.\n\t\t\tfor (let i = 0; i < 5; i++) {\n\t\t\t\tencTable[i] = encTable[i].slice(0);\n\t\t\t\tdecTable[i] = decTable[i].slice(0);\n\t\t\t}\n\t\t}", "function realFft(input, output) {\n\n var n = input.length,\n x = output, \n TWO_PI = 2*Math.PI,\n sqrt = Math.sqrt,\n n2, n4, n8, nn, \n t1, t2, t3, t4, \n i1, i2, i3, i4, i5, i6, i7, i8, \n st1, cc1, ss1, cc3, ss3,\n e, \n a,\n rval, ival, mag; \n\n _reverseBinPermute(output, input);\n\n for (var ix = 0, id = 4; ix < n; id *= 4) {\n for (var i0 = ix; i0 < n; i0 += id) {\n //sumdiff(x[i0], x[i0+1]); // {a, b} <--| {a+b, a-b}\n st1 = x[i0] - x[i0+1];\n x[i0] += x[i0+1];\n x[i0+1] = st1;\n } \n ix = 2*(id-1);\n }\n\n n2 = 2;\n nn = n >>> 1;\n\n while((nn = nn >>> 1)) {\n ix = 0;\n n2 = n2 << 1;\n id = n2 << 1;\n n4 = n2 >>> 2;\n n8 = n2 >>> 3;\n do {\n if(n4 !== 1) {\n for(i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1; \n x[i1] += t1;\n \n i1 += n8;\n i2 += n8;\n i3 += n8;\n i4 += n8;\n \n //sumdiff(x[i3], x[i4], t1, t2); // {s, d} <--| {a+b, a-b}\n t1 = x[i3] + x[i4];\n t2 = x[i3] - x[i4];\n \n t1 = -t1 * Math.SQRT1_2;\n t2 *= Math.SQRT1_2;\n \n // sumdiff(t1, x[i2], x[i4], x[i3]); // {s, d} <--| {a+b, a-b}\n st1 = x[i2];\n x[i4] = t1 + st1; \n x[i3] = t1 - st1;\n \n //sumdiff3(x[i1], t2, x[i2]); // {a, b, d} <--| {a+b, b, a-b}\n x[i2] = x[i1] - t2;\n x[i1] += t2;\n }\n } else {\n for(i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4]; \n x[i4] -= x[i3];\n \n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1; \n x[i1] += t1;\n }\n }\n \n ix = (id << 1) - n2;\n id = id << 2;\n } while (ix < n);\n \n e = TWO_PI / n2;\n\n for (var j = 1; j < n8; j++) {\n a = j * e;\n ss1 = Math.sin(a);\n cc1 = Math.cos(a);\n\n //ss3 = sin(3*a); cc3 = cos(3*a);\n cc3 = 4*cc1*(cc1*cc1-0.75);\n ss3 = 4*ss1*(0.75-ss1*ss1);\n \n ix = 0; id = n2 << 1;\n do {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0 + j;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n i5 = i0 + n4 - j;\n i6 = i5 + n4;\n i7 = i6 + n4;\n i8 = i7 + n4;\n \n //cmult(c, s, x, y, &u, &v)\n //cmult(cc1, ss1, x[i7], x[i3], t2, t1); // {u,v} <--| {x*c-y*s, x*s+y*c}\n t2 = x[i7]*cc1 - x[i3]*ss1; \n t1 = x[i7]*ss1 + x[i3]*cc1;\n \n //cmult(cc3, ss3, x[i8], x[i4], t4, t3);\n t4 = x[i8]*cc3 - x[i4]*ss3; \n t3 = x[i8]*ss3 + x[i4]*cc3;\n \n //sumdiff(t2, t4); // {a, b} <--| {a+b, a-b}\n st1 = t2 - t4;\n t2 += t4;\n t4 = st1;\n \n //sumdiff(t2, x[i6], x[i8], x[i3]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i6]; x[i8] = t2 + st1; x[i3] = t2 - st1;\n x[i8] = t2 + x[i6]; \n x[i3] = t2 - x[i6];\n \n //sumdiff_r(t1, t3); // {a, b} <--| {a+b, b-a}\n st1 = t3 - t1;\n t1 += t3;\n t3 = st1;\n \n //sumdiff(t3, x[i2], x[i4], x[i7]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i2]; x[i4] = t3 + st1; x[i7] = t3 - st1;\n x[i4] = t3 + x[i2]; \n x[i7] = t3 - x[i2];\n \n //sumdiff3(x[i1], t1, x[i6]); // {a, b, d} <--| {a+b, b, a-b}\n x[i6] = x[i1] - t1; \n x[i1] += t1;\n \n //diffsum3_r(t4, x[i5], x[i2]); // {a, b, s} <--| {a, b-a, a+b}\n x[i2] = t4 + x[i5]; \n x[i5] -= t4;\n }\n \n ix = (id << 1) - n2;\n id = id << 2;\n \n } while (ix < n);\n }\n }\n \n /* Scale output to have same norm as input. */\n var f = 1 / sqrt(n);\n for (var i = 0; i < n; i++)\n\t x[i] *= f;\n\n}", "function FFT(){var _n=0,// order\n_bitrev=null,// bit reversal table\n_cstb=null;// sin/cos table\nvar _tre,_tim;this.init=function(n){if(n!==0&&(n&n-1)===0){_n=n;_setVariables();_makeBitReversal();_makeCosSinTable();}else{throw new Error(\"init: radix-2 required\");}};// 1D-FFT\nthis.fft1d=function(re,im){fft(re,im,1);};// 1D-IFFT\nthis.ifft1d=function(re,im){var n=1/_n;fft(re,im,-1);for(var i=0;i<_n;i++){re[i]*=n;im[i]*=n;}};// 2D-FFT\nthis.fft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.fft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT\nthis.ifft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// core operation of FFT\nfunction fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}// set variables\nfunction _setVariables(){if(typeof Uint8Array!=='undefined'){_bitrev=new Uint8Array(_n);}else{_bitrev=new Array(_n);}if(typeof Float64Array!=='undefined'){_cstb=new Float64Array(_n*1.25);_tre=new Float64Array(_n*_n);_tim=new Float64Array(_n*_n);}else{_cstb=new Array(_n*1.25);_tre=new Array(_n*_n);_tim=new Array(_n*_n);}}// make bit reversal table\nfunction _makeBitReversal(){var i=0,j=0,k=0;_bitrev[0]=0;while(++i<_n){k=_n>>1;while(k<=j){j-=k;k>>=1;}j+=k;_bitrev[i]=j;}}// make trigonometric function table\nfunction _makeCosSinTable(){var n2=_n>>1,n4=_n>>2,n8=_n>>3,n2p4=n2+n4,t=Math.sin(Math.PI/_n),dc=2*t*t,ds=Math.sqrt(dc*(2-dc)),c=_cstb[n4]=1,s=_cstb[0]=0;t=2*dc;for(var i=1;i<n8;i++){c-=dc;dc+=t*c;s+=ds;ds-=t*s;_cstb[i]=s;_cstb[n4-i]=c;}if(n8!==0){_cstb[n8]=Math.sqrt(0.5);}for(var j=0;j<n4;j++){_cstb[n2-j]=_cstb[j];}for(var k=0;k<n2p4;k++){_cstb[k+n2]=-_cstb[k];}}}", "function FFT$1(){var _n=0,// order\n_bitrev=null,// bit reversal table\n_cstb=null;// sin/cos table\nvar _tre,_tim;this.init=function(n){if(n!==0&&(n&n-1)===0){_n=n;_setVariables();_makeBitReversal();_makeCosSinTable();}else{throw new Error('init: radix-2 required');}};// 1D-FFT\nthis.fft1d=function(re,im){fft(re,im,1);};// 1D-IFFT\nthis.ifft1d=function(re,im){var n=1/_n;fft(re,im,-1);for(var i=0;i<_n;i++){re[i]*=n;im[i]*=n;}};// 2D-FFT\nthis.fft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.fft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT\nthis.ifft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT, real-valued\n// only outputs the real valued part\nthis.real_ifft2d=function(re,im){var i2;var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nvar halfn=_n/2;var rowIdx=0;for(var x=0;x<_n;x+=2){//untangle\ni=x;i2=x+1;_tre[0]=re[0+i];_tim[0]=re[0+i2];_tre[_n/2]=re[halfn*_n+i];_tim[_n/2]=re[halfn*_n+i2];for(var x2=1;x2<halfn;x2++){rowIdx=x2*_n;_tre[x2]=re[rowIdx+i]-im[rowIdx+i2];_tre[_n-x2]=re[rowIdx+i]+im[rowIdx+i2];_tim[x2]=im[rowIdx+i]+re[rowIdx+i2];_tim[_n-x2]=re[rowIdx+i2]-im[rowIdx+i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;i2=x+1+y2*_n;re[i]=_tre[y2];re[i2]=_tim[y2];}}};// 2D-FFT, real-valued only\n// ignores the imaginary input\n// see:\n// http://www.inf.fu-berlin.de/lehre/SS12/SP-Par/download/fft1.pdf\n// http://cnx.org/content/m12021/latest/\n// http://images.apple.com/acg/pdf/g4fft.pdf\n// http://www.ti.com/lit/an/spra291/spra291.pdf\nthis.real_fft2d=function(re,im){var i=0,i2=0;// x-axis\nfor(var y=0;y<_n;y+=2){i=y*_n;i2=(y+1)*_n;// tangle\nfor(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=re[x1+i2];}this.fft1d(_tre,_tim);// untangle\nre[0+i]=_tre[0];re[0+i2]=_tim[0];im[0+i]=0;im[0+i2]=0;re[_n/2+i]=_tre[_n/2];re[_n/2+i2]=_tim[_n/2];im[_n/2+i]=0;im[_n/2+i2]=0;for(var x2=1;x2<_n/2;x2++){re[x2+i]=0.5*(_tre[x2]+_tre[_n-x2]);im[x2+i]=0.5*(_tim[x2]-_tim[_n-x2]);re[x2+i2]=0.5*(_tim[x2]+_tim[_n-x2]);im[x2+i2]=-0.5*(_tre[x2]-_tre[_n-x2]);re[_n-x2+i]=re[x2+i];im[_n-x2+i]=-im[x2+i];re[_n-x2+i2]=re[x2+i2];im[_n-x2+i2]=-im[x2+i2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// core operation of FFT\nfunction fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\n//butfly(re,im,inv,n4);\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}function _setVariables(){if(typeof Uint8Array!=='undefined'){_bitrev=new Uint8Array(_n);}else{_bitrev=new Array(_n);}if(typeof Float64Array!=='undefined'){_cstb=new Float64Array(_n*1.25);_tre=new Float64Array(_n);_tim=new Float64Array(_n);}else{_cstb=new Array(_n*1.25);_tre=new Array(_n);_tim=new Array(_n);}}// make bit reversal table\nfunction _makeBitReversal(){var i=0,j=0,k=0;_bitrev[0]=0;while(++i<_n){k=_n>>1;while(k<=j){j-=k;k>>=1;}j+=k;_bitrev[i]=j;}}// make trigonometric function table\nfunction _makeCosSinTable(){var n2=_n>>1,n4=_n>>2,n8=_n>>3,n2p4=n2+n4,t=Math.sin(Math.PI/_n),dc=2*t*t,ds=Math.sqrt(dc*(2-dc)),c=_cstb[n4]=1,s=_cstb[0]=0;t=2*dc;for(var i=1;i<n8;i++){c-=dc;dc+=t*c;s+=ds;ds-=t*s;_cstb[i]=s;_cstb[n4-i]=c;}if(n8!==0){_cstb[n8]=Math.sqrt(0.5);}for(var j=0;j<n4;j++){_cstb[n2-j]=_cstb[j];}for(var k=0;k<n2p4;k++){_cstb[k+n2]=-_cstb[k];}}}", "function bnModPow(e,m) {\nvar i = e.bitLength(), k, r = nbv(1), z;\nif(i <= 0) return r;\nelse if(i < 18) k = 1;\nelse if(i < 48) k = 3;\nelse if(i < 144) k = 4;\nelse if(i < 768) k = 5;\nelse k = 6;\nif(i < 8)\n z = new Classic(m);\nelse if(m.isEven())\n z = new Barrett(m);\nelse\n z = new Montgomery(m);\n\n// precomputation\nvar g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;\ng[1] = z.convert(this);\nif(k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n}\n\nvar j = e.t-1, w, is1 = true, r2 = nbi(), t;\ni = nbits(e.data[j])-1;\nwhile(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e.data[j]&(1<<i)) == 0) {\n z.sqrTo(r,r2); t = r; r = r2; r2 = t;\n if(--i < 0) { i = this.DB-1; --j; }\n }\n}\nreturn z.revert(r);\n}", "function bnModPow(e,m) {\nvar i = e.bitLength(), k, r = nbv(1), z;\nif(i <= 0) return r;\nelse if(i < 18) k = 1;\nelse if(i < 48) k = 3;\nelse if(i < 144) k = 4;\nelse if(i < 768) k = 5;\nelse k = 6;\nif(i < 8)\n z = new Classic(m);\nelse if(m.isEven())\n z = new Barrett(m);\nelse\n z = new Montgomery(m);\n\n// precomputation\nvar g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;\ng[1] = z.convert(this);\nif(k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n}\n\nvar j = e.t-1, w, is1 = true, r2 = nbi(), t;\ni = nbits(e.data[j])-1;\nwhile(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e.data[j]&(1<<i)) == 0) {\n z.sqrTo(r,r2); t = r; r = r2; r2 = t;\n if(--i < 0) { i = this.DB-1; --j; }\n }\n}\nreturn z.revert(r);\n}", "function bnModPow(e,m) {\nvar i = e.bitLength(), k, r = nbv(1), z;\nif(i <= 0) return r;\nelse if(i < 18) k = 1;\nelse if(i < 48) k = 3;\nelse if(i < 144) k = 4;\nelse if(i < 768) k = 5;\nelse k = 6;\nif(i < 8)\n z = new Classic(m);\nelse if(m.isEven())\n z = new Barrett(m);\nelse\n z = new Montgomery(m);\n\n// precomputation\nvar g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;\ng[1] = z.convert(this);\nif(k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n}\n\nvar j = e.t-1, w, is1 = true, r2 = nbi(), t;\ni = nbits(e.data[j])-1;\nwhile(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e.data[j]&(1<<i)) == 0) {\n z.sqrTo(r,r2); t = r; r = r2; r2 = t;\n if(--i < 0) { i = this.DB-1; --j; }\n }\n}\nreturn z.revert(r);\n}", "function bnModPow(e,m) {\nvar i = e.bitLength(), k, r = nbv(1), z;\nif(i <= 0) return r;\nelse if(i < 18) k = 1;\nelse if(i < 48) k = 3;\nelse if(i < 144) k = 4;\nelse if(i < 768) k = 5;\nelse k = 6;\nif(i < 8)\n z = new Classic(m);\nelse if(m.isEven())\n z = new Barrett(m);\nelse\n z = new Montgomery(m);\n\n// precomputation\nvar g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;\ng[1] = z.convert(this);\nif(k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n}\n\nvar j = e.t-1, w, is1 = true, r2 = nbi(), t;\ni = nbits(e.data[j])-1;\nwhile(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e.data[j]&(1<<i)) == 0) {\n z.sqrTo(r,r2); t = r; r = r2; r2 = t;\n if(--i < 0) { i = this.DB-1; --j; }\n }\n}\nreturn z.revert(r);\n}", "function bnModPow(e,m) {\nvar i = e.bitLength(), k, r = nbv(1), z;\nif(i <= 0) return r;\nelse if(i < 18) k = 1;\nelse if(i < 48) k = 3;\nelse if(i < 144) k = 4;\nelse if(i < 768) k = 5;\nelse k = 6;\nif(i < 8)\n z = new Classic(m);\nelse if(m.isEven())\n z = new Barrett(m);\nelse\n z = new Montgomery(m);\n\n// precomputation\nvar g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;\ng[1] = z.convert(this);\nif(k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n}\n\nvar j = e.t-1, w, is1 = true, r2 = nbi(), t;\ni = nbits(e.data[j])-1;\nwhile(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e.data[j]&(1<<i)) == 0) {\n z.sqrTo(r,r2); t = r; r = r2; r2 = t;\n if(--i < 0) { i = this.DB-1; --j; }\n }\n}\nreturn z.revert(r);\n}", "function bnModPow(e,m) {\nvar i = e.bitLength(), k, r = nbv(1), z;\nif(i <= 0) return r;\nelse if(i < 18) k = 1;\nelse if(i < 48) k = 3;\nelse if(i < 144) k = 4;\nelse if(i < 768) k = 5;\nelse k = 6;\nif(i < 8)\n z = new Classic(m);\nelse if(m.isEven())\n z = new Barrett(m);\nelse\n z = new Montgomery(m);\n\n// precomputation\nvar g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;\ng[1] = z.convert(this);\nif(k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n}\n\nvar j = e.t-1, w, is1 = true, r2 = nbi(), t;\ni = nbits(e.data[j])-1;\nwhile(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e.data[j]&(1<<i)) == 0) {\n z.sqrTo(r,r2); t = r; r = r2; r2 = t;\n if(--i < 0) { i = this.DB-1; --j; }\n }\n}\nreturn z.revert(r);\n}", "function bnModPow(e,m) {\nvar i = e.bitLength(), k, r = nbv(1), z;\nif(i <= 0) return r;\nelse if(i < 18) k = 1;\nelse if(i < 48) k = 3;\nelse if(i < 144) k = 4;\nelse if(i < 768) k = 5;\nelse k = 6;\nif(i < 8)\n z = new Classic(m);\nelse if(m.isEven())\n z = new Barrett(m);\nelse\n z = new Montgomery(m);\n\n// precomputation\nvar g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;\ng[1] = z.convert(this);\nif(k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n}\n\nvar j = e.t-1, w, is1 = true, r2 = nbi(), t;\ni = nbits(e.data[j])-1;\nwhile(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e.data[j]&(1<<i)) == 0) {\n z.sqrTo(r,r2); t = r; r = r2; r2 = t;\n if(--i < 0) { i = this.DB-1; --j; }\n }\n}\nreturn z.revert(r);\n}", "_precompute() {\n const encTable = this._tables[0];\n const decTable = this._tables[1];\n const sbox = encTable[4];\n const sboxInv = decTable[4];\n const d = [];\n const th = [];\n let xInv, x2, x4, x8;\n for (let i = 0; i < 256; i++) {\n th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i;\n }\n for (let x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {\n let s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;\n s = s >> 8 ^ s & 255 ^ 99;\n sbox[x] = s;\n sboxInv[s] = x;\n x8 = d[x4 = d[x2 = d[x]]];\n let tDec = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008;\n let tEnc = d[s] * 257 ^ s * 16843008;\n for (let i = 0; i < 4; i++) {\n encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;\n decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8;\n }\n }\n for (let i = 0; i < 5; i++) {\n encTable[i] = encTable[i].slice(0);\n decTable[i] = decTable[i].slice(0);\n }\n }", "function fftRadix2(realVals, imagVals, size, inverse, cpuBackend) {\n if (size === 1) {\n return { real: realVals, imag: imagVals };\n }\n const data = backend_util.mergeRealAndImagArrays(realVals, imagVals);\n const half = size / 2;\n const evenComplex = backend_util.complexWithEvenIndex(data);\n const evenRealVals = evenComplex.real;\n const evenImagVals = evenComplex.imag;\n const evenShape = [evenRealVals.length];\n const evenRealInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenRealVals);\n const evenImagInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenImagVals);\n const evenTensorInfo = complex({ inputs: { real: evenRealInfo, imag: evenImagInfo }, backend: cpuBackend });\n const oddComplex = backend_util.complexWithOddIndex(data);\n const oddRealVals = oddComplex.real;\n const oddImagVals = oddComplex.imag;\n const oddShape = [oddRealVals.length];\n const oddRealInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddRealVals);\n const oddImagInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddImagVals);\n const oddTensorInfo = complex({ inputs: { real: oddRealInfo, imag: oddImagInfo }, backend: cpuBackend });\n // Recursive call for half part of original input.\n const $evenComplex = fftRadix2(evenRealVals, evenImagVals, half, inverse, cpuBackend);\n const $evenRealVals = $evenComplex.real;\n const $evenImagVals = $evenComplex.imag;\n const $evenShape = [$evenRealVals.length];\n const $evenRealInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenRealVals);\n const $evenImagInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenImagVals);\n const $evenTensorInfo = complex({\n inputs: { real: $evenRealInfo, imag: $evenImagInfo },\n backend: cpuBackend\n });\n const $oddComplex = fftRadix2(oddRealVals, oddImagVals, half, inverse, cpuBackend);\n const $oddRealVals = $oddComplex.real;\n const $oddImagVals = $oddComplex.imag;\n const $oddShape = [$oddRealVals.length];\n const $oddRealInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddRealVals);\n const $oddImagInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddImagVals);\n const $oddTensorInfo = complex({ inputs: { real: $oddRealInfo, imag: $oddImagInfo }, backend: cpuBackend });\n const e = backend_util.exponents(size, inverse);\n const eShape = [e.real.length];\n const eRealInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.real);\n const eImagInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.imag);\n const complexInfo = complex({ inputs: { real: eRealInfo, imag: eImagInfo }, backend: cpuBackend });\n const exponentInfo = multiply({ inputs: { a: complexInfo, b: $oddTensorInfo }, backend: cpuBackend });\n const addPart = add({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const subPart = sub({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const addPartReal = real({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartReal = real({ inputs: { input: subPart }, backend: cpuBackend });\n const addPartImag = imag({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartImag = imag({ inputs: { input: subPart }, backend: cpuBackend });\n const $real = concat({\n inputs: [addPartReal, subPartReal],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $imag = concat({\n inputs: [addPartImag, subPartImag],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $realVals = cpuBackend.data.get($real.dataId).values;\n const $imagVals = cpuBackend.data.get($imag.dataId).values;\n cpuBackend.disposeIntermediateTensorInfo(evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(eRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(eImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(complexInfo);\n cpuBackend.disposeIntermediateTensorInfo(exponentInfo);\n cpuBackend.disposeIntermediateTensorInfo(addPart);\n cpuBackend.disposeIntermediateTensorInfo(subPart);\n cpuBackend.disposeIntermediateTensorInfo(addPartReal);\n cpuBackend.disposeIntermediateTensorInfo(addPartImag);\n cpuBackend.disposeIntermediateTensorInfo(subPartReal);\n cpuBackend.disposeIntermediateTensorInfo(subPartImag);\n cpuBackend.disposeIntermediateTensorInfo($real);\n cpuBackend.disposeIntermediateTensorInfo($imag);\n return { real: $realVals, imag: $imagVals };\n}", "function conv2dWithIm2Row({ x, filter, convInfo, backend, bias = null, preluActivationWeights = null, leakyreluAlpha = 0, activation = null }) {\n // Rearranges conv2d input so each block to be convolved over forms the\n // column of a new matrix with shape [filterWidth * filterHeight *\n // inChannels, outHeight * outWidth]. The filter is also rearranged so each\n // output channel forms a row of a new matrix with shape [outChannels,\n // filterWidth * filterHeight * inChannels]. The convolution is then\n // computed by multiplying these matrices and reshaping the result.\n const { filterWidth, filterHeight, inChannels, outWidth, outHeight, dataFormat } = convInfo;\n const isChannelsLast = dataFormat === 'channelsLast';\n const sharedDim = filterWidth * filterHeight * inChannels;\n const numCols = outHeight * outWidth;\n const x2ColShape = [sharedDim, numCols];\n const transposeA = true;\n const transposeB = false;\n const intermediates = [];\n const xSqueezed = Object(_Reshape__WEBPACK_IMPORTED_MODULE_7__[\"reshape\"])({ inputs: { x }, backend, attrs: { shape: x.shape.slice(1) } });\n const w2Row = Object(_Reshape__WEBPACK_IMPORTED_MODULE_7__[\"reshape\"])({\n inputs: { x: filter },\n backend,\n attrs: { shape: [1, sharedDim, _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].sizeFromShape(filter.shape) / sharedDim] }\n });\n intermediates.push(xSqueezed);\n intermediates.push(w2Row);\n const im2ColProgram = new _im2col_packed_gpu__WEBPACK_IMPORTED_MODULE_1__[\"Im2ColPackedProgram\"](x2ColShape, xSqueezed.shape, convInfo);\n const im2Col = backend.runWebGLProgram(im2ColProgram, [xSqueezed], 'float32');\n const im2ColReshaped = Object(_Reshape__WEBPACK_IMPORTED_MODULE_7__[\"reshape\"])({\n inputs: { x: im2Col },\n backend,\n attrs: { shape: [1, x2ColShape[0], x2ColShape[1]] }\n });\n intermediates.push(im2Col);\n intermediates.push(im2ColReshaped);\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const hasLeakyreluAlpha = activation === 'leakyrelu';\n const fusedActivation = activation ? Object(_kernel_utils_kernel_funcs_utils__WEBPACK_IMPORTED_MODULE_2__[\"mapActivationToShaderProgram\"])(activation, true) : null;\n const matmulProgram = new _mulmat_packed_gpu__WEBPACK_IMPORTED_MODULE_3__[\"MatMulPackedProgram\"](im2ColReshaped.shape, w2Row.shape, [1, numCols, convInfo.outChannels], transposeA, transposeB, hasBias, fusedActivation, hasPreluActivationWeights, hasLeakyreluAlpha);\n const inputs = [im2ColReshaped, w2Row];\n if (bias) {\n inputs.push(bias);\n }\n if (hasPreluActivationWeights) {\n inputs.push(preluActivationWeights);\n }\n if (hasLeakyreluAlpha) {\n const $leakyreluAlpha = backend.makeTensorInfo([], 'float32', _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].createScalarValue(leakyreluAlpha, 'float32'));\n inputs.push($leakyreluAlpha);\n intermediates.push($leakyreluAlpha);\n }\n const product = backend.runWebGLProgram(matmulProgram, inputs, 'float32');\n const outShape = isChannelsLast ?\n [1, outHeight, outWidth, convInfo.outChannels] :\n [1, convInfo.outChannels, outHeight, outWidth];\n const out = Object(_Reshape__WEBPACK_IMPORTED_MODULE_7__[\"reshape\"])({ inputs: { x: product }, backend, attrs: { shape: outShape } });\n intermediates.push(product);\n for (const i of intermediates) {\n backend.disposeIntermediateTensorInfo(i);\n }\n return out;\n}", "function fft_rx2 (re, im) {\n let N = re.length;\n if (N.toString(2) % 10) // return immediately if N is not power of 2\n return;\n else if (N <= 32) // if N is sufficiently small, compute dft directly\n return dft_direct(re, im);\n\n let W = discrete_circle(N); // N evenly spaced points around the unit circle\n im = im || re.map( a => 0 ); // set imaginary values to zero if not provided\n\n // compute N/2-point DFT for even and odd samples of input array\n let S_1 = fft_rx2(...[re, im].map( a => a.filter( (_, i) => !(i % 2) ) ));\n let S_2 = fft_rx2(...[re, im].map( a => a.filter( (_, i) => i % 2 ) ));\n\n // mutiply by twiddle factor. later, exploit symmetry W[k+N/2] = -W[k]\n let G_2 = S_2.map( (a, k) => cpx_mult(a, W[k % N]) );\n\n // combine for all frequencies k in N/2-1\n let X = [];\n for (let k of xrange(N/2)) {\n X[k] = cpx_add(S_1[k], G_2[k]);\n X[k + N/2] = cpx_sub(S_1[k], G_2[k]);\n }\n\n return X;\n}", "forward(buffer) {\n var n = this.bufferSize,\n spectrum = this.spectrum,\n x = this.trans,\n TWO_PI = 2 * Math.PI,\n sqrt = Math.sqrt,\n i = n >>> 1,\n bSi = 2 / n,\n n2, n4, n8, nn,\n t1, t2, t3, t4,\n i1, i2, i3, i4, i5, i6, i7, i8,\n st1, cc1, ss1, cc3, ss3,\n e,\n a,\n rval, ival, mag;\n\n this.reverseBinPermute(x, buffer);\n\n for (var ix = 0, id = 4; ix < n; id *= 4) {\n for (var i0 = ix; i0 < n; i0 += id) {\n //sumdiff(x[i0], x[i0+1]); // {a, b} <--| {a+b, a-b}\n st1 = x[i0] - x[i0 + 1];\n x[i0] += x[i0 + 1];\n x[i0 + 1] = st1;\n }\n ix = 2 * (id - 1);\n }\n\n n2 = 2;\n nn = n >>> 1;\n\n while ((nn = nn >>> 1)) {\n ix = 0;\n n2 = n2 << 1;\n id = n2 << 1;\n n4 = n2 >>> 2;\n n8 = n2 >>> 3;\n do {\n if (n4 !== 1) {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1;\n x[i1] += t1;\n\n i1 += n8;\n i2 += n8;\n i3 += n8;\n i4 += n8;\n\n //sumdiff(x[i3], x[i4], t1, t2); // {s, d} <--| {a+b, a-b}\n t1 = x[i3] + x[i4];\n t2 = x[i3] - x[i4];\n\n t1 = -t1 * Math.SQRT1_2;\n t2 *= Math.SQRT1_2;\n\n // sumdiff(t1, x[i2], x[i4], x[i3]); // {s, d} <--| {a+b, a-b}\n st1 = x[i2];\n x[i4] = t1 + st1;\n x[i3] = t1 - st1;\n\n //sumdiff3(x[i1], t2, x[i2]); // {a, b, d} <--| {a+b, b, a-b}\n x[i2] = x[i1] - t2;\n x[i1] += t2;\n }\n } else {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1;\n x[i1] += t1;\n }\n }\n\n ix = (id << 1) - n2;\n id = id << 2;\n } while (ix < n);\n\n e = TWO_PI / n2;\n\n for (var j = 1; j < n8; j++) {\n a = j * e;\n ss1 = Math.sin(a);\n cc1 = Math.cos(a);\n\n //ss3 = sin(3*a); cc3 = cos(3*a);\n cc3 = 4 * cc1 * (cc1 * cc1 - 0.75);\n ss3 = 4 * ss1 * (0.75 - ss1 * ss1);\n\n ix = 0; id = n2 << 1;\n do {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0 + j;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n i5 = i0 + n4 - j;\n i6 = i5 + n4;\n i7 = i6 + n4;\n i8 = i7 + n4;\n\n //cmult(c, s, x, y, &u, &v)\n //cmult(cc1, ss1, x[i7], x[i3], t2, t1); // {u,v} <--| {x*c-y*s, x*s+y*c}\n t2 = x[i7] * cc1 - x[i3] * ss1;\n t1 = x[i7] * ss1 + x[i3] * cc1;\n\n //cmult(cc3, ss3, x[i8], x[i4], t4, t3);\n t4 = x[i8] * cc3 - x[i4] * ss3;\n t3 = x[i8] * ss3 + x[i4] * cc3;\n\n //sumdiff(t2, t4); // {a, b} <--| {a+b, a-b}\n st1 = t2 - t4;\n t2 += t4;\n t4 = st1;\n\n //sumdiff(t2, x[i6], x[i8], x[i3]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i6]; x[i8] = t2 + st1; x[i3] = t2 - st1;\n x[i8] = t2 + x[i6];\n x[i3] = t2 - x[i6];\n\n //sumdiff_r(t1, t3); // {a, b} <--| {a+b, b-a}\n st1 = t3 - t1;\n t1 += t3;\n t3 = st1;\n\n //sumdiff(t3, x[i2], x[i4], x[i7]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i2]; x[i4] = t3 + st1; x[i7] = t3 - st1;\n x[i4] = t3 + x[i2];\n x[i7] = t3 - x[i2];\n\n //sumdiff3(x[i1], t1, x[i6]); // {a, b, d} <--| {a+b, b, a-b}\n x[i6] = x[i1] - t1;\n x[i1] += t1;\n\n //diffsum3_r(t4, x[i5], x[i2]); // {a, b, s} <--| {a, b-a, a+b}\n x[i2] = t4 + x[i5];\n x[i5] -= t4;\n }\n\n ix = (id << 1) - n2;\n id = id << 2;\n\n } while (ix < n);\n }\n }\n\n while (--i) {\n rval = x[i];\n ival = x[n - i - 1];\n mag = bSi * sqrt(rval * rval + ival * ival);\n\n if (mag > this.peak) {\n this.peakBand = i;\n this.peak = mag;\n }\n\n spectrum[i] = mag;\n }\n\n spectrum[0] = bSi * x[0];\n\n return spectrum;\n }", "function genBlWithChunksInDiffSize () {\n var bl = new BufferList();\n var i = 0;\n var j = 0;\n var size = 1;\n while (i < 0x100) {\n if (size + i >= 0x100) size = 0x100 - i;\n var b = Buffer.alloc(size);\n for (j = i; j < size + i; j++) {\n b[j-i] = j;\n }\n i = j;\n bl.append(b);\n size++;\n }\n return bl;\n}", "function RealFFT( NumSamples, RealIn, RealOut, ImagOut)\n{\n\n var Half = NumSamples / 2;\n var i;\n\n var theta = Math.PI / Half;\n\n var tmpReal = new Float32Array(Half);\n var tmpImag = new Float32Array(Half);\n\n for (var i = 0; i < Half; i++) {\n tmpReal[i] = RealIn[2 * i];\n tmpImag[i] = RealIn[2 * i + 1];\n }\n\n ACFFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);\n\n var wtemp = (Math.sin(0.5 * theta));\n\n var wpr = -2.0 * wtemp * wtemp;\n var wpi = -1.0 * (Math.sin(theta));\n var wr = 1.0 + wpr;\n var wi = wpi;\n\n var i3;\n\n var h1r, h1i, h2r, h2i;\n\n for (var i = 1; i < Half / 2; i++) {\n\n i3 = Half - i;\n\n h1r = 0.5 * (RealOut[i] + RealOut[i3]);\n h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);\n h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);\n h2i = -0.5 * (RealOut[i] - RealOut[i3]);\n\n RealOut[i] = h1r + wr * h2r - wi * h2i;\n ImagOut[i] = h1i + wr * h2i + wi * h2r;\n RealOut[i3] = h1r - wr * h2r + wi * h2i;\n ImagOut[i3] = -h1i + wr * h2i + wi * h2r;\n\n wr = (wtemp = wr) * wpr - wi * wpi + wr;\n wi = wi * wpr + wtemp * wpi + wi;\n }\n\n RealOut[0] = (h1r = RealOut[0]) + ImagOut[0];\n ImagOut[0] = h1r - ImagOut[0];\n}", "function ACFFT( NumSamples,\n InverseTransform,\n RealIn, ImagIn, RealOut, ImagOut)\n{\n var NumBits; /* Number of bits needed to store indices */\n var i, j, k, n;\n var BlockSize, BlockEnd;\n\n var angle_numerator = 2.0 * Math.PI;\n var tr, ti; /* temp real, temp imaginary */\n\n if (!IsPowerOfTwo(NumSamples)) {\n console.log(NumSamples + \" is not a power of two\");\n return 1;\n }\n\n if (!gFFTBitTable)\n ACInitFFT();\n\n if (!InverseTransform)\n angle_numerator = -angle_numerator;\n\n NumBits = NumberOfBitsNeeded(NumSamples);\n\n /*\n ** Do simultaneous data copy and bit-reversal ordering into outputs...\n */\n\n for (var i = 0; i < NumSamples; i++) {\n j = FastReverseBits(i, NumBits);\n RealOut[j] = RealIn[i];\n ImagOut[j] = (ImagIn === undefined) ? 0.0 : ImagIn[i];\n }\n\n /*\n ** Do the FFT itself...\n */\n\n BlockEnd = 1;\n for (BlockSize = 2; BlockSize <= NumSamples; BlockSize <<= 1) {\n\n var delta_angle = angle_numerator / BlockSize;\n\n var sm2 = Math.sin(-2 * delta_angle);\n var sm1 = Math.sin(-delta_angle);\n var cm2 = Math.cos(-2 * delta_angle);\n var cm1 = Math.cos(-delta_angle);\n var w = 2 * cm1;\n var ar0, ar1, ar2, ai0, ai1, ai2;\n\n for (var i = 0; i < NumSamples; i += BlockSize) {\n ar2 = cm2;\n ar1 = cm1;\n\n ai2 = sm2;\n ai1 = sm1;\n\n for (var j = i, n = 0; n < BlockEnd; j++, n++) {\n ar0 = w * ar1 - ar2;\n ar2 = ar1;\n ar1 = ar0;\n\n ai0 = w * ai1 - ai2;\n ai2 = ai1;\n ai1 = ai0;\n\n k = j + BlockEnd;\n tr = ar0 * RealOut[k] - ai0 * ImagOut[k];\n ti = ar0 * ImagOut[k] + ai0 * RealOut[k];\n\n RealOut[k] = RealOut[j] - tr;\n ImagOut[k] = ImagOut[j] - ti;\n\n RealOut[j] += tr;\n ImagOut[j] += ti;\n }\n }\n\n BlockEnd = BlockSize;\n }\n\n /*\n ** Need to normalize if inverse transform...\n */\n\n if (InverseTransform) {\n var denom = NumSamples;\n\n for (var i = 0; i < NumSamples; i++) {\n RealOut[i] /= denom;\n ImagOut[i] /= denom;\n }\n }\n}", "resizeBloomBuffer(width, height){\n gl.bindTexture(gl.TEXTURE_2D, this._depthTex_Bloom0);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, width, height, 0, gl.DEPTH_COMPONENT,\n gl.UNSIGNED_SHORT, null);\n\n gl.bindTexture(gl.TEXTURE_2D, this._screenbuffer);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.FLOAT,null);\n \n\n gl.bindTexture(gl.TEXTURE_2D, this._depthTex_Bloom1_DownScale);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, \n width / this._brightnessFilterDownScale, height / this._brightnessFilterDownScale, \n 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null);\n \n gl.bindTexture(gl.TEXTURE_2D, this._birghtnessFilterBuffer);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, \n width / this._brightnessFilterDownScale, height / this._brightnessFilterDownScale, \n 0, gl.RGBA, gl.FLOAT, null);\n \n gl.bindTexture(gl.TEXTURE_2D, this._depthTex_Bloom2_DownScale);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, \n width / this._blurDownScale, height / this._blurDownScale, \n 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null);\n \n gl.bindTexture(gl.TEXTURE_2D, this._downScale1Buffer);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, \n width / this._blurDownScale, height / this._blurDownScale, \n 0, gl.RGBA, gl.FLOAT, null);\n \n gl.bindTexture(gl.TEXTURE_2D, this._depthTex_Bloom3_DownScale);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, \n width / this._blurDownScale, height / this._blurDownScale, \n 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null);\n \n gl.bindTexture(gl.TEXTURE_2D, this._downScale2Buffer);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, \n width / this._blurDownScale, height / this._blurDownScale, \n 0, gl.RGBA, gl.FLOAT, null);\n }", "function fourierTransformByMatmul(data, size, inverse) {\n const ret = new Float32Array(size * 2);\n // TODO: Use matmul instead once it supports complex64 type.\n for (let r = 0; r < size; r++) {\n let real = 0.0;\n let imag = 0.0;\n for (let c = 0; c < size; c++) {\n const e = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].exponent(r * c, size, inverse);\n const term = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].getComplexWithIndex(data, c);\n real += term.real * e.real - term.imag * e.imag;\n imag += term.real * e.imag + term.imag * e.real;\n }\n if (inverse) {\n real /= size;\n imag /= size;\n }\n _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].assignToTypedArray(ret, real, imag, r);\n }\n return ret;\n}", "function getWaveTextures(fftProgs, size, period) {\n const stages = Math.ceil(Math.log(size) / Math.log(2));\n const N = 1 << stages; //the resized size\n \n var initNoise = Compute.makeComputeBuffer(fftProgs.gl, N, N);\n var buffer1 = Compute.makeComputeBuffer(fftProgs.gl, N, N);\n var buffer2 = Compute.makeComputeBuffer(fftProgs.gl, N, N);\n var buffer3 = Compute.makeComputeBuffer(fftProgs.gl, N, N);\n \n const yx_ratio = SUB_TILE_HEIGHT / SUB_TILE_WIDTH;\n \n\n\n //Have to scale down because the peak of the power spectrum function is high\n \n //u_1: l\n //u_2: L\n //u_3: y/x ratio\n var shapeNoise = Compute.buildCustomProgram(fftProgs.gl, `\n float k2 = k.x * k.x + (k.y * u_3) * (k.y * u_3);\n \tfloat l = u_1;\n \tfloat l2 = l * l;\n float L = u_2;\n \tfloat L2 = L * L;\n \n float mag;\n if(k2 == 0.0) {//const mode\n \t\tmag = 0.0;\n } else {\n \t\tmag = exp(- l2 * k2) * exp(- l2 * k2) * exp(- 1.0 / (k2 * L2)) / (k2 * k2);\n \t}\n b = a * sqrt(mag);\n `\n );\n Compute.gaussianNoise(fftProgs, Math.floor(Math.random() * 65535), .04, buffer1);\n Compute.runCustomProgram(fftProgs.gl, shapeNoise, buffer1, initNoise, 5, 50, yx_ratio);\n\n //The angular frequency is given by w^2 = gk, so w = 2pi f = sqrt(gk). \n //Bury the constant in g and we get f_k = sqrt(g'k)\n //f_k must be an integer multiple of a fundamental frequency f_0, or the animation won't loop correctly. \n //f_0 is just 1/period, the number of frames in the animation loop.\n\t\n const f_0 = 1 / period; //The fundamental period\n \n //u_1: f_0\n //u_2: 2 * PI * t\n //u_3: y/x ratio\n var noiseAtTime = Compute.buildCustomProgram(fftProgs.gl, `\n\t\tfloat lightX = -.8;\n\t\tfloat lightY = .6;\n float g = 0.002; //Gravitational constant\n \n float kMag = sqrt(k.x * k.x + (k.y * u_3) * (k.y * u_3));\n float f_k = ceil(sqrt(g * kMag) / u_1) * u_1; //See above\n float wkt = u_2 * f_k;\n \n vec2 timeFac = vec2(cos(wkt), sin(wkt));\n \n vec2 h = vec2(a.r * timeFac.r - a.g * timeFac.g, a.r * timeFac.g + a.g * timeFac.r);\n \n //b = i k.l * a\n //k.l = k.x * lightX + k.y * lightY\n vec2 result = vec2(-h.g * (k.x * lightX + k.y * lightY), h.r * (k.x * lightX + k.y * lightY));\n \n //Output real or imaginary part:\n b = vec4(result.r, result.g, 0, 0);\n `\n );\n \n //u_1 sets scaling:\n var chop = Compute.buildCustomProgram(fftProgs.gl, `\n \tfloat maxVal = .1;\t\t\n \tfloat minVal = -.01;\n vec4 scaled = (a * u_1 - vec4(minVal)) / (maxVal - minVal);\n b = clamp(scaled, 0.0, 1.0);\n `\n );\n\n var colorMap = Compute.buildCustomProgram(fftProgs.gl, `\n b = vec4(1.0, 1.0, 1.0, 0.5 * a.x);\n `\n );\n \n var outputTextures = [];\n\n var fftPlan = Compute.makePlan(fftProgs, stages, Compute.FFT_DIRECTIONS.BACKWARD, Math.sqrt(N));\n for(var t = 0; t < period; t++) {\n outputTextures[t] = glUtils.makeTexture(fftProgs.gl, N, N, fftProgs.gl.NEAREST, fftProgs.gl.REPEAT, null);\n var outputBuffer = glUtils.makeFrameBufferTexture(fftProgs.gl, outputTextures[t]);\n \n Compute.runCustomProgram(fftProgs.gl, noiseAtTime, initNoise, buffer1, f_0, 2 * Math.PI * t, yx_ratio);\n \n Compute.computeFft(fftProgs, fftPlan, buffer1, buffer2, buffer3);\n //Output is in buffer 2\n\n Compute.runCustomProgram(fftProgs.gl, chop, buffer2, buffer1, 10);\n \n Compute.runCustomProgram(fftProgs.gl, colorMap, buffer1, outputBuffer);\n }\n \n return {waveTextures: outputTextures};\n}", "function blockMult(a, b, rows, cols) {\n // For small matrices, resort to naive multiplication.\n if (rows <= 512 || cols <= 512) {\n return a.mmul(b); // a is equivalent to this\n } // Apply dynamic padding.\n\n\n if (rows % 2 === 1 && cols % 2 === 1) {\n a = embed(a, rows + 1, cols + 1);\n b = embed(b, rows + 1, cols + 1);\n } else if (rows % 2 === 1) {\n a = embed(a, rows + 1, cols);\n b = embed(b, rows + 1, cols);\n } else if (cols % 2 === 1) {\n a = embed(a, rows, cols + 1);\n b = embed(b, rows, cols + 1);\n }\n\n var halfRows = parseInt(a.rows / 2);\n var halfCols = parseInt(a.columns / 2); // Subdivide input matrices.\n\n var a11 = a.subMatrix(0, halfRows - 1, 0, halfCols - 1);\n var b11 = b.subMatrix(0, halfRows - 1, 0, halfCols - 1);\n var a12 = a.subMatrix(0, halfRows - 1, halfCols, a.columns - 1);\n var b12 = b.subMatrix(0, halfRows - 1, halfCols, b.columns - 1);\n var a21 = a.subMatrix(halfRows, a.rows - 1, 0, halfCols - 1);\n var b21 = b.subMatrix(halfRows, b.rows - 1, 0, halfCols - 1);\n var a22 = a.subMatrix(halfRows, a.rows - 1, halfCols, a.columns - 1);\n var b22 = b.subMatrix(halfRows, b.rows - 1, halfCols, b.columns - 1); // Compute intermediate values.\n\n var m1 = blockMult(Matrix.add(a11, a22), Matrix.add(b11, b22), halfRows, halfCols);\n var m2 = blockMult(Matrix.add(a21, a22), b11, halfRows, halfCols);\n var m3 = blockMult(a11, Matrix.sub(b12, b22), halfRows, halfCols);\n var m4 = blockMult(a22, Matrix.sub(b21, b11), halfRows, halfCols);\n var m5 = blockMult(Matrix.add(a11, a12), b22, halfRows, halfCols);\n var m6 = blockMult(Matrix.sub(a21, a11), Matrix.add(b11, b12), halfRows, halfCols);\n var m7 = blockMult(Matrix.sub(a12, a22), Matrix.add(b21, b22), halfRows, halfCols); // Combine intermediate values into the output.\n\n var c11 = Matrix.add(m1, m4);\n c11.sub(m5);\n c11.add(m7);\n var c12 = Matrix.add(m3, m5);\n var c21 = Matrix.add(m2, m4);\n var c22 = Matrix.sub(m1, m2);\n c22.add(m3);\n c22.add(m6); //Crop output to the desired size (undo dynamic padding).\n\n var resultat = Matrix.zeros(2 * c11.rows, 2 * c11.columns);\n resultat = resultat.setSubMatrix(c11, 0, 0);\n resultat = resultat.setSubMatrix(c12, c11.rows, 0);\n resultat = resultat.setSubMatrix(c21, 0, c11.columns);\n resultat = resultat.setSubMatrix(c22, c11.rows, c11.columns);\n return resultat.subMatrix(0, rows - 1, 0, cols - 1);\n }", "function fft_bin_count(fft_size) { return fft_size / 2; }", "function binaryKernelFunc({ opSnippet, packedOpSnippet, checkOutOfBounds = false, supportsComplex = false, cpuKernelImpl, dtype }) {\n return ({ inputs, backend }) => {\n const { a, b } = inputs;\n const webglBackend = backend;\n if (supportsComplex && a.dtype === 'complex64') {\n const aData = webglBackend.texData.get(a.dataId);\n const bData = webglBackend.texData.get(b.dataId);\n const [real, imag] = [\n [aData.complexTensorInfos.real, bData.complexTensorInfos.real],\n [aData.complexTensorInfos.imag, bData.complexTensorInfos.imag]\n ].map(complexParts => {\n const [aPart, bPart] = complexParts;\n const aHandle = {\n dataId: aPart.dataId,\n dtype: aPart.dtype,\n shape: a.shape\n };\n const bHandle = {\n dataId: bPart.dataId,\n dtype: bPart.dtype,\n shape: b.shape\n };\n const program = new _binaryop_gpu__WEBPACK_IMPORTED_MODULE_1__[\"BinaryOpProgram\"](opSnippet, a.shape, b.shape);\n return webglBackend.runWebGLProgram(program, [aHandle, bHandle], Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"upcastType\"])(aPart.dtype, bPart.dtype));\n });\n const complexOutput = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_3__[\"complex\"])({ inputs: { real, imag }, backend: webglBackend });\n webglBackend.disposeIntermediateTensorInfo(real);\n webglBackend.disposeIntermediateTensorInfo(imag);\n // TODO(annxingyuan): Implement CPU forwarding for complex inputs.\n return complexOutput;\n }\n const $dtype = dtype || Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"upcastType\"])(a.dtype, b.dtype);\n if (webglBackend.shouldExecuteOnCPU([a, b]) && cpuKernelImpl != null) {\n const aData = webglBackend.texData.get(a.dataId);\n const bData = webglBackend.texData.get(b.dataId);\n const [outValues, outShape] = cpuKernelImpl(a.shape, b.shape, aData.values, bData.values, $dtype);\n const out = webglBackend.makeTensorInfo(outShape, $dtype);\n const outData = webglBackend.texData.get(out.dataId);\n outData.values = outValues;\n return out;\n }\n const shouldUsePackedProgram = Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"env\"])().getBool('WEBGL_PACK_BINARY_OPERATIONS') &&\n packedOpSnippet != null;\n let program;\n if (shouldUsePackedProgram) {\n program = new _binaryop_packed_gpu__WEBPACK_IMPORTED_MODULE_2__[\"BinaryOpPackedProgram\"](packedOpSnippet, a.shape, b.shape, checkOutOfBounds);\n }\n else {\n program = new _binaryop_gpu__WEBPACK_IMPORTED_MODULE_1__[\"BinaryOpProgram\"](opSnippet, a.shape, b.shape);\n }\n return webglBackend.runWebGLProgram(program, [a, b], $dtype);\n };\n}", "function workerThreadFn() {\n\n let that = {};\n\n that.n = 1024;\n that.inverse = true;\n\n that.fft = new FFT.complex(that.n, that.inverse);\n\n parentPort.on('message', (payloadIn)=>{\n // let a = msg.bufferInput;\n // console.log(msg);\n\n let chunkCopy = payloadIn.chunk;\n\n const ffttype = 'complex';\n\n const width = 8*2;\n\n // how many uint32's (how many samples) did we get\n const sz = 1024;\n\n\n var dataView = new DataView(chunkCopy);\n\n\n // it's possible that a proxy may be faster here instead of building bufferInput/fftInput\n // https://ponyfoo.com/articles/es6-proxies-in-depth\n \n let bufferInput = new ArrayBuffer(sz*width); // in bytes\n let bufferOutput = new ArrayBuffer(sz*width); // in bytes\n\n // this.w.postMessage(bufferInput,[bufferInput]);\n\n\n let fftInput = new Float64Array(bufferInput);\n let fftOutput = new Float64Array(bufferOutput);\n // let uint8_out_view = new Uint8Array(bufferOutput);\n\n\n // in place modify of the copy\n for(let i = 0; i < sz*2; i+=2) {\n let re = dataView.getFloat64(i*8, true);// * this.gain;\n let im = dataView.getFloat64((i*8)+8, true);// * this.gain;\n // console.log('re: ' + re + ' im: ' + im);\n fftInput[i] = re;\n fftInput[i+1] = im;\n }\n\n that.fft.simple(fftOutput, fftInput, ffttype);\n\n const payloadOut = {id:payloadIn.id, bufferOutput:bufferOutput};\n\n parentPort.postMessage(payloadOut, [payloadOut.bufferOutput]);\n // console.log('finished');\n\n\n });\n}", "function FFTNayuki(n) {\n \n this.n = n;\n this.levels = -1;\n\n for (var i = 0; i < 32; i++) {\n if (1 << i == n) {\n this.levels = i; // Equal to log2(n)\n }\n }\n if (this.levels == -1) {\n throw \"Length is not a power of 2\";\n }\n\n this.cosTable = new Array(n / 2);\n this.sinTable = new Array(n / 2);\n for (var i = 0; i < n / 2; i++) {\n this.cosTable[i] = Math.cos(2 * Math.PI * i / n);\n this.sinTable[i] = Math.sin(2 * Math.PI * i / n);\n }\n\n /* \n * Computes the discrete Fourier transform (DFT) of the given complex vector, storing the result back into the vector.\n * The vector's length must be equal to the size n that was passed to the object constructor, and this must be a power of 2. Uses the Cooley-Tukey decimation-in-time radix-2 algorithm.\n */\n this.forward = function(real, imag) {\n\n var n = this.n;\n \n // Bit-reversed addressing permutation\n for (var i = 0; i < n; i++) {\n var j = reverseBits(i, this.levels);\n if (j > i) {\n var temp = real[i];\n real[i] = real[j];\n real[j] = temp;\n temp = imag[i];\n imag[i] = imag[j];\n imag[j] = temp;\n }\n }\n \n // Cooley-Tukey decimation-in-time radix-2 FFT\n for (var size = 2; size <= n; size *= 2) {\n var halfsize = size / 2;\n var tablestep = n / size;\n for (var i = 0; i < n; i += size) {\n for (var j = i, k = 0; j < i + halfsize; j++, k += tablestep) {\n var tpre = real[j+halfsize] * this.cosTable[k] +\n imag[j+halfsize] * this.sinTable[k];\n var tpim = -real[j+halfsize] * this.sinTable[k] +\n imag[j+halfsize] * this.cosTable[k];\n real[j + halfsize] = real[j] - tpre;\n imag[j + halfsize] = imag[j] - tpim;\n real[j] += tpre;\n imag[j] += tpim;\n }\n }\n }\n \n // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n function reverseBits(x, bits) {\n var y = 0;\n for (var i = 0; i < bits; i++) {\n y = (y << 1) | (x & 1);\n x >>>= 1;\n }\n return y;\n }\n }\n\n /* \n * Computes the inverse discrete Fourier transform (IDFT) of the given complex vector, storing the result back into the vector.\n * The vector's length must be equal to the size n that was passed to the object constructor, and this must be a power of 2. This is a wrapper function. This transform does not perform scaling, so the inverse is not a true inverse.\n */\n this.inverse = function(real, imag) {\n forward(imag, real);\n }\n}", "function Bn(e,t,n){var i=e[0];if(i<=0||i>0)return e;// unoptimized: ! isNaN( firstElem )\n// see http://jacksondunstan.com/articles/983\nvar r=t*n,o=Ln[r];if(void 0===o&&(o=new Float32Array(r),Ln[r]=o),0!==t){i.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}// Texture unit allocation", "function bnModPow(e, m) {\n var i = e.bitLength(), k, r = nbv(1), z;\n if (i <= 0) return r;\n else if (i < 18) k = 1;\n else if (i < 48) k = 3;\n else if (i < 144) k = 4;\n else if (i < 768) k = 5;\n else k = 6;\n if (i < 8)\n z = new Classic(m);\n else if (m.isEven())\n z = new Barrett(m);\n else\n z = new Montgomery(m);\n\n// precomputation\n var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1;\n g[1] = z.convert(this);\n if (k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1], g2);\n while (n <= km) {\n g[n] = nbi();\n z.mulTo(g2, g[n - 2], g[n]);\n n += 2;\n }\n }\n\n var j = e.t - 1, w, is1 = true, r2 = nbi(), t;\n i = nbits(e[j]) - 1;\n while (j >= 0) {\n if (i >= k1) w = (e[j] >> (i - k1)) & km;\n else {\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\n if (j > 0) w |= e[j - 1] >> (this.DB + i - k1);\n }\n\n n = k;\n while ((w & 1) === 0) {\n w >>= 1;\n --n;\n }\n if ((i -= n) < 0) {\n i += this.DB;\n --j;\n }\n if (is1) {\t// ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n }\n else {\n while (n > 1) {\n z.sqrTo(r, r2);\n z.sqrTo(r2, r);\n n -= 2;\n }\n if (n > 0) z.sqrTo(r, r2); else {\n t = r;\n r = r2;\n r2 = t;\n }\n z.mulTo(r2, g[w], r);\n }\n\n while (j >= 0 && (e[j] & (1 << i)) === 0) {\n z.sqrTo(r, r2);\n t = r;\n r = r2;\n r2 = t;\n if (--i < 0) {\n i = this.DB - 1;\n --j;\n }\n }\n }\n return z.revert(r);\n}", "function inner_f(p1, p2) {\n const n = p1.tensor.dim[p1.tensor.ndim - 1];\n if (n !== p2.tensor.dim[0]) {\n defs_1.breakpoint;\n run_1.stop('inner: tensor dimension check');\n }\n const ndim = p1.tensor.ndim + p2.tensor.ndim - 2;\n if (ndim > defs_1.MAXDIM) {\n run_1.stop('inner: rank of result exceeds maximum');\n }\n const a = p1.tensor.elem;\n const b = p2.tensor.elem;\n //---------------------------------------------------------------------\n //\n // ak is the number of rows in tensor A\n //\n // bk is the number of columns in tensor B\n //\n // Example:\n //\n // A[3][3][4] B[4][4][3]\n //\n // 3 3 ak = 3 * 3 = 9\n //\n // 4 3 bk = 4 * 3 = 12\n //\n //---------------------------------------------------------------------\n const ak = p1.tensor.dim\n .slice(0, p1.tensor.dim.length - 1)\n .reduce((a, b) => a * b, 1);\n const bk = p2.tensor.dim.slice(1).reduce((a, b) => a * b, 1);\n const p3 = alloc_1.alloc_tensor(ak * bk);\n const c = p3.tensor.elem;\n // new method copied from ginac http://www.ginac.de/\n for (let i = 0; i < ak; i++) {\n for (let j = 0; j < n; j++) {\n if (is_1.isZeroAtomOrTensor(a[i * n + j])) {\n continue;\n }\n for (let k = 0; k < bk; k++) {\n c[i * bk + k] = add_1.add(multiply_1.multiply(a[i * n + j], b[j * bk + k]), c[i * bk + k]);\n }\n }\n }\n //---------------------------------------------------------------------\n //\n // Note on understanding \"k * bk + j\"\n //\n // k * bk because each element of a column is bk locations apart\n //\n // + j because the beginnings of all columns are in the first bk\n // locations\n //\n // Example: n = 2, bk = 6\n //\n // b111 <- 1st element of 1st column\n // b112 <- 1st element of 2nd column\n // b113 <- 1st element of 3rd column\n // b121 <- 1st element of 4th column\n // b122 <- 1st element of 5th column\n // b123 <- 1st element of 6th column\n //\n // b211 <- 2nd element of 1st column\n // b212 <- 2nd element of 2nd column\n // b213 <- 2nd element of 3rd column\n // b221 <- 2nd element of 4th column\n // b222 <- 2nd element of 5th column\n // b223 <- 2nd element of 6th column\n //\n //---------------------------------------------------------------------\n if (ndim === 0) {\n return p3.tensor.elem[0];\n }\n else {\n p3.tensor.ndim = ndim;\n p3.tensor.dim = [\n ...p1.tensor.dim.slice(0, p1.tensor.ndim - 1),\n ...p2.tensor.dim.slice(1, p2.tensor.ndim),\n ];\n return p3;\n }\n}", "function matrixMultiply(a, b) {\n matrix = [];\n \n matrix[ 0] = a[0 * 4 + 0] * b[0 * 4 + 0] + a[0 * 4 + 1] * b[1 * 4 + 0] + a[0 * 4 + 2] * b[2 * 4 + 0] + a[0 * 4 + 3] * b[3 * 4 + 0];\n matrix[ 1] = a[0 * 4 + 0] * b[0 * 4 + 1] + a[0 * 4 + 1] * b[1 * 4 + 1] + a[0 * 4 + 2] * b[2 * 4 + 1] + a[0 * 4 + 3] * b[3 * 4 + 1];\n matrix[ 2] = a[0 * 4 + 0] * b[0 * 4 + 2] + a[0 * 4 + 1] * b[1 * 4 + 2] + a[0 * 4 + 2] * b[2 * 4 + 2] + a[0 * 4 + 3] * b[3 * 4 + 2];\n matrix[ 3] = a[0 * 4 + 0] * b[0 * 4 + 3] + a[0 * 4 + 1] * b[1 * 4 + 3] + a[0 * 4 + 2] * b[2 * 4 + 3] + a[0 * 4 + 3] * b[3 * 4 + 3];\n matrix[ 4] = a[1 * 4 + 0] * b[0 * 4 + 0] + a[1 * 4 + 1] * b[1 * 4 + 0] + a[1 * 4 + 2] * b[2 * 4 + 0] + a[1 * 4 + 3] * b[3 * 4 + 0];\n matrix[ 5] = a[1 * 4 + 0] * b[0 * 4 + 1] + a[1 * 4 + 1] * b[1 * 4 + 1] + a[1 * 4 + 2] * b[2 * 4 + 1] + a[1 * 4 + 3] * b[3 * 4 + 1];\n matrix[ 6] = a[1 * 4 + 0] * b[0 * 4 + 2] + a[1 * 4 + 1] * b[1 * 4 + 2] + a[1 * 4 + 2] * b[2 * 4 + 2] + a[1 * 4 + 3] * b[3 * 4 + 2];\n matrix[ 7] = a[1 * 4 + 0] * b[0 * 4 + 3] + a[1 * 4 + 1] * b[1 * 4 + 3] + a[1 * 4 + 2] * b[2 * 4 + 3] + a[1 * 4 + 3] * b[3 * 4 + 3];\n matrix[ 8] = a[2 * 4 + 0] * b[0 * 4 + 0] + a[2 * 4 + 1] * b[1 * 4 + 0] + a[2 * 4 + 2] * b[2 * 4 + 0] + a[2 * 4 + 3] * b[3 * 4 + 0];\n matrix[ 9] = a[2 * 4 + 0] * b[0 * 4 + 1] + a[2 * 4 + 1] * b[1 * 4 + 1] + a[2 * 4 + 2] * b[2 * 4 + 1] + a[2 * 4 + 3] * b[3 * 4 + 1];\n matrix[10] = a[2 * 4 + 0] * b[0 * 4 + 2] + a[2 * 4 + 1] * b[1 * 4 + 2] + a[2 * 4 + 2] * b[2 * 4 + 2] + a[2 * 4 + 3] * b[3 * 4 + 2];\n matrix[11] = a[2 * 4 + 0] * b[0 * 4 + 3] + a[2 * 4 + 1] * b[1 * 4 + 3] + a[2 * 4 + 2] * b[2 * 4 + 3] + a[2 * 4 + 3] * b[3 * 4 + 3];\n matrix[12] = a[3 * 4 + 0] * b[0 * 4 + 0] + a[3 * 4 + 1] * b[1 * 4 + 0] + a[3 * 4 + 2] * b[2 * 4 + 0] + a[3 * 4 + 3] * b[3 * 4 + 0];\n matrix[13] = a[3 * 4 + 0] * b[0 * 4 + 1] + a[3 * 4 + 1] * b[1 * 4 + 1] + a[3 * 4 + 2] * b[2 * 4 + 1] + a[3 * 4 + 3] * b[3 * 4 + 1];\n matrix[14] = a[3 * 4 + 0] * b[0 * 4 + 2] + a[3 * 4 + 1] * b[1 * 4 + 2] + a[3 * 4 + 2] * b[2 * 4 + 2] + a[3 * 4 + 3] * b[3 * 4 + 2];\n matrix[15] = a[3 * 4 + 0] * b[0 * 4 + 3] + a[3 * 4 + 1] * b[1 * 4 + 3] + a[3 * 4 + 2] * b[2 * 4 + 3] + a[3 * 4 + 3] * b[3 * 4 + 3];\n return matrix;\n}", "function createComplexBinaryKernelImpl(op) {\n return (aShape, bShape, aRealVals, aImagVals, bRealVals, bImagVals) => {\n const resultShape = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].assertAndGetBroadcastShape(aShape, bShape);\n const resultSize = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].sizeFromShape(resultShape);\n const resultRank = resultShape.length;\n const resultStrides = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].computeStrides(resultShape);\n const resultRealVals = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].getTypedArrayFromDType('float32', resultSize);\n const resultImagVals = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].getTypedArrayFromDType('float32', resultSize);\n const aBroadcastDims = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].getBroadcastDims(aShape, resultShape);\n const bBroadcastDims = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].getBroadcastDims(bShape, resultShape);\n const aVals = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].mergeRealAndImagArrays(aRealVals, aImagVals);\n const bVals = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].mergeRealAndImagArrays(bRealVals, bImagVals);\n const aRank = aShape.length;\n const aStrides = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].computeStrides(aShape);\n const bRank = bShape.length;\n const bStrides = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].computeStrides(bShape);\n if (aBroadcastDims.length + bBroadcastDims.length === 0) {\n for (let i = 0; i < resultRealVals.length; i++) {\n const aIdx = i % aVals.length;\n const bIdx = i % bVals.length;\n const result = op(aVals[aIdx * 2], aVals[aIdx * 2 + 1], bVals[bIdx * 2], bVals[bIdx * 2 + 1]);\n resultRealVals[i] = result.real;\n resultImagVals[i] = result.imag;\n }\n }\n else {\n for (let i = 0; i < resultRealVals.length; i++) {\n const loc = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].indexToLoc(i, resultRank, resultStrides);\n const aLoc = loc.slice(-aRank);\n aBroadcastDims.forEach(d => aLoc[d] = 0);\n const aIndex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].locToIndex(aLoc, aRank, aStrides);\n const bLoc = loc.slice(-bRank);\n bBroadcastDims.forEach(d => bLoc[d] = 0);\n const bIndex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].locToIndex(bLoc, bRank, bStrides);\n const opResult = op(aVals[aIndex * 2], aVals[aIndex * 2 + 1], bVals[bIndex * 2], bVals[bIndex * 2 + 1]);\n resultRealVals[i] = opResult.real;\n resultImagVals[i] = opResult.imag;\n }\n }\n return [resultRealVals, resultImagVals, resultShape];\n };\n}", "function PowerSpectrum( NumSamples, In, Out)\n{\n var Half = NumSamples / 2;\n var i;\n\n var theta = Math.PI / Half;\n\n var tmpReal = new Float32Array(Half);\n var tmpImag = new Float32Array(Half);\n var RealOut = new Float32Array(Half);\n var ImagOut = new Float32Array(Half);\n\n for (var i = 0; i < Half; i++) {\n tmpReal[i] = In[2 * i];\n tmpImag[i] = In[2 * i + 1];\n }\n\n ACFFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);\n\n var wtemp = (Math.sin(0.5 * theta));\n\n var wpr = -2.0 * wtemp * wtemp;\n var wpi = -1.0 * (Math.sin(theta));\n var wr = 1.0 + wpr;\n var wi = wpi;\n\n var i3;\n\n var h1r, h1i, h2r, h2i, rt, it;\n\n for (var i = 1; i < Half / 2; i++) {\n\n i3 = Half - i;\n\n h1r = 0.5 * (RealOut[i] + RealOut[i3]);\n h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);\n h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);\n h2i = -0.5 * (RealOut[i] - RealOut[i3]);\n\n rt = h1r + wr * h2r - wi * h2i;\n it = h1i + wr * h2i + wi * h2r;\n\n Out[i] = rt * rt + it * it;\n\n rt = h1r - wr * h2r + wi * h2i;\n it = -h1i + wr * h2i + wi * h2r;\n\n Out[i3] = rt * rt + it * it;\n\n wr = (wtemp = wr) * wpr - wi * wpi + wr;\n wi = wi * wpr + wtemp * wpi + wi;\n }\n\n rt = (h1r = RealOut[0]) + ImagOut[0];\n it = h1r - ImagOut[0];\n Out[0] = rt * rt + it * it;\n\n rt = RealOut[Half / 2];\n it = ImagOut[Half / 2];\n Out[Half / 2] = rt * rt + it * it;\n}", "function scryptCore() {\n var XY = [], V = [];\n\n if (typeof B === 'undefined') {\n onmessage = function(event) {\n var data = event.data;\n var N = data[0], r = data[1], p = data[2], B = data[3], i = data[4];\n\n var Bslice = [];\n arraycopy32(B, i * 128 * r, Bslice, 0, 128 * r);\n smix(Bslice, 0, r, N, V, XY);\n\n postMessage([i, Bslice]);\n };\n } else {\n for(var i = 0; i < p; i++) {\n smix(B, i * 128 * r, r, N, V, XY);\n }\n }\n\n function smix(B, Bi, r, N, V, XY) {\n var Xi = 0;\n var Yi = 128 * r;\n var i;\n\n arraycopy32(B, Bi, XY, Xi, Yi);\n\n for (i = 0; i < N; i++) {\n arraycopy32(XY, Xi, V, i * Yi, Yi);\n blockmix_salsa8(XY, Xi, Yi, r);\n }\n\n for (i = 0; i < N; i++) {\n var j = integerify(XY, Xi, r) & (N - 1);\n blockxor(V, j * Yi, XY, Xi, Yi);\n blockmix_salsa8(XY, Xi, Yi, r);\n }\n\n arraycopy32(XY, Xi, B, Bi, Yi);\n }\n\n function blockmix_salsa8(BY, Bi, Yi, r) {\n var X = [];\n var i;\n\n arraycopy32(BY, Bi + (2 * r - 1) * 64, X, 0, 64);\n\n for (i = 0; i < 2 * r; i++) {\n blockxor(BY, i * 64, X, 0, 64);\n salsa20_8(X);\n arraycopy32(X, 0, BY, Yi + (i * 64), 64);\n }\n\n for (i = 0; i < r; i++) {\n arraycopy32(BY, Yi + (i * 2) * 64, BY, Bi + (i * 64), 64);\n }\n\n for (i = 0; i < r; i++) {\n arraycopy32(BY, Yi + (i * 2 + 1) * 64, BY, Bi + (i + r) * 64, 64);\n }\n }\n\n function R(a, b) {\n return (a << b) | (a >>> (32 - b));\n }\n\n function salsa20_8(B) {\n var B32 = new Array(32);\n var x = new Array(32);\n var i;\n\n for (i = 0; i < 16; i++) {\n B32[i] = (B[i * 4 + 0] & 0xff) << 0;\n B32[i] |= (B[i * 4 + 1] & 0xff) << 8;\n B32[i] |= (B[i * 4 + 2] & 0xff) << 16;\n B32[i] |= (B[i * 4 + 3] & 0xff) << 24;\n }\n\n arraycopy(B32, 0, x, 0, 16);\n\n for (i = 8; i > 0; i -= 2) {\n x[ 4] ^= R(x[ 0]+x[12], 7); x[ 8] ^= R(x[ 4]+x[ 0], 9);\n x[12] ^= R(x[ 8]+x[ 4],13); x[ 0] ^= R(x[12]+x[ 8],18);\n x[ 9] ^= R(x[ 5]+x[ 1], 7); x[13] ^= R(x[ 9]+x[ 5], 9);\n x[ 1] ^= R(x[13]+x[ 9],13); x[ 5] ^= R(x[ 1]+x[13],18);\n x[14] ^= R(x[10]+x[ 6], 7); x[ 2] ^= R(x[14]+x[10], 9);\n x[ 6] ^= R(x[ 2]+x[14],13); x[10] ^= R(x[ 6]+x[ 2],18);\n x[ 3] ^= R(x[15]+x[11], 7); x[ 7] ^= R(x[ 3]+x[15], 9);\n x[11] ^= R(x[ 7]+x[ 3],13); x[15] ^= R(x[11]+x[ 7],18);\n x[ 1] ^= R(x[ 0]+x[ 3], 7); x[ 2] ^= R(x[ 1]+x[ 0], 9);\n x[ 3] ^= R(x[ 2]+x[ 1],13); x[ 0] ^= R(x[ 3]+x[ 2],18);\n x[ 6] ^= R(x[ 5]+x[ 4], 7); x[ 7] ^= R(x[ 6]+x[ 5], 9);\n x[ 4] ^= R(x[ 7]+x[ 6],13); x[ 5] ^= R(x[ 4]+x[ 7],18);\n x[11] ^= R(x[10]+x[ 9], 7); x[ 8] ^= R(x[11]+x[10], 9);\n x[ 9] ^= R(x[ 8]+x[11],13); x[10] ^= R(x[ 9]+x[ 8],18);\n x[12] ^= R(x[15]+x[14], 7); x[13] ^= R(x[12]+x[15], 9);\n x[14] ^= R(x[13]+x[12],13); x[15] ^= R(x[14]+x[13],18);\n }\n\n for (i = 0; i < 16; ++i) B32[i] = x[i] + B32[i];\n\n for (i = 0; i < 16; i++) {\n var bi = i * 4;\n B[bi + 0] = (B32[i] >> 0 & 0xff);\n B[bi + 1] = (B32[i] >> 8 & 0xff);\n B[bi + 2] = (B32[i] >> 16 & 0xff);\n B[bi + 3] = (B32[i] >> 24 & 0xff);\n }\n }\n\n function blockxor(S, Si, D, Di, len) {\n var i = len>>6;\n while (i--) {\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];\n }\n }\n\n function integerify(B, bi, r) {\n var n;\n\n bi += (2 * r - 1) * 64;\n\n n = (B[bi + 0] & 0xff) << 0;\n n |= (B[bi + 1] & 0xff) << 8;\n n |= (B[bi + 2] & 0xff) << 16;\n n |= (B[bi + 3] & 0xff) << 24;\n\n return n;\n }\n\n function arraycopy(src, srcPos, dest, destPos, length) {\n while (length-- ){\n dest[destPos++] = src[srcPos++];\n }\n }\n\n function arraycopy32(src, srcPos, dest, destPos, length) {\n var i = length>>5;\n while(i--) {\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];\n }\n }\n }", "function fastFib(n) {\n var bitMap = [], matrix = [[1, 1], [1, 0]], fib = [[1, 0], [0, 1]];\n while (n > 0) {\n bitMap.push(n % 2);\n n >>= 1;\n }\n for (var i = 0; i < bitMap.length; i++) {\n if (bitMap[i] == 1) {\n fib = matrixMult(fib, matrix);\n }\n\t\t matrix = matrixMult(matrix, matrix);\n }\n return fib[0][1];\n}", "function nsquaredmultiply(bignum1,bignum2,size)\n{\n var i,j,k,uv,c;\n var result = zeronum(2*size);\n var maxx = 256*256-1;\n var maxxx = 256*256;\n var debug=0;\n \n for(i=0;i<size;i++)\n if(bignum1[i]!=0)\n break;\n if(i == size)\n return result;\n\n var endi = i-1;\n if(endi < 0)\n endi = 0;\n\t\t\n for(j=0;j<size;j++)\n if(bignum2[j]!=0)\n break;\n if(j == size)\n return result;\n\t\t \n var endj = j-2;\n if(endj < 0)\n endj = 0;\n\n for(i=size-1;i>=endi;i--)\n {\n c = 0;\n k = size+i;\n for(j=size-1;j>=endj;j--,k--)\n {\n uv = result[k] + bignum1[i]*bignum2[j] + c;\n result[k] = uv & maxx;\n c = Math.floor(uv / maxxx);\n }\n result[k] = c;\n }\n return result;\n}", "function Matrixes4_multiply(matrix1, matrix2) {\n var a00 = matrix1[0 * 4 + 0];\n var a01 = matrix1[0 * 4 + 1];\n var a02 = matrix1[0 * 4 + 2];\n var a03 = matrix1[0 * 4 + 3];\n var a10 = matrix1[1 * 4 + 0];\n var a11 = matrix1[1 * 4 + 1];\n var a12 = matrix1[1 * 4 + 2];\n var a13 = matrix1[1 * 4 + 3];\n var a20 = matrix1[2 * 4 + 0];\n var a21 = matrix1[2 * 4 + 1];\n var a22 = matrix1[2 * 4 + 2];\n var a23 = matrix1[2 * 4 + 3];\n var a30 = matrix1[3 * 4 + 0];\n var a31 = matrix1[3 * 4 + 1];\n var a32 = matrix1[3 * 4 + 2];\n var a33 = matrix1[3 * 4 + 3];\n var b00 = matrix2[0 * 4 + 0];\n var b01 = matrix2[0 * 4 + 1];\n var b02 = matrix2[0 * 4 + 2];\n var b03 = matrix2[0 * 4 + 3];\n var b10 = matrix2[1 * 4 + 0];\n var b11 = matrix2[1 * 4 + 1];\n var b12 = matrix2[1 * 4 + 2];\n var b13 = matrix2[1 * 4 + 3];\n var b20 = matrix2[2 * 4 + 0];\n var b21 = matrix2[2 * 4 + 1];\n var b22 = matrix2[2 * 4 + 2];\n var b23 = matrix2[2 * 4 + 3];\n var b30 = matrix2[3 * 4 + 0];\n var b31 = matrix2[3 * 4 + 1];\n var b32 = matrix2[3 * 4 + 2];\n var b33 = matrix2[3 * 4 + 3];\n return [b00 * a00 + b01 * a10 + b02 * a20 + b03 * a30, b00 * a01 + b01 * a11 + b02 * a21 + b03 * a31, b00 * a02 + b01 * a12 + b02 * a22 + b03 * a32, b00 * a03 + b01 * a13 + b02 * a23 + b03 * a33, b10 * a00 + b11 * a10 + b12 * a20 + b13 * a30, b10 * a01 + b11 * a11 + b12 * a21 + b13 * a31, b10 * a02 + b11 * a12 + b12 * a22 + b13 * a32, b10 * a03 + b11 * a13 + b12 * a23 + b13 * a33, b20 * a00 + b21 * a10 + b22 * a20 + b23 * a30, b20 * a01 + b21 * a11 + b22 * a21 + b23 * a31, b20 * a02 + b21 * a12 + b22 * a22 + b23 * a32, b20 * a03 + b21 * a13 + b22 * a23 + b23 * a33, b30 * a00 + b31 * a10 + b32 * a20 + b33 * a30, b30 * a01 + b31 * a11 + b32 * a21 + b33 * a31, b30 * a02 + b31 * a12 + b32 * a22 + b33 * a32, b30 * a03 + b31 * a13 + b32 * a23 + b33 * a33];\n}", "function inverse(matrix) {\n var result = new Array(16);\n var m00 = matrix[0 * 4 + 0];\n var m01 = matrix[0 * 4 + 1];\n var m02 = matrix[0 * 4 + 2];\n var m03 = matrix[0 * 4 + 3];\n var m10 = matrix[1 * 4 + 0];\n var m11 = matrix[1 * 4 + 1];\n var m12 = matrix[1 * 4 + 2];\n var m13 = matrix[1 * 4 + 3];\n var m20 = matrix[2 * 4 + 0];\n var m21 = matrix[2 * 4 + 1];\n var m22 = matrix[2 * 4 + 2];\n var m23 = matrix[2 * 4 + 3];\n var m30 = matrix[3 * 4 + 0];\n var m31 = matrix[3 * 4 + 1];\n var m32 = matrix[3 * 4 + 2];\n var m33 = matrix[3 * 4 + 3];\n var tmp_0 = m22 * m33;\n var tmp_1 = m32 * m23;\n var tmp_2 = m12 * m33;\n var tmp_3 = m32 * m13;\n var tmp_4 = m12 * m23;\n var tmp_5 = m22 * m13;\n var tmp_6 = m02 * m33;\n var tmp_7 = m32 * m03;\n var tmp_8 = m02 * m23;\n var tmp_9 = m22 * m03;\n var tmp_10 = m02 * m13;\n var tmp_11 = m12 * m03;\n var tmp_12 = m20 * m31;\n var tmp_13 = m30 * m21;\n var tmp_14 = m10 * m31;\n var tmp_15 = m30 * m11;\n var tmp_16 = m10 * m21;\n var tmp_17 = m20 * m11;\n var tmp_18 = m00 * m31;\n var tmp_19 = m30 * m01;\n var tmp_20 = m00 * m21;\n var tmp_21 = m20 * m01;\n var tmp_22 = m00 * m11;\n var tmp_23 = m10 * m01;\n var t0 = tmp_0 * m11 + tmp_3 * m21 + tmp_4 * m31 - (tmp_1 * m11 + tmp_2 * m21 + tmp_5 * m31);\n var t1 = tmp_1 * m01 + tmp_6 * m21 + tmp_9 * m31 - (tmp_0 * m01 + tmp_7 * m21 + tmp_8 * m31);\n var t2 = tmp_2 * m01 + tmp_7 * m11 + tmp_10 * m31 - (tmp_3 * m01 + tmp_6 * m11 + tmp_11 * m31);\n var t3 = tmp_5 * m01 + tmp_8 * m11 + tmp_11 * m21 - (tmp_4 * m01 + tmp_9 * m11 + tmp_10 * m21);\n var d = 1.0 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n result[0] = d * t0;\n result[1] = d * t1;\n result[2] = d * t2;\n result[3] = d * t3;\n result[4] = d * (tmp_1 * m10 + tmp_2 * m20 + tmp_5 * m30 - (tmp_0 * m10 + tmp_3 * m20 + tmp_4 * m30));\n result[5] = d * (tmp_0 * m00 + tmp_7 * m20 + tmp_8 * m30 - (tmp_1 * m00 + tmp_6 * m20 + tmp_9 * m30));\n result[6] = d * (tmp_3 * m00 + tmp_6 * m10 + tmp_11 * m30 - (tmp_2 * m00 + tmp_7 * m10 + tmp_10 * m30));\n result[7] = d * (tmp_4 * m00 + tmp_9 * m10 + tmp_10 * m20 - (tmp_5 * m00 + tmp_8 * m10 + tmp_11 * m20));\n result[8] = d * (tmp_12 * m13 + tmp_15 * m23 + tmp_16 * m33 - (tmp_13 * m13 + tmp_14 * m23 + tmp_17 * m33));\n result[9] = d * (tmp_13 * m03 + tmp_18 * m23 + tmp_21 * m33 - (tmp_12 * m03 + tmp_19 * m23 + tmp_20 * m33));\n result[10] = d * (tmp_14 * m03 + tmp_19 * m13 + tmp_22 * m33 - (tmp_15 * m03 + tmp_18 * m13 + tmp_23 * m33));\n result[11] = d * (tmp_17 * m03 + tmp_20 * m13 + tmp_23 * m23 - (tmp_16 * m03 + tmp_21 * m13 + tmp_22 * m23));\n result[12] = d * (tmp_14 * m22 + tmp_17 * m32 + tmp_13 * m12 - (tmp_16 * m32 + tmp_12 * m12 + tmp_15 * m22));\n result[13] = d * (tmp_20 * m32 + tmp_12 * m02 + tmp_19 * m22 - (tmp_18 * m22 + tmp_21 * m32 + tmp_13 * m02));\n result[14] = d * (tmp_18 * m12 + tmp_23 * m32 + tmp_15 * m02 - (tmp_22 * m32 + tmp_14 * m02 + tmp_19 * m12));\n result[15] = d * (tmp_22 * m22 + tmp_16 * m02 + tmp_21 * m12 - (tmp_20 * m12 + tmp_23 * m22 + tmp_17 * m02));\n return result;\n}", "function FFTM(x,y){this.x=x;this.y=y;}", "function FFTM(x,y){this.x=x;this.y=y;}", "_read(sz){\n // console.log('sz ' + sz);\n // console.log('pushing');\n \n let ret = true;\n while(ret && this.count > 0) {\n\n\n let j = mt.complex(0,1);\n for(let i = 0; i < this.chunk; i++) {\n // console.log('' + this.factor + ' - ' + this.phase);\n let res = mt.exp(mt.multiply(j,this.phase));\n this.phase += this.factor;\n // cdata.push(res);\n\n\n this.float64_view[2*i] = res.re;\n this.float64_view[(2*i)+1] = res.im;\n\n // this.float64_view[2*i] = this.debug_count++;\n // this.float64_view[(2*i)+1] = 0;\n\n // combdata.push(res.re);\n // combdata.push(res.im);\n // data.push(Math.random()*100);\n }\n\n\n // seems like we need to copy the buffer here\n // because the code above uses the same buffer over and over for this class\n // if we allocated a new buffer above we could remove the slice here\n ret = this.push(this.uint8_view.slice(0));\n this.count--;\n\n\n }\n }", "function F() {\n\n // a while loop is smaller than a for loop\n i = 50000;\n while (i--) {\n\n // pick a function randomly\n // ~~ is the same as Math.floor (and faster)\n g = m[4][~~(M.random()*m[4].length)];\n\n // linear equations\n t = g[1] * x + g[2] * y + g[5];\n y = g[3] * x + g[4] * y + g[6];\n // x = t;\n\n // variables for variations\n j = t*t + y*y;\n\n // i tried making these equations part of m, but eval is just\n // sooooo slow that it doesn't work very well. :(\n switch(g[0]) {\n case 0:\n // sinusoidal\n x = M.sin(t);\n y = M.sin(y);\n case 1:\n // spherical\n x = t/j;\n y = y/j;\n }\n\n // scale x and y coordinates to fit in z\n // ~~ is the same as Math.floor (and faster)\n // cache m[3]\n Q = m[3];\n u = ~~((x*w + Q[0])*Q[2]);\n v = ~~((y*h + Q[1])*Q[2]);\n\n // calculate location of pixel in image buffer\n l = u*w + v;\n\n // if not defined, make it 1\n // otherwise add 1\n H[l] = H[l] ? H[l]+1 : 1;\n\n // keep largest hit\n if (H[l] > d)\n d = H[l];\n }\n\n // create image buffer\n z = a.createImageData(w,h);\n Z = z.data;\n\n // prepare image buffer\n i = w*h;\n while (i--) {\n // logarithmic scale\n t = M.log(H[i])/M.log(d);\n\n // cache 4*i\n j=4*i;\n\n // set nicely!\n Z[j] = n(t,0); // red\n Z[j+1] = n(t,1); // green\n Z[j+2] = n(t,2); // blue\n\n // set alpha to full\n Z[j+3] = 255;\n }\n \n // copy buffer to canvas\n a.putImageData(z, 0, 0);\n\n // do it again!\n // (just calling F() here will cause the browser to crash, teehee)\n W.setTimeout(F, 9);\n}", "mul(f, g) {\r\n const f0 = BigInt(f.data[0]);\r\n const f1 = BigInt(f.data[1]);\r\n const f2 = BigInt(f.data[2]);\r\n const f3 = BigInt(f.data[3]);\r\n const f4 = BigInt(f.data[4]);\r\n const f5 = BigInt(f.data[5]);\r\n const f6 = BigInt(f.data[6]);\r\n const f7 = BigInt(f.data[7]);\r\n const f8 = BigInt(f.data[8]);\r\n const f9 = BigInt(f.data[9]);\r\n const f12 = BigInt(2 * f.data[1]);\r\n const f32 = BigInt(2 * f.data[3]);\r\n const f52 = BigInt(2 * f.data[5]);\r\n const f72 = BigInt(2 * f.data[7]);\r\n const f92 = BigInt(2 * f.data[9]);\r\n const g0 = BigInt(g.data[0]);\r\n const g1 = BigInt(g.data[1]);\r\n const g2 = BigInt(g.data[2]);\r\n const g3 = BigInt(g.data[3]);\r\n const g4 = BigInt(g.data[4]);\r\n const g5 = BigInt(g.data[5]);\r\n const g6 = BigInt(g.data[6]);\r\n const g7 = BigInt(g.data[7]);\r\n const g8 = BigInt(g.data[8]);\r\n const g9 = BigInt(g.data[9]);\r\n const g119 = BigInt(19 * g.data[1]); /* 1.4*2^29 */\r\n const g219 = BigInt(19 * g.data[2]); /* 1.4*2^30; still ok */\r\n const g319 = BigInt(19 * g.data[3]);\r\n const g419 = BigInt(19 * g.data[4]);\r\n const g519 = BigInt(19 * g.data[5]);\r\n const g619 = BigInt(19 * g.data[6]);\r\n const g719 = BigInt(19 * g.data[7]);\r\n const g819 = BigInt(19 * g.data[8]);\r\n const g919 = BigInt(19 * g.data[9]);\r\n const h0 = (f0 * g0) + (f12 * g919) + (f2 * g819) + (f32 * g719) +\r\n (f4 * g619) + (f52 * g519) + (f6 * g419) + (f72 * g319) + (f8 * g219) + (f92 * g119);\r\n const h1 = (f0 * g1) + (f1 * g0) + (f2 * g919) + (f3 * g819) + (f4 * g719) +\r\n (f5 * g619) + (f6 * g519) + (f7 * g419) + (f8 * g319) + (f9 * g219);\r\n const h2 = (f0 * g2) + (f12 * g1) + (f2 * g0) + (f32 * g919) + (f4 * g819) +\r\n (f52 * g719) + (f6 * g619) + (f72 * g519) + (f8 * g419) + (f92 * g319);\r\n const h3 = (f0 * g3) + (f1 * g2) + (f2 * g1) + (f3 * g0) + (f4 * g919) +\r\n (f5 * g819) + (f6 * g719) + (f7 * g619) + (f8 * g519) + (f9 * g419);\r\n const h4 = (f0 * g4) + (f12 * g3) + (f2 * g2) + (f32 * g1) + (f4 * g0) +\r\n (f52 * g919) + (f6 * g819) + (f72 * g719) + (f8 * g619) + (f92 * g519);\r\n const h5 = (f0 * g5) + (f1 * g4) + (f2 * g3) + (f3 * g2) + (f4 * g1) +\r\n (f5 * g0) + (f6 * g919) + (f7 * g819) + (f8 * g719) + (f9 * g619);\r\n const h6 = (f0 * g6) + (f12 * g5) + (f2 * g4) + (f32 * g3) + (f4 * g2) +\r\n (f52 * g1) + (f6 * g0) + (f72 * g919) + (f8 * g819) + (f92 * g719);\r\n const h7 = (f0 * g7) + (f1 * g6) + (f2 * g5) + (f3 * g4) + (f4 * g3) +\r\n (f5 * g2) + (f6 * g1) + (f7 * g0) + (f8 * g919) + (f9 * g819);\r\n const h8 = (f0 * g8) + (f12 * g7) + (f2 * g6) + (f32 * g5) + (f4 * g4) +\r\n (f52 * g3) + (f6 * g2) + (f72 * g1) + (f8 * g0) + (f92 * g919);\r\n const h9 = (f0 * g9) + (f1 * g8) + (f2 * g7) + (f3 * g6) + (f4 * g5) +\r\n (f5 * g4) + (f6 * g3) + (f7 * g2) + (f8 * g1) + (f9 * g0);\r\n this.combine(h0, h1, h2, h3, h4, h5, h6, h7, h8, h9);\r\n }", "function bnModPow(e,m){var i=e.bitLength(),k,r=nbv(1),z;if(i<=0)return r;else if(i<18)k=1;else if(i<48)k=3;else if(i<144)k=4;else if(i<768)k=5;else k=6;if(i<8)z=new Classic(m);else if(m.isEven())z=new Barrett(m);else z=new Montgomery(m);// precomputation\n\tvar g=new Array(),n=3,k1=k-1,km=(1<<k)-1;g[1]=z.convert(this);if(k>1){var g2=new BigInteger();z.sqrTo(g[1],g2);while(n<=km){g[n]=new BigInteger();z.mulTo(g2,g[n-2],g[n]);n+=2;}}var j=e.t-1,w,is1=true,r2=new BigInteger(),t;i=nbits(e[j])-1;while(j>=0){if(i>=k1)w=e[j]>>i-k1&km;else{w=(e[j]&(1<<i+1)-1)<<k1-i;if(j>0)w|=e[j-1]>>this.DB+i-k1;}n=k;while((w&1)==0){w>>=1;--n;}if((i-=n)<0){i+=this.DB;--j;}if(is1){// ret == 1, don't bother squaring or multiplying it\n\tg[w].copyTo(r);is1=false;}else{while(n>1){z.sqrTo(r,r2);z.sqrTo(r2,r);n-=2;}if(n>0)z.sqrTo(r,r2);else{t=r;r=r2;r2=t;}z.mulTo(r2,g[w],r);}while(j>=0&&(e[j]&1<<i)==0){z.sqrTo(r,r2);t=r;r=r2;r2=t;if(--i<0){i=this.DB-1;--j;}}}return z.revert(r);}// (public) gcd(this,a) (HAC 14.54)", "function FluidField(canvas) {\r\n\r\n function lin_solve2(x, x0, y, y0, a, c)\r\n {\r\n if (a === 0 && c === 1) {\r\n for (var j=1 ; j <= height; j++) {\r\n var currentRow = j * rowSize;\r\n ++currentRow;\r\n for (var i = 0; i < width; i++) {\r\n x[currentRow] = x0[currentRow];\r\n y[currentRow] = y0[currentRow];\r\n ++currentRow;\r\n }\r\n }\r\n } else {\r\n var invC = 1/c;\r\n for (var k=0 ; k<iterations; k++) {\r\n for (var j=1 ; j <= height; j++) {\r\n var lastRow = (j - 1) * rowSize;\r\n var currentRow = j * rowSize;\r\n var nextRow = (j + 1) * rowSize;\r\n var lastX = x[currentRow];\r\n var lastY = y[currentRow];\r\n ++currentRow;\r\n for (var i = 1; i <= width; i++) {\r\n lastX = x[currentRow] = (x0[currentRow] + a * (lastX + x[currentRow] + x[lastRow] + x[nextRow])) * invC;\r\n lastY = y[currentRow] = (y0[currentRow] + a * (lastY + y[++currentRow] + y[++lastRow] + y[++nextRow])) * invC;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.update = function () {\r\n\tvar a = 0;\r\n lin_solve2(u, u_prev, v, v_prev, a, 1 + 4 * a);\r\n }\r\n\r\n var iterations = 1;\r\n var visc = 0.5;\r\n var dt = 0.1;\r\n var u;\r\n var u_prev;\r\n var v;\r\n var v_prev;\r\n var width;\r\n var height;\r\n var rowSize;\r\n var size;\r\n var displayFunc;\r\n function reset()\r\n {\r\n rowSize = width;\r\n size = (width)*(height);\r\n u = new Array(size);\r\n u_prev = new Array(size);\r\n v = new Array(size);\r\n v_prev = new Array(size);\r\n for (var i = 0; i < size; i++)\r\n u_prev[i] = v_prev[i] = u[i] = v[i] = 0;\r\n }\r\n this.reset = reset;\r\n this.setResolution = function (hRes, wRes)\r\n {\r\n var res = wRes * hRes;\r\n if (res > 0 && res < 1000000 && (wRes != width || hRes != height)) {\r\n width = wRes;\r\n height = hRes;\r\n reset();\r\n return true;\r\n }\r\n return false;\r\n }\r\n this.setResolution(1, 1);\r\n}", "function blake2bFinal (ctx, out) {\n ctx.t += ctx.c // mark last block offset\n\n while (ctx.c < 128) { // fill up with zeros\n ctx.b[ctx.c++] = 0\n }\n blake2bCompress(ctx, true) // final block flag = 1\n\n for (var i = 0; i < ctx.outlen; i++) {\n out[i] = ctx.h[i >> 2] >> (8 * (i & 3))\n }\n return out\n}", "function blake2bFinal (ctx, out) {\n ctx.t += ctx.c // mark last block offset\n\n while (ctx.c < 128) { // fill up with zeros\n ctx.b[ctx.c++] = 0\n }\n blake2bCompress(ctx, true) // final block flag = 1\n\n for (var i = 0; i < ctx.outlen; i++) {\n out[i] = ctx.h[i >> 2] >> (8 * (i & 3))\n }\n return out\n}", "function naiveDft(inreal, inimag, outreal, outimag, inverse) {\n\tconst n = inreal.length;\n\tif (n != inimag.length || n != outreal.length || n != outimag.length)\n\t\tthrow new RangeError(\"Mismatched lengths\");\n\t\n\tconst coef = (inverse ? 2 : -2) * Math.PI;\n\tfor (let k = 0; k < n; k++) { // For each output element\n\t\tlet sumreal = 0;\n\t\tlet sumimag = 0;\n\t\tfor (let t = 0; t < n; t++) { // For each input element\n\t\t\tconst angle = coef * (t * k % n) / n; // This is more accurate than t * k\n\t\t\tsumreal += inreal[t] * Math.cos(angle) - inimag[t] * Math.sin(angle);\n\t\t\tsumimag += inreal[t] * Math.sin(angle) + inimag[t] * Math.cos(angle);\n\t\t}\n\t\toutreal[k] = sumreal;\n\t\toutimag[k] = sumimag;\n\t}\n}", "function blockMult(a, b, rows, cols) {\n // For small matrices, resort to naive multiplication.\n if (rows <= 512 || cols <= 512) {\n return a.mmul(b); // a is equivalent to this\n }\n\n // Apply dynamic padding.\n if (rows % 2 === 1 && cols % 2 === 1) {\n a = embed(a, rows + 1, cols + 1);\n b = embed(b, rows + 1, cols + 1);\n } else if (rows % 2 === 1) {\n a = embed(a, rows + 1, cols);\n b = embed(b, rows + 1, cols);\n } else if (cols % 2 === 1) {\n a = embed(a, rows, cols + 1);\n b = embed(b, rows, cols + 1);\n }\n\n var halfRows = parseInt(a.rows / 2);\n var halfCols = parseInt(a.columns / 2);\n // Subdivide input matrices.\n var a11 = a.subMatrix(0, halfRows - 1, 0, halfCols - 1);\n var b11 = b.subMatrix(0, halfRows - 1, 0, halfCols - 1);\n\n var a12 = a.subMatrix(0, halfRows - 1, halfCols, a.columns - 1);\n var b12 = b.subMatrix(0, halfRows - 1, halfCols, b.columns - 1);\n\n var a21 = a.subMatrix(halfRows, a.rows - 1, 0, halfCols - 1);\n var b21 = b.subMatrix(halfRows, b.rows - 1, 0, halfCols - 1);\n\n var a22 = a.subMatrix(halfRows, a.rows - 1, halfCols, a.columns - 1);\n var b22 = b.subMatrix(halfRows, b.rows - 1, halfCols, b.columns - 1);\n\n // Compute intermediate values.\n var m1 = blockMult(Matrix.add(a11, a22), Matrix.add(b11, b22), halfRows, halfCols);\n var m2 = blockMult(Matrix.add(a21, a22), b11, halfRows, halfCols);\n var m3 = blockMult(a11, Matrix.sub(b12, b22), halfRows, halfCols);\n var m4 = blockMult(a22, Matrix.sub(b21, b11), halfRows, halfCols);\n var m5 = blockMult(Matrix.add(a11, a12), b22, halfRows, halfCols);\n var m6 = blockMult(Matrix.sub(a21, a11), Matrix.add(b11, b12), halfRows, halfCols);\n var m7 = blockMult(Matrix.sub(a12, a22), Matrix.add(b21, b22), halfRows, halfCols);\n\n // Combine intermediate values into the output.\n var c11 = Matrix.add(m1, m4);\n c11.sub(m5);\n c11.add(m7);\n var c12 = Matrix.add(m3, m5);\n var c21 = Matrix.add(m2, m4);\n var c22 = Matrix.sub(m1, m2);\n c22.add(m3);\n c22.add(m6);\n\n //Crop output to the desired size (undo dynamic padding).\n var resultat = Matrix.zeros(2 * c11.rows, 2 * c11.columns);\n resultat = resultat.setSubMatrix(c11, 0, 0);\n resultat = resultat.setSubMatrix(c12, c11.rows, 0);\n resultat = resultat.setSubMatrix(c21, 0, c11.columns);\n resultat = resultat.setSubMatrix(c22, c11.rows, c11.columns);\n return resultat.subMatrix(0, rows - 1, 0, cols - 1);\n }", "function mt(t){var S,I,k,_,e,u=Math.floor,C=new Array(64),A=new Array(64),T=new Array(64),F=new Array(64),y=new Array(65535),w=new Array(65535),Q=new Array(64),v=new Array(64),P=[],O=0,E=7,q=new Array(64),B=new Array(64),D=new Array(64),n=new Array(256),U=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],j=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],R=[0,1,2,3,4,5,6,7,8,9,10,11],M=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],N=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],z=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],L=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var s=1;s<=t[o];s++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function G(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(O|=1<<E),n--,--E<0&&(255==O?(V(255),V(0)):V(O),E=7,O=0)}function V(t){P.push(t)}function Y(t){V(t>>8&255),V(255&t)}function X(t,e,n,r,i){for(var o,s=i[0],a=i[240],h=function(t,e){var n,r,i,o,s,a,h,c,l,u,f=0;for(l=0;l<8;++l){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],s=t[f+4],a=t[f+5],h=t[f+6];var d=n+(c=t[f+7]),p=n-c,g=r+h,m=r-h,y=i+a,w=i-a,v=o+s,b=o-s,x=d+v,S=d-v,I=g+y,k=g-y;t[f]=x+I,t[f+4]=x-I;var _=.707106781*(k+S);t[f+2]=S+_,t[f+6]=S-_;var C=.382683433*((x=b+w)-(k=m+p)),A=.5411961*x+C,T=1.306562965*k+C,F=.707106781*(I=w+m),P=p+F,O=p-F;t[f+5]=O+A,t[f+3]=O-A,t[f+1]=P+T,t[f+7]=P-T,f+=8}for(l=f=0;l<8;++l){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],s=t[f+32],a=t[f+40],h=t[f+48];var E=n+(c=t[f+56]),q=n-c,B=r+h,D=r-h,U=i+a,j=i-a,R=o+s,M=o-s,N=E+R,z=E-R,L=B+U,H=B-U;t[f]=N+L,t[f+32]=N-L;var W=.707106781*(H+z);t[f+16]=z+W,t[f+48]=z-W;var G=.382683433*((N=M+j)-(H=D+q)),V=.5411961*N+G,Y=1.306562965*H+G,X=.707106781*(L=j+D),K=q+X,J=q-X;t[f+40]=J+V,t[f+24]=J-V,t[f+8]=K+Y,t[f+56]=K-Y,f++}for(l=0;l<64;++l)u=t[l]*e[l],Q[l]=0<u?u+.5|0:u-.5|0;return Q}(t,e),c=0;c<64;++c)v[b[c]]=h[c];var l=v[0]-n;n=v[0],0==l?G(r[0]):(G(r[w[o=32767+l]]),G(y[o]));for(var u=63;0<u&&0==v[u];u--);if(0==u)return G(s),n;for(var f,d=1;d<=u;){for(var p=d;0==v[d]&&d<=u;++d);var g=d-p;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)G(a);g&=15}o=32767+v[d],G(i[(g<<4)+w[o]]),G(y[o]),d++}return 63!=u&&G(s),n}function K(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=u((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),C[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var s=u((i[o]*t+50)/100);s<1?s=1:255<s&&(s=255),A[b[o]]=s}for(var a=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],h=0,c=0;c<8;c++)for(var l=0;l<8;l++)T[h]=1/(C[b[h]]*a[c]*a[l]*8),F[h]=1/(A[b[h]]*a[c]*a[l]*8),h++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&K(e),P=new Array,O=0,E=7,Y(65496),Y(65504),Y(16),V(74),V(70),V(73),V(70),V(0),V(1),V(1),V(0),Y(1),Y(1),V(0),V(0),function(){Y(65499),Y(132),V(0);for(var t=0;t<64;t++)V(C[t]);V(1);for(var e=0;e<64;e++)V(A[e])}(),n=t.width,r=t.height,Y(65472),Y(17),V(8),Y(r),Y(n),V(3),V(1),V(17),V(0),V(2),V(17),V(1),V(3),V(17),V(1),function(){Y(65476),Y(418),V(0);for(var t=0;t<16;t++)V(j[t+1]);for(var e=0;e<=11;e++)V(R[e]);V(16);for(var n=0;n<16;n++)V(M[n+1]);for(var r=0;r<=161;r++)V(N[r]);V(1);for(var i=0;i<16;i++)V(z[i+1]);for(var o=0;o<=11;o++)V(L[o]);V(17);for(var s=0;s<16;s++)V(H[s+1]);for(var a=0;a<=161;a++)V(W[a])}(),Y(65498),Y(12),V(3),V(1),V(0),V(2),V(17),V(3),V(17),V(0),V(63),V(0);var i=0,o=0,s=0;O=0,E=7,this.encode.displayName=\"_encode_\";for(var a,h,c,l,u,f,d,p,g,m=t.data,y=t.width,w=t.height,v=4*y,b=0;b<w;){for(a=0;a<v;){for(f=u=v*b+a,d=-1,g=p=0;g<64;g++)f=u+(p=g>>3)*v+(d=4*(7&g)),w<=b+p&&(f-=v*(b+1+p-w)),v<=a+d&&(f-=a+d-v+4),h=m[f++],c=m[f++],l=m[f++],q[g]=(U[h]+U[c+256>>0]+U[l+512>>0]>>16)-128,B[g]=(U[h+768>>0]+U[c+1024>>0]+U[l+1280>>0]>>16)-128,D[g]=(U[h+1280>>0]+U[c+1536>>0]+U[l+1792>>0]>>16)-128;i=X(q,T,i,S,k),o=X(B,F,o,I,_),s=X(D,F,s,I,_),a+=32}b+=8}if(0<=E){var x=[];x[1]=E+1,x[0]=(1<<E+1)-1,G(x)}return Y(65497),new Uint8Array(P)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),S=r(j,R),I=r(z,L),k=r(M,N),_=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)w[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)w[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)U[t]=19595*t,U[t+256>>0]=38470*t,U[t+512>>0]=7471*t+32768,U[t+768>>0]=-11059*t,U[t+1024>>0]=-21709*t,U[t+1280>>0]=32768*t+8421375,U[t+1536>>0]=-27439*t,U[t+1792>>0]=-5329*t}(),K(t),(new Date).getTime()}()}", "function fourierTransformByMatmul(data, size, inverse) {\n const ret = new Float32Array(size * 2);\n // TODO: Use matmul instead once it supports complex64 type.\n for (let r = 0; r < size; r++) {\n let real = 0.0;\n let imag = 0.0;\n for (let c = 0; c < size; c++) {\n const e = backend_util.exponent(r * c, size, inverse);\n const term = backend_util.getComplexWithIndex(data, c);\n real += term.real * e.real - term.imag * e.imag;\n imag += term.real * e.imag + term.imag * e.real;\n }\n if (inverse) {\n real /= size;\n imag /= size;\n }\n backend_util.assignToTypedArray(ret, real, imag, r);\n }\n return ret;\n}", "function bnModPow(e,m) {\n var i = e.bitLength(), k, r = nbv(1), z;\n if(i <= 0) return r;\n else if(i < 18) k = 1;\n else if(i < 48) k = 3;\n else if(i < 144) k = 4;\n else if(i < 768) k = 5;\n else k = 6;\n if(i < 8)\n z = new Classic(m);\n else if(m.isEven())\n z = new Barrett(m);\n else\n z = new Montgomery(m);\n // precomputation\n var g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;\n g[1] = z.convert(this);\n if(k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n }\n var j = e.t-1, w, is1 = true, r2 = nbi(), t;\n i = nbits(e.data[j])-1;\n while(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n }\n else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n while(j >= 0 && (e.data[j]&(1<<i)) == 0) {\n z.sqrTo(r,r2); t = r; r = r2; r2 = t;\n if(--i < 0) { i = this.DB-1; --j; }\n }\n }\n return z.revert(r);\n}", "function c255lsqr8h(a7, a6, a5, a4, a3, a2, a1, a0) {\n var r = [];\n var v;\n r[0] = (v = a0 * a0) & 0xffff;\n r[1] = (v = ((v / 0x10000) | 0) + 2 * a0 * a1) & 0xffff;\n r[2] = (v = ((v / 0x10000) | 0) + 2 * a0 * a2 + a1 * a1) & 0xffff;\n r[3] = (v = ((v / 0x10000) | 0) + 2 * a0 * a3 + 2 * a1 * a2) & 0xffff;\n r[4] = (v = ((v / 0x10000) | 0) + 2 * a0 * a4 + 2 * a1 * a3 + a2 * a2) & 0xffff;\n r[5] = (v = ((v / 0x10000) | 0) + 2 * a0 * a5 + 2 * a1 * a4 + 2 * a2 * a3) & 0xffff;\n r[6] = (v = ((v / 0x10000) | 0) + 2 * a0 * a6 + 2 * a1 * a5 + 2 * a2 * a4 + a3 * a3) & 0xffff;\n r[7] =\n (v = ((v / 0x10000) | 0) + 2 * a0 * a7 + 2 * a1 * a6 + 2 * a2 * a5 + 2 * a3 * a4) & 0xffff;\n r[8] = (v = ((v / 0x10000) | 0) + 2 * a1 * a7 + 2 * a2 * a6 + 2 * a3 * a5 + a4 * a4) & 0xffff;\n r[9] = (v = ((v / 0x10000) | 0) + 2 * a2 * a7 + 2 * a3 * a6 + 2 * a4 * a5) & 0xffff;\n r[10] = (v = ((v / 0x10000) | 0) + 2 * a3 * a7 + 2 * a4 * a6 + a5 * a5) & 0xffff;\n r[11] = (v = ((v / 0x10000) | 0) + 2 * a4 * a7 + 2 * a5 * a6) & 0xffff;\n r[12] = (v = ((v / 0x10000) | 0) + 2 * a5 * a7 + a6 * a6) & 0xffff;\n r[13] = (v = ((v / 0x10000) | 0) + 2 * a6 * a7) & 0xffff;\n r[14] = (v = ((v / 0x10000) | 0) + a7 * a7) & 0xffff;\n r[15] = (v / 0x10000) | 0;\n return r;\n }", "_transform(chunk,encoding,cb) {\n\n const uint8_view = new Uint8Array(chunk, 0, chunk.length);\n var dataView = new DataView(uint8_view.buffer);\n\n let iFloat = Array(this.sz*2);\n let asComplex = Array(this.sz);\n\n\n // for(let i = 0; i < this.sz*2; i+=1) {\n // iFloat[i] = dataView.getFloat64(i*8, true);\n // }\n\n for(let i = 0; i < this.sz*2; i+=2) {\n let re = dataView.getFloat64(i*8, true);\n let im = dataView.getFloat64((i*8)+8, true);\n\n asComplex[i/2] = mt.complex(re,im);\n\n iFloat[i] = re;\n iFloat[i+1] = im;\n\n // if( i < 16 ) {\n // console.log(re);\n // }\n\n }\n\n let iShort = mutil.IFloatToIShortMulti(iFloat);\n\n if( this.onFrameIShort !== null ) {\n this.onFrameIShort(iShort);\n }\n\n // console.log(\"iFloat length \" + iFloat.length);\n // console.log(iFloat.slice(0,16));\n\n // console.log(\"iShort length \" + iShort.length);\n // console.log(iShort.slice(0,16));\n\n\n this.handleDefaultStream(iFloat,iShort,asComplex);\n this.handleFineSync(iFloat,iShort,asComplex);\n this.handleAllSubcarriers(iFloat,iShort,asComplex);\n this.handleDemodData(iFloat,iShort,asComplex);\n\n\n // for(x of iFloat) {\n // console.log(x);\n // }\n\n\n this.uint.frame_track_counter++;\n cb();\n }", "function h$ghcjsbn_sizeof_b(b) {\n if(b.length < 1) return 0;\n var bl = b[0];\n return Math.ceil((bl * 28) / 32);\n}", "function h$ghcjsbn_sizeof_b(b) {\n if(b.length < 1) return 0;\n var bl = b[0];\n return Math.ceil((bl * 28) / 32);\n}", "function h$ghcjsbn_sizeof_b(b) {\n if(b.length < 1) return 0;\n var bl = b[0];\n return Math.ceil((bl * 28) / 32);\n}", "function h$ghcjsbn_sizeof_b(b) {\n if(b.length < 1) return 0;\n var bl = b[0];\n return Math.ceil((bl * 28) / 32);\n}", "function am1(i,x,w,j,c,n){while(--n>=0){var v=x*this[i++]+w[j]+c;c=Math.floor(v/0x4000000);w[j++]=v&0x3ffffff;}return c;}// am2 avoids a big mult-and-extract completely.", "function bnModPow(e,m) {\n var i = e.bitLength(), k, r = nbv(1), z;\n if(i <= 0) return r;\n else if(i < 18) k = 1;\n else if(i < 48) k = 3;\n else if(i < 144) k = 4;\n else if(i < 768) k = 5;\n else k = 6;\n if(i < 8)\n z = new Classic(m);\n else if(m.isEven())\n z = new Barrett(m);\n else\n z = new Montgomery(m);\n\n // precomputation\n var g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;\n g[1] = z.convert(this);\n if(k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1],g2);\n while(n <= km) {\n g[n] = nbi();\n z.mulTo(g2,g[n-2],g[n]);\n n += 2;\n }\n }\n\n var j = e.t-1, w, is1 = true, r2 = nbi(), t;\n i = nbits(e.data[j])-1;\n while(j >= 0) {\n if(i >= k1) w = (e.data[j]>>(i-k1))&km;\n else {\n w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);\n if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);\n }\n\n n = k;\n while((w&1) == 0) { w >>= 1; --n; }\n if((i -= n) < 0) { i += this.DB; --j; }\n if(is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n }\n else {\n while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }\n if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }\n z.mulTo(r2,g[w],r);\n }\n\n while(j >= 0 && (e.data[j]&(1<<i)) == 0) {\n z.sqrTo(r,r2); t = r; r = r2; r2 = t;\n if(--i < 0) { i = this.DB-1; --j; }\n }\n }\n return z.revert(r);\n}", "function mul(a,b) {\n if (b.length == 4) {\n let res = [0, 0, 0, 1];\n for (let i = 0; i < 4; i++) {\n res[i] = a[i] * b[0] + a[i+4] * b[1] + a[i+8] * b[2] + a[i+12] * b[3]\n }\n return res;\n }\n else{\n let res = Array(16);\n res.fill(0);\n for (let i = 0; i < 4; i++) {\n for (let j = 0; j < 4; j++) {\n res[j*4+i] += a[i]*b[j*4] + b[j*4+1]*a[i+4] + b[j*4+2]*a[i+8] + b[j*4+3]*a[i+12];\n }\n }\n return res;\n }\n}", "multiply(matrix4) {\n let a00 = this._matrix[0 * 4 + 0];\n let a01 = this._matrix[0 * 4 + 1];\n let a02 = this._matrix[0 * 4 + 2];\n let a03 = this._matrix[0 * 4 + 3];\n let a10 = this._matrix[1 * 4 + 0];\n let a11 = this._matrix[1 * 4 + 1];\n let a12 = this._matrix[1 * 4 + 2];\n let a13 = this._matrix[1 * 4 + 3];\n let a20 = this._matrix[2 * 4 + 0];\n let a21 = this._matrix[2 * 4 + 1];\n let a22 = this._matrix[2 * 4 + 2];\n let a23 = this._matrix[2 * 4 + 3];\n let a30 = this._matrix[3 * 4 + 0];\n let a31 = this._matrix[3 * 4 + 1];\n let a32 = this._matrix[3 * 4 + 2];\n let a33 = this._matrix[3 * 4 + 3];\n\n let b00 = matrix4[0 * 4 + 0];\n let b01 = matrix4[0 * 4 + 1];\n let b02 = matrix4[0 * 4 + 2];\n let b03 = matrix4[0 * 4 + 3];\n let b10 = matrix4[1 * 4 + 0];\n let b11 = matrix4[1 * 4 + 1];\n let b12 = matrix4[1 * 4 + 2];\n let b13 = matrix4[1 * 4 + 3];\n let b20 = matrix4[2 * 4 + 0];\n let b21 = matrix4[2 * 4 + 1];\n let b22 = matrix4[2 * 4 + 2];\n let b23 = matrix4[2 * 4 + 3];\n let b30 = matrix4[3 * 4 + 0];\n let b31 = matrix4[3 * 4 + 1];\n let b32 = matrix4[3 * 4 + 2];\n let b33 = matrix4[3 * 4 + 3];\n\n this._matrix[0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n this._matrix[1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n this._matrix[2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n this._matrix[3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n this._matrix[4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n this._matrix[5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n this._matrix[6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n this._matrix[7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n this._matrix[8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n this._matrix[9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n this._matrix[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n this._matrix[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n this._matrix[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n this._matrix[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n this._matrix[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n this._matrix[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return this._matrix;\n }", "function matrix(n) {\n\n// USSR\n// Understand\n // reword - given a number, return an evenly-spiraled matrix \n // inputs - integer\n // outputs - arrays of arrays of integers\n // examples - see above\n// Sudo Chop\n // create empty array of arrays of integers 'results'\n let results = []\n for (let i = 0; i < n; i++) {\n results.push([])\n }\n // create a counter variable that starts at one\n let counter = 1\n // create start and end rows and columns\n let startRow = 0\n let startColumn = 0\n let endRow = n - 1\n let endColumn = n - 1\n // if start column <= end column AND start row <= end row\n while (startColumn <= endColumn && startRow <= endRow) {\n // loop from start column to end column for top row of matrix\n for (i = startColumn; i <= endColumn; i++) {\n // assign counter variable at results[start row][i]\n results[startRow][i] = counter\n // increment counter\n counter++\n }\n // increment start row\n startRow++\n // loop from start row to end row for right column of matrix\n for (i = startRow; i <= endRow; i++) {\n // assign counter variable at results[i][end column]\n results[i][endColumn] = counter\n // increment counter\n counter++\n }\n // decrement end column\n endColumn--\n // repeat for bottom row\n for (let i = endColumn; i >= startColumn; i--) {\n results[endRow][i] = counter\n counter++\n }\n endRow--\n // repeat for start column\n for (let i = endRow; i >= startRow; i--) {\n results[i][startColumn] = counter\n counter++\n }\n startColumn++\n }\n return results\n// Solve / Skip\n// Refactor\n\n}", "function blockMult(a, b, rows, cols) {\n // For small matrices, resort to naive multiplication.\n if (rows <= 512 || cols <= 512) {\n return a.mmul(b); // a is equivalent to this\n }\n\n // Apply dynamic padding.\n if (rows % 2 === 1 && cols % 2 === 1) {\n a = embed(a, rows + 1, cols + 1);\n b = embed(b, rows + 1, cols + 1);\n } else if (rows % 2 === 1) {\n a = embed(a, rows + 1, cols);\n b = embed(b, rows + 1, cols);\n } else if (cols % 2 === 1) {\n a = embed(a, rows, cols + 1);\n b = embed(b, rows, cols + 1);\n }\n\n let halfRows = parseInt(a.rows / 2, 10);\n let halfCols = parseInt(a.columns / 2, 10);\n // Subdivide input matrices.\n let a11 = a.subMatrix(0, halfRows - 1, 0, halfCols - 1);\n let b11 = b.subMatrix(0, halfRows - 1, 0, halfCols - 1);\n\n let a12 = a.subMatrix(0, halfRows - 1, halfCols, a.columns - 1);\n let b12 = b.subMatrix(0, halfRows - 1, halfCols, b.columns - 1);\n\n let a21 = a.subMatrix(halfRows, a.rows - 1, 0, halfCols - 1);\n let b21 = b.subMatrix(halfRows, b.rows - 1, 0, halfCols - 1);\n\n let a22 = a.subMatrix(halfRows, a.rows - 1, halfCols, a.columns - 1);\n let b22 = b.subMatrix(halfRows, b.rows - 1, halfCols, b.columns - 1);\n\n // Compute intermediate values.\n let m1 = blockMult(\n AbstractMatrix.add(a11, a22),\n AbstractMatrix.add(b11, b22),\n halfRows,\n halfCols,\n );\n let m2 = blockMult(AbstractMatrix.add(a21, a22), b11, halfRows, halfCols);\n let m3 = blockMult(a11, AbstractMatrix.sub(b12, b22), halfRows, halfCols);\n let m4 = blockMult(a22, AbstractMatrix.sub(b21, b11), halfRows, halfCols);\n let m5 = blockMult(AbstractMatrix.add(a11, a12), b22, halfRows, halfCols);\n let m6 = blockMult(\n AbstractMatrix.sub(a21, a11),\n AbstractMatrix.add(b11, b12),\n halfRows,\n halfCols,\n );\n let m7 = blockMult(\n AbstractMatrix.sub(a12, a22),\n AbstractMatrix.add(b21, b22),\n halfRows,\n halfCols,\n );\n\n // Combine intermediate values into the output.\n let c11 = AbstractMatrix.add(m1, m4);\n c11.sub(m5);\n c11.add(m7);\n let c12 = AbstractMatrix.add(m3, m5);\n let c21 = AbstractMatrix.add(m2, m4);\n let c22 = AbstractMatrix.sub(m1, m2);\n c22.add(m3);\n c22.add(m6);\n\n // Crop output to the desired size (undo dynamic padding).\n let resultat = AbstractMatrix.zeros(2 * c11.rows, 2 * c11.columns);\n resultat = resultat.setSubMatrix(c11, 0, 0);\n resultat = resultat.setSubMatrix(c12, c11.rows, 0);\n resultat = resultat.setSubMatrix(c21, 0, c11.columns);\n resultat = resultat.setSubMatrix(c22, c11.rows, c11.columns);\n return resultat.subMatrix(0, rows - 1, 0, cols - 1);\n }", "function matrix_multiply(ae, be, res){\n var a11 = ae[0][0], a12 = ae[0][1], a13 = ae[0][2], a14 = ae[0][3]\n var a21 = ae[1][0], a22 = ae[1][1], a23 = ae[1][2], a24 = ae[1][3]\n var a31 = ae[2][0], a32 = ae[2][1], a33 = ae[2][2], a34 = ae[2][3]\n var a41 = ae[3][0], a42 = ae[3][1], a43 = ae[3][2], a44 = ae[3][3]\n\n var b11 = be[0][0], b12 = be[0][1], b13 = be[0][2], b14 = be[0][3]\n var b21 = be[1][0], b22 = be[1][1], b23 = be[1][2], b24 = be[1][3]\n var b31 = be[2][0], b32 = be[2][1], b33 = be[2][2], b34 = be[2][3]\n var b41 = be[3][0], b42 = be[3][1], b43 = be[3][2], b44 = be[3][3]\n\n res[0][0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41\n res[0][1] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42\n res[0][2] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43\n res[0][3] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44\n\n res[1][0] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41\n res[1][1] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42\n res[1][2] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43\n res[1][3] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44\n\n res[2][0] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41\n res[2][1] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42\n res[2][2] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43\n res[2][3] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44\n\n res[3][0] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41\n res[3][1] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42\n res[3][2] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43\n res[3][3] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44\n}", "function gen_op_neon_abdl_u64()\n{\n gen_opc_ptr.push({func:op_neon_abdl_u64});\n}", "function dft_direct (re, im) {\n let N = re.length;\n // is this necessary? should be able to do DFT with any N\n //if (N.toString(2) % 10) return; // check that N is a power of 2\n\n // array containing N evenly spaced points around the unit circle\n let W = discrete_circle(N);\n\n // debugger;\n // initialize imaginary values to zero if not provided\n im = im || re.map( a => 0 );\n\n // sum (x * W) over N points (0 to N-1), for all frequencies k in N\n return re.map( (_, k) =>\n re.map( (_, n) => cpx_mult([re[n], im[n]], W[n * k % N]) )\n .reduce( (a, b) => cpx_add(a, b) ));\n}", "function blake2b(input, key, outlen) {\n // preprocess inputs\n outlen = outlen || 64;\n input = normalizeInput(input);\n // do the math\n var ctx = blake2bInit(outlen, key);\n blake2bUpdate(ctx, input);\n return blake2bFinal(ctx);\n}", "function blake2b(input, key, outlen) {\n // preprocess inputs\n outlen = outlen || 64;\n input = normalizeInput(input);\n // do the math\n var ctx = blake2bInit(outlen, key);\n blake2bUpdate(ctx, input);\n return blake2bFinal(ctx);\n}", "function blake2b (input, key, outlen) {\n // preprocess inputs\n outlen = outlen || 64\n input = normalizeInput(input)\n\n // do the math\n var ctx = blake2bInit(outlen, key)\n blake2bUpdate(ctx, input)\n return blake2bFinal(ctx)\n}", "pow22523(z) {\r\n const t0 = new FieldElement();\r\n const t1 = new FieldElement();\r\n const t2 = new FieldElement();\r\n let i;\r\n t0.square(z);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t1.square(t0);\r\n for (i = 1; i < 2; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(z, t1);\r\n t0.mul(t0, t1);\r\n t0.square(t0);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 5; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 10; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(t1, t0);\r\n t2.square(t1);\r\n for (i = 1; i < 20; i++) {\r\n t2.square(t2);\r\n }\r\n t1.mul(t2, t1);\r\n t1.square(t1);\r\n for (i = 1; i < 10; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 50; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(t1, t0);\r\n t2.square(t1);\r\n for (i = 1; i < 100; i++) {\r\n t2.square(t2);\r\n }\r\n t1.mul(t2, t1);\r\n t1.square(t1);\r\n for (i = 1; i < 50; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t0.square(t0);\r\n for (i = 1; i < 2; i++) {\r\n t0.square(t0);\r\n }\r\n this.mul(t0, z);\r\n }", "function GenMipMap2D( src, srcWidth, srcHeight, dstWidth, dstHeight )\n{\n var x,\n y;\n var texelSize = 3;\n\n var dst = new Uint8Array(texelSize * (dstWidth) * (dstHeight) );\n \n for ( y = 0; y < dstHeight; y++ )\n {\n for( x = 0; x < dstWidth; x++ )\n {\n var srcIndex = new Array(4);\n var r = 0,\n g = 0,\n b = 0;\n var sample;\n\n // Compute the offsets for 2x2 grid of pixels in previous\n // image to perform box filter\n srcIndex[0] =\n (((y * 2) * srcWidth) + (x * 2)) * texelSize;\n srcIndex[1] =\n (((y * 2) * srcWidth) + (x * 2 + 1)) * texelSize;\n srcIndex[2] =\n ((((y * 2) + 1) * srcWidth) + (x * 2)) * texelSize;\n srcIndex[3] =\n ((((y * 2) + 1) * srcWidth) + (x * 2 + 1)) * texelSize;\n\n // Sum all pixels\n for ( sample = 0; sample < 4; sample++ )\n {\n r += src[srcIndex[sample]];\n g += src[srcIndex[sample] + 1];\n b += src[srcIndex[sample] + 2];\n }\n\n // Average results\n r /= 4;\n g /= 4;\n b /= 4;\n\n // Store resulting pixels\n dst[ ( y * (dstWidth) + x ) * texelSize ] = r;\n dst[ ( y * (dstWidth) + x ) * texelSize + 1] = g;\n dst[ ( y * (dstWidth) + x ) * texelSize + 2] = b;\n }\n }\n\n return dst;\n}", "function updateFFT() {\n if (analyser == null) return;\n updateAudio(); \n analizerdata = analyser.getFrequencyData();\n for (var p = 0; p < fftSize-fftsizeCute; p++) {\n particles[p].position.y = (bgstartPos.y - 6) +\n (analizerdata[p] / 25)\n\n particlesBase[p].position.y =\n particles[p].position.y - 7.5;\n }\n var freq = analyser.getAverageFrequency();\n var newbloom = (freq / 300);\n if (newbloom > maxBLOOM) newbloom = maxBLOOM;\n //POST.CHANGEBLOON(newbloom);\n LASTBLOON = window.POST.CHANGEBLOON(newbloom);\n ckeckBPM(freq);\n}", "function precompute()\n{\n\tif (LOG2)\n\t{\n\t\treturn;\n\t}\n\n\t[LOG2, EXP2] = gfLog2Tables256(0x1f5);\n\n\t// Since the C-boxes are rather huge, we calculate them here, rather than\n\t// storing them in the JS\n\tCBOX_ENC = new Array(8);\n\tCBOX_DEC = new Array(8);\n\n\tprecomputeCboxes(CBOX_ENC, SBOX_ENC, G);\n\tprecomputeCboxes(CBOX_DEC, SBOX_DEC, G_INV);\n}", "function gen_op_ldub_kernel()\n{\n gen_opc_ptr.push({func:op_ldub_kernel});\n}", "function fDCTQuant(data, fdtbl)\n {\n var d0, d1, d2, d3, d4, d5, d6, d7;\n /* Pass 1: process rows. */\n var dataOff=0;\n var i;\n var I8 = 8;\n var I64 = 64;\n for (i=0; i<I8; ++i)\n {\n d0 = data[dataOff];\n d1 = data[dataOff+1];\n d2 = data[dataOff+2];\n d3 = data[dataOff+3];\n d4 = data[dataOff+4];\n d5 = data[dataOff+5];\n d6 = data[dataOff+6];\n d7 = data[dataOff+7];\n \n var tmp0 = d0 + d7;\n var tmp7 = d0 - d7;\n var tmp1 = d1 + d6;\n var tmp6 = d1 - d6;\n var tmp2 = d2 + d5;\n var tmp5 = d2 - d5;\n var tmp3 = d3 + d4;\n var tmp4 = d3 - d4;\n \n /* Even part */\n var tmp10 = tmp0 + tmp3; /* phase 2 */\n var tmp13 = tmp0 - tmp3;\n var tmp11 = tmp1 + tmp2;\n var tmp12 = tmp1 - tmp2;\n \n data[dataOff] = tmp10 + tmp11; /* phase 3 */\n data[dataOff+4] = tmp10 - tmp11;\n \n var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n data[dataOff+2] = tmp13 + z1; /* phase 5 */\n data[dataOff+6] = tmp13 - z1;\n \n /* Odd part */\n tmp10 = tmp4 + tmp5; /* phase 2 */\n tmp11 = tmp5 + tmp6;\n tmp12 = tmp6 + tmp7;\n \n /* The rotator is modified from fig 4-8 to avoid extra negations. */\n var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n var z3 = tmp11 * 0.707106781; /* c4 */\n \n var z11 = tmp7 + z3; /* phase 5 */\n var z13 = tmp7 - z3;\n \n data[dataOff+5] = z13 + z2; /* phase 6 */\n data[dataOff+3] = z13 - z2;\n data[dataOff+1] = z11 + z4;\n data[dataOff+7] = z11 - z4;\n \n dataOff += 8; /* advance pointer to next row */\n }\n \n /* Pass 2: process columns. */\n dataOff = 0;\n for (i=0; i<I8; ++i)\n {\n d0 = data[dataOff];\n d1 = data[dataOff + 8];\n d2 = data[dataOff + 16];\n d3 = data[dataOff + 24];\n d4 = data[dataOff + 32];\n d5 = data[dataOff + 40];\n d6 = data[dataOff + 48];\n d7 = data[dataOff + 56];\n \n var tmp0p2 = d0 + d7;\n var tmp7p2 = d0 - d7;\n var tmp1p2 = d1 + d6;\n var tmp6p2 = d1 - d6;\n var tmp2p2 = d2 + d5;\n var tmp5p2 = d2 - d5;\n var tmp3p2 = d3 + d4;\n var tmp4p2 = d3 - d4;\n \n /* Even part */\n var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */\n var tmp13p2 = tmp0p2 - tmp3p2;\n var tmp11p2 = tmp1p2 + tmp2p2;\n var tmp12p2 = tmp1p2 - tmp2p2;\n \n data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n data[dataOff+32] = tmp10p2 - tmp11p2;\n \n var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n data[dataOff+48] = tmp13p2 - z1p2;\n \n /* Odd part */\n tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n tmp11p2 = tmp5p2 + tmp6p2;\n tmp12p2 = tmp6p2 + tmp7p2;\n \n /* The rotator is modified from fig 4-8 to avoid extra negations. */\n var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n var z3p2 = tmp11p2 * 0.707106781; /* c4 */\n \n var z11p2 = tmp7p2 + z3p2; /* phase 5 */\n var z13p2 = tmp7p2 - z3p2;\n \n data[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n data[dataOff+24] = z13p2 - z2p2;\n data[dataOff+ 8] = z11p2 + z4p2;\n data[dataOff+56] = z11p2 - z4p2;\n \n dataOff++; /* advance pointer to next column */\n }\n \n // Quantize/descale the coefficients\n var fDCTQuant;\n for (i=0; i<I64; ++i)\n {\n // Apply the quantization and scaling factor & Round to nearest integer\n fDCTQuant = data[i]*fdtbl[i];\n outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n //outputfDCTQuant[i] = fround(fDCTQuant);\n \n }\n return outputfDCTQuant;\n }", "function blake2bUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}", "function blake2bUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}", "function blake2bUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}", "function blake2bUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}", "function blake2bUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}", "function blake2bUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}", "function blake2bUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}", "function blake2bUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}", "function evenFib() {\n let sum = 0;\n let temp = 0;\n let prev = 1;\n let next = 2;\n const MAX = 4000000;\n\n while (next < MAX) {\n if (next % 2 == 0) sum += next;\n temp = next;\n next = prev + next;\n prev = temp;\n }\n return sum;\n}", "function Hermite_class(){var w,p,_=[];this.init=void(w=navigator.hardwareConcurrency||4),this.getCores=function(){return w},this.resample_auto=function(t,a,e,r,h){var i=this.getCores();window.Worker&&1<i?this.resample(t,a,e,r,h):(this.resample_single(t,a,e,!0),null!=h&&h())},this.resize_image=function(t,a,e,r,h){var i=document.getElementById(t),n=document.createElement(\"canvas\");if(n.width=i.width,n.height=i.height,n.getContext(\"2d\").drawImage(i,0,0),null==a&&null==e&&null!=r&&(a=i.width/100*r,e=i.height/100*r),null==e){var o=i.width/a;e=i.height/o}a=Math.round(a),e=Math.round(e);var l=function(){var t=n.toDataURL();i.width=a,i.height=e,i.src=t,n=t=null};null==h||1==h?this.resample(n,a,e,!0,l):(this.resample_single(n,a,e,!0),l())},this.resample=function(t,r,a,e,h){var i=t.width,n=t.height;r=Math.round(r);var o=n/(a=Math.round(a));if(0<_.length)for(var l=0;l<w;l++)null!=_[l]&&(_[l].terminate(),delete _[l]);_=new Array(w);var s=t.getContext(\"2d\"),c=[],g=2*Math.ceil(n/w/2),d=-1;for(l=0;l<w;l++){var u=d+1;if(!(n<=u)){d=u+g-1,d=Math.min(d,n-1);var f;f=Math.min(g,n-u),c[l]={},c[l].source=s.getImageData(0,u,i,g),c[l].target=!0,c[l].start_y=Math.ceil(u/o),c[l].height=f}}!0===e?(t.width=r,t.height=a):s.clearRect(0,0,i,n);var M=0;for(l=0;l<w;l++)if(null!=c[l]){M++;var v=new Worker(p);(_[l]=v).onmessage=function(t){M--;var a=t.data.core;_[a].terminate(),delete _[a];var e=Math.ceil(c[a].height/o);c[a].target=s.createImageData(r,e),c[a].target.data.set(t.data.target),s.putImageData(c[a].target,0,c[a].start_y),M<=0&&null!=h&&h()};var m={width_source:i,height_source:c[l].height,width:r,height:Math.ceil(c[l].height/o),core:l,source:c[l].source.data.buffer};v.postMessage(m,[m.source])}},p=window.URL.createObjectURL(new Blob([\"(\",function(){onmessage=function(t){for(var a=t.data.core,e=t.data.width_source,r=t.data.height_source,h=t.data.width,i=t.data.height,n=e/h,o=r/i,l=Math.ceil(n/2),s=Math.ceil(o/2),c=new Uint8ClampedArray(t.data.source),g=(c.length,h*i*4),d=new ArrayBuffer(g),u=new Uint8ClampedArray(d,0,g),f=0;f<i;f++)for(var M=0;M<h;M++){var v=4*(M+f*h),m=0,w=0,p=0,_=0,y=0,b=0,C=0,I=f*o,D=Math.floor(M*n),R=Math.ceil((M+1)*n),U=Math.floor(f*o),A=Math.ceil((f+1)*o);R=Math.min(R,e),A=Math.min(A,r);for(var x=U;x<A;x++)for(var B=Math.abs(I-x)/s,L=M*n,j=B*B,k=D;k<R;k++){var q=Math.abs(L-k)/l,E=Math.sqrt(j+q*q);if(!(1<=E)){var W=4*(k+x*e);C+=(m=2*E*E*E-3*E*E+1)*c[W+3],p+=m,c[W+3]<255&&(m=m*c[W+3]/250),_+=m*c[W],y+=m*c[W+1],b+=m*c[W+2],w+=m}}u[v]=_/w,u[v+1]=y/w,u[v+2]=b/w,u[v+3]=C/p}postMessage({core:a,target:u},[u.buffer])}}.toString(),\")()\"],{type:\"application/javascript\"})),this.resample_single=function(t,a,e,r){for(var h=t.width,i=t.height,n=h/(a=Math.round(a)),o=i/(e=Math.round(e)),l=Math.ceil(n/2),s=Math.ceil(o/2),c=t.getContext(\"2d\"),g=c.getImageData(0,0,h,i),d=c.createImageData(a,e),u=g.data,f=d.data,M=0;M<e;M++)for(var v=0;v<a;v++){var m=4*(v+M*a),w=0,p=0,_=0,y=0,b=0,C=0,I=0,D=M*o,R=Math.floor(v*n),U=Math.ceil((v+1)*n),A=Math.floor(M*o),x=Math.ceil((M+1)*o);U=Math.min(U,h),x=Math.min(x,i);for(var B=A;B<x;B++)for(var L=Math.abs(D-B)/s,j=v*n,k=L*L,q=R;q<U;q++){var E=Math.abs(j-q)/l,W=Math.sqrt(k+E*E);if(!(1<=W)){var z=4*(q+B*h);I+=(w=2*W*W*W-3*W*W+1)*u[z+3],_+=w,u[z+3]<255&&(w=w*u[z+3]/250),y+=w*u[z],b+=w*u[z+1],C+=w*u[z+2],p+=w}}f[m]=y/p,f[m+1]=b/p,f[m+2]=C/p,f[m+3]=I/_}!0===r?(t.width=a,t.height=e):c.clearRect(0,0,h,i),c.putImageData(d,0,0)}}", "function blake2bUpdate (ctx, input) {\n for (let i = 0; i < input.length; i++) {\n if (ctx.c === 128) {\n // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}", "function gen_op_neon_abdl_s64()\n{\n gen_opc_ptr.push({func:op_neon_abdl_s64});\n}", "function blake2bUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c; // add counters\n blake2bCompress(ctx, false); // compress (not last)\n ctx.c = 0; // counter to zero\n }\n ctx.b[ctx.c++] = input[i];\n }\n}", "function blake2bUpdate(ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c; // add counters\n blake2bCompress(ctx, false); // compress (not last)\n ctx.c = 0; // counter to zero\n }\n ctx.b[ctx.c++] = input[i];\n }\n}", "function blake2bUpdate(ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c; // add counters\n blake2bCompress(ctx, false); // compress (not last)\n ctx.c = 0; // counter to zero\n }\n ctx.b[ctx.c++] = input[i];\n }\n}", "function bnModPow(e, m) {\r\n\t var i = e.bitLength(), k, r = nbv(1), z;\r\n\t if (i <= 0) return r;\r\n\t else if (i < 18) k = 1;\r\n\t else if (i < 48) k = 3;\r\n\t else if (i < 144) k = 4;\r\n\t else if (i < 768) k = 5;\r\n\t else k = 6;\r\n\t if (i < 8)\r\n\t z = new Classic(m);\r\n\t else if (m.isEven())\r\n\t z = new Barrett(m);\r\n\t else\r\n\t z = new Montgomery(m);\r\n\r\n\t// precomputation\r\n\t var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1;\r\n\t g[1] = z.convert(this);\r\n\t if (k > 1) {\r\n\t var g2 = nbi();\r\n\t z.sqrTo(g[1], g2);\r\n\t while (n <= km) {\r\n\t g[n] = nbi();\r\n\t z.mulTo(g2, g[n - 2], g[n]);\r\n\t n += 2;\r\n\t }\r\n\t }\r\n\r\n\t var j = e.t - 1, w, is1 = true, r2 = nbi(), t;\r\n\t i = nbits(e[j]) - 1;\r\n\t while (j >= 0) {\r\n\t if (i >= k1) w = (e[j] >> (i - k1)) & km;\r\n\t else {\r\n\t w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\r\n\t if (j > 0) w |= e[j - 1] >> (this.DB + i - k1);\r\n\t }\r\n\r\n\t n = k;\r\n\t while ((w & 1) === 0) {\r\n\t w >>= 1;\r\n\t --n;\r\n\t }\r\n\t if ((i -= n) < 0) {\r\n\t i += this.DB;\r\n\t --j;\r\n\t }\r\n\t if (is1) {\t// ret == 1, don't bother squaring or multiplying it\r\n\t g[w].copyTo(r);\r\n\t is1 = false;\r\n\t }\r\n\t else {\r\n\t while (n > 1) {\r\n\t z.sqrTo(r, r2);\r\n\t z.sqrTo(r2, r);\r\n\t n -= 2;\r\n\t }\r\n\t if (n > 0) z.sqrTo(r, r2); else {\r\n\t t = r;\r\n\t r = r2;\r\n\t r2 = t;\r\n\t }\r\n\t z.mulTo(r2, g[w], r);\r\n\t }\r\n\r\n\t while (j >= 0 && (e[j] & (1 << i)) === 0) {\r\n\t z.sqrTo(r, r2);\r\n\t t = r;\r\n\t r = r2;\r\n\t r2 = t;\r\n\t if (--i < 0) {\r\n\t i = this.DB - 1;\r\n\t --j;\r\n\t }\r\n\t }\r\n\t }\r\n\t return z.revert(r);\r\n\t}", "function bnModPow(e, m) {\r\n\t var i = e.bitLength(), k, r = nbv(1), z;\r\n\t if (i <= 0) return r;\r\n\t else if (i < 18) k = 1;\r\n\t else if (i < 48) k = 3;\r\n\t else if (i < 144) k = 4;\r\n\t else if (i < 768) k = 5;\r\n\t else k = 6;\r\n\t if (i < 8)\r\n\t z = new Classic(m);\r\n\t else if (m.isEven())\r\n\t z = new Barrett(m);\r\n\t else\r\n\t z = new Montgomery(m);\r\n\r\n\t// precomputation\r\n\t var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1;\r\n\t g[1] = z.convert(this);\r\n\t if (k > 1) {\r\n\t var g2 = nbi();\r\n\t z.sqrTo(g[1], g2);\r\n\t while (n <= km) {\r\n\t g[n] = nbi();\r\n\t z.mulTo(g2, g[n - 2], g[n]);\r\n\t n += 2;\r\n\t }\r\n\t }\r\n\r\n\t var j = e.t - 1, w, is1 = true, r2 = nbi(), t;\r\n\t i = nbits(e[j]) - 1;\r\n\t while (j >= 0) {\r\n\t if (i >= k1) w = (e[j] >> (i - k1)) & km;\r\n\t else {\r\n\t w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\r\n\t if (j > 0) w |= e[j - 1] >> (this.DB + i - k1);\r\n\t }\r\n\r\n\t n = k;\r\n\t while ((w & 1) === 0) {\r\n\t w >>= 1;\r\n\t --n;\r\n\t }\r\n\t if ((i -= n) < 0) {\r\n\t i += this.DB;\r\n\t --j;\r\n\t }\r\n\t if (is1) {\t// ret == 1, don't bother squaring or multiplying it\r\n\t g[w].copyTo(r);\r\n\t is1 = false;\r\n\t }\r\n\t else {\r\n\t while (n > 1) {\r\n\t z.sqrTo(r, r2);\r\n\t z.sqrTo(r2, r);\r\n\t n -= 2;\r\n\t }\r\n\t if (n > 0) z.sqrTo(r, r2); else {\r\n\t t = r;\r\n\t r = r2;\r\n\t r2 = t;\r\n\t }\r\n\t z.mulTo(r2, g[w], r);\r\n\t }\r\n\r\n\t while (j >= 0 && (e[j] & (1 << i)) === 0) {\r\n\t z.sqrTo(r, r2);\r\n\t t = r;\r\n\t r = r2;\r\n\t r2 = t;\r\n\t if (--i < 0) {\r\n\t i = this.DB - 1;\r\n\t --j;\r\n\t }\r\n\t }\r\n\t }\r\n\t return z.revert(r);\r\n\t}" ]
[ "0.5942304", "0.5936024", "0.59129936", "0.5848767", "0.57809544", "0.5753499", "0.5447977", "0.5359145", "0.53209746", "0.5241078", "0.52395254", "0.51725304", "0.51725304", "0.51725304", "0.51725304", "0.51725304", "0.51725304", "0.51725304", "0.51697624", "0.5137108", "0.5105493", "0.50931895", "0.5015351", "0.49906728", "0.49772778", "0.49420607", "0.49296176", "0.49260092", "0.4922072", "0.4896079", "0.4879527", "0.4874574", "0.4867708", "0.48536614", "0.48466396", "0.48385513", "0.483661", "0.4815187", "0.48149896", "0.48112676", "0.4807155", "0.47970977", "0.47942764", "0.478517", "0.4756964", "0.47561875", "0.47561875", "0.47557107", "0.4744167", "0.47345304", "0.47322935", "0.47274458", "0.47057325", "0.47057325", "0.47018355", "0.46908256", "0.4683715", "0.4683431", "0.4679921", "0.4672436", "0.46689928", "0.46682656", "0.46682656", "0.46682656", "0.46682656", "0.46654806", "0.46647736", "0.46636832", "0.4662306", "0.46541613", "0.46526662", "0.46501395", "0.46492395", "0.46422005", "0.46405804", "0.46405804", "0.46393946", "0.4635981", "0.46306035", "0.46142256", "0.4614062", "0.4598755", "0.4586618", "0.45824265", "0.45824265", "0.45824265", "0.45824265", "0.45824265", "0.45824265", "0.45824265", "0.45824265", "0.45788205", "0.4578795", "0.45780674", "0.45747393", "0.45611373", "0.45578018", "0.45578018", "0.45570162", "0.45570162" ]
0.7380467
0
include('/audit_config/custom_sql_popup/mine_action.js', '/audit_config/js/controller.js'); include('/audit_config/custom_sql_popup/mine_action.js', '/audit_config/ds_info/ds_info.js');
function CustomSQLDo() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function includeJS(incFile)\n{\n document.write('<script type=\"text/javascript\" src=\"' + incFile+ '\"></scr' + 'ipt>');\n}", "function jqGridInclude()\r\n{\r\n var pathtojsfiles = \"js/\"; // need to be ajusted\r\n // set include to false if you do not want some modules to be included\r\n var modules = [\r\n { include: true, incfile:'i18n/grid.locale-en.js'}, // jqGrid translation\r\n { include: true, incfile:'grid.base.js'}, // jqGrid base\r\n { include: true, incfile:'grid.common.js'}, // jqGrid common for editing\r\n { include: true, incfile:'grid.formedit.js'}, // jqGrid Form editing\r\n { include: true, incfile:'grid.inlinedit.js'}, // jqGrid inline editing\r\n { include: true, incfile:'grid.celledit.js'}, // jqGrid cell editing\r\n { include: true, incfile:'grid.subgrid.js'}, //jqGrid subgrid\r\n { include: true, incfile:'grid.treegrid.js'}, //jqGrid treegrid\r\n\t{ include: true, incfile:'grid.grouping.js'}, //jqGrid grouping\r\n { include: true, incfile:'grid.custom.js'}, //jqGrid custom \r\n { include: true, incfile:'grid.tbltogrid.js'}, //jqGrid table to grid \r\n { include: true, incfile:'grid.import.js'}, //jqGrid import\r\n { include: true, incfile:'jquery.fmatter.js'}, //jqGrid formater\r\n { include: true, incfile:'JsonXml.js'}, //xmljson utils\r\n { include: true, incfile:'grid.jqueryui.js'}, //jQuery UI utils\r\n { include: true, incfile:'grid.filter.js'} // filter Plugin\r\n ];\r\n var filename;\r\n for(var i=0;i<modules.length; i++)\r\n {\r\n if(modules[i].include === true) {\r\n \tfilename = pathtojsfiles+modules[i].incfile;\r\n\t\t\tif(jQuery.browser.safari) {\r\n\t\t\t\tjQuery.ajax({url:filename,dataType:'script', async:false, cache: true});\r\n\t\t\t} else {\r\n\t\t\t\tif (jQuery.browser.msie) {\r\n\t\t\t\t\tdocument.write('<script charset=\"utf-8\" type=\"text/javascript\" src=\"'+filename+'\"></script>');\r\n\t\t\t\t} else {\r\n\t\t\t\t\tIncludeJavaScript(filename);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n }\r\n\tfunction IncludeJavaScript(jsFile)\r\n {\r\n var oHead = document.getElementsByTagName('head')[0];\r\n var oScript = document.createElement('script');\r\n oScript.setAttribute('type', 'text/javascript');\r\n oScript.setAttribute('language', 'javascript');\r\n oScript.setAttribute('src', jsFile);\r\n oHead.appendChild(oScript);\r\n }\r\n}", "function include(fileName)\n{ \n\t// On insere une balise script avec le nom du fichier a inclure.\n\tdocument.write(\"<script type='text/javascript' src='\"+fileName+\"'></script>\");\n}", "function includeJS(s) {\n\tfor (i = 0; i < s.length; i++) {\n\t\tvar script = document.createElement(\"script\");\n\t\tscript.type = \"text/javascript\";\n\t\tscript.src = base + s[i];\n\t\tdocument.getElementsByTagName(\"head\")[0].appendChild(script);\n\t}\n}", "function mxinclude(src)\n{\n var g = document.createElement('script'); g.type = 'text/javascript'; g.async = true; g.src = src;\n var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(g, s);\n}", "function include(url){ \n document.write('<script type=\"text/javascript\" src=\"'+ url +'\" ></script>'); \n}", "function include (file) {\r\n\tvar script = document.createElement('script');\r\nscript.src = file;\r\nscript.type = 'text/javascript';\r\nscript.defer = true;\r\n\r\ndocument.getElementsByTagName('head').item(0).appendChild(script);\r\n}", "function $INCLUDE(file)\n{\n load(file);\n// load(\"supporting/\" + file);\n}", "function loadScripts(){\n renderer.setIPC();\n inject.uglifyScripts();\n inject.injectScripts();\n}", "function IncludeJavaScript(jsFile)\n{\n document.write('<script type=\"text/javascript\" src=\"/'\n + jsFile + '\"></scr' + 'ipt>'); \n}", "function _onAllJsIncludesDone() {\n\t\tinitNavigationMode();\n//\t\tSitoolsDesk.loadPreferences(this);\n\n\t\tthis.fireEvent('modulesLoaded');\n\t}", "function includeJavascriptFilesUsedInParentWindow() {\t\n\n function loadScriptSynchronously(src) {\n document.writeln(\"<script type='text/javascript' src='\"+src+\"'></script>\");\n }\n \n function scriptSourcesFromWindow(win) {\n var scripts = win.document.getElementsByTagName('script');\n var sources = [];\n for(var i=0; i<scripts.length; i++) {\n var src = scripts[i].src;\n if(src.length > 0)\n sources.push(src);\n }\n return sources;\n }\n \n var frameScriptSources = scriptSourcesFromWindow(window);\n var parentScriptSources = scriptSourcesFromWindow(window.parent);\n \t\n for(var i=0; i<parentScriptSources.length; i++){\n var src = parentScriptSources[i];\n if(frameScriptSources.indexOf(src) == -1) {\n loadScriptSynchronously(src);\n }\n }\n}", "function include(file) {\n\n var script = document.createElement('script');\n script.src = file;\n script.type = 'text/javascript';\n script.defer = true;\n\n document.getElementsByTagName('head').item(0).appendChild(script);\n\n}", "function inject_script(file) {\r\n var th = document.getElementsByTagName('head')[0];\r\n var s = document.createElement('script');\r\n s.setAttribute('type', 'text/javascript');\r\n s.setAttribute('src', file);\r\n th.appendChild(s);\r\n}", "function loadIncludes(parent){\n //se o parametro for vazio, o parametro recebe o 'body' todo\n if(!parent) parent = 'body'\n //senao, executa o codigo abaixo\n //aqui eu configurei o parent para usar a funcao find(de busca) do jquery\n //para buscar o atributo 'wm-include' dentro do parametro(parent)\n $(parent).find('[wm-include]').each(function(i, e){\n //apos pegar o wm-include(e) da lista de wm-include, eu pego\n //o valor do atributo e referencio na constante url\n const url = $(e).attr('wm-include')\n //chamada da funcao ajax do jquery\n $.ajax({\n url,\n //se a chamada for bem sucedida\n success(data){\n //insiro os dados do arquivo(data) que a url indicou no html do wm-include(e)\n //que esta na pagina index.html\n $(e).html(data)\n //agora excluo o atributo para que nao aja nehuma nova \n //interpretacao dela.\n //se caso eu clicar no botao da pagina e chamar novamente \n //essa funcao o wm-include nao existira e entao nao sera chamada\n //novamente para abrir denovo na pagina, pois ja estara aberta\n $(e).removeAttr('wm-include')\n\n //Quando faco uma chamada ajax ele nao executa arquivos JS da pagina que\n //o ajax esta montando dentro do body. Portanto por exemplo, para que \n // o arquivo cityButtons.js seja executado e para que os botoes sejam inseridos dentro\n //do arquivo galery.html, é preciso que a chamada de criacao dos botoes sejam\n //feitas dentro deste ajax, porque por padrao o ajax nao deixa um outro arquivo JS ser executado\n //pelo arquivo que o ajax esta querendo montar. Por este motivo que esta sendo feito a chamada\n //das funcoes(callback) abaixo.\n\n //Aqui estou passando como parametro os dados(data) pra todas as funcoes(callback)\n //que tem no array 'loadHtmlSuccessCallbacks' e fazendo a chamada delas.\n loadHtmlSuccessCallbacks.forEach(callback => callback(data))\n\n //faco a chamada recursiva, porque pode existir um wm-include dentro\n //dentro deste wm-include(e), entao passo ele como parametro pra funcao\n //para executar esse wm-include que esta dentro do outro\n loadIncludes(e)\n\n }\n })\n })\n}", "function include_js(js_file) {\n\tvar doc_head = document.getElementsByTagName('head').item(0);\n\tvar jsNode = document.createElement('script');\n\tjsNode.setAttribute('language', 'javascript');\n\tjsNode.setAttribute('type', 'text/javascript');\n\tjsNode.setAttribute('src', js_file);\n\tdoc_head.appendChild(jsNode);\n\treturn false;\n}", "function loadJS(js) {\n if (typeof(js) != 'object'){\n\tjs = [js];\n }\n for (var i = 0; i < js.length; i++) {\n appendToHeader('js/'+js[i]+'.js');\n }\n}", "function IncludeJavaScript(jsFile)\n{\n document.write('<script type=\"text/javascript\" src=\"'+ jsFile + '\"></script>');\n}", "static viewJs(formfactor) {\n let src;\n switch(formfactor) {\n case 'phone':\n case 'table':\n src = window.rootpath + 'sample/sample-view-phone.js';\n //src = window.rootpath + 'sample-view-desktop.js';\n break;\n case 'desktop':\n default:\n src = window.rootpath + 'sample/sample-view-desktop.js';\n break;\n }\n return src;\n }", "function injectContent() {\r\n\tvar data = require(\"sdk/self\").data;\r\n\trequire('sdk/page-mod').PageMod({\r\n\t\tinclude: [\"*.gaiamobile.org\"],\r\n\t\tcontentScriptFile: [\r\n\t\t\tdata.url(\"ffos_runtime.js\"),\r\n\t\t\tdata.url(\"hardware.js\"),\r\n\r\n\t\t\tdata.url(\"lib/activity.js\"),\r\n\t\t\tdata.url(\"lib/apps.js\"),\r\n\t\t\tdata.url(\"lib/bluetooth.js\"),\r\n\t\t\tdata.url(\"lib/cameras.js\"),\r\n\t\t\tdata.url(\"lib/idle.js\"),\r\n\t\t\tdata.url(\"lib/keyboard.js\"),\r\n\t\t\tdata.url(\"lib/mobile_connection.js\"),\r\n\t\t\tdata.url(\"lib/power.js\"),\r\n\t\t\tdata.url(\"lib/set_message_handler.js\"),\r\n\t\t\tdata.url(\"lib/settings.js\"),\r\n\t\t\tdata.url(\"lib/wifi.js\")\r\n\t\t],\r\n\t\tcontentScriptWhen: \"start\",\r\n\t\tattachTo: ['existing', 'top', 'frame']\r\n\t})\r\n\r\n\trequire('sdk/page-mod').PageMod({\r\n\t\tinclude: [\"*.homescreen.gaiamobile.org\"],\r\n\t\tcontentScriptFile: [\r\n\t\t\tdata.url(\"apps/homescreen.js\")\r\n\t\t],\r\n\t\tcontentScriptWhen: \"start\",\r\n\t\tattachTo: ['existing', 'top', 'frame']\r\n\t})\r\n\r\n}", "function addScriptBlock(pth,srcs)\r\n{\r\n\tsrcs = srcs.substring(1,srcs.length-1);\r\n\tvar splt =srcs.split(\",\");\r\n\t//alert(splt);\r\n\tfor ( i = 0 ; i < splt.length; i++)\r\n\t{\r\n\t\tvar src = splt[i];\r\n\t\tvar objfl = getElemnt('_jsFile'+src);\r\n\t\tif(!objfl)\r\n\t\t{\r\n\t\t //alert(\"registereing \\n id \" +id + \"\\n src \" + src);\r\n\t\t var oScr = document.createElement(\"script\");\r\n\t\t oScr.id ='_jsFile'+ src;\t\t \r\n\t\t document.getElementsByTagName(\"head\")[0].appendChild(oScr);\r\n\t\t oScr.src = pth+src;\r\n\t\t //alert(oScr.outerHTML);\r\n\t\t}\r\n\t}\r\n}", "function drupalgap_add_js() {\n try {\n var data;\n if (arguments[0]) { data = arguments[0]; }\n jQuery.ajax({\n async: false,\n type: 'GET',\n url: data,\n data: null,\n success: function() {\n if (drupalgap.settings.debug) {\n // Print the js path to the console.\n console.log(data);\n }\n },\n dataType: 'script',\n error: function(xhr, textStatus, errorThrown) {\n console.log(\n 'drupalgap_add_js - error - (' +\n data + ' : ' + textStatus +\n ') ' + errorThrown\n );\n }\n });\n }\n catch (error) {\n console.log('drupalgap_add_js - ' + error);\n }\n}", "function Introducao_elementsExtraJS() {\n // screen (Introducao) extra code\n\n }", "function userscripts()\n{\n //insert code here:\n}", "function PaginaInicial_elementsExtraJS() {\n // screen (PaginaInicial) extra code\n\n }", "function BaixarOrdemInternet_elementsExtraJS() {\n // screen (BaixarOrdemInternet) extra code\n\n }", "function scriptLoader()\n{\n addJavascript(\"phoneticMapper.js\", \"head\");\n addJavascript(\"vedatype.js\", \"head\");\n addJavascript(\"slp01.js\", \"head\"); \n}", "function applyMultiJs () {\n /* Main script loaded on base.html. Here only function is\n called */\n $('#id_client_id').multi({\n \"search_placeholder\":\n \"Search... (if there are no clients, hit CTRL+R to manually refresh the page)\",\n });\n}", "success(data){\n //insiro os dados do arquivo(data) que a url indicou no html do wm-include(e)\n //que esta na pagina index.html\n $(e).html(data)\n //agora excluo o atributo para que nao aja nehuma nova \n //interpretacao dela.\n //se caso eu clicar no botao da pagina e chamar novamente \n //essa funcao o wm-include nao existira e entao nao sera chamada\n //novamente para abrir denovo na pagina, pois ja estara aberta\n $(e).removeAttr('wm-include')\n\n //Quando faco uma chamada ajax ele nao executa arquivos JS da pagina que\n //o ajax esta montando dentro do body. Portanto por exemplo, para que \n // o arquivo cityButtons.js seja executado e para que os botoes sejam inseridos dentro\n //do arquivo galery.html, é preciso que a chamada de criacao dos botoes sejam\n //feitas dentro deste ajax, porque por padrao o ajax nao deixa um outro arquivo JS ser executado\n //pelo arquivo que o ajax esta querendo montar. Por este motivo que esta sendo feito a chamada\n //das funcoes(callback) abaixo.\n\n //Aqui estou passando como parametro os dados(data) pra todas as funcoes(callback)\n //que tem no array 'loadHtmlSuccessCallbacks' e fazendo a chamada delas.\n loadHtmlSuccessCallbacks.forEach(callback => callback(data))\n\n //faco a chamada recursiva, porque pode existir um wm-include dentro\n //dentro deste wm-include(e), entao passo ele como parametro pra funcao\n //para executar esse wm-include que esta dentro do outro\n loadIncludes(e)\n\n }", "function xInclude(url1, url2, etc)\r\n{\r\n if (document.getElementById || document.all || document.layers) { // minimum dhtml support required\r\n var h, f, i, j, a, n, inc;\r\n\r\n for (var i=0; i<arguments.length; ++i) { // loop thru all the url arguments\r\n\r\n h = ''; // html (script or link element) to be written into the document\r\n f = arguments[i].toLowerCase(); // f is current url in lowercase\r\n inc = false; // if true the file has already been included\r\n\r\n // Extract the filename from the url\r\n\r\n // Should I extract the file name? What if there are two files with the same name \r\n // but in different directories? If I don't extract it what about: '../foo.js' and '../../foo.js' ?\r\n\r\n a = f.split('/');\r\n n = a[a.length-1]; // the file name\r\n\r\n // loop thru the list to see if this file has already been included\r\n for (j = 0; j < xIncludeList.length; ++j) {\r\n if (n == xIncludeList[j]) { // should I use '==' or a string cmp func?\r\n inc = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!inc) { // if the file has not yet been included\r\n\r\n xIncludeList[xIncludeList.length] = n; // add it to the list of included files\r\n\r\n // is it a .js file?\r\n if (f.indexOf('.js') != -1) {\r\n // if nn4 use nn4 versions of certain lib files\r\n if (document.layers && !window.opera && navigator.vendor != 'KDE' && !document.all) { // use this instead of the sniffer variable\r\n var c='x_core', e='x_event', d='x_dom', n='_n4';\r\n if (f.indexOf(c) != -1) { f = f.replace(c, c+n); }\r\n else if (f.indexOf(e) != -1) { f = f.replace(e, e+n); }\r\n else if (f.indexOf(d) != -1) { f = f.replace(d, d+n); }\r\n }\r\n h = \"<script type='text/javascript' src='\" + f + \"'></script>\";\r\n }\r\n\r\n // else is it a .css file?\r\n else if (f.indexOf('.css') != -1) { // CSS file\r\n h = \"<link rel='stylesheet' type='text/css' href='\" + f + \"'>\";\r\n } \r\n \r\n // write the link or script element into the document\r\n if (h.length) { document.writeln(h); }\r\n\r\n } // end if (!inc)\r\n } // end outer for\r\n return true;\r\n } // end if (min dhtml support)\r\n return false;\r\n}", "function IntroducaoContra_elementsExtraJS() {\n // screen (IntroducaoContra) extra code\n\n }", "function addScript()\n\t { \n\t var script=document.createElement('script');\n\t script.type='text/javascript';\n\t console.log(\"------------0000000000--------------\", script)\n\t script.src=\"/custom_theme/static/src/js/function_add.js\";\n\t console.log(\"fffffffffff44444444444444444\", script.src) \t \n\t $(\"head\").append(script);\n\t }", "function appendJsFiles( urlJavascript )\n{\n for( i = 0; i < _appendJsFiles.length; i++ ){\n var script = document.createElement( \"script\" );\n script.type = \"text/javascript\";\n script.src = _appendJsFiles[i];\n jisQuery( \"head\" ).append( script );\n }\n}", "function IntroducaoPros_elementsExtraJS() {\n // screen (IntroducaoPros) extra code\n\n }", "function loadSideBarEffectsScripts() {\n $.getScript('/resources/js/plugins/sidebar/classie.js');\n $.getScript('/resources/js/plugins/sidebar/sidebar-effects.js');\n}", "function startScreen_elementsExtraJS() {\n // screen (startScreen) extra code\n }", "function startScreen_elementsExtraJS() {\n // screen (startScreen) extra code\n }", "function startScreen_elementsExtraJS() {\n // screen (startScreen) extra code\n\n }", "function startScreen_elementsExtraJS() {\n // screen (startScreen) extra code\n\n }", "function Screen4_elementsExtraJS() {\n // screen (Screen4) extra code\n\n }", "function loadScripts() {\r\n\t\t\t\twindow._sf_endpt = (new Date()).getTime();\r\n\t\t\t\tvar cbDomain = ((\"https:\"==document.location.protocol)?\"https://a248.e.akamai.net/chartbeat.download.akamai.com/102508/\":\"http://static.chartbeat.com/\");\r\n\t\t\t\tif(loadPubJS) {\r\n\t\t\t\t\t$.getScript(cbDomain+\"js/chartbeat_pub.js\");\r\n\t\t\t\t}\r\n\t\t\t\tif((loadVidJS) || (typeof StrategyInterface !== 'undefined' && (espn && espn.video))) {\r\n\t\t\t\t\t$.getScript(cbDomain+\"js/chartbeat_video.js\");\r\n\t\t\t\t}\r\n\t\t\t\t// load default chartbeat js others are disabled\r\n\t\t\t\tif(!loadVidJS && !loadPubJS) {\r\n\t\t\t\t\t$.getScript(cbDomain+\"js/chartbeat.js\");\r\n\t\t\t\t}\r\n\t\t\t}", "function renderProjectDetailsScripts(){\n //get all scripts in database\n pw.scripts.getAllScripts({\n success: function(data){\n var template = $(\"#tplProjectDetailsScripts\").html(),\n html = Mustache.to_html(template, data),\n sList = $(\"#scriptList-project\");\n //clear the assets list to start\n sList.html(html).trigger('create');\n },\n error : function(error){ //TODO: check to make sure arguments list is correct for this function\n alert(\"there was an error when attempting to retrieve the projects: \", error.code);\n }\n });\n}", "function HeaderDocumentReadyScripts() {\n\n\tif ($.trim(SearchPageUrl).length > 0) {\n\t\tsessionStorage.setItem('SearchPageUrl', SearchPageUrl);\n\t}\n\n\t$(\"body\").find(\"div\").click(function () {\n\t\tif ($(this).hasClass(\"village-cinema-bg\") == false && $(this).hasClass(\"wrapper\") == false) { //#5322 - To Allow click on main div or body.\n\t\t\tisBodyClicked = false;\n\t\t}\n\t});\n\n\tif ($('#LoginTexthWidget').length > 0) {\n\t\t$('#LoginTexthWidget').hover(function () {\n\t\t\treturn false;\n\t\t});\n\n\t\t$('#LoginTexthWidget').click(function () {\n\t\t\treturn false;\n\t\t});\n\n\t}\n\n\tSetPasswordDefaultText();\n\tWidgetStateChange();\n\tWidgetByMovieFilterChange('All');\n\tWidgetByCinemaFilterChange('All');\n\n\tstyleFormElements();\n\n\tEnableDisableControl('ddlByMovieCinemas', true);\n\tEnableDisableControl('ddlByMovieSessions', true);\n\tEnableDisableControl('ddlByCinemaMovies', true);\n\tEnableDisableControl('ddlByCinemaSessions', true);\n\n\t$('#ddlByMovieCinemas').parent().find('span').html('Select cinema');\n\t$('#ddlByMovieSessions').parent().find('span').html('Select session');\n\t$('#ddlByCinemaMovies').parent().find('span').html('Select movie');\n\t$('#ddlByCinemaSessions').parent().find('span').html('Select session');\n\n\t//code for call cinema page on enter press in CinemaMegaMenu \n\t/* fix for defect #643 */\n\t$('#Cinema-Search').bind('keypress', function (e) {\n\t\tvar code = (e.keyCode ? e.keyCode : e.which);\n\t\tif (code == 13) {\n\t\t\t$('#imgCinemaNavFindCinema').trigger('click');\n\t\t\treturn false;\n\t\t}\n\t});\n\n\t$('#QuickTicketsMenu ul.tabs a').click(function () {\n\n\t\tif ($(this).attr('href') == '#CinemaTab') {\n\t\t\tWidgetTab('bycinema');\n\t\t}\n\t\telse {\n\t\t\tWidgetTab('bymovie');\n\t\t}\n\n\t\t$('#txtCurrentWidgetTab').val($(this).attr('href'));\n\n\t});\n\n\t$('#divHeaderForgotPwdContent').html($('#hidForgotPasswordText').val());\n\t$('#divHeaderMailSentContent').html($('#hidMailSentText').val());\n\n}", "function include(file)\n\t{\n\t\tif (window.document.getElementsByTagName)\n\t\t{\n\t\t\tscript = window.document.createElement(\"script\");\n\t\t\tscript.type = \"text/javascript\";\n\t\t\tscript.src = file;\n\t\t\tdocument.documentElement.firstChild.appendChild(script);\n\t\t}\n\t}", "init() {\n this.addAdditionnalScripts();\n }", "function qll_module_ajax()\r\n{\r\n\r\n\taddJS('http://www.erepublik.com/js/jquery-1.3.2.min.js','head');\r\n\taddJS('http://www.erepublik.com/js/jquery.history.plugin.js','head');\r\n\taddJS('http://www.erepublik.com/js/exchange/filters.js','head');\r\n\taddJS('http://www.erepublik.com/js/exchange/historyList.js','head');\r\n\taddJS('http://www.erepublik.com/js/exchange/currency.js','head');\r\n\taddJS('http://www.erepublik.com/js/exchange/listOffers.js','head');\r\n\r\n\taddJS('http://economy.erepublik.com/js/uncompressed.jquery.dd.js','head');\r\n\taddJS('http://economy.erepublik.com/js/jquery.tools.min.js','head');\r\n\taddJS('http://economy.erepublik.com/js/ui.core.js','head');\r\n\taddJS('http://economy.erepublik.com/js/ui.slider.js','head');\r\n\taddJS('http://economy.erepublik.com/js/jquery.blockUI.js','head');\r\n\taddJS('http://economy.erepublik.com/js/Market/marketplace.js','head');\r\n\taddJS('http://economy.erepublik.com/js/numberChecks.js','head');\r\n\taddCSS('http://www.erepublik.com/css/cmp/marketplace.css','head');\r\n\r\n\t//$(\"#content a\").each(function(){\r\n\t$(\"a\").each(function(){\r\n\t\tif($(this).attr(\"href\") == \"#\")\r\n\t\t\treturn;\r\n\t\t$(this).click(function(event){\r\n\t\t\tevent.preventDefault()\r\n\t\t\tqll_module_ajax_perform($(this).attr(\"href\"))\r\n\t\t});\r\n\t\t\r\n\t});\r\n}", "function include(/* string */ file){\n _references.push(HOST_URI+\"/scripts/\"+file);\n}", "function BaixarOrdemTV_elementsExtraJS() {\n // screen (BaixarOrdemTV) extra code\n\n }", "async function loadExtraScripts() {\n}", "function IDEIncludeCommand() {}", "function injectAllScript()\n{\n // add in the lists\n injectScript( chrome.extension.getURL( '/src/lib/lists/gamejournopros.js' ), 'body' );\n injectScript( chrome.extension.getURL( '/src/lib/lists/journolist.js' ), 'body' );\n injectScript( chrome.extension.getURL( '/src/lib/lists/gamechanger-salon.js' ), 'body' );\n injectScript( chrome.extension.getURL( '/src/lib/lists/gawker.js' ), 'body' );\n\n injectScript( chrome.extension.getURL( '/src/lib/inject.js' ), 'body' );\n // site rules\n injectScript( chrome.extension.getURL( '/src/lib/sites.js' ), 'body' );\n}", "function TELUGU_elementsExtraJS() {\n // screen (TELUGU) extra code\n }", "function defineAppCode() {\r\n var strCode=\"\";\r\n if (document.location.hostname.length === 0) {\r\n strCode += '<link rel=\"stylesheet\" href=\"datepicker/datepicker.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"static_files/assets/css/bootstrap-multiselect.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"tablesorter/css/theme.blue.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"static_files/assets/validator/bootstrapValidator.min.css\">'; \r\n strCode += '<link rel=\"stylesheet\" href=\"css/safe.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"css/beaches.css\">';\r\n strCode += '<script type=\"text/javascript\" src=\"static_files/assets/validator/bootstrapValidator.min.js\"></script>'; \r\n strCode += '<script type=\"text/javascript\" src=\"static_files/assets/multiselect/bootstrap-multiselect.js\"></script>'; \r\n strCode += '<script type=\"text/javascript\" src=\"static_files/assets/datepicker/bootstrap-datepicker.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"static_files/assets/datepicker/moment-with-locales.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"/placeholders/placeholders.min.js\"></script>';\r\n\r\n } else { \r\n strCode += '<link rel=\"stylesheet\" href=\"/datepicker/datepicker.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"/static_files/assets/multiselect/bootstrap-multiselect.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"/tablesorter/css/theme.blue.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"/static_files/assets/validator/bootstrapValidator.min.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"/static_files/WebApps/Health/safe/css/safe.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"/static_files/WebApps/Health/SwimSafe/css/beaches.css\">';\r\n strCode += '<script type=\"text/javascript\" src=\"/static_files/assets/validator/bootstrapValidator.min.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"/static_files/assets/multiselect/bootstrap-multiselect.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"/datepicker/bootstrap-datepicker.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"/static_files/assets/datepicker/moment-with-locales.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"/placeholders/placeholders.min.js\"></script>';\r\n }\r\n return strCode;\r\n\r\n}", "function injectJS( link ) {\n\tvar script = document.createElement( 'script' );\n\tscript.type = 'text/javascript';\n\tscript.src = link;\n\tdocument.documentElement.appendChild( script );\n}", "function include(url) {\n\tvar script = $('<script/>', {'src': url, 'type': 'text/javascript'});\n\t$('head').append(script);\n}", "onOpen () {\n // Inject any client scripts\n this.clientScripts.forEach(script => {\n this.page.injectJs(script)\n })\n }", "function setup() {\n console.log(\"I have linked Javascript!\");\n $(\"#intake\").click(handleRespones);\n $('#signup').click(signUp);\n}", "function overridePopulateActions(){\n $(\"#overridePopulateActionsScript\").remove();\n let overridePopulateActionsMenu = `\n<script id=\"overridePopulateActionsScript\">\nfunction PopulateActions( prefix, elActions, rgActions, item, owner )\n{\n\telActions.update('');\n\tif ( !rgActions )\n\t{\n\t\telActions.hide();\n\t\treturn;\n\t}\n\trgActions=rgActions.filter(element => element.id!==\"inbrowser\");\n\t\tlet inspectLink = rgActions[0].link;\n\t\tif(inspectLink.substring(0,20)===\"steam://rungame/730/\"){ //makes sure it's a csgo inspect button\n\t\t rgActions.push({name: \"Inspect in Browser...\", link: \"http://csgo.gallery/\"+inspectLink, id: \"inbrowser\"});\n\t\t}\n\tfor ( var i = 0; i < rgActions.length; i++ )\n\t{\n\t\tvar action = rgActions[i];\n\t\tif ( !action.link || !action.name )\n\t\t\tcontinue;\n \n\t\tvar strLink = action.link.replace( \"%assetid%\", item.assetid );\n\t\tstrLink = strLink.replace( \"%contextid%\", item.contextid );\n\t\tif ( owner )\n\t\t{\n\t\t\tif ( typeof owner == 'string' )\n\t\t\t\tstrLink = strLink.replace( \"%owner_steamid%\", owner );\n\t\t\telse\n\t\t\t\tstrLink = strLink.replace( \"%owner_steamid%\", owner.GetSteamId() );\n\t\t}\n\n\t\t// hack to handle \"grind into goo\" action\n\t\tif ( strLink.match( /^javascript:GetGooValue/ ) )\n\t\t{\n\t\t\tHandleGetGooValueAction( prefix, item, strLink );\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\tlet target = \"_self\"; \n\t\tif(action.id===\"inbrowser\"){\n\t\t target = \"_blank\";\n\t\t}\n\n\t\tvar elAction = new Element(\n\t\t\t'a',\n\t\t\t{\n\t\t\t\t'class': 'btn_small btn_grey_white_innerfade',\n\t\t\t\thref: strLink,\n\t\t\t\ttarget: target\n\t\t\t}\n\t\t);\n\t\tvar elSpan = new Element( 'span' );\n\t\telSpan.update( action.name );\n\t\telAction.appendChild( elSpan );\n\t\telActions.appendChild( elAction );\n\t}\n\telActions.show();\n}\n</script>`;\n\n $(\"body\").append(overridePopulateActionsMenu);\n}", "function addScript() {\n var script = document.createElement(\"script\");\n script.type = \"text/javascript\";\n script.src = \"./project/Work_2DCharacterShading/work-theme.js\";\n document.getElementsByTagName(\"head\")[0].appendChild(script);\n}", "function myImport() {\n\tvar args = Array.prototype.slice.call(arguments);\n var filename = args.shift();\n if (typeof(filename) == typeof(undefined)) {\n return;\n }\n var preImport = function(args){myImport.apply(null, args);};\n var next = function(){preImport(args);};\n var tag = document.createElement('script');\n tag.type = 'text/javascript';\n tag.src = filename;\n tag.onreadystatechange = next;\n tag.onload = next;\n var head = document.getElementsByTagName('head')[0];\n head.appendChild(tag);\n}", "function addJS(where, js) {\r\n var head, jscript;\r\n head = document.getElementsByTagName(where)[0];\r\n if (!head) { return; }\r\n jscript = document.createElement('script');\r\n jscript.type = 'text/javascript';\r\n jscript.innerHTML = js;\r\n head.appendChild(jscript);\r\n}", "function appendJSref() {\n\t\tif(!jsAppended) {\n\t\t\tvar url = urlPrefix + '.scorecardresearch.com/c2/' + config.accountId + '/ct.js';\n\t\t\tvar newScript = document.createElement(\"script\");\n\t\t\tnewScript.type = 'text/javascript';\n\t\t\tnewScript.src = url;\n\t\t\tdocument.body.appendChild(newScript);\n\t\t\tjsAppended = true;\n\t\t}\n\t}", "function dealers_page_elementsExtraJS() {\n // screen (dealers_page) extra code\n\n }", "function logSE() {\n head = document.getElementsByTagName('head')[0];\n script = document.createElement('script');\n script.setAttribute('type', 'text/javascript');\n script.setAttribute('src', '/syntaxError.js');\n head.appendChild(script);\n}", "function ExternalScripts() {\r\n BaseObject.apply(this,arguments);\r\n }", "function include(filename)\n{\n return HtmlService.createHtmlOutputFromFile(filename)\n .getContent();\n}", "function LiveReloadJsHandler() {\n}", "function init() {\n logger.info('init called');\n showAdminDashboard();\n $.app_config_window.init();\n}", "function register_event_handlers()\n {\n \n \n $(document).on(\"click\", \"#sidemenu_button\", function(evt)\n {\n /* Other possible functions are: \n uib_sb.open_sidebar($sb)\n uib_sb.close_sidebar($sb)\n uib_sb.toggle_sidebar($sb)\n uib_sb.close_all_sidebars()\n See js/sidebar.js for the full sidebar API */\n \n uib_sb.toggle_sidebar($(\"#sidemenu\")); \n });\n $(document).on(\"click\", \".uib_w_6\", function(evt)\n {\n activate_subpage(\"#Reports_page\"); \n });\n $(document).on(\"click\", \".uib_w_7\", function(evt)\n {\n activate_subpage(\"#SCRUM_page\"); \n });\n $(document).on(\"click\", \".uib_w_8\", function(evt)\n {\n activate_subpage(\"#APPLICATION_page\"); \n });\n /* listitem LOGIN */\n $(document).on(\"click\", \".uib_w_5\", function(evt)\n {\n activate_subpage(\"#mainsub\"); \n });\n \n /* button LOGIN */\n $(document).on(\"click\", \"#LOGIN\", function(evt)\n {\n activate_subpage(\"#APPLICATION_page\"); \n });\n \n }", "function include(file) {\r\n return HtmlService.createTemplateFromFile(file)\r\n .evaluate()\r\n .getContent();\r\n}", "includeSpoon () {\n console.log('Here is your spoon!');\n }", "function addScript(u){ \n var s=document.createElement('script'); \n s.src=u; \n document.getElementsByTagName('*')[1].appendChild(s);\n }", "function obtenerScriptsConexion() {\n $.getScript(CentralConexionUrl + \"Scripts/SignalrGeneral/Adaptador.js\", function () {\n $.getScript(CentralConexionUrl + \"Scripts/jquery.signalR-2.2.1.js\", function () {\n $.getScript(CentralConexionUrl + \"signalr/hubs\", function () {\n $.getScript(CentralConexionUrl + \"Scripts/SignalrGeneral/ConfiguracionConexion.js\", function () {\n $.getScript(CentralConexionUrl + \"Scripts/SignalrClientes/PormedPacienteSignalr.js\", function () {\n \n });\n });\n });\n });\n });\n}", "function addCode(js){\n var e = document.createElement('script');\n e.type = 'text/javascript';\n e.src = 'data:text/javascript;charset=utf-8,'+escape(js);\n document.body.appendChild(e);\n }", "function Chimera_OnAddOrOnLoad()\n{\n CommonChimera_OnAddOrOnLoad();\n}", "function loadInpage() {\n // check if already initialized - just in case these scripts were loaded multiple times\n var bootstrapper = new _bootstrap_bootstrap__WEBPACK_IMPORTED_MODULE_0__[\"BootstrapInPage\"]();\n bootstrapper.initialize();\n _quick_edit_quick_e__WEBPACK_IMPORTED_MODULE_8__[\"QuickE\"].start();\n /** this enhances the $2sxc client controller with stuff only needed when logged in */\n if (!_interfaces_window_in_page__WEBPACK_IMPORTED_MODULE_6__[\"windowInPage\"].$2sxc.system)\n _interfaces_window_in_page__WEBPACK_IMPORTED_MODULE_6__[\"windowInPage\"].$2sxc.system = new _system__WEBPACK_IMPORTED_MODULE_9__[\"SystemUpgrader\"]();\n /** Connect DNN action mapper to this module instance */\n _interfaces_window_in_page__WEBPACK_IMPORTED_MODULE_6__[\"windowInPage\"].$2sxcActionMenuMapper = function (moduleId) {\n return new _dnn__WEBPACK_IMPORTED_MODULE_3__[\"DnnActionMenu\"](moduleId);\n };\n}", "function loadEvents() {\n prettyPhotoConfiguration();\n setContent();\n}", "function inject_page_script (script_file) { \n\t // script_file lives in the extension \n\t var script = document.createElement('script');\n\t script.setAttribute(\"type\", \"text/javascript\");\n\t script.setAttribute(\"src\", script_file);\n\t document.documentElement.appendChild(script);\n\t console.logv('Injected: ' + script_file);\n\t //document.documentElement.removeChild(script);\n\t}", "function loadjs(file) {\n var script = document.createElement(\"script\");\n script.type = \"application/javascript\";\n script.src = file;\n document.body.appendChild(script);\n }", "function injectData(){\n\n let htmlFP=gitParent+'index.html';\n let html=fs.readFileSync(htmlFP);\n\n let s=html.indexOf('<script');\n let h1=html.slice(0,s);\n let h2=html.slice(s);\n\n if (h2.indexOf('let dates')==-1){}\n else{h2=h2.slice(h2.indexOf('</script>')+9)}\n html=h1+'<script>'+'let dates='+JSON.stringify(dates)+';'+'let topics='+JSON.stringify(topics)+';'+'</script>'+h2;\n\n fs.writeFileSync(htmlFP,html,'utf8');\n gitSync();\n }", "function loadExternalFilerScripst() {\n\t\n\t\t\n\tvar script = document.createElement(\"script\");\n script.src = \"http://test.stickyginger.co.za/tmg-wp-app/filter/jquery.ui.touch-punch.min.js\";\n script.type = \"text/javascript\";\n document.getElementsByTagName(\"body\")[0].appendChild(script);\n\t\n\tvar script = document.createElement(\"script\");\n script.src = \"http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js\";\n script.type = \"text/javascript\";\n document.getElementsByTagName(\"body\")[0].appendChild(script);\n\t\n\tvar script = document.createElement(\"script\");\n script.src = \"http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js\";\n script.type = \"text/javascript\";\n document.getElementsByTagName(\"body\")[0].appendChild(script);\n\t\n\tvar script = document.createElement(\"script\");\n script.src = \"//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js\";\n script.type = \"text/javascript\";\n document.getElementsByTagName(\"body\")[0].appendChild(script);\n\t\n\tvar script = document.createElement(\"script\");\n script.src = \"http://test.stickyginger.co.za/tmg-wp-app/filter/js/jquery.min.js\";\n script.type = \"text/javascript\";\n document.getElementsByTagName(\"body\")[0].appendChild(script);\n\t\n\t var script2 = document.createElement(\"script\");\n // This script has a callback function that will run when the script has\n // finished loading.\n script2.src = \"http://test.stickyginger.co.za/tmg-wp-app/filter/js/fsfilter.js\";\n script2.type = \"text/javascript\";\n document.getElementsByTagName(\"body\")[0].appendChild(script2);\n\t\t\n\t var script2 = document.createElement(\"script\");\n // This script has a callback function that will run when the script has\n // finished loading.\n script2.src = \"http://test.stickyginger.co.za/tmg-wp-app/filter/jqFunctions.js\";\n script2.type = \"text/javascript\";\n document.getElementsByTagName(\"body\")[0].appendChild(script2);\n\t\n\t\n}", "function ConfirmacaoCliente_elementsExtraJS() {\n // screen (ConfirmacaoCliente) extra code\n\n }", "function loadJS(name,data){\n var head= document.getElementsByTagName('head')[0];\n var script= document.createElement('script');\n script.type= 'text/javascript';\n script.onreadystatechange = function() {\n if (!this.readyState || this.readyState === \"loaded\" || this.readyState === \"complete\" ) {\n if(typeof temp_init=='function') temp_init(data);\n// Handle memory leak in IE\n script.onload = script.onreadystatechange = null;\n } };\n\n script.src= '/js/templateScript/'+name+'.js';\n head.appendChild(script);\n}", "function loadJS(jsFiles, pageScript) {\n\n var i;\n for(i = 0; i<jsFiles.length;i++){\n\n var body = document.getElementsByTagName('body')[0];\n var script = document.createElement('script');\n script.type = 'text/javascript';\n script.async = false;\n script.src = jsFiles[i];\n body.appendChild(script);\n }\n\n if (pageScript) {\n var body = document.getElementsByTagName('body')[0];\n var script = document.createElement('script');\n script.type = 'text/javascript';\n script.async = false;\n script.src = pageScript;\n body.appendChild(script);\n }\n\n init();\n}", "function addProjectDetailsScriptMarkup(sid, path){\n var filename = path.replace(/^.*[\\\\\\/]/, '');\n var sList = $(\"#scriptList-project\");\n if(sList){\n var markup = scriptProjectDetailsTemplate.format(sid, filename);\n sList.append(markup);\n }\n sList.trigger('create');\n}", "function additionalSettings(){\n\n\n}", "function noClearedEvent()\n{\n hideLoading(); // hide the \"loading...\" popup\n console.log(\"editIndivid.js: 2138: noClearedEvent: action script 'ClearIndivEvent.php' not found\");\n}", "function processJs(jsFiles) {\n var mergedJs = mergeFiles(jsFiles).join(' ');\n var script = replaceDemoModuleWithCodepenModule(mergedJs);\n return script;\n}", "function BaixarOrdemInternet_TV_elementsExtraJS() {\n // screen (BaixarOrdemInternet_TV) extra code\n\n }", "function $import(path) {\r\n var i, base, src = \"prototype.js\", scripts = document.getElementsByTagName(\"script\");\r\n for (i = 0; i < scripts.length; i++) {\r\n if (scripts[i].src.match(src)) {\r\n base = scripts[i].src.replace(src, \"\");\r\n break;\r\n }\r\n }\r\n document.write(\"<\" + \"script src=\\\"\" + base + path + \"\\\"></\" + \"script>\");\r\n}", "function showRelated(page)\n{\n var removePage = document.getElementById(\"main\");\n $(\"#main\").removeClass(\"showBlock\").addClass(\"showNone\");\n var pageToAppend = document.getElementById(\"sub\");\n pageToAppend.innerHTML = \"<div data-include='\"+page+\"'></div>\";\n $(function(){\n var includes = $('[data-include]');\n jQuery.each(includes, function(){\n var file = $(this).data('include')+'/' + $(this).data('include') + '.html';\n $(this).load(file);\n });\n });\n}", "function fixImportScript(file){//{filename: STRING, src: STRING}\r\n\r\n\tvar fileName = file.filename.replace(__dirname, '').replace(/\\\\/gm, '/');\r\n\tfileName = fileName.replace(/^\\//, '');\r\n\r\n\t//convert importScripts() to require()\r\n\tif(/importScripts\\s*\\(/g.test(file.src)){\r\n\r\n\t\tconsole.log(' detected importScript for '+fileName);\r\n\r\n\t\tif(/^workers\\//i.test(fileName)){\r\n\r\n\t\t\tif(/importScripts\\s*\\(\\s*'/g.test(file.src)){\r\n\t\t\t\tfile.src = file.src.replace(/importScripts\\s*\\(\\s*(')([^']+)(')/g, function(_match, p1, p2, p3){\r\n\t\t\t\t\treturn 'require(' + p1 + 'workers/' + p2.replace(/\\.js$/i, '') + p3;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tif(/importScripts\\s*\\(\\s*\"/g.test(file.src)){\r\n\t\t\t\tfile.src = file.src.replace(/importScripts\\s*\\(\\s*(\")([^\"]+)(\")/g, function(_match, p1, p2, p3){\r\n\t\t\t\t\treturn 'require(' + p1 + 'workers/' + p2.replace(/\\.js$/i, '') + p3;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\tfile.src = wrapAsModule(file.src.replace(/importScripts\\s*\\(/g, 'require('));\r\n\r\n\t}\r\n\r\n //DISABLED: env/media/** are now AMD modules (since mmir v5.x)\r\n\t// if(/env\\/media\\//i.test(fileName)){\r\n //\r\n\t// \t//\"pull-up\" simple require-calls (these seem to to not get detected otherwise)\r\n\t// \tdeps = extractSimpleReqCalls(file.src);\r\n //\r\n\t// \tfile.src = wrapAsModule(file.src);//, deps);\r\n\t// }\r\n\r\n if(/tools\\/util_jquery\\//.test(fileName)){\r\n\r\n var jsUtilName = fileName.replace(/.*tools\\/util_jquery\\//, 'tools/util_purejs/').replace(/\\.js$/i, '');\r\n\r\n console.log(' detected jquery module, adding util_purejs variant as depencency -> ', jsUtilName);\r\n\r\n file.src = injectDeps(file.src, [jsUtilName]);\r\n }\r\n\r\n\t//\"convert\" any non-modules to modules\r\n\t// NOTE: this may fail to detect, if a script is not a module (i.e. if there is any \"define(\" contained, but script itself is not a module)\r\n\tif(!/define\\s*\\(/g.test(file.src)){\r\n\t\tfile.src = wrapAsModule(file.src);\r\n\t}\r\n\r\n\r\n\treturn file;\r\n}", "function loadJS (nameList) {\n var names = nameList.split(',');\n var namesCount = names.length;\n var fileobj = document.createElement('script');\n fileobj.setAttribute('type','text/javascript');\n fileobj.setAttribute('src',names[0]);\n var onLoad = 'loadJS(\"';\n for (var cnt = 1; cnt < namesCount; cnt++) {\n if (cnt > 1) onLoad += ',';\n onLoad += names[cnt];\n }\n onLoad += '\")';\n if (onLoad.length > 10) fileobj.setAttribute('onload',onLoad);\n document.getElementsByTagName('head')[0].appendChild(fileobj);\n}", "function include(file,scriptStack) {\n\tvar script = document.createElement('script');\n\tscript.src = file;\n\tscript.type = 'text/javascript';\n\t\n\tif(scriptStack == 'async' && elemHasAttribute('script','async'))\n\t\tscript.async = true;\n\telse if(scriptStack == 'defer')\n\t\tscript.defer = true;\n\t\t\n\tdocument.getElementsByTagName('head')[0].appendChild(script);\n\tdebuggStack({'msg':'script.js(47): include '+file});\n}", "function staticJSLoad(js) {\n\tvar addJs = document.createElement(\"script\");\n\taddJs.setAttribute(\"type\",\"text/javascript\");\n\taddJs.setAttribute(\"src\",js);\n\tdocument.body.appendChild(addJs);\n}", "function addBehaviours()\r\n{\r\n try \r\n {\r\n xForm = getXForm();\r\n // toolbar sync\r\n jQ(\"button.ice-fm-sync\").unbind().addClass(\"command\").click(function() { \t\r\n var fileManagerView = jQ(\"div.app-file-manager\").size()>0;\r\n if (!fileManagerView) { jQ(\"#ice_toolbar_status\").addClass(\"update\").text(\"Sync\"); }\r\n \r\n function callback(data) {\r\n if (fileManagerView) {\r\n jQ(\"div.app-file-manager\").replaceWith(data);\r\n workingStatusUpdate();\r\n } else {\r\n workingStatusUpdate(refresh);\r\n } \r\n }\r\n xFormAjaxSubmit(\"sync\", \"\", callback);\r\n \r\n });\r\n jQ(\"img.ice-fm-sync\").unbind().addClass(\"command\").click(function() {\r\n function callback(data) {\r\n jQ(\"div.app-file-manager\").replaceWith(data);\r\n workingStatusUpdate();\r\n }\r\n xFormAjaxSubmit(\"syncSelected\", \"\", callback)\r\n })\r\n var fm = jQ(\"div.app-file-manager\");\r\n if(fm.size()==0)\r\n {\r\n //jQ(\"span.ice-fm-refresh\").addClass(\"command\").unbind().click( refresh ); // toolbar refresh\r\n return;\r\n }\r\n //jQ(\"span.ice-fm-refresh, img.ice-fm-refresh\").addClass(\"command\").unbind().click( function(){ xFormSubmit();} );\r\n\r\n // Added FileManager behaviours\r\n jQ(\"span.ice-fm-bAdd, button.ice-fm-bAdd\").each(function() {\r\n var btn = jQ(this);\r\n btn.unbind();\r\n var btnId = btn.attr(\"id\");\r\n\t if (btnId==\"cutSelected\" || btnId==\"copySelected\") \r\n\t\t{ btn.click(function() { xFormAjaxSubmit(this.id, \"\", cutCopyPasteCallback); }); }\r\n if (btnId==\"updateSelected\")\r\n { \r\n if (jQ(\"div.app-file-manager\").size()>0) { jQ(\"#ice_toolbar_status\").remove(); }\r\n function callback(data) {\r\n \tjQ(\"div.app-file-manager\").replaceWith(data);\r\n workingStatusUpdate();\r\n }\r\n btn.click(function() { xFormAjaxSubmit(this.id, \"\", callback); }); \r\n }\r\n if (btnId==\"repairSelected\"){\r\n \tbtn.click(function() {\r\n \t\tvar templateBox = jQ(\"select.ice-fm-dropBox\").val();\r\n \t\txFormSubmit(this.id, \"\", templateBox); });\r\n }\r\n\t else { btn.click(function() { xFormSubmit(this.id, \"\"); }); }\r\n\t});\r\n\t\r\n //\r\n var fmTable = fm.find(\"table.ice-file-manager\");\r\n //fmTable.find(\"tr.file, tr.dir\").click(function(e){ jQ(this).find(\".select\").click().change(); })\r\n //fmTable.find(\"td.ice-fm-cmd\").click(function(e){ e.stopPropagation(); } )\r\n fmTable.find(\"tr.file, tr.dir\").find(\"td:not(:eq(1), :eq(2), :eq(3))\").click(function(e){ jQ(this).parent().find(\".select\").click().change(); })\r\n fmTable.find(\"td.ice-fm-cmd\").find(\"span, img, label, select\").each( function(i) {\r\n\t var s = jQ(this);\r\n\t var c = s.attr(\"class\");\r\n\t var id = null\r\n\t function getTr() {\r\n\t return s.parents(\"tr:first\");\r\n\t }\r\n\t function getId(){\r\n\t var tr = s.parents(\"tr:first\");\r\n\t id = tr.find(\"td input[@type='checkbox']\").val();\r\n if(typeof(id)==\"undefined\")\r\n {\r\n id = tr.attr(\"id\").substring(4);\r\n }\r\n\t return id;\r\n\t }\r\n\t s.i = i\r\n\t switch(c) {\r\n\t case \"paste\":\r\n\t s.click(function(){\r\n\t\t var id = getId();\r\n\t \t //unselectAll();\r\n\t\t //xFormAjaxSubmit(c, id, cutCopyPasteCallback); \r\n\t\t xFormSubmit(c, id);\r\n\t\t });\r\n\t\t break;\r\n\t case \"copy\":\r\n\t case \"cut\":\r\n\t s.click(function(){\r\n\t\t var cb = s.parents(\"tr:first\").find(\"td:first input[@type='checkbox']\");\r\n\t\t var id = getId();\r\n\t \t unselectAll();\r\n\t\t cb.attr(\"checked\", true).change();\r\n\t\t xFormAjaxSubmit(c, id, cutCopyPasteCallback); \r\n\t\t });\r\n\t break;\r\n \t case \"edit\":\r\n\t callback1=function(data, status){ \r\n if(data.substring(0,12)==\"redirectUrl=\"){ data=data.substring(12); window.location=data; }\r\n };\r\n\t s.click(function(){\r\n\t\t var id = getId();\r\n\t\t xFormAjaxSubmit(c, id, callback1); \r\n\t\t });\r\n\t break;\r\n case \"download\":\r\n s.click(function(){\r\n var id = getId();\r\n var xId = s.attr(\"id\");\r\n var action = xForm.action;\r\n xForm.action += xId;\r\n xFormSubmit(c, id, xId);\r\n xForm.action = action; // reset action\r\n });\r\n break;\r\n\t case \"delete\":\r\n\t s.click(function(){\r\n\t\t var cb = s.parents(\"tr:first\").find(\"td input[@type='checkbox']:first\");\r\n\t\t var id = getId();\r\n if (confirm(\"Are you sure you want to delete '\" + id + \"'?\")) {\r\n\t \t unselectAll();\r\n\t\t cb.attr(\"checked\", true).change();\r\n\t\t xFormSubmit(c, id);\r\n\t\t }\r\n\t\t });\r\n\t break;\r\n\t case \"options\":\r\n\t s.click(function(){\r\n\t\t var tr = getTr();\r\n\t\t jQ(this).parent().find(\"div.options\").toggle().find(\".log-data\").hide();\r\n var renaming = tr.find(\".renaming\");\r\n\t\t if(renaming.size()>0) { renaming.find(\"span.command\").click(); }\r\n\t });\r\n\t break;\r\n\t case \"rename\":\r\n\t s.click(function(e){\r\n\t\t var tr = getTr();\r\n\t\t var d = tr.find(\"div.entry-name\");\r\n var id = getId();\r\n if(d.hasClass(\"renaming\"))\r\n\t\t {\r\n\t\t d.html(id);\r\n\t\t d.removeClass(\"renaming\");\r\n\t\t // refresh();\r\n\t\t }\r\n\t\t else\r\n\t\t {\r\n\t\t d.addClass(\"renaming\");\r\n\t\t d.html(\"<div><input type='text' size='32' value='\" + jQ.attrSafe(id) + \"'/> <button>Save</button>&#160;<span class='command'>cancel</span></div>\")\r\n\t\t d.find(\"div\").click(function(e){ return false;});\r\n\t\t //d.find(\"span.command\").click(renameClick);\r\n\t\t \r\n\t\t cancel = d.find(\"span.command\");\r\n\t\t cancel.click( function() {\r\n\t\t \td.html(id);\r\n\t\t d.removeClass(\"renaming\");\r\n\t\t \r\n\t\t refresh();\r\n\t\t });\r\n\t\t \r\n\t\t input = d.find(\"input\");\r\n\t\t input.focus()\r\n\t\t save = d.find(\"button\");\r\n\t\t save.click( function(e) {\r\n\t\t \tvar newName=d.find(\"input\").val();\r\n\t\t \tnewName = escape(newName);\r\n\t\t \td.removeClass(\"renaming\"); \r\n\t\t \td.find(\"div\").hide();\r\n\t\t\t d.append(newName);\r\n\t\t\t //d.parent().parent().find(\".options\").click();\r\n\t\t\t //xFormSubmit(c, id, newName);\r\n\t\t\t function callback(data) {\r\n\t\t\t \tif (data.indexOf(\"Cannot rename\")>-1){\r\n\t\t\t \t \t//alert(data); //If use confirm, it will have \"ok and cancel\" button.\r\n\t\t\t \t \t\tjQalert(data, \"ICE Rename Error\");\r\n\t\t\t \t }else{\r\n\t\t\t \t \trefresh();\r\n\t\t\t \t }\r\n\t\t\t \t}\r\n\t\t\t \t//alert(c + \", \" + id + \", \" + callback + \", \" + newName);\r\n\t\t\t xFormAjaxSubmit(c, id, callback, newName)\r\n\t\t\t } );\r\n\t\t\t \r\n\t\t input.keypress(function(e){\r\n\t\t \tif(e.which == 13)\r\n\t\t \t{\r\n\t\t \t\t//save.click(); // not needed because inside a form\r\n\t\t\t }\r\n\t\t });\r\n }\r\n\t\t });\r\n\t break;\r\n\t case \"log\":\r\n\t var callback2=function(data, status){ s.parent().append(data); };\r\n\t s.click(function(){\r\n\t var me = jQ(this);\r\n\t\t var logData = me.parent().find(\".log-data\")\r\n\t\t if(logData.size()) logData.toggle();\r\n\t\t else {var id = getId(); xFormAjaxSubmit(c, id, callback2);} \r\n\t });\r\n\t break;\r\n\t case \"ice-content\":\r\n\t var callback2 = function(data, status){\r\n //var c=Boolean(parseInt(data)); s.find(\"input\").attr(\"checked\", c);\r\n\t\t\t\trefresh();\r\n }\r\n\t \ts.click(function(){\r\n\t \t var id = getId();\r\n\t\t\t \tvar state = Boolean(s.find(\"input\").attr(\"checked\"))\r\n\t\t\t\txFormAjaxSubmit(c, id, callback2, state);\r\n\t\t });\r\n\t \tbreak;\r\n\t case \"display-source-type\":\r\n\t case \"links-as-endnotes\":\r\n case \"render-audio\":\r\n case \"glossary\":\r\n case \"glossary-terms\":\r\n\t var callback2 = function(data, status){\r\n var c=Boolean(parseInt(data)); s.find(\"input\").attr(\"checked\", c); }\r\n\t // s.change doesn't work in IE..\r\n\t s.click(function(e){ \r\n\t\t \t var id = getId();\r\n\t\t\t \tvar state = Boolean(s.find(\"input\").attr(\"checked\"))\r\n\t\t\t\t//alert(\"change, \"+c+\", state=\"+state+\", id=\"+id); \r\n\t\t\t\txFormAjaxSubmit(c, id, callback2, state); \r\n\t\t });\r\n \t break;\r\n case \"tocLevels\":\r\n s.change(function(e){\r\n var id = getId();\r\n var value = s.val();\r\n var callback = function(data, status){\r\n s.val(data);\r\n }\r\n xFormAjaxSubmit(c, id, callback, value);\r\n });\r\n break;\r\n case \"editBook\": // c==\"editBook\"\r\n s.click(function(){ var id=getId(); \r\n gotoURI(id+\"/\"+c);\r\n //xForm.postCount.value = xForm.postCount.value*1+1;\r\n //xForm.action = id+\"/\"+c; \r\n //xForm.submit();\r\n });\r\n break;\r\n case \"revert\":\r\n s.click(function(){ \r\n \tvar id=getId(); \r\n \tif(confirm(\"Will revert to the repository version and local changes will be lost. Do you want to proceed?\")){\r\n \t\txFormSubmit(c, id);\r\n \t} \r\n });\r\n break;\r\n\t default:\r\n s.click(function(){ var id=getId(); xFormSubmit(c, id); });\r\n\t }\r\n if(c==\"disabled\" || c==\"revert disabled\") {\r\n }\r\n\t else {\r\n s.addClass(\"command\");\r\n }\r\n });\r\n var pathPaste = jQ(\"div.app-nav img.paste\");\r\n pathPaste.click(function() { xFormSubmit(\"paste\", \".\"); });\r\n\t//binding the confirmation to click\r\n\tjQ(\"#revertSelected\").mousedown(function(){\r\n\t\tif(confirm(\"Will revert to the repository version and local changes will be lost. Do you want to proceed?\")){\r\n\t\t\tjQ(\"#revertSelected\").click();\r\n\t\t}\r\n\t});\r\n iceFmSelect(fm);\r\n }\r\n catch(e)\r\n {\r\n alert(\"Error in addBehaviours() - \" + e.message);\r\n }\r\n zebraTables(); // zebra strip tables\r\n}", "function InsertPicture(_1){\r\nif(typeof _editor_picturePath!==\"string\"){\r\n_editor_picturePath=Xinha.getPluginDir(\"InsertPicture\")+\"/demo_pictures/\";\r\n}\r\nInsertPicture.Scripting=\"php\";\r\n_1.config.URIs.insert_image=\"../plugins/InsertPicture/InsertPicture.\"+InsertPicture.Scripting+\"?picturepath=\"+_editor_picturePath;\r\n}", "function BaixarOrdemTelefone_elementsExtraJS() {\n // screen (BaixarOrdemTelefone) extra code\n\n }", "function TermsServices_elementsExtraJS() {\n // screen (TermsServices) extra code\n\n }", "function inject() {\r\n debug('Injecting script');\r\n var script = document.createElement(\"script\"),\r\n txt = main.toString();\r\n if (typeof window.opera !== 'undefined') {\r\n txt = txt.replace(/</g, \"<\");\r\n }\r\n script.innerHTML = \"(\" + txt + \")();\";\r\n script.type = \"text/javascript\";\r\n document.getElementsByTagName(\"head\")[0].appendChild(script);\r\n }", "function detailedReviewPage_elementsExtraJS() {\n // screen (detailedReviewPage) extra code\n }" ]
[ "0.63667333", "0.6255466", "0.6237482", "0.60852754", "0.5991929", "0.59515667", "0.59451234", "0.5821001", "0.5757549", "0.57417095", "0.57158166", "0.57149476", "0.56692207", "0.5661394", "0.5643543", "0.56375086", "0.5615504", "0.56107795", "0.56049865", "0.55968934", "0.5593258", "0.55869216", "0.55854464", "0.5560057", "0.5556329", "0.5544485", "0.5532524", "0.55246246", "0.5522694", "0.5468133", "0.54459774", "0.54324067", "0.54235905", "0.54230905", "0.54217225", "0.5414932", "0.5414932", "0.5406235", "0.5406235", "0.5390811", "0.53900874", "0.5377824", "0.53728384", "0.53601676", "0.5350026", "0.53496426", "0.53422904", "0.5307966", "0.53011715", "0.5296355", "0.5287373", "0.52839977", "0.5283788", "0.5267003", "0.5266042", "0.525972", "0.5251731", "0.52510697", "0.524722", "0.52400714", "0.5238026", "0.5235407", "0.5230518", "0.52290976", "0.5226979", "0.521568", "0.5214721", "0.52030545", "0.5183067", "0.5180521", "0.5178186", "0.51731205", "0.5168955", "0.51545006", "0.5144229", "0.51437783", "0.5134858", "0.5134392", "0.51263446", "0.5120291", "0.5114261", "0.5105206", "0.51024956", "0.5099617", "0.50989413", "0.5098269", "0.50967544", "0.50912714", "0.5088089", "0.50862914", "0.50766534", "0.50666815", "0.50639445", "0.5060398", "0.50603455", "0.5056116", "0.5054628", "0.5049673", "0.5047487", "0.5044076", "0.50365895" ]
0.0
-1
init game's state on grid
function init() { this.grid = setupGrid(this.rows, this.lines, this.pattern); draw(this.canvas, this.grid); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initializeGameState()\n {\n this.gameState = [];\n for (let column = 0; column < this.xSize; column++)\n {\n let newColumn = [];\n for (let row = 0; row < this.ySize; row++)\n {\n let newSpace = {bomb: false, revealed: false, flagged: false, tile: null};\n newColumn[row] = newSpace;\n }\n this.gameState[column] = newColumn;\n }\n\n this.addBombs(this.startBombs);\n this.updateMineCounter(this.startBombs);\n\n }", "init() {\n for (let i = 0; i < GRID_SIZE; ++i) {\n for (let j = 0; j < GRID_SIZE; ++j) {\n this.grid[i][j] = EMPTY\n }\n }\n this.grid[THREE][THREE] = PLAYER1; this.grid[THREE][FOUR] = PLAYER2\n this.grid[FOUR][THREE] = PLAYER2; this.grid[FOUR][FOUR] = PLAYER1\n }", "function initGame(){\n resetGameStats()\n setLevel()\n gBoard = buildBoard()\n renderBoard(gBoard)\n gGame.isOn = true\n\n}", "initGame(gridSize = 4) {\n let board = [...Array(gridSize)].map(e => Array(gridSize).fill(0))\n\n board = this.placeNewTile(this.placeNewTile(board))\n\n this.setState(prevState => ({\n ...prevState,\n board: board,\n score: 0,\n gameOver: false,\n gridSize: gridSize\n }))\n }", "function initGame(){\n\tdragging = snapping = false;\n\tcurrentlyAnimating = true;\n\ttriggerDetectSquares = true;\n\tspawnNewPoly = polyMoved = false;\n\tgameWon = gameWonOverlayShown = false;\n\tgameLost = gameLostOverlayShown = false;\n\tcomboActiveCtr = 0;\n\tscore = goalScore;\n\tmaxCombo = parseInt(localStorage.getItem(\"maxCombo\")) || 0;\n\tmaxComboScore = parseInt(localStorage.getItem(\"maxComboScore\")) || 0;\n\tshapeCountAllTime = JSON.parse(localStorage.getItem(\"shapeCount\")) || shapeCountCurrentGame;\n\n\tselection = new grid(gridSize);\n\tfor(var i=0;i<selection.size;++i)for(var j=0;j<selection.size;++j)\n\t\tselection.setCell(i,j,0);\n}", "function initialize() {\n\t// For each cell in the grid\n\tgridCells.forEach((cell) => {\n\t\t// Remove the active class\n\t\tcell.classList.remove(\"active\");\n\t\t// Set the content to empty\n\t\tcell.textContent = \"\";\n\t});\n\t// Add an event listener to notify when a player has made a move\n\tgrid.addEventListener(\"click\", playerMove);\n\t// Initialize the first player to be X\n\tplayerX.playerTurn = true;\n\t// Set the game status to playing\n\tgameStatus = \"Playing\";\n\t// Render the game\n\trender();\n}", "setupNewGame() {\n var board = [];\n for (var i = 0; i < this.numTiles; i++) {\n board[i] = 0;\n }\n\n this.gameState = {\n board: board,\n score: 0,\n won: false,\n over: false\n }\n this.addRandomTile();\n this.addRandomTile();\n return;\n }", "function initGame() {\n gBoard = buildBoard(gLevel);\n renderBoard();\n}", "initGrid() {\n this.grid = [];\n this.gameOver = false;\n for(let row = 0; row < this.rowSize; row++) {\n let currentRow = [];\n for(let cell = 0; cell < this.colSize; cell++) {\n currentRow.push(this.getEmptyCell());\n }\n this.grid.push(currentRow);\n }\n }", "function setupGame(){\n for (i in state){\n state[i] = initstate[i]\n }\n for (i in gstate){\n gstate[i] = 0\n }\n for (i in sstate){\n sstate[i] = 0\n }\n turnCounter = 0\n stateStore = {}\n storeState(state, gStore, sStore)\n turnCounter = 1\n turnView = 0\n drawboard(state, gstate, sstate)\n}", "function initGame() {\r\n renderLevels()\r\n gGame = {\r\n isOn: true,\r\n isFirstClick: true,\r\n\r\n }\r\n gBoard = buildBoard();\r\n renderBoard(gBoard);\r\n startTimer()\r\n\r\n}", "setupNewGame() {\n\t\tthis.gameState = {\n\t\t\tboard: this.addRandomTile(\n\t\t\t\tthis.addRandomTile(new Array(this.size * this.size).fill(0))\n\t\t\t),\n\t\t\tscore: 0,\n\t\t\twon: false,\n\t\t\tover: false\n\t\t};\n\t\tthis.totalmoves = 0;\n\t\tthis.validmoves = this.getHints().length;\n\t}", "function init() {\n board = [\n [0, 0, 0, 0, 0, 0], // col 0\n [0, 0, 0, 0, 0, 0], // col 1\n [0, 0, 0, 0, 0, 0], // col 2\n [0, 0, 0, 0, 0, 0], // col 3\n [0, 0, 0, 0, 0, 0], // col 4\n [0, 0, 0, 0, 0, 0], // col 5\n [0, 0, 0, 0, 0, 0], // col 6\n ];\n turn = 1;\n winner = null;\n render();\n}", "initializeGrid() {\n const gridInit = new BrewGridInit(BrewGridStore.getBrewAssets());\n assetGrid = gridInit.getAssetGrid();\n tanks = gridInit.getTanks();\n let statusGrid = StatusGrid.convert(assetGrid, BrewGridStore.getAssetStatus());\n fluidSim = new FluidSimulation(assetGrid, tanks, statusGrid);\n this.setState({\n fluidGrid: fluidSim.getFluidGrid(),\n statusGrid: statusGrid,\n });\n }", "setupNewGame() {\n this.gameState = {\n board: this.creatArr(this.board),\n score: 0,\n won: false,\n over: false\n }\n }", "function init() {\n setupModeButtons();\n setupSquares();\n resetGame();\n}", "function initializeGame() {\n createArray();\n initializeArray();\n shipLocator();\n }", "init_grid() {\n this.grid_default = new Array(8);\n\n for (let i = 0; i < 8; ++i) {\n this.grid_default[i] = new Array(8);\n }\n this.grid_default[0][0] = new Tour(1, 0, 0);\n this.grid_default[0][1] = new Cavalier(1, 1, 0);\n this.grid_default[0][2] = new Fou(1, 2, 0);\n this.grid_default[0][3] = new Dame(1, 3, 0);\n this.grid_default[0][4] = new Roi(1, 4, 0);\n this.grid_default[0][5] = new Fou(1, 5, 0);\n this.grid_default[0][6] = new Cavalier(1, 6, 0);\n this.grid_default[0][7] = new Tour(1, 7, 0);\n for (let i = 0; i <= 7; ++i) {\n this.grid_default[1][i] = new Pion(1, i, 1);\n }\n\n this.grid_default[7][0] = new Tour(0, 0, 7);\n this.grid_default[7][1] = new Cavalier(0, 1, 7);\n this.grid_default[7][2] = new Fou(0, 2, 7);\n this.grid_default[7][3] = new Dame(0, 3, 7);\n this.grid_default[7][4] = new Roi(0, 4, 7);\n this.grid_default[7][5] = new Fou(0, 5, 7);\n this.grid_default[7][6] = new Cavalier(0, 6, 7);\n this.grid_default[7][7] = new Tour(0, 7, 7);\n for (let i = 0; i <= 7; ++i) {\n this.grid_default[6][i] = new Pion(0, i, 6);\n }\n\n for (let i = 2; i <= 5; ++i) {\n for (let j = 0; j <= 7; ++j) {\n this.grid_default[i][j] = undefined;\n }\n }\n return this.grid_default;\n }", "initGame() {\n\n\t\t// Empty the container\n\t\t// TODO: Try a reset to default instead of a rerender\n\t\tthis._$container.innerHTML= '';\n\n\t\t// Set matched cards to 0\n\t\tthis._matchedCards= 0;\n\t\t\n\t\t// Set initial score\n\t\tthis._setScore(0);\n\n\t\t// Start score deduction timer\n\t\tthis._startScoreLoop();\n\n\n\t\t// Generate the grid and render elements\n\t\tthis._generateGrid(this.rows, this.cols);\n\t\tthis._randomizeList(this._grid);\n\t\tthis._$container.appendChild(this._renderGrid());\n\n\t\t// Scale the grid\n\t\tthis._resizeHandler();\n\t}", "init(){\n player = {score: 0, prev_score: 0, won: 0, lost: 0};\n clear(lostInterval);\n\n this.prev_grid = null;\n\n for(let r = 0; r < this.cell_no; r += 1){\n for(let c = 0; c < this.cell_no; c += 1){\n this.grid[r][c].val = 0;\n }\n }\n\n let i = 0\n while(i != 2){\n let r = floor(random(this.cell_no));\n let c = floor(random(this.cell_no));\n\n let g = this.grid[r][c];\n\n if(g.val != 0) continue\n\n g.val = 2;\n i += 1\n }\n }", "function init() {\n //go through menus\n menus = true;\n //choosing play style\n choosingStyle = true;\n //Display text and buttons\n AI.DecidePlayStyle();\n //load the board and interactable cubes\n LoadBoard();\n LoadInteractables();\n}", "function populateGameGrid(grid) {\r\n\r\n for (var i = 0; i < NUM_ROWS; i += 1) {\r\n for (var j = 0; j < NUM_COLS; j += 1) {\r\n //fills all grid with initial cells\r\n grid[i][j] = new Cell();\r\n //x position match x coordinates\r\n grid[i][j].xPosition = j * CELL_SIZE;\r\n //y position match y coordinates\r\n grid[i][j].yPosition = i * CELL_SIZE;\r\n }\r\n\r\n } \r\n\r\n }", "function init() {\n\tscore = 0;\n\tspeed = 10;\n speedCheck = 1;\n\tgrid.init(emptyFill, columns, rows);\n\tvar snakePos = {x:Math.floor(columns/2), y:rows-1};\n\tsnake.init(up, snakePos.x, snakePos.y);\n\tgrid.set(snakeFill, snakePos.x, snakePos.y);\n\tsetFood();\n}", "function gridSetup() {\n for (var i = 0; i <= HEIGHT - 1; i++) {\n grid[i] = [];\n }\n\n for (i = 0; i <= HEIGHT - 1; i++) {\n for (var j = 0; j <= WIDTH - 1; j++) {\n grid[i][j] = new Cell(j * cellSide, i * cellSide, 'black');\n }\n }\n\n //drawGlider(54, 3);\n //drawRandom();\n\n for (var i = 0; i <= HEIGHT - 1; i++) {\n gridCopy[i] = [];\n }\n\n for (i = 0; i <= HEIGHT - 1; i++) {\n for (var j = 0; j <= WIDTH - 1; j++) {\n if (grid[i][j].isAlive == 0) {\n gridCopy[i][j] = 0;\n }\n else if (grid[i][j].isAlive == 1) {\n gridCopy[i][j] = 1;\n }\n }\n }\n}", "constructor(gameBoardState) {\n // TODO - neater initialisation\n this.numberOfRows= gameBoardState.length\n this.numberOfCols= gameBoardState[0].length\n // assign cells to empty 2d array or cells[0][0] === undefined (!empty array)\n this.cells = [[],[]]\n // populate empty state\n for (let row = 0; row < this.numberOfRows; row++) {\n for (let col = 0; col < this.numberOfCols; col++) {\n // set initial state - not null\n if(gameBoardState[row][col]>=0){\n this.cells[row][col] = gameBoardState[row][col] \n }else{\n this.cells[row][col] = this.unknownCell\n }\n }\n }\n this.unknownCell= -1;\n this.mine = -2\n this.empty = -3\n }", "function init(){\n board = new Array(9).fill(null);\n turn = 1;\n winner = false;\n render();\n}", "async function initBoard() {\n try {\n let existingState = await BoardState.findOne();\n if (!existingState) {\n function gridMaker(rows, columns, color) {\n let grid = [];\n\n for (let x = 0; x < rows; x++) {\n grid.push([]);\n for (let y = 0; y < columns; y++) {\n grid[x].push(color);\n }\n }\n return grid;\n }\n const initialGrid = new BoardState({\n test: \"test\",\n state: gridMaker(180, 320, \"#FFFFFF\"),\n });\n try {\n await initialGrid.save();\n } catch (err) {\n console.log(err);\n console.log(\"something went wrong!\");\n return;\n }\n } else {\n return;\n }\n } catch (err) {\n console.log(\"something went very wrong\");\n return;\n }\n}", "begin(grid) {\n init();\n }", "function initGame() {\n first_item_timestamp = Math.round((new Date().getTime()) / 100) / 10;\n initializeSetsOfChoices();\n adjustSlider(set[round][stage][1], set[round][stage][2], set[round][stage][3], set[round][stage][4], set[round][stage][5], set[round][stage][6]);\n\n // we store some data\n itemLowvalYou[stage] = set[round][stage][1];\n itemHighvalYou[stage] = set[round][stage][2];\n itemDescYou[stage] = set[round][stage][3];\n itemLowvalOther[stage] = set[round][stage][4];\n itemHighvalOther[stage] = set[round][stage][5];\n itemDescOther[stage] = set[round][stage][6];\n itemID[stage] = set[round][stage][7];\n\n initSlider();\n if (storeSearchPath == 1) {\n trackTicks();\n }\n gameMsg = '';\n dispGame();\n }", "function startGame(){\n\n // create the grid array\n gridCardsArray = createGrid();\n\n // start cards with objects IDs and Icon values\n initCards();\n\n}", "function setGrid(width,height){\n\tbd.cellWidth = bd.width/width;\n\tbd.cellHeight = bd.height/height;\n\tbd.x = width;\n\tbd.y = height;\n\n\tctx.clearRect(0,0,bd.width,bd.height);\n\t//Initalizes the state array and the neighbor array\n\tstate\t = new Array(width);\n\tneighbor = new Array(width);\n\tfor(var x = 0; x < width; x ++){\n\n\t\tstate[x] \t= new Array(height);\n\t\tneighbor[x] = new Array(height);\n\n\t\tfor(var y = 0; y < height; y ++){\n\t\t\tif(random && Math.random()>0.5)\n\t\t\t\tstate[x][y] = true;\n\t\t\telse state[x][y] = false;\n\t\t\t\tneighbor[x][y] = 0;\n\t\t}\n\t}\n}", "function init() {\n let grid = new Grid()\n grid.renderGrid();\n}", "_init(){\n // clear the squares\n\t\tthis.squares.each(function(){\n\n\t\t\t$(this).html('');\n\n\t\t});\n \n // Reset the game states...\n\t\tthis.gameBoard = [null, null, null, null, null, null, null, null, null]; \n\t\tthis.currentPlayer = 'X';\n\t\tthis.isGameOver = false;\n\t\tthis.numberOfPlayedSquares = 0;\n \n }", "function game_initBoard(){\n\t//get map from data.\n\tvar mapdata=data_map[GLOBAL['gid']].map;\n\tvar spawntiles=[];\n\tGLOBAL['board']=[];\n\t//copy data into a board of tile objects\n\tfor(var i=0;i<mapdata.length;i++){\n\t\tGLOBAL['board'][i]=[];\n\t\tfor(var j=0;j<mapdata[i].length;j++){\n\t\t\tvar tile={x:i,y:j,type:mapdata[i][j]};\n\t\t\ttile.color=Math.round(170+(Math.random()*30));\n\t\t\tif(tile.type==2){\n\t\t\t\tspawntiles.push(tile);\n\t\t\t}\n\t\t\tGLOBAL['board'][i][j]=tile;\n\t\t}\n\t}\n\tvar xmax=46*GLOBAL['board'].length;\n\tvar ymax=46*GLOBAL['board'][0].length;\n\t//share the board offset, and spawn tiles.\n\n\tGLOBAL['gamevars'].xoffset=Math.round(($('#game')[0].width-xmax)/2);\n\tGLOBAL['gamevars'].yoffset=Math.round(($('#game')[0].height-ymax)/2);\n\tGLOBAL['gamevars'].spawnpoints=spawntiles;\n}", "function initialiseGame() {\n reset();\n if (canvas.getContext)\n {\n if(artAgent == true){\n timeStep = 0.000000000005;\n }\n else{\n timeStep = 0.3;\n }\n originalTimeStep = timeStep;\n\n spawnPos = Math.floor(xGridAmount/2) - 2;\n currentX = spawnPos;\n\n var gridYCentre = getGridHeight() / 2;\n\n for (var x = 0; x < xGridAmount; x++) {\n gridCellX.push(((getGridWidth() * x)));\n }\n for (var y = 0; y < yGridAmount; y++) {\n gridCellY.push(((getGridHeight() * y)));\n }\n\n for (var x = 0; x < xGridAmount; x++) {\n gridCellOccupied[x] = new Array(yGridAmount);\n surfaceBlock[x] = new Array(yGridAmount);\n for (var y = 0; y < yGridAmount; y++) {\n gridCellOccupied[x][y] = false;\n surfaceBlock[x][y] = null;\n }\n }\n\n backgroundImage = new image(0, 0, \"grey-background.jpg\", 0, 0);\n headerImage = new image(0, 0, \"Header.png\", 0, 0);\n styleText('white', '30px Courier New', 'left', 'middle');\n\n createNewShape();\n gameLoop();\n }\n}", "init() {\r\n //const result = this.isGameEnd([4],gameModeStevenl.wining_positions);\r\n //console.log(result);\r\n\r\n this.assignPlayer();\r\n gameView.init();\r\n }", "function initGrid (){\n for (var row = 0; row < numRows; row += 1) {\n for (var col = 0; col < numCols; col += 1) {\n drawCustomCell(row, col, window.cells[row][col].state,'none', true);\n }\n }\n}", "function init() {\n gameFieldsEl.forEach(el => {\n el.innerText = '';\n el.className = 'game-board__field';\n });\n displayScores();\n logic.initLogic(myTurn); \n player0.className = 'player player0';\n player1.className = 'player player1';\n player0Name.innerText = 'Player 1';\n player1Name.innerText = 'Player 2';\n if(logic.getActivePlayer() === 1) player0.classList.add('active');\n else player1.classList.add('active');\n gameFieldsEl.forEach(el => el.style = 'none');\n if(!myTurn) logic.makeMoveAI();\n myTurn = myTurn ? false : true;\n \n \n //Event listeners\n logic.getActivePlayer() === 1 ? gameBoardEl.addEventListener('click', makeMove) : gameBoardEl.removeEventListener('click', makeMove);\n newGame.addEventListener('click', init);\n reset.addEventListener('click', resetScores);\n }", "function initGame() {\r\n const state = createGameState();\r\n state.bricks.list = initBricks(state);\r\n return state;\r\n}", "init() {\n let i, cells, cell, cellMeta;\n let width = null;\n let height = null;\n\n if (!this.config.isFullScreen) {\n width = this.canvas.width;\n height = this.canvas.height;\n }\n\n this.board.calculateCellLayout(width, height);\n this.canvas.width = this.board.width;\n this.canvas.height = this.board.height;\n cells = this.board.populateBoard(this.config.isRandom);\n\n this.drawCells(cells);\n this.isInitialized = true;\n }", "function init() {\r\n var levelData = document.querySelector('input[name=\"level\"]:checked')\r\n gLevel.size = levelData.getAttribute('data-inside');\r\n gLevel.mines = levelData.getAttribute('data-mines');\r\n gLevel.lives = levelData.getAttribute('data-lives');\r\n var elHints = document.querySelector('.hints')\r\n elHints.innerText = 'hints: ' + HINT.repeat(3)\r\n var elButton = document.querySelector('.start-button')\r\n elButton.innerText = NORMAL\r\n document.querySelector('.timer').innerHTML = 'Time: 00:00:000'\r\n gBoard = createBoard()\r\n clearInterval(gTimerInterval);\r\n gGame = { isOn: false, shownCount: 0, markedCount: 0, isFirstClick: true, isHintOn: false }\r\n renderBoard()\r\n renderLives()\r\n}", "function init_grid() {\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < cols; j++) {\n if (random() < 0.9) {\n grid[i][j] = 1;\n }\n if (random() < 0.04) {\n grid[i][j] = 2;\n }\n }\n }\n}", "function init() {\n\tinitalizeGrid();\n\tupdateCanvasGrid();\n\tdrawPalette();\n\tdrawCurrentColor();\n\tdecodeOnFirstLoad();\n}", "makeGrid() {\n // Create cells of a grid, store them in a grid, and give them the data that they need.\n gameState.grid = [];\n for (let x = 0; x < gameState.GRID_WIDTH; x++) {\n gameState.grid[x] = [];\n for (let y = 0; y < gameState.GRID_HEIGHT; y++) {\n let newCell = this.add.sprite((x * (gameState.CELL_DIMS + gameState.PADDING)) + gameState.INIT_X, (y * (gameState.CELL_DIMS + gameState.PADDING)) + gameState.INIT_Y, 'cell');\n newCell.number = parseInt((Math.random() * gameState.maxNumber) + gameState.minNumber); // Number between min and maxNumber\n newCell.targetNumber = this.checkTargetNumber(newCell.number); // Whether number is a target number\n newCell.absorbed = false; // Number has not been absorbed yet (since we just created it)\n newCell.printNumber = newCell.number.toString(); // Number as a string.\n gameState.grid[x][y] = newCell; // Add it to the grid.\n newCell.print = this.add.text(newCell.x-10, newCell.y-10, newCell.printNumber, {\n align: \"center\",\n font: gameState.INFO_FONT,\n fill: '#ffffff'\n }).setTint(0x000000); // We use tint since we change the color of the numbers.\n }\n }\n }", "refresh(){\n this.grid = [] ;\n for( var i = 0 ; i < columns ; ++i ){\n this.grid[i] = [] ;\n for( var j = 0 ; j < rows ; ++j ){\n this.grid[i][j] = { bool: false , color: \"#fff\" } ;\n }\n }\n this.inPlay = false ;\n this.alive = true ;\n }", "setupNewGame() {\n let newGame = new Game(this.size);\n this.gameState = {\n board: newGame.gameState.board,\n score: 0,\n won: false,\n over: false\n }\n }", "function init() {\r\n //If we pressed the rest button mid Ai thinking, stop it.\r\n clearTimeout(aiDelay);\r\n state.phase = 'setup';\r\n state.shipPrimed = null;\r\n state.orientation = null;\r\n state.turn = 1;\r\n for (row=0; row < 10; row++) {\r\n for(col=0; col < 10; col++) {\r\n playerCoordinateEl[row][col].className = '';\r\n opponentCoordinateEl[row][col].className = '';\r\n }\r\n }\r\n for (let ship in playerShipState) {\r\n playerShipState[ship].orientation = 'horizontal';\r\n playerShipState[ship].health.fill(0);\r\n playerShipState[ship].coordinate = [null, null];\r\n playerShipState[ship].counter = 1;\r\n if (playerBoardContainerEl.contains(playerShipState[ship].attachedImage)) {\r\n playerShipState[ship].attachedImage.parentNode.removeChild(playerShipState[ship].attachedImage);\r\n }\r\n }\r\n for (let ship in enemyShipState) {\r\n enemyShipState[ship].orientation = 'horizontal';\r\n enemyShipState[ship].health.fill(0);\r\n enemyShipState[ship].coordinate = [null, null];\r\n enemyShipState[ship].counter = 1;\r\n if (opponentBoardContainerEl.contains(enemyShipState[ship].attachedImage)) {\r\n enemyShipState[ship].attachedImage.parentNode.removeChild(enemyShipState[ship].attachedImage);\r\n }\r\n }\r\n readyEl.textContent = 'Ready?';\r\n //Reset the styling for the ships at port.\r\n portEl.querySelectorAll('img').forEach((element) => {\r\n element.classList.remove('unavailable');\r\n })\r\n render();\r\n}", "function init() {\n setUpModeButtons();\n setUpSquares();\n reset();\n}", "function init(){\n compArray = createEmptyArray();\n generateRandomShipLocations();\n render();\n myTurn = true;\n myTurnIndicatorOn();\n}", "function _createGrid() {\n\t_grid = [$game.VIEWPORT_WIDTH];\n\tvar i = $game.VIEWPORT_WIDTH;\n\twhile(--i >= 0) {\n\t\t_grid[i] = [$game.VIEWPORT_HEIGHT];\n\t\tvar j = $game.VIEWPORT_HEIGHT;\n\t\twhile(--j >= 0) {\n\t\t\t//place random object\n\t\t\tvar item = _makeRandomItem();\n\t\t\t_grid[i][j] = {\n\t\t\t\titem: item,\n\t\t\t\titemRevealed: false\n\t\t\t};\n\t\t}\n\t}\n}", "function initGame() {\n // Assign variables\n gridSize = formGridSize.value;\n isXFirst = formFirstMove.value;\n oName = formOpponentSelection.value;\n inputX = \"❌\";\n inputO = \"⭕\";\n currentMark = inputX;\n oName === \"Player 2\" ? (isComputerActive = false) : (isComputerActive = true);\n\n // Change text based on inputs\n titleDesc.textContent = ` ${gridSize}x${gridSize} board`;\n p2Title.textContent = oName;\n p1Desc.textContent = `${inputX}'s`;\n if (isComputerActive) {\n p2Avatar.style.backgroundImage =\n \"url('https://images.vexels.com/media/users/3/157318/isolated/preview/2782b0b66efa5815b12c9c637322aff3-desktop-computer-icon-computer-by-vexels.png')\";\n }\n p2Desc.textContent = `${inputO}'s`;\n currentPlayerMessage = `${xName} (${inputX})`;\n\n // Hide/Unhide\n modal.classList.add(\"hide\");\n modalContainer.classList.add(\"hide\");\n content.classList.remove(\"hide\");\n\n // Creation\n createGrid(gridSize);\n addMainFunction();\n createBoardInstance(); // push empty board to gridHistory\n if (isXFirst == 0) {\n // switch to let O go first\n playerOMovesFirst();\n }\n}", "initGame() {\n\n this.state = 'stopped';\n this.bugsSpeeds = []; // empty bug speed with every init\n\n // change the state and create entities depending on the choosed lvl\n switch(this.level) {\n case 'Easy':\n this.numOfBugs = 4;\n\n this.allBugs = Enemy.createMultiple(this.numOfBugs, this.numRows);\n this.allGems = Gem.createMultiple(this.gemColor.length+2, this.winWidth, this.gemColor, this.numCols);\n this.allRocks = [];\n // for caching original bug speed as it'll be stoped or zerolized [= 0] upon pause state\n for (let bug of this.allBugs) {\n this.bugsSpeeds.push(bug.speed);\n }\n\n this.changeState(this.state, this.bugsSpeeds);\n break;\n case 'Medium':\n this.numOfBugs = 5;\n this.numOfRocks = 2;\n\n this.allBugs = Enemy.createMultiple(this.numOfBugs, this.numRows);\n this.allGems = Gem.createMultiple(this.numCols/1.6, this.winWidth, this.gemColor, this.numCols);\n this.allRocks = Rock.createMultiple(this.numOfRocks, this.winWidth, this.numRows, this.numCols);\n \n for (let bug of this.allBugs) {\n this.bugsSpeeds.push(bug.speed);\n }\n\n this.changeState(this.state, this.bugsSpeeds);\n break;\n case 'Hard':\n this.numOfBugs = 7;\n this.numOfRocks = 3;\n\n this.allBugs = Enemy.createMultiple(this.numOfBugs, this.numRows);\n this.allGems = Gem.createMultiple(this.numCols-1, this.winWidth, this.gemColor, this.numCols);\n this.allRocks = Rock.createMultiple(this.numOfRocks, this.winWidth, this.numRows, this.numCols);\n \n for (let bug of this.allBugs) {\n this.bugsSpeeds.push(bug.speed);\n }\n\n this.changeState(this.state, this.bugsSpeeds);\n break;\n };\n // random img for game states to show in modal\n this.randomWinImg = this.winnerImg[Math.floor(Math.random() * ((this.winnerImg.length-1)-0) + 1) + 0];\n this.randomLoseImg = this.loserImgs[Math.floor(Math.random() * ((this.loserImgs.length-1)-0) + 1) + 0];\n this.randomPauseImg = this.zzz[Math.floor(Math.random() * (this.zzz.length-1)-0)/* + 0) + 0*/];\n // let randomDefaultImg = this.players[Math.floor(Math.random() * (this.players.length-1) - 0) + 0];\n\n }", "initGrid () {\n\n // Init all rows one by one\n for ( const [ , row ] of this.rows.entries () ) {\n this.initSortableRow ( row );\n }\n\n // Init sortable grid\n Sortable.create (\n this.$el.firstChild,\n {\n ...this.getSortableOptions,\n ...{\n group: {\n name: 'vgd-rows',\n pull: 'vgd-rows',\n put : 'vgd-rows'\n }\n }\n }\n );\n\n this.setModeClass();\n\n this.$emit ( 'ready' );\n\n }", "function gameInit() {\r\n // disable menu when right click with the mouse.\r\n dissRightClickMenu();\r\n resetValues();\r\n // switch emoji face to normal.\r\n switchEmoji();\r\n gBoard = createBoard(gLevel.SIZE);\r\n renderBoard(gBoard);\r\n}", "setup(){\n for(var j=0; j<this.rows; j++){\n for(var i=0; i<this.columns; i++){\n var cell = this.grid.cell(i,j) ;\n if (cell.linked(cell.east)){\n this.verticalWall(i+1,j).standing = false ;\n }else{\n this.verticalWall(i+1,j).standing = true ;\n }\n if (cell.linked(cell.north)){\n this.horizontalWall(i,j+1).standing = false ;\n }else{\n this.horizontalWall(i,j+1).standing = true ;\n }\n }\n }\n this.setCells() ;\n this.setWalls() ;\n this.setCorners() ;\n this.setDoors() ;\n }", "function initGame() {\r\n initPelota();\r\n initNavecilla();\r\n initLadrillos();\r\n}", "init() {\n //const result = this.isGameEnd([4],gameModeStevenl.wining_positions);\n //console.log(result);\n\n this.assignPlayer();\n gameView.init(this);\n registerView.init(this);\n }", "init(game) {\n\n }", "function initGame (w, h) {\n\t\tPAUSE_MODE = false;\n\t\tMAX_LEVEL_DONE = false;\n\t\tif (moveTilesId !== -1)\n\t\t\twindow.clearInterval(moveTilesId);\n\t\tfieldWidth = w; fieldHeight = h; // width and height of the field, in number of tiles\n\t\tfieldArray = new Array();\n\t\tfor (var i=0; i<fieldHeight; i++) {\n\t\t\tfieldArray[i] = new Array();\n\t\t\tfor (var j=0; j<fieldWidth; j++)\n\t\t\t\t// each tile has a color (between 0 and 3), an id (the id of the Crafty entity),\n\t\t\t\t// and a prorpiety indicating if the tile is moving or not (not moving = touching another tile)\n\t\t\t\tfieldArray[i][j] = { \"color\": -1, \"id\": -1, \"moving\": 1 };\n\t\t}\n\t\tfullColumns = new Array();\n\t\tfor (var j=0; j<fieldWidth; j++) // all the columns are empty when we start\n\t\t\tfullColumns[j] = 0;\n\t\tcurrentLevel = 1;\n\t\tcurrentScore = 0;\n\t\tintervalBetweenUpdates = SET_intervalBetweenUpdates; // the number of ms between each update of the scene\n\t\tnumberOfColors = SET_numberOfColors; // the number of authorized colors\n\t\tlinesStart = SET_linesStart; // the number of lines full of minerals at the start\n\t\t\n\t\twinnings.forEach(function (e) {\n\t\t\te.number = 0;\n\t\t\te.earnings = 0;\n\t\t});\n\t}", "_init_grid() {\n\t\t\tfor (var i = 0; i < this._internal_grid_size[0]; i++) {\n\t\t\t\tthis._internal_grid.push([]);\n\t\t\t\tfor (var e = 0; e < this._internal_grid_size[1]; e++) {\n\t\t\t\t\tthis._internal_grid[i].push(0);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function initializeGrid(gridWidth, gridHeight) {\n\n Tile.count = 0;\n\n for (let i = 0; i < gridHeight; i++) {\n grid[i] = [];\n for (let j = 0; j < gridWidth; j++) {\n grid[i][j] = new Tile(false, false, 0);\n }\n }\n\n}", "constructor(board_size = 400, n_blocks = 20) {\n this.color_map = {\n '#EEAAAA': 'light red',\n '#DDBB99': 'beige',\n '#FFFF80': 'yellow',\n '#BFFF80': 'light green',\n '#408000': 'dark green',\n '#DD99BB': 'pink',\n '#CC88CC': 'purple',\n '#99BBDD': 'light blue',\n '#336699': 'dark blue',\n '#5CD6D6': 'turquoise',\n '#FFB366': 'orange',\n '#e8e8e8': 'grey'\n };\n // board properties\n this.board_size = board_size;\n this.n_blocks = n_blocks;\n this.block_size = board_size / n_blocks;\n this.x = 0\n this.y = 0\n this.show_gridlines = true\n\n // game mode\n this.templ_col = 'grey'\n this.provide_template = true\n this.hide_buttons = true\n this.game_time = 600\n this.demo_time = 300\n }", "function setupGame() {\n game.bombsOnBoard = 0;\n game.flagsAvaliable = gameConfig.bombCount;\n buildSweeperGrid();\n plantBombs();\n addClickListeners();\n updateFlagsIndicator();\n}", "function init() {\n\t\tclearBoard();\n\t\tprintBoard(board);\n\t\ttopPlayerText.innerHTML = `- ${game.currentPlayer.name}'s turn -`;\n\t\tgame.currentPlayer = game.playerOne;\n\t\tgame.squaresRemaining = 9;\n\t\tgame.winner = false;\n\t\tclickSquares();\n\t}", "startGame () {\n const {width, height, gameStart} = this.state\n const dimension = width * height\n const longList = Array.apply(null, {length: dimension}, [Number.call, Number])\n const game = util.arrayToBoard(longList, width, height)\n const currentPlayerCell = util.getPlayerCell(game.cells)\n const mushroomCells = util.getMushroomCells(game.cells)\n this.setState({\n dimension,\n game,\n moves: 0,\n playerCell: currentPlayerCell,\n mushrooms: mushroomCells.length\n })\n\n if (!gameStart) { this.toggleDisplay() }\n\n }", "function init(rows, columns) {\n\n console.log(navigator.language);\n\n var current_level = $.cookie('select');\n\n // $('.level-cell').removeClass('current_lvl');\n $('.level-cell:eq(' + current_level + ')').addClass('current_lvl');\n var $i = 0;\n\n //cell indexes\n var xPrevios;\n var yPrevios;\n\n var firstStepFlag = 1;\n var indexPrevios;\n\n function remove_grid() {\n $('.grid-container').empty();\n }\n\n /**\n * Generate grid with parameters from init(rows, columns)\n */\n function generage_grid() {\n\n for (var i = 0; i < rows; i++) {\n $('.grid-container').append('<div class=\"grid-row\"></div>');\n }\n\n\n $('.grid-row').each(function () {\n for (i = 0; i < columns; i++) {\n $(this).append('<div class=\"grid-cell\"></div>')\n }\n });\n\n var game_container_height = (34.5 * rows)\n $('.game-container').height(game_container_height);\n var game_container_width = (34.5 * columns)\n $('.game-container').width(game_container_width);\n }\n\n remove_grid();\n generage_grid();\n\n\n $('.grid-cell').click(function () {\n\n var $cells = $('.grid-cell');\n\n var $index = $cells.index(this);\n //$n = $(this).classList[3];\n var x = Math.floor($index / columns);\n var y = $index % columns;\n // console.log(x + ':' + y);\n\n /**\n * Check if cell have already busy\n */\n if (!$(this).hasClass('number')) {\n\n /**\n * Check move conformity to knight move\n */\n if (firstStepFlag == 1 || (x == xPrevios - 2 && y == yPrevios - 1)\n || (x == xPrevios - 2 && y == yPrevios + 1)\n || (x == xPrevios - 1 && y == yPrevios - 2)\n || (x == xPrevios - 1 && y == yPrevios + 2)\n || (x == xPrevios + 2 && y == yPrevios + 1)\n || (x == xPrevios + 2 && y == yPrevios - 1)\n || (x == xPrevios + 1 && y == yPrevios + 2)\n || (x == xPrevios + 1 && y == yPrevios - 2)\n ) {\n if (firstStepFlag == 1) {\n $(this).append($i).addClass('number').fadeTo(\"fast\", 1).addClass('first');\n indexPrevios = $index;\n }\n else $(this).append($i).addClass('number').fadeTo(\"fast\", 1).addClass('last');\n\n if ($i > 99) $(this).css({'font-size': '14px'});\n\n xPrevios = x;\n yPrevios = y;\n //console.log($i - 1);\n firstStepFlag = 0;\n // console.log('Last ' + $('.grid-cell').get($index).className);\n //$( '.grid-cell:eq(' + $index-1 + ' )' ).addClass('number');\n if (!$('.grid-cell:eq(' + indexPrevios + ' )').hasClass('first')) $('.grid-cell:eq(' + indexPrevios + ' )').removeClass('last').addClass('intermediate');\n indexPrevios = $index;\n\n /**\n * Check is any moves for player or not\n */\n if (($('.grid-cell:eq(' + ((x - 2) * columns + (y - 1)) + ' )').hasClass('number') || 0 > (x - 2) || 0 > (y - 1) || (x - 2) >= rows || (y - 1) >= columns)\n && ($('.grid-cell:eq(' + ((x - 2) * columns + (y + 1)) + ' )').hasClass('number') || 0 > (x - 2) || 0 > (y + 1) || (x - 2) >= rows || (y + 1) >= columns)\n && ($('.grid-cell:eq(' + ((x - 1) * columns + (y - 2)) + ' )').hasClass('number') || 0 > (x - 1) || 0 > (y - 2) || (x - 1) >= rows || (y - 2) >= columns)\n && ($('.grid-cell:eq(' + ((x - 1) * columns + (y + 2)) + ' )').hasClass('number') || 0 > (x - 1) || 0 > (y + 2) || (x - 1) >= rows || (y + 2) >= columns)\n && ($('.grid-cell:eq(' + ((x + 2) * columns + (y + 1)) + ' )').hasClass('number') || 0 > (x + 2) || 0 > (y + 1) || (x + 2) >= rows || (y + 1) >= columns)\n && ($('.grid-cell:eq(' + ((x + 2) * columns + (y - 1)) + ' )').hasClass('number') || 0 > (x + 2) || 0 > (y - 1) || (x + 2) >= rows || (y - 1) >= columns)\n && ($('.grid-cell:eq(' + ((x + 1) * columns + (y + 2)) + ' )').hasClass('number') || 0 > (x + 1) || 0 > (y + 2) || (x + 1) >= rows || (y + 2) >= columns)\n && ($('.grid-cell:eq(' + ((x + 1) * columns + (y - 2)) + ' )').hasClass('number') || 0 > (x + 1) || 0 > (y - 2) || (x + 1) >= rows || (y - 2) >= columns)\n && $i < ((columns * rows) - 1)) {\n console.log('Game over!');\n getPopUp('game_message_lose');\n }\n console.log('========== true unavailable ============');\n console.log((x - 2) + ' ' + (y - 1) + ' ' + ($('.grid-cell:eq(' + ((x - 2) * columns + (y - 1)) + ' )').hasClass('number') || 0 > (x - 2) || 0 > (y - 1) || (x - 2) >= rows || (y - 1) >= columns));\n console.log((x - 2) + ' ' + (y + 1) + ' ' + ($('.grid-cell:eq(' + ((x - 2) * columns + (y + 1)) + ' )').hasClass('number') || 0 > (x - 2) || 0 > (y + 1) || (x - 2) >= rows || (y + 1) >= columns));\n console.log((x - 1) + ' ' + (y - 2) + ' ' + ($('.grid-cell:eq(' + ((x - 1) * columns + (y - 2)) + ' )').hasClass('number') || 0 > (x - 1) || 0 > (y - 2) || (x - 1) >= rows || (y - 2) >= columns));\n console.log((x - 1) + ' ' + (y + 2) + ' ' + ($('.grid-cell:eq(' + ((x - 1) * columns + (y + 2)) + ' )').hasClass('number') || 0 > (x - 1) || 0 > (y + 2) || (x - 1) >= rows || (y + 2) >= columns));\n console.log((x + 2) + ' ' + (y + 1) + ' ' + ($('.grid-cell:eq(' + ((x + 2) * columns + (y + 1)) + ' )').hasClass('number') || 0 > (x + 2) || 0 > (y + 1) || (x + 2) >= rows || (y + 1) >= columns));\n console.log((x + 2) + ' ' + (y - 1) + ' ' + ($('.grid-cell:eq(' + ((x + 2) * columns + (y - 1)) + ' )').hasClass('number') || 0 > (x + 2) || 0 > (y - 1) || (x + 2) >= rows || (y - 1) >= columns));\n console.log((x + 1) + ' ' + (y + 2) + ' ' + ($('.grid-cell:eq(' + ((x + 1) * columns + (y + 2)) + ' )').hasClass('number') || 0 > (x + 1) || 0 > (y + 2) || (x + 1) >= rows || (y + 2) >= columns));\n console.log((x + 1) + ' ' + (y - 2) + ' ' + ($('.grid-cell:eq(' + ((x + 1) * columns + (y - 2)) + ' )').hasClass('number') || 0 > (x + 1) || 0 > (y - 2) || (x + 1) >= rows || (y - 2) >= columns));\n console.log($i < ((columns * rows) - 1));\n // console.log('======================');\n\n\n if ($i == ((columns * rows) - 1)) {\n\n current_level = $.cookie('select');\n if (current_level == '5') {\n getPopUp('game_message_win');\n }\n else {\n getPopUp('game_message_next_level');\n //console.log(current_level + ' ' + getCurrent_level());\n\n current_level++;\n $.cookie('level', current_level);\n $.cookie('select', current_level);\n console.log(current_level + ' ----')\n $('.level-cell:eq(' + current_level + ')').removeClass('lock');\n console.log('2')\n $('.level-cell').removeClass('current_lvl');\n $('.level-cell:eq(' + current_level + ')').addClass('current_lvl');\n // init_next_level(current_level);\n }\n }\n\n $i++;\n }\n }\n\n else {\n\n console.log('Already set number.');\n }\n\n\n }\n )\n ;\n\n\n /**\n * Field shading function, add black and white class to cell\n */\n function shading() {\n var $cells = $('.grid-cell');\n $cells.each(function () {\n if ((columns % 2) == 0) {\n if ((Math.floor($i / columns) + $i) % 2 == 1) $(this).addClass('black')\n else $(this).addClass('white');\n $i++;\n } else {\n if (($i % 2) == 1) $(this).addClass('black')\n else $(this).addClass('white');\n $i++;\n }\n\n });\n $i = 0;\n }\n\n shading();\n\n\n /**\n * Generate popup window after win or lose\n *\n * @param message_id get game_message_win or game_message_lose\n */\n function getPopUp(message_id) {\n\n var popupid = message_id;\n console.log(popupid);\n\n $('#' + popupid).fadeIn(900);\n\n $('#fade').css({'filter': 'alpha(opacity=80)'}).fadeIn(900);\n\n var popuptopmargin = ($('#' + popupid).height() + 10) / 2;\n var popupleftmargin = ($('#' + popupid).width() + 10) / 2;\n\n $('#' + popupid).css({\n 'margin-top': -popuptopmargin,\n 'margin-left': -popupleftmargin\n });\n\n $('#fade').click(function () {\n $('#fade , #game_message_win, #game_message_lose, #game_message_next_level').fadeOut(900)\n return false;\n });\n }\n\n\n }", "function testSetup() {\n let testGrid = new Grid(playerNumber=99);\n testGrid.clearGrid();\n testGrid.setupGrid();\n testGrid.placeShip(SHIPS.A,0,0,\"right\");\n testGrid.placeShip(SHIPS.B,0,9,\"right\");\n testGrid.placeShip(SHIPS.C,8,3,\"down\");\n testGrid.placeShip(SHIPS.D,8,6,\"right\");\n testGrid.placeShip(SHIPS.S,4,9,\"right\");\n console.table(testGrid.matrix);\n}", "setupGameBoard()\n {\n this.gameBoard.innerHTML = \"\";\n let newStyle = \"grid-template-columns: repeat(\" + this.xSize + \", 1fr); grid-template-rows: repeat(\" + this.ySize + \", 1fr);\";\n this.gameBoard.setAttribute(\"style\", newStyle);\n\n for (let row = 0; row < this.ySize; row++)\n {\n for (let col = 0; col < this.xSize; col++)\n {\n let newTile = document.createElement(\"div\");\n if (((col+row) % 2) == 0)\n {\n newTile.className = \"tile\";\n }\n else\n {\n newTile.className = \"tile odd\";\n }\n\n newTile.setAttribute(\"data-x\", col);\n newTile.setAttribute(\"data-y\", row);\n \n let tileStyle = \"grid-row: \" + (row+1) + \"; grid-column: \" + (col+1) + \";\";\n newTile.setAttribute(\"style\", tileStyle);\n\n this.gameState[col][row].tile = newTile;\n this.gameBoard.appendChild(newTile);\n }\n \n }\n\n this.setUpTileListeners();\n }", "function init(){\n //clear the old values,turn,array,messages\n turn = \"\";\n grid = [[0,0,0],[0,0,0],[0,0,0]];\n boardMsg(\"\");\n $(\".col\").map(function() {\n $(this).text(\"\");\n }).get();\n hasWinner = 0;\n moveCount=0;\n}", "function initGrid() {\n row = [];\n for (var j = 0; j < GRID_H; j++) {\n\trow.push('');\n }\n grid = [];\n for (var i = 0; i < GRID_W; i++) {\n\tgrid.push(Array.from(row));\n }\n}", "function gameStart() {\n\n // Set all grid empty\n dataBoard = _.chain(new Array(ROWS * COLS))\n .fill(null)\n .chunk(COLS)\n .value();\n\n stage = new Stage();\n\n // Insert a new block\n createNewBlock();\n resetTimer();\n\n}", "function initGame() {\n\tdebugAlert(\"initGame\", false);\n\tif(gGameActive === true) return;\n\t\n\tgBoardRowCount = 8;//document.getElementById(\"row\").value;\n\tgBoardColumnCount = 6;//document.getElementById(\"column\").value;\n\t\n\t//Create the play area canvas and listeners\n\tgPlayAreaCanvas = createCanvas(getPlayAreaWidth(), getPlayAreaHeight());\n\tgPlayAreaCanvasDrawingContext = gPlayAreaCanvas.getContext(\"2d\");\n\taddListenerToElement(gPlayAreaCanvas,onMouseMovePlayArea,\"mousemove\");\n\taddListenerToElement(gPlayAreaCanvas,onMouseClickPlayArea,\"click\");\n\t\n\t//Create the tile chooser canvas and listeners\n\tgTileChooserCanvas = createCanvas(getTileLayoutWidth(), getTileLayoutHeight());\n\tgTileCanvasDrawingContext = gTileChooserCanvas.getContext(\"2d\");\n\taddListenerToElement(gTileChooserCanvas, onMouseClick,\"click\");\n\taddListenerToElement(gTileChooserCanvas, onDoubleClick,\"dblclick\");\n\taddListenerToElement(gTileChooserCanvas,onMouseMoveTileArea,\"mousemove\");\n\n\t//Create the tiles\n\tiRightElbow = new Image();\n\tiRightElbow.src = \"elbow.png\";\n\tiLeftElbow = new Image();\n\tiLeftElbow.src = \"elbow2.png\";\n\t\n\tiStraight = new Image();\n\tiStraight.src = \"straight.png\";\n\tiPlumber = new Image();\n\tiPlumber.src = \"plumber.jpg\";\n\tiToilet = new Image();\n\tiToilet.addEventListener(\"load\", function(){\n\t\t//after the resources are loaded start a new game\n\t\tflushHandle();\n\t\tnewGame();\n\t\tgGameActive = true;\n\t}, false);\n\tiToilet.src =\"toilet.png\";\n}", "function initialize() {\n // to initialize game \n setupSquares(numberOfSquares); // calls and sets up the colors & logic of game\n}", "constructor() {\n\t\tthis.grid = [];\n\t\tthis.rows = 0;\n\t\tthis.cols = 0;\n\t}", "function initialise() {\n\tboard = new Board();\n\n\tvar handler = createDiv();\n\thandler.parent('#bagh-chal');\n\thandler.id('handler');\n\n\t// --- Game Properties ---\n\tvar propertiesDiv = createDiv();\n\tpropertiesDiv.child(createElement('h3', 'Game'));\n\tpropertiesDiv.parent('#handler');\n\tpropertiesDiv.id('properties');\n\n\t// Turn\n\tvar turnSpan = createSpan('Turn: ');\n\tturnSpan.parent('#properties');\n\tturnSpan.child(turnP = createP('?'));\n\n\t// Goats In-Hand\n\tvar goatsInHandSpan = createSpan('Goats In-Hand: ');\n\tgoatsInHandSpan.parent('#properties');\n\tgoatsInHandSpan.child(goatsInHandP = createP('?'));\n\n\t// Goats Captured\n\tvar goatsCapturedSpan = createSpan('Goats Captured: ');\n\tgoatsCapturedSpan.parent('#properties');\n\tgoatsCapturedSpan.child(goatsCapturedP = createP('?'));\n\n\t// Tigers Trapped\n\tvar tigersTrappedSpan = createSpan('Tigers Trapped: ');\n\ttigersTrappedSpan.parent('#properties');\n\ttigersTrappedSpan.child(tigersTrappedP = createP('?'));\n\n\t// Status\n\tvar statusSpan = createSpan('Status: ');\n\tstatusSpan.parent('#properties');\n\tstatusSpan.child(statusP = createP('Running').class('running'));\n\n\t// --- Controls ---\n\tvar controlsDiv = createDiv();\n\tcontrolsDiv.parent('#handler');\n\tcontrolsDiv.id('controls');\n\tcontrolsDiv.child(createElement('h3', 'Controls'));\n\n\t// Game Mode\n\tcontrolsDiv.child(gameMode = createSelect());\n\tgameMode.option('Game Mode');\n\tgameMode.option('Player vs Player', 0);\n\tgameMode.option('Player vs AI', 1);\n\tgameMode.option('AI vs AI', 2);\n\tgameMode.value(1);\n\tgameMode.changed(updateHandler);\n\n\t// Play As\n\tcontrolsDiv.child(playAsSelect = createSelect());\n\tplayAsSelect.option('Play As');\n\tplayAsSelect.option('Tiger', 0);\n\tplayAsSelect.option('Goat', 1);\n\tplayAsSelect.value(playAsTiger ? 0 : 1);\n\tplayAsSelect.changed(changePlayAs);\n\n\t// Goat Algorithm/Depth\n\tcontrolsDiv.child(goatP = createP('Goat'));\n\tcontrolsDiv.child(goatAlgorithm = createSelect());\n\tgoatAlgorithm.option('Algorithm');\n\tgoatAlgorithm.option('Minimax', 0);\n\tgoatAlgorithm.option('Alpha-Beta', 1);\n\tgoatAlgorithm.option('MCTS', 2);\n\tgoatAlgorithm.value(1);\n\tgoatAlgorithm.changed(updateHandler);\n\n\tcontrolsDiv.child(goatDepth = createSelect());\n\tgoatDepth.option('Depth');\n\tgoatDepth.option('Depth 1 (Very Easy)', 1);\n\tgoatDepth.option('Depth 2 (Easy)', 2);\n\tgoatDepth.option('Depth 3 (Moderate)', 3);\n\tgoatDepth.option('Depth 4 (Hard)', 4);\n\tgoatDepth.option('Depth 5 (Very Hard)', 5);\n\tgoatDepth.value(3);\n\tgoatDepth.changed(reset);\n\n\tcontrolsDiv.child(goatTime = createSelect());\n\tgoatTime.option('Time');\n\tgoatTime.option('2s', 2);\n\tgoatTime.option('4s', 4);\n\tgoatTime.option('6s', 6);\n\tgoatTime.option('8s', 8);\n\tgoatTime.option('10s', 10);\n\tgoatTime.value(2);\n\tgoatTime.changed(reset);\n\n\t// Tiger Algorithm/Depth\n\tcontrolsDiv.child(tigerP = createP('Tiger'));\n\tcontrolsDiv.child(tigerAlgorithm = createSelect());\n\ttigerAlgorithm.option('Algorithm');\n\ttigerAlgorithm.option('Minimax', 0);\n\ttigerAlgorithm.option('Alpha-Beta', 1);\n\ttigerAlgorithm.option('MCTS', 2);\n\ttigerAlgorithm.value(1);\n\ttigerAlgorithm.changed(updateHandler);\n\n\tcontrolsDiv.child(tigerDepth = createSelect());\n\ttigerDepth.option('Depth');\n\ttigerDepth.option('Depth 1 (Very Easy)', 1);\n\ttigerDepth.option('Depth 2 (Easy)', 2);\n\ttigerDepth.option('Depth 3 (Moderate)', 3);\n\ttigerDepth.option('Depth 4 (Hard)', 4);\n\ttigerDepth.option('Depth 5 (Very Hard)', 5);\n\ttigerDepth.value(3);\n\ttigerDepth.changed(reset);\n\n\tcontrolsDiv.child(tigerTime = createSelect());\n\ttigerTime.option('Time');\n\ttigerTime.option('2s', 2);\n\ttigerTime.option('4s', 4);\n\ttigerTime.option('6s', 6);\n\ttigerTime.option('8s', 8);\n\ttigerTime.option('10s', 10);\n\ttigerTime.value(2);\n\ttigerTime.changed(reset);\n\n\t// Delay\n\tdelaySpan = createSpan('Min. Simulation Delay');\n\tdelaySpan.parent('#controls');\n\tdelaySpan.child(delaySlider = createSlider(0, 500, 250));\n\n\t// Reset\n\tcontrolsDiv.child(resetButton = createButton('Reset'));\n\tresetButton.mousePressed(reset);\n\n\t// Pause\n\tcontrolsDiv.child(pauseButton = createButton('Pause'));\n\tpauseButton.mousePressed(togglePause);\n\n\t// --- AI Debugging ---\n\tdebuggingDiv = createDiv();\n\tdebuggingDiv.parent('#handler');\n\tdebuggingDiv.id('debugging');\n\tdebuggingDiv.child(createElement('h3', 'AI Debugging'));\n\n\t// Iterations\n\tvar iterationsSpan = createSpan('Iterations: ');\n\titerationsSpan.parent('#debugging');\n\titerationsSpan.child(countP = createP('?'));\n\n\t// Time\n\tvar timeSpan = createSpan('Time to Run: ');\n\ttimeSpan.parent('#debugging');\n\ttimeSpan.child(timeP = createP('?'));\n\n\t// Score\n\tvar scoreSpan = createSpan('Score/Wins: ');\n\tscoreSpan.parent('#debugging');\n\tscoreSpan.child(scoreP = createP('?'));\n\n\t// Tiger Wins\n\t//var scoreSpan = createSpan('Tiger Wins: ');\n\t//scoreSpan.parent('#debugging');\n\t//scoreSpan.child(tigerWinsP = createP('?'));\n\n\t// Goat Wins\n\t//var scoreSpan = createSpan('Goat Wins: ');\n\t//scoreSpan.parent('#debugging');\n\t//scoreSpan.child(goatWinsP = createP('?'));\n\n\t// Draws\n\t//var scoreSpan = createSpan('Draws: ');\n\t//scoreSpan.parent('#debugging');\n\t//scoreSpan.child(drawsP = createP('?'));\n\n\t// Update what's disabled/hidden\n\t$('select > option:first-child').attr('disabled', true);\n\tupdateHandler();\n}", "function createGrid() {\n\n const frame = null; // get a reference to the frame\n\n // Add Code to create the game grid\n for (let i = 0; i < 10 ; i++) {\n buildRow(frame); \n }\n resetGame();\n}", "function init() {\n\t\tvar board = $(\"<table border=0 cellspacing=0>\"),\n\t\t\tidentifier = 1;\n\t\tfor (var i = 0; i < N_SIZE; i++) {\n\t\t\tvar row = $(\"<tr>\");\n\t\t\tboard.append(row);\n\t\t\tfor (var j = 0; j < N_SIZE; j++) {\n\t\t\t\tvar cell = $(\"<td height=120 width=120 align=center valign=center></td>\");\n\t\t\t\tcell.addClass('col' + j).addClass('row' + i);\n\t\t\t\tif (i == j) {\n\t\t\t\t\tcell.addClass('diagonal0');\n\t\t\t\t}\n\t\t\t\tif (j == N_SIZE - i - 1) {\n\t\t\t\t\tcell.addClass('diagonal1');\n\t\t\t\t}\n\t\t\t\tcell[0].identifier = identifier;\n\t\t\t\tcell.click(set);\n\t\t\t\trow.append(cell);\n\t\t\t\tboxes.push(cell);\n\t\t\t\tidentifier += identifier;\n\t\t\t}\n\t\t}\n\n\t\t$(document.getElementById(\"tictactoe\") || document.body).append(board);\n\t\tstartNewGame();\n\t}", "init() {\n //this.raster.width = this.spriteWidth;\n //this.raster.height = this.spriteWidth;\n this.updatePosition(this.gridX, this.gridY);\n }", "function init() {\n\t\tscore = 0;\n\t\tclearScreen();\n\t\tspeed = DEFAULT_SPEED;\n\t\twell = new gameWell();\n\t\tactBlock = newActBlock();\n\t\tactBlock.draw();\n\t\tnextBlock.draw();\n\t}", "function initGame() {\n players = [];\n teams = [];\n orbs = [];\n bases = [];\n createOrbs(defaultOrbs);\n createBases(defaultBases);\n}", "function initGameData () {\n $(\"#result_span\").text(\"\");\n closebyDistance = 1;\n centerIndex = indexFromCoordinates(trunc(boardDimension/2), trunc(boardDimension/2));\n numSquares = boardDimension*boardDimension;\n gameBoard = E.repeat(numSquares); \n gameInTurn = 0; \n gameMovesMade = 0;\n gameResult = null; \n gameIsPlayerToMove = true; \n nodeHash = {};\n nodeHash[gameBoard] = {result:0, visited:0, evaluation:null}; \n engineMoveOrder = [];\n thinkingTimeChangeHandler();\n }", "handleResetGrid (e) {\n const resetBasic = [\n [0,0,0,0,0,0],\n [0,0,0,0,0,0],\n [0,0,0,0,0,0],\n [0,0,0,0,0,0],\n [0,0,0,0,0,0],\n [0,0,0,0,0,0],\n [0,0,0,0,0,0]\n ]\n\n this.setState({\n basic: resetBasic,\n player1 : 0,\n player2 : 0,\n joueur : true\n })\n }", "updateGridStates() {\n const newGridStates = _.times(this.state.boardHeight, (rowIdx) => {\n return _.times(this.state.boardWidth, (colIdx) => {\n const northRowIdx = this.wrapHeight(rowIdx - 1);\n const southRowIdx = this.wrapHeight(rowIdx + 1);\n const eastColIdx = this.wrapWidth(colIdx + 1);\n const westColIdx = this.wrapWidth(colIdx - 1);\n const neighbors = [\n // North\n this.state.gridStates[northRowIdx][colIdx],\n // North-east\n this.state.gridStates[northRowIdx][eastColIdx],\n // North-west\n this.state.gridStates[northRowIdx][westColIdx],\n // South\n this.state.gridStates[southRowIdx][colIdx],\n // South-east\n this.state.gridStates[southRowIdx][eastColIdx],\n // South-west\n this.state.gridStates[southRowIdx][westColIdx],\n // East\n this.state.gridStates[rowIdx][eastColIdx],\n // West\n this.state.gridStates[rowIdx][westColIdx]\n ];\n const numLiveNeighbors = _.sum(neighbors);\n const isAlive = this.state.gridStates[rowIdx][colIdx];\n const nextLife = isAlive ? numLiveNeighbors === 2 || numLiveNeighbors === 3 : numLiveNeighbors === 3;\n return Number(nextLife);\n });\n });\n this.setState({gridStates: newGridStates}, () => {\n console.log('updated state');\n setTimeout(this.updateGridStates.bind(this), this.state.iterationSleep);\n });\n }", "function init(difficulty) {\r\n\r\n // set stat fields\r\n setTowerStatFields();\r\n\r\n // Model\r\n game = new Game(difficulty);\r\n \r\n // update all game pieces\r\n update();\r\n // draw all updated piecesw\r\n draw();\r\n\r\n pausePanel.setPanel('pause');\r\n\r\n gameboard.style.display = 'flex';\r\n\r\n}", "startGame(){\n this.setState({\n //game has been started\n gameSelected: true, \n //board is empty \n boardState: new Array(7).fill(new Array(6).fill(null)),\n // full set back to 0\n full:0\n })\n }", "function initGrid()\n {\n for (var i = 0; i < GRIDSIZE ; i++)\n {\n GRID[i] = new Array(GRIDSIZE);\t\t// each element is an array\n mazeObjects[i] = new Array(GRIDSIZE); //also make the array that tracks maze objects 2d\n agentMap['lineOfSight'][i] = new Array(GRIDSIZE); //also make the agent's lineOfSight array 2d\n enemyMap['lineOfSight'][i] = new Array(GRIDSIZE); //also make the enemy's lineOfSight array 2d\n\n for (var j = 0; j < GRIDSIZE ; j++)\n {\n GRID[i][j] = GRID_BLANK ;\n }\n }\n }", "function setup() {\n\t//reset gridcontainer each time button is pressed\n\tdocument.getElementById('gameboard').innerHTML = '';\n\t\n\t// get user input\n\tvar rows = parseInt(document.getElementById('numrows').value, 10);\n\tvar cols = parseInt(document.getElementById('numcols').value, 10);\n\t\n\t// create and setup the game board\n\tgame = new BattleshipGame(rows, cols, 50, document.getElementById(\"gameboard\"));\n\tconsole.log('Set up new game with a ' + rows + ' by ' + cols + ' board.');\n\tconsole.log(game);\n}", "function loadState(){\n var state = $.deparam.fragment();\n grid = state.grid;\n \n if(typeof state.variant !== \"undefined\"){\n options.variant = state.variant;\n }\n \n if(typeof state.level !== \"undefined\"){\n options.level = state.level;\n } else {\n options.level = 1;\n }\n \n $theInputs = $('.game-cell-input');\n $theInputs.each(function(){ // iterate over each input, putting saved value in.\n var num = $(this).data('num');\n if(typeof grid !== \"undefined\" && typeof grid[num] !== \"undefined\" && grid[num] !== \"\"){\n $(this).val( grid[num].val );\n $(this).data('special', grid[num].special );\n } else {\n $(this).val('');\n $(this).data('special', 0 );\n }\n decorateInput($(this));\n });\n \n $('#level').val(options.level);\n }", "function initLogic()\n{\n\t/*\n\t * Player\n\t */\n\t\n\tvar S = new vector(80, 150);\n\tvar V = new vector(0, 0);\n\tvar A = new vector(0, 0);\n\tvar mass = 10;\n\tvar e = 0;\n\tplayer = new SpritePlayer(S, V, A, SIZE_DOT, mass, e);\n\n\t/*\n\t * Level\n\t */\n\n\tobjs_static = new Array();\n\tobjs_dynamic = new Array();\n\tgates = new Array();\n\tbg_images = new Array();\n\t\n\t//state.initLevel();\n\t//initLevelTwo();\n}", "function newGame(){\r\n\tgrid = new Array(size);\r\n\tstoreGrid = new Array(size); \r\n\tcreateGrid(); \r\n\tfillRandomPlaces();\r\n\tfillRandomPlaces();\r\n\tscore = 0;\r\n\tgridDisplay();\r\n\t\r\n}", "function initGame() {\r\n console.log(\"Init Game\");\r\n version.innerText = application.version;\r\n grid.innerHTML = TemplateForGrid();\r\n miniSquaresInit();\r\n gameOverDiv.style.display = \"none\";\r\n scoreInit();\r\n gameTimer.stop();\r\n currentPosition = 4;\r\n currentRotation = 0;\r\n random = Math.floor(Math.random() * theTetrominoes.length);\r\n nextRandom = Math.floor(Math.random() * theTetrominoes.length);\r\n current = theTetrominoes[random][currentRotation];\r\n nextRotatedCurrent = theTetrominoes[random][nextRotation];\r\n startBtn.innerHTML = \"▶ START\";\r\n deactivateGameButtons();\r\n rewardPicDivSetHeight(0);\r\n rewardPicDivSetBackground();\r\n rewardCheckBox.checked = checkRewardExtra();\r\n weird.checked = checkWeirdMode();\r\n}", "constructor() {\n // GameBoard constants\n this.numRows = 6;\n this.numCols = 5;\n\n // Initialize game entities\n this.allEnemies = [];\n\n // Start new game\n this.setInputHandler();\n this.startGame();\n }", "function playGame() {\n if (game) {\n board.updateGrid();\n }\n}", "function setup_initial_world()\n {\n // Generate empty world.\n for (var x = 0; x < worldWidth; x++) {\n worldGrid[x] = [];\n for (var y = 0; y < worldHeight; y++) {\n worldGrid[x][y] = {\n // Tile\n tile: blocks.EMPTY,\n // Center position\n pos: vec2(x + 0.5, y + 0.5)\n }\n }\n }\n\n // ------------ //\n // Update tiles //\n // ------------ //\n // Create ground\n for (var x = 0; x < worldWidth; x++) {\n for (var y = 0; y < Math.floor(worldHeight/3); y++) {\n worldGrid[x][y].tile = blocks.DIRT;\n }\n }\n\n // Create grass\n for (var x = 0; x < worldWidth; x++) {\n var y = Math.floor(worldHeight/3);\n worldGrid[x][y].tile = blocks.GRASS;\n worldGrid[x][y+1].tile = blocks.GRASS;\n }\n\n // Create lake\n for (var x = Math.floor(worldWidth/4*2); x < Math.floor(worldWidth/4*3); x++) {\n var y = Math.floor(worldHeight/3);\n worldGrid[x][y+1].tile = blocks.WATER;\n }\n\n // Create fire/lava pit\n for (var x = 0; x < Math.floor(worldWidth/4); x++) {\n var y = Math.floor(worldHeight/3);\n worldGrid[x][y+1].tile = blocks.FIRE;\n }\n }", "function initGame(){\n gamemode = document.getElementById(\"mode\").checked;\n \n fadeForm(\"user\");\n showForm(\"boats\");\n \n unlockMap(turn);\n \n player1 = new user(document.user.name.value);\n player1.setGrid();\n \n turnInfo(player1.name);\n bindGrid(turn);\n}", "function initialiseGame() {\n enableAnswerBtns();\n hideGameSummaryModal();\n showGameIntroModal();\n selectedStories = [];\n score = 0;\n round = 1;\n resetGameStats();\n}", "function init() {\n // declared board array to null with 9 indexes\n boardArray = [null, null, null, null, null, null, null, null, null]\n // declare player to start \n whoseTurn = 1 //player x goes first\n //set winner to null\n winner = null \n //added rest button here to allow user to start over at any point in the game\n resetBtn.addEventListener('click', resetBoard)\n render()\n}", "function init() {\n stage = new createjs.Stage(document.getElementById(\"gameCanvas\"));\n game = new createjs.Container();\n stage.enableMouseOver(20);\n createjs.Ticker.setFPS(60);\n createjs.Ticker.addEventListener(\"tick\", gameLoop);\n optimizeForMobile();\n\n // When game begins, current state will be opening menu (MENU_STATE)\n //scoreboard = new objects.scoreBoard(stage, game);\n currentState = constants.MENU_STATE;\n changeState(currentState);\n}", "function initBoard(game) {\n for (var i = 0; i < COLUMN; i++) {\n game.board[i] = new Array(ROW);\n for(var y=0; y < ROW; y++){\n // genere des tiles aleatoire dans tour le tableau\n generateTile(game, new Coord(i, y));\n }\n }\n\n destroyTiles(game);\n\n for (i = 0; i < COLUMN; i++) {\n for(y=0; y < ROW; y++){\n drawTile(game.board[i][y]);\n }\n }\n\n}", "function initGame (){\n\n resetData();\n \n //Update content\n\n \n //Pick a new country and display info\n pickCountry();\n getcountryText();\n UpdateContent();\n\n //hide background image\n\n dispGame.classList.add(\"gameStarted\");\n dispGame.style.display = \"block\";\n dispGame.style.visibility = \"visible\";\n \n //hide start button\n startGame.style.display = \"none\";\n\n //Set isGameOver to false\n isgameOver = false;\n\n}" ]
[ "0.76835823", "0.76126724", "0.7605477", "0.76018506", "0.75706553", "0.7456369", "0.742831", "0.73816085", "0.7258723", "0.7241117", "0.7238877", "0.7231902", "0.72068304", "0.7197604", "0.7173652", "0.71724117", "0.7141281", "0.7123744", "0.7064598", "0.70569474", "0.703101", "0.7023153", "0.70069", "0.69803125", "0.69731915", "0.6968132", "0.6967904", "0.6962666", "0.6941501", "0.6932102", "0.69186354", "0.69163877", "0.69044065", "0.6893639", "0.6891813", "0.6890703", "0.68646985", "0.6861276", "0.68362254", "0.68309665", "0.6822744", "0.6805236", "0.68036515", "0.67917925", "0.6782825", "0.6778473", "0.6777684", "0.67769605", "0.67706126", "0.6769963", "0.6766468", "0.67616016", "0.6755918", "0.6753158", "0.6736477", "0.6733945", "0.6725948", "0.6724832", "0.6724788", "0.670537", "0.6703439", "0.6698461", "0.6694668", "0.66827667", "0.6675171", "0.66698134", "0.6668759", "0.6662343", "0.66610396", "0.6657067", "0.66488475", "0.6634791", "0.6629376", "0.66201556", "0.66152877", "0.66132325", "0.661007", "0.66066766", "0.660509", "0.6598163", "0.659547", "0.65954614", "0.6591867", "0.6590917", "0.65907866", "0.65804976", "0.658026", "0.6576898", "0.65768284", "0.6576206", "0.65729713", "0.6565954", "0.6564378", "0.65636796", "0.6556007", "0.6553332", "0.6550813", "0.6546946", "0.65390134", "0.65351534" ]
0.67686355
50
update the game's grid asynchronously.
function tick() { var interval = 40, //TODO: parameterize for user to throttle speed canvas = this.canvas, grid = this.grid; var runStep = function () { draw(canvas, grid); grid = nextStep(grid); }; this.isRunning = setInterval(runStep, interval); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateCellsFuture() {\n let allDeath = true;\n for(let row = 0; row < this.rowSize; row++) {\n for(let cell = 0; cell < this.colSize; cell++) {\n this.grid[row][cell].alive = this.grid[row][cell].willLive; \n if ( this.grid[row][cell].alive ) {\n allDeath = false;\n }\n }\n }\n /* If all cells are Death, Stop de game and enable flag to show an Alert on Screen*/\n if (allDeath) {\n this.stopGame();\n this.gameOver = true;\n }\n }", "function updateGrid() {\n let update = makeGrid(cols, rows);\n for (let i = 0; i < cols; i++) {\n for (let j = 0; j < rows; j++) {\n let neighbors = countLiveNeighbors(grid, i, j);\n let currentState = grid[i][j];\n if (currentState === 0 && neighbors === 3) {\n update[i][j] = 1;\n } else if (currentState === 1 && neighbors === 2 || currentState === 1 && neighbors === 3) {\n update[i][j] = 1;\n } else if (currentState === 1 && neighbors < 2 || currentState === 1 && neighbors > 3) {\n update[i][j] = 0;\n } else {\n update[i][j] = currentState;\n }\n }\n }\n grid = update;\n}", "function updateGrid() {\n for (const gridRef of this.spriteGrid) {\n const playerInPos = playerInGridPosition.call(this, gridRef.gridPos);\n const powerUpInPos = powerUpInGridPosition.call(this, gridRef.gridPos);\n\n if (playerInPos !== null) {\n const playerDef = SNAKE_GAME_CONFIG.playerDefs[playerInPos];\n const playerState = this.playerStates[playerInPos];\n if (playerState.alive) {\n gridRef.sprite.tint = playerDef.colour;\n } else {\n gridRef.sprite.tint = playerDef.deadColour;\n }\n } else if (powerUpInPos) {\n gridRef.sprite.tint = SNAKE_GAME_CONFIG.powerUpColour;\n } else {\n gridRef.sprite.tint = SNAKE_GAME_CONFIG.emptyTileColour;\n }\n }\n}", "update() {\n if(this.options.onUpdate && typeof this.options.onUpdate === 'function')\n this.options.onUpdate.call();\n\n this.rows = [];\n this._updateGridRows();\n this._updatePositions();\n\n if(this.options.onUpdated && typeof this.options.onUpdated === 'function')\n this.options.onUpdated.call();\n }", "function playGame() {\n if (game) {\n board.updateGrid();\n }\n}", "function staticUpdateCells(grid) {\r\n var new_canvas = getCanvas();\r\n for (var i = 0; i < NUM_ROWS; i += 1) {\r\n for (var j = 0; j < NUM_COLS; j += 1) {\r\n new_canvas.fillStyle = grid[i][j].fillStyle;\r\n new_canvas.fillRect(grid[i][j].xPosition, grid[i][j].yPosition, CELL_SIZE, CELL_SIZE);\r\n }\r\n }\r\n }", "run() {\n //run the grid logic\n this.updateMouseValues();\n this.updateGridValues();\n this.renderModules();\n }", "async update() {}", "function updateGraphics(gameGridObj)\n{\n drawGame();\n}", "function startUpdatingGrids() {\n\tsetTimeout('updateGridRow1Col1()', updateDelay+100);\n\tsetTimeout('updateGridRow1Col2()', updateDelay+200);\n\tsetTimeout('updateGridRow2Col1()', updateDelay+300);\n\tsetTimeout('updateGridRow2Col2()', updateDelay+400);\t\n}", "updateGrid() {\n if (this.moved) {\n let updateGrid = new Array(this.size * this.size).fill(null)\n this.grid.forEach(element => {\n if (element) {\n if (element.remove)\n return\n if (element.merge) {\n element.value *= 2\n element.merge = false\n this.score += element.value\n //if merge value 2048 then game over\n if (element.value === 2048)\n this.gameWon = true\n }\n updateGrid[element.position] = element\n }\n\n });\n this.grid = [...updateGrid]\n this.bestScore = this.score > this.bestScore ? this.score : this.bestScore\n this.addTile()\n this.gameOver = this.isGameOver();\n this.writeToStorage()\n this.moved=false\n }\n }", "refresh(){\n this.grid = [] ;\n for( var i = 0 ; i < columns ; ++i ){\n this.grid[i] = [] ;\n for( var j = 0 ; j < rows ; ++j ){\n this.grid[i][j] = { bool: false , color: \"#fff\" } ;\n }\n }\n this.inPlay = false ;\n this.alive = true ;\n }", "function update() {\n previousGeneration = copyArray(pixelGrid);\n for (let i = 0; i < numCellsX; i++) {\n for (let j = 0; j < numCellsY; j++) {\n // If the cell should live in the next generation\n if(shouldLive(i, j)) {\n pixelGrid[i][j] = 1;\n } else {\n pixelGrid[i][j] = 0;\n }\n }\n }\n}", "updateGridStates() {\n const newGridStates = _.times(this.state.boardHeight, (rowIdx) => {\n return _.times(this.state.boardWidth, (colIdx) => {\n const northRowIdx = this.wrapHeight(rowIdx - 1);\n const southRowIdx = this.wrapHeight(rowIdx + 1);\n const eastColIdx = this.wrapWidth(colIdx + 1);\n const westColIdx = this.wrapWidth(colIdx - 1);\n const neighbors = [\n // North\n this.state.gridStates[northRowIdx][colIdx],\n // North-east\n this.state.gridStates[northRowIdx][eastColIdx],\n // North-west\n this.state.gridStates[northRowIdx][westColIdx],\n // South\n this.state.gridStates[southRowIdx][colIdx],\n // South-east\n this.state.gridStates[southRowIdx][eastColIdx],\n // South-west\n this.state.gridStates[southRowIdx][westColIdx],\n // East\n this.state.gridStates[rowIdx][eastColIdx],\n // West\n this.state.gridStates[rowIdx][westColIdx]\n ];\n const numLiveNeighbors = _.sum(neighbors);\n const isAlive = this.state.gridStates[rowIdx][colIdx];\n const nextLife = isAlive ? numLiveNeighbors === 2 || numLiveNeighbors === 3 : numLiveNeighbors === 3;\n return Number(nextLife);\n });\n });\n this.setState({gridStates: newGridStates}, () => {\n console.log('updated state');\n setTimeout(this.updateGridStates.bind(this), this.state.iterationSleep);\n });\n }", "_update() {\n this._tick++;\n\n // Move every snake in the shard\n _.forEach(this._players, (player) => {\n if (player.isAlive) {\n this._move(player);\n }\n });\n\n // Regenerate food that was eaten or blocked\n var diff = this.foodLimit - this.foodCount;\n var blockers = internals.createBlockersGrid(this._grid.width, this._grid.height, this._players);\n for (var i = 0; i < diff; i++) {\n internals.createFood(this._grid, this._grid.merge(blockers));\n }\n\n // Update the grid of every player\n _.forEach(this._players, (player) => {\n this._updatePlayer(player, false);\n });\n }", "function refreshUI() {\r\n //refresh boards\r\n let rows = game.ROWS;\r\n let cols = game.COLS;\r\n for (let row = 0; row < rows; row++) {\r\n for (let col = 0; col < cols; col++) {\r\n\r\n //refresh CPU board\r\n let cpu = $(`#cpu [data-row=${row}][data-col=${col}]`);\r\n switch (game.cpuBoard()[col][row]) {\r\n case game.FIELD_HIT:\r\n cpu.css('background', 'green');\r\n break;\r\n case game.FIELD_MISS:\r\n cpu.css('background', 'red');\r\n break;\r\n default:\r\n cpu.css(\"background\", \"white\");\r\n }\r\n\r\n //refresh Player board\r\n let player = $(`#player [data-row=${row}][data-col=${col}]`);\r\n switch (game.playerBoard()[col][row]) {\r\n case game.FIELD_EMPTY:\r\n player.css(\"background\", \"white\");\r\n break;\r\n case game.FIELD_SHIP:\r\n player.css(\"background\", \"black\");\r\n break;\r\n case game.FIELD_HIT:\r\n player.css(\"background\", \"green\");\r\n break;\r\n case game.FIELD_MISS:\r\n player.css(\"background\", \"red\");\r\n break;\r\n }\r\n }\r\n }\r\n\r\n //update counters\r\n $(\".playerCounter\").val(game.playerLeft());\r\n $(\".cpuCounter\").val(game.cpuLeft());\r\n }", "update() {\n this.drawBoard();\n }", "function update_grid() {\n clear();\n background(255);\n draw_grid( 25, 8, 'black');\n if (valid_pt && valid_pass) {\n textSize(g_canvas.cell_size);\n textFont('Courier New');\n print_chunks(chunked, g_sz - 1);\n print_chunks(encrypted, 2 * g_sz + 4);\n print_chunks(decrypted, 3 * g_sz + 9);\n }\n}", "function updateCells(grid) {\r\n updateLiveNeighbors(grid); // update neighbour\r\n var new_canvas = getCanvas();\r\n for (var i = 0; i < NUM_ROWS; i += 1) {\r\n for (var j = 0; j < NUM_COLS; j += 1) {\r\n\r\n // determine which cells should be drawn on canvas according\r\n // to what is drawn on it at the moment when the function is called\r\n\r\n var num = grid[i][j].liveNeighbors;\r\n var inf = grid[i][j].infectedNeighbors;\r\n var mine = grid[i][j].variation === \"mine\";\r\n var pacman = grid[i][j].variation === \"pacman\" ||\r\n grid[i][j].variation === \"pacmanCore\";\r\n var snake = grid[i][j].variation === \"snakeHead\" ||\r\n grid[i][j].variation === \"snakeTail\";\r\n\r\n //treat a cell that was created by clicking as a regular one \r\n if (grid[i][j].userClick) {\r\n grid[i][j].userClick = false;\r\n } \r\n\r\n //turn hot explosion particles into regular ones\r\n //and regular ones to dead cells\r\n if (grid[i][j].variation === \"explosion\") {\r\n explosion_soundEft = document.getElementById(\"explosion_soundEft\");\r\n explosion_soundEft.play();\r\n grid[i][j].ticker -= 1;\r\n\r\n if (grid[i][j].fillStyle === CELL_EXPL_HOT_COLOR &&\r\n grid[i][j].ticker === 1) {\r\n grid[i][j].fillStyle = CELL_EXPLOSION_COLOR;\r\n grid[i][j].fillStyle = CELL_EXPLOSION_COLOR;\r\n }\r\n\r\n if (grid[i][j].ticker === 0) {\r\n grid[i][j].variation = \"normal\";\r\n grid[i][j].fillStyle = CELL_DEAD_COLOR;\r\n }\r\n }\r\n\r\n // if cell is not of a special kind\r\n // check if cell is alive or dead and determine\r\n // whether it is infected or not\r\n if (!(mine) && !(pacman) && !snake) {\r\n //kill cell if it is over/underpopulated\r\n if (!(grid[i][j].dead) && ((num != 2) && (num != 3))) {\r\n grid[i][j].dead = true;\r\n grid[i][j].fillStyle = CELL_DEAD_COLOR;\r\n grid[i][j].variation = \"normal\";\r\n }\r\n\r\n //make cell alive if there are exactly 3 neighbors\r\n //if it has infected neighbors then it might be infected \r\n //as well with a certain probability\r\n if (grid[i][j].dead && num === 3) {\r\n rand = Math.floor(Math.random() * 191869) % 100;\r\n grid[i][j].dead = false;\r\n if (inf === 0) {\r\n grid[i][j].fillStyle = CELL_ALIVE_COLOR;\r\n }\r\n if (inf === 1) {\r\n if (rand <= 32 + VIRULENCE) {\r\n grid[i][j].variation = \"infected\";\r\n grid[i][j].fillStyle = CELL_INFECTED_COLOR;\r\n }\r\n else {\r\n grid[i][j].fillStyle = CELL_ALIVE_COLOR;\r\n }\r\n }\r\n if (inf === 2) {\r\n if (rand <= 65 + 2*VIRULENCE) {\r\n grid[i][j].variation = \"infected\";\r\n grid[i][j].fillStyle = CELL_INFECTED_COLOR;\r\n }\r\n else {\r\n grid[i][j].fillStyle = CELL_ALIVE_COLOR;\r\n }\r\n }\r\n if (inf === 3) {\r\n if (rand <= Math.min(98, 98 + VIRULENCE)) {\r\n grid[i][j].variation = \"infected\";\r\n grid[i][j].fillStyle = CELL_INFECTED_COLOR;\r\n }\r\n else {\r\n grid[i][j].fillStyle = CELL_ALIVE_COLOR;\r\n }\r\n }\r\n \r\n }\r\n }\r\n\r\n if (mine) {\r\n //mine is started if its ticker is smaller than the original value\r\n var start = grid[i][j].ticker < EXPLOSION_DELAY;\r\n\r\n //mine obeys the same laws as regular cell\r\n if (!(grid[i][j].dead) && ((num != 2) && (num != 3))) {\r\n grid[i][j].dead = true;\r\n }\r\n if (grid[i][j].dead && num === 3) {\r\n grid[i][j].dead = false;\r\n }\r\n\r\n //start the mine if there is a cell grown on it\r\n //decrement the ticker every generation after\r\n if ((start) || (!(grid[i][j].dead))) {\r\n grid[i][j].ticker -= 1;\r\n }\r\n\r\n //change mine's color to create blinking effect\r\n if (start || !grid[i][j].dead) {\r\n if (grid[i][j].ticker % 2 === 1) {\r\n grid[i][j].fillStyle = CELL_MINE1_COLOR;\r\n }\r\n else {\r\n grid[i][j].fillStyle = CELL_MINE2_COLOR;\r\n }\r\n }\r\n\r\n //explode the mine as ticker reaches 0\r\n if (grid[i][j].ticker === 0) {\r\n for (var i2 = 0; i2 < NUM_ROWS; i2 += 1) {\r\n for (var j2 = 0; j2 < NUM_COLS; j2 += 1) {\r\n var distance = Math.sqrt((i2 - i) * (i2 - i) \r\n + (j2 - j) * (j2 - j));\r\n //mine itself and every cell within the explosion range\r\n //but not the other mines is turned into explosion\r\n if (distance <= EXPLOSION_RANGE \r\n && validPosition(i2, j2) \r\n && !(grid[i2][j2].variation === \"mine\" &&\r\n !(i === i2 && j === j2))) {\r\n grid[i2][j2].variation = \"explosion\";\r\n grid[i2][j2].dead = true;\r\n grid[i2][j2].fillStyle = CELL_EXPLOSION_COLOR;\r\n if (grid[i2][j2].uniqID === ID_IN_CONTROL) {\r\n ID_IN_CONTROL = 0;\r\n }\r\n \r\n //program operates by going row by row\r\n //so adjust to the cells that were \r\n //processed previously\r\n if ((i2 > i) || ((i2 === i) && (j2 > j))) {\r\n grid[i2][j2].ticker = 2;\r\n }\r\n else {\r\n grid[i2][j2].ticker = 1;\r\n }\r\n \r\n //create hot particles of explosion\r\n //more hot particles near to the center\r\n rand1 = Math.random();\r\n rand2 = Math.floor(Math.random() \r\n * 191869) % EXPLOSION_RANGE;\r\n if (distance < rand2 && rand1 > 0.5) {\r\n grid[i2][j2].ticker += 1;\r\n grid[i2][j2].fillStyle = CELL_EXPL_HOT_COLOR;\r\n }\r\n\r\n //update canvas\r\n new_canvas.fillStyle = grid[i2][j2].fillStyle;\r\n new_canvas.fillRect(grid[i2][j2].xPosition, \r\n grid[i2][j2].yPosition, CELL_SIZE, CELL_SIZE);\r\n } \r\n\r\n //explosion chain reaction\r\n //activate mines within explosion range\r\n if (distance <= EXPLOSION_RANGE && \r\n grid[i2][j2].variation === \"mine\" &&\r\n grid[i2][j2].ticker === EXPLOSION_DELAY) {\r\n grid[i2][j2].ticker = 2;\r\n //adjust to row-by-row movement of program\r\n if ((i2 > i) || ((i2 === i) && (j2 > j))) {\r\n grid[i2][j2].ticker = 3;\r\n }\r\n grid[i2][j2].fillStyle = CELL_MINE2_COLOR;\r\n staticUpdateCells(grid);\r\n }\r\n }\r\n }\r\n //some cells could die, so update neighbors\r\n updateLiveNeighbors(grid);\r\n }\r\n }\r\n\r\n if (grid[i][j].variation === \"pacmanCore\") {\r\n //pacman switches between open and notopen\r\n //every generations\r\n var isOpen = false;\r\n if (grid[i][j].ticker % 6 <= 2) {\r\n isOpen = true;\r\n }\r\n\r\n //draw pacman, its column depends\r\n //on ticker which is incremented every generation\r\n drawPacman(grid, i, grid[i][j].ticker, isOpen);\r\n grid[i][j].ticker += 1; \r\n //kill pacman when the end is reached\r\n if (grid[i][j].ticker === NUM_COLS + 1) {\r\n grid[i][j].variation = \"normal\";\r\n grid[i][j].ticker = 0;\r\n }\r\n\r\n //pacman core behaves as if it a regular cell\r\n if (!(grid[i][j].dead) && ((num != 2) && (num != 3))) {\r\n grid[i][j].dead = true;\r\n grid[i][j].fillStyle = CELL_DEAD_COLOR;\r\n }\r\n if (grid[i][j].dead && num === 3) {\r\n grid[i][j].dead = false;\r\n grid[i][j].fillStyle = CELL_ALIVE_COLOR;\r\n }\r\n }\r\n\r\n //decrement snake tail's ticker every generation\r\n //it ticker reached 0 fill the cell\r\n if (grid[i][j].variation === \"snakeTail\") {\r\n if (grid[i][j].ticker > 0) {\r\n grid[i][j].ticker -= 1;\r\n }\r\n else {\r\n grid[i][j].dead = true;\r\n grid[i][j].fillStyle = CELL_DEAD_COLOR;\r\n grid[i][j].variation = \"normal\";\r\n grid[i][j].uniqID = 0; \r\n }\r\n }\r\n\r\n if (grid[i][j].variation === \"snakeHead\" &&\r\n grid[i][j].direction < 4) {\r\n var dir = grid[i][j].direction;\r\n //with a certain chance snake might randomly turn\r\n var turnChance = 0.05;\r\n //if snake is close to the edge of canvas the turn\r\n //chance is increase proportionally to its size\r\n if ((dir === 0 && j > 9.0*NUM_COLS/10) ||\r\n (dir === 1 && i < 1.5*NUM_ROWS/10) ||\r\n (dir === 2 && j < 1.0*NUM_COLS/10) ||\r\n (dir === 3 && i > 8.5*NUM_ROWS/10)) {\r\n turnChance = Math.min(0.3, 0.13 + \r\n 1.0 * (grid[i][j].ticker) / 100);\r\n }\r\n if (snakeControlSelect === \"2\"){\r\n if (keyW && (dir === 0 || dir === 2)) {\r\n dir = 1;\r\n grid[i][j].direction = dir;\r\n }\r\n else if (keyA && (dir === 1 || dir === 3)) {\r\n dir = 2;\r\n grid[i][j].direction = dir;\r\n }\r\n else if (keyS && (dir === 2 || dir === 0)) {\r\n dir = 3;\r\n grid[i][j].direction = dir;\r\n }\r\n else if (keyD && (dir === 3 || dir === 1)) {\r\n dir = 0;\r\n grid[i][j].direction = dir;\r\n }\r\n } else if (grid[i][j].uniqID === ID_IN_CONTROL && (snakeControlSelect != \"3\")){\r\n\t\t\t\t\t\tif (keyW && (dir === 0 || dir === 2)) {\r\n\t\t\t\t\t\t\tdir = 1;\r\n\t\t\t\t\t\t\tgrid[i][j].direction = dir;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if (keyA && (dir === 1 || dir === 3)) {\r\n\t\t\t\t\t\t\tdir = 2;\r\n\t\t\t\t\t\t\tgrid[i][j].direction = dir;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if (keyS && (dir === 2 || dir === 0)) {\r\n\t\t\t\t\t\t\tdir = 3;\r\n\t\t\t\t\t\t\tgrid[i][j].direction = dir;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if (keyD && (dir === 3 || dir === 1)) {\r\n\t\t\t\t\t\t\tdir = 0;\r\n\t\t\t\t\t\t\tgrid[i][j].direction = dir;\r\n\t\t\t\t\t\t}\r\n } else if (Math.random() < turnChance) {\r\n var changeDir = Math.floor(Math.random() * 19185) % 2;\r\n changeDir = changeDir * 2 - 1;\r\n dir += changeDir;\r\n if (dir === 4) {\r\n dir = 0;\r\n }\r\n if (dir === -1) {\r\n dir = 3;\r\n }\r\n grid[i][j].direction = dir;\r\n }\r\n //turn this cell into a snake tail\r\n grid[i][j].direction = 0;\r\n grid[i][j].variation = \"snakeTail\";\r\n\r\n //copy all info from this cell into the cell that\r\n //is ahead of it according to its direction\r\n //and turn that cell into a head\r\n if (validPosition(rowDir(i,dir),colDir(j,dir)) && \r\n !(grid[rowDir(i,dir)][colDir(j,dir)].variation \r\n === \"snakeHead\" || \r\n grid[rowDir(i,dir)][colDir(j,dir)].variation \r\n === \"snakeTail\" || \r\n grid[rowDir(i,dir)][colDir(j,dir)].variation \r\n === \"mine\")) {\r\n grid[rowDir(i,dir)][colDir(j,dir)].uniqID = \r\n grid[i][j].uniqID;\r\n grid[rowDir(i,dir)][colDir(j,dir)].direction = dir;\r\n grid[rowDir(i,dir)][colDir(j,dir)].variation = \r\n \"snakeHead\";\r\n grid[rowDir(i,dir)][colDir(j,dir)].ticker = \r\n grid[i][j].ticker;\r\n grid[rowDir(i,dir)][colDir(j,dir)].fillStyle = \r\n grid[i][j].fillStyle;\r\n //determine if anything was eaten\r\n if (!grid[rowDir(i,dir)][colDir(j,dir)].dead) {\r\n grid[rowDir(i,dir)][colDir(j,dir)].ticker += 1;\r\n }\r\n //adjust to row-by-row operation of the program\r\n grid[rowDir(i,dir)][colDir(j,dir)].dead = true;\r\n if (dir === 0 || dir === 3) {\r\n grid[rowDir(i,dir)][colDir(j,dir)].direction += 23;\r\n }\r\n else {\r\n staticUpdateCells(grid);\r\n }\r\n }\r\n //kill the snake if it reaches the border, \r\n //a mine, or another snake\r\n else {\r\n \r\n for (var i2 = 0; i2 < NUM_ROWS; i2 += 1) {\r\n for (var j2 = 0; j2 < NUM_COLS; j2 += 1) {\r\n //determine which snake to kill\r\n //using the SNAKE_ID\r\n if (grid[i2][j2].variation === \"snakeTail\" &&\r\n grid[i2][j2].uniqID === grid[i][j].uniqID) {\r\n grid[i2][j2].variation = \"snakeDeath\";\r\n grid[i2][j2].ticker = 6;\r\n //adjust to row-by-row operation of the program\r\n if ((i2 > i) || ((i2 === i) && (j2 >= j))) {\r\n grid[i2][j2].ticker += 1;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n //blow up the mine if snake hits it\r\n if (validPosition(rowDir(i,dir),colDir(j,dir)) && \r\n grid[rowDir(i,dir)][colDir(j,dir)].variation === \"mine\") {\r\n if ((i2 > i) || ((i2 === i) && (j2 > j))) {\r\n grid[rowDir(i,dir)][colDir(j,dir)].ticker = 2;\r\n }\r\n else {\r\n grid[rowDir(i,dir)][colDir(j,dir)].ticker = 1;\r\n }\r\n }\r\n\r\n }\r\n //adjust to row-by-row operation of the program\r\n if (grid[i][j].variation === \"snakeHead\" &&\r\n grid[i][j].direction > 4) {\r\n grid[i][j].direction -= 23;\r\n }\r\n\r\n //dead snake blinks for 3 generations\r\n //and then turns into dead cells \r\n if (grid[i][j].variation === \"snakeDeath\") {\r\n grid[i][j].ticker -= 1;\r\n if ((grid[i][j].ticker % 2) === 0) {\r\n if (grid[i][j].uniqID === ID_IN_CONTROL) {\r\n grid[i][j].fillStyle = CELL_SNAKE_CONTROL;\r\n }\r\n else {\r\n grid[i][j].fillStyle = CELL_SNAKE_COLOR;\r\n }\r\n }\r\n else {\r\n grid[i][j].fillStyle = CELL_DEAD_COLOR;\r\n }\r\n if (grid[i][j].ticker === 0) {\r\n if (grid[i][j].uniqID === ID_IN_CONTROL) {\r\n ID_IN_CONTROL = 0;\r\n }\r\n grid[i][j].dead = true;\r\n grid[i][j].fillStyle = CELL_DEAD_COLOR;\r\n grid[i][j].variation = \"normal\";\r\n grid[i][j].uniqID = 0;\r\n }\r\n }\r\n\r\n // show each cell's update on HTML canvus\r\n new_canvas.fillStyle = grid[i][j].fillStyle;\r\n new_canvas.fillRect(grid[i][j].xPosition, grid[i][j].yPosition, \r\n CELL_SIZE, CELL_SIZE);\r\n\r\n }\r\n }\r\n }", "fetchGrid(url, obj) {\n fetch(url).then(function(response) {\n return response.json()\n }).then(function(data) {\n let newGrid = data.cells\n let width = newGrid.length\n let height = newGrid[0].length\n\n obj.setWidth(width)\n obj.setHeight(height)\n obj.board.grid = obj.board.createGrid()\n obj.board.resultGrid = obj.board.createGrid()\n\n for(let col = 0; col < obj.width; col++) {\n for(let row = 0; row < obj.height; row++) {\n obj.board.grid[col][row] = newGrid[col][row]\n }\n }\n game.createTable()\n game.render()\n console.log(game.getWidth())\n console.log(game.getHeight())\n $('width').val(game.getWidth())\n $('height').val(game.getHeight())\n }).catch(function() {\n console.error(\"Error fetching.\")\n })\n }", "function visualisationUpdateLoop() {\n getGoldEvents();\n getHeroPositions();\n visualisationSize = document.getElementById('visualisationDiv').offsetWidth;\n //generateRadiantGoldHeatmap();\n //generateDireGoldHeatmap();\n //generateRadiantControlHeatmap();\n gRCHU();\n //generateDireControlHeatmap();\n getObserverData();\n getHealthData();\n // drawPlayers();\n\n // console.log(\"loop!\");\n}", "startGame() {\n this.interval = this.$interval(() => {\n this.loopCellMatrix();\n this.updateCellsFuture();\n this.iteration++;\n }, 300);\n }", "loopCellMatrix() {\n for(let row = 0; row < this.rowSize; row++) {\n for(let cell = 0; cell < this.colSize; cell++) {\n this.grid[row][cell].willLive = this.decideCellFuture(row, cell);\n }\n }\n }", "renderGrid() {\n this.gridCanvas.background(240);\n this.gridCanvas.fill(70, 70, 200);\n \n for (let w = 0; w < this.plotterGridSize.width; w++) {\n for (let h = 0; h < this.plotterGridSize.height; h++) {\n if (!this.plotterGrid.getCellState(w, h)) {\n continue;\n }\n\n this.gridCanvas.rect(w * this.cellSize, h * this.cellSize, this.cellSize, this.cellSize);\n }\n }\n\n this.lastRenderedCanvasStep = this.plotterGrid.getCurrentStep();\n }", "function updateGrid(){\n for (var i = 0; i < 20; i++) {\n for (var j = 0; j < 10; j++) {\n \tdocument.getElementById((i * 10 + j).toString()).style.animationName = \"none\";\n if (board[i][j] != 0){\n addSquare(i,j);\n } else {\n removeSquare(i,j);\n }\n if (board[i][j] == 8){\n \tdocument.getElementById((i * 10 + j).toString()).style = \"animation-name: color_change; \" +\n \t\"animation-duration: .25s; animation-iteration-count: infinite;animation-direction: alternate;\"\n }\n }\n }\n}", "function update(){\n\tvar a = arrayfromargs(messagename,arguments);\n\tvar ca = new Array(a[0],a[1],a[2],a[3],a[4]);\n\t//args = \"update\", x, y, playernumber\n\tif(a[1]>7 || a[2] > 7) { //out of range\n\t\t\n\t} else{ //new grid entry\n\t\n\t\t//get coords of update\n\t\tvar d = new Dict(\"gridSettings\");\n\t\tvar s = \"playerOffset::\";\n\t\ts = s.concat(a[3]);\n\t\t//post(s, \"\\n\");\n\t\tcOffset = d.get(s);\n\t\ta[1] += cOffset[1];\n\t\ta[2] += cOffset[0];\n\n\t\ta[2] = dimY - a[2] - 1; //flip Y-axis \n\n\t\t//determine state\n\t\tvar modFlag = 0;\n\t\tcurState = states[a[1]][a[2]].state;\n\t\tfor(var i=0;i<8;i++){\n\t\t\tif(curMod[i]>0) {\n\t\t\t\t//post(i,\"\\n\");\n\t\t\t\tmodFlag += (1<<(i+1));\n\t\t\t}\n\t\t}\n\t\tif (modFlag== 0 && curState > 0 && states[a[1]][a[2]].player == a[3] ) curState = 0;\n\t\telse if(modFlag == 0 ) curState = 1;//normal note\n\t\telse curState = modFlag; \n\t\tif(modFlag == 1) curState++;\n\t\t//post(curState);\n\n\t\tstates[a[1]][a[2]].state = curState;\n\t\tstates[a[1]][a[2]].player = a[3];\n\n\n\t\twriteValToGrid(a,curState);\n\n\t\t//outlet to coll is 3 values: player, state, y-position\n\t\tvar s = new Array(dimY+1);\n\t\ts[0] = a[1];\n\n\t\tfor(var i=0; i<dimY; i++) {\n\t\t\tvar curY = (dimY-i-1) % dimY;\n\t\t\ts[(i*3+1)] = states[a[1]][curY].player;\n\t\t\ts[(i*3+2)] = states[a[1]][curY].state;\n\t\t\ts[(i*3+3)] = i;\n\t\t}\n\n\t\toutlet(columnOut, s);\n\n\t\tupdateLP(ca[1], ca[2], states[a[1]][a[2]].state, states[a[1]][a[2]].player);\n\t}\n}//update", "UpdateGrid(){\r\n for (let i = 0; i < this.size; i++){\r\n for(let j = 0; j < this.size; j++){\r\n this.countAdjacent(i, j);\r\n }\r\n }\r\n }", "update(ruleset, grid) {\n const processCell = (xIndex, yIndex, cell, grid) => {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve(ruleset(xIndex, yIndex, cell, grid));\n }, 1);\n })\n }\n const processRow = (row, yIndex, i) => {\n return new Promise((res, rej) => {\n setTimeout(() => {\n // create a timeout for each row\n const cells = row.map((cell, xIndex) => {\n return processCell(xIndex, yIndex, cell, grid);\n });\n Promise.all(cells)\n .then((c) => {\n res(c);\n })\n }, 1);\n });\n }\n const processGrid = (grid) => {\n let i = 0;\n return grid.map((row, y) => {\n return processRow(row, y, i++);\n });\n }\n return new Promise((resolve, reject) => {\n Promise.all(processGrid(grid))\n .then((nextGrid) => {\n resolve(nextGrid);\n })\n });\n }", "refresh() {\n this.props.loadGrid(5);\n this.resetTiles();\n }", "function onUpdate(framework) {\n if (!(grid === undefined)) {\n grid.tick();\n }\n}", "async update(event) {\n\n if (this.updating) {\n const type = event ? event.type : \"NONE\"\n this.pending.set(type, event)\n } else {\n this.updating = true\n try {\n\n this.startSpinner()\n if (event !== undefined && \"LocusChange\" === event.type) {\n this.layoutController.xAxisRuler.locusChange(event)\n this.layoutController.yAxisRuler.locusChange(event)\n }\n\n const promises = []\n\n for (let xyTrackRenderPair of this.trackPairs) {\n promises.push(this.renderTrackXY(xyTrackRenderPair))\n }\n promises.push(this.contactMatrixView.update(event))\n await Promise.all(promises)\n\n if (event && event.propogate) {\n let syncState1 = this.getSyncState()\n for (let browser of this.synchedBrowsers) {\n browser.syncState(syncState1)\n }\n }\n\n } finally {\n this.updating = false\n if (this.pending.size > 0) {\n const events = []\n for (let [k, v] of this.pending) {\n events.push(v)\n }\n this.pending.clear()\n for (let e of events) {\n this.update(e)\n }\n }\n if (event) {\n // possibly, unless update was called from an event post (infinite loop)\n this.eventBus.post(event)\n }\n this.stopSpinner()\n }\n }\n }", "step() {\n let cells = this.board.tick();\n this.drawCells(cells);\n }", "function updateScreen () {\r\n // Loop over the 4x4 grid.\r\n for (let i = 0; i < 4; i++) {\r\n for (let j = 0; j < 4; j++) {\r\n // Get the HTML button at position (i,j).\r\n let button = document.querySelector (`#board${i}${j}`);\r\n // Read the state of the \"board\" array for position (i,j).\r\n let instance = getInstance ();\r\n let sender = web3.eth.accounts[0];\r\n instance.board (\r\n i + j * 4,\r\n { from : sender, gas : 200000 },\r\n function (error, result) { \r\n if (!error) {\r\n // When we reach here, \"result\" is the uint8 for the \"board\" array at position (i,j).\r\n // So we assign it to the HTML button's value, which changes the button's label.\r\n button.value = result;\r\n } else {\r\n console.error (error); \r\n }\r\n }\r\n ); \r\n }\r\n }\r\n}", "tick() {\n for(let col = 0; col < this.width; col++) {\n for(let row = 0; row < this.height; row++) {\n this.setCell(this.resultGrid, col, row, this.nextState(col, row));\n }\n }\n this.copyResults()\n }", "function updateTiles() {\n forEachTile(function update(row, col) {\n setTimeout(function () {\n tileColor = jQuery.Color().hsla({\n hue: (tileColor.hue() + (Math.random() * tileMaxHueShift)) % 360,\n saturation: tileMinSaturation + (Math.random() * tileSaturationSpread),\n lightness: tileMinLightness + (Math.random() * tileLightnessSpread),\n alpha: tileOpacity\n });\n\n var currentColor = jQuery.Color($(\"#\" + row + \"-\" + col), \"backgroundColor\");\n\n // when to update the Tiles\n if (currentColor.lightness() < tileLightnessDeadZoneLowerBound() ||\n currentColor.lightness() > tileLightnessDeadZoneUpperBound() ||\n currentColor.lightness() == 1) {\n $(\"#\" + row + \"-\" + col).animate({\n backgroundColor: tileColor\n }, tileFadeDuration);\n }\n }, getTileDelayTime(row, col));\n });\n }", "function update() {\n\tcurrentTime = new Date().getTime();\n\t\n\t// Tying the speed of the game to lines cleared. Every 50 lines reduces the time between block movements by 50ms.\n\tvar speed = 500 - ((Math.floor(currentLines / 50) * 0.1) * 500);\n\t\n\t// Checking if enough time has passed to move the block down a row and if so is it a valid move. If it is move the block, if not copy the blocks data to gamedata and get new block.\n\tif(currentTime - previousTime > speed) {\n\t\tif(checkMove(ourPiece.gridX, ourPiece.gridY + 1, ourPiece.curState)) {\n\t\t\tourPiece.gridY++;\n\t\t} else {\n\t\t\tcopyData(ourPiece);\n\t\t\tourPiece = getRandomPiece();\n\t\t}\n\t\t\n\t\tpreviousTime = currentTime;\n\t}\n\t\n\t// All the drawing of board and blocks.\n\tctx.clearRect(0, 0, 320, 640);\n\tdrawBoard();\n\tdrawPiece(ourPiece);\n\t\n\t// If game is over draw the game over screen, if not continue the gameplay.\n\tif(isGameOver == false) {\n\t\trequestAnimationFrame(update);\n\t} else {\n\t\tctx.drawImage(gameOverImg, 0, 0, 320, 640, 0, 0, 320, 640);\n\t}\n}", "function drawUpdateGrid(board){\n for(var x = 0; x < 9; x++){\n for (var y = 0; y < 9; y++) {\n if (board[y][x] == 1) {\n drawRectAtBoardPos(x+1, y+1, 1);\n } else if (board[y][x] == 2){\n drawRectAtBoardPos(x+1, y+1, 2);\n }\n }\n }\n}", "update(board) {\n globalWidth = $(window).width();\n observer.updateHistory(globalWidth);\n if (observer.shouldWidthUpdate()){\n gameStyles.adjustStyles();\n }\n this.setState({tile1: board[0][0]});\n this.setState({tile2: board[0][1]});\n this.setState({tile3: board[0][2]});\n this.setState({tile4: board[0][3]});\n this.setState({tile5: board[1][0]});\n this.setState({tile6: board[1][1]});\n this.setState({tile7: board[1][2]});\n this.setState({tile8: board[1][3]});\n this.setState({tile9: board[2][0]});\n this.setState({tile10: board[2][1]});\n this.setState({tile11: board[2][2]});\n this.setState({tile12: board[2][3]});\n this.setState({tile13: board[3][0]});\n this.setState({tile14: board[3][1]});\n this.setState({tile15: board[3][2]});\n this.setState({tile16: board[3][3]});\n this.setState({scores: grid.get_score()});\n this.setState({hist_num: grid.history.length});\n }", "update() {\n let xpos = 0, ypos = 0;\n let i;\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n this.ctx.strokeStyle = \"#E0E0E0\";\n for (i = 0; i < this.cols*this.rows; i++) {\n if (i % this.cols === 0 && i !== 0) {\n ypos += this.cellSize;\n xpos = 0;\n }\n if (this.engine.getCellStateFromIndex(i) === 1) {\n this.ctx.fillRect(xpos, ypos, this.cellSize, this.cellSize);\n }\n if (this.cellSize > 5) {\n this.ctx.strokeRect(xpos, ypos, this.cellSize, this.cellSize);\n }\n xpos += this.cellSize;\n }\n }", "function updateCells() {\n\t\t\tconsole.log('Updating cells')\n\t\t\tfor(i = 0; i < maxRow; i++) {\n\t\t\t\tfor(j = 0; j < maxCol; j++) {\n\t\t\t\t\tcellID = j+'_'+i;\n\t\t\t\t\tif(cells[cellID].state != cells[cellID].nextState) { // change in the cell\n\t\t\t\t\t\tconsole.log('Change in cell state detected.')\n\t\t\t\t\t\tcells[cellID].state = cells[cellID].nextState\n\t\t\t\t\t\tcells[cellID].changeCellView()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function updateBoard() {\r\n\r\n if (playing) {\r\n //update values\r\n for (var r = 0; r < boardSize; r++) {\r\n for (var t = 0; t < boardSize; t++) {\r\n var key = tileKey(t, r);\r\n var tile = document.querySelector(\"#\" + key);\r\n board[key] != null ? tile.innerHTML = board[key] : tile.innerHTML = \"\";\r\n tile.className = \"tile\";\r\n tile.classList.add(\"tile-\" + board[key]);\r\n }\r\n }\r\n\r\n //update score\r\n scoreSpan.innerHTML = score;\r\n\r\n //check if game is over\r\n gameOver();\r\n }\r\n}", "function update(){\r\n updateBackground();\r\n //extractData();\r\n loop();\r\n // checkStatus();\r\n \r\n}", "update() {\n var now = Date.now();\n var dt = (now - gameNs.game.prevTime);\n gameNs.game.dt = dt;\n gameNs.game.prevTime = now;\n gameNs.game.draw();\n //Update projectile manager\n gameNs.game.pm.update(dt, gameNs.game.mX, gameNs.game.mY);\n dt = 0;\n //Recursively call game.update here to create loop\n window.requestAnimationFrame(gameNs.game.update);\n }", "updateUI() {\n this.clear();\n this.context.beginPath();\n let cells = this.automaton.cells;\n for(let x = 0; x < cells.length; x++) {\n for(let y = 0; y < cells[x].length; y++) {\n if(cells[x][y]) {\n this.context.fillRect(x*this.cellSize, y*this.cellSize, this.cellSize, this.cellSize);\n }\n }\n }\n this.context.stroke();\n }", "refresh() {\n const clearGrid = this.getStartGrid();\n this.setState({\n grid: clearGrid,\n clearedActions: this.state.actionCount,\n });\n for (let row = 0; row < 20; row++) {\n for (let col = 0; col < 45; col++) {\n if (row === this.state.start_node_row && col === this.state.start_node_col) {\n document.getElementById(`node-${row}-${col}`).className =\n 'node start-node';\n }\n if (row === this.state.finish_node_row && col === this.state.finish_node_col) {\n document.getElementById(`node-${row}-${col}`).className =\n 'node finish-node';\n } \n }\n }\n }", "function ensureCellsPopulated(grid) {\n //processing goes here\n var modifiedGrid = grid;\n return modifiedGrid;\n}", "update(){\r\n while (this.lastMove != 'x' && this.isAlive && !this.won) {\r\n console.clear();\r\n this.print(this.grid);\r\n this.playerMovement();\r\n }\r\n\r\n if (!this.isAlive || this.won){\r\n this.restart();\r\n }\r\n }", "draw () {\n\n // loop over the x coordinates\n for (let x = 0; x < this.config.get(colsKey); ++x) {\n\n // loop over the y coordinates\n for (let y = 0; y < this.config.get(rowsKey); ++y) {\n\n // get the current index\n let index = (x + y * this.config.get(colsKey));\n\n // get the current state\n let state = this.grid.get(index);\n\n // do we have a living being?\n if (state === 1) {\n\n // fill black\n fill(0);\n\n // get the resolution\n let resolution = this.config.get('resolution');\n\n // prepare the x coordinate\n let xPos = (x * resolution);\n \n // prepare the y coordinate\n let yPos = (y * resolution);\n\n // draw a rect\n rect(xPos, yPos, resolution, resolution);\n }\n }\n }\n }", "onUpdate() {\n for (const computeCell of this.computeCells) {\n computeCell.onInputUpdate();\n }\n }", "function updateGrid() {\n grid.innerHTML = \"\";\n createGrid(range.value);\n}", "function draw () {\n\t\t// loop over grid and draw Stuffs\n\t\tfor (var x = 0; x < tsg.xlen; x++){\n\t\t\tfor (var y = 0; y < tsg.ylen; y++){\n\t\t\t\t// clear cell\n\t\t\t\tctx.fillStyle = \"rgb(0,0,0)\";\n\n\t\t\t\tctx = tsg.stuffMgr.draw(ctx, x,y);\n\t\t\t\tvar xw = x*cellWidth;\n\t\t\t\tvar yw = y*cellWidth;\n\t\t\t\tctx.fillRect (xw, yw, cellWidth, cellWidth);\n\t\t\t}\n\t\t}\n\n\t\t// draw the Things\n\t\tctx = tsg.thingMgr.draw(ctx);\n\n\t\tif (running){\n\t\t\tsetTimeout(tsg.run, 200);\n\t\t}\n\t}", "update_grid() {\n // Constants for parameters of the grid pattern.\n // The (average) length of the dashes making up the cell border lines.\n const DASH_LENGTH = this.default_cell_size / 16;\n // The border colour.\n const BORDER_COLOUR = \"lightgrey\";\n\n const [width, height] = [document.body.offsetWidth, document.body.offsetHeight];\n const canvas = this.grid;\n canvas.resize(width, height);\n\n const scale = 2 ** this.scale;\n\n const context = canvas.context;\n context.strokeStyle = BORDER_COLOUR;\n context.lineWidth = Math.max(1, CONSTANTS.GRID_BORDER_WIDTH * scale);\n context.setLineDash([DASH_LENGTH * scale]);\n\n // We want to centre the horizontal and vertical dashes, so we get little crosses in the\n // corner of each grid cell. This is best effort: it is perfect when each column and row\n // is the default size, but otherwise may be imperfect.\n const dash_offset = -DASH_LENGTH * scale / 2;\n\n const offset = this.view;\n\n const [[left_col, left_offset], [top_row, top_offset]] = this.col_row_offset_from_offset(\n offset.sub(new Offset(width / scale / 2, height / scale / 2))\n );\n const [[right_col,], [bottom_row,]] = this.col_row_offset_from_offset(\n offset.add(new Offset(width / scale / 2, height / scale / 2))\n );\n\n // Draw the vertical lines.\n context.beginPath();\n for (let col = left_col, x = left_offset - offset.left;\n col <= right_col; x += this.cell_size(this.cell_width, col++)) {\n context.moveTo(x * scale + width / 2, 0);\n context.lineTo(x * scale + width / 2, height);\n }\n context.lineDashOffset = offset.top * scale - dash_offset - height % this.default_cell_size / 2;\n context.stroke();\n\n // Draw the horizontal lines.\n context.beginPath();\n for (let row = top_row, y = top_offset - offset.top;\n row <= bottom_row; y += this.cell_size(this.cell_height, row++)) {\n context.moveTo(0, y * scale + height / 2);\n context.lineTo(width, y * scale + height / 2);\n }\n context.lineDashOffset = offset.left * scale - dash_offset - width % this.default_cell_size / 2;\n context.stroke();\n }", "function refresh(){\n //Only runs update if we are in the editor or play mode\n if(app.state.editor || app.state.player) {\n mdata.update().then((ret) => {\n app.vizzy.canvas.clear();\n app.vizzy.canvas.update(ret);\n });\n }\n window.requestAnimationFrame(refresh);\n }", "async performUpdate() {\n await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n super.performUpdate();\n }", "onUpdate() {\n let game = this;\n for (let player in this.players) {\n this.getClientData(player).then(data => {\n if (game.players[player].update)\n game.players[player].update(data)\n }).catch(err => {\n logger.error(err);\n });\n }\n }", "function refresh_view(){\n\t//draw the board, color tokens as appropriate\n\tctx.fillStyle = \"#000\";\n\tctx.beginPath();\n\tctx.rect(0, 0, config.square_size*config.grid_size+(config.offset*2), config.square_size*config.grid_size+(config.offset*2));\n\tctx.closePath();\n\tctx.fill();\n\tfor(var i=0;i<config.grid_size;i++){\n\t\tfor(var j=0;j<config.grid_size;j++){\n\t\t\tif(grid[i][j] == undefined){\n\t\t\t\t//empty\n\t\t\t\tctx.fillStyle = \"#fff\";\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.rect(i*config.square_size+config.offset, j*config.square_size+config.offset, config.square_size-1, config.square_size-1);\n\t\t\t\tctx.closePath();\n\t\t\t\tctx.fill();\n\t\t\t\tctx.fillStyle = \"#000\";\n\t\t\t\tctx.stroke();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(grid[i][j].player == 1){\n\t\t\t\t//player 1\n\t\t\t\tswitch(grid[i][j].life){\n\t\t\t\t\tcase 5:\n\t\t\t\t\t\tctx.fillStyle = \"#F00\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tctx.fillStyle = \"#F33\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tctx.fillStyle = \"#F66\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tctx.fillStyle = \"#F99\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tctx.fillStyle = \"#FCC\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tctx.fillStyle = \"#FFF\";\n\t\t\t\t}\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.rect(i*config.square_size+config.offset, j*config.square_size+config.offset, config.square_size-1, config.square_size-1);\n\t\t\t\tctx.closePath();\n\t\t\t\tctx.fill();\n\t\t\t\tctx.fillStyle = \"#000\";\n\t\t\t\tctx.stroke();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(grid[i][j].player == 2){\n\t\t\t\t//player2\n\t\t\t\tswitch(grid[i][j].life){\n\t\t\t\t\tcase 5:\n\t\t\t\t\t\tctx.fillStyle = \"#0F0\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tctx.fillStyle = \"#3F3\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tctx.fillStyle = \"#6F6\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tctx.fillStyle = \"#9F9\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tctx.fillStyle = \"#CFC\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tctx.fillStyle = \"#FFF\";\n\t\t\t\t}\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.rect(i*config.square_size+config.offset, j*config.square_size+config.offset, config.square_size-1, config.square_size-1);\n\t\t\t\tctx.closePath();\n\t\t\t\tctx.fill();\n\t\t\t\tctx.fillStyle = \"#000\";\n\t\t\t\tctx.stroke();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t}\n}", "update() {\n this.view.drawArrows(Clock.getCurrentDate());\n // SetTimeout for next iteration if clock is working.\n if (this.isWork) {\n setTimeout(() => {\n this.update.apply(this);\n }, 50);\n }\n }", "function refreshGrid(){\n clearGrid();\n makeGrid(document.getElementById(\"input_height\").value, document.getElementById(\"input_width\").value);\n}", "function updateGameDev()\n{\n // GO THROUGH THE UPDATE GRID AND USE IT TO CHANGE THE RENDER GRID\n for (var i = 0; i < gridHeightDev; i++)\n {\n for (var j = 0; j < gridWidthDev; j++)\n {\n // HOW MANY NEIGHBORS DOES THIS CELL HAVE?\n var numLivingNeighbors = calcLivingNeighborsDev(i, j);\n // CALCULATE THE ARRAY INDEX OF THIS CELL\n // AND GET ITS CURRENT STATE\n var index = (i * gridWidthDev) + j;\n var testCell = updateLifeGridDev[index];\n\n // CASES\n // 1) IT'S ALIVE\n if (testCell === BAD_CELL_DEV || testCell === GOOD_CELL_DEV)\n {\n // 1a FEWER THAN 2 LIVING NEIGHBORS\n if (numLivingNeighbors < 2)\n {\n // IT DIES FROM UNDER-POPULATION\n renderLifeGridDev[index] = DEAD_CELL_DEV;\n }\n // 1b MORE THAN 3 LIVING NEIGHBORS\n else if (numLivingNeighbors > 3)\n {\n // IT DIES FROM OVERCROWDING\n renderLifeGridDev[index] = DEAD_CELL_DEV;\n }\n // 1c 2 OR 3 LIVING NEIGHBORS, WE DO NOTHING\n else\n {\n if (testCell === BAD_CELL_DEV)\n renderLifeGridDev[index] = BAD_CELL_DEV;\n else if(testCell === GOOD_CELL_DEV){\n renderLifeGridDev[index] = GOOD_CELL_DEV;\n }\n }\n // IT'S A FINISH CELL\n } else if (testCell === FINISH_CELL_DEV) {\n // DON'T CHANGE ANYTHING\n // ITS A VOID CELL\n } else if (testCell === VOID_CELL_DEV) {\n // DON'T CHANGE ANYTHING\n }\n // IT'S DEAD\n else if (numLivingNeighbors === 3)\n {\n var dominantLife = getDominantLife(i, j);\n if(dominantLife === \"bad\"){\n renderLifeGridDev[index] = BAD_CELL_DEV;\n }\n else if (dominantLife === \"good\"){\n renderLifeGridDev[index] = GOOD_CELL_DEV;\n }\n }\n else\n {\n renderLifeGridDev[index] = DEAD_CELL_DEV;\n }\n }\n }\n}", "update(dt) {\n game.update(dt);\n }", "function updateAll() {\n\t\tmoveAll();\n\t\tdrawAll();\n\t}", "update() {\n this.initGrid();\n\n // Sort route definitions by increasing distance.\n const dist = this.options.distance;\n this.routes.sort((a, b) => dist(a.start, a.goal) - dist(b.start, b.goal));\n\n // Compute a new path for each route.\n for (const [i, route] of this.routes.entries()) {\n route.onChange(route, this.findPath(route));\n }\n }", "updateBoard() {\r\n for (let tile in this.gameState.state) {\r\n if (this.gameState.state[tile] !== 0) {\r\n $(\"#\"+tile).html((this.gameState.state[tile] === 1) ? this.playerSymbols[0] : this.playerSymbols[1]);\r\n } else {\r\n $(\"#\"+tile).html(\"\");\r\n }\r\n }\r\n //Check for winner, otherwise check for no free spaces (tie)\r\n let winState = this.gameState.checkWin();\r\n if (winState.win) {\r\n this.winner(winState);\r\n } else if(this.gameState.freeSpaces().length === 0) {\r\n this.tie();\r\n }\r\n }", "function updateBoard() {\n // Clear the canvas\n board.clear();\n\n // Draw older gen ghosts\n var colors = [\"#777777\", \"#999999\", \"#BBBBBB\", \"#DDDDDD\", \"#EEEEEE\"];\n for (var gen = 0; gen < genGhosts.length; gen++) {\n drawGen(genGhosts[gen], colors[gen]);\n }\n\n // Draw current gen\n drawGen(currentGen, \"#555555\");\n }", "tick() {\n const newBoard = this.makeBoard();\n\n this.iterate((row, col) => {\n const alive = !!this.board[row][col];\n const dead = !alive;\n const living = this.livingNeighbors(row, col);\n\n if ((alive && living < 2) || (alive && living > 3)) {\n newBoard[row][col] = 0;\n } else if (dead && living === 3) {\n newBoard[row][col] = 1;\n } else if (alive) {\n newBoard[row][col] = 1;\n }\n });\n this.board = newBoard;\n }", "function updateGrid(){\n //num = prompt(\"enter new grid dimensions\");\n clearGrid();\n newSizeGrid(num);\n}", "Draw() {\r\n for (let row = 0; row < this.rowCount; ++row) {\r\n for (let column = 0; column < this.columnCount; ++column) {\r\n let cell = this.simulationGrid[row][column];\r\n\r\n if (cell === this.cellState.alive) {\r\n let coordinate = new Vector2D();\r\n coordinate.x = column * this.cellSize.x;\r\n coordinate.y = row * this.cellSize.y;\r\n\r\n DrawRectangle(coordinate, this.cellSize, \"#ffffff\", this.context);\r\n }\r\n }\r\n }\r\n }", "updateGridValues() {\n //for every col...\n for (let i = 0; i < this.colNum; i++) {\n\n //increment offsetSum by randomInc*2.25 each row, this line is responsible for the increased distrotion across the grid\n this.offsetSum += (this.randomInc*2.25);\n\n //Alternative method of having the offsetSum accumulate exponentially\n // this.offsetSum += this.randomInc*i;\n\n //nest another array within coOrds[i]\n this.coOrds[i] = [];\n //and for every row...\n for (let ii = 0; ii < this.rowNum; ii++) {\n //store the X and Y values for this spot in the grid\n this.x = this.canvasPadding + (this.moduleSize / 2) + (i * (this.moduleSize + this.padding));\n this.y = this.canvasPadding + (this.moduleSize / 2) + (ii * (this.moduleSize + this.padding));\n //store the offsetSum as Z. This will be used to offset the module when it it rendered later\n this.z = this.offsetSum;\n //Store X,Y and Z inside a vector in coOrds[i][ii]\n this.coOrds[i][ii] = createVector(this.x, this.y, this.z);\n }\n }\n\n // reset offsetSum after each frame so it does not accumulate\n this.offsetSum *= 0;\n }", "function update() {\n // board movement.\n board.update();\n\n // arrow movement.\n updateArrow();\n}", "function update(dt) {\n gridnext.set(function(x, y) { \n let C = grid.get(x, y);\n \n let N = grid.get(x, y-1);\n let NE = grid.get(x+1, y-1);\n let E = grid.get(x+1, y);\n let SE = grid.get(x+1, y+1);\n let S = grid.get(x, y+1);\n let SW = grid.get(x-1, y+1);\n let W = grid.get(x-1, y);\n let NW = grid.get(x-1, y-1);\n let total = N+NE+E+SE+S+SW+W+NW;\n \n if (C==1) { // alive\n if (total < 2) {\n return 0; //death by loneliness\n } else if (total > 3) {\n return 0; // death by overcrowding\n }\n } else if (C==0) { // dead\n if (total == 3) {\n return 1; // reproduction\n }\n }\n // else state remains same:\n return C;\n });\n \n let temp = grid;\n grid = gridnext;\n gridnext = temp;\n}", "function doUpdate() {\n chordData.getMatrix().then(render, function (e) {\n console.log(ERROR_RENDERING + e);\n });\n }", "function runTick(){\n\t\tvar total = 0;\n\t\tfor (var y = 0; y < height; y++){\n\t\t\tvar row = rows[y],\n\t\t\t\t\tcol = row.getElementsByClassName('col');\n\t\t\tfor (var x = 0; x < width; x++){\n\t\t\t\tvar cell = col[x],\n\t\t\t\t cellInfo = grid.get(new Cell(x, y));\n\t\t\t\tif ( cellInfo.state == \"alive\" ){ \n\t\t\t\t\tcell.className = cell.className.replace('dead', 'alive');\n\t\t\t\t\ttotal ++;\n\t\t\t\t}\n\t\t\t\telse cell.className = cell.className.replace('alive', 'dead');\n\t\t\t}\n\t\t}\n\t\tif (total === 0) {\n\t\t\tstopButton.click();\n\t\t\treturn displayGrid();\n\t\t}\n\t}", "function whenRefresh() {\n gameInstance.updateGridSize(ctx) ;\n gameInstance.updateGridSize(ctx2) ;\n gameInstance.drawGameStep(ctx) ;\n\n if (!buttonStateInstance.start.isSwitch) {\n newGame() ;\n }\n}", "render(grid){\n grid.forEach((line, row)=> {\n this.updateLis(line,row);\n });\n }", "function scheduleUpdate() {\n if (!_nextUpdateHandle) {\n _nextUpdateHandle = setImmediate(processUpdate);\n }\n}", "async function update() {\r\n\t\t\t\t\tif(active) {\r\n\t\t\t\t\t\tdescription = ' ';\r\n\t\t\t\t\t\tconsoleEdit.edit(consoleDesc);\r\n\t\t\t\t\t\tconsoleDesc = `\\`\\`\\`X: ${stats.x} | Y: ${stats.y}\\`\\`\\``\r\n\t\t\t\t\t\tstats = client.getPInfo.get(message.author.id, message.guild.id);\r\n\t\t\t\t\t\tgameEdit.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })\r\n\t\t\t\t\t\t.then(async collected => {\r\n\t\t\t\t\t\t\tconst reaction = collected.first();\r\n\t\t\t\t\t\t\treaction.users.remove(message.author.id);\r\n\t\t\t\t\t\t\tswitch(reaction.emoji.name) {\r\n\t\t\t\t\t\t\t\tcase '⬅️':\r\n\t\t\t\t\t\t\t\t\tmove(stats, stats.x-1, stats.y, 4);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase '➡️':\r\n\t\t\t\t\t\t\t\t\tmove(stats, stats.x+1, stats.y, 2);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase '⬇️':\r\n\t\t\t\t\t\t\t\t\tmove(stats, stats.x, stats.y-1, 3);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase '⬆️':\r\n\t\t\t\t\t\t\t\t\tmove(stats, stats.x, stats.y+1, 1)\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase '🛑':\r\n\t\t\t\t\t\t\t\t\tactiveGame.delete(message.author.id);\r\n\t\t\t\t\t\t\t\t\tactive = false;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase '⛏️':\r\n\t\t\t\t\t\t\t\t\tconsoleDesc += await client.commands.get('mine').execute(client, message, MessageEmbed);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase '🧳':\r\n\t\t\t\t\t\t\t\t\tclient.commands.get('inventory').execute(client, message, MessageEmbed, player);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tawait mapUpdate();\r\n\t\t\t\t\t\tawait update();\r\n\t\t\t\t\t\tturns--;\r\n\t\t\t\t\t}).catch(err => {\r\n\t\t\t\t\t\t//If the player does not respond in time, shut down the game.\r\n\t\t\t\t\t\tactiveGame.delete(message.author.id);\r\n\t\t\t\t\t\tgameEdit.edit(`${block}${block}${block}${block}${block}\\n${block}${block}${block}${block}${block}\\n${block}${block}${block}${block}${block}\\n${block}${block}${block}${block}${block}\\n${block}${block}${block}${block}${block}\\n`);\r\n\t\t\t\t\t\tconsoleEdit.edit('``` Game Closed ```')\r\n\t\t\t\t\t})\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "function refreshGameBoard() {\n // Load a new game board\n currentBoard = boardUtil.loadBoard(difficulty);\n // Hide the solved text\n $('#solved').addClass('hidden');\n // Remove the win state styling on all of the cells\n $('.content').removeClass('winstate');\n // Remove any classes from the gameboard cells\n $('.content').removeClass('mutable immutable');\n $('.cell').removeClass('conflict');\n // Remove any forms from the gameboard cells\n $('form').remove();\n\n // Go through all of the content divs in the gameboard div and update their values\n $('.content').each(function(index) {\n // check value at index in currentBoard\n // if value is present\n if (currentBoard[index] !== undefined) {\n // Set the value of the cell\n $(this).html(currentBoard[index]);\n // Make it an immutable cell\n $(this).addClass('immutable');\n } else {\n // Set a placeholder for the value of the cell\n $(this).html(' ');\n // Make it a mutable cell\n $(this).addClass('mutable');\n // Add a form within every mutable cell\n $(this).after('<form class=\"input-form hidden\"><input type=\"text\" size=\"1\"></form>');\n }\n });\n\n // Change the content of the cell and hide the form when the form is submitted\n $('form').submit(changeCellValue);\n }", "function UpdateBoard(){\n for(var i = 0; i < activeBlock.shapeMatrix[0].length; ++i){\n for(var j = 0; j < activeBlock.shapeMatrix[0].length; ++j){\n if(activeBlock.shapeMatrix[i][j] != 0){\n board[activeBlock.position.y + i][activeBlock.position.x + j] = activeBlock.shapeMatrix[i][j];\n\n }\n }\n }\n updateGrid();\n}", "refreshBoard() {\n this.Canvas.clearLayer(this.Canvas.layerContexts[0], this.Canvas.layerElements[0]);\n this.Canvas.drawListOfForms(this.Canvas.layerContexts[0], this.generateSnakeForm());\n }", "function updateWorld() {\n\n // update player data\n\n TemplateService.inject( Templates.STATS_DISPLAY, container, {\n money: Player.money,\n radius: Player.radius\n });\n\n // retrieve all venues\n\n police = [], banks = [], gas = [];\n\n // a bit of a Promise pyramid which could benefit from async - await !\n\n FourSquareService.API.venues( Locations.POLICE )\n .then(( policeData ) => {\n police = policeData.venues;\n\n FourSquareService.API.venues( Locations.BANK, Categories.BANK )\n .then(( bankData ) => {\n banks = bankData.venues;\n\n FourSquareService.API.venues( Locations.GAS )\n .then(( gasData ) => {\n\n gas = gasData.venues;\n\n // flush existing markers and render the new list\n // not entirely low on overhead with regards to reusable\n // resource, but we're in a rush ;)\n\n PubSub.publishSync( Actions.FLUSH_MARKERS );\n PubSub.publishSync( Actions.CREATE_MARKERS, { police, banks, gas });\n });\n })})\n .catch(( error ) => PubSub.publish( Actions.SHOW_ERROR, { message: error }));\n}", "function updateElements() { //Main loop logic here.\r\n updateResourceDisplay();\r\n updateCoreDisplay();\r\n}", "function gridRedraw() {\n rowHeight = 700 / config.numRows;\n colWidth = 700 / config.numCols;\n }", "function update() {\r\n paintWorld();\r\n observers.forEach(observer => observer.update());\r\n}", "async updateUi() {\n this.$div.find('.stats-match').text(this.stats.match);\n this.$div.find('.stats-time').text(convertTimeToText(this.stats.matchTime, 1));\n this.$div\n .find('.stats-match-duration')\n .text(convertTimeToText(this.stats.lastDurations.getAverage(), 1));\n\n return new Promise(resolve => {\n window.requestAnimationFrame(resolve);\n });\n }", "function runUpdate(){\n people.forEach(function(element){\n element.update();\n });\n }", "function updateButton() {\n console.log('update costs');\n gridData(300000);\n\n row.selectAll(\".square\")\n .data(function(d) { return d; })\n .style(\"fill\", function(d) {\n return d.id >= fillBoxes ? \"#fff\" : \"#2C93E8\";\n });\n}", "function updateGridRow1Col1() {\n\thttp.open('get', 'grid.php?spanId='+escape(idName1));\n http.onreadystatechange = handleResponse11;\n http.send(null);\n setTimeout('updateGridRow1Col1()', updateDelay+100);\n}", "function displayGrid() {\r\n for (i = 0; i < cols; i++) {\r\n for (j = 0; j < rows; j++) {\r\n grid[i][j].display(w, h, 255);\r\n }\r\n }\r\n}", "function print_board(){\n for(var i=0;i<9;i++){\n for(var j=0;j<9;j++){\n update_grid_element(i, j, board[i][j]);\n }\n }\n}", "update() {\n this.poll();\n }", "function update(){\n scoreboard.update();\n redTeam.forEach(player => player.update());\n blueTeam.forEach(player => player.update());\n\n}", "function update() {\r\n const time = Date.now() / 1000;\r\n coordinates = getCoordinates(time);\r\n drawing.redraw(coordinates);\r\n }", "function refreshBoard() {\n for( let i = 0; i <= total; i++){\n createSpace(space[i].type, space[i].x, space[i].y);\n addNumbers(i+1, space[i].color, space[i].x + (size/2), space[i].y + (size/2), space[i].size);\n }\n return stage.update();\n}", "async function weatherUpdate () { \n weather = await getWeather(location)\n drawWidget(location, timestamp, weather)\n console.log(\"weather updated\")\n}", "run() {\n this.update();\n this.display();\n this.checkEdges();\n }", "loop () {\n\t\tthis.update();\n\t\tthis.render();\n\n\t\twindow.requestAnimationFrame( () => this.loop() );\n\t}", "update() {\r\n\t\tthis.matrix.forEach((row, y) => row.forEach((tile, x) => {\r\n\t\t\tif (tile && !tile.isEmpty) {\r\n\t\t\t\tlet temp = tile.top;\r\n\t\t\t\ttile.contents.shift();\r\n\t\t\t\tthis.insert(temp);\r\n\t\t\t}\r\n\t\t}));\r\n\t}", "function refreshAllGrids () {\n itemGrids.forEach((grid) => { grid.refreshItems().layout() })\n}", "update() {\n let newArray = Array.from({length: this.width}, () =>\n Array.from({length: this.height}, () => 0)\n );\n\n for(let x = 0; x < this.width; x++) {\n for(let y = 0; y < this.height; y++) {\n // Number of neighboring cells\n let neighbors = this.countNeighbors(x, y, this.cells);\n if(this.cells[x][y]) { // If the cell is alive\n if(!this.surviveConditions.includes(neighbors)) { // It dies if it has not the required number of neighbors\n newArray[x][y] = 0;\n } else {\n newArray[x][y] = 1;\n }\n } else { // If the cell is dead\n if(this.birthConditions.includes(neighbors)) { // It becomes alive if it has the required number of neighbors\n newArray[x][y] = 1;\n } else {\n newArray[x][y] = 0;\n }\n }\n }\n }\n\n this.cells = newArray;\n }", "function drawGrid() {\n for (r = 0; r < ROW; r++) {\n for (c = 0; c < COLUMN; c++) {\n drawSquare(c, r, grid[r][c]);\n }\n }\n }", "async function run() {\n await init();\n updatePlot();\n}" ]
[ "0.7010956", "0.70090115", "0.6837019", "0.6664746", "0.66378295", "0.66346836", "0.6569902", "0.6527904", "0.6523911", "0.64547205", "0.64380044", "0.6369253", "0.6352266", "0.62638223", "0.6231494", "0.6223972", "0.62150896", "0.6210801", "0.61659086", "0.6121369", "0.61207587", "0.6114149", "0.60990924", "0.6071545", "0.6034264", "0.60314476", "0.60294276", "0.6028277", "0.6023096", "0.6011638", "0.6007554", "0.5994349", "0.5979042", "0.59651667", "0.5960138", "0.5956168", "0.5953169", "0.5942744", "0.5937324", "0.5930487", "0.5924236", "0.5914213", "0.5913907", "0.5908827", "0.58990556", "0.5887545", "0.58742905", "0.58713055", "0.5836959", "0.58281434", "0.58269894", "0.5820631", "0.5815436", "0.58111906", "0.58108073", "0.5789224", "0.5785096", "0.5782275", "0.5776474", "0.57761526", "0.57568574", "0.5749397", "0.5739504", "0.573047", "0.5730134", "0.5724645", "0.57148397", "0.5712476", "0.5712054", "0.5707504", "0.5700136", "0.56987643", "0.5696169", "0.568945", "0.5677543", "0.56744134", "0.567075", "0.5669505", "0.56690896", "0.56656384", "0.5663484", "0.56560844", "0.564907", "0.564845", "0.5647213", "0.5642794", "0.5635421", "0.5631648", "0.56295115", "0.5623971", "0.56115925", "0.5607271", "0.5606765", "0.5595406", "0.5594847", "0.5591433", "0.55869514", "0.557952", "0.557927", "0.55682695", "0.55632937" ]
0.0
-1
BEGIN API CALLS NEED TO MAKE A FUNCTION TO MAKE 3 API CALLS AND CREATE RESPONSE VARIABLES
function callWxData(param) { callCurrApi(param) function callCurrApi(param) { queryURL = wxApi + wxCurr + param + imperials + wxKey console.log(queryURL) $.ajax({ url: queryURL, method: "GET" }) .then(function (response) { // NEED TO PASS LON,LAT STRING VALUE TO UV CALL let lat = response.coord.lat; let lon = response.coord.lon; let coords = "lat=" + lat + "&lon=" + lon console.log("Coordinate Check" + coords) callUvApi(coords) activeLocation.name = response.name activeLocation.country = response.sys.country activeLocation.temp = response.main.temp activeLocation.humidity = response.main.humidity activeLocation.wind = response.wind.speed activeLocation.wxCond = response.weather[0].description activeLocation.wxIcon = response.weather[0].icon fiveDay.empty() renderCurrWx() // callDailyApi(param) // OLD CALL callOneApi(coords) }) // end of then function } // end of CURRENT WX ajax call function callOneApi(param) { queryURL = wxOne + param + imperials + wxKey console.log(queryURL) $.ajax({ url: queryURL, method: "GET" }) .then(function (response) { console.log(response) var dailyArray = response.daily console.log(dailyArray) for (let i = 1; i < dailyArray.length - 2; i++) { // // console daily objects let dailyObj = dailyArray[i]; console.log(dailyObj.temp.max) let dayCard = $('<div>').addClass('dayCard').appendTo(fiveDay) //append date insert moment iterator $('<div>').addClass('card-header').appendTo(dayCard).text(nextFive[i - 1].day) let wxDeets = $('<div>').addClass('card-body').appendTo(dayCard) //append icon $('<img>').appendTo(wxDeets).attr('src', "http://openweathermap.org/img/wn/" + dailyObj.weather[0].icon + "@2x.png").prop('alt', activeLocation.wxCond) //temp $('<p>').addClass('card-text').appendTo(wxDeets).text("Temperature: " + dailyObj.temp.max.toFixed(0) + " \xB0F") //append humidity $('<p>').addClass('card-text').appendTo(wxDeets).text("Humidity: " + dailyObj.humidity + "%") // TARGET FIVE DAY CONTAINER AND CREATE ELEMENTS FOR EACH DAY OF OBJECT ARRAY { //create card // let dayCard = $('<div>').addClass('day-card').text() // dayCard.appendTo(fiveDay) // let futureDate = $('<div>').addClass('card-header').text() // futureDate.appendTo(dayCard) // let wxDeets = $('<div>').addClass('card-body').text() // wxDeets.appendTo(dayCard) // let futureIcon = $('<h5>').addClass('card-title').text() // futureIcon.appendTo(wxDeets) // let futureTemp = $('<p>').addClass('card-text').text() // futureTemp.appendTo(wxDeets) // let futureHum = $('<p>').addClass('card-text').text() // futureHum.appendTo(wxDeets) } }) // end of then function } // end of ONE CALL WX ajax call function callUvApi(param) { queryURL = wxApi + wxUvI + param + wxKey console.log(queryURL) $.ajax({ url: queryURL, method: "GET", }) .then(function (response) { activeLocation.uvindex = response.value let uvIndex = parseInt(activeLocation.uvindex) console.log(uvIndex) // $('#cityUv').text("UV Index: " + uvIndex) $('#cityUv').text("UV Index: " + uvIndex.toFixed(1)) if (uvIndex < 3) { $('#cityUv').removeClass().addClass('uvLow') } if (uvIndex >= 3) { $('#cityUv').removeClass().addClass('uvMod') } if (uvIndex >= 5) { $('#cityUv').removeClass().addClass('uvHigh') } if (uvIndex >= 7) { $('#cityUv').removeClass().addClass('uvVhigh') } if (uvIndex >= 10) { $('#cityUv').removeClass().addClass('uvXtreme') } }) // end of then function } // end of UV INDEX ajax call }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function StartR() \r\n {\r\n // request, fetch api data\r\n const response = await fetch(api_url); //fetch\r\n const data = await response.json(); //api\r\n let json_split = JSON.parse(JSON.stringify(data)); // split api data\r\n\r\n // only for the first request\r\n if (beginvar == true){\r\n console.log(\"first try\");\r\n render_call(json_split, waisted_count, beginvar);\r\n last_api = json_split[0].id;\r\n beginvar = false; \r\n } \r\n else{\r\n console.log(\"secound try\");\r\n waisted_count = while_count(last_api, json_split);\r\n render_call(json_split, waisted_count, beginvar);\r\n }\r\n console.log(\"assync vege 15perc \" + \"Last API: \" + last_api);\r\n }", "static async updateVariables(){\n\n //Get instance of VariablesOperations Class\n let variablesOperations = new VariablesOperations();\n\n //Get instance of BodyWrapper Class that will contain the request body\n let request = new BodyWrapper();\n\n //Array to hold Variable instances\n let variableArray = [];\n\n //Get instance of Variable Class\n let variable1 = new ZCRMVariable();\n\n variable1.setId(3477061000006852038n);\n\n variable1.setValue(\"4763\");\n\n variableArray.push(variable1);\n\n variable1 = new ZCRMVariable();\n\t\t\n\t\tvariable1.setId(3409643000002275035n);\n\t\t\n\t\tvariable1.setDescription(\"This is a new description\");\n\t\t\n\t\tvariableArray.push(variable1);\n\t\t\n\t\tvariable1 = new ZCRMVariable();\n\t\t\n\t\tvariable1.setAPIName(\"NewAPI\");\n\t\t\n variableArray.push(variable1);\n \n //Set the array to variables in BodyWrapper instance\n request.setVariables(variableArray);\n\n //Call updateVariables method that takes BodyWrapper class instance as parameter\n let response = await variablesOperations.updateVariables(request);\n\n if(response != null){\n\n //Get the status code from response\n console.log(\"Status Code: \" + response.statusCode);\n\n //Get object from response\n let responseObject = response.object;\n\n if(responseObject != null){\n\n //Check if expected ActionWrapper instance is received \n if(responseObject instanceof ActionWrapper){\n\n //Get the array of obtained ActionResponse instances\n let actionResponses = responseObject.getVariables();\n\n actionResponses.forEach(actionResponse => {\n\n //Check if the request is successful\n if(actionResponse instanceof SuccessResponse){\n\n //Get the Status\n console.log(\"Status: \" + actionResponse.getStatus().getValue());\n\n //Get the Code\n console.log(\"Code: \" + actionResponse.getCode().getValue());\n\n console.log(\"Details\");\n\n //Get the details map\n let details = actionResponse.getDetails();\n\n if(details != null){\n Array.from(details.keys()).forEach(key => {\n console.log(key + \": \" + details.get(key)); \n });\n }\n\n console.log(\"Message: \" + actionResponse.getMessage().getValue());\n }\n //Check if the request returned an exception\n else if(actionResponse instanceof APIException){\n\n //Get the Status\n console.log(\"Status: \" + actionResponse.getStatus().getValue());\n\n //Get the Code\n console.log(\"Code: \" + actionResponse.getCode().getValue());\n\n console.log(\"Details\");\n\n //Get the details map\n let details = actionResponse.getDetails();\n\n if(details != null){\n Array.from(details.keys()).forEach(key => {\n console.log(key + \": \" + details.get(key)); \n });\n }\n\n //Get the Message\n console.log(\"Message: \" + actionResponse.getMessage().getValue());\n } \n });\n }\n //Check if the request returned an exception\n else if(responseObject instanceof APIException){\n\n //Get the Status\n console.log(\"Status: \" + responseObject.getStatus().getValue());\n\n //Get the Code\n console.log(\"Code: \" + responseObject.getCode().getValue());\n\n console.log(\"Details\");\n\n //Get the details map\n let details = responseObject.getDetails();\n\n if(details != null){\n Array.from(details.keys()).forEach(key => {\n console.log(key + \": \" + details.get(key)); \n });\n }\n\n //Get the Message\n console.log(\"Message: \" + responseObject.getMessage().getValue());\n }\n }\n }\n }", "static makeAPICall(endpoint, input, options = {}) {\n switch (endpoint) {\n case GET_TOKEN:\n if (options.body === undefined) {\n options.body = {};\n }\n options.body.client_id = process.env.REACT_APP_CLIENT_ID;\n return this._fetchFromAPI(this.authUrlBeginning + \"token/\", options);\n case CREATE_USER:\n return this._fetchFromAPI(this.urlBeginning + \"createUser/\", options);\n case VALIDATE_TOKEN:\n return this._addAuthorization(this.urlBeginning + \"validateToken/\");\n case FORGOT_PASSWORD:\n return this._fetchFromAPI(this.urlBeginning + \"password_reset/\", options);\n case RESET_PASSWORD:\n return this._fetchFromAPI(this.urlBeginning + \"password_reset/confirm\", options);\n case UPLOAD_DOCUMENT:\n return this._addAuthorization(this.urlBeginning + \"uploadDoc/\", options);\n case UPLOAD_ANNOTATIONS:\n return this._addAuthorization(this.urlBeginning + \"uploadAnnot/\", options);\n case GET_ALL_ANNOTE_BY_CURRENT_USER:\n return this._addAuthorization(this.urlBeginning + \"getAllMyAnnots/\" + (input == null ? \"\" : input));\n case GET_ALL_ANNOTE:\n return this._addAuthorization(this.urlBeginning + \"getAllAnnots/\" + (input == null ? \"\" : input));\n case GET_ANNOTATIONS_FILENAME_USER:\n return this._addAuthorization(this.urlBeginning + \"getAnnotationsByFilenameUser/\" + input + this.json);\n case EXPORT_CURRENT_ANNOTATIONS:\n return this._addAuthorization(this.urlBeginning + \"exportAnnotations/\" + input + this.json);\n case DOWNLOAD_ANNOTATIONS_BY_ID:\n return this._addAuthorization(this.urlBeginning + \"downloadAnnotations/\" + input + this.json);\n\n // ICD APIs\n case ANCESTORS:\n return this._addAuthorization(this.urlBeginning + \"ancestors/\" + input + this.json);\n case FAMILY:\n return this._addAuthorization(this.urlBeginning + \"family/\" + input + this.json);\n case CODE_AUTO_SUGGESTIONS:\n return this._addAuthorization(this.urlBeginning + \"codeAutosuggestions/\" + input + this.json);\n case CODE_DESCRIPTION:\n return this._addAuthorization(this.urlBeginning + \"codeDescription/\" + input + this.json);\n default:\n return null;\n }\n }", "function loop_request(){\r\n let waisted_count = 0; // set to 0\r\n \r\n //requset from api\r\n async function StartR() \r\n {\r\n // request, fetch api data\r\n const response = await fetch(api_url); //fetch\r\n const data = await response.json(); //api\r\n let json_split = JSON.parse(JSON.stringify(data)); // split api data\r\n\r\n // only for the first request\r\n if (beginvar == true){\r\n console.log(\"first try\");\r\n render_call(json_split, waisted_count, beginvar);\r\n last_api = json_split[0].id;\r\n beginvar = false; \r\n } \r\n else{\r\n console.log(\"secound try\");\r\n waisted_count = while_count(last_api, json_split);\r\n render_call(json_split, waisted_count, beginvar);\r\n }\r\n console.log(\"assync vege 15perc \" + \"Last API: \" + last_api);\r\n }\r\n StartR();\r\n}", "static async getVariables(){\n\n //Get instance of VariablesOperations Class\n let variablesOperations = new VariablesOperations();\n\n //Get instance of ParameterMap Class\n let paramInstance = new ParameterMap();\n\n /* Possible parameters of Get Variables operation */\n await paramInstance.add(GetVariablesParam.GROUP, \"General\");\n\n //Call getVariables method that takes ParameterMap instance as parameter\n let response = await variablesOperations.getVariables(paramInstance);\n\n if(response != null){\n\n //Get the status code from response\n console.log(\"Status Code: \" + response.statusCode);\n\n if([204, 304].includes(response.statusCode)){\n console.log(response.statusCode == 204? \"No Content\" : \"Not Modified\");\n\n return;\n }\n\n //Get object from response\n let responseObject = response.object;\n\n if(responseObject != null){\n\n //Check if expected ResponseWrapper instance is received \n if(responseObject instanceof ResponseWrapper){\n\n //Get the array of obtained Variable instances\n let variables = responseObject.getVariables();\n\n variables.forEach(variable => {\n\n //Get the ID of each Variable\n console.log(\"Variable ID: \" + variable.getId());\n\n //Get the APIName of each Variable\n console.log(\"Variable APIName: \" + variable.getAPIName());\n\n //Get the Name of each Variable\n console.log(\"Variable Name: \" + variable.getName());\n\n //Get the Description of each Variable\n console.log(\"Variable Description: \" + variable.getDescription());\n\n //Get the Type of each Variable\n console.log(\"Variable Type: \" + variable.getType());\n\n //Get the VariableGroup instance of each Variable\n let variableGroup = variable.getVariableGroup();\n\n //Check if variableGroup is not null\n if(variableGroup != null){\n //Get the APIName of the VariableGroup\n console.log(\"Variable VariableGroup APIName: \" + variableGroup.getAPIName());\n\n //Get the ID of the VariableGroup\n console.log(\"Variable VariableGroup ID: \" + variableGroup.getId());\n }\n\n //Get the Value of each Variable\n console.log(\"Variable Value: \" + variable.getValue());\n });\n }\n //Check if the request returned an exception\n\t\t\t\telse if(responseObject instanceof APIException){\n\t\t\t\t\t//Get the Status\n\t\t\t\t\tconsole.log(\"Status: \" + responseObject.getStatus().getValue());\n\n\t\t\t\t\t//Get the Code\n\t\t\t\t\tconsole.log(\"Code: \" + responseObject.getCode().getValue());\n\n\t\t\t\t\tconsole.log(\"Details\");\n\n\t\t\t\t\t//Get the details map\n\t\t\t\t\tlet details = responseObject.getDetails();\n\n\t\t\t\t\tif(details != null){\n\t\t\t\t\t\tArray.from(details.keys()).forEach(key => {\n\t\t\t\t\t\t\tconsole.log(key + \": \" + details.get(key)); \n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t//Get the Message\n\t\t\t\t\tconsole.log(\"Message: \" + responseObject.getMessage().getValue());\n\t\t\t\t}\n }\n }\n }", "static async createVariables(){\n\n //Get instance of VariablesOperations Class\n let variablesOperations = new VariablesOperations();\n\n //Get instance of BodyWrapper Class that will contain the request body\n let request = new BodyWrapper();\n\n //Array to hold Variable instances\n let variableArray = [];\n\n //Get instance of Variable Class\n let variable1 = new ZCRMVariable();\n\n //Set the name to variable\n variable1.setName(\"Variable551\");\n \n //Set the API name to variable\n variable1.setAPIName(\"Variable551\");\n \n //Get instance of VariableGroup Class\n let variableGroup = new VariableGroup();\n\n //Set the ID to VariableGroup instance\n variableGroup.setName(\"Create me\");\n\n //Set the VariableGroup to Variable instance\n variable1.setVariableGroup(variableGroup);\n\n //Set the type to Variable\n variable1.setType(\"integer\");\n \n //Set the value to Variable\n\t\tvariable1.setValue(\"55\");\n\t\t\n variable1.setDescription(\"This denotes variable 5 description\");\n \n //Add the variable instance to the array\n variableArray.push(variable1);\n\n variable1 = new ZCRMVariable();\n\n variable1.setName(\"Variable661\");\n\t\t\n\t\tvariable1.setAPIName(\"Variable661\");\n\t\t\n\t\tvariableGroup = new VariableGroup();\n\t\t\n\t\tvariableGroup.setName(\"General\");\n\t\t\n\t\tvariable1.setVariableGroup(variableGroup);\n\t\t\n\t\tvariable1.setType(\"text\");\n\t\t\n\t\tvariable1.setValue(\"Hello\");\n\t\t\n\t\tvariable1.setDescription(\"This denotes variable 6 description\");\n \n //Add the variable instance to the array\n variableArray.push(variable1);\n \n //Set the array to variables in BodyWrapper instance\n request.setVariables(variableArray);\n\n //Call createVariables method that takes BodyWrapper instance as parameter\n let response = await variablesOperations.createVariables(request);\n\n if(response != null){\n\n //Get the status code from response\n console.log(\"Status Code: \" + response.statusCode);\n\n //Get object from response\n let responseObject = response.object;\n\n if(responseObject != null){\n\n //Check if expected ActionWrapper instance is received \n if(responseObject instanceof ActionWrapper){\n\n //Get the array of obtained ActionResponse instances\n let actionResponses = responseObject.getVariables();\n\n actionResponses.forEach(actionResponse => {\n\n //Check if the request is successful\n if(actionResponse instanceof SuccessResponse){\n\n //Get the Status\n console.log(\"Status: \" + actionResponse.getStatus().getValue());\n\n //Get the Code\n console.log(\"Code: \" + actionResponse.getCode().getValue());\n\n console.log(\"Details\");\n\n //Get the details map\n let details = actionResponse.getDetails();\n\n if(details != null){\n Array.from(details.keys()).forEach(key => {\n console.log(key + \": \" + details.get(key)); \n });\n }\n\n console.log(\"Message: \" + actionResponse.getMessage().getValue());\n }\n //Check if the request returned an exception\n else if(actionResponse instanceof APIException){\n\n //Get the Status\n console.log(\"Status: \" + actionResponse.getStatus().getValue());\n\n //Get the Code\n console.log(\"Code: \" + actionResponse.getCode().getValue());\n\n console.log(\"Details\");\n\n //Get the details map\n let details = actionResponse.getDetails();\n\n if(details != null){\n Array.from(details.keys()).forEach(key => {\n console.log(key + \": \" + details.get(key)); \n });\n }\n\n //Get the Message\n console.log(\"Message: \" + actionResponse.getMessage().getValue());\n } \n });\n }\n //Check if the request returned an exception\n else if(responseObject instanceof APIException){\n\n //Get the Status\n console.log(\"Status: \" + responseObject.getStatus().getValue());\n\n //Get the Code\n console.log(\"Code: \" + responseObject.getCode().getValue());\n\n console.log(\"Details\");\n\n //Get the details map\n let details = responseObject.getDetails();\n\n if(details != null){\n Array.from(details.keys()).forEach(key => {\n console.log(key + \": \" + details.get(key)); \n });\n }\n\n //Get the Message\n console.log(\"Message: \" + responseObject.getMessage().getValue());\n }\n }\n }\n }", "function API(){}", "function API(){}", "function callApi() {\n return setCuisine().then((res) => {\n setIntolerance().then((res2) => {\n setDiet().then((res3) => {\n var tabIntolerances = []\n var tabCuisine = []\n var resultFile = []\n\n // Traitement des résultats inscrit par l'utilisateur\n // Pour pouvoir les mettre dans l'URL\n for(var i = 0; i < res2['intolerances'].length; i++) {\n tabIntolerances += res2['intolerances'][i] + '%2C+'\n }\n\n for(var i = 0; i < res['cuisine'].length; i++) {\n tabCuisine += res['cuisine'][i] + '%2C+'\n }\n\n if(res3 == 'Om nom nom, I eat everything') {\n res3 = ''\n }\n\n unirest.get(`https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/search?\n diet${res3['diet']}\n &cuisine=${tabCuisine}\n &intolerances=${tabIntolerances}\n &limitLicense=false\n &type=main+course`)\n .header(\"X-Mashape-Key\", \"mnuIxvIQSamshydbUwjdW6RTqapVp1J5b4YjsnJF4NF7n9uRi5\")\n .header(\"Accept\", \"application/json\")\n .end(function (result) {\n var recipes = result.body\n var promises = []\n var compteur = 0 \n var compteurMax = recipes['results'].length - 1\n\n // Permet de récupérer les recettes de manière récursive\n getRecipes(promises, compteur, compteurMax, recipes)\n })\n })\n })\n }) \n}", "async processRequest(id, caller, apis, response_type, aggregation_type, context, prefered_api, string_to_count, options, assigned_oracle, standby_oracle) {\n\n\t\t\n\t\tvar results = [];\n\t\tvar api_response_set = [];\n\t\tfor (var api of apis) {\n\t\t\tvar result = null;\n\t\t\tif (api.endpoint.match(/^(https:\\/\\/)?(localhost|127\\.0\\.0\\.1)/) === null) {\n\t\t\t\ttry {\n\t\t\t\t\tresult = await this.getResult(api, api.endpoint, api.json_field, response_type);\n\t\t\t\t\tconsole.log(\"request processor, inside processReq result :\", result)\n\t\t\t\t\t\n\t\t\t\t\tif (result !== null) {\n\t\t\t\t\t\tapi[\"response\"] = result;\n\t\t\t\t\t\tapi[\"api\"] = api['endpoint'];\n\t\t\t\t\t\tdelete api['endpoint'];\n\t\t\t\t\t\tapi_response_set.push(api);\n\t\t\t\t\t\tresults.push(result);\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\tconsole.error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log('Skipping request to localhost.');\n\t\t\t}\n\t\t}\n\n\n\t\tvar confirmed_response = results.filter((value,index,arr)=>{\n\t\t\treturn value!=undefined\n\t\t})\n\t\n\t\t\n\t\tconsole.log(\"request processor, inside processReq confirmed_response.length :\", confirmed_response.length)\n\t\tconsole.log(\"request processor, inside processReq apis.length/2 :\", apis.length/2)\n\t\tconsole.log(\"request processor, inside processReq confirmed_response.length>=apis.length/2 :\", (confirmed_response.length>=apis.length/2) )\n\t\tconsole.log(\"request processor, inside processReq results[prefered_api] :\", results[prefered_api])\n\n\n\t\tif(confirmed_response.length>=apis.length/2 )\n\t\t{\n\t\t\tresult = aggregate (confirmed_response, aggregation_type, string_to_count)\n\t\t}\n\t\telse if(prefered_api)\n\t\t{\n\t\t\tconsole.log(\"prefered_api: ~~~~~~~~~~\",prefered_api);\n\t\t\tif(results[prefered_api])\n\t\t\t{\n\t\t\t\tresult = results[prefered_api];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = aggregate (confirmed_response, aggregation_type, string_to_count)\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult = aggregate (confirmed_response, aggregation_type, string_to_count)\n\t\t}\n\t\t\n\t\tvar encoded = \"\";\n\t\ttry {\n\t\t\tconsole.log(\"request processor, inside processReq before encodeing aggregation :\", result)\n\t\t\tencoded = encode(result, response_type);\n\t\t}\n\t\tcatch (e) {\n\t\t\tconsole.error(e);\n\t\t}\n\t\n\t\tconsole.log(\"request processor, inside processReq encoded :\", encoded)\n\t\tconsole.log(\"apaiaapapiapiaiapaipapapia\", api_response_set)\n\t\tconsole.log(\"apaiaapapiapiaiapaipapapia\", result)\n\n\t\tawait this.audit_trail(id, caller, api_response_set, response_type, aggregation_type, result, context, options, assigned_oracle, standby_oracle );\n\n\n\t\treturn encoded;\n\t}", "async function callApi() {\n try {\n const peopleData = await API.get('mainappapi', '/people');\n console.log('peopleData: ', peopleData)\n updatePeople(peopleData.people)\n const coinsData = await API.get('mainappapi', '/coins');\n console.log('coinsData: ', coinsData)\n updateCoins(coinsData.coins)\n } catch (err) {\n console.log({ err })\n }\n }", "async function main() {\n // create the promises first\n var call1 = myApiClient(1)\n var call2 = myApiClient(2)\n\n // then wait for them\n var response1 = await call1\n var response2 = await call2\n\n // do something with the responses\n var message = response1['message'] + ' ' + response2['message']\n console.log(message)\n}", "function startAPIRequests()\t{\n // Get app configuration.\n loadConfig().then(() => {\n // -> Get save data.\n afterConfigLoaded();\n loadVideoInformation().then(() => {\n // -> start requesting subs.\n requestSubs();\n });\n });\n}", "async oldAPImain() {\n // create objects\n let promises = [];\n for (const obj of utils_1.oldAPIStates) {\n const id = obj._id;\n // use extend to update stuff like types if they were wrong, but preserve name\n promises.push(this.extendObjectAsync(id, obj, { preserve: { common: ['name'] } }));\n }\n await Promise.all(promises);\n promises = [];\n promises.push(this.requestStateAndSetOldAPI(`M03`, `status.production`));\n promises.push(this.requestStateAndSetOldAPI(`M04`, `status.consumption`));\n promises.push(this.requestStateAndSetOldAPI(`M05`, `status.relativeSoc`));\n promises.push(this.requestStateAndSetOldAPI(`M06`, `status.operatingMode`));\n promises.push(this.requestStateAndSetOldAPI(`M07`, `status.consumptionL1`));\n promises.push(this.requestStateAndSetOldAPI(`M08`, `status.consumptionL2`));\n promises.push(this.requestStateAndSetOldAPI(`M09`, `status.consumptionL3`));\n promises.push(this.requestStateAndSetOldAPI(`M34`, `status.pacDischarge`));\n promises.push(this.requestStateAndSetOldAPI(`M35`, `status.pacCharge`));\n try {\n await Promise.all(promises);\n await this.setState(`info.lastSync`, Date.now(), true);\n const state = await this.getStateAsync(`info.connection`);\n if (!(state === null || state === void 0 ? void 0 : state.val)) {\n await this.setState(`info.connection`, true, true);\n }\n }\n catch (e) {\n this.log.warn(`[DATA] Error getting Data ${e.message}`);\n }\n const pollStates = async () => {\n // poll states every configured seconds\n const promises = [];\n promises.push(this.requestStateAndSetOldAPI(`M03`, `status.production`));\n promises.push(this.requestStateAndSetOldAPI(`M04`, `status.consumption`));\n promises.push(this.requestStateAndSetOldAPI(`M05`, `status.relativeSoc`));\n promises.push(this.requestStateAndSetOldAPI(`M06`, `status.operatingMode`));\n promises.push(this.requestStateAndSetOldAPI(`M34`, `status.pacDischarge`));\n promises.push(this.requestStateAndSetOldAPI(`M35`, `status.pacCharge`));\n promises.push(this.requestStateAndSetOldAPI(`M07`, `status.consumptionL1`));\n promises.push(this.requestStateAndSetOldAPI(`M08`, `status.consumptionL2`));\n promises.push(this.requestStateAndSetOldAPI(`M09`, `status.consumptionL3`));\n try {\n await Promise.all(promises);\n this.setState(`info.lastSync`, Date.now(), true);\n this.setStateChanged(`info.connection`, true, true);\n }\n catch (e) {\n await this.setStateChangedAsync(`info.connection`, false, true);\n this.log.warn(`[DATA] Error getting Data ${e.message}`);\n }\n this.polling = setTimeout(pollStates, this.pollingTime);\n };\n pollStates();\n }", "async function apiRequest(_method, ..._params) \n{\n const params = [];\n params.push(..._params);\n const apiParams = params.join('');\n try {\n const url = `https://api.flickr.com/services/rest/?method=${_method}&api_key=${APIkey}${apiParams}${format}`;\n const flickrApi = await fetch(url);\n\n const data = await flickrApi.json();\n\n if(data.stat === 'fail') {\n console.log('Ops, something went wrong :(');\n }else{ \n return data;\n }\n } catch (e) {\n return e;\n }\n }", "function rpcCall( xsrfToken, cookie){\nvar options = {\n host: 'coeportal167.saphosting.de', //\n // port: 443,\n path: '/sap/bc/jsonrpc',\n\n// authentication headers\n auth: username+':'+passw,\n headers: {\n // 'Authorization': 'Basic ' + new Buffer(username + ':' + passw).toString('base64'),\n 'X-CSRF-Token': xsrfToken,\n 'X-Requested-With':'XMLHttpRequest',\n cookie: cookie\n },\n agent: false, // or you can supply your own agent, but if you don't you must set to false\n rejectUnauthorized: true,\n ca: [ fs.readFileSync('certs/PCA-3G5.pem') ]\n};\n\n console.log('XSRF again: ' + xsrfToken);\n// create a client\nvar client = jayson.client.https(options);\n\nconsole.log('RPC Client created');\n\n var batch = [\n client.request('BAPI_USER_GET_DETAIL', { \"CACHE_RESULTS\": 'X', \"USERNAME\": 'DDIC' }),\n client.request('BAPI_USER_GET_DETAIL', {\"CACHE_RESULTS\": 'X', \"USERNAME\": 'SAP*' }),\n client.request('BAPI_USER_GET_DETAIL', {}) // a notification\n ];\n\n// invoke \"BAPI_USER_GET_DETAIL\"\n var request =\nclient.request(batch, function(err, error, response) {\n if(err) throw err; {\n\n console.log(\"Error Response\",response); // 2!\n }\n console.log(error);\n console.log(err);\n}\n\n);\n\n console.log('Request:',request);\n\n}", "async function do_api_request (url_params) {\n const api_url = await get_api_url();\n const api_info = await get_api_info();\n\n // Append token / timestamp to request\n url_params.append(\"token\", await get_token(api_url, api_info));\n url_params.append(\"t\", Date.now());\n\n // Make request URL from params\n const url = `${api_url}/?${url_params.toString()}`;\n\n const res_body = await fetch(url, api_info);\n const res_json = await res_body.json();\n\n return res_json;\n}", "async apiCall(body) {\n const apiMethod = this.api.get(body.method);\n if (apiMethod === undefined) return { jsonrpc: '2.0', error: JSONRPC_ERRORS['-32601'], id: body.id || null };\n\n // Get user from session and set it to `_user` key in params object\n // Get users id from session\n if (body.params._sid) {\n const userSession = await this.sessions.get(body.params._sid);\n const { userId } = JSON.parse(userSession);\n if (userId) {\n const result = await this.db.query('SELECT id, email, first_name, last_name FROM users WHERE id=$1;', [userId]);\n body.params._user = result.rows[0];\n }\n }\n\n // If the method is a notification start running it and return\n if (apiMethod.type === 'notification') {\n apiMethod.handler(this, body.params);\n return;\n }\n\n // If the request does not have an id or it is not an int, return an error\n if (body.id === undefined || typeof body.id !== 'number') {\n return { jsonrpc: '2.0', error: JSONRPC_ERRORS['-32600'], id: null };\n }\n\n // If request has invalid params (it should be undefined or an 'object') return an invalid request error\n if (typeof body.params !== 'undefined' && typeof body.params !== 'object') {\n return { jsonrpc: '2.0', error: JSONRPC_ERRORS['-32600'], id: body.id };\n }\n\n try {\n const result = await apiMethod.handler(this, body.params);\n return { jsonrpc: '2.0', id: body.id, result };\n } catch (err) {\n this.logger.error(err.stack);\n return { jsonrpc: '2.0', id: body.id, error: err };\n }\n }", "call(query, languageCode, context, sessionId) {\n // call(query:string, latitude:string, longitude:string, sessionId:string, iana_timezone:string, contexts: string[]): Promise<any> {\n let data = {\n \"query\": query,\n \"lang\": \"en\",\n \"sessionId\": sessionId,\n \"location\": {\n \"latitude\": Number('42.361145'),\n \"longitude\": Number('-71.057083'),\n },\n \"timezone\": 'America/New_York'\n };\n if (context) {\n data.contexts = [context];\n }\n let raw_url = \"\";\n return new Promise((resolve, reject) => {\n request.post({\n headers: {\n \"Content-Type\": \"application/json; charset=utf-8\",\n \"Authorization\": `${this.apiAuthorization}`\n },\n url: 'https://api.api.ai/v1/query?v=20150910',\n body: JSON.stringify(data)\n }, (error, response, body) => {\n if (error) {\n //console.log(error);\n reject(error);\n }\n else {\n let body_obj = JSON.parse(body);\n resolve(body_obj);\n }\n });\n });\n }", "async function APIcall(requestInformation){\n\tconsole.log(requestInformation)\n\tconst response = await axios({\n\t\tmethod : 'post',\n\t\turl : 'https://api.daimler-mobility.com/internal/ocapi/v2/de/calculations',\n\t\tdata : {\n\t\t\t\"context\": \n\t\t\t{\n\t\t\t\t\"input\": \n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"customer_type\",\n\t\t\t\t\t\t\"value\": requestInformation.customer_group\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"calculation_type\",\n\t\t\t\t\t\t\"value\": \"leasing\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"deposit_amount\",\n\t\t\t\t\t\t\"value\": requestInformation.sonderzahlung + requestInformation.downpayment\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"period_months\",\n\t\t\t\t\t\t\"value\": requestInformation.laufzeit\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"total_mileage\",\n\t\t\t\t\t\t\"value\": (requestInformation.km*requestInformation.laufzeit)/12\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\t\"caller\": \"cc\",\n\t\t\t\t\"market\": \"DE\",\n\t\t\t\t\"locale\": \"de_DE\"\n\t\t\t},\n\t\t\t\"vehicle\": \n\t\t\t{\n\t\t\t\t\"name\": requestInformation.name,\n\t\t\t\t\"prices\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"id\": \"purchasePrice\",\n\t\t\t\t\t\t\"rawValue\": requestInformation.brutto_list_price_mitSonderausstattung\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\t\"vehicleConfiguration\": {\n\t\t\t\t\t\"baumuster\": requestInformation.baumuster,\n\t\t\t\t\t\"modelYear\": requestInformation.modelYear,\n\t\t\t\t\t\"division\": \"pc\",\n\t\t\t\t\t\"brand\":\"mercedes-benz\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t})\n .then(res => res.data.output)\n\t\n\tconst collected_discount = requestInformation.collected_discount\n\tconst rate = response.rate\n\tconst aktion_str = response.containers.filter(item => item.id.includes('fullSummary'))[0].items.filter(item => item.id.includes('installment'))[0].disclaimer\n\tconst aktion = aktion_str === null ? \"null\" : aktion_str.substr(aktion_str.length-5)\n \n\tconsole.log(\"containers: \" + response.containers)\n\tconsole.log(\"str1 : \"+ aktion_str)\n//\tconsole.log(\"ding : \"+ leasing_product)\n\tWriteBackGoogleSheet (collected_discount,rate,aktion)\n}", "function callAPIs( APIs ) {\n var API = APIs.shift();\n setTimeout(function(){\n console.log(API);\n request(API, function(err, res, body) { \n if( APIs.length ) {\n callAPIs ( APIs );\n }\n });\n },3000);\n}", "function call_api(finishedAPI) {\n request('https://api.nasa.gov/planetary/apod?api_key=0uKX4xKAlZRAVq4uqHlrUTbiHmQ7et6zW7QvbAi6&hd=false', { json: true }, (err, res, body) => {\n if (err) { return console.log(err); }\n if (res.statusCode === 200) {\n finishedAPI(body);\n };\n });\n }", "function callAndStore(pairArr, exchange, pair, resObj) {\n\n var pairURL = pairArr[0];\n var bidPath = pairArr[1];\n var askPath = pairArr[2];\n var lastPath = pairArr[3];\n\n\n //handle binance's second endpoint for last\n if (exchange == 'binance') {\n //bid and ask endpoint\n standardAPITicker(pairURL, bidPath, askPath, lastPath, (APIresp) => {\n //all these checks to make sure other call hasn't alraedy made these objects\n //inside the response object so it doesn't overwrite (which it will on assigment =)\n if (resObj[exchange]) {\n if (resObj[exchange][pair]) {\n if (resObj[exchange][pair][\"prices\"]) {\n if (APIresp.APIStatusCode == 200) {\n resObj[exchange][pair][\"prices\"][\"bid\"] = APIresp.prices.bid;\n resObj[exchange][pair][\"prices\"][\"ask\"] = APIresp.prices.ask;\n } else {\n resObj[exchange][pair][\"prices\"][\"bid\"] = APIresp.message;\n resObj[exchange][pair][\"prices\"][\"ask\"] = APIresp.message;\n }\n } else {\n resObj[exchange][pair][\"prices\"] = {};\n if (APIresp.APIStatusCode == 200) {\n resObj[exchange][pair][\"prices\"][\"bid\"] = APIresp.prices.bid;\n resObj[exchange][pair][\"prices\"][\"ask\"] = APIresp.prices.ask;\n } else {\n resObj[exchange][pair][\"prices\"][\"bid\"] = APIresp.message;\n resObj[exchange][pair][\"prices\"][\"ask\"] = APIresp.message;\n }\n }\n }\n else {\n resObj[exchange][pair] = {};\n resObj[exchange][pair][\"prices\"] = {};\n if (APIresp.APIStatusCode == 200) {\n resObj[exchange][pair][\"APIStatusCode\"] = 200;\n resObj[exchange][pair][\"prices\"][\"bid\"] = APIresp.prices.bid;\n resObj[exchange][pair][\"prices\"][\"ask\"] = APIresp.prices.ask;\n }\n else {\n resObj[exchange][pair][\"APIStatusCode\"] = 400;\n resObj[exchange][pair][\"prices\"][\"bid\"] = APIresp.message;\n resObj[exchange][pair][\"prices\"][\"ask\"] = APIresp.message;\n }\n }\n }\n else {\n resObj[exchange] = {};\n if (APIresp.APIStatusCode == 200) {\n resObj[exchange][pair] = APIresp;\n } else {\n resObj[exchange][pair] = {};\n resObj[exchange][pair][\"prices\"] = {};\n resObj[exchange][pair][\"prices\"][\"ask\"] = APIresp.message;\n resObj[exchange][pair][\"prices\"][\"bid\"] = APIresp.message;\n }\n }\n });\n\n //last price endpoint\n var binanceLastURL = \"https://api.binance.com/api/v3/ticker/price?symbol=\" + pair;\n standardAPITicker(binanceLastURL, bidPath, askPath, \"price\", (lastResp) => {\n if (resObj[exchange]) {\n if (resObj[exchange][pair]) {\n if (resObj[exchange][pair][\"prices\"]) {\n if (lastResp.APIStatusCode == 200) {\n resObj[exchange][pair][\"prices\"][\"last\"] = lastResp.prices.last;\n } else {\n resObj[exchange][pair][\"prices\"][\"last\"] = lastResp.message;\n }\n } else {\n resObj[exchange][pair][\"prices\"] = {};\n if (lastResp.APIStatusCode == 200) {\n resObj[exchange][pair][\"prices\"][\"last\"] = lastResp.prices.last;\n } else {\n resObj[exchange][pair][\"prices\"][\"last\"] = lastResp.message;\n }\n }\n }\n else {\n resObj[exchange][pair] = {};\n resObj[exchange][pair][\"prices\"] = {};\n if (lastResp.APIStatusCode == 200) {\n resObj[exchange][pair][\"APIStatusCode\"] = 200;\n resObj[exchange][pair][\"prices\"][\"last\"] = lastResp.prices.last;\n }\n else {\n resObj[exchange][pair][\"prices\"][\"last\"] = lastResp.message;\n }\n }\n }\n else {\n resObj[exchange] = {};\n if (lastResp.APIStatusCode == 200) {\n resObj[exchange][pair] = lastResp;\n } else {\n resObj[exchange][pair] = {};\n resObj[exchange][pair][\"prices\"] = {};\n resObj[exchange][pair][\"prices\"][\"last\"] = lastResp.message;\n }\n }\n });\n }///////////////end of binance mess handling\n\n //non-binance exchange\n else {\n standardAPITicker(pairURL, bidPath, askPath, lastPath, (APIresp) => {\n if (resObj[exchange]) resObj[exchange][pair] = APIresp;\n else { resObj[exchange] = {}; resObj[exchange][pair] = APIresp; }\n });\n }\n\n}////////////end of callAndStore function", "_requestApiData(api, league, delay) {\n var self = this;\n var url = buildApiUrl(api.overview, api.type, league);\n console.log(url);\n\n return new Promise(function (resolve, reject) {\n // Request the API\n setTimeout(function () {\n request(url, { json: true, headers: { Connection: \"keep-alive\" } })\n .then((contents) => {\n return self._processRequest(contents, api, league, resolve, reject);\n })\n .catch((error) => {\n return reject(error);\n });\n }, delay);\n });\n }", "function test2() {\n\tvar start = new Date();\n\n\tgetJsonWithCallback('vessels.json?parameter=a', function(a) {\n\t\tgetJsonWithCallback('vessels.json?parameter=b', function(a) {\n\t\t\tgetJsonWithCallback('vessels.json?parameter=c', function(a) {\n\t\t\t\tgetJsonWithCallback('vessels.json?parameter=d', function(a) {\n\t\t\t\t\tgetJsonWithCallback('vessels.json?parameter=e', function(a) {\n\t\t\t\t\t\tvar diff = (new Date()) - start;\n\t\t\t\t\t\tconsole.log('Did 5 API calls in ' + diff + ' millis');\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n}", "function api_proc(q) {\n if (q.setimmediate) {\n clearTimeout(q.setimmediate);\n q.setimmediate = false;\n }\n if (q.ctxs[q.i].length || !q.ctxs[q.i ^ 1].length) return;\n q.i ^= 1;\n if (!q.xhr) q.xhr = getxhr();\n q.xhr.q = q;\n q.xhr.onerror = function() {\n if (!this.q.cancelled) {\n if (d) console.log('API request error - retrying');\n api_reqerror(q, -3);\n }\n }\n q.xhr.onload = function() {\n if (!this.q.cancelled) {\n var t;\n if (this.status == 200) {\n var response = this.responseText || this.response;\n if (d) console.log('API response: ', response);\n try {\n t = JSON.parse(response);\n if (response[0] == '{') t = [\n t\n ];\n } catch (e) {\n // bogus response, try again\n console.log('Bad JSON data in response: ' + response);\n t = EAGAIN;\n }\n } else {\n if (d) console.log('API server connection failed (error ' + this.status + ')');\n t = ERATELIMIT;\n }\n if (typeof t == 'object') {\n for (var i = 0; i < this.q.ctxs[this.q.i].length; i++)\n if (this.q.ctxs[this.q.i][i].callback) this.q.ctxs[this.q.i][i].callback(t[i], this.q.ctxs[this.q.i][i], this);\n this.q.rawreq = false;\n this.q.backoff = 0; // request succeeded - reset backoff timer\n this.q.cmds[this.q.i] = [];\n this.q.ctxs[this.q.i] = [];\n api_proc(q);\n } else api_reqerror(this.q, t);\n }\n }\n if (q.rawreq === false) {\n q.url = apipath + q.service + '?id=' + (q.seqno++) + '&' + q.sid;\n if (typeof q.cmds[q.i][0] == 'string') {\n q.url += '&' + q.cmds[q.i][0];\n q.rawreq = '';\n } else q.rawreq = JSON.stringify(q.cmds[q.i]);\n }\n api_send(q);\n}", "static async makeRequest(action, params, url) {\n const {reqMethods} = await import('./request.js');\n let reqMethodFunc=reqMethods.get(action);\n if (!reqMethodFunc) reqMethodFunc=reqMethods.get(\"default\");\n const method=reqMethodFunc(params);\n const contentType='application/json';\n if (!url) url=config.requestUrlPath;\n const fetchParams={\n method: method,\n headers: {\n 'Content-Type': contentType\n },\n body: JSON.stringify({action: action, parameters: params}),\n };\n if (authorizationToken) fetchParams.headers={...fetchParams.headers, ...authorizationToken};\n return fetch(url, fetchParams)\n .then(res => res.text())\n .then(resultTxt => {\n // This is allowing a null result, it doesnt throw errur if resultTxt==null\n let result=null;\n if (resultTxt) {\n try {\n result=JSON.parse(resultTxt);\n }\n catch(e){//To send errors from server in case the error catching methods at backend fail\n throw new Error(e.message + \"Action: \" + action + \". Error: Response error: \"+ resultTxt);\n }\n }\n return result;\n })\n .then(resultJSON => {\n if (resultJSON?.error==true) {\n throw new Error(action + '. SERVER Message: ' + result.message);\n }\n return resultJSON;\n });\n /*\n .then(res => res.text())\n .then(resultTxt => {\n let result=null;\n if (resultTxt) {\n try {\n result=JSON.parse(resultTxt);\n }\n catch(e){//To send errors from server in case the error catching methods at backend fail\n throw new Error(e.message + \"Action: \" + action + \". Error: Response error: \"+ resultTxt);\n }\n }\n if (result?.error==true) {\n throw new Error(action + '. SERVER Message: ' + result.message);\n }\n return result;\n });\n */\n\n }", "function API(s=\"untitled\",t=!1){return new class{constructor(s,t){this.name=s,this.debug=t,this.isRequest=\"undefined\"!=typeof $request,this.isQX=\"undefined\"!=typeof $task,this.isLoon=\"undefined\"!=typeof $loon,this.isSurge=\"undefined\"!=typeof $httpClient&&!this.isLoon,this.isNode=\"function\"==typeof require,this.isJSBox=this.isNode&&\"undefined\"!=typeof $jsbox,this.node=(()=>{if(this.isNode){const s=\"undefined\"!=typeof $request?void 0:require(\"request\"),t=require(\"fs\");return{request:s,fs:t}}return null})(),this.initCache();const e=(s,t)=>new Promise(function(e){setTimeout(e.bind(null,t),s)});Promise.prototype.delay=function(s){return this.then(function(t){return e(s,t)})}}get(s){return this.isQX?(\"string\"==typeof s&&(s={url:s,method:\"GET\"}),$task.fetch(s)):new Promise((t,e)=>{this.isLoon||this.isSurge?$httpClient.get(s,(s,i,o)=>{s?e(s):t({statusCode:i.status,headers:i.headers,body:o})}):this.node.request(s,(s,i,o)=>{s?e(s):t({...i,statusCode:i.statusCode,body:o})})})}post(s){return this.isQX?(\"string\"==typeof s&&(s={url:s}),s.method=\"POST\",$task.fetch(s)):new Promise((t,e)=>{this.isLoon||this.isSurge?$httpClient.post(s,(s,i,o)=>{s?e(s):t({statusCode:i.status,headers:i.headers,body:o})}):this.node.request.post(s,(s,i,o)=>{s?e(s):t({...i,statusCode:i.statusCode,body:o})})})}initCache(){if(this.isQX&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||\"{}\")),(this.isLoon||this.isSurge)&&(this.cache=JSON.parse($persistentStore.read(this.name)||\"{}\")),this.isNode){let s=\"root.json\";this.node.fs.existsSync(s)||this.node.fs.writeFileSync(s,JSON.stringify({}),{flag:\"wx\"},s=>console.log(s)),this.root={},s=`${this.name}.json`,this.node.fs.existsSync(s)?this.cache=JSON.parse(this.node.fs.readFileSync(`${this.name}.json`)):(this.node.fs.writeFileSync(s,JSON.stringify({}),{flag:\"wx\"},s=>console.log(s)),this.cache={})}}persistCache(){const s=JSON.stringify(this.cache);this.isQX&&$prefs.setValueForKey(s,this.name),(this.isLoon||this.isSurge)&&$persistentStore.write(s,this.name),this.isNode&&(this.node.fs.writeFileSync(`${this.name}.json`,s,{flag:\"w\"},s=>console.log(s)),this.node.fs.writeFileSync(\"root.json\",JSON.stringify(this.root),{flag:\"w\"},s=>console.log(s)))}write(s,t){this.log(`SET ${t}`),-1!==t.indexOf(\"#\")?(t=t.substr(1),this.isSurge||this.isLoon&&$persistentStore.write(s,t),this.isQX&&$prefs.setValueForKey(s,t),this.isNode&&(this.root[t]=s)):this.cache[t]=s,this.persistCache()}read(s){return this.log(`READ ${s}`),-1===s.indexOf(\"#\")?this.cache[s]:(s=s.substr(1),this.isSurge||this.isLoon?$persistentStore.read(s):this.isQX?$prefs.valueForKey(s):this.isNode?this.root[s]:void 0)}delete(s){this.log(`DELETE ${s}`),-1!==s.indexOf(\"#\")?(s=s.substr(1),this.isSurge||this.isLoon&&$persistentStore.write(null,s),this.isQX&&$prefs.removeValueForKey(s),this.isNode&&delete this.root[s]):delete this.cache[s],this.persistCache()}notify(t=s,e=\"\",i=\"\",o,n){if(this.isSurge){let s=i+(null==n?\"\":`\\n\\n多媒体链接:${n}`),r={};o&&(r.url=o),\"{}\"==JSON.stringify(r)?$notification.post(t,e,s):$notification.post(t,e,s,r)}if(this.isQX){let s={};o&&(s[\"open-url\"]=o),n&&(s[\"media-url\"]=n),\"{}\"==JSON.stringify(s)?$notify(t,e,i):$notify(t,e,i,s)}if(this.isLoon){let s={};o&&(s.openUrl=o),n&&(s.mediaUrl=n),\"{}\"==JSON.stringify(s)?$notification.post(t,e,i):$notification.post(t,e,i,s)}if(this.isNode){let s=i+(null==o?\"\":`\\n\\n跳转链接:${o}`)+(null==n?\"\":`\\n\\n多媒体链接:${n}`);if(this.isJSBox){const i=require(\"push\");i.schedule({title:t,body:e?e+\"\\n\"+s:s})}else console.log(`${t}\\n${e}\\n${s}\\n\\n`)}}log(s){this.debug&&console.log(s)}info(s){console.log(s)}error(s){console.log(\"ERROR: \"+s)}wait(s){return new Promise(t=>setTimeout(t,s))}done(s={}){this.isQX||this.isLoon||this.isSurge?this.isRequest?$done(s):$done():this.isNode&&!this.isJSBox&&\"undefined\"!=typeof $context&&($context.headers=s.headers,$context.statusCode=s.statusCode,$context.body=s.body)}}(s,t)}", "async execute(){\n\t\tawait this.processRequest();\n\t\tawait this.formatRequest();\n\t\tawait this.processData();\n\t\tawait this.formatResponse();\n\t\tawait this.processResponse();\n\t}", "performPRTGAPIRequest(method, params) {\n var queryString = 'username=' + this.username + '&passhash=' + this.passhash + '&' + params;\n var options = {\n method: 'GET',\n url: this.url + '/' + method + '?' + queryString\n };\n \n if (this.inCache(options.url)) {\n return this.getCache(options.url);\n } else {\n return this.setCache(options.url, this.backendSrv.datasourceRequest(options)\n .then(response => {\n if (!response.data) {\n return Promise.reject({message: \"Response contained no data\"});\n } \n \n if (response.data.groups) {\n return response.data.groups;\n }\n else if (response.data.devices) {\n return response.data.devices;\n }\n else if (response.data.sensors) {\n return response.data.sensors;\n }\n else if (response.data.channels) {\n return response.data.channels;\n }\n else if (response.data.values) {\n return response.data.values;\n }\n else if (response.data.sensordata) {\n return response.data.sensordata;\n }\n else if (response.data.messages) {\n return response.data.messages;\n }\n else if (response.data.Version) { //status request\n return response.data;\n } else { //All else is XML from table.xml so throw it into the transformer and get JSON back.\n if (response.data == \"Not enough monitoring data\") {\n //Fixes Issue #5 - reject the promise with a message. The message is displayed instead of an uncaught exception.\n return Promise.reject({message: \"<p style=\\\"font-size: 150%; font-weight: bold\\\">Not enough monitoring data.</p><p>Request:<br> &quot;\" + params + \"&quot;</p>\"});\n }\n return new XMLXform(method, response.data);\n }\n }, err => {\n if (err.data.match(/<error>/g)) {\n var regex = /<error>(.*)<\\/error>/g;\n var res = regex.exec(err.data);\n err.message = res[1];\n } else {\n err.message = \"Unknown error: \" + err.data;\n }\n return Promise.reject(err);\n }));\n } \n }", "async function testLib() {\n var initC = await initContract();\n var callOne = await makeRequest(\"ShipmentDelivered\");\n var callTwo = await makeRequest(\"ShipmentDelivered\");\n console.log(initC, callOne, callTwo)\n}", "async function responseFunction(a) {\n if (sess.ClientID == undefined && a == null) {\n console.log(\"summyD \" + sess.clientID);\n\n var b = JSON.parse('{ \"Success\" : false, \"ClientID\" : \"dummyData\" }');\n responses[responses.length] = [];\n\n responses[responses.length - 1][\"Success\"] = b[\"Success\"]; // Success response\n\n responses[responses.length - 1][\"ClientID\"] = b[\"ClientID\"]; // Customer ID\n\n sess.ClientID = responses[responses.length - 1][\"ClientID\"];\n } else if (a) {\n\n responses[responses.length] = [];\n\n responses[responses.length - 1][\"Success\"] = a[\"Success\"]; // Success response\n\n responses[responses.length - 1][\"ClientID\"] = a[\"ClientID\"]; // Customer ID\n\n sess.ClientID = responses[responses.length - 1][\"ClientID\"];\n }\n\n }", "async function getCODStats(ctx){\n // Get username and platform that will be needed for request\n var username = ctx.request.body.username;\n var platform = ctx.request.body.platform;\n // Store HTTP Get to API with url and headers required to make call\n var options = {\n method: 'GET',\n url: `https://call-of-duty-modern-warfare.p.rapidapi.com/warzone/${username}/${platform}`,\n headers: {\n 'x-rapidapi-host': 'call-of-duty-modern-warfare.p.rapidapi.com',\n 'x-rapidapi-key': 'd08f4aa168msh70aa02d0584b683p1ac8bcjsnaa334409768f'\n }\n };\n \n // Try to make request with all options specified above and store/display data to user\n try{\n await axios.request(options).then(function (response) {\n ctx.status = 200\n ctx.body = response.data\n // Key Values we want to store for user from request\n if(ctx.params.id){\n let values = {ID: ctx.params.id, wins: response.data.br.wins, kills: response.data.br.kills,\n kd: response.data.br.kdRatio, kpm: response.data.br.kills / response.data.br.gamesPlayed,\n userID: parseInt(ctx.params.id)}\n saveData(values)\n } else {\n console.log(\"No Data\")\n }\n })\n // If there was an error in the request display simple error message\n } catch(error){\n ctx.status = 404\n ctx.body = \"Unable to perform action\"\n console.log(error)\n }\n}", "function _makeAPIcall(method, url, params,withResults) {\r\n var _method = method;\r\n var _url = url;\r\n var _params = params;\r\n var _withResults = withResults; \r\n return _authToken().then(function (response) {\r\n if (response.error === undefined) {\r\n var _token = response;\r\n $http.defaults.headers.common.Authorization = 'Bearer token: ' + _token;\r\n if (_method == 'get') { \r\n return $http.get(_url, { params: _params })\r\n .then(function (response) { \r\n \r\n return _apiCallSuccess(response, _url,_withResults);\r\n })\r\n .catch(function (response) { \r\n \r\n return _apiCallFail(response, _url)\r\n });\r\n } else {\r\n return $http.post(_url, _params)\r\n .then(function (response) {\r\n return _apiCallSuccess(response, _url,_withResults);\r\n })\r\n .catch(function (response) { \r\n return _apiCallFail(response, _url)\r\n });\r\n }\r\n } else {\r\n return response;\r\n }\r\n\r\n });\r\n\r\n }", "_m_exec_http_request(ph_args, pf_process_next_in_queue) {\n const lo_this = this;\n\n const ph_query_opts = ph_args.ph_query_opts;\n\n const pf_json_callback = lo_this.m_pick_option(ph_args, \"pf_json_callback\");\n const pi_timeout_ms = lo_this.m_pick_option(ph_args, \"pi_timeout_ms\");\n const ps_call_context = lo_this.m_pick_option(ph_args, \"ps_call_context\");\n const ps_method = lo_this.m_pick_option(ph_args, \"ps_method\");\n const ps_url_end_point = lo_this.m_pick_option(ph_args, \"ps_url_end_point\");\n const ps_url_path = lo_this.m_pick_option(ph_args, \"ps_url_path\");\n\n const ls_url_full = f_join_non_blank_vals('', f_string_remove_trailing_slash(ps_url_end_point), ps_url_path);\n\n\n // credentials to call our own services\n const ps_http_pass = lo_this.m_pick_option(ph_args, \"ps_http_pass\", true);\n const ps_http_user = lo_this.m_pick_option(ph_args, \"ps_http_user\", true);\n\n /* eslint multiline-ternary:0, no-ternary:0 */\n const lh_auth = (f_string_is_blank(ps_http_pass) ? null : {\n user: ps_http_user,\n pass: ps_http_pass,\n sendImmediately: true\n });\n\n\n // one more call\n lo_this._ai_call_count_exec_total ++;\n f_chrono_start(lo_this._as_queue_chrono_name);\n\n // at first call\n if (lo_this._ab_first_call) {\n lo_this._ab_first_call = false;\n f_console_OUTGOING_CNX(`target=[${ls_url_full}] login=[${ps_http_user}] way=[push] comment=[connection ${lo_this.m_get_context(ps_call_context)}]`);\n }\n\n const ls_full_call_context = lo_this.m_get_context(`[#${lo_this._ai_call_count_exec_total}]`, ps_call_context);\n\n f_console_verbose(1, `${ls_full_call_context} - init`);\n\n // https://github.com/request/request#requestoptions-callback\n const lh_query_opts = f_object_extend({\n method: ps_method,\n url: ls_url_full,\n\n agent: false,\n auth: lh_auth,\n encoding: \"utf8\",\n json: true,\n rejectUnauthorized: false,\n requestCert: false,\n timeout: pi_timeout_ms,\n }, ph_query_opts);\n\n const ls_call_chrono_name = f_digest_md5_hex(f_join_non_blank_vals('~', lo_this._as_queue_chrono_name, lo_this._ai_call_count_exec_total, f_date_format_iso()));\n f_chrono_start(ls_call_chrono_name);\n\n\n // one more pending request in parallel...\n lo_this._ai_parallel_current ++;\n lo_this._ai_parallel_max = f_number_max(lo_this._ai_parallel_max, lo_this._ai_parallel_current);\n\n cm_request(lh_query_opts, function(ps_error, po_response, po_json_response) {\n\n // one less pending request in parallel...\n lo_this._ai_parallel_current --;\n\n const li_call_duration_ms = f_chrono_elapsed_ms(ls_call_chrono_name);\n f_console_verbose(2, `${ls_full_call_context} - call took [${f_human_duration(li_call_duration_ms, true)}]`);\n\n // collect stats\n lo_this._ai_call_duration_total_ms += li_call_duration_ms;\n lo_this._ai_call_duration_max_ms = f_number_max(lo_this._ai_call_duration_max_ms, li_call_duration_ms);\n lo_this._ai_call_duration_min_ms = f_number_min(lo_this._ai_call_duration_min_ms, li_call_duration_ms);\n\n try {\n\n // error ?\n if (f_string_is_not_blank(ps_error)) {\n throw f_console_error(`${ls_full_call_context} - ${ps_error}`);\n }\n\n const li_statusCode = po_response.statusCode;\n if (li_statusCode !== 200) {\n throw f_console_error(`${ls_full_call_context} - call returned statusCode=[${li_statusCode} / ${po_response.statusMessage}] on URL=[${ls_url_full}] - reponse=[${f_console_stringify(po_json_response)}]`);\n }\n\n if (f_is_not_defined(po_json_response)) {\n throw f_console_error(`${ls_full_call_context} - returned an empty body`);\n }\n\n f_console_verbose(3, `${ls_full_call_context} - returned statusCode=[${li_statusCode}] with raw response:`, {\n po_json_response: po_json_response\n });\n\n if (f_is_defined(po_json_response.errors)) {\n throw f_console_error(`${ls_full_call_context} - errors=[${f_console_stringify(po_json_response.errors)}]`);\n }\n\n if (f_is_defined(po_json_response.error)) {\n throw f_console_error(`${ls_full_call_context} - error=[${f_console_stringify(po_json_response.error)}]`);\n }\n\n // give a context to the reply\n po_json_response.as_call_context = ls_full_call_context;\n\n // positive feed-back through the call-back\n pf_json_callback(null, po_json_response);\n }\n\n catch (po_err) {\n f_console_catch(po_err);\n }\n\n // handle the next pending element in the queue\n f_console_verbose(2, `${lo_this.m_get_context()} - next in queue...`);\n pf_process_next_in_queue();\n });\n }", "function ioSdk( api ) {\n // storing user on server is a no go\n var user,\n processing,\n delimiterStart = '{{',\n delimiterEnd = '}}',\n pattern = new RegExp( delimiterStart + '(.+?)' + delimiterEnd, 'g');\n\n function templating ( str, vars ) {\n function getVars ( item ) {\n // this is kinda cray\n // replace delimiters and grab var\n return vars[ item.replace(delimiterStart, '')\n .replace(delimiterEnd, '') ];\n }\n var items = str.match( pattern ),\n values = items.map( getVars );\n\n for( var i = 0; i < items.length; i += 1 ) {\n str = str.replace( items[i], values[i] );\n }\n return str;\n }\n\n function _sendRequest ( endpoint, data, callback, options ) {\n\n if ( user ) {\n data = data || {};\n data.session_token = user.session_token;\n }\n // replace with request\n var opts = {\n url : api + endpoint,\n form : data,\n method : options.method || 'post'\n };\n return request( opts, function ( err, res, body ) {\n if ( err ) return callback( err );\n if ( res.statusCode === 200 ) {\n var data,\n returned;\n\n try {\n data = JSON.parse( body );\n } catch ( e ) {\n returned = true;\n callback( e );\n }\n\n if ( returned ) return;\n return callback ( null, data );\n }\n // if it gets here its probably not that good\n // i dont think our api returns anything else time being \n callback( new Error('bad status'), body );\n } );\n }\n\n function _setCall ( endpoint, options ) {\n options = options || {};\n return function ( values, callback ) {\n\n var _endpoint;\n\n if ( user ) {\n values.id = values.id || user.id;\n }\n\n if ( typeof values === 'function' ) {\n callback = values;\n values = {};\n }\n\n _endpoint = options.endpointVars ? \n templating( endpoint, values ) :\n endpoint;\n\n if ( !processing ) {\n processing = true;\n return _sendRequest( _endpoint, values, function ( ) {\n processing = false;\n if ( callback ) callback.apply( null, arguments );\n }, options || {} );\n }\n }\n }\n\n return {\n users : {\n login : _setCall('sessions.json'),\n create : _setCall('users.json'),\n all : _setCall('users.json', {\n method : 'get'\n }),\n read : _setCall('users.json', { \n method : 'get' \n }),\n update : _setCall('users/{{id}}/update.json', {\n endpointVars : true\n }),\n show : _setCall('users/{{id}}/show.json', {\n endpointVars : true,\n method : 'get'\n }),\n updateCard : _setCall('users/{{id}}/update_card.json', {\n endpointVars : true\n }),\n checkin : _setCall('checkins.json'),\n resetPassword : _setCall('users/reset_password.json'),\n cancelPlan : _setCall('users/{{id}}/cancel_plan.json', {\n endpointVars : true\n }),\n updatePlan : _setCall('users/{{id}}/update_plan.json', {\n endpointVars : true\n }),\n charge : _setCall('users/{{id}}/charge.json', {\n endpointVars : true\n })\n },\n plans : {\n all : _setCall('plans.json', {\n method : 'get'\n })\n }\n\n }\n\n}", "function yelpAPIcall(frmtName,frmtAddr,ratingsarray,chain) {\n\nvar yelptoken = \"Bearer dlVH8b6SrxR8hB3Qt-kp8oNeaDzXSYP5O_pG7Gy6Sm5E7PxMa_6wbrpY88thyflQ3KVJ8xg6eAtGO_oEYRtC8c9oXBTVsCSbJGzV65ohKSdKhEIDxqvvZxGP5X_lWXYx\";\nvar chriskey = \"55d9430e09095b44d75ece0c0380c9daf1946332\";\n\n request(proxyOptions('GET', frmtAddr)) \n .then(function (coordsResponse) {\n var coords = coordinates(coordsResponse);\n if (coords !== undefined) {\n return request({\n method: 'GET',\n url: csProxyUtils.buildProxyUrl(chrisKey, yelpRestaurantSearch(coords, frmtName)),\n headers: {\n \"authorization\": yelptoken\n }\n });\n } else {\n errorfunction();\n }\n })\n .then(function (detailsResponse) {\n var yelpPlace = JSON.parse(detailsResponse).businesses[0];\n // console.log(yelpPlace);\n ratingsarray.push(yelpPlace);\n\n //Calls next API function in the chain\n chain(frmtName,frmtAddr,ratingsarray,googleAPIcall);\n });\n}", "function callAPIForState() {\n let iterator = \"01\";\n let get_country_string = [];\n\n for (let i = 0; i < 56; i++) {\n if (i === 3 || i === 7 || i === 14 || i === 43 || i === 52) {\n continue; // not associated with state, move to next iteration\n } else {\n if (i < 10) {\n iterator = \"0\" + i;\n } else { // else if greater than 10\n iterator = i;\n }\n get_country_string[i] = 'LASST' + iterator + '0000000000003';\n }\n }\n get_country_string[56] = 'LASST720000000000003'; // Count puerto rico as #56\n\n\n // return the api url for use with effect fetch\n // return 'https://api.bls.gov/publicAPI/v2/timeseries/data/' + get_country_string +\n // '?registrationkey=' + API_KEY + '&startyear=2020&endyear=2020';\n return get_country_string; // return list of API codes for retrieval\n}", "function Api() {\n \n //Calls the endpoint and returns the body.\n function fetch(endpoint) {\n //Avoid wrong input.\n url = (url.startsWith('http')) ? url : 'http://'+url;\n url = (url.endsWith('/')) ? url : url += '/';\n endpoint = (endpoint.startsWith('/')) ? endpoint.replace('/', '') : endpoint;\n const finUrl = url + endpoint;\n \n // To not break any existing scripts using pre-options syntax\n if (arguments.length === 3) {\n const options = arguments[1];\n const cb = arguments[2];\n const headers = (options[\"headers\"]) ? options[\"headers\"] : {};\n } else if (arguments.length === 2) {\n const cb = arguments[1];\n const headers = {};\n } else {\n const cb = function(){};\n const headers = {};\n }\n\n //TODO: If data has been preloaded or downloaded before, load the already downloaded data.\n \n request({\n url: finUrl,\n headers: headers\n }, function(error, response, body) {\n //Error cases\n if(error) cb(error);\n else if(response && response.statusCode == 400) cb('400 returned.');\n //TODO: Add more error cases (no body, error statusCodes, ...)\n else cb(undefined, body);\n })\n }\n\n //Set object methods with this\n this.fetch = fetch;\n}", "async requestAPIData(dataRequest){\n\n\n\n\n let serverName = ClientConnection.getServerNameForDataRequest(dataRequest)\n let serverProperties = serverConfig[serverName]\n\n console.log('server name for request is ', serverName)\n //let url = \"http://localhost:9208/api/v1\"\n\n let url = serverProperties.url + ':' + serverProperties.port + '/api/v1'\n\n\n var postData = Object.assign({}, dataRequest);\n\n postData.authToken = await this.getSessionAuthDataCache().authToken\n postData.publicAddress = publicAddress\n\n /* var postData = {\n requestType: dataRequest.requestType,\n authToken: await this.getSessionAuthDataCache(),\n publicAddress: publicAddress\n }*/\n\n\n/*\n let options = {\n url: serverConfig.gameServer.url,\n port: serverConfig.gameServer.port\n }\n*/\n\n\n\n let response = await axios({\n method: 'post',\n url: url,\n data: postData\n });\n\n let results = response.data\n\n console.log('got from api ', results)\n\n if(results.success)\n {\n return results ;\n\n }\n\n\n\n\n }", "async requestBL(stub, args) {\n\n //check args length should be 7\n if (args.length != 7) {\n console.info(`Argument length should be 7 with the order example: \n {\n buyer_id: \"user12\",\n organization: \"Seller\",\n order_id: \"order12\",\n bl_id: \"bl12\",\n requestDate: '12/06/20',\n shippmentDate: '14/06/20',\n expectedDeliveryDate: '14/06/20'\n }`);\n\n throw new Error(`Argument length should be 7 with the order example: \n {\n buyer_id: \"user12\",\n organization: \"Seller\",\n order_id: \"order12\",\n bl_id: \"bl12\",\n requestDate: '12/06/20',\n shippmentDate: '14/06/20',\n expectedDeliveryDate: '14/06/20'\n }`);\n }\n\n // check the user existence\n // let userBytes = await stub.getPrivateData((args[1].charAt(0).toLowerCase() + args[1].slice(1))+'_users', args[0]);\n let userBytes = await stub.getState(args[0]);\n if (!userBytes || userBytes.length == 0) {\n throw new Error(`Seller with this id ${args[0]} not exist`);\n }\n\n // fetch order\n let orderBytes = stub.getState(args[2]);\n if (orderBytes == null || orderBytes.length == 0) {\n throw new Error(`Order with this id ${args[2]} not exist`);\n }\n\n // convert order object back into object to fetch values\n let order = JSON.parse(orderBytes.toString());\n\n let lcBytes = await stub.getState(order.LCid);\n if (lcBytes == null || lcBytes.length == 0) {\n throw new Error(`LC with this id ${args[2]} not exist`);\n }\n // convert LC object back into object to fetch values\n let lc = JSON.parse(orderBytes.toString());\n\n if (lc.phase != 3) {\n throw new Error(`First complete the lc process`);\n }\n\n // add more fields in order\n order.requestBL = 'requestSend';\n order.BLid = args[3];\n\n // add it into ledger\n await stub.putState(args[2], Buffer.from(JSON.stringify(order)));\n\n // create BL object\n let requestBL = {};\n\n // initialize it with key value\n requestBL.BLid = args[3];\n requestBL.orderId = args[2];\n requestBL.phase = 1; // 1 means BL request send to Bank\n requestBL.status = 'blRequestSent';\n requestBL.requestor = args[0]; //seller\n requestBL.seller = order.seller;\n requestBL.organization = args[1];\n requestBL.requestDate = args[4];\n requestBL.shippmentDate = args[5];\n requestBL.expectedDeliveryDate = args[6];\n requestBL.traderBank = '';\n requestBL.shipper = '';\n\n // add it to ledger\n await stub.putState(args[3], Buffer.from(JSON.stringify(askLC)));\n }", "async function addALL(api , optint) {\n try {\n return await fetch(api, optint).then((res) => res.json());\n } catch (error) {\n return { message: \"ERROR\" };\n }\n }", "async function callApi(urlString, body, methodType) {\n console.log('-----------AXIOS Api request is----------- ');\n console.log('url string ' + urlString);\n console.log('methodType ' + methodType);\n // console.log('body ' + JSON.stringify(body));\n let headers = {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n };\n\n const options = {\n method: methodType,\n headers,\n };\n if (methodType == 'POST' || methodType == 'PUT') {\n options.body = {};\n if (body) {\n options.body = JSON.stringify(body);\n }\n }\n console.log('options', options);\n try {\n const response = await fetch(urlString, options);\n const jsonResposne = await response.json();\n console.log('result :--', JSON.stringify(jsonResposne));\n if (jsonResposne && jsonResposne.status && jsonResposne.status == 100) {\n \n \n } else {\n return jsonResposne;\n }\n } catch (error) {\n console.log('error :--', JSON.stringify(error));\n return error;\n }\n}", "function init() {\n xapi.status.get('SystemUnit Software Version').then((value) => {\n systemInfo.softwareVersion = value;\n //console.log(\"output is\" + JSON.stringify(output)); //test purposes\n });\n\n\n xapi.status.get('Network 1 IPv4 Address').then((value) => {\n systemInfo.IpAddress = value;\n //console.log(\"IP Address:\" + systemInfo.IpAddress); //test purposes\n }); \n \n \n xapi.status.get('SystemUnit Hardware Module SerialNumber').then((value) => {\n systemInfo.SystemSerialNumber = value;\n //console.log(\"output is\" + JSON.stringify(output)); //test purposes\n }); \n\n\n/* For some reason, neither of these work: \n\n xapi.config.get('SystemUnit Name').then((value) => { \n systemInfo.systemName = value;\n output.push(\"TEST1: The System Name is: \" + systemInfo.systemName);\n //console.log(\"output is \" + JSON.stringify(output)); //test purposes \n }); \n\n \n xapi.status.get('UserInterface ContactInfo Name').then((value) => {\n systemInfo.SystemName = value; \n output.push(\"TEST2: The System Name is: \" + systemInfo.systemName);\n console.log(\"output is \" + JSON.stringify(output)); //test purposes \n }); \n*/\n}", "function toCall(offset){\n\t\t\t\t//update the key\n\t\t\t\tif(hubCache.get(\"config\").type == \"hapikey\"){\n\t\t\t\t\tvar key = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + \"?hapikey=\" + key + '&count=100' + '&offset=' + offset,{headers: {\"content-type\": \"application/json\" }\n\t\t\t\t\t}).then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.results)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t \n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t}\n\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t}\n\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t}\n\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t}else{\n\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t}\n\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t}\n\t\t\t\t })\n\t\t\t\t}else{\n\t\t\t\t\tvar token = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + '?offset=' + offset + '&count=100',\n\t\t\t\t\t\t{headers: {\"Authorization\": \"Bearer \" + token,\"content-type\": \"application/json\" }\n\t\t\t\t\t})\n\t\t\t\t .then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.results)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}//end of oauth block\n\t\t\t\t\n\t\t\n\t\t}", "function makeAPICall()\n{\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() { \n if (4 == xhr.readyState && 200 == xhr.status) {\n handleAPICall(xhr.responseText);\n }\n }\n xhr.open(\"GET\", \"https://api.torn.com/user/1643506?selections=&key=SFfDBKRg\", true); \n xhr.send(null);\n}", "async callApi(opts) {\n console.log(`invoking http call: ${util.inspect(opts)}`);\n\n try {\n var result = await request(opts);\n }\n catch(err) {\n console.error(`error invoking request: ${err.message}, opts: ${opts}`);\n return;\n }\n\n console.log(`got result: ${util.inspect(result)}`);\n return result.response;\n }", "function API(e=\"untitled\",s=!1){return new class{constructor(e,s){this.name=e,this.debug=s,this.isRequest=\"undefined\"!=typeof $request,this.isQX=\"undefined\"!=typeof $task,this.isLoon=\"undefined\"!=typeof $loon,this.isSurge=\"undefined\"!=typeof $httpClient&&!this.isLoon,this.isNode=\"function\"==typeof require,this.isJSBox=this.isNode&&\"undefined\"!=typeof $jsbox,this.node=(()=>{if(this.isNode){const e=\"undefined\"!=typeof $request?void 0:require(\"request\"),s=require(\"fs\");return{request:e,fs:s}}return null})(),this.initCache();const t=(e,s)=>new Promise(function(t){setTimeout(t.bind(null,s),e)});Promise.prototype.delay=function(e){return this.then(function(s){return t(e,s)})}}get(e){return this.isQX?(\"string\"==typeof e&&(e={url:e,method:\"GET\"}),$task.fetch(e)):new Promise((s,t)=>{this.isLoon||this.isSurge?$httpClient.get(e,(e,i,o)=>{e?t(e):s({statusCode:i.status,headers:i.headers,body:o})}):this.node.request(e,(e,i,o)=>{e?t(e):s({...i,statusCode:i.statusCode,body:o})})})}post(e){return e.body&&e.headers&&!e.headers[\"Content-Type\"]&&(e.headers[\"Content-Type\"]=\"application/x-www-form-urlencoded\"),this.isQX?(\"string\"==typeof e&&(e={url:e}),e.method=\"POST\",$task.fetch(e)):new Promise((s,t)=>{this.isLoon||this.isSurge?$httpClient.post(e,(e,i,o)=>{e?t(e):s({statusCode:i.status,headers:i.headers,body:o})}):this.node.request.post(e,(e,i,o)=>{e?t(e):s({...i,statusCode:i.statusCode,body:o})})})}initCache(){if(this.isQX&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||\"{}\")),(this.isLoon||this.isSurge)&&(this.cache=JSON.parse($persistentStore.read(this.name)||\"{}\")),this.isNode){let e=\"root.json\";this.node.fs.existsSync(e)||this.node.fs.writeFileSync(e,JSON.stringify({}),{flag:\"wx\"},e=>console.log(e)),this.root={},e=`${this.name}.json`,this.node.fs.existsSync(e)?this.cache=JSON.parse(this.node.fs.readFileSync(`${this.name}.json`)):(this.node.fs.writeFileSync(e,JSON.stringify({}),{flag:\"wx\"},e=>console.log(e)),this.cache={})}}persistCache(){const e=JSON.stringify(this.cache);this.isQX&&$prefs.setValueForKey(e,this.name),(this.isLoon||this.isSurge)&&$persistentStore.write(e,this.name),this.isNode&&(this.node.fs.writeFileSync(`${this.name}.json`,e,{flag:\"w\"},e=>console.log(e)),this.node.fs.writeFileSync(\"root.json\",JSON.stringify(this.root),{flag:\"w\"},e=>console.log(e)))}write(e,s){this.log(`SET ${s}`),-1!==s.indexOf(\"#\")?(s=s.substr(1),(this.isSurge||this.isLoon)&&$persistentStore.write(e,s),this.isQX&&$prefs.setValueForKey(e,s),this.isNode&&(this.root[s]=e)):this.cache[s]=e,this.persistCache()}read(e){return this.log(`READ ${e}`),-1===e.indexOf(\"#\")?this.cache[e]:(e=e.substr(1),this.isSurge||this.isLoon?$persistentStore.read(e):this.isQX?$prefs.valueForKey(e):this.isNode?this.root[e]:void 0)}delete(e){this.log(`DELETE ${e}`),-1!==e.indexOf(\"#\")?(e=e.substr(1),(this.isSurge||this.isLoon)&&$persistentStore.write(null,e),this.isQX&&$prefs.removeValueForKey(e),this.isNode&&delete this.root[e]):delete this.cache[e],this.persistCache()}notify(s=e,t=\"\",i=\"\",o,n){if(this.isSurge){let e=i+(null==n?\"\":`\\n\\n多媒体链接:${n}`),r={};o&&(r.url=o),\"{}\"==JSON.stringify(r)?$notification.post(s,t,e):$notification.post(s,t,e,r)}if(this.isQX){let e={};o&&(e[\"open-url\"]=o),n&&(e[\"media-url\"]=n),\"{}\"==JSON.stringify(e)?$notify(s,t,i):$notify(s,t,i,e)}if(this.isLoon){let e={};o&&(e.openUrl=o),n&&(e.mediaUrl=n),\"{}\"==JSON.stringify(e)?$notification.post(s,t,i):$notification.post(s,t,i,e)}if(this.isNode){let e=i+(null==o?\"\":`\\n\\n跳转链接:${o}`)+(null==n?\"\":`\\n\\n多媒体链接:${n}`);if(this.isJSBox){const i=require(\"push\");i.schedule({title:s,body:t?t+\"\\n\"+e:e})}else console.log(`${s}\\n${t}\\n${e}\\n\\n`)}}log(e){this.debug&&console.log(e)}info(e){console.log(e)}error(e){console.log(\"ERROR: \"+e)}wait(e){return new Promise(s=>setTimeout(s,e))}done(e={}){this.isQX||this.isLoon||this.isSurge?this.isRequest?$done(e):$done():this.isNode&&!this.isJSBox&&\"undefined\"!=typeof $context&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}}(e,s)}", "function main() {\n\n\t\t//Check the Method\n\t\tif ($.request.method === $.net.http.POST) {\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tresult: \"POST is not supported, perform a GET to read the Account Type Amounts by Company Code\"\n\t\t\t}));\n\t\t} else {\n\t\t\ttry {\n\t\t\t\t//Calculate Values\n\t\t\t\tvar records = getEntries();\n\n\t\t\t\t$.response.status = 200;\n\t\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\t\tmessage: \"API Called\",\n\t\t\t\t\tdata: records\n\t\t\t\t}));\n\n\t\t\t} catch (err) {\n\t\t\t\t$.trace.error(JSON.stringify({\n\t\t\t\t\tmessage: err.message\n\t\t\t\t}));\n\t\t\t\t$.response.status = 200;\n\t\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\t\tmessage: \"API Called\",\n\t\t\t\t\terror: err.message\n\t\t\t\t}));\n\t\t\t}\n\t\t}\n\t}", "async function main(params) {\n // create a Logger\n const logger = Core.Logger(\"main\", { level: params.LOG_LEVEL || \"info\" });\n\n try {\n logger.info(\"Calling the main action\"); // 'info' is the default level if not set\n logger.debug(stringParameters(params)); // log parameters, only if params.LOG_LEVEL === 'debug'\n // check for missing request input parameters and headers\n const requiredParams = [\"email\", \"eventType\"];\n const errorMessage = checkMissingRequestInputs(params, requiredParams, [\n \"Authorization\",\n ]);\n if (errorMessage) {\n return errorResponse(400, errorMessage, logger); // return and log client errors\n }\n\n // extract the user Bearer token from the input request parameters\n let buff = new Buffer(getBearerToken(params), \"base64\");\n const sessionToken = buff.toString(\"ascii\").replace(\":\", \"/\");\n\n logger.info(`sessionToken = ${sessionToken}`);\n\n var url = `https://${params.accIntanceURL}/nl/jsp/soaprouter.jsp`;\n\n params.externalId = params.externalId || \"\";\n\n let ctxxml = \"\";\n Object.keys(params.ctx).map((attr) => {\n ctxxml += `<${attr}>${params.ctx[attr]}</${attr}>\\n`;\n });\n\n var content = `<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:nms:rtEvent\">\n <soapenv:Header/>\n <soapenv:Body>\n <urn:PushEvent>\n <urn:sessiontoken>${sessionToken}</urn:sessiontoken>\n <urn:domEvent>\n <rtEvent type=\"${params.eventType}\" email=\"${params.email}\" externalId=\"${params.externalId}\">\n <ctx>\n ${ctxxml}\n </ctx>\n </rtEvent>\n </urn:domEvent>\n </urn:PushEvent>\n </soapenv:Body>\n</soapenv:Envelope>`;\n\n logger.info(`content = ${content}`);\n\n return new Promise(function (resolve, reject) {\n try {\n var options = {\n method: \"POST\",\n headers: {\n \"Content-Type\": [\"text/xml;charset=UTF-8\", \"text/plain\"],\n SOAPAction: '\"nms:rtEvent#PushEvent\"',\n },\n url: url,\n body: content,\n };\n\n request(options, function (error, response, body) {\n if (error) reject(error);\n else {\n // var json = JSON.parse(parser.toJson(body, { reversible: true }));\n const response = {\n statusCode: 200,\n body: body,\n };\n // console.log(JSON.stringify(json));\n resolve(response);\n }\n });\n } catch (e) {\n reject(e);\n }\n });\n } catch (error) {\n // log any server errors\n logger.error(error);\n // return with 500\n return errorResponse(500, \"server error\", logger);\n }\n}", "function fetchWeatherData(cityInputText){\n //okay so basically, you need lat and long params to use onsecall, which will be easier in the long run\n //make an initial call to fetch the current weather data for the city, THEN use the lat and long values to use the onecall api for the forecast...\n //well..now that I think about it it's all just to get the current uv index, kinda stinky but whatever\n var apiUrlLocation = \"https://api.openweathermap.org/data/2.5/weather?q=\" + cityInputText + \"&units=imperial\" + \"&appid=5900db7311e0af32ad5ab7ce4fdd9244\";\n fetch(apiUrlLocation).then(function(response){\n if(response.ok){\n response.json().then(function(data){\n //console.log(data);\n var lat = data.coord.lat;\n var lon = data.coord.lon;\n //console.log(lat, lon);\n //nested api call\n var apiUrl = \"https://api.openweathermap.org/data/2.5/onecall?lat=\" + lat + \"&lon=\" +lon+ \"&units=imperial\" +\"&appid=5900db7311e0af32ad5ab7ce4fdd9244\"; \n fetch(apiUrl).then(function(response){\n if(response.ok){\n response.json().then(function(data){\n displayWeather(data, cityInputText);\n displayForecast(data);\n //console.log(data);\n });\n }\n else{\n alert(\"Error \" + response.statusText);\n }\n });\n });\n }\n else{\n alert(\"Error\" +response.statusText);\n }\n })\n .catch(function(error){\n alert(\"Check network connection\");\n });\n}", "function getData() {\n //use the number of records info from the first API call\n return rp(getNum)\n .then(function(ret) {\n // console.log(\"**from keys.js * totalSize = \" + ret.totalSize);\n //determine the number of API calls needed\n size = ret.totalSize;\n callNumber = Math.ceil(size / 200);\n var requestPromiseArray = [];\n for (j = 0; j < callNumber; j++) {\n //create the requestPromiseArray using a loop\n options = {\n method: 'GET',\n uri: 'https://api.salesforceiq.com/v2/lists/57114e10e4b0a3f93805ebc6/listitems?_start=' + URLcounter + '&_limit=200',\n headers: {\n 'Authorization': auth,\n 'Content-type': 'application/json'\n },\n json: true\n }\n if (!options.uri) {}\n //push each call result into the array\n requestPromiseArray.push(rp(options));\n URLcounter = URLcounter + 200;\n }\n //return all the API calls\n return Promise.all(requestPromiseArray); \n })\n .then(function(totalRecords) {\n //join the API calls into one array\n return totalRecords.reduce(function(initial, following) {\n return initial.concat(following.objects);\n }, []);\n })\n .catch(function(err) {\n console.log(\"error in API call\")\n });\n}", "function toCall(offset){\n\t\t\t\t//update the key\n\t\t\t\tif(hubCache.get(\"config\").type == \"hapikey\"){\n\t\t\t\t\tvar key = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + \"?hapikey=\" + key + '&count=100' + '&offset=' + offset)\n\t\t\t\t .then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.results)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t \n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}else{\n\t\t\t\t\tvar token = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + '?offset=' + offset + '&count=100',\n\t\t\t\t\t\t{headers: {\"Authorization\": \"Bearer \" + token }\n\t\t\t\t\t})\n\t\t\t\t .then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.results)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\tconsole.log(companies)\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}//end of oauth block\n\t\t\t\t\n\t\t\n\t\t}", "async function makerequest() {\r\n \r\n}", "async audit_trail (id, caller, api, response_type, aggregation_type, aggregated_response, context, options, assigned_oracle, standby_oracle){\n\n\t\tconsole.log(\"request processor, inside audit_trail :\", options.ala_data.oracle_account)\n\t\tconsole.log(\"request processor, inside audit_trail :\", assigned_oracle)\n\t\tconsole.log(\"request processor, inside audit_trail :\", standby_oracle)\n\t\tconsole.log(\"request processor, inside audit_trail :\", (options.ala_data.oracle_contract_name == assigned_oracle))\n\n\n\t\tresponse_type = \"\" + response_type; \n\t\taggregation_type = \"\" + aggregation_type; \n\n\t\tresponse_type = responseJson[response_type]; \n\t\taggregation_type = aggregationJson[aggregation_type]; \n\n\t\tif (options.ala_data.oracle_account == assigned_oracle || options.ala_data.oracle_account == standby_oracle){\n\n\t\t\tcontext.mongo.model('audit_trail').findOne({request_id: id}).then(function (userDataa) {\n\t\t\t\tconsole.log(\"Moment of truth\", userDataa)\n\t\t\t\tif(userDataa == null){\n\t\t\t\t\tcontext.mongo.model('audit_trail').create({ \n\t\t\t\t\t\tcaller: caller, \n\t\t\t\t\t\trequest_id: id, \n\t\t\t\t\t\ttime: moment().format('YYYY-MM-DD hh:mm:ss'),\n\t\t\t\t\t\tapi_set : api,\n\t\t\t\t\t\tresponse_type : response_type,\n\t\t\t\t\t\taggregation_type : aggregation_type,\n\t\t\t\t\t\toracle_account : assigned_oracle, \n\t\t\t\t\t\taggregated_response: aggregated_response\n\t\t\t\t\t\n\t\t\t\t\t}).catch(error => {\n\t\t\t\t\t\tconsole.error('Failed to insert response to mongo3: ', error);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t})\t\t\n\t\t}\n\t\t\n\t}", "function getApiData(method, params, fcallback,cbparam) {\n\tApiDataNotReady++;\t\t// flag to track api calls\n\tBC_API_Request(method, params, function (response) {\n\t\tvar str = '';\n\t\t//another chunk of data has been received, so append it to `str`\n\t\tresponse.on('data', function (chunk) {\n\t\t\tstr += chunk;\n\t\t});\n\t\t//the whole response has been received, take final action.\n\t\tresponse.on('end', function () {\n\t\t\tApiDataNotReady--;\n\t\t\tvar jsonObj;\n\t\t\ttry {\n\t\t\t\tjsonObj = JSON.parse(str);\n\t\t\t}\n\t\t\tcatch (e){\n\t\t\t\tconsole.log(\"API or JSON error: \"+e.message);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar next = jsonObj.Next;\n\t\t\tvar data = new Array();\n\t\t\tdata = jsonObj.Data;\n\t\t\tif(data === 'undefined' || data == null)\n\t\t\t{\n\t\t\t\tconsole.log(\"No data returned: \"+str);\n\t\t\t\treturn;\t\t// exit out if error json message received\n\t\t\t}\n\t\t\tfcallback(data,cbparam);\n\t\t\t\n\n\t\t\tif(typeof next !== 'undefined') \n\t\t\t{\n\t\t\t\tloadNext(method, next, fcallback);\n\t\t\t}\n\t\t});\n\t\t// in case there is a html error\n\t\tresponse.on('error', function(err) {\n\t\t// handle errors with the request itself\n\t\tconsole.error(\"Error with the request: \", err.message);\n\t\tApiDataNotReady--;\n\t\t});\n\t});\n}", "[FETCH_COMPANIES]({ commit }) {\n let endpoint = `/api/v1/company/`;\n commit(FETCH_START);\n apiService(endpoint)\n .then(response => {\n commit(SET_COMPANIES, response);\n commit(FETCH_END);\n })\n .catch(error => {\n console.log(error);\n });\n }", "function __request(apiURI, allQueries) {\n request(\n\tapiURI + \"?s=\" + allQueries[\"s\"] + \"&v=\" + allQueries[\"v\"]\n , function (error, response, body) {\n if (!error) {\n \tsetRedisPair(allQueries[\"s\"] + allQueries[\"v\"], body, function() {});\n } else {\n console.log('info', responseResult(\"failure\",\"Access the API went error.\",\"\"));\n }\n });\n}", "function toCall(offset){\n\t\t\t\t//update the key\n\t\t\t\tif(hubCache.get(\"config\").type == \"hapikey\"){\n\t\t\t\t\tvar key = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + \"?hapikey=\" + key + '&limit=200' + '&offset=' + offset + propString)\n\t\t\t\t .then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.companies)\n\t\t\t\t\t if (response.data['has-more']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t \n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}else{\n\t\t\t\t\tvar token = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + '?offset=' + offset + '&limit=200' + propString,\n\t\t\t\t\t\t{headers: {\"Authorization\": \"Bearer \" + token }\n\t\t\t\t\t})\n\t\t\t\t .then(response =>{\n\t\t\t\t\t companies = companies.concat(response.data.companies)\n\t\t\t\t\t if (response.data['has-more']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(companies)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}//end of oauth block\n\t\t\t\t\n\t\t\n\t\t}", "function name(agent){\n var body=JSON.stringify(request.body);\n console.log(body);\n var obj = JSON.parse(body);\n \n // use outputContext[2] when testing in dialogflow console\n //let insuranceNumber=obj.queryResult.outputContexts[2].parameters.Insurance_Number;\n //let fever=obj.queryResult.outputContexts[2].parameters.Number2;\n //let preCon=obj.queryResult.outputContexts[2].parameters.Precondition;\n //let headInjury=obj.queryResult.outputContexts[2].parameters.Head_Injury;\n //let fracture=obj.queryResult.outputContexts[2].parameters.Fracture;\n \n let insuranceNumber=obj.queryResult.outputContexts[6].parameters.Insurance_Number;\n let fever=obj.queryResult.outputContexts[6].parameters.Number2;\n let preCon=obj.queryResult.outputContexts[6].parameters.Precondition;\n let headInjury=obj.queryResult.outputContexts[6].parameters.Head_Injury;\n let fracture=obj.queryResult.outputContexts[6].parameters.Fracture;\n console.log(insuranceNumber);\n let surname=obj.queryResult.parameters.givenname;\n let lastname=obj.queryResult.parameters.lastname;\n let mail=obj.queryResult.parameters.email;\n let birthDate=obj.queryResult.parameters.dateOfBirth; \n let params='InsuranceNumber='+ insuranceNumber + '&Surname=' + surname + '&Lastname=' + lastname + '&Mail=' + mail + '&dataOfBirth=' + birthDate;\n\tlet data = '';\n let url = encodeURI(`https://hook.integromat.com/zbeedk5u73hmh2jpay5w835anxq4x4kx?` + params);\n\treturn new Promise((resolve, reject) => { \n const request = https.get(url, (res) => {\n res.on('data', (d) => {\n data += d;\n agent.add(`Thanks`);\n console.log(`Thanks`); \n console.log(body);\n var name = surname + ` ` + lastname;\n consultationNeededPrompt(agent, name, fever, preCon, headInjury, fracture); \n });\n res.on('end', resolve);\n });\n request.on('error', reject);\n });\n }", "function sendPOSTrequest2API(returnJSON) {\n var xhttp = new XMLHttpRequest();\n xhttp.open('POST', 'ENDPOINTHERE', true); // http://www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp\n xhttp.setRequestHeader('Content-Type', 'application/json');\n xhttp.setRequestHeader('authorization', id_token);\n\n // do I need xhttp.onload here?? what does that do? see http://blog.garstasio.com/you-dont-need-jquery/ajax/ under Web API\n\n xhttp.send(JSON.stringify(returnJSON)); // not sure if I need to put send data inside () or can use just empty (); see http://blog.garstasio.com/you-dont-need-jquery/ajax/ under Web API\n \n // get response: hope that it contains id_token, user_id, email, name, keyword and is_active\n \n}", "async function AppelApi(parfunc=api_tan.GenericAsync(api_tan.getTanStations(47.2133057,-1.5604042)),\nretour=function(par){console.log(\"demo :\" + JSON.stringify(par))}) {\n let demo = await parfunc \n retour(demo);\n // console.log(\"demo : \" + JSON.stringify(demo));\n}", "async function responseFunction(a)\n {\n if(a == null)\n {\n // debug msg\n //console.log(\"\\nUsing dummy data!\");\n var b = JSON.parse('{ \"Success\" : true, \"ClientID\" : \"dur dur\" }');\n\n responses[responses.length] = [];\n\n responses[responses.length-1][\"Success\"] = b[\"Success\"]; // Success response\n\n responses[responses.length-1][\"ClientID\"] = b[\"ClientID\"]; // Customer ID\n\n // debug msg\n //console.log(\"\\nAdded response\");\n //console.log(responses[responses.length-1]);\n //console.log(\"\");\n\n sess.ClientID = responses[responses.length-1][\"ClientID\"];\n }\n else if(a)\n {\n responses[responses.length] = [];\n\n responses[responses.length-1][\"Success\"] = a[\"Success\"]; // Success response\n\n responses[responses.length-1][\"ClientID\"] = a[\"ClientID\"]; // Customer ID\n\n responses[responses.length-1][\"Message\"] = a[\"Message\"]; // Message\n\n if(!sess.ClientID)\n sess.ClientID = responses[responses.length-1][\"ClientID\"];\n }\n\n // debug msg\n console.log(\"Response -> \");\n console.log(responses[responses.length-1]);\n\n console.log(\"\\n------------------------\\n\");\n }", "createAPI(data) {\n return null;\n }", "function callGetServiceINTERNAL (state, URLPath, callback, authkey) {\n var config = {\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': authkey\n }\n }\n // console.log('Making call the config is:')\n // console.log(config)\n axios.get(\n state.corsproxyprefix + state.host + URLPath,\n config\n ).then(function (response) {\n // console.log('callGetServiceINTERNAL response')\n // console.log(response)\n if (response.status < 200) {\n callback.FAILcallback.method({msg: 'Bad status', response: response}, callback.FAILcallback.params)\n }\n else {\n if (response.status > 299) {\n callback.FAILcallback.method({msg: 'Bad status', response: response}, callback.FAILcallback.params)\n }\n else {\n callback.OKcallback.method(response, callback.OKcallback.params)\n }\n }\n })\n .catch(function (response) {\n if (typeof (response.response) === 'undefined') {\n if (typeof (response.message) === 'undefined') {\n callback.FAILcallback.method({msg: 'Bad Response UNKNOWN', response: response}, callback.FAILcallback.params)\n }\n else {\n console.log(response)\n callback.FAILcallback.method({msg: 'Bad Response ' + response.message, response: response}, callback.FAILcallback.params)\n }\n }\n else if (typeof (response.response.data) !== 'undefined') {\n if (typeof (response.response.data.errorMessages) !== 'undefined') {\n callback.FAILcallback.method({msg: 'Bad Response(' + response.response.data.errorMessages.length + ') ' + response.response.data.errorMessages, response: response.response}, callback.FAILcallback.params)\n }\n else {\n callback.FAILcallback.method({msg: 'Data Bad Response ' + response.response.status, response: response.response}, callback.FAILcallback.params)\n }\n }\n else {\n callback.FAILcallback.method({msg: 'Nested Bad Response ' + response.response.status, response: response.response}, callback.FAILcallback.params)\n }\n })\n}", "controller(model){\r\n Promise.all([\r\n api.sendRequest(`${api.API_URL}/flight`, 'GET'),\r\n api.sendRequest(`${api.API_URL}/airport`, 'GET')\r\n ]).then(allResponses => {\r\n model.flights = allResponses[0];\r\n model.airports = allResponses[1];\r\n })\r\n }", "function toCall(vidOffset){\n\t\t\t\t//update the key\n\t\t\t\tif(hubCache.get(\"config\").type == \"hapikey\"){\n\t\t\t\t\tvar key = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + \"?hapikey=\" + key + '&vidOffset=' + vidOffset)\n\t\t\t\t .then(response =>{\n\t\t\t\t\t contacts = contacts.concat(response.data.vids)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['vidOffset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(contacts)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}else{\n\t\t\t\t\tvar token = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + '?vidOffset=' + vidOffset,\n\t\t\t\t\t\t{headers: {\"Authorization\": \"Bearer \" + token }\n\t\t\t\t\t})\n\t\t\t\t .then(response =>{\n\t\t\t\t\t contacts = contacts.concat(response.data.vids)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['vidOffset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(contacts)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}//end of oauth block\n\t\t\t\t\n\t\t}", "function toCall(vidOffset){\n\t\t\t\t//update the key\n\t\t\t\tif(hubCache.get(\"config\").type == \"hapikey\"){\n\t\t\t\t\tvar key = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + \"?hapikey=\" + key + '&vidOffset=' + vidOffset)\n\t\t\t\t .then(response =>{\n\t\t\t\t\t contacts = contacts.concat(response.data.contacts)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(contacts)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}else{\n\t\t\t\t\tvar token = hubCache.get(\"config\").value\n\t\t\t\t\taxios.get(endpoint + '?vidOffset=' + vidOffset,\n\t\t\t\t\t\t{headers: {\"Authorization\": \"Bearer \" + token }\n\t\t\t\t\t})\n\t\t\t\t .then(response =>{\n\t\t\t\t\t contacts = contacts.concat(response.data.contacts)\n\t\t\t\t\t if (response.data['hasMore']){\n\t\t\t\t\t \tsetTimeout(function(){\n\t\t\t\t\t \t\ttoCall(response.data['offset']) \t\t\n\t\t\t\t\t \t},101)\n\t\t\t\t\t }else{ \t\n\t\t\t\t\t \tresolve(contacts)\n\t\t\t\t\t }\n\t\t\t\t \t}).catch(error => {\n\t\t\t\t\t \t//look through 429 error codes for daily or secondly(as in time) limit\n\t\t\t\t\t\tif(error.response.status == 404){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have a 404 error for endpoint not found.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 429){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You have exceeded your call limit for the day.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else if(error.response.status == 401){\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You are not authorized to hit this endpoint.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvar rejectObject = {\n\t\t\t\t\t\t\t\tadvice: \"You received a \" + error.response.status + \" error.\",\n\t\t\t\t\t\t\t\terror: error.response\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treject(rejectObject)\n\t\t\t\t\t\t}\n\t\t\t\t \t})\n\t\t\t\t}//end of oauth block\n\t\t\t\t\n\t\t}", "function buildRequest(tapi, data, cb) {\n var options = {\n method: tapi.method,\n uri: 'https://api.trello.com/1' + tapi.url,\n qs: {\n key: keys.key,\n token: keys.token,\n },\n headers: {\n 'User-Agent': 'byatec'\n },\n json: true // Automatically parses the JSON string in the response\n };\n\n // Check the validity of the request and put the data where it belongs\n if (validateData(tapi, data, (err) => console.log(err))) {\n replaceUriFieldsWithData(options, data);\n placeDataIntoRequest(options, data);\n cb(null, options);\n }\n else {\n cb(new Error('Data is missing fields'), options);\n }\n\n }", "fetchdata(method, params) {\n return _.extend(this.fetchInit, {\n body: JSON.stringify({\n id: uniqueId(),\n jsonrpc: '2.0',\n method,\n params,\n }),\n });\n }", "function sendName(something) {\n let apiCall = \"https://api.nasa.gov/mars-photos/api/v1/manifests/\" + something + \"/?api_key=RZGwSzKbOaZadLPNj2btegTPGivRWJI8IKnLnUsd\"\n let splitCall = \"https://api.nasa.gov/mars-photos/api/v1/rovers/\" + something + \"/photos?sol=$&api_key=RZGwSzKbOaZadLPNj2btegTPGivRWJI8IKnLnUsd\"\n let holder\n\n fetch(apiCall).then(function (response) {\n if (response.ok) {\n response.json()\n .then(function (data) {\n holder = data;\n newFunction(holder, splitCall)\n });\n } else {\n alert(\"Error: \" + response.statusText + \"... The API call is failing. Come back soon!\");\n }\n });\n}", "function API()\r\n{\r\n this.call = function(callName, args, handler)\r\n {\r\n if(apiReturns[callName])\r\n {\r\n log(\"API call \" + callName + \" overriden.\");\r\n if(callbacks[callName] && callbacks[callName].before) callbacks[callName].callback(args, apiReturns[callName]);\r\n if(handler) handler(apiReturns[callName]);\r\n if(callbacks[callName] && !callbacks[callName].before) callbacks[callName].callback(args, apiReturns[callName]);\r\n }\r\n else\r\n {\r\n if(callbacks[callName] && callbacks[callName].callback)\r\n api_call(callName, args, function(e)\r\n {\r\n if(callbacks[callName].before) callbacks[callName].callback(args, apiReturns[callName]);\r\n if(handler) handler(apiReturns[callName]);\r\n if(!callbacks[callName].before) callbacks[callName].callback(args, apiReturns[callName]);\r\n });\r\n else\r\n api_call(callName, args, handler);\r\n }\r\n }\r\n\r\n // Override API call [apiCallName] to return [apiReturn].\r\n this.setAPIOverride = function(apiCallName, apiReturn)\r\n {\r\n apiReturns[apiCallName] = apiReturn;\r\n }\r\n\r\n this.clearAPIOverride = function(apiCallName)\r\n {\r\n this.setAPIOverride(apiCallName, undefined);\r\n }\r\n\r\n // Call [callback] after the normal handler for [apiCallName] has been executed. Iff [before] is set, [callback] will be called before the typical handler.\r\n this.setAPICallback = function(apiCallName, _callback, _before)\r\n {\r\n callbacks[apiCallName] = { callback : _callback, before : _before };\r\n }\r\n\r\n this.clearAPICallback = function(apiCallName)\r\n {\r\n callbacks[apiCallName] = undefined;\r\n }\r\n\r\n // Collection of API overrides.\r\n var apiReturns = {};\r\n // Collection of API callbacks.\r\n var callbacks = {};\r\n}", "call(action, params = {}, method = 'GET', content_type = 'application/json') {\n \n console.log(\"Calling \" + action);\n \n this.baseurl = this.baseurl.trim();\n this.baseurl = this.baseurl.replace(/\\/$/, \"\");\n this.baseurl = this.baseurl.replace(/\\s/, \"\");\n \n var hmac = crypto.createHmac('sha256', this.apikey);\n hmac.update(action);\n \n var query = {\n method: method,\n headers: {\n Accept: 'application/json',\n 'Content-Type': content_type,\n 'X-KNOWN-USERNAME': this.username,\n 'X-KNOWN-SIGNATURE': hmac.digest('base64')\n }, \n };\n if (method == 'POST') {\n if (content_type == 'application/json')\n query.body = JSON.stringify(params);\n else\n query.body = params;\n }\n \n console.log(\"Query to \" + this.baseurl + action +\": \");console.log(query);\n \n return fetch(this.baseurl + action, query)\n .then((response) => response.json())\n .then((responseJson) => {\n //console.log(\"Response: \" + JSON.stringify(responseJson));\n return responseJson;\n })\n .catch((error) => {\n console.warn(error)\n reject(error);\n })\n }", "function addAPIReq(userGUID, apiName){\n return new Promise(async (resolve, reject) => {\n var request = JSON.parse(templates.req_API);\n\n request.status = 1;\n request.req_date = new Date();\n request.info.clientGUID = userGUID;\n request.info.project_name = apiName;\n\n try{\n var add = await redis.SADDSync('req_api', JSON.stringify(request));\n resolve(add);\n } catch(reject) {\n reject({\"Error\" : reject, \"Method\" : \"addAPIReq()\", \"Code\" : 1});\n }\n });\n}", "function apiCall(cityInput) {\n var weatherUrl = 'https://api.openweathermap.org/data/2.5/weather?q=' + cityInput + '&appid=' + appkey + '&units=' + unit;\n fetch(weatherUrl)\n .then(function (response) {\n return response.json();\n })\n .then(function (data) {\n // collecting different variables to plug them into the DOM so that the user can see data for their city\n var cityEl = document.querySelector('#cityName');\n cityEl.textContent = cityInput + ' (' + (currentDate) + ')';\n var tempEl = document.querySelector('#temp');\n tempEl.textContent = 'Temperature: ' + parseInt(data.main.temp) + '°F';\n var humidityEl = document.querySelector('#humidity');\n humidityEl.textContent = 'Humidity: ' + parseInt(data.main.humidity) + '%';\n var windEl = document.querySelector('#windspeed');\n windEl.textContent = 'Wind Speed: ' + parseInt(data.wind.speed) + ' MPH';\n var lat = parseInt(data.coord.lat);\n var lon = parseInt(data.coord.lon);\n\n var uvIndexUrl = 'https://api.openweathermap.org/data/2.5/uvi?lat=' + lat + '&lon=' + lon + '&appid=' + appkey;\n\n // fetching the UVIndex open weather api so that we can set info on the uv index\n fetch(uvIndexUrl)\n .then(function (response) {\n return response.json();\n })\n .then(function (data) {\n uvIndexNumber = parseInt(data.value);\n var uvIndexEl = document.querySelector('#uvindex');\n uvIndexEl.textContent = 'UV Index: ' + uvIndexNumber;\n // changing background color based on index returned from api\n if (uvIndexNumber < 4) {\n uvIndexEl.classList.add('favorable');\n } else if (uvIndexNumber >= 4 && uvIndexNumber <= 7) {\n uvIndexEl.classList.add('moderate');\n } else {\n uvIndexEl.classList.add('severe');\n }\n })\n fiveDayAPICall(cityInput);\n })\n}", "function movieDetails (api_app) {\n // Complete your fulfillment logic and send a response\n const inputAttr = api_app.getArgument(\"attributes\");\n const movieName = api_app.getArgument(\"movie\");\n // var inputAttr=\"director\";\n // var movieName=\"iron man\";\n var movieId = myCache.get(movieName);\n // var movieData = myCache.get(\"ASd\");\n var movieData = myCache.get(movieId || \"placeholder_ran\");\n // var mData;\n const sendAppropriateResponse = function(data) {\n // WRITE CORE LOGIC HERE for getting that data\n // mData = data;\n var result = \"\";\n if(dataMapper.get(inputAttr) == \"credits\"){\n switch(inputAttr) {\n case \"crew\":\n var map = new Map();\n result = \"The\";\n data.credits.crew.filter( item => { return [\"producer\",\"director\"].indexOf(item.job.toLowerCase()) != -1;}).forEach( obj => { map.set(obj.job, obj.name) });\n map.forEach( (value, key) => result += ` ${key} is ${value}` );\n break;\n case \"cast\":\n var cast = data.credits.cast;\n result = `${cast[0].name}, ${cast[1].name} and ${cast[2].name} are some of the cast members`;\n break;\n case \"vote_average\":\n result = `I don't know about that but according to my sources it has an average of ${data[inputAttr]}!`;\n break;\n default:\n result = \"The \" + inputAttr + \" of \" + movieName + \" is \" +\n data.credits.crew.filter( item => { return item.job.toLowerCase() == inputAttr;})[0].name;\n }\n }else{\n if(inputAttr == \"release_date\"){\n var options = { year: 'numeric', month: 'long', day: 'numeric' };\n result = `It was released on ${(new Date(data[inputAttr])).toLocaleDateString(\"en-US\",options)}`;\n }else if(inputAttr == \"genres\"){\n result = `${movieName} can be classified into ${data.genres.map( obj => obj.name ).join(\",\")}`;\n }else{\n result = data.overview;\n }\n }\n\n api_app.ask(result);\n\n }\n\n const getMovieDetails = function(id) {\n tmdb.movie.details({movie_id: id, append_to_response: \"credits\"})\n .then( data => {\n movieData = data;\n myCache.set( id, movieData, 120 );\n sendAppropriateResponse(movieData);\n }).catch( error => {\n console.log(\"ERROR getting movie details \"+JSON.stringify(error));\n api_app.ask(\"Sorry, can you try again please ?\");\n });\n }\n\n const getMovieId = function(name) {\n tmdb.search.movie({ query: name })\n .then( movies => {\n movieId = movies.results[0].id\n getMovieDetails(movieId);\n }).catch( error => {\n console.log(\"ERROR searching movie - \"+JSON.stringify(error));\n api_app.ask(\"Oops, either the service is down or I just forgot the movie name. Can you start over with the movie ?\");\n });\n }\n\n if(movieId == undefined) {\n // not in cache, make the request and cache it\n getMovieId(movieName)\n }else if(movieData == undefined) {\n getMovieDetails(movieId);\n }else{\n sendAppropriateResponse(movieData);\n }\n }", "function fetcher(method, inputEndpoint, inputParams, body) {\n\tlet endpoint = inputEndpoint;\n\tconst params = inputParams;\n\n\treturn new Promise(async (resolve, reject) => {\n\t\t// const network = await NetInfo.isConnected.fetch().then(isConnected => isConnected);\n\t\t// if (!network) return reject(Labels.error.networkError);\n\n\t\trequestCounter += 1;\n\t\tconst requestNum = requestCounter;\n\n // After x seconds, let's call it a day!\n\t\tconst timeoutAfter = 5;\n\t\tconst apiTimedOut = setTimeout(() => (\n reject(Labels.error.timeOut)\n ), timeoutAfter * 1000);\n\n\t\tif (!method || !endpoint) {\n\t\t\treturn reject('Missing params (API.fetcher).');\n\t\t}\n\n // Build request\n\t\tconst req = {\n\t\t\tmethod: method.toUpperCase(),\n\t\t\theaders: {\n // 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n\t\t\t\t// 'Content-Type': 'application/x-www-form-urlencoded'\n\t\t\t}\n\t\t};\n\n\t\t// Add Token\n\t\tif (endpoint !== APIConfig.endpoints[0].url) {\n\t\t\tconst jwt = await Util.getFromStorage('jwt');\n\t\t\tif (jwt) {\n\t\t\t\treq.headers.Authorization = `Bearer ${jwt}`;\n\t\t\t}\n\t\t}\n\n // Add Endpoint Params\n\t\tlet urlParams = '';\n\t\tif (params) {\n // Object - eg. /recipes?title=this&cat=2\n\t\t\tif (typeof params === 'object') {\n\t\t\t\t// Replace matching params in API routes eg. /recipes/{param}/foo\n\t\t\t\tObject.keys(params).forEach((param) => {\n\t\t\t\t\tif (endpoint.includes(`{${param}}`)) {\n\t\t\t\t\t\tendpoint = endpoint.split(`{${param}}`).join(params[param]);\n\t\t\t\t\t\tdelete params[param];\n\t\t\t\t\t}\n\t\t\t\t});\n\n // Check if there's still an 'id' prop, /{id}?\n\t\t\t\tif (params.id !== undefined) {\n\t\t\t\t\tif (typeof params.id === 'string' || typeof params.id === 'number') {\n\t\t\t\t\t\turlParams = `/${params.id}`;\n\t\t\t\t\t\tdelete params.id;\n\t\t\t\t\t}\n\t\t\t\t}\n // Add the rest of the params as a query string\n\t\t\t\turlParams = `?${serialize(params)}`;\n\t\t\t}\n\t\t\telse if (typeof params === 'string' || typeof params === 'number') {\n\t\t\t\t// String or Number - eg. /recipes/23\n\t\t\t\turlParams = `/${params}`;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Something else? Just log an error\n\t\t\t\tdebug('You provided params, but it wasn\\'t an object!', HOSTNAME + endpoint + urlParams);\n\t\t\t}\n\t\t}\n\n // Add Body\n\t\tif (body) {\n // use if => 'Content-Type' : 'application/x-www-form-urlencoded'\n\t\t\treq.body = serialize(body);\n\n // use if => 'Content-Type' : 'application/json'\n // req.body = JSON.stringify(body);\n\t\t}\n\n\t\tconst thisUrl = HOSTNAME + endpoint + urlParams;\n\n\t\tdebug(`REQUEST #${requestNum}`, HOSTNAME + endpoint, body, req.method, req.headers);\n\n // Make the request\n\t\treturn fetch(thisUrl, req)\n\t\t\t.then(async (rawResponse) => {\n\t\t\t\t// API got back to us, clear the timeout\n\t\t\t\tclearTimeout(apiTimedOut);\n\t\t\t\tif (!rawResponse || rawResponse.status !== 200) {\n throw rawResponse ? rawResponse.status : { message: Labels.error.networkError };\n }\n\t\t\t\tlet jsonResponse = {};\n\t\t\t\ttry {\n\t\t\t\t\tjsonResponse = await rawResponse.json();\n\t\t\t\t}\n\t\t\t\tcatch (error) {\n\t\t\t\t\tlet err = '';\n\t\t\t\t\tif (!rawResponse.url.includes(HOSTNAME)) {\n\t\t\t\t\t\terr = { message: Labels.error.networkError };\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\terr = { message: Labels.error.default };\n\t\t\t\t\t}\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\treturn jsonResponse;\n\t\t\t})\n\t\t\t.then((response) => {\n\t\t\t\tdebug(`RESPONSE #${requestNum}`, HOSTNAME + endpoint, response);\n\t\t\t\treturn resolve(response);\n\t\t\t})\n\t\t\t// when response status code is not 200\n\t\t\t.catch(async (error, code) => {\n\t\t\t\t// API got back to us, clear the timeout\n\t\t\t\tclearTimeout(apiTimedOut);\n\t\t\t\tdebug(`RESPONSE #${requestNum}`, HOSTNAME + endpoint, { error, code });\n\n\t\t\t\tif (error === 401) {\n\t\t\t\t\treturn reject(error);\n\t\t\t\t}\n\n\t\t\t\tif (!error.message) {\n\t\t\t\t\treturn reject(Labels.error.default);\n\t\t\t\t}\n\n\t\t\t\treturn reject(error);\n\t\t\t});\n\t});\n}", "firstPass(ledger, { prev_api, curr_api, curr_chat }) {}", "function callAPIalternate(domain, type, id, call, token, optPerPage){\n var perpage = (optPerPage != undefined) ? \"&per_page=\"+optPerPage : \"\";\n var resp = {};\n var url = \"https://\"+domain+\"/\"+type+\"/\"+id+\"/\"+call+\"?access_token=\"+token+perpage;\n\n Browser.msgBox(url);\n \n var result = UrlFetchApp.fetch(url);\n //Browser.msgBox(result);\n if (result.getResponseCode() == 200){\n var header = result.getHeaders();\n if (header.Link) {\n resp.linkHeader = parseLinkHeader(header.Link).rels;\n }\n resp.result = JSON.parse(result.getContentText());\n resp.responseCode = 200;\n } else {\n resp.responseCode = result.getResponseCode();\n }\n var x = Utilities.jsonParse(result.getContentText());\n //Browser.msgBox(x);\n return resp;\n}", "function callAPI(id) {\n const age = 20;\n return new Promise((resolve, reject) => {\n resolve({ id, name: \"Woody\", age })\n });\n}", "async function callAPIsAndUpdateCountriesInfo(requestsList, type, overwrite = false) {\n\n let countriesInfo = countriesInfoFunctions.returnCountriesInfo();\n\n let updateStatus = [];\n\n let currentDate = window['currentDate'];\n\n for (let i = 0; i < requestsList.length; i++) {\n\n let requestProperty;\n\n try {\n\n requestProperty = countriesInfo[type][requestsList[i]];\n\n } catch (e) {\n\n requestProperty = false;\n\n }\n\n if (requestsList[i] !== 'countryWeather') {\n\n if (requestProperty && (overwrite == false)) {\n\n let propertyCreationDate = moment.unix(countriesInfo[type]['timeOfCreation'][requestsList[i]]).format('DD/MM/YYYY');\n \n if (currentDate == propertyCreationDate) {\n \n debug_log(`callAPIsAndUpdateCountriesInfo: ${requestsList[i]} data loaded from localStorage`);\n updateStatus[i] = true;\n continue;\n \n }\n \n }\n\n }\n\n let countryName;\n let boundingBox;\n let lat, lon;\n let isoCode;\n\n switch (requestsList[i]) {\n\n // Bounding Box API Calls\n case 'countryPOI':\n case 'countryWeather':\n countryName = countriesInfo[type]['countryBorder']['properties']['name'];\n boundingBox = returnBoundingBoxFromCountryName(countryName);\n updateStatus[i] = await countriesInfoFunctions.updateProperty(requestsList[i], type, boundingBox);\n break;\n // Lat/Lon API Calls\n case 'localPOI':\n case 'localWeather':\n lat = window[`${type}Lat`];\n lon = window[`${type}Lon`];\n updateStatus[i] = await countriesInfoFunctions.updateProperty(requestsList[i], type, {lat: lat, lon: lon});\n break;\n case 'covid':\n isoCode = countriesInfo[type]['countryBorder']['properties']['iso_a3'];\n updateStatus[i] = await countriesInfoFunctions.updateProperty(requestsList[i], type, {isoCode: isoCode});\n break;\n case 'news':\n countryName = countriesInfo[type]['countryBorder']['properties']['name'];\n updateStatus[i] = await countriesInfoFunctions.updateProperty(requestsList[i], type, {countryName: countryName});\n break;\n\n }\n\n }\n\n let sectionsToUpdate = [];\n\n for (let i = 0; i < updateStatus.length; i++) {\n\n // Add section to sectionsToUpdate list (if update was successful)\n if (updateStatus[i]) {\n\n sectionsToUpdate.push(requestsList[i]);\n\n // Log API call failure (If update was not successful)\n } else {\n\n console.error(`Failed to load ${requestsList[i]} data`);\n\n }\n\n }\n\n return sectionsToUpdate;\n\n }", "function VexReq(url,alexa) {\n this.url = url;\n this.getResponse = function(location, callback) {\n var Url = location || url;\n https.get(Url, (res) => {\n var rawData = '';\n res.on('data', (d) => rawData += d);\n res.on('end', () => {\n try {\n callback(JSON.parse(rawData));\n } catch (e) {\n console.error(e);\n alexa.emit('Error');\n }\n });\n }).on('error', (e) => {\n console.error(e);\n alexa.emit('Error');\n });\n };\n this.requestWithParams = function(location,callback) {\n var Url = location || url;\n var args = Array.from(arguments);\n // i starts at 1 to skip location and callback\n for(var i = 2; i < args.length; i ++) {\n if(i == 2 && !Url.includes(\"?\")) {\n Url += \"?\";\n } else {\n Url += \"&\";\n }\n Url+=args[i];\n }\n this.getResponse(Url, function(data) {\n callback(data);\n })\n };\n this.getFullResponse = function(callback,location) {\n var Url = location || url;\n var obj = this;\n this.requestWithParams(Url, function(data) {\n var length = data.size;\n var output = {\"status\":1,\"size\":0,\"result\":[]};\n obj.waitForFullResponse(length, 0, Url, output, obj, function(newLength, newOutput) {\n output.size = newLength;\n callback(newOutput);\n })\n },'nodata=true');\n };\n this.waitForFullResponse = function(length, countedLen, Url, output, thisObj, callback) {\n if(countedLen < length) {\n thisObj.requestWithParams(Url, function(data) {\n countedLen += data.size;\n output.result = output.result.concat(data.result);\n thisObj.waitForFullResponse(length, countedLen, Url, output, thisObj, callback);\n },'limit_start' + countedLen);\n } else {\n callback(countedLen, output);\n }\n }\n}", "function main() {\n\n\t\t//Check the Method\n\t\tif ($.request.method === $.net.http.GET) {\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tresult: \"GET is not supported, perform a POST to add Entries\"\n\t\t\t}));\n\t\t} else {\n\t\t\t//Perform Table Entry to be created in Table\n\t\t\ttry {\n\t\t\t\tif (gvGuid) {\n\t\t\t\t\t_createEntries();\n\t\t\t\t}\n\t\t\t} catch (errorObj) {\n\t\t\t\tgvTableUpdate = \"Error during table insert:\" + errorObj.message;\n\t\t\t}\n\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tTableUpdateStatus: gvTableUpdate\n\t\t\t}));\n\t\t}\n\t}", "function apiPOKEMONcb(apiCall,callback) {\n // API Reference @ https://pokeapi.co\n console.log(\"API Request [POKE]: \" + apiCall);\n var req = http.get(apiCall, function(res) {\n let body = \"\";\n res.on('data', function (chunk) { body += chunk });\n res.on('end', function() {\n if (body == 'Not Found') {\n console.log('^^^^^^^^^^^^^^^^^^^^ DUD'); // TO DO\n callback();\n } else {\n if (apiCall.includes('evolution')) {\n let poke = JSON.parse(body);\n var evoChain = [];\n var evoData = poke.chain;\n let nest = -1;\n let evoChainNarrative = [];\n let evoNarrative = '';\n do {\n nest = nest + 1;\n let numberOfEvolutions = evoData['evolves_to'].length;\n var evoDetails = evoData['evolution_details'][0];\n let pokeEvoDetailsLoop = 0;\n if (typeof evoData['evolution_details'][0] != 'undefined') {\n //console.table(evoDataNest['evolution_details'][nestLoop]);\n evoChainNarrative = [];\n for (pokeEvoDetailsLoop = 0; pokeEvoDetailsLoop < pokeEvoDetails.length; pokeEvoDetailsLoop++) {\n var holder = evoData['evolution_details'][0][pokeEvoDetails[pokeEvoDetailsLoop]];\n if (typeof holder != 'undefined' && holder != null && holder != '') {\n if (typeof holder == 'object') { holder = holder.name };\n holder = '' + holder;\n if (holder != '-1') {holder = holder.replace(/-/g, ' ')};\n holder = strTitleCase(holder);\n if (pokeEvoDetails[pokeEvoDetailsLoop] == 'trigger') {\n evoNarrative = holder;\n } else {\n if (pokeEvoDetails[pokeEvoDetailsLoop] == 'relative_physical_stats') {\n if (holder == '1') { holder = 'Attack > Defence' };\n if (holder == '-1') { holder = 'Defence > Attack' };\n };\n if (holder == 'True') { holder = 'while raining'};\n holder = pokeEvoPrefix[pokeEvoDetailsLoop] + holder + pokeEvoSuffix[pokeEvoDetailsLoop];\n evoChainNarrative.push(holder);\n }; // if (pokeEvoDetails[pokeEvoDetailsLoop]\n //console.log(\"DEBUG [apiPOKEMONcb]> Evolution parameters: \" + pokeEvoDetails[pokeEvoDetailsLoop] + ' = ' + holder);\n }; // if (typeof holder\n }; // for (pokeEvoDetailsLoop\n }; // if (typeof evoData\n //if (typeof evoData['evolution_details'][0] != 'undefined') { console.table(evoData['evolution_details'][0]) };\n var evoPhraseCnt = evoChainNarrative.length;\n var super_prefix = ' and '; // switch to or?\n if (evoPhraseCnt == 0) {\n // Only trigger\n } else if (evoPhraseCnt == 1) {\n evoNarrative = evoNarrative + ' ' + evoChainNarrative[0];\n } else if (evoPhraseCnt == 2) {\n evoNarrative = evoNarrative + ' ' + evoChainNarrative[0] + super_prefix + evoChainNarrative[1];\n } else { // >2 e.g. 3.... 0,1,2 (length -1)\n let narLoop = 1;\n for (narLoop = 0; narLoop < evoPhraseCnt.length; narLoop++) {\n if (narLoop == (evoPhraseCnt-1)) {\n super_prefix = ' and ';\n } else if (narLoop == 0) {\n super_prefix = ' ';\n } else {\n super_prefix = ', ';\n }; // if (narLoop\n evoNarrative = evoNarrative + super_prefix + evoChainNarrative[narLoop];\n }; // for (narLoop = 0;\n }; // if (evoPhraseCnt\n evoChain.push({\n \"Root\": '*',\n \"Sequence\": nest,\n \"Species\": strTitleCase(evoData.species.name),\n \"Evolution\": evoNarrative\n }); // evoChain.push({\n //console.log(\"DEBUG [apiPOKEMONcb]> Pokemon: \" + evoData .species.name + '; Evolution: ' + evoNarrative);\n if (numberOfEvolutions > 1) {\n for (let i = 1;i < numberOfEvolutions; i++) {\n evoChainNarrative = [];\n var evoDataNest = evoData.evolves_to[i];\n var evoDetailsNest = evoDataNest['evolution_details'][0];\n let nestLoop = 0;\n let reached = -1;\n for (nestLoop = 0; nestLoop < evoDataNest['evolution_details'].length; nestLoop++) {\n if (typeof evoDataNest['evolution_details'][nestLoop] != 'undefined') {\n for (pokeEvoDetailsLoop = 0; pokeEvoDetailsLoop < pokeEvoDetails.length; pokeEvoDetailsLoop++) {\n var holder = evoDataNest['evolution_details'][nestLoop][pokeEvoDetails[pokeEvoDetailsLoop]];\n if (typeof holder != 'undefined' && holder != null && holder != '') {\n if (typeof holder == 'object') { holder = holder.name };\n holder = '' + holder;\n if (holder != '-1') {holder = holder.replace(/-/g, ' ')};\n holder = strTitleCase(holder);\n if (pokeEvoDetails[pokeEvoDetailsLoop] == 'trigger') {\n evoNarrative = holder;\n } else {\n if (pokeEvoDetails[pokeEvoDetailsLoop] == 'relative_physical_stats') {\n if (holder == '1') { holder = 'Attack > Defence' };\n if (holder == '-1') { holder = 'Defence > Attack' };\n };\n if (holder == 'True') { holder = 'while raining'};\n holder = pokeEvoPrefix[pokeEvoDetailsLoop] + holder + pokeEvoSuffix[pokeEvoDetailsLoop];\n evoChainNarrative.push(holder);\n };\n //console.log(\"DEBUG [apiPOKEMONcb]> Evolution parameters (nested): \" + pokeEvoDetails[pokeEvoDetailsLoop] + ' = ' + holder);\n }; // if (typeof holder\n }; // for (pokeEvoDetailsLoop\n }; // if (typeof evoDataNest\n reached = nestLoop;\n }; // for (nestLoop\n var evoPhraseCnt = evoChainNarrative.length;\n var super_prefix = ' and '; // switch to or?\n if (reached > 0) { var super_prefix = ' or ' }\n if (evoPhraseCnt == 0) {\n // Only trigger\n } else if (evoPhraseCnt == 1) {\n evoNarrative = evoNarrative + ' ' + evoChainNarrative[0];\n } else if (evoPhraseCnt == 2) {\n evoNarrative = evoNarrative + ' ' + evoChainNarrative[0] + super_prefix + evoChainNarrative[1];\n } else { // >2 e.g. 3.... 0,1,2 (length -1)\n let narLoop = 0;\n for (narLoop = 0; narLoop < evoPhraseCnt; narLoop++) {\n if (narLoop == (evoPhraseCnt-1)) {\n super_prefix = ' and ';\n if (reached > 0) { var super_prefix = ' or ' }\n } else if (narLoop == 0) {\n super_prefix = ' ';\n } else {\n super_prefix = ', ';\n }; // if (narLoop\n evoNarrative = evoNarrative + super_prefix + evoChainNarrative[narLoop];\n }; // for (narLoop\n }; // if (evoPhraseCnt\n evoChain.push({\n \"Sequence\": nest,\n \"Species\": strTitleCase(evoDataNest.species.name),\n \"Evolution\": evoNarrative\n }); // evoChain.push({\n //console.log(\"DEBUG [apiPOKEMONcb]> Pokemon: \" + evoDataNest .species.name + '; Evolution: ' + evoNarrative);\n }; // for (let i = 1;i < numberOfEvolutions; i++) {\n }; // if (numberOfEvolutions > 1)\n evoData = evoData['evolves_to'][0];\n } while (!!evoData && evoData.hasOwnProperty('evolves_to'));\n //console.log(\"DEBUG [apiPOKEMONcb]> Results:\"); console.table(evoChain);\n let evoChainCnt = evoChain.length;\n let evoSequence = '';\n if (evoChainCnt == 0) {\n evoSequence = 'Sorry, unable to find evolution chain';\n } else if (evoChainCnt == 1) {\n evoSequence = evoChain[0]['Species'] + \" does not evolve\";\n } else {\n let evoLoop = 0;\n let pokePrevious = '';\n let pokeFirst = false;\n for (evoLoop = 0; evoLoop < evoChainCnt; evoLoop++) {\n if (evoChain[evoLoop]['Root'] == '*' && evoLoop == 0 ) { // 0\n pokePrevious = evoChain[evoLoop]['Species'];\n } else if (evoChain[evoLoop]['Root'] == '*' && evoLoop != (evoChainCnt - 1)) { // 1\n evoSequence = evoSequence + pokePrevious + ' ➡️ ';\n // Poliwag >\n pokePrevious = evoChain[evoLoop]['Species'];\n evoSequence = evoSequence + pokePrevious + ' 📶 ' + evoChain[evoLoop]['Evolution'] + '\\n';\n // Poliwag > Poliwhirl [Level Up with Level 25+]\n //\n } else if (evoChain[evoLoop]['Root'] != '*') { // 2\n evoSequence = evoSequence + pokePrevious + ' ➡️ ';\n evoSequence = evoSequence + evoChain[evoLoop]['Species'] + ' 📶 ' + evoChain[evoLoop]['Evolution'] + '\\n';\n\n } else if (evoChain[evoLoop]['Root'] == '*') { // Final evolution 3\n evoSequence = evoSequence + pokePrevious + ' ➡️ ';\n // Poliwag > Poliwhirl [Level Up with Level 25+]\n // Poliwhirl >\n evoSequence = evoSequence + evoChain[evoLoop]['Species'] + ' 📶 ' + evoChain[evoLoop]['Evolution'];\n // Poliwag > Poliwhirl [Level Up with Level 25+]\n // Poliwhirl > Poliwrath [Use Item Water Stone]\n };\n }; // for (evoLoop = 0\n }; // if (evoChainCnt == 0)\n pokeEvolution.push({\n \"Evolution URL\": apiCall,\n \"Evolution Narrative\": evoSequence\n }); //\n console.log(\"DEBUG [apiPOKEMONcb]> Evolution sequence: \\n\" + evoSequence);\n callback();\n } else if (apiCall.includes('species')) {\n let poke = JSON.parse(body);\n let description = 'No description'\n let flavCount = poke.flavor_text_entries.length;\n let flavLoop = 0;\n for (flavLoop = 0; flavLoop < flavCount; flavLoop++) {\n let flavEntry = poke.flavor_text_entries[flavLoop];\n if (flavEntry.language.name == 'en' && flavEntry.version.name == 'red') {\n description = flavEntry.flavor_text;\n }; // if\n }; // for (flavLoop\n description = strReplaceAll(description,'\\n',' ');\n description = strReplaceAll(description,'\\f',' ');\n description = description.replace(/^((\\S+\\s+){7}\\S+)\\s+/, '$1\\n');\n let eggs = poke.egg_groups.map((element) => strTitleCase(element.name)).join(', ');\n eggs = eggs.replace(/,([^,]*)$/,' &$1'); // last comma for and\n let hatch_after = (poke.hatch_counter+1)*255;\n let habitat = \"No Habitat\";\n if (poke.habitat != null) { habitat = poke.habitat.name };\n let hatch_steps = hatch_after + ' Steps';\n let female_eighth = poke.gender_rate; // in 1/8th female proportion i.e. 2=25% female\n let gender = '';\n if (female_eighth == -1) {\n gender = 'None';\n } else {\n var female_proportion = (female_eighth/8)*100;\n var male_proportion = 100 - female_proportion;\n gender = '♀️' + female_proportion.toFixed(1) + '% ♂️' + male_proportion.toFixed(1) + '%'; //ToFixed is string\n }\n pokeSpecies.push({\n \"Species URL\": apiCall,\n \"Description\": description,\n \"Egg Groups\": eggs,\n \"Steps to Hatch\": hatch_steps,\n \"Gender Distribution\": gender,\n \"Colour\": poke.color.name,\n \"Shape\": poke.shape.name,\n \"Growth Rate\": poke.growth_rate.name,\n \"Habitat\": habitat,\n \"Base Happiness\": poke.base_happiness,\n \"Capture Rate\": poke.capture_rate,\n \"Evolution URL\": poke.evolution_chain.url\n }); // pokeSpecies.push\n console.log(\"DEBUG [apiPOKEMONcb]> Species: \\n\");\n console.table(pokeSpecies[pokeSpecies.length - 1])\n callback();\n } else { // pokemon URL\n let poke = JSON.parse(body);\n let types = poke.types.map((type) => strTitleCase(type.type.name)).join(', ');\n types = types.replace(/,([^,]*)$/, ' &$1'); // last comma for and\n let abilities = poke.abilities.map((ability) => strTitleCase(ability.ability.name)).join(', ');\n abilities = abilities.replace(/,([^,]*)$/, ' &$1');\n let moves = poke.moves.map((move) => strTitleCase(move.move.name)).join(', ');\n moves = moves.replace(/,([^,]*)$/, ' &$1');\n pokeDex.push({\n \"ID\": poke.id,\n \"Name\": poke.species.name,\n \"Species URL\": poke.species.url,\n \"Height\": poke.height/10 + 'm',\n \"Weight\": poke.weight/10 + 'kg',\n \"Sprite\": poke.sprites.front_default,\n \"Speed\": poke.stats[0].base_stat,\n \"Defence\": poke.stats[1].base_stat,\n \"Attack\": poke.stats[2].base_stat,\n \"Sp. Defence\": poke.stats[3].base_stat,\n \"Sp. Attack\": poke.stats[4].base_stat,\n \"HP\": poke.stats[5].base_stat,\n \"Total\": (poke.stats[5].base_stat + poke.stats[4].base_stat + poke.stats[3].base_stat +\n poke.stats[2].base_stat + poke.stats[1].base_stat + poke.stats[0].base_stat),\n \"Base Experience\": poke.base_experience,\n \"Type(s)\": types,\n \"Abilities\": abilities,\n \"Moves\": moves\n }); // pokeDex.push\n console.log(\"DEBUG [apiPOKEMONcb]> Pokemon: \\n\");\n console.table(pokeDex[pokeDex.length - 1]);\n callback();\n }; // else { // pokemon URL\n }; // if (body == 'Not Found')\n }); // res.on('end'\n }); // http.get(url\n req.on('error', function(e) { // Catches failures to connect to the API\n console.log(\"ERROR [apiPOKEMONcb]> Error getting to API: \" + e);\n callback();\n }); // req.on('error'\n}", "function SetAPI(arg) {\n // Establish an auth object which has properties token and user_id.\n const module = 'SetAPI';\n let auth;\n if (typeof arg.auth === 'function') {\n auth = arg.auth();\n } else {\n // REALLY??\n auth = arg.auth || {};\n }\n\n if (!arg.url) {\n throw new Error('The service discovery url was not provided');\n }\n if (!arg.version) {\n throw new Error('The service version was not provided');\n }\n\n function options() {\n return {\n timeout: arg.timeout,\n authorization: auth.token,\n rpcContext: arg.rpcContext,\n };\n }\n\n this.lookupModule = function () {\n const func = 'get_service_status',\n params = [\n {\n module_name: module,\n version: arg.version || 'dev',\n },\n ];\n return jsonRpc.request(arg.url, 'ServiceWizard', func, params, 1, options());\n };\n\n /*\n * ref\n */\n this.get_reads_set_v1 = function () {\n const params = Array.prototype.slice.call(arguments),\n func = 'get_reads_set_v1';\n\n return this.lookupModule().then((serviceStatus) => {\n return jsonRpc.request(serviceStatus.url, module, func, params, 1, options());\n });\n };\n\n /*\n * ref\n */\n this.save_reads_set_v1 = function () {\n const params = Array.prototype.slice.call(arguments),\n func = 'save_reads_set_v1';\n\n return this.lookupModule().then((serviceStatus) => {\n return jsonRpc.request(serviceStatus.url, module, func, params, 1, options());\n });\n };\n\n /*\n * ref\n */\n this.list_sets = function () {\n const params = Array.prototype.slice.call(arguments),\n func = 'list_sets';\n\n return this.lookupModule().then((serviceStatus) => {\n return jsonRpc.request(serviceStatus.url, module, func, params, 1, options());\n });\n };\n\n /*\n * ref\n */\n this.get_set_items = function () {\n const params = Array.prototype.slice.call(arguments),\n func = 'get_set_items';\n\n return this.lookupModule().then((serviceStatus) => {\n return jsonRpc.request(serviceStatus.url, module, func, params, 1, options());\n });\n };\n\n /*\n * ref\n */\n this.status = function () {\n const params = Array.prototype.slice.call(arguments),\n func = 'status';\n\n return this.lookupModule().then((serviceStatus) => {\n return jsonRpc.request(serviceStatus.url, module, func, params, 1, options());\n });\n };\n }", "function getData(input) {\n var dynamicApi = currentApi + input + '&appid=' + apiKey;\n fetch(dynamicApi)\n .then(function (response) {\n if (!response.ok) {\n throw response.json();\n };\n return response.json();\n })\n .then(function (data) {\n // console.log(data)\n var weatherIcon = 'http://openweathermap.org/img/w/';\n weatherIcon = weatherIcon + data.weather[0].icon + '.png';\n var temp = data.main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.main.humidity;\n var wind = data.wind.speed;\n var date = moment().format('dddd, MMMM Do YYYY');\n // return a;\n var name = data.name\n // adding the fetch for uv index\n var lat = data.coord.lat.toString();\n var lon = data.coord.lon.toString();\n // console.log(lat,lon)\n // create fetch url\n var needsLat = 'https://api.openweathermap.org/data/2.5/onecall?lat='\n var needsLon = '&lon='\n var end = '&exclude=hourly,daily,minutely,alerts&units=imperial&appid=' + apiKey\n needsLat = needsLat + lat\n needsLon = needsLat + needsLon + lon + end\n fetch(needsLon)\n .then(function (response) {\n if (!response.ok) {\n throw response.json();\n }\n return response.json();\n })\n .then(function (data) {\n // console.log(data)\n var uv = data.current.uvi;\n // console.log(uv)\n var a = makeCard(name, weatherIcon, temp, humid, wind, date, uv);\n makeRow(a)\n var dynamicApi = basicApi + input + '&appid=' + apiKey;\n // var a = getData(input)\n // console.log(a)\n fetch(dynamicApi)\n .then(function (response) {\n if (!response.ok) {\n throw response.json();\n };\n return response.json();\n })\n .then(function (data) {\n // console.log(data)\n var weatherIcon = 'http://openweathermap.org/img/w/';\n // second day\n weatherIcon = weatherIcon + data.list[4].weather[0].icon + '.png';\n var temp = data.list[4].main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.list[4].main.humidity;\n var wind = data.list[4].wind.speed;\n var date = moment(data.list[4].dt_txt).format('dddd, MMMM Do YYYY');\n var b = makeCard(data.city.name, weatherIcon, temp, humid, wind, date);\n // third day\n var weatherIcon = 'http://openweathermap.org/img/w/';\n weatherIcon = weatherIcon + data.list[12].weather[0].icon + '.png';\n var temp = data.list[12].main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.list[12].main.humidity;\n var wind = data.list[12].wind.speed;\n var date = moment(data.list[12].dt_txt).format('dddd, MMMM Do YYYY');\n var c = makeCard(data.city.name, weatherIcon, temp, humid, wind, date);\n // fourth day\n var weatherIcon = 'http://openweathermap.org/img/w/';\n weatherIcon = weatherIcon + data.list[20].weather[0].icon + '.png';\n var temp = data.list[20].main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.list[20].main.humidity;\n var wind = data.list[20].wind.speed;\n var date = moment(data.list[20].dt_txt).format('dddd, MMMM Do YYYY');\n var d = makeCard(data.city.name, weatherIcon, temp, humid, wind, date);\n // fifth day\n var weatherIcon = 'http://openweathermap.org/img/w/';\n weatherIcon = weatherIcon + data.list[28].weather[0].icon + '.png';\n var temp = data.list[28].main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.list[28].main.humidity;\n var wind = data.list[28].wind.speed;\n var date = moment(data.list[28].dt_txt).format('dddd, MMMM Do YYYY');\n var e = makeCard(data.city.name, weatherIcon, temp, humid, wind, date);\n // makeRow(a, b, c, d, e)\n // sixth day\n var weatherIcon = 'http://openweathermap.org/img/w/';\n weatherIcon = weatherIcon + data.list[36].weather[0].icon + '.png';\n var temp = data.list[36].main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.list[36].main.humidity;\n var wind = data.list[36].wind.speed;\n var date = moment(data.list[36].dt_txt).format('dddd, MMMM Do YYYY');\n var f = makeCard(data.city.name, weatherIcon, temp, humid, wind, date);\n makeRow(a, b, c, d, e, f)\n });\n })\n });\n // console.log(a)\n}", "callApi(url, method, dataToSend, authenticator) {\n\n // Get a token\n return authenticator.getCurrentAccessToken()\n .then(token => {\n\n // Call the API\n return HttpClient._callApiWithToken(url, method, dataToSend, token)\n .then (data => {\n \n // Return data if successful\n return Promise.resolve(data);\n })\n .catch (xhr1 => {\n\n // Report erors other than 401\n if (xhr1.status !== 401) {\n let ajaxError = ErrorHandler.ajaxErrorToString(xhr1, url);\n return Promise.reject(ajaxError);\n }\n\n // Get a new token\n return authenticator.getNewAccessToken()\n .then(token => {\n\n // Call the API again\n return HttpClient._callApiWithToken(url, method, dataToSend, token)\n .then(data => {\n \n // Return data if successful\n return Promise.resolve(data);\n })\n .catch(xhr2 => {\n\n // Report erors\n let ajaxError = ErrorHandler.ajaxErrorToString(xhr2, url);\n return Promise.reject(ajaxError);\n });\n });\n });\n });\n }", "function makeAPICall() {\n movieAndDinnerObject.queryURL = createUrl();\n // console.log(movieAndDinnerObject.queryURL);\n\n $.ajax({\n url: movieAndDinnerObject.queryURL,\n method: \"GET\"\n }).then(function (response) {\n buildMovieData(response);\n createTheaters();\n }).fail(function (error) {\n console.log(\"error: \" + error);\n\n });\n }", "function getApiFuture(requestData) {\n var forecastUrl = (\"https://api.openweathermap.org/data/2.5/forecast?lat=\" + requestData.coord.lat + \"&lon=\" + requestData.coord.lon + \"&cnt=50&appid=453aa8aa937d813f343ce451eb44cfc2\")\n fetch(forecastUrl)\n .then((response) => {\n return response.json();\n })\n .then((requestData2) => {\n firstDayForecast(requestData2) // runs first day\n secondDayForecast(requestData2) // runs second day\n thirdDayForecast(requestData2) // runs third day\n fourthDayForecast(requestData2) // runs fourth day\n fifthDayForecast(requestData2) // runs fifth day\n });\n}", "getData(dept, start, end, analyses) {\n\n // Kinda wonky, but otherwise this.updateData is not available from within Promise.all().then()\n const updateData = this.updateData;\n\n let params = {\n dateStart: start,\n dateEnd: end\n };\n\n if (dept !== null) {\n params['department'] = dept;\n }\n\n let qStr = this.buildQString(params);\n\n // reset the api data to empty array\n const apiData = {};\n\n Object.keys(this.state.apiData).forEach((key) => {\n apiData[key] = [];\n });\n\n\n const urlPromises = analyses.map((item) => {\n const url = this.state.apiLinks[item] + '?' + qStr;\n return this.fetchData(url, item);\n });\n\n\n Promise.all(urlPromises)\n .then(function (results) {\n results.forEach((r) => {\n apiData[r.name] = r.data;\n });\n updateData(apiData)\n })\n .catch(function (err) {\n console.log(\"Failed: \", err);\n });\n\n\n }", "function uploadProcessDataAll() {\n\n var inArgs = uploadProcessDataAll.arguments;\n var result = new Result_customFunctionCommon();\n\n var return_value = 0;\n var errorMessage = \"\";\n try {\n var tempOb = parseUploadProcessDataAll(inArgs);\n\n // API integration -----------------------------------------------------\n // ---------------------------------------------------------------------\n\n var stationNr = tempOb.IN_STATION_NUMBER;\n\n tempOb.OUT_MEAS_AR = new Array(16);\n for (var x = 0; x < 16; x++) {\n tempOb.OUT_MEAS_AR[x] = [];\n }\n for (var x = 0; x < tempOb.IN_PROCESS_DATA_AR.length; x++) {\n var info = getParamInfo(tempOb.IN_PROCESS_DATA_AR[x].MEASURE_NAME, tempOb.IN_PROCESS_DATA_AR[x].MEASURE_VALUE);\n if (info.id == -1) {\n //tempOb.OUT_RESULT+= \"\\n All stations : \" + info.param + \" = \" + info.value;\n //tempOb.OUT_MEAS_AR[0].push(new Measure(info.param, \"\", info.value, \"\", \"\", \"\", \"\"));\n for (var y = 0; y < 16; y++) {\n tempOb.OUT_MEAS_AR[y].push(new Measure(info.param, \"\", info.value, \"\", \"\", \"\", \"\"));\n }\n }\n else {\n\n //tempOb.OUT_RESULT+= \"\\n ST# \" + getStationId(stationNr,info.id).station + \" : \" + info.param + \" = \" + info.value;\n tempOb.OUT_MEAS_AR[info.id - 1].push(new Measure(info.param, \"\", info.value, \"\", \"\", \"\", \"\"));\n }\n }\n\n // <mdaGetRecipeData> --------------------------------------------------\n // var partNumber = \"MOB001L\";\n // \n // var recipeFilters = new Array(new KeyValue(\"PART_NUMBER\", partNumber));\n // var recipeResultKeys = new Array(\"MAX_VALUE\",\"MEASURE_NAME\",\"MIN_VALUE\",\"UNIT\");\n // \n // var result_mdaGetRecipeData = imsApiService.mdaGetRecipeData(imsApiSessionContext,\n // station,\n // -1,\n // \"-1\",\n // \"-1\",\n // \"-1\",\n // -1.0,\n // \"-1\",\n // \"T\",\n // 1,\n // recipeFilters,\n // recipeResultKeys);\n //\n // if (result_mdaGetRecipeData.return_value != 0) {\n // var res = imsApiService.imsapiGetErrorText(imsApiSessionContext, return_value);\n // result.errorString = \"uploadProcessData:mdaGetRecipeData|\" + return_value + \"|\" + res.errorString;\n // result.return_value = return_value;\n // return result;\n // }\n\n var TEMP_REIPE_AR = new Array();\n\n // for (var i=0;i<result_mdaGetRecipeData.recipeResultValues.length;i++){\n // var name = result_mdaGetRecipeData.recipeResultValues[i*4+1];\n // var upperlimit = result_mdaGetRecipeData.recipeResultValues[i*4];\n // var lowerlimit = result_mdaGetRecipeData.recipeResultValues[i*4+2];\n // var unit = result_mdaGetRecipeData.recipeResultValues[i*4+3];\n // \n // TEMP_REIPE_AR.push(new Measure(name, \"\", \"\", \"\", lowerlimit, upperlimit, unit));\n // }\n\n\n // this.MEASURE_NAME = name;\n // this.MEASURE_TYPE = type;\n // this.MEASURE_VALUE = value;\n // this.MEASURE_NOMINAL = nominal;\n // this.MEASURE_LOWERLIMIT = lowerlimit;\n // this.MEASURE_UPPERLIMIT = upperlimit;\n // this.MEASURE_UNIT = unit; \n\n // for (var i=0;i<TEMP_REIPE_AR.length;i++){\n // \n // tempOb.OUT_RESULT+=\"\\n\" + TEMP_REIPE_AR[i].MEASURE_NAME + \" *** \" + TEMP_REIPE_AR[i].MEASURE_LOWERLIMIT + \" *** \" + TEMP_REIPE_AR[i].MEASURE_UPPERLIMIT;\n // \n // }\n\n // <trUploadStationResult> ---------------------------------------------\n var stationResultUploadKeys = new Array(\"ERROR_CODE\", \"MEASURE_FAIL_CODE\", \"MEASURE_NAME\", \"MEASURE_VALUE\");\n\n\n for (var x = 0; x < tempOb.OUT_MEAS_AR.length; x++) {\n var stationResultUploadValues = new Array();\n if (x >= 0) tempOb.OUT_RESULT += \"\\n ST# \" + getStationId(stationNr, x + 1).station;\n var station = getStationId(stationNr, x + 1).station;\n for (var y = 0; y < tempOb.OUT_MEAS_AR[x].length; y++) {\n tempOb.OUT_RESULT += \"\\n --> data name: \" + tempOb.OUT_MEAS_AR[x][y].MEASURE_NAME + \" --- value: \" + tempOb.OUT_MEAS_AR[x][y].MEASURE_VALUE;\n stationResultUploadValues.push(0, \"0\", tempOb.OUT_MEAS_AR[x][y].MEASURE_NAME, tempOb.OUT_MEAS_AR[x][y].MEASURE_VALUE);\n }\n\n\n var result_trUploadStationResult = imsApiService.trUploadStationResult(imsApiSessionContext,\n station,\n \"-1\",\n -1,\n \"-1\",\n \"-1\",\n \"-1\",\n -1,\n 1,\n stationResultUploadKeys,\n stationResultUploadValues\n );\n\n var return_value = result_trUploadStationResult.return_value;\n //\n // if (return_value != 0) {\n // var res = imsApiService.imsapiGetErrorText(imsApiSessionContext, return_value);\n // result.errorString = \"uploadProcessData:trUploadStationResult|\" + return_value + \"|\" + res.errorString;\n // result.return_value = return_value;\n // return result;\n // }\n\n }\n // <End call> ----------------------------------------------------------\n\n\n // CF result -----------------------------------------------------------\n // ---------------------------------------------------------------------\n\n logHandler.logMessage(\"custom function OPC.uploadProcessDataAll finished.\");\n return resultUploadProcessDataAll(\"CF\", 0, \"PASS\", tempOb);\n\n } catch (e) {\n logHandler.logMessage(\"custom function OPC.uploadProcessDataAll failed: \" + e);\n result = new Result_customFunctionCommon();\n result.outArgs = new Array();\n result.outArgs = logHandler.getMessages();\n result.return_value = ItacMesErrorCodeApi.SERVER_ERROR.getReturnValue();\n result.errorString = ItacMesErrorCodeApi.SERVER_ERROR.getErrorString();\n return result;\n }\n}", "async function getAPIdata(user_id, page_id, metric, period, start_date = null, end_date = null, media_id = null) {\n const key = await FbToken.findOne({where: {user_id: user_id}});\n let data;\n\n if(start_date) {\n start_date = new Date(start_date)\n }\n\n if(end_date) {\n end_date = new Date(end_date);\n }\n\n try {\n // data = //(start_date && end_date)\n //? await InstagramApi.getInstagramData(page_id, metric, period, key.api_key, new Date(start_date), new Date(end_date), media_id) :\n data = await InstagramApi.getInstagramData(page_id, metric, period, key.api_key, start_date, end_date, media_id);\n\n if(metric === 'online_followers') { //time change compared to the time released by the API Instagram, +9\n data= online_Followers(data);\n }\n\n return data;\n\n } catch (e) {\n console.error(\"Error retrieving Instagram data\");\n }\n\n}", "function apiCall(url, apikey) {\n Logger.log('Attempting an API call to ' + url + '.');\n var APIheaders = {'X-Cisco-Meraki-API-Key': apikey}; //sets headers\n var options = {'contentType':'application/json', 'method':'GET', 'headers':APIheaders, 'muteHttpExceptions':true};\n var response = UrlFetchApp.fetch(url, options); //actual api call\n if (response.getResponseCode() != 200) {\n return SpreadsheetApp.getUi().alert('Something wasn\\'t right.', 'I tried to contact Meraki, but I got a ' + response.getResponseCode() + ' response code. If you got a 404, either your security appliance serial number, API key, organization ID or network ID isn\\'t correct.', SpreadsheetApp.getUi().ButtonSet.OK);\n }\n Logger.log('API call succeeded. Parsing responses.');\n var stringResponse = response.getContentText();\n var jsonResponse = JSON.parse(stringResponse); //parses response as json\n Logger.log('Completed API call to ' + url + '.');\n return {'jsonResponse':jsonResponse, 'stringResponse':stringResponse};\n \n}", "async function GenerateCallList() {\n const markets = (await axios.get('https://mcdex.io/api/markets')).data.data.markets;\n const marketStatus = (await axios.get('https://mcdex.io/api/markets/status')).data.data;\n let id2Info = {};\n _.forEach(markets, market => {\n const id = market.id;\n if (market.contractType === 'Perpetual') {\n id2Info[id] = { perpetualAddress: market.perpetualAddress };\n }\n });\n _.forEach(marketStatus, status => {\n if(status===null){\n return;\n }\n const id = status.marketID;\n if (id2Info[id] && status.perpetualStorage && status.perpetualStorage.collateralTokenAddress !== '0x0000000000000000000000000000000000000000') {\n id2Info[id].collateralTokenAddress = status.perpetualStorage.collateralTokenAddress;\n }\n });\n let calls = []\n _.map(id2Info, (info, id) => {\n if (info.collateralTokenAddress && info.perpetualAddress) {\n calls.push({\n target: info.collateralTokenAddress,\n params: info.perpetualAddress\n })\n }\n });\n return calls;\n}", "function call(parameters) {\n return new Promise(async (resolve, reject) => {\n czr.request.call({\n \"from\": parameters.from ? parameters.from : account,\n \"to\": parameters.to,\n \"data\": parameters.data\n })\n .then(ret => {\n if (ret.code === 0) {\n //console.log('request success =>', ret)\n let response = \"0x\" + ret.output;\n let fnabi = parameters.funABI\n let decres = decode.decodeResponse(response, fnabi);\n let res = []\n for (var key in decres) {\n res.push(decres[key])\n }\n //console.log(res)\n resolve(res)\n } else {\n console.log('request failed =>', ret);\n reject(ret)\n }\n })\n })\n}", "handlePayload(payload) {\n console.log(\"Received Payload:\", `${payload} for ${this.user.psid}`);\n\n // Log CTA event in FBA\n GraphAPi.callFBAEventsAPI(this.user.psid, payload);\n //test\n let response;\n\n // Set the response based on the payload\n if (\n payload === \"GET_STARTED\" ||\n payload === \"DEVDOCS\" ||\n payload === \"GITHUB\"\n ) {\n response = Response.genNuxMessage(this.user);\n } else if (payload.includes(\"CURATION\") || payload.includes(\"COUPON\")) {\n let curation = new Curation(this.user, this.webhookEvent);\n response = curation.handlePayload(payload);\n } else if (payload.includes(\"CARE\")) {\n let care = new Care(this.user, this.webhookEvent);\n response = care.handlePayload(payload);\n } else if (payload.includes(\"ORDER\")) {\n response = Order.handlePayload(payload);\n } else if (payload.includes(\"CSAT\")) {\n response = Survey.handlePayload(payload);\n } else if (payload.includes(\"CHAT-PLUGIN\")) {\n response = [\n Response.genText(i18n.__(\"chat_plugin.prompt\")),\n Response.genText(i18n.__(\"get_started.guidance\")),\n Response.genQuickReply(i18n.__(\"get_started.help\"), [\n {\n title: i18n.__(\"care.order\"),\n payload: \"CARE_ORDER\"\n },\n {\n title: i18n.__(\"care.billing\"),\n payload: \"CARE_BILLING\"\n },\n {\n title: i18n.__(\"care.other\"),\n payload: \"CARE_OTHER\"\n }\n ])\n ];\n } else if (payload.includes(\"complaints_1\")) {\n response = [\n Response.genQuickReply(\n i18n.__(\"complaints1flow.features_confirmation1\"),\n [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_1\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]\n ),\n { complaintType: \"complaints_1\" }\n ];\n } else if (payload.includes(\"complaints_2\")) {\n response = [\n Response.genQuickReply(\n i18n.__(\"complaints2flow.features_confirmation2\"),\n [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_2\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]\n ),\n { complaintType: \"complaints_2\" }\n ];\n } else if (payload.includes(\"complaints_3\")) {\n response = [\n Response.genQuickReply(\n i18n.__(\"complaints3flow.features_confirmation3\"),\n [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_3\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]\n ),\n { complaintType: \"complaints_3\" }\n ];\n } else if (payload.includes(\"complaints_4\")) {\n response = [\n Response.genQuickReply(\n i18n.__(\"complaints4flow.features_confirmation4\"),\n [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_4\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]\n ),\n { complaintType: \"complaints_4\" }\n ];\n } else if (payload.includes(\"yes_1\")) {\n let confirm = Response.genText(i18n.__(\"fallback.correct_option\"));\n let name = Response.genText(i18n.__(\"get_started.input_name\"));\n\n let payloadData = {\n payload: \"yes_1\",\n user: this.user.psid\n };\n response = [confirm, payloadData, name];\n } else if (payload.includes(\"yes_2\")) {\n let confirm = Response.genText(i18n.__(\"fallback.correct_option\"));\n let name = Response.genText(i18n.__(\"get_started.input_name\"));\n\n let payloadData = {\n payload: \"yes_2\",\n user: this.user.psid\n };\n response = [confirm, payloadData, name];\n } else if (payload.includes(\"yes_3\")) {\n let confirm = Response.genText(i18n.__(\"fallback.correct_option\"));\n let name = Response.genText(i18n.__(\"get_started.input_name\"));\n\n let payloadData = {\n payload: \"yes_3\",\n user: this.user.psid\n };\n response = [confirm, payloadData, name];\n } else if (payload.includes(\"yes_4\")) {\n let confirm = Response.genText(i18n.__(\"fallback.correct_option\"));\n let name = Response.genText(i18n.__(\"get_started.input_name\"));\n\n let payloadData = {\n payload: \"yes_4\",\n user: this.user.psid\n };\n response = [confirm, payloadData, name];\n } else if (payload.includes(\"no\")) {\n let firstResponse = Response.genQuickReply(\n i18n.__(\"get_started.input_select\"),\n [\n {\n title: i18n.__(\"menu.complaints_1\"),\n payload: \"complaints_1\"\n },\n {\n title: i18n.__(\"menu.complaints_2\"),\n payload: \"complaints_2\"\n },\n {\n title: i18n.__(\"menu.complaints_3\"),\n payload: \"complaints_3\"\n },\n {\n title: i18n.__(\"menu.complaints_4\"),\n payload: \"complaints_4\"\n }\n ]\n );\n let mypayload = {\n payload: \"mygreetings\"\n };\n response = [firstResponse, mypayload];\n } else if (payload.includes(\"deny_confirmation\")) {\n let first = Response.genText(i18n.__(\"get_started.input_name\"));\n let payloadSecond = {\n payload: \"deny_confirmation\",\n user: this.user.psid\n };\n response = [first, payloadSecond];\n } else if (payload.includes(\"yes_confirmation\")) {\n let first = Response.genText(i18n.__(\"fallback.when\"));\n let payloadSecond = {\n payload: \"yes_confirmation\",\n user: this.user.psid\n };\n response = [first, payloadSecond];\n } else if (payload.includes(\"decline_evidence\")) {\n console.log(\"Asignando codigo a mensaje\");\n console.log(this.user.idreport);\n let first = Response.genText(i18n.__(\"fallback.dontworry\"));\n console.log(\"first\");\n console.log(first);\n let second = Response.genText(i18n.__(\"fallback.pdfpath\"));\n let third = Response.genGenericTemplate(\n `${config.appUrl}/logo_chappy_police.png`,\n i18n.__(\"titles.title_en\"),\n this.user.idreport,\n [\n Response.genWebUrlButton(\n i18n.__(\"titles.download_here\"),\n `${config.botUrl}/${this.user.idDocument}.pdf`\n )\n ]\n );\n console.log(\"IMPRIMIENDO URL:\");\n console.log(`${config.botUrl}/${this.user.idDocument}.pdf`);\n\n let forth = Response.genText(i18n.__(\"fallback.finish2\"));\n let fifth = { payload: \"finish\" };\n response = [first, second, third, forth, fifth];\n } else if (payload.includes(\"accept_evidence\")) {\n let first = Response.genText(i18n.__(\"fallback.evidence_input\"));\n response = [first];\n }\n\n //yes_confirmation\n else {\n response = {\n text: `This is a default postback message for payload: ${payload}!`\n };\n }\n return response;\n }", "function makeApiRequest (weatherUrl) {\n\n\n fetch(weatherUrl) //fetches the data from the url\n .then(function(res) {\n\n\n if(res.ok){ //if the response of the api server is fine then it continues as normal. If not it returns an error asking for a valid location\n res.json()\n .then(function(weatherData) {\n // console.log(weatherData); //shows lat/lon\n \n //We assign the lattitude and longitude of the location chosen by the user into the \"lat\" and \"lon\" variables. This is so we can use the values in our planet API\n lon = weatherData.city.coord.lon\n lat = weatherData.city.coord.lat\n \n //this code adds weather data from the API to the the elements in our html\n weatherConditionEL.innerText = weatherData.list[0].weather[0].main\n weatherTempEL.innerText = weatherData.list[0].main.temp\n var weatherIconCode = weatherData.list[0].weather[0].icon //here we make a variable and set it to have the icon code of the current weather\n var iconMainUrl = \"http://openweathermap.org/img/w/\" + weatherIconCode + \".png\"; //we then make a url using the icon code that we get from the previous variable\n weatherIconEL.src = iconMainUrl //finally we assign the url to the src of our weather icon html element \n \n //finally we unhide the weather elements so that the user can see them\n weatherTempDivEL.classList.remove('invisible') \n weatherConditionDivEL.classList.remove('invisible')\n weatherIconEL.classList.remove('hidden')\n\n //this code takes the city name of our weather data and assigns it to the inner text of yourCity. This means in the weather div it will show the user the location they are viewing for\n yourCity.innerText = weatherData.city.name\n \n })\n .then(function() {\n \n var endpointPlanets = `https://visible-planets-api.herokuapp.com/v2?latitude=${lat}&longitude=${lon}&showCoords=true` //gets a new URL and assigns it to the variable endpointPlanets. The URL changes based on the lat and lon\n \n return fetch(endpointPlanets) //we then fetch this URL\n })\n .then(function (res) {\n \n return res.json(); //the URL gets turned into an object\n })\n \n .then(function (apiPlanetData){\n \n //console.log(apiPlanetData); //shows planets\n buildCards(apiPlanetData) //runs the buildCards function, this should create the planet data cards\n })\n } else { //this runs only if the api response returns and invalid response. It hides the weather data and returns an error message\n errorBoxEl.textContent = \"Please Enter A Valid Location\"\n\n //hide our weather data.\n weatherTempDivEL.classList.add('invisible')\n weatherConditionDivEL.classList.add('invisible')\n weatherIconEL.classList.add('hidden')\n }\n \n }) \n}", "init() {\n\t\tthis.replaceData(\n\t\t\tthis.manager.get(\"noReq\"),\n\t\t\tthis.endpoints.get,\n\t\t\tthis.data.get\n\t\t);\n\t}", "function randomHTTPRequest (input1, input2) {\n\tconsole.log('Request Number: ' + input1.toString());\n\tconst URL = API_URL + '?' + FIRST_PARAM + input1.toString() + '&' + SECOND_PARAM + input2.toString();\n\trequest(URL, function (error, response, body) {\n\t\t\tconsole.log(body);\n\t\t});\n}", "function processOurAPI(req, res) {\n var query = require('url').parse(req.url,true).query;\n\n //\n // when we set a new test value, we clear all other\n // leftover flags! this makes sure that we get a fresh start\n //\n pendingActions = [];\n\n for (var property in query) {\n if (Object.keys(actionTable).indexOf(property) < 0) {\n res.writeHead(400, {\n 'Content-Type': 'text/plain'\n });\n\n res.end(property + ' is not a valid action');\n return;\n }\n\n if (isNaN(query[property]) || query[property] < 1 || query[property] > 10000) {\n res.writeHead(400, {\n 'Content-Type': 'text/plain'\n });\n\n res.end(property + '=' + query[property] + ' is a valid value');\n return;\n }\n\n // add the action to the pending fifo\n pendingActions.push({count : Math.floor(query[property]),\n callback : actionTable[property]});\n }\n\n res.writeHead(200, {\n 'Content-Type': 'application/json'\n });\n\n res.end(JSON.stringify(pendingActions));\n}" ]
[ "0.6548261", "0.6535708", "0.6330252", "0.6303298", "0.6296454", "0.62641484", "0.62635267", "0.62635267", "0.6184757", "0.60557735", "0.60394436", "0.600515", "0.59792894", "0.5976754", "0.59549093", "0.59110314", "0.59055734", "0.5904499", "0.5901554", "0.5811214", "0.57814777", "0.57788676", "0.5775308", "0.5771154", "0.5767411", "0.57654387", "0.57619846", "0.5759023", "0.5757343", "0.57477623", "0.5736237", "0.57210904", "0.56880176", "0.56695133", "0.5642868", "0.5641002", "0.56399435", "0.563909", "0.5625766", "0.56255", "0.56238186", "0.5623011", "0.5620037", "0.56174386", "0.5610043", "0.5606354", "0.56040144", "0.55927235", "0.5581434", "0.5573268", "0.5570704", "0.55677724", "0.5562169", "0.5553011", "0.55442995", "0.5543458", "0.5539625", "0.553429", "0.55316836", "0.5523255", "0.55232316", "0.55204535", "0.5518889", "0.5512404", "0.5510136", "0.549078", "0.5482183", "0.5482066", "0.5480762", "0.5472125", "0.54699725", "0.5460902", "0.54585135", "0.54583305", "0.5453949", "0.54509914", "0.54505754", "0.5446242", "0.5444985", "0.5441885", "0.54379076", "0.5432122", "0.5426799", "0.54265785", "0.542034", "0.54180264", "0.5414507", "0.54077566", "0.54028845", "0.53951854", "0.53943413", "0.53935397", "0.53906417", "0.53834176", "0.53779835", "0.53772986", "0.53726095", "0.5365611", "0.5358468", "0.5351583" ]
0.5732477
31
THIS save FUNCTION IS WORKING AND SAVES VALUES ADDED TO THE INPUT BOX TO THE LOCAL STORAGE
function saveRecents() { // // saves entire Object to local storage localStorage.setItem('Recent Cities', JSON.stringify(recentSearches)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function savingInLocalStorage() {\n\n\n //1.get all the calaculated data from the BudgetController:\n let sendDataToLocalStorage = budgetCtrl.getAllData();\n\n //2.send data to UIcontroller for storing it in local storage:\n document.querySelector(DOMClassNames.savingData).addEventListener('click', () => {\n\n //update the data to be sent:\n if (input && input.description !== '' && !isNaN(input.value) && input.value > 0) {\n\n sendDataToLocalStorage.total_income = budget.totalInc;\n sendDataToLocalStorage.total_expenditure = budget.totalExp\n sendDataToLocalStorage.final_budget = budget.budget;\n sendDataToLocalStorage.percentage = budget.percentage;\n\n UIctrl.saving(sendDataToLocalStorage);\n }\n })\n\n }", "function save()\r\n{\r\n var rows = document.getElementById(\"rows\").value;\r\n var cols = document.getElementById(\"cols\").value;\r\n var algoSelect = document.getElementById(\"algoSelect\").value;\r\n\r\n localStorage.rows = rows;\r\n localStorage.cols = cols;\r\n localStorage.algoSelect = algoSelect;\r\n}", "function save(onSaved) {\n\t\t// store as an object\n\t\tvar store = {};\n\n\t\t//required inputs\n\t\tif (!birthDateInput.value || !lifeInput.value) {\n\t\t\treturn;\n\t\t}\n\n\t\tstore[STORAGE_BIRTH_NAME] = birthDateInput.value;\n\t\tstore[STORAGE_LIFE_NAME] = parseInt(lifeInput.value);\n\t\tstore[STORAGE_FASTCOUNT_NAME] = fastCountInput.checked;\n\t\tstore[STORAGE_COLORS_NAME] = [backColInput.value, textColInput.value, numColInput.value];\n\n\t\t//CALLBACK TO FINISH UP\n\t\tchrome.storage.sync.set({data: store}, onSaved);\n\t}", "function save(){\n\t\tvar y =$(this).attr(\"id\");\n\t\tvar g= JSON.stringify(y);\n\t\tlocalStorage.setItem(y, $(this).val()); // localStorage.setItem(\"lastname\", \"Smith\"); localStorage.getItem(\"lastname\");\n\t}", "function saveData() {\n\t\tif(!key){\n\t\t\tvar id \t\t\t\t\t\t= Math.floor(Math.random()*1000001);\n\t\t}else{\n\t\t\tid = key;\n\t\t}\n\t\t\n\t\tgetRadioValue ();\n\t\tgetCheckbox();\n\t\tvar item\t\t\t\t\t\t= {};\n\t\t\t item.kname\t\t\t\t= [\"Kid's Name:\", $(\"kname\").value];\n\t\t\t item.pname\t\t\t\t= [\"Parent's Name:\", $(\"pname\").value];\n\t\t\t item.phone\t\t\t\t= [\"Phone #:\", $(\"phone\").value];\n\t\t\t item.email\t\t\t\t= [\"Email:\", $(\"email\").value];\n\t\t\t item.date\t\t\t\t= [\"Play Date:\", $(\"date\").value];\n\t\t\t item.sex\t\t\t\t= [\"Sex:\", sexValue];\n\t\t\t item.choice\t\t\t= [\"Best Time of Week:\", $(\"choice\").value];\n\t\t\t item.select\t\t\t= [\"Best Time of Day:\", $(\"dayTimes\").value];\n\t\t\t item.allergies\t\t= [\"Needs:\", hasAllergy];\n\t\t\t item.comments\t\t\t= [\"Notes:\", $(\"comments\").value];\n\t\t\t item.outgoing\t\t\t= [\"How Outgoing? 1-10:\", $(\"outgoing\").value];\n\t\tlocalStorage.setItem(id, JSON.stringify(item));\n\t\talert(\"Saved!\");\n\t}", "function saveInput() {\n\t$(\"button\").on(\"click\", function () {\n\t\tevent.preventDefault(event);\n\t\tvar button = $(this);\n\n\t\tlocalStorage.setItem(\n\t\t\tbutton[0].form.nextElementSibling.dataset.value,\n\t\t\tbutton[0].form[0].value\n\t\t);\n\t});\n}", "function saveData(key) {\n\t\t// Set Random Key for Stored Data //\n\t\tif(!key) {\n\t\t\tvar id = Math.floor(Math.random()*10001);\n\t\t}else{\n\t\t\tid = key;\n\t\t}\n\t\t// Call Functions //\n\t\tgetCheckboxValue();\n\t\tgetSelectedRadio();\n\t\tvar item \t\t\t\t= {};\n\t\t\titem.training \t\t= [\"Training Style: \", $('#training').value];\n\t\t\titem.wname\t\t\t= [\"Workout Name: \", $('#wname').value];\n\t\t\titem.favorite\t\t= [\"Favorite: \", favoriteValue];\n\t\t\titem.howlong\t\t= [\"How Long: \", $('#howlong').value + \" minutes\"];\n\t\t\titem.timeofday\t\t= [\"Preferred Time: \", timeValue];\n\t\t\titem.completiondate\t= [\"Completion Date: \", $('#completiondate').value];\n\t\t\titem.comments\t\t= [\"Self-Motivation: \", $('#comments').value];\n\t\t\t\n\t\t// Save Data into Local Storage with JSON.stringify //\n\t\tlocalStorage.setItem(id, JSON.stringify(item));\n\t\talert(\"Workout Saved!\");//\n\t\t// Set dialog using Dialog //\n\t\t//$('#dialog').attr(\"title\", \"Saved!\").text(\"Your workout has been saved.\").dialog('open');\n\t}", "function save(e) {\n var node = e.target;\n if (node.nodeName === 'INPUT' && node.checked) {\n localStorage[node.name] = node.value;\n }\n else if (node.nodeName === 'SELECT') {\n localStorage[node.name] = node.value;\n }\n }", "function save() {\n //get all metadata entered by the user\n type = $(\"#type\")[0].value;\n material1 = $(\"#mat1\")[0].innerText;\n material2 = $(\"#mat2\")[0].innerText;\n description = $(\"#desc\")[0].value;\n newton = $(\"#newton\")[0].value;\n curve = JSON.stringify(processedData);\n //use jQuerys ajax request to post all data to a php script\n $.post(\"./php_helper/savedata.php\", {\n type: type,\n material1: material1,\n material2: material2,\n description: description,\n newton: newton,\n curve: curve\n }, function (data) {\n showPopup(\"save_success\");\n }).fail(function () {\n showPopup(\"save_fail\")\n });\n}", "saveData() {\n if (this.s.unavailable()) {\n return;\n }\n\n for (const val of this.dispField.items) {\n this.s.set(val, this.dispField.checked(val));\n }\n\n this.s.set(\"unit\", this.unitField.get());\n this.s.set(\"format\", this.formatField.get());\n this.s.set(\"sort\", this.sortableField.toArray());\n }", "function savesaveInfoLocalStorage(evt){\n saveInfoLocalStorage[evt.currentTarget.name] = evt.currentTarget.value;\n setsaveInfoLocalStorage(saveInfoLocalStorage);\n}", "function save_options() {\n\n forEachField(function(id){\n localStorage[id] = $('#' + id).val();\n });\n\n $(\"#save_text\").html('Saving...').fadeIn(300);\n\n F.getCode(function(){\n $(\"#save_text\").html('Saved').fadeOut(2000);\n });\n}", "function saveData(){\n var id = Math.floor((Math.random()*10000000)+1); \n //gather all form field values and store them in an object\n //Object properties contain array with the form label and input values\n getSelectedRadio();\n var item = {}\n item.name = [\"Item Name:\", $('item-name').value];\n item.brand = [\"Item Brand:\", $('item-brand').value];\n item.quantity = [\"Quantity:\", $('quantity').value];\n item.cost = [\"Total Cost:\", $('total-cost').value];\n item.date = [\"Pledge Date:\", $('pledge').value];\n item.priority = [\"Priority:\", priorityValue];\n item.timeFrame = [\"Time Frame:\", $('time').value];\n item.amountSaved = [\"Amount Saved:\", $('amount').value];\n item.motivation = [\"Motivation:\", $('motivation').value];\n item.space = [\"<br>\", \"<br>\"];\n \n //save data into local storage: Using Stringify to convert our object into a string\n localStorage.setItem(id, JSON.stringify(item));\n alert(\"Saved!\");\n }", "function savedData() {\n var i1 = localStorage.getItem('inputText1');\n inOutText1.text(i1);\n var i2 = localStorage.getItem('inputText2');\n inOutText2.text(i2);\n var i3 = localStorage.getItem('inputText3');\n inOutText3.text(i3);\n var i4 = localStorage.getItem('inputText4');\n inOutText4.text(i4);\n var i5 = localStorage.getItem('inputText5');\n inOutText5.text(i5);\n var i6 = localStorage.getItem('inputText6');\n inOutText6.text(i6);\n var i7 = localStorage.getItem('inputText7');\n inOutText7.text(i7);\n var i8 = localStorage.getItem('inputText8');\n inOutText8.text(i8);\n var i9 = localStorage.getItem('inputText9');\n inOutText9.text(i9);\n $('#clear').on(\"click\", function () {\n localStorage.clear();\n });\n\n }", "function saveManageBusinessFields() {\n // Save business details in local Storage\n var businessName = document.getElementById('businessName').value;\n if (businessName != null) {\n localStorage.setItem('businessName', businessName);\n }\n\n var businessPhone = document.getElementById('businessPhone').value;\n if (businessPhone != null) {\n localStorage.setItem('businessPhone', businessPhone);\n }\n\n var businessAddress = document.getElementById('set-address').value;\n if (businessAddress != null) {\n localStorage.setItem('businessAddress', businessAddress);\n }\n}", "save () { if (this.name) saveValue(this.name, this.items); }", "function saveAction(){\n\t\tvar data = getInput();\n\t\tif(data.id == \"\") {\n\t\t\t// delete the id property as it's\n\t\t\t// automatically set by database.\n\t\t\tdelete data.id;\n\t\t\tupdateDB(\"add\", data);\n\t\t}\n\t\telse {\n\t\t\tdata.id = Number(data.id);\n\t\t\tupdateDB(\"edit\", data);\n\t\t}\n\t\tclearInput();\n\t}", "function saveFormInput() {\n var nameInput = $('name').value;\n var keyInput = $('key').value;\n var actionInput = $('action').value;\n\n // validation\n if (!nameInput) {\n showAlert('Name cannot be empty!', 'warning');\n return;\n }\n\n if (!keyInput) {\n showAlert('Key cannot be empty!', 'warning');\n return;\n }\n\n if (!actionInput) {\n showAlert('Action cannot be empty!', 'warning');\n return;\n }\n\n // Everything is saved in local storage as a JSON object\n saveToLocalStorage(nameInput, keyInput, actionInput);\n}", "function testsave()\n{\n var neco = $('#testInput').val();\n console.log(neco);\n window.localStorage.setItem(\"key\", neco );\n}", "function saveLocalStore(){\n for(i = 0; i < generalInfo.length; i++){\n var displayNow = ($(\"#inputEvent\"+generalInfo[i].display).val());\n var notesNow = generalInfo[i].notes;\n generalInfo[i].notes = displayNow;\n console.log(\"grabo vacio\");\n\n }\n localStorage.setItem(\"generalInfo\", JSON.stringify(generalInfo));\n }", "function saveLocalStorage() {\n localStorage['mainText'] = text_area.value;\n localStorage['excText'] = excludeWord.value;\n localStorage['percentReplacement'] = percentReplSlider.value;\n localStorage['excludePronouns'] = chkPronouns.checked;\n localStorage['excludeHyphenated'] = chkHyphens.checked;\n localStorage['excludeConjunctions'] = chkConjunctions.checked;\n localStorage['currReplacement'] = currReplacement;\n localStorage['chkMultiWord'] = chkMultiWord.checked;\n localStorage['chkNoRepeat'] = chkNoRepeat.checked;\n}", "function saveData(id) {\n \n var userInput = $(\"#\"+id).val();\n localStorage.setItem(id, userInput); \n}", "function save() {\n if (confirm('Are you sure you want to save the recording?')){\n let name = prompt('Enter a name of your recording')\n if (localStorage.getItem(name)== null) {\n document.getElementById('recordinglist').add(new Option(name));\n localStorage.setItem(name, sessionStorage.getItem('recording'));\n head = null;\n tail = null;\n sessionStorage.removeItem('recording');\n } else {alert('The name you entered already exists. Please try again and enter a different name.')}\n }\n }", "function save_data() {\n var name = document.getElementById(\"getInfo\")[0].value;\n var lastName = document.getElementById(\"getInfo\")[1].value;\n \n localStorage.setItem(\"name\", name);\n localStorage.setItem(\"lastName\", lastName);\n}", "function saveData(ranKey) {\n //random key number\n //console.log(\"save it enter\");\n if(!ranKey){\n var id = Math.floor(Math.random()*120211);\n }else{\n id = ranKey;\n }\n getCheckbox();\n getRadio();\n var field={};\n\n field.title=[\"Book Title\", $(\"Title\").value];\n field.date=[\"Date Added:\", $(\"date\").value];\n field.booknumber=[\"Issue Number\", $(\"booknumber\").value];\n field.coverstyle=[\"Cover Style\", styleValue];\n field.read=[\"Read\", readValue];\n field.notes=[\"Notes\", $(\"Notes\").value];\n field.grade=[\"CCG Grading\", $(\"slider\").value];\n\n //Function to convert data into strings (stringify)\n\n localStorage.setItem(id, JSON.stringify(field));\n alert(\"Book Saved\");\n }", "function saveStorage() {\n $('textarea').each(function () {\n let val = $(this).val();\n let id = $(this).attr(\"id\");\n localStorage.setItem(id, val);\n });\n }", "function actuallySave() {\n var inputs = document.getElementsByTagName('input');\n var data = {\n details: details\n };\n var isDefault = true;\n for(var i = 0; i < inputs.length; ++i) {\n if(inputs[i].type == 'checkbox') {\n data[inputs[i].id] = inputs[i].checked;\n if(isDefault && inputs[i].checked != (DEFAULT_FALSE.indexOf(inputs[i].id) === -1)) {\n isDefault = false;\n }\n }\n else {\n data[inputs[i].id] = inputs[i].value;\n if(isDefault && inputs[i].value) {\n isDefault = false;\n }\n }\n }\n twitch.configuration.set('broadcaster', CONFIG_VERSION, JSON.stringify(data));\n document.getElementById(\"reset\").disabled = isDefault;\n if(saveCallTimeout) {\n clearTimeout(saveCallTimeout);\n }\n saveCallTimeout = undefined;\n hideUnsaved();\n }", "function save() {\n $editors.find('.text').each(function () {\n $(this).closest('.fields').find('textarea').val(this.innerHTML);\n });\n }", "function editSave() {\n if (document.getElementById('edit_input').value == \"\") {\n DOM.Modal.Close('edit_modal');\n State.Reset();\n return;\n }\n // check whether we're editing or adding\n if (State.Adding.Get()) {\n // the temporary array is necessary, otherwise the array can't be read/written properly\n var tempTracks = [];\n var desiredLocation;\n // determine the array index where the track should be stored\n if (State.Adding.Above.Get()) {desiredLocation = State.Editing.Get()-1}\n if (State.Adding.Below.Get()) {desiredLocation = State.Editing.Get()}\n // if neither add above or add below is specified, it will simply be appended\n if(!State.Adding.Above.Get() && !State.Adding.Below.Get()) {desiredLocation = Data.Tracks.length}\n // iterate through the tracks array\n // shift all entries after the desired location down by one\n for (let i = 0; i < Data.Tracks.length; i++) {\n if (i >= desiredLocation) {\n tempTracks[i+1] = Data.Tracks[i];\n }\n // keep all entries before the desired location\n else {tempTracks[i] = Data.Tracks[i];}\n }\n // assign the added track to the \"now free\" index\n tempTracks[desiredLocation] = document.getElementById('edit_input').value;\n // apply the temporary array\n Data.Tracks = tempTracks;\n }\n // apply the edited value to the original value in the array\n else {\n Data.Tracks[State.Editing.Get()-1] = document.getElementById('edit_input').value;\n }\n // close the modal and reset all the flags\n DOM.Modal.Close('edit_modal');\n State.Reset();\n // refresh the UI\n DOM.UI.Update();\n}", "function setSave(e) {\n e.preventDefault();\n character.savingThrowModifier.strength = document.getElementById('strSave').value;\n character.savingThrowModifier.dexterity = document.getElementById('dexSave').value;\n character.savingThrowModifier.constitution = document.getElementById('conSave').value;\n character.savingThrowModifier.intelligence = document.getElementById('intSave').value;\n character.savingThrowModifier.wisdom = document.getElementById('wisSave').value;\n character.savingThrowModifier.charisma = document.getElementById('chaSave').value;\n}", "function saveTransfer() {\n retrieveValues();\n saveToServer();\n}", "function saveText(event) {\n var saved = ( $(this).parent().children().eq(1) ).val();\n //console.log(saved);\n var index = $(this).parent().children().eq(1).attr(\"index\");\n //console.log(index);\n textStorage[index] = saved;\n \n $(this).parent().children().eq(2).attr(\"class\", \"saveBtn\");\n $(this).parent().children().eq(2).children().attr(\"class\", \"fas fa-save\");\n //console.log(save);\n //console.log(textStorage);\n localStorage.setItem(\"hour_planner\", JSON.stringify(textStorage));\n}", "function storeData() {\n\t// This is a little bit of future proofing \n\tif (!submit.key) {\n\t\t// if there is no key, this is a new item and needs a new key\n\t\tvar id = \"ubuVers\" + Math.floor(Math.random()*10000001);\n\t} else {\n\t\t// set the id to the existing key we are editing\n\t\tid = submit.key;\n\t};\n\t\n // I like to give all my form elements their own id's to give myself access\n\t// outside of the form as well as simple access inside of it\n var ubuVersNumValue = ge('ubuVersNum').value,\n ubuVersNameValue = ge('ubuVersName').value,\n\t\tubuVersDict = {version: ubuVersNumValue, release: ubuVersNameValue};\n\t// log out those values as a double check\n console.log(ubuVersNumValue);\n console.log(ubuVersNameValue);\t\n\t\n\t// set the item in localstorage\n\t// note the stringify function\n\tlocalStorage.setItem(id, JSON.stringify(ubuVersDict));\n\t\n\t// log out the whole local storage\n\tconsole.log(localStorage);\n\tge('submit').value = 'Add';\n\n\n}", "function saveData(event) {\n let divId = ($(event.target).parent().attr('id'));\n let newNote = ($(event.target).siblings('textarea').val())\n\n // checking that box contains string\n if ($(event.target).siblings('textarea').val()) {\n\n let existingNote = noteArray.find(function (note) {\n return note.id === divId;\n });\n if (existingNote) {\n existingNote.note = newNote;\n } else {\n noteArray.push({\n id: divId,\n note: newNote,\n })\n }\n localStorage.setItem('dayNotes', JSON.stringify(noteArray));\n save.text(\"Saved to Local Storage\");\n setTimeout(function () {\n save.text(\"\");\n }, 2000)\n }\n}", "function save(){\n\t//saves score from score array in local storage\n\tvar pointsResult = score.reduce((a, b) => a + b, 0);\n\tlocalStorage.setItem(\"points\", pointsResult);\n\t//saves values of questions in assigned local storage\n\t//before saving transforms array elements into JSON\n\t//local storage can store only strings\n\tlocalStorage.setItem(\"qAccSave\",JSON.stringify(qAccepted));\n\tlocalStorage.setItem(\"qRejSave\",JSON.stringify(qRejected));\n}", "function save() {\r\n\t\tvar str = myDiagram.model.toJson();\r\n\t\tdocument.getElementById(\"mySavedModel\").value = str;\r\n\t }", "function nineAmSaveBtnClick(e) {\n\te.preventDefault;\n\tlocalStorage.setItem(\"nineAm\", nineAm.value);\n}", "function saveResponses () { \t\n localStorage.setItem(\"name\", nameField.value); \t\n localStorage.setItem(\"email\", emailField.value); \t\n localStorage.setItem(\"feedback\", feedbackField.value); \n}", "function save() {\r\n\t\tvar date = new Date(),\r\n\t\t\tall = $('.cell'),\r\n\t\t\tsaveboard = [],\r\n\t\t\tcondition;\r\n\t\t\r\n\t\t// saves current state of board\r\n\t\tfor (var i = 0; i < TOTALCELLS; i++) {\r\n\t\t\tsaveboard[i] = ($(all[i]).hasClass('clicked')) ? 'c' : $(all[i]).text();\r\n\t\t}\r\n\t\r\n\t\tif (messageDiv.hasClass('loseMessage')) {\r\n\t\t\tcondition = 'l';\r\n\t\t} else if (messageDiv.hasClass('winMessage')) {\r\n\t\t\tcondition = 'w';\r\n\t\t}\r\n\r\n\t\tvar value = { \r\n size: SIZE,\r\n condition: condition,\r\n time: time,\r\n clicks: clicks,\r\n board: saveboard,\r\n cells: cells,\r\n minecells: minecells\r\n };\r\n\t\t\r\n\t\tlocalStorage.setItem(STORAGE_NAME, JSON.stringify(value));\r\n\t\tloadButton.removeClass('noload');\r\n\t\tmessageDiv.removeClass().addClass('notice').html('saved!');\r\n\t}", "save () {\n\n // Validate\n if (this.checkValidity()) {\n\n // Collect input\n this.info.item = this.collectInput();\n\n // Show modal\n this.modal.show();\n }\n }", "function saveInformation () {\n\t\t numOfCreditFun();\n\t\t bestMthContFun();\n\t\t var info = {};\n\t\t \tinfo.major = [\"Major Choice:\", $('#departments').val()];\n\t\t info.cName = [\"Course Name:\", $('#courseName').val()];\n\t\t info.cSection = [\"Course Section:\", $('#courseSection').val()];\n\t\t info.topicAndSec = [\"Topic and Section:\", $('#topicAndSection').val()];\n\t\t info.todaysDate = [\"Today's Date:\", $('#todaysDate').val];\n\t\t info.dueDate = [\"Due Date:\", $('#dueDate').val()];\n\t\t info.weeksOfClass = [\"Is the Class on Campus or Online:\", $('#weeksOfClass').val()];\n\t\t info.slideValue = [\"Due Date:\", $('#weeksOfClass').val()];\n\t\t info.courseNumCredits = [\"Number of Credits:\", numOfCreditFun];\n\t\t info.teacherName = [\"Teacher Name:\", $('#teacherName').val()];\n\t\t info.teacherEmail = [\"Teacher Email:\", $('#teacherEmail').val()];\n\t\t info.teacherPhone = [\"Teacher Phone:\", $('#teacherPhone').val()];\n\t\t info.bestMthCont = [\"Best Method To Get In Contact:\", bestMthContFun];\n\t\t info.note = [\"Note Section:\", $('#noteSection').val()];\n\t\t //localStorage.setItem(id, JSON.stringify(info));\n\t\t couchDBSave(info);\n\t\t}", "function write() {\n var store = {};\n\n // store inputs\n var inputs = document.querySelectorAll('input');\n for(var i=0;i<inputs.length;i++) {\n var val,\n key = inputs[i].name;\n\n switch (inputs[i].type) {\n case 'checkbox':\n val = inputs[i].checked ? inputs[i].value : '';\n break;\n default:\n val = inputs[i].value;\n break;\n }\n\n store[key] = val;\n }\n\n // cast\n store.debug = Boolean(store.debug);\n\n chrome.storage.local.set({'pwa': store}, function() {\n flash('Options Saved');\n });\n}", "function saveChanges() {\n\n \n //First, create an object that contains all the old data.\n //Each data value is uniquely referenced by an integer i.\n chrome.storage.local.get(function(dataObject) { \n \n \n //An index that acts as the key to the object's values.\n var i;\n \n \n //Let the object's keys be incrementing integers. Let dataObject[0] store the \n //first unused key. If the storage is currently empty, dataObject[0] is set to 1: \n if (!dataObject[0]) {\n \n dataObject[0] = 1;\n }\n \n //Proceed to add the 2 new values to the end of the array-like object.\n i = dataObject[0];\n dataObject[i] = document.getElementById(\"area\").value;\n dataObject[i+1] = document.getElementById(\"area2\").value;\n \n //Update the record of the number that's the first free key.\n dataObject[0] = i + 2;\n\n \n //Check that the data box isn't blank.\n if (!dataObject[i] || !dataObject[i+1]) {\n alert('Error: Enter text in both boxes.');\n return;\n }\n \n //Store dataObject. No callback function is needed here.\n chrome.storage.local.set(dataObject);\n });\n}", "function Save_Data()\n{\n //handles setting profile's variable to entered name\n let tempName = name.value;\n if(tempName != \"\")\n {\n profile.name = tempName;\n }\n\n //sets profile's age to entered age\n let tempAge = Number(age.value);\n if ((tempAge != 0) && (tempAge != NaN))\n {\n profile.age = tempAge;\n }\n\n //sets profile's pet name to entered name\n let tempPetName = petName.value;\n if (tempName != \"\")\n {\n profile.petName = tempPetName;\n }\n\n //sets profile's favorite color to entered color\n let tempFavCol = favoriteColor.value;\n if (tempName != \"\")\n {\n profile.favoriteColor = tempFavCol;\n }\n\n //sets profile's favorite food to entered food\n let tempFavFood = favoriteFood.value;\n if (tempName != \"\")\n {\n profile.favoriteFood = tempFavFood;\n }\n\n //turns the profile object into json tet format and is displayed onto the page\n let json = JSON.stringify(profile);\n storage.textContent = json;\n}", "function save_options() {\n $('#options-list input[type=\"checkbox\"]').each(function() {\n var obj = {};\n var check = $(this);\n obj[$(this).attr('id')] = $(this).prop(\"checked\");\n\n chrome.storage.sync.set(obj);\n console.log('saving', obj);\n });\n $('#options-list input[type=\"text\"]').each(function() {\n var obj = {};\n var value = $(this).val();\n obj[$(this).attr('id')] = value;\n chrome.storage.sync.set(obj);\n console.log('saving', obj);\n });\n\n $('#status').text(\"Saved\").slideDown();\n setTimeout(function() {\n $('#status').slideUp(function() {\n $(this).text(\"\");\n })\n }, 3000);\n}", "function save() {\n if (document.getElementById('workSettings').value < 1) {\n alert(usePositiveNumberText[localStorage.getItem('language')]);\n return;\n } else if (document.getElementById('shortBreakSettings').value < 1) {\n alert(usePositiveNumberText[localStorage.getItem('language')]);\n return;\n } else if (document.getElementById('longBreakSettings').value < 1) {\n alert(usePositiveNumberText[localStorage.getItem('language')]);\n return;\n }\n\n valueWork = document.getElementById('workSettings').value;\n valueShort = document.getElementById('shortBreakSettings').value;\n valueLong = document.getElementById('longBreakSettings').value;\n valueSound = document.getElementById('volume-slider').value;\n document.getElementById('clock').innerHTML = `${valueWork}:00`;\n\n localStorage.setItem('workSettings', `${valueWork}`);\n localStorage.setItem('shortBreakSettings', `${valueShort}`);\n localStorage.setItem('longBreakSettings', `${valueLong}`);\n localStorage.setItem('volume-slider', `${valueSound}`);\n}", "function save(e) {\n let saveBtn = e.target;\n let inputBox = event.target.parentNode.lastChild;\n event.target.parentNode.firstChild.textContent = inputBox.value;\n inputBox.style.display = \"none\";\n saveBtn.style.display=\"none\";\n let editBtn = event.target.nextSibling;\n editBtn.style.display = \"inline\";\n \n}", "function saveData() {\n\t\tlocalStorage.setItem('ckFilters', JSON.stringify({\n\t\t\twords: $('#ck-input-words').val(),\n\t\t\taccounts: $('#ck-input-accounts').val()\n\t\t}));\n\t}", "function submit_inputs() {\n\n\t\t\t\tvar W = $('.form-w').val();\n\t\t\t\tvar B = $('.form-b').val();\n\t\t\t\tvar Mf = $('.form-mf').val();\n\t\t\t\tvar Mt = $('.form-mt').val();\n\n\t\t\t\tlocalStorage.setItem('SPLITTER_W', W);\n\t\t\t\tlocalStorage.setItem('SPLITTER_B', B);\n\t\t\t\tlocalStorage.setItem('SPLITTER_MF', Mf);\n\t\t\t\tlocalStorage.setItem('SPLITTER_MT', Mt);\n\n\t\t\t}", "function saveEvent() {\n $('.save-button').on('click', function() {\n var trId = $(this)\n .closest('tr')\n .attr('id');\n var textAreaVal = $(this)\n .closest('tr')\n .find('textarea')\n .val()\n .trim();\n\n storedSchedule = JSON.parse(localStorage.getItem(date));\n scheduleObj = {};\n\n scheduleObj[trId] = textAreaVal;\n scheduleArr.push(scheduleObj);\n localStorage.setItem(date, JSON.stringify(scheduleArr));\n\n for (var i = 0; i < storedSchedule.length; i++) {\n if (storedSchedule[i].hasOwnProperty(trId)) {\n storedSchedule[i][trId] = textAreaVal;\n scheduleArr = storedSchedule;\n localStorage.setItem(date, JSON.stringify(scheduleArr));\n return;\n }\n }\n });\n }", "function MUD_Save() {\n console.log(\"=== MUD_Save === \");\n\n const new_idnumber = (el_MUD_idnumber.value) ? el_MUD_idnumber.value : null;\n const new_cribnumber = (el_MUD_cribnumber.value) ? el_MUD_cribnumber.value : null;\n const new_bankname = (el_MUD_bankname.value) ? el_MUD_bankname.value : null;\n const new_bankaccount = (el_MUD_bankaccount.value) ? el_MUD_bankaccount.value : null;\n const new_beneficiary = (el_MUD_beneficiary.value) ? el_MUD_beneficiary.value : null;\n\n const upload_dict = {\n user_id: mod_MUD_dict.user_id,\n userdata_id: mod_MUD_dict.userdata_id\n };\n if(new_idnumber !== mod_MUD_dict.idnumber ){\n upload_dict.idnumber = new_idnumber;\n };\n if(new_cribnumber !== mod_MUD_dict.cribnumber ){\n upload_dict.cribnumber = new_cribnumber\n };\n if(new_bankname !== mod_MUD_dict.bankname ){\n upload_dict.bankname = new_bankname\n };\n if(new_bankaccount !== mod_MUD_dict.bankaccount ){\n upload_dict.bankaccount = new_bankaccount\n };\n if(new_beneficiary !== mod_MUD_dict.beneficiary ){\n upload_dict.beneficiary = new_beneficiary\n };\n\n if (!isEmpty(upload_dict)){\n UploadChanges(upload_dict, urls.url_userdata_upload);\n };\n\n $(\"#id_mod_userdata\").modal(\"hide\");\n}", "function save(){\n\tid = -1;\n\t\n\tif (pos_comp != -1)//modificar\n\t\tid = positions[pos_comp][0];\n\t\t\n\t$(\"#btnGuardar\").hide();\n\t$(\"#mensajeTemporal\").show();\n\t$(\"#backImage\").css({cursor:\"wait\"});\n\t\n\t\n\t$(\"#idPagina\").val(id);\n\t$(\"#contenido\").val($(\"#contenido\").sceditor(\"instance\").val());\n\t\n\t\n\t$(\"#subirPagina\").ajaxSubmit({\n\t\tdataType: \"json\",\n\t\tsuccess: function(respuesta_json){\n\t\t\t$(\"#btnGuardar\").show();\n\t\t\t$(\"#mensajeTemporal\").hide();\n\t\t\t$(\"#backImage\").css({cursor:\"default\"});\n\t\t\n\t\t\t$(\"#resultados\").text(respuesta_json.mensaje);\n\t\t\tprincipalCerrarPopUp(pagina_cerrarPopUp);\n\t\t\tconsultarTuplasExistentes(nombrePHPConsultar, isBorrarTuplas, arrayCamposConsulta);\n\t\t}\n\t});\n}", "function saveCharacter(){\n\tvar temp;\n\n\t// Character information\n\tsaved.setItem('charName', $('#charName').val());\n\tsaved.setItem('charRace', $('#charRace').val());\n\tsaved.setItem('charLevel', $('#charLevel').val());\n\tsaved.setItem('charBackground', $('#charBackground').val());\n\tsaved.setItem('charAlignment', $('#charAlignment').val());\n\tsaved.setItem('charExp', $('#charExp').val());\n\tsaved.setItem('charProficiency', $('#charProficiency').val());\n\tsaved.setItem('charInit', $('#charInit').val());\n\tsaved.setItem('charSpeed', $('#charSpeed').val());\n\tsaved.setItem('charAC', $('#charAC').val());\n\tsaved.setItem('charHealth', $('#charHealth').val());\n\n\t// Character Stats\n\tsaved.setItem('str', $('#str').val());\n\tsaved.setItem('dex', $('#dex').val());\n\tsaved.setItem('con', $('#con').val());\n\tsaved.setItem('int', $('#int').val());\n\tsaved.setItem('wis', $('#wis').val());\n\tsaved.setItem('cha', $('#cha').val());\n\n\t// Currency\n\tsaved.setItem('gold', $('#gold').val());\n\tsaved.setItem('silver', $('#silver').val());\n\tsaved.setItem('copper', $('#copper').val());\n\n\t// List sizes\n\tsaved.setItem('atkSize', atkCount);\n\tsaved.setItem('itmSize', itmCount);\n\tsaved.setItem('splSize', splCount);\n\n\t// Tab\n\tsaved.setItem('tab', curTab);\n\n\t// List contents\n\t$('.atkTable').each(function(){\n\t\tatkList += $(this).val()+':';\n\t})\n\t$('.itmTable').each(function(){\n\t\titmList += $(this).val()+':';\n\t})\n\t$('.splTable').each(function(){\n\t\tsplList += $(this).val()+':';\n\t})\n\n\tsaved.setItem('atkList', atkList);\n\tsaved.setItem('itmList', itmList);\n\tsaved.setItem('splList', splList);\n\n\t// Info\n\tsaved.setItem('profText', $('#profText').val());\n\tsaved.setItem('featText', $('#featText').val());\n\n\t// Spell Slots\n\tfor(var i = 1;i<10;++i){\n\t\tsaved.setItem(i+'Cur', $('#'+i+'Cur').val());\n\t\tsaved.setItem(i+'Max', $('#'+i+'Max').val());\n\t}\n\n\t// Saves\n\ttemp = '';\n\tfor(var i = 0;i < saves.length;++i){\n\t\ttemp += saves[i] + ':';\n\t}\n\tsaved.setItem('saves', temp);\n\n\t// SkillBonus\n\ttemp = '';\n\tfor(var i = 0;i < skillBonus.length;++i){\n\t\ttemp += skillBonus[i] + ':';\n\t}\n\tsaved.setItem('skillBonus', temp);\n\n\t// ThrowBonus\n\ttemp = '';\n\tfor(var i = 0;i < throwBonus.length;++i){\n\t\ttemp += throwBonus[i] + ':';\n\t}\n\tsaved.setItem('throwBonus', temp);\n\n}", "function save() {\r\n //recupero il valore (.value) inserito dall'utente nel campo che ha id 'username'\r\n let inseredUsername = document.getElementById(\"username\").value;\r\n\r\n //recupero il valore (.value) inserito dall'utente nel campo che ha id 'password'\r\n let inseredPassword = document.getElementById(\"password\").value;\r\n\r\n //salvo questi valori nel local storage:\r\n localStorage.setItem('username', inseredUsername) //key = username, value = inseredUsername (ovvero ciò che ha scritto l'utente)\r\n localStorage.setItem('password', inseredPassword)\r\n}", "function save() {\n str = myDiagram.model.toJson();\n document.getElementById(\"mySavedModel\").value = str;\n }", "function saveHelper(){\n\tvar occupants = document.getElementById(\"occupantInput\");\n\tif(occupants)\n\t{\n\t\tselected_furn.totalOccupants = occupants.value;\n\t}\n\tselected_marker.setOpacity(1);\n\tselected_furn.seat_places = temp_seat_places;\n\t\n\tif(temp_wb != [])\n\t{\n\t\tselected_furn.whiteboard = temp_wb;\n\t}\n\t\n \tmymap.closePopup();\n}", "function saveInfo(e) {\n e.preventDefault();\n //console.log(\"click\")\n var text = $(this).siblings('textarea').val().trim();\n var id = $(this).siblings('textarea').attr('id');\n\n localStorage.setItem(id, JSON.stringify(text));\n\n}", "function save() {\n if(check_web_storage_support() == true) {\n var area = document.getElementById(\"area\");\n if(area.value != '') {\n localStorage.setItem(\"note\", area.value);\n }\n else {\n alert(\"Write someting to save\");\n }\n }\n}", "function storeData() {\n trainName = $(\"#Train-Name\").val();\n destinationName = $(\"#Destination-Name\").val();\n firstTrainTime = $(\"#First-Time\").val();\n trainFrequency = $(\"#Frequency\").val();\n}", "function save() {\r\n const uname = context.user && context.user.username;\r\n const time = new Date().toLocaleTimeString();\r\n const searchValue = value.length > 0 ? value : \"\";\r\n const newData = { uname, searchValue, time };\r\n if (localStorage.getItem(\"data\") === null) {\r\n localStorage.setItem(\"data\", \"[]\");\r\n }\r\n\r\n var oldData = JSON.parse(localStorage.getItem(\"data\"));\r\n oldData.push(newData);\r\n\r\n localStorage.setItem(\"data\", JSON.stringify(oldData));\r\n }", "function save() {\r\n //Modify\r\n for (i = 0; i < toModify.length; i++) {\r\n items[toModify[i]].description = document.getElementById(toModify[i]).value;\r\n serverPut(items[toModify[i]].id, items[toModify[i]].description);\r\n }\r\n //Delete\r\n toDelete.sort();\r\n toDelete.reverse();\r\n for (i = 0; i < toDelete.length; i++) {\r\n serverDelete(items[toDelete[i]]);\r\n items.splice(toDelete[i], 1);\r\n }\r\n //Add\r\n for (i = 0; i < toAdd.length; i++) {\r\n let newDescription = document.getElementById(toAdd[i]).value;\r\n let newID = serverPost(desc);\r\n items[items.length] = {\r\n description: newDescription,\r\n id: newID,\r\n };\r\n }\r\n\r\n //Display list\r\n displayList(items, true);\r\n document.getElementById(\"displayer\").className = \"shown\";\r\n document.getElementById(\"editor\").className = \"hidden\";\r\n}", "function saveData()\n{\n /***********\n * SET INT *\n ***********/\n function setInt(name, data)\n {\n // if a boolean or other, convert to an int\n if (data === true)\n data = 1;\n else if (data === false)\n data = 0;\n\n // otherwise set it normally\n if (data !== null && data !== undefined && !isNaN(data))\n localStorage.setItem(name, data);\n }\n\n // set data\n setInt('data', true);\n setInt('ax', ax);\n setInt('ay', ay);\n setInt('dx', dx);\n setInt('dy', dy);\n setInt('score', score);\n setInt('recent', recent);\n setInt('hScore', hScore);\n setInt('paused', paused);\n setInt('doWrap', doWrap);\n \n // set snake data\n setInt('length', snake.length);\n for (var i = 0; i < snake.length; i++)\n {\n setInt('snake' + i + 'x', snake[i].x);\n setInt('snake' + i + 'y', snake[i].y);\n }\n}", "function savedStuff(){\n $.each(middleFind, (i, v) =>{\n var saved = middleFind.eq(i).attr('data-saved')\n textboxes.eq(i).val(localStorage.getItem(saved))\n \n })\n}", "function saveSettings() {\n\tif (typeof (Storage) !== \"undefined\") {\n\t\tlocalStorage.fixIncome = document.getElementById(\"fixIncome\").value;\n\t\tlocalStorage.fixCost = document.getElementById(\"fixCost\").value;\n\t\tlocalStorage.fixSaving = document.getElementById(\"fixSaving\").value;\n\t\tlocalStorage.interval = document.getElementById(\"interval\").selectedIndex + 1;\n\t} else {\n\t\talert(\"Ihr Browser unterstützt LocalStage nicht!!!\");\n\t}\n}", "function saveData() {\n try {\n const fsStorageAsArray = toSaveFormat(fsStorage[0], null);\n localStorage.setItem(\"saveArray\", JSON.stringify(fsStorageAsArray));\n } catch(err) {\n alert(\"Error occurred while saving the data\");\n }\n }", "function save() {\n localStorage && localStorage.setItem(key, Y.JSON.stringify(data));\n }", "function saveSomeData() {\n localStorage.setItem(\"name\", $('#stringPlayerName').val());\n //localStorage.setItem()\n}", "function save() {\n localStorage.setItem(\"toys\", toys);\n localStorage.setItem(\"click\", mClickUpgrade.amount);\n localStorage.setItem(\"autoClicker\", mAutoClicker.amount);\n localStorage.setItem(\"multiplier\", mMultiplier.amount);\n localStorage.setItem(\"toyShop\", mToyShop.amount);\n localStorage.setItem(\"toyFactory\", mToyFactory.amount);\n localStorage.setItem(\"hiddenToyLayer\", mHiddenToyLayer.amount);\n}", "function nineAmSaveBtnClick(e) {\n e.preventDefault;\n localStorage.setItem(\"nineAm\", nineAm.value);\n}", "function saveDocumentAs() {\r\n\t\tif (checkLocalStorage()) {\r\n\t\t var saveName = prompt(\"Save file as...\");\r\n\t\t if (saveName) {\r\n\t\t\tvar str = myDiagram.model.toJson();\r\n\t\t\tlocalStorage.setItem(saveName, str);\r\n\t\t\tmyDiagram.isModified = false;\r\n\t\t\tvar listbox = document.getElementById(\"mySavedFiles\");\r\n\t\t\t// adds saved floor plan to listbox if it isn't there already \r\n\t\t\tvar exists = false;\r\n\t\t\tfor (var i = 0; i < listbox.options.length; i++) {\r\n\t\t\t if (listbox.options[i].value === saveName) {\r\n\t\t\t\texists = true;\r\n\t\t\t\tbreak;\r\n\t\t\t }\r\n\t\t\t}\r\n\t\t\tif (exists === false) {\r\n\t\t\t var option = document.createElement('option');\r\n\t\t\t option.value = saveName;\r\n\t\t\t option.text = saveName;\r\n\t\t\t listbox.add(option, null);\r\n\t\t\t}\r\n\t\t\tvar currentFile = document.getElementById(\"currentFile\");\r\n\t\t\tcurrentFile.innerHTML = saveName;\r\n\t\t }\r\n\t\t}\r\n\t }", "function SaveItem() {\n\t\t\t\n\tvar name = document.forms.ShoppingList.name.value;\n\tvar data = document.forms.ShoppingList.data.value;\n\twindow.localStorage.setItem(name,data);\n\tdoShowAll();\n\t\n}", "function saveState() {\n const state = {\n cf: cfSelect.value,\n gf: gfSelect.value,\n mf: mfSelect.value,\n am: amSelect.value,\n };\n localStorage.setItem('collecting_together_form', JSON.stringify(state));\n }", "function _saveLocalRecord() {\n\n // get all vars (don't worry if they've been changed).\n var columnList = [];\n columnList.push({ column: \"playername\", value: firstname });\n columnList.push({ column: \"coachname\", value: coachname });\n columnList.push({ column: \"clubname\", value: clubname });\n columnList.push({ column: \"path\", value: path });\n columnList.push({ column: \"thumbnail\", value: thumbnail });\n columnList.push({ column: \"shottype\", value: viewModel.get(\"shotTypeIndex\") });\n columnList.push({ column: \"ratingtype\", value: viewModel.get(\"ratingTypeIndex\") });\n columnList.push({ column: \"playerid\", value: playerId });\n columnList.push({ column: \"coachid\", value: coachId });\n columnList.push({ column: \"clubid\", value: clubId });\n var dateCheck = viewModel.get(\"date\");\n var timeCheck = viewModel.get(\"time\");\n columnList.push({ column: \"date\", value: new Date(dateCheck + \" \" + timeCheck) });\n \n // build query. Add each item to the query procedurally\n var query = \"INSERT INTO \" + LocalSave._tableName + \" (\";\n var first = true;\n for (var i = 0; i < columnList.length; i++) {\n var item = columnList[i];\n if (!first) {\n query += \", \";\n }\n query += item.column;\n first = false;\n }\n query += \") VALUES (\";\n first = true;\n var valList = [];\n for (var i = 0; i < columnList.length; i++) {\n var item = columnList[i];\n if (!first) {\n query += \", \";\n }\n query += \"?\";\n first = false;\n valList.push(item.value);\n }\n query += \");\";\n\n // run query.\n var complete = new Promise(function (resolve, reject) {\n db.queryExec(query, valList,\n function (id) {\n console.log(\"Saved new shot with id \" + id);\n resolve(id);\n },\n function (err) {\n reject(err);\n });\n });\n\n // handle query after it has completed\n complete.then(\n function (val) {\n if (page.android) {\n var Toast = android.widget.Toast;\n Toast.makeText(application.android.context, \"New Shot Saved\", Toast.LENGTH_SHORT).show();\n }\n // leave page\n var navigationOptions = {\n moduleName: \"record-shot-page\",\n backstackVisible: false\n };\n frameModule.topmost().navigate(navigationOptions);\n },\n function (err) {\n _unlockFunctionality();\n });\n}", "function saveCustomerData(form){\n // pick the data from the inputs\n let first = $(\"input[name=first]\").val();\n let email = $(\"input[name=email]\").val();\n let products = $(\"select[name=products]\").val();\n let quantity = $(\"input[name=quantity]\").val();\n\n // store the data in the object\n let CustomerData = {\n first: first,\n\t\temail: email,\n products:products,\n quantity:quantity\n\t};\n console.log(CustomerData);\n //stroing all the input in the local variable\n\tlocalStorage[\"CustomerData\"]=JSON.stringify(CustomerData);\n form.submit();\n}", "function save_bague(results){\n // si la sauvegarde a été validée\n if (results.buttonIndex == 1){\n // récupert les sauvegardes actuelles\n var save = window.localStorage.getItem(\"sauvegardes_bagues\");\n\n if (save == undefined)\n save = '';\n\n // prépare la nouvelle sauvegarde - ajoute le nom de la sauvegarde\n var value = results.input1 + \"&&\";\n\n // ajoute la date\n var date = new Date();\n value += date.getDate() + \"/\" + (date.getMonth() + 1) + \"/\" + date.getFullYear() + \" \" + date.getHours() + \":\" + date.getMinutes() + \"&&\";\n\n // ajoute le type de configurateur\n value += $(\"select[name='type_configurateur']\").val() + \"&&\";\n\n // récupert les options\n options = new Array();\n $('.options_set').each(function(){\n options.push($(this).val());\n });\n options = options.join(\",\");\n\n // ajoute les options à la sauvegarde\n value += options;\n // stock la nouvelle sauvegarde\n if (save != '')\n save += \";;\";\n\n save += value;\n window.localStorage.setItem(\"sauvegardes_bagues\", save);\n }\n}", "function saveTerrainModificationForm() {\n var terrainModificationType = terrainModificationForms[terrainModificationIndex][\"terrain-modification\"];\n var formEntries = document.getElementById(\"custom-inputs\").getElementsByClassName(\"custom-input\");\n for (var i = 0; i < formEntries.length; i++) {\n var input = formEntries.item(i);\n var fieldName = input.id;\n terrainModificationForms[terrainModificationIndex][\"json\"][\"fields\"][fieldName][\"value\"] = input.value;\n }\n}", "function saveInfo() {\n\n let textarea = $(this).siblings(\"textarea\");\n let textAreaValue = textarea.val();\n let timeSlot = textarea.attr(\"time\");\n\n if(textAreaValue === \"\" && schedule[timeSlot]){\n //Remove key value pair from schedule if textArea is blank\n delete schedule[timeSlot];\n } else if (textAreaValue !== \"\"){\n schedule[timeSlot] = textAreaValue;\n }\n localStorage.setItem(\"schedule\", JSON.stringify(schedule));\n}", "function saveNote() {\n window.localStorage.setItem(notes.value, editor.value);\n}", "function saveText(id) {\n\n //var dayPlanner = []\n \n\n // Get dayPlanner dataarray from localStorage\n var dataLoaded = JSON.parse(localStorage.getItem(\"dayPlanner\"));\n\n // Get input text\n var inputText = $(`#input${id}`).val();\n\n // Store input text in localStorage array\n dataLoaded[id] = inputText;\n\n // Save new array to localStorage\n localStorage.setItem(\"dayPlanner\", JSON.stringify(dataLoaded));\n\n}", "function Save() \n{\n /* var savearr = [holdname, playerlvl, health, mana, gold, savecoord];\n var savedata = JSON.stringify(savearr);*/\n savedatasw = 1;\n playerinfo.playername=playername;\n playerinfo.playerlvl=playerlvl;\n playerinfo.health=health;\n playerinfo.mana=mana;\n playerinfo.gold=gold;\n playerinfo.savecoord=savecoord;\n playerinfo.savedatasw=savedatasw;\n \n fs.writeFileSync(\"save.json\", JSON.stringify(playerinfo));\n \n return;\n}", "function save() {\n \n try {\n if (typeof (localStorage) === 'undefined') {\n alert('Your browser does not support HTML5 localStorage. Try upgrading.');\n } else {\n try {\n window.localStorage.setItem(\"currency\", totalCurrency.toString());\n window.localStorage.setItem(\"cps\", CPS.toString());\n window.localStorage.setItem(\"inventory\", ko.toJSON(appView));\n window.localStorage.setItem(\"totalClicks\", appView.player.totalClicks());\n window.localStorage.setItem(\"totalMoneySpent\", appView.player.totalMoneySpent());\n } catch (e) {\n if (e === QUOTA_EXCEEDED_ERR) {\n alert('Quota exceeded!');\n }\n }\n }\n } catch (e) {\n window.status = e.message;\n }\n\n lastSave = new Date();\n}", "function save() {\r\n var site_name = document.getElementById(\"site_Name\").value;\r\n dev_name = document.getElementById(\"dev_Name\").value;\r\n var test_num = document.getElementById(\"try_num\").value;\r\n var language = document.getElementById(\"language\").value;\r\n\r\n database.ref('test/' + dev_name).set({\r\n siteName : site_name,\r\n developer : dev_name,\r\n testNumber : test_num,\r\n lSitLanguage : language\r\n });\r\n\r\n alert('saved');\r\n }", "function handleSave(){\n localStorage.setItem(\"hour8\", hour8.value);\n localStorage.setItem(\"hour9\", hour9.value);\n localStorage.setItem(\"hour10\", hour10.value);\n localStorage.setItem(\"hour11\", hour11.value);\n localStorage.setItem(\"hour12\", hour12.value);\n localStorage.setItem(\"hour13\", hour13.value);\n localStorage.setItem(\"hour14\", hour14.value);\n localStorage.setItem(\"hour15\", hour15.value);\n localStorage.setItem(\"hour16\", hour16.value);\n}", "save() {\n try {\n this._toggleSaveThrobber();\n this._readFromForm();\n this.dao.save();\n\n // make sure the edit input is showing the correct id, reload data from server\n document.getElementById('edit_id').value = this.dao.id;\n this.read();\n \n } catch(e) {\n console.log(e);\n alert(e);\n }\n this._toggleSaveThrobber();\n }", "function saveButton(num) { //Passing a number we're going to use to determine the time\n //console.log(this.siblings)\n let timestring = parseTime(num)\n var input = document.getElementById(\"TextField\" + timestring).value;\n localStorage.setItem(timestring, input);\n document.getElementById(\"TextField\" + timestring).value = localStorage.getItem(timestring);\n var testStorage = localStorage.getItem(timestring);\n console.log(\"input: \", input)\n console.log(\"testStorage: \", testStorage)\n\n }", "function MSM_Save() {\n console.log(\"=== MSM_Save =========\");\n\n const has_permit = permit_dict.permit_crud_sameschool;\n\n if(has_permit){\n\n let new_array = [];\n let allowed_str = \"\"\n const tblBody_select = el_MSM_tblbody_select;\n for (let i = 0, row; row = tblBody_select.rows[i]; i++) {\n const base_pk_int = get_attr_from_el_int(row, \"data-pk\")\n if(base_pk_int > 0) {\n const is_selected = (!!get_attr_from_el_int(row, \"data-selected\"))\n if(is_selected){\n new_array.push(base_pk_int);\n\n };\n }\n }\n if(new_array){\n // PR2020-11-02 from https://www.w3schools.com/js/js_array_sort.asp\n new_array.sort(function(a, b){return a - b});\n };\n\n // --- upload changes\n // mod_MSM_dict = user_data_dict with additional keys\n const upload_dict = { user_pk: mod_MSM_dict.user_pk,\n schoolbase_pk: mod_MSM_dict.schoolbase_pk,\n mapid: mod_MSM_dict.mapid,\n mode: \"update\",\n allowed_clusters: (new_array.length) ? new_array : null };\n\n UploadChanges(upload_dict, urls.url_user_upload);\n };\n// hide modal\n $(\"#id_mod_select_multiple\").modal(\"hide\");\n } // MSM_Save", "function savestate() {\n state = $(\"#states\").val();\n $(\"#state\").val(state);\n}", "function putValueToForm() {\r\n\r\n localStorValues3 = localStorage.getItem(localStorage.key(event.target.id));\r\n\r\n NlistOfLSvalues = JSON.parse(localStorValues3);\r\n\r\n myRef =\r\n event.target.parentElement.previousElementSibling.previousElementSibling\r\n .previousElementSibling.previousElementSibling.previousElementSibling\r\n .previousElementSibling.innerText;\r\n removeAfromNameProduct =\r\n event.target.parentElement.previousElementSibling.previousElementSibling\r\n .previousElementSibling.previousElementSibling.previousElementSibling\r\n .innerText;\r\n myDescription =\r\n event.target.parentElement.previousElementSibling.previousElementSibling\r\n .previousElementSibling.previousElementSibling.innerText;\r\n myPrice =\r\n event.target.parentElement.previousElementSibling.previousElementSibling\r\n .previousElementSibling.innerText;\r\n myStock =\r\n event.target.parentElement.previousElementSibling.previousElementSibling\r\n .innerText;\r\n\r\n key.value = event.target.id;\r\n ref.value = myRef;\r\n nameProduct.value = removeAfromNameProduct;\r\n descriptionProduct.value = myDescription;\r\n price.value = myPrice;\r\n stock.value = myStock;\r\n}", "function saveData() {\n localStorage.setItem(\"datos\", JSON.stringify({\n nombre: document.querySelector(nombre).value,\n run: document.querySelector(run).value,\n edad: document.querySelector(edad).value,\n region: document.querySelector(region).value,\n // Al ser Javascript plano lenemos que usar en Index en duro, algun framework ($) y un campo bien referenciables seria mas lindo.\n regionId :document.querySelector(region).selectedOptions[0].attributes[\"data-id\"].value,\n comuna: document.querySelector(comuna).value,\n comunaId: document.querySelector(comuna).selectedOptions[0].attributes[\"data-id\"].value,\n domicilio: document.querySelector(domicilio).value,\n email: document.querySelector(email).value,\n }));\n}", "function save_options() {\r\n localStorage[\"user\"] = document.getElementById(\"user\").value;\r\n localStorage[\"passwd\"] = document.getElementById(\"passwd\").value;\r\n\r\n // Update status to let user know options were saved.\r\n update_status(\"已保存\");\r\n}", "function saveTextAreaOnClick() {\n $(\".saveBtn\").on(\"click\", function () {\n \n //when the button is clicked we create a current Time Data var that will grab the time data of the text area we have selceted\n var currentTimeData = $(this).parent().attr(\"data-type\");\n //We create a varible that will indicate the current text are we have selected by using the textarea class plus the current timedata\n var clickedTextarea = $(\"#input\" + currentTimeData);\n //we then grab the data-type of the button we clicked which will be equals to the index spot of our SavedTextArray\n var rowToArrayCorrelation = $(this).attr(\"data-type\");\n \n //We then save the current textarea value to the corresponding spot on the array\n savedInputList[rowToArrayCorrelation] = clickedTextarea.val();\n\n //store Array to local storage\n localInputList();\n });\n }", "function storeData(){\r\n\t\tvar id \t\t\t\t= Math.floor(Math.random()*100000000001);\r\n\t\t//Gather up all our form field values and store in an object\r\n\t\t//Object properties contain an array with the form label and input value\r\n\t\tgetSelectedRadio();\r\n\t\tvar item \t\t\t\t= {};\r\n\t\t\titem.comicTitle\t\t= [\"Title of Comic:\", e('comicTitle').value];\r\n\t\t\titem.seriesTitle\t= [\"Title of Series:\", e('seriesTitle').value];\r\n\t\t\titem.issueNum\t\t= [\"Issue Number:\", e('issueNum').value];\r\n\t\t\titem.dateReleased\t= [\"Date Released:\", e('dateReleased').value];\r\n\t\t\titem.publisher\t\t= [\"Publisher:\", e('publisher').value];\r\n\t\t\titem.rateIssue\t\t= [\"Rate of Issue:\", e('rateIssue').value];\r\n\t\t\titem.genre \t\t\t= [\"Genre:\", e('genre').value];\r\n\t\t\titem.illStyle\t\t= [\"Illustration Style:\", styleValue];\r\n\t\t\titem.comments\t\t= [\"Comments:\", e('comments').value];\r\n\t\t//Save data into Local Storage: Use Stringify to convert our object to a string\r\n\t\tlocalStorage.setItem(id, JSON.stringify(item));\r\n\t\talert(\"Comic saved to index!\");\r\n\t}", "function saveInventory() {\n Settings.setValue(inventoryDataSettingString, inventoryData);\n }", "function save() {\n\t\tdocument.getElementById(\"mySavedModel\").value = myDiagram.model.toJson();\n\t\tmyDiagram.isModified = false;\n\t}", "function savedLink(e){\n\t//form values\n\t//logs the value not the input field\n\tvar siteName = document.getElementById('siteName').value;\n\tvar siteURL = document.getElementById('siteURL').value;\n\n\tif(!validForm(siteURL, siteName)){\n\t\treturn false;\n\t}\n\n\t//creating bookmark object with siteName/siteURL variables in it\n\tvar bookmark = {\n\t\tname: siteName,\n\t\turl: siteURL\n\t}\n\n\n\t//if its null need to initialaise bookmarks array\n\tif(localStorage.getItem('bookmarks') === null){\n\t\t//bookmark array\n\t\tvar bookmarks = [];\n\t\t//this will add to the array\n\t\tbookmarks.push(bookmark);\n\t\t//set to local storage + wrapping bookmarks in a json function to turn it into a string before saving it\n\t\tlocalStorage.setItem('bookmarks', JSON.stringify(bookmarks));\n\t} \n\t//if there is an object in bookmarks array\n\telse{\n\t\t//get bookmarks array from localStorage\n\t\tvar bookmarks = JSON.parse(localStorage.getItem('bookmarks'));\n\t\t//add bookmark to array\n\t\tbookmarks.push(bookmark);\n\t\t//reset to localStorage\n\t\tlocalStorage.setItem('bookmarks', JSON.stringify(bookmarks));\n\n\t}\n\n\tgetBookmarks();\n\t//this prevents the default behavour of the event listener, \n\t//stops form from submitting so you can work with it.\n\te.preventDefault();\n}", "function saveGrades() {\n var grade_arr = new Array();\n for (i = 0; i < grades.length; i++) {\n grade_arr.push(grades[i].value);\n }\n\n rubric_obj.grades = grade_arr;\n localStorage['grades'] = grade_arr;\n }", "function saveElementSeedForm() {\n var elementType = elementSeedForms[elementSeedIndex][\"element\"];\n var formEntries = document.getElementById(\"custom-inputs\").getElementsByClassName(\"custom-input\");\n for (var i = 0; i < formEntries.length; i++) {\n var input = formEntries.item(i);\n var fieldName = input.id;\n elementSeedForms[elementSeedIndex][\"json\"][\"fields\"][fieldName][\"value\"] = input.value;\n }\n}", "function updateSaveDataForm(values) {\r\n \"use strict\";\r\n document.getElementById(\"sav-name\").value = values[0];\r\n document.getElementById(\"sav-kills\").value = values[11];\r\n document.getElementById(\"sav-love\").value = values[1];\r\n document.getElementById(\"sav-hp\").value = values[2];\r\n document.getElementById(\"sav-exp\").value = values[9];\r\n document.getElementById(\"sav-gold\").value = values[10];\r\n document.getElementById(\"sav-at\").value = values[4];\r\n document.getElementById(\"sav-weaponat\").value = values[5];\r\n document.getElementById(\"sav-df\").value = values[6];\r\n document.getElementById(\"sav-armordf\").value = values[7];\r\n for (var i = 0; i < 8; i++) {\r\n updateSelection(\"sav-invslot\" + (i + 1), values, 12 + (i * 2), items);\r\n updateSelection(\"sav-cellslot\" + (i + 1), values, 13 + (i * 2), cellOpts);\r\n }\r\n updateSelection(\"sav-weapon\", values, 28, items);\r\n updateSelection(\"sav-armor\", values, 29, items);\r\n updateSelection(\"sav-trainingdummystate\", values, 44, trainingDummyStates);\r\n updateSelection(\"sav-torielstate\", values, 75, torielStates);\r\n updateSelection(\"sav-doggostate\", values, 82, doggoStates);\r\n updateSelection(\"sav-dogamydogaressastate\", values, 83, dogamyDogaressaStates);\r\n updateSelection(\"sav-greaterdogstate\", values, 84, greaterDogStates);\r\n updateSelection(\"sav-comedianstate\", values, 87, comedianStates);\r\n updateSelection(\"sav-papyrusstate\", values, 97, papyrusStates);\r\n updateSelection(\"sav-shyrenstate\", values, 111, shyrenStates);\r\n document.getElementById(\"sav-unkkills\").value = values[231];\r\n document.getElementById(\"sav-ruinskills\").value = values[232];\r\n document.getElementById(\"sav-snowdinkills\").value = values[233];\r\n document.getElementById(\"sav-waterfallkills\").value = values[234];\r\n document.getElementById(\"sav-hotlandkills\").value = values[235];\r\n updateSelection(\"sav-undynestate1\", values, 281, undyneStates1);\r\n updateSelection(\"sav-maddummystate\", values, 282, madDummyStates);\r\n updateSelection(\"sav-undynestate2\", values, 380, undyneStates2);\r\n updateSelection(\"sav-muffetstate\", values, 427, muffetStates);\r\n updateSelection(\"sav-broguardsstate\", values, 432, broGuardsStates);\r\n updateSelection(\"sav-mettatonstate\", values, 455, mettatonStates);\r\n if (parseInt(values[523].trim()) === 12) {\r\n document.getElementById(\"sav-exitedtruelab\").checked = true;\r\n } else {\r\n document.getElementById(\"sav-exitedtruelab\").checked = false;\r\n }\r\n if (parseInt(values[37].trim()) === 1) {\r\n document.getElementById(\"sav-defeatedasriel\").checked = true;\r\n } else {\r\n document.getElementById(\"sav-defeatedasriel\").checked = false;\r\n }\r\n updateSelection(\"sav-plotvalue\", values, 542, plotValues);\r\n if (parseInt(values[545].trim()) === 1) {\r\n document.getElementById(\"sav-havecell\").checked = true;\r\n } else {\r\n document.getElementById(\"sav-havecell\").checked = false;\r\n }\r\n document.getElementById(\"sav-location\").value = parseInt(values[547].trim());\r\n document.getElementById(\"sav-fun\").value = parseInt(values[35].trim());\r\n}", "function _saveLocalEdit() {\n\n // get changed vars\n var columnList = [];\n\n // changed names\n columnList.push({ column: \"playername\", value: firstname });\n columnList.push({ column: \"coachname\", value: coachname });\n columnList.push({ column: \"clubname\", value: clubname });\n\n // changed video\n if (path != viewModel.get(\"videoPath\")) {\n columnList.push({ column: \"path\", value: viewModel.get(\"videoPath\") });\n }\n columnList.push({ column: \"thumbnail\", value: thumbnail });\n\n // changed types\n if (shotTypeIndex != viewModel.get(\"shotTypeIndex\")) {\n columnList.push({ column: \"shottype\", value: viewModel.get(\"shotTypeIndex\") });\n }\n if (ratingTypeIndex != viewModel.get(\"ratingTypeIndex\")) {\n columnList.push({ column: \"ratingtype\", value: viewModel.get(\"ratingTypeIndex\") });\n }\n\n // changed ids\n columnList.push({ column: \"playerid\", value: playerId });\n columnList.push({ column: \"coachid\", value: coachId });\n columnList.push({ column: \"clubid\", value: clubId });\n\n // changed date\n var dateCheck = viewModel.get(\"date\");\n var timeCheck = viewModel.get(\"time\");\n var dateTimeCheck = dateCheck + \" \" + timeCheck;\n var curDateTime = dateTimeObj.toDateString() + \" \" + dateTimeObj.toLocaleTimeString(\"en-US\");\n if (curDateTime != dateTimeCheck) {\n columnList.push({ column: \"date\", value: new Date(dateCheck + \" \" + timeCheck) });\n }\n\n // build query\n var query = \"UPDATE \" + LocalSave._tableName + \" SET \";\n var first = true;\n var valList = [];\n for (var i = 0; i < columnList.length; i++) {\n var item = columnList[i];\n if (!first) {\n query += \", \";\n }\n query += item.column + \"=?\";\n valList.push(item.value);\n first = false;\n }\n query += \" WHERE id=?;\";\n valList.push(shotId);\n\n // run query.\n var complete = new Promise(function (resolve, reject) {\n db.queryExec(query, valList,\n function (id) {\n console.log(\"Saved new shot with id \" + id);\n resolve(id);\n },\n function (err) {\n reject(err);\n });\n });\n\n // handle query after it has completed\n complete.then(\n function (val) {\n if (page.android) {\n var Toast = android.widget.Toast;\n Toast.makeText(application.android.context, \"Shot Saved\", Toast.LENGTH_SHORT).show();\n }\n // leave page\n frameModule.topmost().goBack();\n },\n function (err) {\n _unlockFunctionality();\n });\n}", "function writeInLocalFifthMovieNew() {\n /* Test possibility to use localStorage and JSON*/\n if (typeof localStorage != \"undefined\" && JSON) {\n /* Definition of a Javascript object fifth_movie_new */\n if ($(\"input[name='fifth_movie_new']\").val().length) {\n var fifth_movie_new = {\n name: $(\"input[name='fifth_movie_new']\").val()\n }\n /* Serialization to a JSON object */\n localStorage.setItem(\"fifth_movie_new\", JSON.stringify(fifth_movie_new));\n var data = JSON.parse(localStorage.getItem(\"fifth_movie_new\"));\n $(\"input[name='fifth_movie_new']\").val(data.name)\n $(\"input[name='fifth_movie_new']\").attr('disabled', 'disabled')\n }\n $('#fifth-movie-new-submit').attr('hidden', 'hidden')\n $('#fifth-movie-new-delete').removeAttr('hidden')\n /* Control display */\n alert(\"Enregistrement du film en cinquième position sur le troisième bandeau : \" + data.name);\n } else {\n /* Error message (no possibility localStorage) */\n alert(\"localStorage n'est pas supporté\");\n }\n}", "function importSave() {\r\n\tlet data = prompt(\"Paste your save string here\");\r\n\r\n\tif (data !== null && data !== '')\r\n\t\tparseAndImportData(data);\r\n\t\t\r\n\trunAll();\r\n}" ]
[ "0.729548", "0.71950823", "0.7102521", "0.7081648", "0.7050331", "0.7048661", "0.70155525", "0.6945653", "0.69049793", "0.68342", "0.68308836", "0.6830375", "0.68207395", "0.68160135", "0.68122834", "0.6802373", "0.67972827", "0.6775257", "0.67634666", "0.67507786", "0.67000705", "0.66916484", "0.6690727", "0.66766644", "0.66404784", "0.6632123", "0.66307604", "0.6621758", "0.66208047", "0.66207576", "0.6608705", "0.65970075", "0.6593249", "0.65797377", "0.65690905", "0.65581566", "0.6546018", "0.65444005", "0.6537935", "0.653537", "0.65288407", "0.6524777", "0.6517757", "0.6515069", "0.6507046", "0.650238", "0.65020645", "0.65010214", "0.64941573", "0.64834625", "0.64796233", "0.6471273", "0.64705807", "0.646981", "0.6467857", "0.6467415", "0.6453636", "0.6452687", "0.6440443", "0.6433978", "0.6433553", "0.6431613", "0.6429441", "0.6426148", "0.641492", "0.6411017", "0.64080036", "0.64075565", "0.6402088", "0.6401326", "0.63959265", "0.63956267", "0.6391958", "0.63904023", "0.63896936", "0.6383507", "0.6383125", "0.6375644", "0.63737524", "0.6373576", "0.6366118", "0.6365101", "0.6363584", "0.6363061", "0.63628215", "0.63491756", "0.6341816", "0.6341137", "0.63388705", "0.6338228", "0.63347554", "0.6329772", "0.6328577", "0.632072", "0.6319527", "0.6312513", "0.63093346", "0.6304833", "0.6303441", "0.629763", "0.629699" ]
0.0
-1
END LOCAL STORAGE BEGIN GEOLOCATION COORDINATES OF USER
function getLocation() { // Make sure browser supports this feature if (navigator.geolocation) { // Provide our showPosition() function to getCurrentPosition console.log(navigator.geolocation.getCurrentPosition(showPosition)); } else { alert("Geolocation is not supported by this browser."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLocation(){\n self.polyline = [];\n self.markers = [];\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(setUserLocation);\n } else {\n console.log(\"geolocation error\");\n }\n }", "function onSuccessGeo( position )\n{\n localStorage.setItem( 'latitude_L' , position.coords.latitude );\n localStorage.setItem( 'longitude_L' , position.coords.longitude );\n}", "function geo_success(p) {\r\n // alert(\"Found you at latitude \" + p.coords.latitude +\r\n // \", longitude \" + p.coords.longitude);\r\n\t\tuserPos.LAT =p.coords.latitude;\r\n\t\tuserPos.LNG =p.coords.longitude;\r\n\t\talertUserPos();\r\n}", "function updateCoords(){\n storage.write('coords.json', coords);\n}", "function initLoc(position) {\r\n userLoc['lat'] = position.coords.latitude;\r\n userLoc['long'] = position.coords.longitude;\r\n initCSV();\r\n}", "function userSaver(user,geocode){\n return new Promise(function(fulfill,reject){\n var newUser = new User(user)\n newUser.location = {\n type: 'Point',\n coordinates: [geocode.location.lng,geocode.location.lat]\n }\n newUser.save(function(err,user){\n if(err) reject(err)\n fulfill(user)\n })\n })\n}", "function getLocationUser () {\n if (navigator.geolocation) {\n var location_timeout = setTimeout(\"geolocFail()\", 10000);\n \n navigator.geolocation.getCurrentPosition(function(position) {\n clearTimeout(location_timeout);\n \n locationUser.lat = position.coords.latitude;\n locationUser.lng = position.coords.longitude;\n loadNearby()\n // console.log(locationUser)\n }, function(error) {\n clearTimeout(location_timeout);\n console.log('failed to get location')\n });\n } else {\n console.log('failed to get location')\n }\n}", "function getUserLocation() {\n geolocationService.getCurrentPosition()\n .then(function(coords) {\n setUserCoordinates(coords.latitude, coords.longitude);\n geolocationService\n .getAddressName(coords.latitude, coords.longitude)\n .then(function(addressName) {\n $scope.filters.address = addressName;\n $scope.getVenues();\n })\n }, function(){\n $scope.showSpinner = false;\n $scope.noResults = true;\n });\n }", "function loadLocations() {\n// var locations = new Location(0, 0, null);\n var area = new Area(\"University\");\n send(new Arrival(\"area_read\", session, area, true), writeLocations);\n}", "function geoLocation() {\r\n if (navigator.geolocation) { // try to get user's geoLocation\r\n navigator.geolocation.getCurrentPosition (function(position) {\r\n lat = position.coords.latitude;\r\n lon = position.coords.longitude;\r\n });\r\n }\r\n else { // centre on UTSC\r\n lat = 43.78646;\r\n lon = -79.1884399;\r\n }\r\n /* need user's geoLocation before drawing map, so block here\r\n\tuntil geoLocation is determined */\r\n if (lat==null || lon==null) { // keep trying until geoLocation determined\r\n\tsetTimeout(geoLocation, 500);\r\n }\r\n else { // have geoLocation, now draw the map\r\n\tdrawMap([],[]);\r\n }\r\n}", "function getLocation() {\n window.navigator.geolocation.getCurrentPosition((location) => {\n userLat = location.coords.latitude;\n userLon = location.coords.longitude;\n checkParkCoord();\n })\n }", "function updateUserGeo(geoInfo) {\n state.userInfo.geoLocation = {'lat':geoInfo.lat, 'lng':geoInfo.lng};\n}", "function Geography(user) {\n return $http.get('http://prod1.groupz.in:7000/Authenticator?request=' + JSON.stringify(user)).then(handleSuccess, handleError('Error Login'));\n }", "function handle_geolocation_query(position){ \n\tdlat=position.coords.latitude;\n\tdlon=position.coords.longitude; \n}", "function success() {\n localStorage[\"authorizedGeoLocation\"] = 1;\n}", "function UserLocation(position) {\r\n console.log(position.coords.latitude, position.coords.longitude);\r\n NearestCity(position.coords.latitude, position.coords.longitude);\r\n console.log(position.coords.latitude);\r\n }", "function updateUserLocation() {\n if (navigator.geolocation) {\n console.log(\"Getting location\");\n console.log(marker.getPosition().lat());\n navigator.geolocation.getCurrentPosition(function (position) {\n var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);\n console.log(\"New Pos\");\n console.log(latlng.lat());\n marker.setPosition(latlng);\n }, navError);\n console.log(\"Done\");\n console.log(marker.getPosition().lat());\n }\n}", "function onload_map() {\n console.log(\"onload_map\");\n\n readData();\n\n //get user's current location\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function (position) {\n var pos = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n\n latcurrent = pos.lat;\n lngcurrent = pos.lng;\n var marker = new google.maps.Marker({\n position: pos,\n map: map,\n animation: google.maps.Animation.DROP,\n title: \"Now your are here\"\n });\n userLocationMarkers.push(marker);\n\n map.setCenter(pos);\n map.setZoom(13);\n\n readDataUpdatedLocation(latcurrent, lngcurrent)\n\n }, function () {\n handleLocationError(true, infoWindow, map.getCenter());\n });\n } else {\n // Browser doesn't support Geolocation\n handleLocationError(false, infoWindow, map.getCenter());\n }\n}", "function initialize() {\n obtainGeolocation(); \n}", "function askForCoords(){\n navigator.geolocation.getCurrentPosition(handleGeoSuccess, handleGeoError)\n}", "function initiate_geolocation() { \n navigator.geolocation.getCurrentPosition(handle_geolocation_query); \n}", "function endUserLocation() {\n $scope.endUserLocationDetails = true;\n }", "function updateUserMarker() {\n if (bigMap.config.markers.hasOwnProperty('user')) {\n $log.log(TAG + 'updateUserMarker');\n bigMap.config.markers.user.lat = UserLocation.real.lat;\n bigMap.config.markers.user.lng = UserLocation.real.lon;\n }\n }", "function userLocation() {\n if (navigator.geolocation) {\n //geolocation available\n navigator.geolocation.getCurrentPosition(successfulLookup, console.log);\n }\n}", "function updateGEOPosition(position) {\n latData = position.coords.latitude;\n lonData = position.coords.longitude;\n if (!geoDataExists) {\n geoDataExists = true;\n startedTrackingSuccessful();\n }\n }", "function geoloc() {\n let coords = navigator.geolocation.getCurrentPosition((pos) => {\n coords = pos;\n let lat = coords.coords.latitude;\n let long = coords.coords.longitude;\n ll = `?_ll=${lat},${long}`;\n document.querySelector(\".change-hour h1 span\").textContent = \"ma position\";\n getDatas(process);\n });\n}", "function locateUser() {\n\n\t\tlocatingId = navigator.geolocation.watchPosition(geolocationSuccess, geolocationFailed, geolocationOptions);\n\t\t// MsgBox\n\t\tvar msgBox = new MsgBox();\n\t\tmsgBox.show(\"Géolocalisation en cours...\", GEOLOC_DURATION);\n\t\tsetTimeout(stopLocalisation, GEOLOC_DURATION, locatingId);\n\t\tconsole.log('Géolocalisation en cours...');\n\t}", "function updateUserLoc(position) {\n var gpsLocationFB = new Firebase(\"https://envimovilcentral.firebaseio.com/equipos/\" + deviceuuid + \"/gpsLocation\");\n var location = {\n lat : position.coords.latitude,\n lng : position.coords.longitude\n };\n // Update coordinates in localStorage\n localStorage.setItem(\"latitud\",location.lat);\n localStorage.setItem(\"longitud\",location.lng);\n // Update in webview\n $(\"#latitud\").html(location.lat);\n $(\"#longitud\").html(location.lng);\n // Update in FB\n gpsLocationFB.update({\n \"latitud\": location.lat,\n \"longitud\": location.lng\n })\n // Set GeoPoint de la siguiente estacion\n geoFire1.set(\"geoPoint\",[location.lat, location.lng]);\n }", "function centerOnUser() {\n bigMap.config.center = {\n lat : UserLocation.real.lat,\n lng : UserLocation.real.lon,\n zoom: 17\n };\n }", "function refreshLocVariables(){\n\ttargetPoint = false;\n\ttempTin=false;\n\ttin=false;\n\tnearest=false;\n\tnearest_turf=false;\n\tbuffered=false;\n\tptsWithin=false;\n\tmyPoint=false;\n\tcoords_x = []; //define an array to store the lng coordinate\n\tcoords_y = []; //define an array to store the lat coordinate\n\tcoords_z = []; //define an array to store elev coordinate\n\tkeyLocLocation = false;\n}", "function initialLocation() {\n var IPapiKey = \"602f8d85bc584bb4b0b520771a9d3287\";\n var IPapi = \"https://ipgeolocation.abstractapi.com/v1/?api_key=\" + IPapiKey;\n fetch(IPapi)\n .then((r) => r.json())\n .then((d) => {\n // assign user's lat/long to variables place them on the map\n searchLat = d.latitude;\n searchLng = d.longitude;\n initMap()\n });\n}", "geolocate () {\n this.updateGeolocation ((geolocation, position) => {\n this.updateCoordinates(geolocation)\n })\n }", "function onGeolocationSuccess(position) { \n currentLat = position.coords.latitude;\n currentLong = position.coords.longitude;\n}", "function locationSuccess(location) {\n\tconsole.log(\"location: \" + location);\n\t\n\tcurrentUser.Latitude=location.coords.latitude;\n\tcurrentUser.Longitude=location.coords.longitude;\n\t\n\tupdateUser(currentUser.UserID, null, currentUser.FirstName, currentUser.LastName, currentUser.Email, currentUser.Phone, location.coords.latitude, location.coords.longitude, currentUser.UsePayPal, currentUser.PayPalEmail, currentUser.EmailAlert, currentUser.SMSAlert);\n\talert(\"Your location has been updated successfully!\");\n}", "function setCurrentLocation() {\n\n navigator.geolocation.getCurrentPosition(showPosition);\n function showPosition(position) {\n\n localStorage.setItem('lon', '' + position.coords.longitude);\n localStorage.setItem('lat', '' + position.coords.latitude);\n }\n}", "function getGeoData() {\n\n //determine if the handset has client side geo location capabilities\n if(geo_position_js.init()){\n\tgeo_position_js.getCurrentPosition(\n\t\t\t\t\t function(data){\n\t\t\t\t\t \n\t\t\t\t\t LATITUDE = data.coords.latitude;\n\t\t\t\t\t LONGITUDE = data.coords.longitude;\n\n\t\t\t\t\t },\n\n\t\t\t\t\t function(data){\n\t\t\t\t\t alert('could not retrieve geo data');\n\t\t\t\t\t }\n\t\t\t\t\t );\n }\n else{\n\talert(\"Functionality not available\");\n }\n\n\n\n}", "function geolocalizame(){\nnavigator.geolocation.getCurrentPosition(pedirPosicion);\n }", "function fillOutLocation(position) {\n\t//alert(position.coords.latitude + ' , ' + position.coords.longitude);\n\tglobLat =position.coords.latitude;\n\tglobLng =position.coords.longitude;\t\t\t \n}", "function processData(){\n navigator.geolocation.getCurrentPosition(onsuccess, onerror);\n}", "function setUserCoordinates(lat, long) {\n coordinates.latitude = lat;\n coordinates.longitude = long;\n }", "function getUserCoords() {\n\tfunction success(pos) {\n\t\tconst crd = pos.coords;\n\t\tcoordObj.lat = crd.latitude;\n\t\tcoordObj.lon = crd.longitude;\n\t\t// current moment object\n\t\tcoordObj.dateTimeStart = moment().format('YYYY-MM-DDTHH:mm:ss');\n\t\t// // make range 6 days for testing\n\t\tcoordObj.dateTimeEnd = moment().add(6, 'd').format('YYYY-MM-DDTHH:mm:ss');\n\t\t// make range 24 hours for deployable version\n\t\t// coordObj.dateTimeEnd = moment().add(24, 'h').format('YYYY-MM-DDTHH:mm:ss');\n\t\t// call function to reveal container that will hold results. pass coords down to child restau/event display functions\n\t\trevealResultsContainer(coordObj);\n\t}\n\n\t// Creates Warning User denied Geolocation\n\tfunction error(err) {\n\t\t// TODO output error message to HTML\n\t\tconsole.warn(`ERROR(${err.code}): ${err.message}`);\n\t\t// let msg = \"If you don't want us to use your location, you can still make a custom search\";\n\t\t// displayErrorMsg(msg);\n\t}\n\tif (!navigator.geolocation) {\n\t\t// TODO tell user to choose custom search button\n\t\tconsole.log('Geolocation is not supported by your browser');\n\t\t// let msg = \"Geolocation is not supported by your browser, but you can still make a custom search\";\n\t\t// displayErrorMsg(msg);\n\t} else {\n\t\tnavigator.geolocation.getCurrentPosition(success, error);\n\t}\n}", "function createLocations(){\n\n\t//Uptown Areas\n\tlibrary = new Location('Library', 'This is the Library of ' + user.townName + '. It is filled with thousand of books, Magazines, and newspaper articles. Any information you are looking for you will find here. There is a librarian here all the time and you will usually find at least one student studying.', [ancientBook, hiddenTreasureMap, bookOnDecipheringCode, scienceBook, mathBook], [librarian, student], [], 'library');\n\n\thotel = new Location ('Hotel', 'The hotel of ' + user.townName + ' is a hundred year old building with 42 beautiful rooms for travelers, tourists, and businessmen to stay in. There is always front desk help for any needs you have and a bell boy to take care of your luggage.', [roomKeySet, luggage, luggageCart, pillow, elevatorKey], [bellboy, frontDeskHelp], [], 'hotel');\n\n\t//Shopping District Areas\n\tgroceryStore = new Location ('Grocery Store', 'You will find a lot of ' + user.townName + ' shoppers here on the weekend getting their groceries. Any clerk or cashier will be happy to help you get your freshest food and other essential groceries here all at once!', [shoppingBasket, boxOfCereal, rawSteak, priceGun, cashRegister], [cashier, clerk, shopper], [], 'grocery');\n\n\tcoffeeShop = new Location ('Coffee Shop', 'A nice little place to get any type of coffee you would like along with a little something to eat. There is only need for one employee but she is very good and will take care of you. Beware of the hipster that comes in everyday. Regardless anyday of the year is a good time to stop in!', [hotCoffee, icedCoffee, doughnut, muffin, thermos], [employee, hipster], [], 'coffee');\n\n\thardwareStore = new Location ('Hardware Store', 'With aisles and aisles of home and yard improvement items this is the perfect place to get the tool for the job. The owner is a great guy and will always help you plus you will find a contractor or two that will probably be able to help you as well.', [hammer, screwdriver, wrench, shovel, saw], [owner, contractor], [], 'hardware');\n\n\t//Downtown Areas\n\tpoliceStation = new Location ('Police Station', 'You do not want to end up here in the ' + user.townName + ' Police Station. The town is not highly crime plagued but this Station has eight holding cells and twelve officers prepared for anything. Do not be like the crook in here now because the officer will not take it easy on you.', [handcuffs, nightstick, handcuffKey, taser, policeReport], [officer, crook], [], 'police');\n\n\tautoShop = new Location ('Auto Shop', 'This Auto Shop features a six bay garage with four lifts. They have everything possible to fix any vehicle. Mike the mechanic is the best just ask any customer of his! Do not go anywhere else to get your car, truck, or any other motorized vehicle fixed!', [tire, engine, torqueWrench, carJack, alternator], [mechanic, customer], [], 'auto');\n\n\t//Districts\n\tdowntown = new Location ('Downtown', 'This is Downtown ' + user.townName + ' where you will find our lovely Police Station and Auto Shop. If you get into trouble with the law or car problems you will find yourself here. If you travel north from here, you will find yourself in the Shopping District.', [], [], [], 'downtown');\n\n\tshoppingDistrict = new Location ('Shopping District', 'You find yourself in the busy Shopping District of ' + user.townName +'. You see a large grocery store on your right. Across the street from the grocery store you see a road that leads west to Uptown. On one side of this road you see a small coffee shop. Across the street from the coffee shop you see a hardware store. If you take the main road south, you will arrive in Downtown.', [], [], [], 'shopping');\n\n\tuptown = new Location ('Uptown', 'While in Uptown ' + user.townName + ' you will experience a nice laid back area. This part of town includes a library, for the book connoisseurs, and a Hotel for individuals visiting on business or some tourists.If you travel South-East you will find the Shopping District and continue South to get to Downtown', [], [], [], 'uptown');\n}", "setGeoLocation() {\n navigator.geolocation.getCurrentPosition(function (pos) {\n _position.lat = pos.coords.latitude;\n _position.long = pos.coords.longitude;\n });\n }", "function edit_location_map() {\n initialize_add_location_map();\n convert_points_to_markers();\n if (typeof triangles != 'undefined') {\n createCurrentPolygons(triangles);\n placeCurrentPolygonsOnMap(map);\n }\n}", "async function updateUserLocation(req, res, data) {\n\tlet query = '';\n\n\t//Set query based on user types\n\tif (data[1] === 'C') {\n\t\tquery = `\n\t\t\t\tUPDATE clientt\n\t\t\t\tSET C_Location_X = ${data[2]},\n\t\t\t\t\t\tC_Location_Y = ${data[3]}\n\t\t\t\tWHERE u_id = '${data[0]}'\n\t\t`;\n\t} else if (data[1] === 'D') {\n\t\tquery = `\n\t\t\tUPDATE driver\n\t\t\tSET DR_Location_X = ${data[2]},\n\t\t\t\t\tDR_Location_Y = ${data[3]}\n\t\t\tWHERE u_id = '${data[0]}'\n\t`;\n\t}\n\n\ttry {\n\t\tconnection = await oracledb.getConnection(dbconnection);\n\n\t\tresult = await connection.execute(query, {}, { autoCommit: true });\n\n\t\tconsole.log(`Connected to update user location ${data}`);\n\t} catch (error) {\n\t} finally {\n\t\tif (connection) {\n\t\t\tawait connection.close();\n\t\t\t// console.log('Connection ended');\n\t\t}\n\t\tres.status(200).send(result);\n\t}\n}", "function saveLocation() {\n centre = map.getCenter();\n lat=centre.lat();\n lng=centre.lng();\n loc = \"\" + lat + \",\" + lng;\n setCookie( \"WepocoLatLng\", loc, 20 );\n zoom = map.getZoom();\n setCookie( \"WepocoZoom\", \"\" + zoom, 20 );\n return;\n}", "function saveLocation() {\n centre = map.getCenter();\n lat=centre.lat();\n lng=centre.lng();\n loc = \"\" + lat + \",\" + lng;\n setCookie( \"WepocoLatLng\", loc, 20 );\n zoom = map.getZoom();\n setCookie( \"WepocoZoom\", \"\" + zoom, 20 );\n return;\n}", "function getLocation(address, range) {\n var geocoder = new google.maps.Geocoder();\n geocoder.geocode({ \"address\": address }, function (results, status) {\n if (status === google.maps.GeocoderStatus.OK) {\n var latitude = results[0].geometry.location.lat(),\n longitude = results[0].geometry.location.lng(),\n //Create a lat/long with the user address\n point = new Parse.GeoPoint({latitude: latitude, longitude: longitude}),\n user = Parse.User.current();\n\n user.set(\"location\", point);\n user.set(\"workPreferenceRange\", range);\n user.save(null, {\n success: function (user) {\n console.log(\"successfully saved GEO for user\");\n },\n error: function (user, error) {\n console.log(\"An error occured when saving new job...\");\n console.log(error.code + \" \" + error.message);\n }\n });//End of save\n\n } else {//For geocode\n console.log(\"Didn't work.\" + results + \" \" + status);\n }\n });\n }", "function geoSuccess(position) {\n /*\n alert('GEO LOCATION INFO\\n\\n' +\n 'Latitude: ' + position.coords.latitude + '\\n' +\n 'Longitude: ' + position.coords.longitude + '\\n' +\n 'Altitude: ' + position.coords.altitude + '\\n' +\n 'Accuracy: ' + position.coords.accuracy + '\\n' +\n 'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\\n' +\n 'Heading: ' + position.coords.heading + '\\n' +\n 'Speed: ' + position.coords.speed + '\\n' +\n 'Timestamp: ' + position.timestamp + '\\n');\n */\n _session.geolocation = {\"latitude\":position.coords.latitude.toFixed(7), \"longitude\":position.coords.longitude.toFixed(7)};\n saveGeolocation();\n}", "function startUp() {\n getLocation();\n\n }", "function register(username,password,type,location,contact){\n\tif(!fs.existsSync(\"./data/userData/\" + username + \".json\")) {\n\t\tfs.writeFile(\"./data/userData/\" + username + \".json\",\"{}\",function() {\n\t\t\trequest({url: \"https://maps.googleapis.com/maps/api/geocode/json?key=AIzaSyADkEWk0rw92U2RLe3_8z0ejK1MQ-mUs9w&language=en&address=\" + location},\n\t\t\t(error,res,body) => {\n\t\t\t\tif(error) {\n\t\t\t\t\treturn;\n\t\t\t\t}else{\n\t\t\t\t\tvar jsonObj = JSON.parse(body);\n\t\t\t\t\tpostGetLL(username,password,type,location,jsonObj.results[0].geometry.location,contact);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\t\n}", "function getUserLocation() {\n\tif (navigator.geolocation) {\n\t\tnavigator.geolocation.getCurrentPosition(showUserPosition);\n\t} \n}", "function initialize() {\n\t \tnavigator.geolocation.getCurrentPosition(setGeoLocation);\n\t\t}", "function useGeographic() {\n setUserProjection('EPSG:4326');\n}", "fetchGeographicLocation() {\n\t\t//First check if the browser supports geo locations\n\t\tif (navigator.geolocation){\n\t\t\tnavigator.geolocation.getCurrentPosition(\n\t\t\t\t/*anonymous method passed as the first argument used by the getCurrentPosition\n\t\t\t\t method when it was successful, else it calls the error function */\n\t\t\t\t(position) => {\n\t\t\t\t\t//creating a variable to store the coordinates\n\t\t\t\t\tlet crds = position.coords;\n\t\t\t\t\tthis.fetchWeatherData(crds.latitude, crds.longitude);\n\t\t\t\t},\n\t\t\t\t//the method that gets called when an error occurs\n\t\t\t\t() => {\n\t\t\t\t\twindow.alert(\"Error has occurred\");\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}", "function addLocationData(data3) {\n originLatitude = data3[0][0];\n originLongitude = data3[0][1];\n}", "function error() {\n localStorage[\"authorizedGeoLocation\"] = 0;\n}", "function getLocation() {\n $.getJSON( window.apiUrl + '/directions/2/' + window.username + '/', function( data ) {\n console.log(data);\n user = data.user;\n });\n }", "function loadGeoLocation() {\n var q = geoService.initialize();\n q.then(function () {\n $rootScope.position = geoService.position;\n }).catch(function () {\n $rootScope.position = defaultLocation;\n });\n }", "function generateCoordinates() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(\n addPosition, \n geoError,\n { timeout: 10000, enableHighAccuracy: true }\n );\n } else {\n program.showMessage(\"\", \"Vafrinn styður ekki staðsetningartækni\");\n }\n }", "function storeMyLocation(latitude, longitude) {\n\twriteCookie('latitude', latitude);\n\twriteCookie('longitude', longitude);\n}", "function getLocation() {\n navigator.geolocation.getCurrentPosition(function(position) {\n lat = position.coords.latitude;\n lon = position.coords.longitude;\n console.log('lat =' + lat + ', lon =' + lon);\n });\n }", "function getLocation() {\n var currentLon = \"\";\n var currentLat = \"lat=\";\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(loc) {\n //set currentLon & currentLat\n currentLon += loc.coords.longitude;\n currentLat += loc.coords.latitude;\n //fucntions called built on longitude and latitude location\n buildApi(currentLon, currentLat);\n //drawCoords(currentLon, currentLat);\n });\n } else {\n alert(\"You're lost and we can't find you.\");\n }\n }", "function startUp() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(successFunction, errorFunction);\n } \n}", "function connectUserToLocation (userId, name, country, city, postal) {\n const locationId = idGenerator.nextLocationId();\n // log.info('graph.js location name:', name, country, city, postal);\n return cq.query(qb.connectUserToLocation(userId, locationId, name, country, city, postal))\n .then(transformer.location);\n}", "function obtainGeolocation(){\n window.navigator.geolocation.getCurrentPosition(localitation);\n }", "function getgeo() {\n\n $(\"#location-loading\").toggleClass('hidden');\n console.log(\"getting location...\")\n navigator.geolocation.getCurrentPosition(function (location) {\n\n console.log(location.coords.latitude);\n console.log(location.coords.longitude);\n console.log(location.coords.accuracy);\n\n var s = document.createElement('script');\n s.src = 'https://nominatim.openstreetmap.org/reverse?json_callback=cb&format=json&lat=' + location.coords.latitude + '&lon=' + location.coords.longitude + '&zoom=27&addressdetails=1';\n document.getElementsByTagName('head')[0].appendChild(s);\n\n //Set location cookie\n document.cookie = location.coords.latitude + \",\" + location.coords.longitude;\n });\n}", "function cargarPosicionDelUsuario() {\n window.navigator.geolocation.getCurrentPosition(\n // Callback de éxito.\n function (pos) {\n posicionDelUsuario = {\n latitude: pos.coords.latitude,\n longitude: pos.coords.longitude\n };\n inicializarMapa();\n },\n // Callback de error.\n function () {\n posicionDelUsuario = {\n latitude: -34.903816878014354,\n longitude: -56.19059048108193\n };\n inicializarMapa();\n }\n );\n}", "function getCoords() {\n // Making use of the navigator.geolocation property which gives access to user location\n if (navigator.geolocation) {\n // After declaring variable and learning we are using the navigator.geolocation property, we are not calling for the position and asking for display of position\n navigator.geolocation.getCurrentPosition(displayPosition);\n\n // Making use of an else statement which says to say not available otherwise\n } else {\n userLocation.innerHTML = \"Not available\";\n }\n}", "function loadCoords() {\n const loadedCoords = localStorage.getItem('coords');\n if (loadedCoords === null) {\n askForCoords();\n } else {\n const parsedCoords = JSON.parse(loadedCoords);\n const latitude = parsedCoords.latitude;\n const longitude = parsedCoords.longitude;\n getWeather(latitude, longitude);\n }\n }", "function GetCurrentLocation() {\n // chek deafault user coordinates\n if (Modernizr.geolocation) {\n navigator.geolocation.getCurrentPosition(success, options);\n var options = {\n enableHighAccuracy: true,\n timeout: 5000,\n maximumAge: 0\n };\n function success(pos) {\n var crd = pos.coords;\n // transfer current user coordinates to default\n window.centerLat = crd.latitude;\n window.centerLng = crd.longitude;\n }\n } else {\n console.log('location error');\n }\n} // GetCurrentLocation", "async getCoords() {\n try {\n const data = await getCurrentLocation();\n this.coords = [data.coords.latitude, data.coords.longitude];\n } catch (error) {\n console.log(error);\n }\n }", "function startGeolocation() {\n geolocation = true;\n\n\t/** On met à jour la position de l'utilisateur toutes les trois secondes. */\n var options = { maximumAge: 5000, frequency: 5000, enableHighAccuracy: true };\n\n watchID = navigator.geolocation.watchPosition(onLocationSuccess, onLocationError, options);\n\n\t// old_loc = map.getCenter();\n\t// init_lat = old_loc.jb;\n\t// init_long = old_loc.kb;\n}", "function onLocationFound(e) {\n console.log(e); \n userPositionCircle.setLatLng([e.latitude, e.longitude]);\n window.motonWalkingTour.currentUserPosition.lat = e.latitude;\n window.motonWalkingTour.currentUserPosition.lng = e.longitude; \n \n}", "function initMap() {\n\n infoWindow = new google.maps.InfoWindow;\n\n // Try HTML5 geolocation.\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n var pos = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n userLongitude = position.coords.longitude;\n userLatitude = position.coords.latitude;\n\n getUserCityName();\n\n }, function() {\n // hardcoding user's location to Evanston if user does not allow to disclose their location\n handleLocationError(true, infoWindow);\n userLongitude = -87.6818861111;\n userLatitude = 42.0497277778;\n getUserCityName();\n });\n } else {\n // Browser doesn't support Geolocation\n handleLocationError(false, infoWindow);\n }\n}", "function grantLocationAccess() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(position => {\n coords.lat = position.coords.latitude;\n coords.long = position.coords.longitude;\n\n giveLatLong(coords.lat, coords.long);\n });\n }\n}", "function watchLocation() {\n var gcp = navigator.geolocation.getCurrentPosition(\n updateUserLoc, onLocationError, {\n enableHighAccuracy: true\n });\n //console.log(gcp);\n }", "function saveDataLocally() {\n chrome.storage.local.set({\n 'locationData': locations\n })\n}", "function savePosition() {\r\n\t//map.savePosition();\r\n\tGMO.savePosition(map);\r\n\tGMO.updateStatus(\"Position saved.\");\r\n\treturn true;\r\n}", "function getLocalizacao() {\r\n \r\n if(navigator.geolocation){ \r\n navigator.geolocation.getCurrentPosition(mapSetup);\r\n }\r\n}", "function geolocationOnSuccess(position) {\n localStorage.setItem('lat', position.coords.latitude);\n localStorage.setItem('lon', position.coords.longitude);\n\n if(FileHandler.getFileSystem() == null) {\n FileHandler.data.fsIsInit = false;\n FileHandler.initializeFileSystem(function() {\n app.receivedEvent('content');\n });\n } else {\n app.receivedEvent('content');\n }\n}", "function success(position) {\n state.userLat = position.coords.latitude;\n state.userLng = position.coords.longitude;\n state.userLoc = { lat: state.userLat, lng: state.userLng };\n initMap();\n}", "function GeographyAccounts(user) {\n return $http.get('http://prod1.groupz.in:7000/Authenticator?request=' + JSON.stringify(user)).then(handleSuccess, handleError('Error Login'));\n }", "function UserLocation(position) {\r\n NearestCity(position.coords.latitude, position.coords.longitude);\r\n}", "function getLocation(location) {\n\t lat = location.coords.latitude;\n\t lng = location.coords.longitude;\n\t\tgetVenues();\n\t}", "function GeoOnSuccess(position) {\n\tlatitude = position.coords.latitude;\n\tlongitude = position.coords.longitude;\n}", "function getUserLocation() {\r\n\t// Global variable\r\n\r\n\tif (navigator.geolocation) {\r\n\t\tnavigator.geolocation.getCurrentPosition(showPosition, showError);\r\n\t} else {\r\n\t\tuserLocation.innerHTML = \"Your browser does not support this feature.\";\r\n\t}\r\n}", "function getUserLatLong() {\n lat = localStorage.getItem('originLat');\n long = localStorage.getItem('originLong');\n var userLatString;\n var userLongString;\n if (lat.startsWith('-')) {\n userLatString = lat.substr(0,9);\n } else {\n userLatString = lat.substr(0,8);\n };\n \n if (long.startsWith('-')) {\n userLongString = long.substr(0,9);\n } else {\n userLongString = long.substr(0,8);\n }\n parsedLatLong = `${userLatString},${userLongString}`\n localStorage.setItem('locLatLong', parsedLatLong);\n}", "function initialize() {\n \n // google.maps.visualRefresh = true;\n getCookies();\n mapOption();\n\n if(navigator.geolocation) {\n //define callback functions to handle succesful or failed current position estimation\n navigator.geolocation.getCurrentPosition(cbGetCurPosOK, cbGetCurPosFail);\n } else {\n //browser does not support geolocation \n alert('Your browser doesn\\'t support geolocation.')\n }\n \n // callback for successful getCurrentPosition \n function cbGetCurPosOK(position) {\n \n //build a current position \n curPosition = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);\n setCookie('mylocation',curPosition,cookieExpire);\n\n if(municipalitesFromCookies==0){zoomMyLocation();}\n\n }\n\n // callback for failed getCurrentPosition \n function cbGetCurPosFail(error) {\n switch(error.code) {\n case error.PERMISSION_DENIED:\n alert(\"User denied the request for Geolocation.\");\n break;\n case error.POSITION_UNAVAILABLE:\n alert(\"Location information is unavailable.\");\n break;\n case error.TIMEOUT:\n alert(\"The request to get user location timed out.\");\n break;\n case error.UNKNOWN_ERROR:\n alert(\"An unknown error occurred.\")\n break;\n }\n }\n \n }//******Tελος function initialize******//", "function initGeoPosition() {\n // watchID can be used to disable continuous geolocation tracking.\n watchID = navigator.geolocation.watchPosition(function(position) {\n // Set the center of the map to the user's location.\n var currPosition = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n user.center.setPosition(currPosition);\n googleMapObject.setCenter(currPosition);\n googleMapObject.panTo(currPosition);\n googleMapObject.setZoom(18);\n });\n}", "function compute(){\n var newLocations = locations;\n newLocations.forEach(function(currentValue,currentIndex){\n for(num in currentValue.loc){\n if (num == \"latitude\"){\n var c = currentValue.loc.latitude;\n lat.push(c);\n } else if (num == \"longitude\") {\n var d = currentValue.loc.longitude;\n lon.push(d);\n }\n }\n});\n}", "function getCurrentLocation() {\n \n function success(position) {\n //if permission granted set call [setAddress()] to convert lat and long to street adresss\n lat = position.coords.latitude;\n lon = position.coords.longitude;\n setAddress();\n }\n function denied() {\n // if permission is denied set Ticket Master queries to defualt to \"Washington\"(city) and DC (state)\n // console.log('Unable to retrieve your location');\n searchAddress=\"\";\n searchCity = \"Washington\";\n searchState = \"DC\";\n startPoint = searchCity + \", \" + searchState;\n // Call to main to set defualts other than location [setTime() default && setCategory() defualt]\n main();\n }\n if (!navigator.geolocation) {\n // console.log('Geolocation is not supported by your browser');\n } else {\n // console.log('Locating…');\n navigator.geolocation.getCurrentPosition(success, denied);\n }\n }", "function getLocation() {\n function showPosition(position) {\n\n startLat = position.coords.latitude;\n startLng = position.coords.longitude;\n\n //Request the formatted address of the users current coordinates and saves them in userAddress variable\n var URL = \"https://maps.googleapis.com/maps/api/geocode/json?latlng=\" + startLat + \",\" + startLng + \"&key=AIzaSyCMRNMvB_hrPmwoHo_pkOvAfIOI5IMuMsA\";\n $.ajax({\n url: URL,\n method: \"GET\"\n }).done(function(response) {\n userAddress = response.results[\"0\"].formatted_address;\n console.log(\"User's address from browser: \" + userAddress);\n //Once the user's address is saved in the userAddress variable, call the initMap function to load the map\n initMap();\n });\n };\n //if geolocation is supported, the getCurrentPosition will be called\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(showPosition);\n }\n else {\n lattitude.innerHTML = \"Geolocation is not supported by this browser.\";\n }\n}", "function updateData(new_lat, new_lon, new_acc){\n lat = new_lat;\n lon = new_lon;\n acc = new_acc;\n showPosition();\n}", "function getLocation() {\n coord = null;\n // coord = Alloy.Globals.getCurrentLocation();\n if (Ti.Geolocation.locationServicesEnabled) {\n Ti.Geolocation.purpose = \"Receive User Location\";\n Titanium.Geolocation.getCurrentPosition(function(e) {\n coord = e.coords;\n // coord = {\n // latitude : 19.0760,\n // longitude : 72.8777\n // };\n //Ti.API.info('current locations ' + JSON.stringify(coord));\n if (coord != null) {\n\n if (args.inStore) {\n //Ti.API.info('do nthing');\n getDirectionforInStore();\n } else {\n ///\n\n showLoader($.findStore);\n //now calling store locator web service\n var param = {\n latitude : coord.latitude,\n longitude : coord.longitude,\n filter : \"All\",\n storetype : \"All\"\n };\n\n var requestMethod = Alloy.Globals.commonUrl.storeList;\n var requestParams = JSON.stringify(param);\n //Ti.API.info('request Param--->' + requestParams);\n Alloy.Globals.webServiceCall(requestMethod, requestParams, _getStoreListSuccessCallback, _getStoreListErrorCallback, \"POST\", $.findStore);\n ////\n }\n } else {\n coord = null;\n //display message that location is not enabled\n setTimeout(function() {\n geolocation();\n }, 1500);\n showAlert($.findStore, \"Allow location access for D'Decor app by going to Settings\");\n\n }\n\n });\n } else {\n coord = null;\n setTimeout(function() {\n geolocation();\n }, 1500);\n //display message that location is not enabled\n showAlert($.findStore, \"Allow location access for D'Decor app by going to Settings\");\n\n }\n\n}", "function geolocation() {\n if (navigator.geolocation) {\n //checks if browser supports the html5 geolocation api\n navigator.geolocation.getCurrentPosition(fillCoordinates, handleError);\n /* if user location is retrieved properly calls the fillCoordinates function, passing a geolocation object\n containing the user location, otherwise calls the handleErrr function passing an error object containig \n information about the error\n */\n } else {\n window.alert(\"Your browser doesn't support this feature\");\n }\n}", "function updateUserLocationOnMap() {\n\n\t//clear existing markers\n\tclearMarkers();\n\n\tvar currentUser = getCurrentUser();\n\tvar currentUserPosition;\n\tif (currentUser != null) {\n\t\tcurrentUserPosition = [currentUser.Latitude, currentUser.Longitude];\n\t} else {\n\t\t//set the location to Tech Tower\n\t\tcurrentUserPosition = [33.772457, -84.394699];\n\t}\n\n\tvar newPosition = new google.maps.LatLng(currentUserPosition[0], currentUserPosition[1]);\n\t/*\n\t var infowindow = new google.maps.InfoWindow({\n\t map: map,\n\t position: newPosition,\n\t content: 'You are here.'\n\t });\n\t */\n\tvar marker = new google.maps.Marker({\n\t\tposition : newPosition,\n\t\tmap : map,\n\t\tanimation : google.maps.Animation.BOUNCE, //or DROP\n\t\ttitle : 'You are here.'\n\t});\n\n\tmarkers.push(marker);\n\n\tsetMarkers();\n\n\tmap.setCenter(newPosition);\n\tmap.setZoom(16);\n\n}", "function geoFindUser() {\n\t\tif (!navigator.geolocation) {\n\t\t\tconsole.log('Geolocation is not supported by your browser');\n\t\t\treturn;\n\t\t}\n\n\t\tfunction success(position) {\n\t\t\tlat = position.coords.latitude;\n\t\t\tlng = position.coords.longitude;\n\t\t\tconsole.log('Latitude is ' + lat + '° Longitude is ' + lng + '°');\n\t\t};\n\n\t\tfunction error() {\n\t\t\tconsole.log('Unable to retrieve your location');\n\t\t};\n\n\t\tnavigator.geolocation.getCurrentPosition(success, error);\n\t}", "function getGeoLocation() {\n \"use strict\";\n var cords = [];\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function (position) {\n cords.push(position.coords.latitude);\n cords.push(position.coords.longitude);\n //When you take them, use them to find the weather\n getWeatherFromCords(cords);\n });\n }\n}", "function setLocation() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition((position) => {\n coords = { lat: position.coords.latitude, lng: position.coords.longitude }\n\n deleteMarkers();\n\n // var options = {\n // zoom: 14,\n // center: coords\n // }\n\n // map = new google.maps.Map(document.getElementById('map'), options);\n map.setCenter(coords);\n\n // Adding marker to my current place\n\n var CenterMarker = new google.maps.Marker({\n draggable: true,\n position: coords,\n map: map,\n icon: 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png'\n });\n\n markers.push(CenterMarker);\n \n // update the lattitude and longitude of user loaction when the marker position is changed\n google.maps.event.addListener(CenterMarker, 'dragend', function (evt) {\n coords = {lat: this.getPosition().lat(), lng: this.getPosition().lng()};\n // map.setCenter(coords);\n });\n\n })\n }\n}", "function useDefaultLocation(err) {\n\n console.log(err) // Log why we couldn't get the user's location\n\n // Near 1500 RDU Center Drive\n var defaultPosition = {\n coords: {\n latitude: 35.851579,\n longitude: -78.795865\n }\n }\n\n // Populate the map using the default location\n populateMap(defaultPosition)\n }" ]
[ "0.60776955", "0.60209423", "0.59454125", "0.594161", "0.59287", "0.59218365", "0.5822929", "0.5792822", "0.5780386", "0.5771821", "0.57523644", "0.56890523", "0.5651212", "0.5642401", "0.5626813", "0.5621031", "0.5605669", "0.5597776", "0.55772036", "0.55746543", "0.5565297", "0.5543943", "0.5532697", "0.55216515", "0.55106413", "0.54944956", "0.54844004", "0.5472761", "0.5470584", "0.5469686", "0.5464473", "0.5455257", "0.54548156", "0.5433422", "0.5423178", "0.54090405", "0.54048836", "0.5404258", "0.54010344", "0.5398703", "0.53889203", "0.5388569", "0.5378034", "0.53737336", "0.5372868", "0.5366453", "0.5366453", "0.53663045", "0.5363293", "0.5351993", "0.53516835", "0.5346154", "0.53431517", "0.53395426", "0.5333699", "0.5331688", "0.5319385", "0.53170156", "0.53156996", "0.53144366", "0.5309098", "0.53088707", "0.5295939", "0.5287699", "0.5282646", "0.5277511", "0.527393", "0.5273372", "0.52723897", "0.5271538", "0.52691495", "0.5267799", "0.5264113", "0.5260175", "0.5258683", "0.5258364", "0.5258216", "0.5255539", "0.5247821", "0.52376556", "0.5234469", "0.5229332", "0.522577", "0.52249765", "0.5223891", "0.5221473", "0.52187866", "0.52180827", "0.5211989", "0.52042645", "0.519824", "0.5196129", "0.51934856", "0.5188846", "0.5188002", "0.5184006", "0.5175892", "0.517504", "0.51699376", "0.51696163", "0.51663184" ]
0.0
-1
This will get called after getCurrentPosition()
function showPosition(position) { // Grab coordinates from the given object var lat = "lat=" + position.coords.latitude.toFixed(2); var lon = "lon=" + position.coords.longitude.toFixed(2); userLocation = lat + "&" + lon console.log(userLocation); // for now this simply shows me the string to make an ajax call let localWxRqst = wxApi + "weather?" + userLocation + wxKey console.log(localWxRqst); // Call next function to get wx data NEEDS TO BE TURNED OFF FOR NOW callWxData(userLocation); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setLastPos() {\n this.previousPos = this.getCurrentPosition();\n }", "recalculateLastPosition() {\n this._positionStrategy.reapplyLastPosition();\n }", "_getPosition() {\r\n navigator.geolocation.getCurrentPosition(this._loadMap.bind(this), function () {\r\n alert(\"Can't get your current position 😥\");\r\n });\r\n }", "updatePosition() {\n if (this._positionStrategy) {\n this._positionStrategy.apply();\n }\n }", "requestUpdatePosition () {\n this.positionUpdateNeeded = true;\n }", "_getPosition() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(\n this._loadMap.bind(this),\n function () {\n AudioListener(\"Could not get your position\");\n }\n );\n }\n }", "function getPosition() {\n\n\t//change time box to show updated message\n\t$('#time').val(\"Getting data...\");\n\n\t//instruct location service to get position with appropriate callbacks\n\tnavigator.geolocation.getCurrentPosition(successPosition, failPosition);\n}", "_onMoveEnd() {\n this._map.locate({\n 'watch': true,\n 'setView': false,\n 'enableHighAccuracy': true,\n });\n }", "function onGetCurrentLocation () {\n geocodeByCurrentLocation();\n return false;\n}", "updatePosition() {\n this.position = getPositionForPopup(this.mapFeature);\n this.draw();\n }", "function handlerPositionUpdate () {\n var position = svl.panorama.getPosition();\n handlerPovChange(); // handle pov change\n\n // Store the current status\n// if ('storage' in svl) {\n// svl.tracker.save();\n// svl.labelContainer.save();\n// svl.map.save();\n// svl.task.save();\n// }\n\n // End of the task if the user is close enough to the end point\n if ('task' in svl) {\n if (svl.task.isAtEnd(position.lat(), position.lng(), 10)) {\n svl.task.endTask();\n }\n }\n }", "function initCurrentPosition(thishash){\n current_position_marker = mapnav.flagHash(thishash);\n current_position_marker.setOptions({\n draggable: true,\n animation: google.maps.Animation.DROP,\n icon: curPos.startImage\n });\n \n google.maps.event.addListener(current_position_marker, 'mouseover', function(event){\n current_position_marker.setIcon(curPos.hoverImage);\n });\n \n google.maps.event.addListener(current_position_marker, 'mouseout', function(event){\n current_position_marker.setIcon(curPos.startImage);\n });\n \n google.maps.event.addListener(current_position_marker, 'mousedown', function(event){\n current_position_marker.setIcon(curPos.heldImage);\n });\n \n google.maps.event.addListener(current_position_marker, 'mouseup', function(event){\n current_position_marker.setIcon(curPos.startImage);\n });\n\n google.maps.event.addListener(current_position_marker, 'dragend', function(event){\n var newlocation = current_position_marker.getPosition();\n var thishash = geohash(newlocation.lat(), newlocation.lng());\n updateConsole(newlocation.lat(), newlocation.lng(), '', thishash); \n //getPosts(thishash);\n current_position_marker.setIcon(curPos.startImage);\n\n });\n}", "pushCurrentPosition() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n this._tryPushCurrentPosition();\n }", "updatePosition() {\n this.position = Utils.convertToEntityPosition(this.bmp);\n }", "set currentPosition(val) {\n if (!this.currentPositionInternal || this.currentPositionInternal.coords !== val.coords) {\n this.currentPositionInternal = val;\n this.currentPositionListener.forEach(function (listener) {\n listener.function(val);\n });\n }\n }", "getCurrentPosition() {\n window.navigator.geolocation.getCurrentPosition(currPosition => {\n const { latitude, longitude } = currPosition.coords;\n const position = [ latitude, longitude ];\n this.setState(Object.assign({}, this.state, {\n position,\n currPosition: position,\n }));\n\n this.props.sendCurrentPosition(position);\n });\n }", "onMove() {\n }", "apply() {\n this._positionStrategy.apply();\n }", "function update_position() {\r\n if (!error_state) {\r\n if (prev_time + 50 < Date.now()) {\r\n prev_time = Date.now();\r\n //50 ms + 5ms to account for drift, measured to be around 5ms per update cycle.\r\n local_track.position += 55;\r\n update_controls_UI();\r\n }\r\n }\r\n }", "function current_position() {\r\n if(navigator.geolocation) {\r\n browserSupportFlag = true;\r\n navigator.geolocation.getCurrentPosition(function(position) {\r\n initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);\r\n map.setCenter(initialLocation);\r\n\r\n var marker = new google.maps.Marker({\r\n position: initialLocation,\r\n map: map,\r\n title: 'votre position',\r\n icon:'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=' + '|20D699' \r\n }); \r\n\r\n }, function() {\r\n handleNoGeolocation(browserSupportFlag);\r\n });\r\n }\r\n // Browser doesn't support Geolocation\r\n else {\r\n browserSupportFlag = false;\r\n handleNoGeolocation(browserSupportFlag);\r\n }\r\n function handleNoGeolocation(errorFlag) {\r\n if (errorFlag == true) {\r\n \r\n initialLocation = myLatLng;\r\n var marker = new google.maps.Marker({\r\n position: myLatLng,\r\n map: map,\r\n title: 'votre position',\r\n icon:'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=' + '|20D699' \r\n }); \r\n } else {\r\n \r\n initialLocation = myLatLng;\r\n }\r\n map.setCenter(initialLocation);\r\n }\r\n}", "function getPositionSuccess(position) {\n logger.info(\"Latitude: \" + position.coords.latitude +\" Longitude: \" + position.coords.longitude);\n vm.currentCoordinates = {lat: position.coords.latitude, lng: position.coords.longitude};\n drawMap(vm.currentCoordinates);\n }", "function updatePosition() {\n\t\n\t//change time box to show updated message\n\t$('#time').val(\"Getting data...\");\n\t\n\t//instruct location service to get position with appropriate callbacks\n\twatchID = navigator.geolocation.watchPosition(successPosition, failPosition, locationOptions);\n}", "updatePositions(){\n this.api.get_positions(this.apiPositionListener)\n }", "function recordLocation() {\r\n nav.getCurrentPosition(navHandler, errorHandler, options);\r\n }", "componentWillMount() {\n navigator.geolocation.getCurrentPosition(({coords})=>{\n var lastPosition = {longitude: coords.longitude, latitude: coords.latitude};\n this.state.lastPosition = lastPosition;\n });\n }", "function onUpdatePosition() {\n gridDotUpper.position = position;\n gridDot.position = position;\n gridDotMiddle.position = position;\n\n if (guitarString) {\n guitarString.updateDotPosition(self);\n }\n }", "_updatePosition() {\n const position = this._overlayRef.getConfig().positionStrategy;\n const origin = this._getOrigin();\n const overlay = this._getOverlayPosition();\n position.withPositions([\n Object.assign(Object.assign({}, origin.main), overlay.main),\n Object.assign(Object.assign({}, origin.fallback), overlay.fallback)\n ]);\n }", "function startingLocation() {\n\t\tTitanium.Geolocation.getCurrentPosition( getStartingPosition );\n\t}", "geolocate () {\n this.updateGeolocation ((geolocation, position) => {\n this.updateCoordinates(geolocation)\n })\n }", "function getPosition()\r\n{\r\n if (navigator.geolocation && !ranOnce)\r\n {\r\n let positionOptions = {\r\n enableHighAccuracy: true,\r\n timeout: Infinity,\r\n maximumAge: 0\r\n };\r\n \r\n navigator.geolocation.watchPosition(showCurrentLocation, errorHandler, positionOptions);\r\n }\r\n}", "function getPosition() {\n if (navigator.geolocation) {\n $(\".button-fill-coords\").html(\"Fetching Values...\");\n navigator.geolocation.getCurrentPosition(showPosition, showError);\n } else {\n test.html(\"Geolocation not supported on this browser.\");\n }\n// console.log(\"bonjour...\"); //fpr testing purposes\n }", "newPosition(position) {\n this.position = position;\n }", "_customLocation() {\n if (this.state.somewhereElse) {\n this.getCoordsByAddress();\n } else {\n this._onForward();\n }\n }", "function _getLocation_return(position) {\n position.latitude=position.coords.latitude;\n position.longitude=position.coords.longitude;\n App.Modules.GPS.position=position;\n App.Modules.GPS.history.push(position);\n if(App.Modules.GPS.history.length>10){\n App.Modules.GPS.history.shift();\n } \n _dispatchUpdateCallbacks( );\n }", "requestCurrentPosition() {\n\n var options = {\n enableHighAccuracy: true,\n timeout: 5000,\n maximumAge: 0\n }\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition((pos) => {\n var crd = pos.coords;\n const x = crd.latitude;\n const y = crd.longitude;\n this.setState({\n userLat: x\n });\n this.setState({\n userLng: y\n });\n }, this.error, options);\n }\n\n }", "function updatePosition(position) {\n console.log(\"Updating GPS position.\");\n // Update the current position and update the main app screen.\n currentPosition = position.coords.latitude + \",\" + position.coords.longitude;\n}", "updatePositions() {\n throw 'not implemented';\n }", "function setCurrentPosition(pos) {\n currentPositionMarker = new google.maps.Marker({\n map: map,\n position: new google.maps.LatLng(\n pos.coords.latitude,\n pos.coords.longitude\n ),\n title: \"Current Position\"\n });\n map.panTo(new google.maps.LatLng(\n pos.coords.latitude,\n pos.coords.longitude\n ));\n }", "function onGeolocationSuccess(position) { \n currentLat = position.coords.latitude;\n currentLong = position.coords.longitude;\n}", "function cbGetCurPosOK(position) {\n \n //build a current position \n curPosition = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);\n setCookie('mylocation',curPosition,cookieExpire);\n\n if(municipalitesFromCookies==0){zoomMyLocation();}\n\n }", "ngOnInit() {\n if (this._position == 'center' && this.origin != null) {\n this._position = this._computePositionFromOrigin(this.origin);\n }\n }", "setPosition() {\r\n if (!this.object) return;\r\n this.updatePosition();\r\n }", "function success(position){\n currentCoords = [position.coords.longitude, position.coords.latitude]\n CurrentLocationMarker(currentCoords);\n}", "updatePosition() {\n const position = this.overlayRef.getConfig().positionStrategy;\n position.withPositions([\n POSITION_MAP[this.placement].position,\n ...DEFAULT_POPOVER_POSITIONS,\n ]);\n }", "updatePosition(position) \n {\n this.position = position;\n }", "function showlocation() {\n // position request.\n navigator.geolocation.getCurrentPosition(callback);\n }", "function getPosition(){\n\t\tnavigator.geolocation.getCurrentPosition(mysuccess, fail,{\n\t\t\t\tenableHighAccuracy:true,\n\t\t\t\ttimeout:100000,\n\t\t\t\tmaximumAge:Infinity\n\t\t}); \n\t}", "function getPosition(event){\nevent.preventDefault();\nnavigator.geolocation.getCurrentPosition(showPosition)\n}", "function handleLocationSuccess(position) {\n return cb(null, position);\n }", "handleCenterToLocation() {\n if (this.geolocation_ === null) {\n this.initGeoLocation_();\n }\n if (!this.geolocation_.getTracking()) {\n this.initFeatureOverlay_();\n this.getMap().getView().setZoom(17);\n this.geolocation_.setTracking(true);\n } else {\n this.clearFeatureOverlay_();\n this.geolocation_.setTracking(false);\n }\n }", "function handlePositionChange(e) {\n overlay.setPosition(e.position.x, e.position.y, e.position.z);\n overlay.translate();\n //overlay.refresh();\n }", "function showCurrentLocation(position) {\r\n mainPosition = new google.maps.LatLng(\r\n position.coords.latitude,\r\n position.coords.longitude\r\n );\r\n map.setCenter(mainPosition);\r\n markers[0].position = mainPosition;\r\n markers[0].title = \"Your current position\";\r\n if (onNaviMode) {\r\n calcRoute();\r\n } else {\r\n markers[0].setMap(map);\r\n }\r\n}", "function processCurrentposition (data) {\n controls.setPosition(parseInt(data))\n}", "function watchCurrentPosition() {\n var positionTimer = navigator.geolocation.watchPosition(\n function (position) {\n if(posMarker){\n setMarkerPosition(posMarker, position);\n }\n else{\n createMarker(position.coords.latitude, position.coords.longitude, 'Current Location');\n }\n }\n );\n}", "reapplyLastPosition() {\n if (!this._isDisposed && (!this._platform || this._platform.isBrowser)) {\n this._originRect = this._getOriginRect();\n this._overlayRect = this._pane.getBoundingClientRect();\n this._viewportRect = this._getNarrowedViewportRect();\n const lastPosition = this._lastPosition || this._preferredPositions[0];\n const originPoint = this._getOriginPoint(this._originRect, lastPosition);\n this._applyPosition(lastPosition, originPoint);\n }\n }", "function processCurrentposition(data) {\n var pos = parseInt(data);\n setPosition(pos);\n}", "function gpsCallback(_coords){\n\tTi.API.info('win2.js gpsCallback(_coords) function affecting mapView.setLocation({}); Latitude: ' + _coords.latitude + ' Longitude: ' + _coords.longitude);\n\tmapView.setLocation({\n\tlatitude: _coords.latitude,\n\tlongitude: _coords.longitude,\n\tanimate: true\n\t});\n\n}", "function setPosition(position) {\r\n\t SetLocation(position.coords.latitude, position.coords.longitude);\t\r\n\t }", "returnToLastPos() {\n if (this.previousPos) {\n this.x = this.previousPos.x\n this.y = this.previousPos.y\n }\n }", "function updatePosition() {\n\tcheckConnection();\n\t//change time box to show updated message\n\t$('#time').val(\"Getting data...\");\n\t\n\t//instruct location service to get position with appropriate callbacks\n\twatchID = navigator.geolocation.watchPosition(successPosition, failPosition, locationOptions);\n console.log(\"geolocation start: \" + watchID);\n}", "function onSuccess(position) {\n self.setCoords(position);\n deferred.resolve();\n }", "function _showMyMarkerPosition() {\n\n var position = get_last_position();\n\n if (getMap() != null && position != null) {\n try {\n\n if (UserMarker.marker == null) {\n UserMarker.marker = new google.maps.Marker({\n position: position,\n // icon: UserMarker.symbol,\n map: getMap()\n });\n }\n\n UserMarker.marker.setPosition(position);\n //UserMarker.marker.setMap(getMap())\n // IF USER MOVE WITH GPS MOVE MOVE THE MAP IF USER HAVENT MOVE MAP.\n if (_this.centerMe.visible == false) {\n centerUser();\n }\n } catch (e) {\n console.error(e);\n }\n }\n }", "active() {\n // set the animation for active marker\n this.marker.setAnimation(google.maps.Animation.BOUNCE);\n // set it back to normal after 4 seconds\n setTimeout(() => {\n this.marker.setAnimation(null);\n }, 800);\n // update location info section\n updateLocation(this);\n }", "function successPosition(position) {\n long = position.coords.longitude;\n lat = position.coords.latitude;\n var current = new google.maps.LatLng(lat, long);\n setloc(current, 12);\n}", "function updateCurrentLocation(roomLat,roomLng) {\n if (!userHasGPSCoordinates ){\n userHasGPSCoordinates = true;\n currentPosition = new google.maps.LatLng(roomLat, roomLng);\n }\n}", "function getcurentposition() {\n\tnavigator.geolocation.getCurrentPosition(GeoOnSuccess, GeoOnError, {enableHighAccuracy: true});\n}", "function successGeolocation(position) {\n\n console.log(\"Got a GPS lock for the first time. Sending position to Foursquare.\");\n\n // Go back to the main app screen, remove the \"waiting for gps\" screen.\n $('#waiting-view').removeClass('move-up');\n $('#waiting-view').addClass('move-down');\n\n // Used to display position on the main app screen, the latitude and longitude rounded to 3 decimal places.\n currentPosition = position.coords.latitude + \",\" + position.coords.longitude;\n updateFoursquareVenues();\n // If we currently had a watchPosition setup, then clear it.\n if (positionInterval) {\n navigator.geolocation.clearWatch(positionInterval);\n }\n // Set up a watchPosition to constantly poll the device for its location. On success updatePosition gets called.\n positionInterval = navigator.geolocation.watchPosition(updatePosition, noPositionFound, { enableHighAccuracy: true, maximumAge: 0 });\n}", "function successfulPosition(position) {\n userPosition = position.coords;\n addToMap();\n webSecurity();\n}", "function setPosition(position) {\n\tglobalPos.latitude = position.coords.latitude;\n\tglobalPos.longitude = position.coords.longitude;\n\t\n\tconsole.log(\"globalLat: \" + globalPos.latitude + \", globalLong: \" + globalPos.longitude);\n\tcheckSound();\n\tprintPosition(position);\n\t\n}", "function initCurrentLocation() {\n if (!navigator.geolocation) {\n console.log('지도API가 실행불가능한 브라우저입니다.');\n } else {\n navigator.geolocation.getCurrentPosition(success, error, options);\n }\n}", "function failedPosition() {\n userPosition = [48.8566, 2.3522]; // failed position Paris, Fr\n addToMap();\n webSecurity();\n}", "get position() { return this._position; }", "get position() { return this._position; }", "_complete() {\n this._resetCurrent(true);\n\n super._complete();\n }", "function currentPosition(event) {\n event.preventDefault();\n navigator.geolocation.getCurrentPosition(requestPosition);\n}", "function handleUpadateLocation() {\n resetMap();\n}", "function handleGeolocateSuccess(position) {\n\t\t\tvar pos = new OpenLayers.LonLat(position.coords.longitude, position.coords.latitude);\n\n\t\t\t//add marker at current position\n\t\t\tvar feature = map.addGeolocationResultMarker(pos);\n\n\t\t\t//show current position as address in the Ui pane\n\t\t\tgeolocator.reverseGeolocate(pos, handleReverseGeolocationSuccess, handleGeolocateError, preferences.language, null, null, feature);\n\t\t}", "function successPosition(currentPosition) {\n if (direction !== 'inbound') {\n direction = 'outbound';\n }\n $('.progress').hide();\n var crd = currentPosition.coords;\n console.log('Your current position is:');\n console.log('Latitude : ' + crd.latitude);\n console.log('Longitude: ' + crd.longitude);\n console.log('More or less ' + crd.accuracy + ' meters.');\n console.log('Direction: ' + direction);\n getBusData(crd.latitude, crd.longitude, direction);\n setInterval(\n function ()\n {\n getBusData(crd.latitude, crd.longitude, direction);\n }, 15000);\n}", "function showCurrentPosition(){\n currentLocation = {\n location: new google.maps.LatLng(position.coords.latitude,position.coords.longitude),\n accuracy: position.coords.accuracy,\n time: position.timestamp\n };\n \n if (travel.locationHistory.length >= 1){\n currentLocation.heading=google.maps.geometry.spherical.computeHeading(userTravel.locationHistory[userTravel.locationHistory.length-1],currentLocation.location)\n }\n \n //user travel updates\n travel.locationHistory.push(currentLocation.location);\n \n // tracking user's travel \n travel.totalTime = (currentLocation.time - travel.initTime)/1000;\n \n //distance travelled \n travel.distance=google.maps.geometry.spherical.computeLength(travel.locationHistory);\n \n //travelling speed\n travel.speed = travel.distance / travel.totalTime;\n \n userHeadingUpdate(); displayUpdate(); \n}", "setCurrentLocation() {\n if ('geolocation' in navigator) {\n navigator.geolocation.getCurrentPosition((position) => {\n this.latitude = position.coords.latitude;\n this.longitude = position.coords.longitude;\n this.zoom = 8;\n this.getAddress(this.latitude, this.longitude);\n });\n }\n }", "setCurrentLocation() {\n if ('geolocation' in navigator) {\n navigator.geolocation.getCurrentPosition((position) => {\n this.latitude = position.coords.latitude;\n this.longitude = position.coords.longitude;\n this.zoom = 8;\n this.getAddress(this.latitude, this.longitude);\n });\n }\n }", "function checkPosition() {\n const offset = reposition(prevFocused);\n if (offset.top !== prevOffset.top || offset.left !== prevOffset.left || offset.width !== prevOffset.width || offset.height !== prevOffset.height) {\n // console.log(\"Changed focus position\", offset, prevFocused);\n prevOffset = offset;\n staticCounter = 0;\n } else {\n staticCounter++;\n }\n if (staticCounter < 3) {\n // at the beginning and as long as we see position changes\n // we will check the position/bounds more often\n positionTimeout = setTimeout(checkPosition, 100);\n } else {\n // we want to measure at least every 2 seconds\n positionTimeout = setTimeout(checkPosition, 1000);\n }\n }", "function update_positie(event) {\n // use config.currentPosition to center the map\n var newPos = new google.maps.LatLng(config.currentPosition.coords.latitude, config.currentPosition.coords.longitude);\n config.map.setCenter(newPos);\n currentPositionMarker.setPosition(newPos);\n }", "function local_position_cb(data){\n\tvar x = data.pose.position.x;\n\tvar y = data.pose.position.y;\n\tvar z = data.pose.position.z;\n\tupdate_position_info(x, y, z);\n}", "function fnPosition(eData) {\n eData.preventDefault();\n navigator.geolocation.getCurrentPosition(fnSuccess, fnError);\n}", "function showPosition(geolocationPosition)\r\n{\r\n // Check this is a unique call\r\n if (geolocationPosition.timestamp !== geolocationTimestamp)\r\n {\r\n // Update timestamp\r\n geolocationTimestamp = geolocationPosition.timestamp;\r\n\r\n // Construct position object\r\n let userLatitude = geolocationPosition.coords.latitude;\r\n let userLongitude = geolocationPosition.coords.longitude;\r\n let posAccuracy = geolocationPosition.coords.accuracy;\r\n\r\n let userPosition = {\r\n position: new google.maps.LatLng(userLatitude, userLongitude),\r\n accuracy: posAccuracy\r\n };\r\n\r\n // Check whether new position is outside uncertainty of the last position. If so, update map.\r\n // Handle first position.\r\n let distanceFromLast;\r\n\r\n if (currentNav.position === null)\r\n {\r\n distanceFromLast = userPosition.accuracy;\r\n }\r\n else\r\n {\r\n distanceFromLast = google.maps.geometry.spherical.computeDistanceBetween(currentNav.position, userPosition.position);\r\n }\r\n // Handle other positions\r\n \r\n // Define this threshold so that map updates position more regularly, and position displayed is more reflective of reality. Provides a better user experience.\r\n // Waypoints are still updated based on the unmodified accuracy.\r\n let thresholdFactor = 0.4;\r\n if (distanceFromLast >= userPosition.accuracy * thresholdFactor)\r\n {\r\n // Pan to position\r\n currentNav.map.panTo(userPosition.position);\r\n\r\n // Update position, heading, marker and precision circle.\r\n currentNav.updateMap(userPosition);\r\n\r\n // Update direction image\r\n if (!currentNav.endOfPath)\r\n { \r\n showDirection(currentNav.directionToWaypoint);\r\n }\r\n else\r\n {\r\n let arrowRef = document.getElementById(\"direction-arrow\");\r\n arrowRef.src = \"images/straight.svg\";\r\n }\r\n\r\n // Update information panel\r\n infoOutput(\"dist-to-waypoint\", currentNav.distanceToNext);\r\n infoOutput(\"waypoint-num\", currentNav.waypointIdx + 1);\r\n infoOutput(\"dist\", currentNav.totalDistance);\r\n infoOutput(\"speed\", currentNav.averageSpeed);\r\n infoOutput(\"dist-remaining\", currentNav.remainingDistance);\r\n infoOutput(\"eta\", currentNav.remainingTime);\r\n }\r\n }\r\n}", "function getCurrentPosition(success, error) {\n if (position && errorCode < 0) {\n success(position);\n } else {\n error({\n code: errorCode * 1,\n message: errorMessages[errorCode]\n });\n }\n }", "function OverlayConnectionPosition() { }", "function error(error) {\n\t\talert(\"Error: getCurrentPosition: \" + error)\n\t}", "if (!game.inEditorMode) {\n // revert pos\n this.pos = lastPos;\n }", "function userCurrentPosition(){\n openNav();\n vm.loading = true;\n //The below function locates your current position in to lat and lng variables.\n var ops = {\n timeout: 10000,\n maximumAge: 0\n };\n navigator.geolocation.getCurrentPosition(pos => {\n const userCurrentLat = pos.coords.latitude;\n const userCurrentLng = pos.coords.longitude;\n //The below changes them in to an object ready for converting them in to an address string\n const latLng = {lat: userCurrentLat, lng: userCurrentLng};\n //The below uses the latLng object and finds the formatted_address\n const geocoder = new google.maps.Geocoder;\n geocoder.geocode({'location': latLng}, function(results, status) {\n console.log('hello');\n if (status === 'OK') {\n vm.successfulLocateMessage = 'We\\'ve located you!';\n openNav();\n if (results[0]) {\n vm.userCurrentAddress = results[0].formatted_address;\n vm.origin = results[0].formatted_address;\n vm.loading = false;\n $scope.$apply();\n }\n }\n });\n }, err => {\n if (err.TIMEOUT) {\n vm.loading = false;\n console.log('failed');\n openNav();\n vm.unsuccessfulLocateMessage = 'Sorry, we couldn\\'t locate you this time.';\n $scope.$apply();\n }\n }, ops);\n }", "function update() {\n updatePosition();\n checkBounds();\n }", "SetLocation() {\n\n }", "function saveInitialPosition(position) {\n userLatitude = position.coords.latitude;\n userLongitude = position.coords.longitude;\n\n swiper.appendSlide('<div class=\"swiper-slide\"> ' + \"<iframe id='innerContent' class='currentMap map-top' width='100%' height='100%' src=\" +\n \"https://www.google.com/maps/embed/v1/directions?key=\" + API_KEY + \"&origin=\" + userLatitude + ',' + userLongitude + \"&destination=\" +\n destinationLatitudes[0] + ',' + destinationLongitudes[0] + \"&mode=walking\" + \"></iframe>\" + '</div>');\n\n swiper.appendSlide('<div class=\"swiper-slide\"> ' + \"<iframe id='innerContent' class='currentMap map-top' width='100%' height='100%' src=\" +\n \"https://www.google.com/maps/embed/v1/directions?key=\" + API_KEY + \"&origin=\" + userLatitude + ',' + userLongitude + \"&destination=\" +\n destinationLatitudes[1] + ',' + destinationLongitudes[1] + \"&mode=walking\" + \"></iframe>\" + '</div>');\n\n sizeMap();\n}", "resetTempPosition() {\n this.set('tempPosition', { x: 0, y: 0, active: false });\n }", "validatePositioning() {\n if (!this.positioningValid) {\n this.calculateAndSetPopupPosition();\n }\n }", "function refreshMapPosition() {\n //alert(\"on Map\");\n roeMapTemp.resize();\n roeMapTemp.reposition();\n }", "update() {\n // initialize next move\n let nextPosition = this.getNextPosition();\n // if next position is not blocked by an object\n if (this.isPositionFree(nextPosition)) {\n this.position.x = nextPosition.x;\n this.position.y = nextPosition.y;\n\n // if successful, send movement to server\n this.game.broadcastPosition({id: this.id, x: this.position.x, y: this.position.y, direction: this.direction});\n }\n\n }", "function updateBusPosition(){\n deleteMarkers(markersBus);\n get_all_bus_position();\n }", "function StartCurrentPositionWatcher() {\n\n //Check that browser supports geolocation\n //If it doesn't, display message and stop any more current position code from running\n if (!navigator.geolocation) {\n alert(\"GeoLocation info not available\");\n return;\n }\n\n //Get current position -- whenever position changes -- \n //and pass it to callback function\n navigator.geolocation.watchPosition(cb_UpdateCurrentPositionMarker,\n cb_UpdateCurrentPositionMarker_Error,\n {\n enableHighAccuracy: true,\n maximumAge: 1000 //Retrieve new info if older than 5 seconds \n }\n );\n}", "function getPosition(e) { \n restbound = 0.03;\n restime = 6500;\n fire =true;\n mouseX = e.x - canvas.offsetLeft;\n mouseY = e.y - canvas.offsetTop;\n chat.server.send(mouseX / W, mouseY / H);\n push = true; \n }" ]
[ "0.7006736", "0.6887366", "0.6755902", "0.6724936", "0.660516", "0.6535325", "0.65215755", "0.6488699", "0.64541763", "0.6387138", "0.6318063", "0.63035095", "0.6273244", "0.6219321", "0.62096", "0.6203042", "0.61854494", "0.61842763", "0.6171744", "0.61568487", "0.61426127", "0.6135028", "0.61296266", "0.61238974", "0.61086", "0.6106546", "0.6082049", "0.6079396", "0.60650086", "0.606322", "0.6052918", "0.6046775", "0.60354745", "0.6024978", "0.60197675", "0.6019323", "0.59998745", "0.5996815", "0.59958005", "0.59920835", "0.598918", "0.598838", "0.59680104", "0.5963549", "0.5962393", "0.59599704", "0.5948184", "0.59416234", "0.5935622", "0.59294206", "0.592242", "0.5912538", "0.5900014", "0.58932674", "0.58905673", "0.5890157", "0.588858", "0.58846235", "0.58837813", "0.5882214", "0.58765864", "0.5865601", "0.5861285", "0.58610564", "0.5855087", "0.582918", "0.5826824", "0.5814499", "0.5813986", "0.58124876", "0.58042794", "0.5804176", "0.5804176", "0.5800915", "0.5799755", "0.57963157", "0.5788688", "0.5779778", "0.5777643", "0.5771193", "0.5771193", "0.5770227", "0.5765897", "0.5765214", "0.5759054", "0.5752045", "0.57462215", "0.57457316", "0.57395774", "0.57336587", "0.57300645", "0.5729826", "0.572868", "0.57192194", "0.5716687", "0.5716341", "0.5713489", "0.57107425", "0.57103026", "0.5707088", "0.57059526" ]
0.0
-1
END OF GEOLOCATION COORDINATES OF USER
function renderCurrWx() { //TARGET #activeCityCard ELEMENTS AND UPDATE EACH ELEMENT WITH KEY VALUES $('#cityName').text(activeLocation.name + ", " + activeLocation.country + today) $('#wxCond').attr('src', "http://openweathermap.org/img/wn/" + activeLocation.wxIcon + "@2x.png").prop('alt', activeLocation.wxCond) $('#cityTemp').text("Temperature: " + activeLocation.temp.toFixed(0) + " \xB0F") $('#cityHum').text("Humidity: " + activeLocation.humidity + "%") $('#cityWs').text("Wind Speed: " + activeLocation.wind + " MPH") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endUserLocation() {\n $scope.endUserLocationDetails = true;\n }", "function getLastWayPointCoordinates(){\n return new google.maps.LatLng(\n $scope.wayPoints[$scope.wayPoints.length - 1].latitude,\n $scope.wayPoints[$scope.wayPoints.length - 1].longitude\n );\n }", "get endRadians() { return this._radians1; }", "function getUserLocation() {\n geolocationService.getCurrentPosition()\n .then(function(coords) {\n setUserCoordinates(coords.latitude, coords.longitude);\n geolocationService\n .getAddressName(coords.latitude, coords.longitude)\n .then(function(addressName) {\n $scope.filters.address = addressName;\n $scope.getVenues();\n })\n }, function(){\n $scope.showSpinner = false;\n $scope.noResults = true;\n });\n }", "function getPinFinal(){\n\t\t\t\tvar latValue = pin_final.getLatitude();\n\t\t\t\tvar longValue = pin_final.getLongitude();\n\t\t\t\treturn latValue + \",\" + longValue;\n\t\t\t}", "async getMostRecentUserLoc() {\n const locData = await this.getLocationData();\n return locData[locData.length - 1];\n }", "function processLocation (obj) {\n if (obj && obj.user && obj.user.location != null && obj.user.location.split(\",\")[1]){\n return obj.user.location.split(\",\")[1];\n }else{\n return false;\n } \n}", "_getQueryReverse(data, params) {\n if (!this.validateLngLat(data)) return { error: 'LatLng wrong!' };\n return {\n location: data,\n maxLocations: params.maxLocations || 10,\n };\n }", "function endAtALocation(endingLocation, locationsList) {\n return R.append(endingLocation, locationsList);\n}", "function onDragEnd(){\n let lnglat = CurrentLocation.getLngLat();\n dragCoords = [lnglat.lng, lnglat.lat];\n }", "function update_end_loc(current_lat, current_lon) {\n firebase.firestore().collection(\"Users\").doc(\"gkWaMtCQ2CTuSBBoM3jX\").update({\n 'endLat': current_lat,\n 'endLon': current_lon\n }).then(() => {\n \n console.log('Updated End Lat/Lon');\n })\n }", "get endDegrees() { return Angle_1.Angle.radiansToDegrees(this._radians1); }", "function geocodeUser(user) {\n\n console.log('user location: ' + user.location);\n\n if (!(user.location == null)) {\n\n if (!(user.location.replace(/\\s/g) == '')) {\n\n if ((user.location.search(regexp) == -1) ? false : (user.location.match(regexp).length != 2) ? false : (user.location.match(regexp)[0] >= -90 && user.location.match(regexp)[0] <= 90 && user.location.match(regexp)[1] >= -180 && user.location.match(regexp)[1] <= 180)) {\n\n //ubertwitter and the like\n gotCoords(user.screen_name, user.location.match(regexp)[0], user.location.match(regexp)[1]);\n\n } else if (/^\\d{3}$/i.test(user.location) || /^\\d{3}\\D/i.test(user.location) || /\\D\\d{3}$/i.test(user.location) || /\\D\\d{3}\\D/i.test(user.location)) {\n\n //handle area codes\n var found = binarySearch(area_codes, 'area_code', user.location.match(/\\d{3}/)[0]);\n \n if (found != null) {\n gotCoords(user.screen_name, found.lat, found.lng);\n } else {\n geocodeStack.push(user);\n }\n\n } else {\n\n //plain old location\n geocodeStack.push(user);\n\n }\n\n } else {\n didNotGetCoords(user.screen_name);\n }\n\n } else {\n didNotGetCoords(user.screen_name);\n }\n\n }", "function getLocationUser () {\n if (navigator.geolocation) {\n var location_timeout = setTimeout(\"geolocFail()\", 10000);\n \n navigator.geolocation.getCurrentPosition(function(position) {\n clearTimeout(location_timeout);\n \n locationUser.lat = position.coords.latitude;\n locationUser.lng = position.coords.longitude;\n loadNearby()\n // console.log(locationUser)\n }, function(error) {\n clearTimeout(location_timeout);\n console.log('failed to get location')\n });\n } else {\n console.log('failed to get location')\n }\n}", "function UserLocation(position) {\r\n console.log(position.coords.latitude, position.coords.longitude);\r\n NearestCity(position.coords.latitude, position.coords.longitude);\r\n console.log(position.coords.latitude);\r\n }", "function getLocation() {\n $.getJSON( window.apiUrl + '/directions/2/' + window.username + '/', function( data ) {\n console.log(data);\n user = data.user;\n });\n }", "function lastY() { return (segments.length == 0) ? 0 : segments[segments.length-1].p2.world.y; }", "function hasUserChanged (user) {\n (user.latitude) ||\n (user.longitude) ||\n (user.profileText)\n }", "function UserLocation(position) {\r\n NearestCity(position.coords.latitude, position.coords.longitude);\r\n}", "static async getMostRecentUserGps() {\n const locData = await LocationServices.getLocationData();\n return locData[locData.length - 1];\n }", "function getCendroid() {\n dX = (loc1X + loc2X) / 2;\n var dYloc1Y = map(loc1Y, yminMap, ymaxMap, xminMap, xmaxMap);\n var dYloc2Y = map(loc2Y, yminMap, ymaxMap, xminMap, xmaxMap);\n dY = (dYloc1Y + dYloc2Y) / 2;\n var cend = atan(dX / dY);\n return cend;\n}", "function getLocation(){\n self.polyline = [];\n self.markers = [];\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(setUserLocation);\n } else {\n console.log(\"geolocation error\");\n }\n }", "function pols_get_entrance_outside(){\r\n\tvar links = this.geo_links_get_outgoing();\r\n\tfor (var l in links){\r\n\t\tif (links.length == 1 || (links[l].deco_class && links[l].deco_class.indexOf('entrance') >= 0) || (links[l].door_id && links[l].door_id == 'door_out')){\r\n\t\t\treturn {\r\n\t\t\t\ttsid: links[l].tsid,\r\n\t\t\t\tx: links[l].x,\r\n\t\t\t\ty: links[l].y\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n\r\n\treturn {};\r\n}", "function onLocationFound(e) {\n console.log(e); \n userPositionCircle.setLatLng([e.latitude, e.longitude]);\n window.motonWalkingTour.currentUserPosition.lat = e.latitude;\n window.motonWalkingTour.currentUserPosition.lng = e.longitude; \n \n}", "get endAngle() { return Angle_1.Angle.createRadians(this._radians1); }", "function onLeaveGeo2()\n{\n\tvar value = $(\"geoName2\").val();\n\t// Memorize the value in the completer varaible of the next level\n\t$(\"#geoName3\").data(\"ui-autocomplete\").options.params.parValue = value;\n}", "get endPosition() { return this.endPositionIn; }", "function _markerDragEnd(lat, lng) {\n this.lat.value = lat;\n this.lng.value = lng;\n }", "function lastY() {\n return (segments.length === 0) ? 0 : segments[segments.length - 1].p2.world.y;\n}", "function gotCoords(userName, lat, lng, googleObj) {\n\n //filter out 0,0\n if ( lat == 0 && lng == 0) {\n console.log('Filtering out 0,0 for ' + userName);\n didNotGetCoords(userName);\n } else {\n $.each(results, function() {\n\n if (!this.waiting) {\n return;\n }\n console.log('gotCoords from_user, userName');\n console.log(this.from_user);\n console.log(userName);\n \n if (this.from_user == userName) {\n\n this.geo_info.valid = true;\n this.geo_info.lat = lat;\n this.geo_info.lng = lng;\n this.waiting = false;\n if(!googleObj){\n success(this, null);\n checkIfDone();\n } else {\n success(this, googleObj);\n checkIfDone();\n }\n }\n\n });\n }\n\n }", "getEndPosition() {\n const radius = (this.tunnelWidth - 1) / 2\n if (this.direction === 'NORTH') {\n return { x: this.x + radius, y: this.y }\n } else if (this.direction === 'SOUTH') {\n return { x: this.x + radius, y: (this.y + this.height) - 1 }\n } else if (this.direction === 'EAST') {\n return { x: (this.x + this.width) - 1, y: this.y + radius }\n } else if (this.direction === 'WEST') {\n return { x: this.x, y: this.y + radius }\n }\n return null\n }", "function reverseGeoCode(lat, lon) {\n var locationIQ =\n \"https://us1.locationiq.com/v1/reverse.php?key=pk.d153eede84e6d6d8954c160de6babc21&lat=\" +\n lat +\n \"&lon=\" +\n lon +\n \"&format=json\";\n $.ajax({\n url: locationIQ,\n method: \"GET\",\n }).then(function (response) {\n // store the country of the user\n var userCountry = response.address.country;\n // create a button of the users country and bring the countries COVID statistics to the page\n countryMatch(userCountry);\n });\n}", "biasAutocompleteLocation () {\n if (this.enableGeolocation) {\n this.updateGeolocation((geolocation, position) => {\n let circle = new google.maps.Circle({\n center: geolocation,\n radius: position.coords.accuracy\n });\n this.autocomplete.setBounds(circle.getBounds());\n })\n }\n }", "function getUserCoords() {\n\tfunction success(pos) {\n\t\tconst crd = pos.coords;\n\t\tcoordObj.lat = crd.latitude;\n\t\tcoordObj.lon = crd.longitude;\n\t\t// current moment object\n\t\tcoordObj.dateTimeStart = moment().format('YYYY-MM-DDTHH:mm:ss');\n\t\t// // make range 6 days for testing\n\t\tcoordObj.dateTimeEnd = moment().add(6, 'd').format('YYYY-MM-DDTHH:mm:ss');\n\t\t// make range 24 hours for deployable version\n\t\t// coordObj.dateTimeEnd = moment().add(24, 'h').format('YYYY-MM-DDTHH:mm:ss');\n\t\t// call function to reveal container that will hold results. pass coords down to child restau/event display functions\n\t\trevealResultsContainer(coordObj);\n\t}\n\n\t// Creates Warning User denied Geolocation\n\tfunction error(err) {\n\t\t// TODO output error message to HTML\n\t\tconsole.warn(`ERROR(${err.code}): ${err.message}`);\n\t\t// let msg = \"If you don't want us to use your location, you can still make a custom search\";\n\t\t// displayErrorMsg(msg);\n\t}\n\tif (!navigator.geolocation) {\n\t\t// TODO tell user to choose custom search button\n\t\tconsole.log('Geolocation is not supported by your browser');\n\t\t// let msg = \"Geolocation is not supported by your browser, but you can still make a custom search\";\n\t\t// displayErrorMsg(msg);\n\t} else {\n\t\tnavigator.geolocation.getCurrentPosition(success, error);\n\t}\n}", "_customLocation() {\n if (this.state.somewhereElse) {\n this.getCoordsByAddress();\n } else {\n this._onForward();\n }\n }", "function updateUserMarker() {\n if (bigMap.config.markers.hasOwnProperty('user')) {\n $log.log(TAG + 'updateUserMarker');\n bigMap.config.markers.user.lat = UserLocation.real.lat;\n bigMap.config.markers.user.lng = UserLocation.real.lon;\n }\n }", "function get_office_location(){\n\n}", "function geolocError(){\n console.log(\"Error getting user's location :(\");\n}", "get end() {\n return this.ranges.length ? this.ranges[ this.ranges.length - 1 ].end : null;\n }", "async function updateUserLocation(req, res, data) {\n\tlet query = '';\n\n\t//Set query based on user types\n\tif (data[1] === 'C') {\n\t\tquery = `\n\t\t\t\tUPDATE clientt\n\t\t\t\tSET C_Location_X = ${data[2]},\n\t\t\t\t\t\tC_Location_Y = ${data[3]}\n\t\t\t\tWHERE u_id = '${data[0]}'\n\t\t`;\n\t} else if (data[1] === 'D') {\n\t\tquery = `\n\t\t\tUPDATE driver\n\t\t\tSET DR_Location_X = ${data[2]},\n\t\t\t\t\tDR_Location_Y = ${data[3]}\n\t\t\tWHERE u_id = '${data[0]}'\n\t`;\n\t}\n\n\ttry {\n\t\tconnection = await oracledb.getConnection(dbconnection);\n\n\t\tresult = await connection.execute(query, {}, { autoCommit: true });\n\n\t\tconsole.log(`Connected to update user location ${data}`);\n\t} catch (error) {\n\t} finally {\n\t\tif (connection) {\n\t\t\tawait connection.close();\n\t\t\t// console.log('Connection ended');\n\t\t}\n\t\tres.status(200).send(result);\n\t}\n}", "function setBankAccountIsOptional( user, location, callback ) {\n if( 'CH' === location.countryCode ) {\n location.isOptional = false;\n } else {\n location.isOptional = true;\n }\n callback( null, location );\n }", "function connectUserToLocation (userId, name, country, city, postal) {\n const locationId = idGenerator.nextLocationId();\n // log.info('graph.js location name:', name, country, city, postal);\n return cq.query(qb.connectUserToLocation(userId, locationId, name, country, city, postal))\n .then(transformer.location);\n}", "function locationSuccess(location) {\n\tconsole.log(\"location: \" + location);\n\t\n\tcurrentUser.Latitude=location.coords.latitude;\n\tcurrentUser.Longitude=location.coords.longitude;\n\t\n\tupdateUser(currentUser.UserID, null, currentUser.FirstName, currentUser.LastName, currentUser.Email, currentUser.Phone, location.coords.latitude, location.coords.longitude, currentUser.UsePayPal, currentUser.PayPalEmail, currentUser.EmailAlert, currentUser.SMSAlert);\n\talert(\"Your location has been updated successfully!\");\n}", "function Geography(user) {\n return $http.get('http://prod1.groupz.in:7000/Authenticator?request=' + JSON.stringify(user)).then(handleSuccess, handleError('Error Login'));\n }", "function geolocate() {\n /*if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n var geolocation = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n document.getElementById('latitude').value = geolocation.lat.toFixed(6);\n document.getElementById('longitude').value = geolocation.lng.toFixed(6); \n //console.log(geolocation); \n var circle = new google.maps.Circle({\n center: geolocation,\n radius: position.coords.accuracy\n });\n autocomplete.setBounds(circle.getBounds());\n });\n }*/\n }", "function getLocation() {\n window.navigator.geolocation.getCurrentPosition((location) => {\n userLat = location.coords.latitude;\n userLon = location.coords.longitude;\n checkParkCoord();\n })\n }", "function isLocationFree(latLng){\n \n for (var i = actualPositions.length - 1; i >= 0; i--) {\n \n if (actualPositions[i][0] === latLng[0] && actualPositions[i][1] === latLng[1]) {\n return false; \n }\n }\n return true;\n }", "function getCoords() {\n // Making use of the navigator.geolocation property which gives access to user location\n if (navigator.geolocation) {\n // After declaring variable and learning we are using the navigator.geolocation property, we are not calling for the position and asking for display of position\n navigator.geolocation.getCurrentPosition(displayPosition);\n\n // Making use of an else statement which says to say not available otherwise\n } else {\n userLocation.innerHTML = \"Not available\";\n }\n}", "getGeodesicFinalBearing(location) {\n return this.vincentyFormula(location, GeoLocation.FINAL_BEARING);\n }", "function geolocate() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n var geolocation = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n var circle = new google.maps.Circle({\n center: geolocation,\n radius: position.coords.accuracy\n });\n autocompleteDeparture.setBounds(circle.getBounds());\n autocompleteDestination.setBounds(circle.getBounds());\n });\n }\n }", "function onGetCurrentLocation () {\n geocodeByCurrentLocation();\n return false;\n}", "function geo_success(p) {\r\n // alert(\"Found you at latitude \" + p.coords.latitude +\r\n // \", longitude \" + p.coords.longitude);\r\n\t\tuserPos.LAT =p.coords.latitude;\r\n\t\tuserPos.LNG =p.coords.longitude;\r\n\t\talertUserPos();\r\n}", "function geoLocation() {\r\n if (navigator.geolocation) { // try to get user's geoLocation\r\n navigator.geolocation.getCurrentPosition (function(position) {\r\n lat = position.coords.latitude;\r\n lon = position.coords.longitude;\r\n });\r\n }\r\n else { // centre on UTSC\r\n lat = 43.78646;\r\n lon = -79.1884399;\r\n }\r\n /* need user's geoLocation before drawing map, so block here\r\n\tuntil geoLocation is determined */\r\n if (lat==null || lon==null) { // keep trying until geoLocation determined\r\n\tsetTimeout(geoLocation, 500);\r\n }\r\n else { // have geoLocation, now draw the map\r\n\tdrawMap([],[]);\r\n }\r\n}", "function locateUser() {\n\n\t\tlocatingId = navigator.geolocation.watchPosition(geolocationSuccess, geolocationFailed, geolocationOptions);\n\t\t// MsgBox\n\t\tvar msgBox = new MsgBox();\n\t\tmsgBox.show(\"Géolocalisation en cours...\", GEOLOC_DURATION);\n\t\tsetTimeout(stopLocalisation, GEOLOC_DURATION, locatingId);\n\t\tconsole.log('Géolocalisation en cours...');\n\t}", "function reverse_geocode(coords, show_current_location) {\n\t\t$.ajax({\n\t\t\tasync: true,\n\t\t\turl: \"/reverse_geocode\",\n\t\t\ttype: \"POST\",\n\t\t\tdataType: \"json\",\n\t\t\tdata: {\n\t\t\t\t\t\"coords\": coords\n\t\t\t\t},\n\t\t\t\tsuccess: function(data) {\n\t\t\t\t\tparsed_data = data;\n\t\t\t\t\tshow_current_location(data);\n\t\t\t\t},\n\t\t\t\terror: function (xhr, ajaxOptions, thrownError) {\n\t\t\t\t\t// console.log(\"error\");\n\t\t\t\t}\n\t\t});\n\t}", "end() {\n if (this.objParam['type'] === 'iprange') {\n if (this.objParam['param1'] === '') {\n this.objParam['param1'] = '::';\n }\n if (this.objParam['param2'] === '') {\n this.objParam['param2'] = '::';\n }\n } else if (this.objParam['type'] === 'ipprefix') {\n if (this.objParam['param1'] === '') {\n this.objParam['param1'] = '::/0';\n }\n }\n g_Domain_Data[this.strDomainName].address6[this.strEditName] = normalizeFirewallIPv6Address(this.objParam);\n }", "function mapAfterMoveEnd() {\n // get the center of the map\n var centerOfMap = map.getCenter();\n\n // if there is no orange circle then create one\n if(myCircle === undefined) {\n\n // create a circle to place on the map so the user can\n // follow the area they'd like to\n myCircle = new MapboxCircle(centerOfMap, 15000, {\n editable: false,\n minRadius: 1500,\n strokeColor: '#FAC82D',\n strokeWeight: 2,\n fillColor: '#FAC82D',\n fillOpacity: 0.25\n }).addTo(map, 'place_city');\n }\n }", "function updateUserLocation2(position) {\n //var latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);\n //var latLng = new google.maps.LatLng(marker.getPosition().lat(), marker.getPosition().lng());\n var latLng = new google.maps.LatLng(marker.getPosition().lat(), marker.getPosition().lng());\n marker.setPosition(latLng);\n if (clicked) {\n var dist = google.maps.geometry.spherical.computeDistanceBetween(allMyMarkers[userCp].getPosition(), latLng);\n if (dist <= 30) {\n allMyMarkers[userCp].setIcon(\"images/flag.png\");\n //allMyMarkers[userCp].setVisible = false;\n userCp--;\n }\n console.log(\"DISTANCE:\");\n console.log(dist);\n //allMyMarkers[i--].setIcon(\"b.png\");\n\n if(userCp == 0) { \n window.location.replace(\"win.html\");\n }\n }\n}", "function updateUserLocationOnMap() {\n\n\t//clear existing markers\n\tclearMarkers();\n\n\tvar currentUser = getCurrentUser();\n\tvar currentUserPosition;\n\tif (currentUser != null) {\n\t\tcurrentUserPosition = [currentUser.Latitude, currentUser.Longitude];\n\t} else {\n\t\t//set the location to Tech Tower\n\t\tcurrentUserPosition = [33.772457, -84.394699];\n\t}\n\n\tvar newPosition = new google.maps.LatLng(currentUserPosition[0], currentUserPosition[1]);\n\t/*\n\t var infowindow = new google.maps.InfoWindow({\n\t map: map,\n\t position: newPosition,\n\t content: 'You are here.'\n\t });\n\t */\n\tvar marker = new google.maps.Marker({\n\t\tposition : newPosition,\n\t\tmap : map,\n\t\tanimation : google.maps.Animation.BOUNCE, //or DROP\n\t\ttitle : 'You are here.'\n\t});\n\n\tmarkers.push(marker);\n\n\tsetMarkers();\n\n\tmap.setCenter(newPosition);\n\tmap.setZoom(16);\n\n}", "function findUser(start, end){\n\tdirectionsServiceForTime = new google.maps.DirectionsService();\n var requestForTime = {\n \torigin: start,\n \t\tdestination: user.start,\n \t\ttravelMode: google.maps.DirectionsTravelMode['BICYCLING']\n };\n directionsServiceForTime.route(requestForTime, function(response, status){\n \tif (status == google.maps.DirectionsStatus.OK){\n \t\tif(parseInt(response.routes[0].legs[0].duration.text) < 5){\n \t\t\tyourMatch = user;\n \t\t}\n \t}\n })\n}", "function getUserLocation() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function (position) {\n userLat = position.coords.latitude;\n userLong = position.coords.longitude;\n fetch(\n `http://www.mapquestapi.com/geocoding/v1/address?key=leD58xaywYgcRGiGPl2hSPFJuBLaYqmm&location=${userLat},${userLong}`\n )\n .then(res => res.json())\n .then(data => {\n let street = data.results[0].locations[0].street;\n let state = data.results[0].locations[0].adminArea3;\n let country = data.results[0].locations[0].adminArea1;\n document.getElementById(\n \"userLocation\"\n ).innerHTML = ` Wellcome all from ${street}, ${state}, ${country}!`;\n });\n });\n } else {\n x.innerHTML = \"Geolocation is not supported by this browser.\";\n }\n }", "function askForCoords(){\n navigator.geolocation.getCurrentPosition(handleGeoSuccess, handleGeoError)\n}", "end(range) {\n var [, end] = Range.edges(range);\n return end;\n }", "end(range) {\n var [, end] = Range.edges(range);\n return end;\n }", "_onMoveEnd() {\n this._map.locate({\n 'watch': true,\n 'setView': false,\n 'enableHighAccuracy': true,\n });\n }", "function locationAlongArc(start, end, loc) {\n\t\tvar interpolator = d3.geo.interpolate(start, end);\n\t\treturn interpolator(loc);\n\t}", "function currentCoord() {\n\treturn game_data.village.coord;\n}", "function isAtEnd (lat, lng, threshold) {\n if (taskSetting) {\n var len = taskSetting.features[0].geometry.coordinates.length - 1,\n latEnd = taskSetting.features[0].geometry.coordinates[len][1],\n lngEnd = taskSetting.features[0].geometry.coordinates[len][0],\n d;\n\n if (!threshold) {\n threshold = 10; // 10 meters\n }\n\n d = svl.util.math.haversine(lat, lng, latEnd, lngEnd);\n\n console.log('Distance to the end:' , d);\n\n if (d < threshold) {\n return true;\n } else {\n return false;\n }\n }\n }", "get end() {\n if (this._positions.anchor < this._positions.focus) {\n return this._positions.focus\n }\n\n return this._positions.anchor\n }", "get end() {\n return this[this._end];\n }", "function geolocate() {\n // console.log(\"i am geolocate\");\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n var geolocation = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n var circle = new google.maps.Circle({\n center: geolocation,\n radius: position.coords.accuracy\n });\n //console.log(\"radius is :\",circle.radius);\n autocomplete.setBounds(circle.getBounds());\n });\n }\n }", "function showLastKnownLocationOfProfessorOnMap(){\n sendData = {'findName': $('#findName').val()};\n \n $.get('../find',\n sendData,\n function(data){\n var jData = jQuery.parseJSON(data);\n var color = randomColor();\n \n jData['rows'].forEach(function(dPoint){\n var posX = dPoint['value']['posX'];\n var posY = dPoint['value']['posY'];\n var time = dPoint['value']['time'];\n var currentTime = (new Date().getTime())/1000;\n var timeDifference = currentTime - parseInt(time);\n var radius;\n \n if ((timeDifference > 30000) || (timeDifference < 0)){\n // Don't do anything! \n } else {\n radius = 40 * Math.pow((30000 - timeDifference),6) / Math.pow(30000,6);\n radius = (radius < 15 ? 10 : radius);\n drawCircleOnMap(posX, posY, dPoint['key'][0], radius, color, 60000);\n }\n });\n });\n }", "geolocate () {\n this.updateGeolocation ((geolocation, position) => {\n this.updateCoordinates(geolocation)\n })\n }", "function updateUserLocation() {\n if (navigator.geolocation) {\n console.log(\"Getting location\");\n console.log(marker.getPosition().lat());\n navigator.geolocation.getCurrentPosition(function (position) {\n var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);\n console.log(\"New Pos\");\n console.log(latlng.lat());\n marker.setPosition(latlng);\n }, navError);\n console.log(\"Done\");\n console.log(marker.getPosition().lat());\n }\n}", "function onLeaveGeo1()\n{\n\tvar value = $(\"#geoName1\").val();\n\t// Set variable in the completer of the next level\n\t$(\"#geoName2\").data(\"ui-autocomplete\").options.params.parValue = value;\n}", "getLocationDataCompensation(start, end) {\r\n\t\t\t\tvar compensation, current, initialEnd, totalCompensation;\r\n\t\t\t\ttotalCompensation = 0;\r\n\t\t\t\tinitialEnd = end;\r\n\t\t\t\tcurrent = start;\r\n\t\t\t\twhile (current <= end) {\r\n\t\t\t\t\tif (current === end && start !== initialEnd) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcompensation = this.locationDataCompensations[current];\r\n\t\t\t\t\tif (compensation != null) {\r\n\t\t\t\t\t\ttotalCompensation += compensation;\r\n\t\t\t\t\t\tend += compensation;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcurrent++;\r\n\t\t\t\t}\r\n\t\t\t\treturn totalCompensation;\r\n\t\t\t}", "function handle_geolocation_query(position){ \n\tdlat=position.coords.latitude;\n\tdlon=position.coords.longitude; \n}", "function rngEnd (rng) {\n return rng[1]\n}", "function stopTrackingUserLocation() {\n deleteOverlays(userMarkersArray);\n if (userLocationCircle) {\n userLocationCircle.setMap(null);\n }\n targetControlDiv.style.display = 'none';\n resizeMap();\n navigator.geolocation.clearWatch(updateLocation);\n hasLoaded = 0;\n}", "function onLeaveLoBoundLoc()\n{\n\tvar value = $(\"#loBoundLoc\").val();\n\t// Set variable for upBound completer\n\t$(\"#upBoundLoc\").data(\"ui-autocomplete\").options.params.loBound = value;\n}", "function getLocation(address, range) {\n var geocoder = new google.maps.Geocoder();\n geocoder.geocode({ \"address\": address }, function (results, status) {\n if (status === google.maps.GeocoderStatus.OK) {\n var latitude = results[0].geometry.location.lat(),\n longitude = results[0].geometry.location.lng(),\n //Create a lat/long with the user address\n point = new Parse.GeoPoint({latitude: latitude, longitude: longitude}),\n user = Parse.User.current();\n\n user.set(\"location\", point);\n user.set(\"workPreferenceRange\", range);\n user.save(null, {\n success: function (user) {\n console.log(\"successfully saved GEO for user\");\n },\n error: function (user, error) {\n console.log(\"An error occured when saving new job...\");\n console.log(error.code + \" \" + error.message);\n }\n });//End of save\n\n } else {//For geocode\n console.log(\"Didn't work.\" + results + \" \" + status);\n }\n });\n }", "function GeoLocQuery(){}", "function finishCoords( coords, elem_type, restrict ) {\n self.util.standardizeQuad(coords);\n\n $(coords)\n .parent()\n .addClass('editable')\n .each( function () {\n this.setEditing = function ( ) {\n var event = { target: this };\n self.util.setEditing( event, 'points', { points_selector: '> polygon', restrict: restrict } );\n };\n } );\n window.setTimeout( function () { $(coords).parent()[0].setEditing(); self.util.selectElem(coords,true); }, 50 );\n\n self.util.registerChange('added '+elem_type+' '+$(coords).parent().attr('id'));\n\n for ( var n=0; n<self.cfg.onFinishCoords.length; n++ )\n self.cfg.onFinishCoords[n](coords,elem_type,restrict);\n }", "function updateUserGeo(geoInfo) {\n state.userInfo.geoLocation = {'lat':geoInfo.lat, 'lng':geoInfo.lng};\n}", "function geolocate() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n var geolocation = {\n //use position.coords. to biase towards current browser location\n lat: 51.528, //position.coords.latitude,\n lng: -0.381 //position.coords.longitude\n };\n var circle = new google.maps.Circle({\n center: geolocation,\n radius: position.coords.accuracy\n });\n autocomplete.setBounds(circle.getBounds());\n });\n }\n }", "function userLonLat(userLoca, callback){\n var googleMaps = \"https://maps.googleapis.com/maps/api/geocode/json?address=\";\n userLoca = userLoca.split('');\n userLoca = userLoca.join('');\n //split join to omit user input strings with spaces\n \n var locaUrl = googleMaps.concat(userLoca);\n \n req.requestJS(locaUrl, function(err, userData){\n if(err){\n callback(err);\n }\n \n else{\n var lonLatObj = userData.results[0];\n var userCoordinates = [lonLatObj.geometry.location.lat, lonLatObj.geometry.location.lng];\n \n // console.log(\"red\");\n \n callback(null, userCoordinates);\n }\n });\n}", "function handleGoogleReverseGeocoder() {\n if (! geocoder ) {\n geocoder = new google.maps.Geocoder();\n }\n\n var latlng = new google.maps.LatLng(axisLocation.lat, axisLocation.lon);\n geocoder.geocode({\n 'latLng': latlng\n }, function (results, status) {\n if (status === google.maps.GeocoderStatus.OK) {\n if (results[1]) {\n var addrsDtl = results[1].address_components;\n for (var compCnt=0; compCnt < addrsDtl.length; compCnt ++ ) {\n\n var currRec=addrsDtl[compCnt];\n var currKey=currRec.types[0];\n var currLongVal=currRec.long_name;\n var currShortVal=currRec.short_name;\n\n switch(currKey) {\n case \"locality\": axisLocation.city = currLongVal;\n break;\n\n case \"administrative_area_level_1\":\n axisLocation.state = currLongVal;\n axisLocation.stateShort = currShortVal;\n break;\n\n case \"postal_code\":\n axisLocation.zip = currShortVal;\n break;\n\n case \"postal_code_suffix\":\n axisLocation.zip4 = currLongVal;\n break;\n }\n }\n handleLocationEvents();\n } else {\n log('Warning: Reverse Geodocer - No results found');\n }\n } else {\n log('ERROR: Reverse Geocoder failed due to: ' + status);\n }\n });\n}", "function getUserCoord(callback1, callback2){\n //navigator is a object from html5' geolocation API,checking if geolocation usage is available\n if(navigator.geolocation){\n navigator.geolocation.getCurrentPosition(function(position){\n var lat = position.coords.latitude;\n var long = position.coords.longitude;\n //using google map api\n var mapURL = \"https://maps.googleapis.com/maps/api/geocode/json?latlng=\" + lat + \",\" + long;\n //invoke the two argument function as callback\n callback1(mapURL);\n callback2(lat, long);\n });\n }\n}", "function miPosYAgenciasSB(){\n // console.log(\"DFC >>> Mi Pos Y Agencias Scotia Bank\");\n msgWaitForFosition(\"mapDondeEstoySB\");\n watchIDSB = navigator.geolocation.watchPosition(\n onSuccessMiPosYAgenciasSB, onErrorMiPosYAgenciasSB, {enableHighAccuracy: true}\n );\n\n}", "function GeographyAccounts(user) {\n return $http.get('http://prod1.groupz.in:7000/Authenticator?request=' + JSON.stringify(user)).then(handleSuccess, handleError('Error Login'));\n }", "function reverse(lat,lon,key,language){\n var query = lat + '%2C' + lon;\n return geocode(query,'reverse',key,language);\n}", "function onDragEnd() {\n let lngLat = marker.getLngLat();\n let longitude = lngLat.lng.toString();\n let latitude = lngLat.lat.toString();\n getCityState(longitude, latitude);\n createWeatherCard(longitude, latitude);\n}", "function getCoordintes() { \n\tvar options = { \n\t\tenableHighAccuracy: true, \n\t\ttimeout: 5000, \n\t\tmaximumAge: 0 \n\t}; \n\tfunction success(pos) { \n\t\tvar crd = pos.coords; \n\t\tvar lat = crd.latitude.toString(); \n\t\tvar lng = crd.longitude.toString(); \n\t\tvar coordinates = [lat, lng]; \n\t\tgetCity(coordinates); \n\t\treturn; \n\t} \n\tfunction error(err) { \n\t\tconsole.warn(`ERROR(${err.code}): ${err.message}`); \n\t} \n\tnavigator.geolocation.getCurrentPosition(success, error, options); \n}", "function updateCurrentLocation(roomLat,roomLng) {\n if (!userHasGPSCoordinates ){\n userHasGPSCoordinates = true;\n currentPosition = new google.maps.LatLng(roomLat, roomLng);\n }\n}", "function addOrRemoveEndUser(endUser){\n\t\t\tif(isEndUserAdded(endUser)){\n\t\t\t\tvar index = $scope.addedEndUsers.map(function(e){return e.PartnerId;}).indexOf(endUser.PartnerId);\n\t\t\t\t$scope.addedEndUsers.splice(index,1);\n\t\t\t}else{\n\t\t\t\t$scope.addedEndUsers.pop();\n\t\t\t\t$scope.addedEndUsers.push(endUser);\n\t\t\t}\n\t\t}", "function finishGeo(addr){\n\tsearchbarInput.value = addr;\n}", "end(editor, at) {\n return Editor.point(editor, at, {\n edge: 'end'\n });\n }", "end(editor, at) {\n return Editor.point(editor, at, {\n edge: 'end'\n });\n }", "function getGeolocation() {\n // console.log(this.responseText);\n var data = JSON.parse(this.responseText);\n var results = data.results;\n results.forEach(function (element) {\n console.log(element.geometry.location);\n var ubication = {\n lat: element.geometry.location.lat,\n lng: element.geometry.location.lng\n };\n });\n }", "function getLocation(location) {\n\t lat = location.coords.latitude;\n\t lng = location.coords.longitude;\n\t\tgetVenues();\n\t}", "function onDragEnd() { \n var lngLat = marker.getLngLat();\n lng = lngLat.lng\n lng = adjustLng(lng)\n lat = lngLat.lat\n\n // display coordinates on form side\n $('#lat').text(`Latitude: ${lat}`)\n $('#lng').text(`Longitude: ${lng}`)\n\n // //store data into session\n sessionStorage.setItem(\"coord_lat\", JSON.stringify({ \"lat\": lat }))\n sessionStorage.setItem(\"coord_lng\", JSON.stringify({\"lng\": lng }))\n}" ]
[ "0.6377289", "0.5888919", "0.5872836", "0.560028", "0.54315156", "0.541998", "0.5397453", "0.5393223", "0.5377661", "0.53744173", "0.53707063", "0.5320766", "0.5318279", "0.53128964", "0.5303158", "0.52944845", "0.52223885", "0.52162087", "0.5197862", "0.519345", "0.51799816", "0.5171992", "0.51516837", "0.5146257", "0.514418", "0.51289934", "0.5125938", "0.51196414", "0.51155704", "0.5097291", "0.5056468", "0.5051986", "0.50501686", "0.50469524", "0.5033832", "0.5020917", "0.5004931", "0.49771065", "0.49698865", "0.49693674", "0.49585432", "0.49573925", "0.49567866", "0.49449757", "0.49320668", "0.49315965", "0.49315056", "0.49174318", "0.49046114", "0.48992792", "0.4897061", "0.48948982", "0.4892962", "0.48840764", "0.48833916", "0.4878357", "0.4867506", "0.48658776", "0.48640347", "0.4863328", "0.4860946", "0.48535943", "0.48506466", "0.48506466", "0.48418856", "0.4836282", "0.48342934", "0.48297524", "0.48285565", "0.4825642", "0.48255172", "0.48241425", "0.48219085", "0.481951", "0.4817536", "0.48164245", "0.48155338", "0.48107937", "0.48097956", "0.48080254", "0.4806735", "0.4799196", "0.47966337", "0.4796182", "0.4794817", "0.47905174", "0.47880384", "0.47865298", "0.47845256", "0.4782118", "0.47788098", "0.47770253", "0.47759667", "0.47737855", "0.47696766", "0.47678712", "0.47650194", "0.47650194", "0.47636804", "0.47618902", "0.4756183" ]
0.0
-1
FUNCTION TIED TO NAV LINK CLICKS TO TAKE THEIR DATA NAME AND SEND TO API CALL
function callWxBtn() { let btnValue = ($(this).data('name')) callWxData(btnValue) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setGoToData(){\n\n\t\t\t$scope.goToData.links.push({type: 'brand id', namePath: 'id', sref: 'spa.brand.brandEdit', paramKey: 'brandId', paramPath: 'id'});\n\t\t\tif(hasAccountsPermissions) $scope.goToData.links.push({type: 'account', namePath: 'relationsBag.parents.account.name', sref: 'spa.account.accountEdit', paramKey: 'accountId', paramPath: 'relationsBag.parents.account.id'});\n\t\t\tif(hasAdvertisersPermissions) $scope.goToData.links.push({type: 'advertiser', namePath: 'relationsBag.parents.advertiser.name', sref: 'spa.advertiser.advertiserEdit', paramKey: 'advertiserId', paramPath: 'relationsBag.parents.advertiser.id'});\n\t\t\tif(hasCampaignsPermissions) $scope.goToData.links.push({type: 'campaigns', namePath: 'relationsBag.children.campaigns.count', sref: 'spa.brand.campaigns', paramKey: 'brandId', paramPath: 'id'});\n\n\t\t\t$scope.goToData.actions.splice(0, 0, { name: 'New Brand', func: newBrand});\n\t\t\t$scope.goToData.actions.splice(1, 0, { name: 'Delete', func: deleteEntity});\n\t\t}", "function leadsLink(obj, key){\n\n //debugger;\n return '<li id=\"'+ key+'\"><a href=\"javascript:void(0)'+ '\" onclick=\"goToLeadDetailPage(\\''+ obj.name[1] + '\\',\\''+ obj.email[1] + '\\',\\''+ key + '\\',\\''+ obj.phone[1] +'\\')\">'+ obj.name[1]\n + '</a></li>';\n}", "function waLinkClick(obj,linkName,pv_sSwitchStmt,pv_linkDetail)\n{\nvar events;\nwa.linkName = false;\n switch(pv_sSwitchStmt)\n {\n case \"link\":\n switch(linkName)\n\t\t\t{\n\t\t\t\tcase \"globalnav\":\n\t\t\t\t\twa.linkTrackVars=\"prop10,prop21,eVar21\";\n\t\t\t\t\tbreak;\t\t\t\t\t\n\t\t\n\t\t\t\t//Calendar Widget\n\t\t\t\tcase \"calclick\":\n\t\t\t\t\twa.linkTrackVars=\"prop7\";\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t//Overview\n\t\t\t\tcase \"overviewclick\":\n\t\t\t\tcase \"overlaylink\":\n\t\t\t\t\twa.linkTrackVars=\"prop7\";\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t//Transaction\n\t\t\t\tcase \"transaction\":\n\t\t\t\t\twa.linkTrackVars=\"prop7\";\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t//Planning\n\t\t\t\tcase \"planning\":\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents=events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t//Trend\n\t\t\t\tcase \"trend\":\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents=events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t//FIs\n\t\t\t\tcase \"addfi\":\n\t\t\t\t\twa.linkTrackVars=\"events\";\n\t\t\t\t\tevents=\"event11,event10\";\n\t\t\t\t\ts.linkTrackEvents = events;\n\t\t\t\t\ts.events = s.linkTrackEvents+\":\"+wa.userGuid;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"searchfi\":\t\t\n\t\t\t\t\twa.linkTrackVars=\"events\";\n\t\t\t\t\tevents=\"event12\";\n\t\t\t\t\ts.linkTrackEvents = events;\n\t\t\t\t\ts.events = s.linkTrackEvents+\":\"+wa.userGuid;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"sysmsg\":\t\t\t\t\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents = events;\n\t\t\t\t\ts.events = s.linkTrackEvents;\n\t\t\t\t\tif(wa.events) { s.events=s.events+\":\"+wa.userGuid; }\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"closefioverlay\":\t//REMOVE FOR PHASE2(?)\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=\"event13\";\n\t\t\t\t\ts.linkTrackEvents = events;\n\t\t\t\t\ts.events = s.linkTrackEvents+\":\"+wa.userGuid;\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t//Goals\n\t\t\t\tcase \"goalsclick\":\t\t\n\t\t\t\t\twa.linkTrackVars=\"prop7,eVar11\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"upload photo\":\t\n\t\t\t\t\twa.linkTrackVars=\"prop11,eVar11,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents = events;\n\t\t\t\t\ts.events = s.linkTrackEvents;\n\t\t\t\t\tif(wa.goalID) {s.events=s.events+\":\"+wa.goalID;}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"autosave goal\":\n\t\t\t\t\twa.linkTrackVars=\"prop11,eVar11,events\";\t\t\t\t\t\n\t\t\t\t\tevents=s.linkTrackEvents=wa.events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tif(wa.goalID) {s.events=s.events+\":\"+wa.goalID;}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"add a goal\":\n\t\t\t\tcase \"edit goal\":\n\t\t\t\tcase \"add account\":\n\t\t\t\tcase \"uncomplete goal\":\n\t\t\t\tcase \"click add task\":\n\t\t\t\tcase \"create task\":\n\t\t\t\tcase \"view task\":\n\t\t\t\tcase \"edit task\":\n\t\t\t\tcase \"complete task\":\n\t\t\t\tcase \"uncheck task\":\n\t\t\t\tcase \"rate details\":\n\t\t\t\t\twa.linkTrackVars=\"prop11,eVar11\";\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t//Offers\n\t\t\t\tcase \"offerclick\":\n\t\t\t\t\twa.linkTrackVars=\"events,transactionID,products,prop6,eVar6,prop7,eVar11\";\n\t\t\t\t\ts.linkTrackEvents=s.events;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"offerimpression\":\n\t\t\t\t\twa.linkTrackVars=\"eVar11,events,products\";\n\t\t\t\t\ts.linkTrackEvents=s.events;\n\t\t\t\t\tbreak;\n\n\t\t\t\t//Alerts\n\t\t\t\tcase \"alertimpression\":\n\t\t\t\tcase \"alertclick\":\n\t\t\t\tcase \"alertdismiss\":\n\t\t\t\t\twa.linkTrackVars=\"events,products\";\n\t\t\t\t\ts.linkTrackEvents=s.events;\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t//Ways to Save (W2S)\n\t\t\t\tcase \"waW2SActions\":\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents=events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t//Ways to Invest (W2I)\n\t\t\t\tcase \"investmentActions\":\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents=events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tbreak;\t\t\t\t\n\t\t\t\t\n\t\t\t\t//Advice\n\t\t\t\tcase \"adviceshowdetails\":\n\t\t\t\tcase \"advicehidedetails\":\n\t\t\t\t\twa.linkTrackVars=\"prop26,\";\n\t\t\t\tcase \"adviceimpression\":\n\t\t\t\tcase \"advicelearnmore\":\n\t\t\t\tcase \"advicenext\":\n\t\t\t\tcase \"adviceignore\":\n\t\t\t\t\tif(wa.linkTrackVars) {\n\t\t\t\t\t\twa.linkTrackVars=wa.linkTrackVars+\"prop7,events,products\"; \n\t\t\t\t\t} else {\n\t\t\t\t\t\twa.linkTrackVars=\"prop7,events,products\"; \n\t\t\t\t\t}\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents=events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t//Google Local\n\t\t\t\tcase \"glocal\":\n\t\t\t\t\twa.linkTrackVars=\"prop19\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"glocal-scid\":\n\t\t\t\t\twa.linkTrackVars=\"prop21,eVar21,prop19\";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\twa.linkTrackVars=\"prop7\";\n\t\t\t\t\tif(wa.pageDetail) {\ts.prop7=wa.pageDetail; } else { s.prop7=defaultPath; }\n\t\t\t\t\ts.prop7=s.prop7+\":\"+linkName;\n\t\t\t\t\tif(pv_linkDetail) { s.prop7=s.prop7+\"_\"+pv_linkDetail; }\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t//if (stickyCid) {s.prop26= stickyCid+\" -- \"+wa.pageDetail+\"/\"+linkName+\"|\"+s.prop3;}else {s.prop26= wa.pageDetail+\"/\"+linkName+\"|\"+s.prop3; }\n\t\t\t\n\t\t\tif(wa.linkTrackVars) { s.linkTrackVars=s.linkTrackVars+\",\"+wa.linkTrackVars; }\n\n\t\t\twa.linkName=true;\n\n\t\t\ts=s_gi(s_account);\n\t\t\tvar lt=obj.href!=null?s.lt(obj.href):\"\";\n if (lt==\"\") { s.tl(obj,'o',linkName); }\n break;\n\n case \"page\":\n\t\t\tif(wa.events) {s.events = wa.events;}\n\t\t\tswitch(linkName) {\n\t\t\t\tcase \"closeoverlay\":\tbreak;\n\t\t\t\tcase \"searchfi\":\n\t\t\t\tcase \"addfi\":\t\t\t\n\t\t\t\t\ts.events=s.events+\":\"+wa.userGuid;break;\n\t\t\t}\n\t\t\tif(wa.goalAppendID) {\n\t\t\t\tif(wa.goalID) { s.events=s.events+\":\"+wa.goalID; }\n\t\t\t\twa.goalAppendID=false;\n\t\t\t}\n\t\t\t\n\t\t\ts.t(); //send page call\n\t\t\ts.products=\"\"; //reset products variable\n\t\t\twa.events=s.events=\"\"; //reset events variables\n break;\n default:\n s.pageName = linkName; //used for page tracking\n s.prop6=s.eVar6= \"\";\n //if (bEventTrack)\n s.events = events;\n s.t();\n break;\n }\n}", "handleClick(itemName, type) {\n console.log(\"Click in ProjDetail\");\n console.log(itemName);\n console.log(type);\n //Already got the table, sp, func details in this.state; don't need to call API again\n switch(type) {\n case \"tables\":\n this.getCurrentDBItem(this.state.tableItems, itemName, \"TABLE\");\n break;\n case \"sp\":\n this.getCurrentDBItem(this.state.spItems, itemName, \"SP\");\n break;\n case \"func\":\n this.getCurrentDBItem(this.state.funcItems, itemName, \"FUNCTION\");\n break;\n default:\n console.log(\"Sorry No Data\");\n }\n }", "function accessesingData1() {\n\n}", "function accessesingData1() {\n\n}", "function headerNavBarLinkValues(navName) {\n\n //console.log(\"backend fired!\");\n\n var navServiceLinkList = [\"Service 1\", \"/service1.html\", \"Service 2\", \"/service2.html\", \"Service 3\", \"/service3.html\", \"Service 4\", \"/service4.html\",\n \"Service 5\", \"/service5.html\", \"Service 6\", \"/service6.html\", \"Service 7\", \"/service7.html\"];\n\n var navGalleryLinkList = [\"Gallery 1\", \"/gallery1.html\", \"Gallery 2\", \"/gallery2.html\", \"Gallery 3\", \"/gallery3.html\", \"Gallery 4\", \"/gallery4.html\",\n \"Gallery 5\", \"/gallery5.html\", \"Gallery 6\", \"/gallery6.html\", \"Gallery 7\", \"/gallery7.html\"];\n\n var linkObj = {};\n linkObj.hyperLinks = [];\n linkObj.names = [];\n\n // array Position Counter\n var x = 0;\n\n if (navName == servicesLink){\n\n for(var i = 0; i < navServiceLinkList.length; i++){\n if(i % 2 == 0 || i == 0){\n linkObj.names[x] = (navServiceLinkList[i]);\n x = x +1;\n } else {\n linkObj.hyperLinks[x - 1] = (navServiceLinkList[i]);\n }\n //console.log(\"create product list loop fired!\");\n }\n } else if (navName == galleryLink){\n for(var i = 0; i < navGalleryLinkList.length; i++){\n if(i % 2 == 0 || i == 0){\n linkObj.names[x] = (navGalleryLinkList[i]);\n x = x +1;\n } else {\n linkObj.hyperLinks[x - 1] = (navGalleryLinkList[i]);\n }\n //console.log(\"create product list loop fired!\");\n }\n }\n var linkJSON = JSON.stringify(linkObj);\n //console.log(\"JSON going to show\");\n //console.log(linkJSON);\n return linkJSON;\n}", "function accessesingData2() {\n\n}", "function accessesingData2() {\n\n}", "function nameFollowUp(data){\n return data.name;\n }", "function setGoToData(){\n\t\t\t//set links array\n\t\t\t$scope.goToData.links.push({type: 'user id', namePath: 'id', sref: 'spa.user.userEdit', paramKey: 'userId', paramPath: 'id'});\n\t\t\tif(hasAccountsPermissions) $scope.goToData.links.push({type: 'account', namePath: 'accountName', sref: 'spa.account.accountEdit', paramKey: 'accountId', paramPath: 'accountId'});\n\t\t\t//$scope.goToData.links.push({type: 'permissions', namePath: 'id', sref: 'spa.user.userPermissions', paramKey: 'userId', paramPath: 'id'});\n\n\t\t\t//due to the fact that HISTORY action was already added by entityLayout.js, needs to reorder the actions and add HISTORY to be last\n\t\t\t//set actions array\n\t\t\t$scope.goToData.actions.splice(0, 0, {name: 'New User', func: addNewUser});\n\t\t\t$scope.goToData.actions.splice(1, 0, {name: 'Delete', func: deleteEntity});\n\t\t}", "function addNavigationLink(_data, _json) {\n var data = _data.replace(/\"/g, \"\");\n var test = identifyDataType(data);\n\n\n if (test == false) {\n return `\"${data}\"`\n \n } else if (test == \"isBlockHash\"){\n return `<a href=\"javascript:getBlockHash('${data}')\">\"${data}\"</a>`\n \n } else if (test == \"isBlockNb\"){\n // récupération de segments présécent data dans _json\n var index = _json.indexOf(data);\n var test1 = _json.substr((index - 15), index);\n var test2 = _json.substr((index - 11), index);\n var test3 = _json.substr((index - 16), index);\n\n // Vérification que que ce sont les bons mots clés\n // précent la data que l'on veut vérifier\n if (/(\"nb\":)/.test(test1) |/(\"blocks\":)|(\"height\":)/.test(test2) || /(\"block_height\":)/.test(test3)) {\n return `<a href=\"javascript:getBlockHeight('${data}')\">\"${data}\"</a>`\n } else {\n return data;\n }\n \n } else if (test == \"isTx\") {\n return `<a href=\"javascript:getTx('${data}')\">\"${data}\"</a>`\n \n } else if (test == \"isAddress\"){\n return `<a href=\"javascript:getAddress('${data}')\">\"${data}\"</a>`\n }\n}", "function ModelSwitch(name, args){\n var names = {\n \"responseJob\":function(){ // tab-index.html\n capability = {\n Url:'/#/tab/search', BtnTitle:'去搜索',\n Msg:'继续加载内容可能会使滑动缓慢(卡顿),您也可以通过搜索找到您想要的职位' }\n url = $rootScope.app_config.api + '/api/Common/Job/GetHomeJobList?'+\n 'AreaId=' + ($cookies.get(\"cityCode-key\") || \"00000000000000000000000000440500\") +\n '&PageIndex=' + scope.PageIndex + '&PageSize=' + scope.onePage\n \n }\n ,\"SearchResumeList\":function(){\n /*\n \"/api/Company/Resume/SearchPublicResume?Key=\" + $scope.datas.Key + \n \"&IntentionJobTypes=\" + $scope.datas.IntentionJobTypes + \"&IntentionAreas=\" + \n $scope.datas.IntentionAreas + \"&Pays=\" + $scope.datas.Pays + \"&Gender=\" + \n $scope.datas.Gender + \"&LastLoginDay=\" + $scope.datas.LastLoginDay + \n \"&PageIndex=\" + $scope.datas.PageIndex + \"&PageSize=\" + $scope.datas.PageSize\n */\n url = $rootScope.app_config.api + '/api/Company/Resume/SearchPublicResume?' +\n 'Key=' + args.Key + '&IntentionJobTypes=' + args.IntentionJobTypes +\n '&IntentionAreas=' + args.IntentionAreas + '&Pays=' + args.Pays +\n '&Gender=' + args.Gender + '&LastLoginDay=' + args.LastLoginDay +\n '&PageIndex=' + scope.PageIndex + '&PageSize=' + scope.onePage;\n }\n ,\"responseResume\": function(){ // company-index.html\n url = $rootScope.app_config.api + '/api/Common/Resume/GetHomeResumeList?'+\n 'AreaId=' + ($cookies.get(\"cityCode-key\") || \"00000000000000000000000000440500\") +\n '&PageIndex=' + scope.PageIndex + '&PageSize=' + scope.onePage\n }\n ,\"JobApplyList\": function(){\n url = $rootScope.app_config.api + '/api/Company/JobApply/GetSimpleJobApplyList?'+\n 'PageIndex=' + scope.PageIndex + '&PageSize=' + scope.onePage\n }\n ,\"CommonJobList\": function(){\n url = $rootScope.app_config.api + scope.commonUrl + '?AreaId=' + ($cookies.get(\"cityCode-key\") || \"00000000000000000000000000440500\") +\n '&PageIndex=' + scope.PageIndex + '&PageSize=' + scope.onePage\n }\n ,\"IndustryCateLists\": function(){\n url = $rootScope.app_config.api + '/api/Common/Job/GetIndustryJobList?' +\n 'AreaId=' + ($cookies.get(\"cityCode-key\") || \"00000000000000000000000000440500\") +\n '&PageIndex=' + scope.PageIndex + '&PageSize=' + scope.onePage +\n '&IndustryId=' + scope.id\n }\n };\n if(typeof names[name] != \"function\"){ return false; }\n return names[name]();\n }", "handlegood(event) {\n const goodId = event.detail; \n console.log(goodId); \n // Navigate to product record page\n this[NavigationMixin.Navigate]({\n type: 'standard__recordPage',\n attributes: {\n recordId: goodId,\n objectApiName: 'Product__c',\n actionName: 'view',\n },\n });\n }", "function RequestLoadGeneralData() {\n\n}", "function getAboutData() {\n\n //var featureRelId = getUrlVars()['transferId'];\n var userSiteId = getUrlVars()['touchId'];\n var itemId = getUrlVars()['itemId'];\n\tvar featureName = getUrlVars()['featureName'];\n\tfeatureName = featureName.replace(/\\%20/g,' ');\n\tfeatureNameTitle(featureName);\n\t\n var menuhtml = $(\"userSiteId\").find('a').html();\n //var userSiteId = $('#userSiteId').val();\n var url = baseUrl + 'web/web/getAboutUsDescription/' + itemId;\n var data = '';\n doAjaxCall(url, data, false, function (html) {\n //console.log(html);\n $('title,.header-content h1').html(menuhtml);\n $('.header-content .back').show();\n $('#main-content').html(html[0].description);\n\t\t$('#main-content').css({ 'background-color': '#' + html[0].globalBackground, 'color': '#' + html[0].globalTextColor });\n });\n\tgetUserAppereance();\n}", "function lookUpUserName(data, type, row, meta) {\n let name = null;\n abp.ajax({\n type: 'GET',\n async: false,\n url: '/api/identity/users/' + data, //here is GUID data\n }).done(function (result) {\n name = result.name\n });\n return name \n }", "function sendData() {\n\tvar packed = \"\";\n\tpacked += escape(selectedName);\n\tpacked += \",\";\n\tpacked += escape(selectedSrc);\n\twindow.location = \"ConsumAparell2.html?\"+packed;\n}", "function link(data) {\r\n\tconsole.log(data);\r\n}", "function sendName(something) {\n let apiCall = \"https://api.nasa.gov/mars-photos/api/v1/manifests/\" + something + \"/?api_key=RZGwSzKbOaZadLPNj2btegTPGivRWJI8IKnLnUsd\"\n let splitCall = \"https://api.nasa.gov/mars-photos/api/v1/rovers/\" + something + \"/photos?sol=$&api_key=RZGwSzKbOaZadLPNj2btegTPGivRWJI8IKnLnUsd\"\n let holder\n\n fetch(apiCall).then(function (response) {\n if (response.ok) {\n response.json()\n .then(function (data) {\n holder = data;\n newFunction(holder, splitCall)\n });\n } else {\n alert(\"Error: \" + response.statusText + \"... The API call is failing. Come back soon!\");\n }\n });\n}", "function changeName() {\n var lightName = event.target.value;\t\t\t\t// what did you click on?\n var thisLight = event.target.parentNode.id;\t// get the parent (light number)\n var payload = { \"name\": lightName }; // form the name payload\n setLight(thisLight, payload, 'name'); // make the HTTP call\n}", "handleClick() {\n let conf = {\n type: \"standard__recordPage\", // type defines what type of PageReference it is, whether it is a record page,an lightning app, or login page or any other thing \n attributes: { // attribute is used to define the properties of the configuration file\n recordId: \"00B5g00000EXixUEAT\",\n objectApiName: \"Lead\",\n actionName: \"view\"\n }\n };\n\n this[NavigationMixin.Navigate](conf);\n }", "function dataHandler() { //TODO Add properties to info Card **************\n const routeData = data.route;\n for (const item in routeData) {\n if (item.includes(day)) {\n const routeItems = data.route[item];\n for (const key in routeItems) {\n const keys = routeItems[key];\n if ((keys.name).includes(title)) {\n event.push(keys.label, keys.score, keys.imageURL, keys.intro)\n return\n }\n }\n }\n }\n }", "function senGuiData()\n{\n\tvar datasend={\n\t\tevent:\"guidata\"\n\t}\n\tqueryDataGet(\"php/api_process.php\",datasend,function(res){\n\t\t//nhan du lieu tu server tra ve\n\t\talert_info(res);\n\t});\n\tqueryDataPost(\"php/api_process_post.php\",datasend,function(res){\n\t\t//nhan du lieu tu server tra ve\n\t\talert_info(\"Post:\"+res);\n\t});\n}", "function setName() {\n var input = document.getElementById('name');\n skylink.setUserData({\n name: input.value\n });\n}", "function productreview(data){\n console.log(data);\n location.href =\"/product_review_buyer\"+data;\n}", "function name_click_handler(data_url) {\n resetFactoryColor();\n // waiting for the results\n $.getJSON(url_get_factory_ids_dealing_with_component + data_url)\n .done(function (data) {\n if (data) {\n // show them in a table\n // mark those factories in the map\n for (var i = 0; i < data.length; ++i)\n markFactoryColor(data[i]);\n } \n })\n .fail(function (status, err) {\n console.log(\"Error: failed to load factory supplying or comsuming the component\", factory_id);\n })\n\n}", "function myData() {\n retrun;\n}", "function storeIdName(data) {\n localStorage.setItem(\"orderNumber\", data.orderId);\n localStorage.setItem(\"UserName\", data.contact.firstName);\n window.location.href = \"./order.html\";\n }", "function leadsLink(val){\n\n //debugger;\n return '<li><a href=\"#page\" class=\"dynamic\" id=\"'+key+'\"><h2>' + val.name + '</h2><p>' + val.email + '</p><p class=\"ui-li-aside\"><strong>' + val.date +'</strong></p></a></li>';\n \n }", "function handleTOOData (data) {\n var Data = data.data;\n pushMaster(Data);\n\n }", "nav_helper_add(data) {\n\t\tif((data.AccountName!='')&&(data.Category=='yes')){\n\n\t\t\tdata.AccountName=data.AccountName+util.randomnumbergeneration(999);\n\t\t}\n\t\tif((data.AccountNumber!='')||(data.Category='yes')){\n\n\t\t\tdata.AccountNumber=data.AccountNumber+util.randomnumbergeneration(9999999);\n\t\t}\n\t\tutil.selectDropDown(this.group,data.Group,'Group','Account Info');\n\t\tutil.selectDropDown(this.clientName,data.ClientName,'Client Name','Account Info ');\n\t\tutil.inputValidation(this.accountName,data.AccountName,'Account Name','Account Info');\n\t\tutil.inputValidation(this.accountNumber,data.AccountNumber,'Account Number','Account Info');\n\t\tutil.scrolldown(this.nextBtn1)\n\t\tutil.elementClickable(this.nextBtn1)\n\t}", "_onSelect(data) { \n this.props.navigator.push({title: 'Details Page', index: 4, \n passProps : { data: data}}) \n }", "function selectData(node)\n{\n\n var nodeparent=node.parent;\n var nodeparentF=nodeparent.parent;\n\n\n var title= nodeparentF.name+' - '+ nodeparent.name;\n\n var tvalue=node.typeValue;\n var url=nodeparent.url +node.url ;\n var isCmd= Boolean(node.isCmd)?\"1\":\"0\" ;\n var valueList=node.value.split(',');\n url+=\"/\"+ title +'/'+nodeparent.id;\n for(var i=0;i< valueList.length;i++)\n {\n url += \"/\"+ valueList[i];\n }\n\n if(tvalue.indexOf('Template')==0)\n {\n tvalue=tvalue.replace(\"Template_\",\"\");\n url +='/'+node.name+'/'+tvalue+'/'+isCmd+'/tmp';\n }else{\n\n url +=\"/\"+tvalue+'/'+isCmd+'/mq';\n }\n\n\n if(null!=url &&''!= url)\n {\n window.parent.frames[\"main\"].location.href =url;\n }\n\n}", "function data_call(arg1){\n\n\t// 'Tis a focus node.\n\tfocus_nodes[arg1] = true;\n\n\t// Data call setup.\n\tvar base = 'http://kato.crbs.ucsd.edu:9000/scigraph/graph/neighbors/' +\n\t arg1 + '.json';\n\tvar rsrc = base + '?' + 'depth=' + desired_spread;\n\tmanager.resource(rsrc);\n\tmanager.method('get');\n\t//manager.use_jsonp(true);\n\tmanager.jsonp_callback('callback');\n\n\t// Action.\n\t_spin_show();\n\tmanager.action();\n }", "function trigger(data) {\n\t\tvar el = $('#slider .navigation').find('a[href$=\"' + data.id + '\"]').get(0);\n\t\tselectNav.call(el);\n\t}", "function setGoToData(){\n\t\t\t$scope.childModel.accountCount = $scope.childModel.siteAccounts ? $scope.childModel.siteAccounts.length : 0;\n\t\t\t//set links array\n\t\t\t$scope.goToData.links.push({type: 'site id', namePath: 'id', sref: 'spa.site.siteEdit', paramKey: 'siteId', paramPath: 'id'});\n\t\t\tif(hasCampaignsPermissions) $scope.goToData.links.push({type: 'campaigns', namePath: 'relationsBag.children.campaigns.count', sref: 'spa.site.campaigns', paramKey: 'siteId', paramPath: 'id'});\n\t\t\tif(hasAccountsPermissions) $scope.goToData.links.push({type: 'accounts', namePath: 'accountCount', sref: 'spa.site.accounts', paramKey: 'siteId', paramPath: 'id'});\n\t\t\t//$scope.goToData.links.push({type: 'site sections', namePath: 'id', sref: 'spa.site.sitesections', paramKey: 'siteId', paramPath: 'id'});\n\n\t\t\t//due to the fact that HISTORY action was already added by entityLayout.js, needs to reorder the actions and add HISTORY to be last\n\t\t\t//set actions array\n\t\t\tvar indx = 0;\n\t\t\tif(hasCreateSitePermission) $scope.goToData.actions.splice(indx++, 0, {name: 'New Site', func: newSite});\n\t\t\t$scope.goToData.actions.splice(indx++, 0, {name: 'New Site Section', func: newSiteSection});\n\t\t\t$scope.goToData.actions.splice(indx, 0, {name: 'Delete', func: deleteEntity});\n\t\t}", "function sendData() {\n cardShare.classList.remove('hidden');\n fetch(urlBase, {\n method: 'POST',\n body: localStorage.getItem('Details'),\n headers: {\n 'content-type': 'application/json'\n }\n })\n .then(response => response.json())\n .then(data => showURL(data))\n .catch(function (error) { console.log(error) })\n // shareLink(event);\n}", "function dataRequested(e) {\n var request = e.request;\n\n // Title is required\n var dataPackageTitle = $(\"#articleTitle\").html();\n if ((typeof dataPackageTitle === \"string\") && (dataPackageTitle !== \"\")) {\n request.data.properties.title = dataPackageTitle;\n\n try {\n request.data.setUri(new Windows.Foundation.Uri($(\"#articleLink\").html()));\n } catch (ex) {\n //show error message\n }\n } else {\n request.failWithDisplayText(\"Enter the text you would like to share and try again.\");\n }\n }", "function DataUrl() \n{ \n var url = \"json.php?bucket=m\";\n url += \"&customer=\";\n if (params['customer'])\n {\t\n url += params['customer'];\n }\n url += \"&product=\";\n if (params['product'])\n {\t\n url += params['product'];\n }\n url += \"&os=\";\n if (params['os'])\n {\t\n url += params['os'];\n }\n url += \"&software1=\";\n if (params['software1'])\n {\n url += params['software1'];\n }\n url += \"&software2=\";\n if (params['software2'])\n {\n url += params['software2'];\n }\n url += \"&software3=\";\n if (params['software3'])\n {\n url += params['software3'];\n }\n url += \"&from=\";\n url += Math.floor(lookback);\n return url; \n}", "function Ins_Upd_EarthHeartData(_Data, _ReturnUrl) {\n if (localStorage.User == null || localStorage.User == undefined)\n app.application.navigate('signup_login.html');\n else\n User = $.parseJSON(localStorage.User);\n\n var Parameters = User.Id + '/'\n + _Data.Type + '/'\n + _Data.DonationAmount + '/'\n + _Data.Transactions + '/'\n + _Data.FriendRecommendation + '/'\n + _Data.CO2Saved;\n}", "function caller(name){\n var data = {};\n data.title = \"task\";\n data.message = name;\n\t\t\t\t\t\n $.ajax({\n\t type: 'POST',\n\t data: JSON.stringify(data),\n\t contentType: 'application/json',\n url: '/list',\t\t\t\t\t\t\n success: function(data) {\n }\n });\n }", "function showData(name)\n {\n console.log('hello'+' '+name);\n }", "function _data_call(nid){\n\tman.set_id(nid);\n\tman.search();\n }", "function HNG_Data(name, id, lang, mail){\n console.log(\"Hello World, this is \" + name + \" with HNGi7 ID \" + id + \" using \" + lang + \" for stage 2 task.\"+ mail);\n}", "handleClick() {\n this[NavigationMixin.Navigate]({\n type: \"standard__recordPage\",\n attributes: {\n recordId: this.record.Id,\n actionName: \"view\"\n }\n });\n }", "function handleClick(){\n history.push(`/getTools/${_id}`)\n }", "handleViewDetailsClick() {\n this[NavigationMixin.Navigate]({\n type: 'standard__recordPage',\n attributes: {\n recordId: this.location.Id,\n objectApiName: LOCATION_OBJECT.objectApiName,\n actionName: 'view'\n }\n });\n }", "function getData(requestUrl) {\n \n\n}", "function callDataItem(_itemID, _region, _token){\r\r\n // Build out the call URL\r\r\n let full_url = URL_BASE + URL_ITEM_EXT;\r\r\n full_url += `/${_itemID}`;\r\r\n full_url += `?${_region}`;\r\r\n full_url += `&access_token=${_token}`;\r\r\n \r\r\n // Call the ajax function, async to prevent organizeItemData from loading prior to requests coming back\r\r\n $.ajax({\r\r\n datatype: \"json\",\r\r\n url: full_url,\r\r\n data: null,\r\r\n async: false,\r\r\n success: organizeItemData,\r\r\n error: searchFailed\r\r\n });\r\r\n}", "function executeLink(pData) {\n var key = specialStr + unescape(pData.id);\n var index = pData.index;\n\n if (seriesData[key]) {\n var seriesObj = seriesData[key];\n if (seriesObj.length === 1) {\n index = 0\n }\n\n if (seriesData[key][index] && seriesData[key][index].link) {\n util.link(seriesData[key][index].link);\n }\n }\n }", "sendCat() {\r\n let sendData = \"\";\r\n this.items.click((e) => {\r\n sendData = e.target.getAttribute(\"value\");\r\n this.fetchUrl(sendData);\r\n })\r\n if (sendData == \"\") {\r\n this.fetchUrl(\"now_playing\");\r\n }\r\n\r\n }", "navigateToComponent(event) {\n let contractCode = event.currentTarget.dataset.item;\n // eslint-disable-next-line no-console\n console.log('contractcode:'+contractCode);\n this[NavigationMixin.Navigate]({\n type: 'standard__component',\n attributes: {\n componentName: 'c__alternateEndingModifyPlan' \n },\n state: {\n c__currentContractCode: contractCode\n }\n });\n }", "function theClick() {\r\n console.log('inicia')\r\n dataNodes()\r\n dataElements()\r\n backEnd()\r\n}", "function make_items_clickable(data_type){\n $('.dd-detail').unbind('click');\n $('.dd-detail').bind('click', function(){\n build_detail_query($(this).data('key'), $(this).data('source')); \n });\n\n }", "function executeLink( pData ) {\n const key = specialStr + unescape( pData.id );\n let index = pData.index;\n\n if ( seriesData[key] ) {\n const seriesObj = seriesData[key];\n if ( seriesObj.length === 1 ) {\n index = 0;\n }\n\n if ( seriesData[key][index] && seriesData[key][index].link ) {\n util.link( seriesData[key][index].link, seriesData[key][index].linkTarget );\n }\n }\n }", "function productSpecific(content, data) {\n\n //check what it thinks is the target data (object)\n console.log(data[content].menu);\n\n}", "function trigger(data) {\n var el = $('#slider .navigation').find('a[href$=\"' + data.id + '\"]').get(0);\n selectNav.call(el)\n\t\t\t\t;\n\t\t\t\tvar el1 = $('#slider1 .navigation').find('a[href$=\"' + data.id + '\"]').get(0);\n selectNav.call(el1)\n\t\t\t\t;\n\t\t\t\tvar el2 = $('#slider2 .navigation').find('a[href$=\"' + data.id + '\"]').get(0);\n selectNav.call(el2)\n\t\t\t\t;\n\t\t\t\tvar el3 = $('#slider3 .navigation').find('a[href$=\"' + data.id + '\"]').get(0);\n selectNav.call(el3)\n\t\t\t\t;\n\t\t\t\tvar el4 = $('#slider4 .navigation').find('a[href$=\"' + data.id + '\"]').get(0);\n selectNav.call(el4)\n\t\t\t\t;\n }", "componentDidMount() {\n this.refs.analytics.sendData({\n \"action-type\": \"click\",\n \"starting-screen\": this.props.navigation.state.params.previousScreen?this.props.navigation.state.params.previousScreen:null,\n \"starting-section\": this.props.navigation.state.params.previousSection?this.props.navigation.state.params.previousSection:null,\n \"target\": \"Links\",\n \"resulting-screen\": \"links\", \n \"resulting-section\": null,\n });\n let links =\n \"https://k7viviyvod.execute-api.us-west-2.amazonaws.com/prod/links\";\n axios.get(links).then(response => {\n this.setState({\n data: response.data\n });\n });\n }", "function RequestLoadPersonalData() {\n\n}", "async function assign_referral_url(idToken, contract_data, next){\n let response_data = {};\n await fetch('https://api.lifo.ai/am/lifo_tracking', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: idToken,\n },\n body: JSON.stringify(contract_data),\n })\n .then(response => {\n if (response.statusCode > 299){\n console.error('failed to retrieve referral url with statusCode', response.statusCode, response.statusText);\n return new functions.https.HttpsError('not-found','failed to get matched shops');\n }\n response_data = response.json();\n return response_data;\n })\n .catch(next);\n return response_data;\n}", "function getRouteData() {\n\t// get reference to the selected country\n\tlet countryRef = document.getElementById(\"country\");\n\tlet country = countryRef.value;\n\n\t// define data object that will be passed on as parameters to the webServiceRequest function\n\tlet data1 = {\n\t\tcountry: country,\n\t\tcallback: \"showAllRoutes\"\n\t};\n\n\t// define url that will be passed on as parameters to the webServiceRequest function\n\tlet url1 = `https://eng1003.monash/OpenFlights/allroutes/`;\n\n\t// call webServiceRequest function to send request to the web service\n\twebServiceRequest(url1, data1);\n}", "function get_data() {}", "showRestaurant(event) {\n let data = event.currentTarget.dataset;\n let id = data.id;\n\n wx.navigateTo({\n url: `/pages/detail/detail?id=${id}`\n })\n }", "sendClickedVenue(key){\n this.props.sendData(key);\n }", "function sendClickCode(typeName, data, option) {\n // Exception\n //if(data.indexOf(\"submit a review\") != -1){\n //\treturn;\n //}\n\n if (typeName.indexOf(\"TEMPORARY\") != -1) {\n recallClickCode(typeName, data, option);\n return;\n }\n\n if (typeName.indexOf(\"pid\") != -1) {\n getPid(data);\n return;\n }\n if (option == \"REPLACE\") {\n data = data.replace(/,/gi, \"\").toLowerCase();\n }\n\n var trackVar = {\n /*\n\t\t< Options >\n\t\t1. section : business, support\n\t\t2. sitecode : define country code that you want to call this function.\n\t\t\n\t\t\"example\" : \"events=event1|eVar43=data#0|prop30=data#1|type=o|trackname=example tracking|section=support|sitecode=uk,sg,in\",\n\t\t*/\n\n\n //< Ko ga-young >\n \"account\": \"events=event31|eVar31=data#0|eVar64=data#1|type=o|trackname=account event\",\n \"locator\": \"events=event22|eVar22=data#0|products=data#1|type=o|trackname=locator\",\n \"locator_noresult\": \"events=event22|prop21=data#0|products=data#1|type=o|trackname=locator search noresult\",\n \"search_success\": \"events=event21|eVar21=data#0|type=o|trackname=search success\",\n \"pop_rct_search\": \"events=event21|eVar61=data#0|type=o|trackname=popular_recent search\",\n \"search_fail\": \"events=event21|prop21=data#0|type=o|trackname=search fail\",\n \"share\": \"events=event29|eVar29=data#0|type=o|trackname=share button click\",\n \"spt_search_success\": \"events=event23|eVar23=data#0|type=o|trackname=support search success\",\n \"spt_search_fail\": \"events=event23|prop21=data#0|type=o|trackname=support search fail\",\n //\"support_content\" : \"events=event34|eVar34=data#0|type=o|trackname=get tips click\",\n \"support_content\": \"events=event34|eVar34=data#0|products=data#1|type=o|trackname=get tips click\",\n \"reviews\": \"events=event68|eVar68=data#0|type=o|trackname=reviews action\",\n \"support_submit\": \"events=event30|eVar30=data#0|eVar38=data#1|type=o|trackname=content submit action\",\n\n //< Kim yu-kyeong >\n \"jumpto\": \"prop11=data#0|type=o|trackname=jump to tracking\",\n \"view_more\": \"prop11=data#0|type=o|trackname=view more tracking\",\n \"view more\": \"prop11=data#0|type=o|trackname=view more tracking\",\n \"pdp_gallery\": \"events=event27|eVar27=data#0|type=o|trackname=pdp gallery tracking\",\n \"pdp_360\": \"events=event27|eVar27=data#0|type=o|trackname=pdp 360 tracking\",\n \"pdp_wishlist\": \"events=event31|eVar31=data#0|type=o|trackname=pdp wishlist add\",\n \"instore_pdp_findproduct\": \"events=event26|eVar26=data#0|type=o|trackname=instore pdp find product\",\n \"content\": \"eVar38=data#0|type=o|trackname=content item\",\n \"content_click\": \"events=event26|eVar26=data#0|products=data#1|eVar41=data#2|type=o|trackname=content interaction\",\n \"gnb\": \"prop7=data#0|type=o|trackname=gnb tracking\",\n \"download_b2b\": \"events=event33|eVar32=data#0|eVar38=data#1|type=o|trackname=b2b download resources\",\n\n //< Jeong eui-tak >\n \"contact\": \"events=event30|eVar30=data#0|type=o|trackname=contact\",\n \"compare\": \"events=event28|eVar28=data#0+data#1|prop74=data#1|type=o|trackname=compare\",\n \"category_filter\": \"events=event44|eVar44=data#0|type=o|trackname=category filter\",\n \"download\": \"events=event32|eVar32=data#0|products=data#1|type=o|trackname=download\",\n \"warranty_menu\": \"eVar34=data#0|type=o|trackname=warranty\",\n \"finding_method\": \"events=event25|eVar25=data#0|products=data#1|type=o|trackname=product finding method\",\n \"finding method\": \"events=event25|eVar25=data#0|products=data#1|type=o|trackname=product finding method\",\n \"service_locator_success\": \"events=event24|eVar24=data#0|type=o|trackname=service locator search\",\n \"service_locator_fail\": \"events=event24|prop21=data#0|type=o|trackname=service locator search\",\n \"resource_content\": \"eVar38=data#0|type=o|trackname=resource content\",\n \"pre_order\": \"events=event35|eVar35=data#0|type=o|trackname=pdp pre order\",\n //\"wishlist\" : \"events=event35|eVar35=data#0|eVar41=data#1|type=o|trackname=wish list click event\",\n \"wishlist\": \"events=event35|eVar35=data#0|eVar41=data#1|products=data#2|type=o|trackname=wish list click event\",\n \"shopping_faq_type\": \"prop11=data#0|type=o|trackname=shopping faq type select\",\n \"shopping_faq_question\": \"events=event26|eVar26=data#0|type=o|trackname=shopping faq question\",\n \"pdp_scroll_down\": \"events=event46|eVar46=data#0|type=o|trackname=pdp scroll down\",\n\n // store\n //\"sign_in\" : \"events=event62|eVar64=data#0|type=o|trackname=login\",\n \"wish_list\": \"events=event31|eVar31=data#0|products=data#1|type=o|trackname=wish list click event\",\n \"wish_list_cat\": \"events=event31|eVar31=data#0|products=data#1|eVar41=data#2|type=o|trackname=content interaction\",\n \"content_click_count\": \"prop26=data#0|type=o|trackname=content interaction count\",\n //\"promotion\" : \"events=event45|eVar33=data#0|type=o|trackname=promotion\",\n //\"promotion_product\" : \"events=event45|eVar33=data#0|products=data#1|type=o|trackname=promotion\",\n \"footer\": \"prop17=data#0|type=o|trackname=footer link click\",\n\n //promotion\n \"microsite_action\": \"events=event45|eVar33=data#0|type=o|trackname=microiste action tracking\",\n //my samsung\n \"mys_account\": \"events=event31|eVar31=data#0|eVar64=data#1|type=o|trackname=my samsung account event\",\n \"mys_account_prd\": \"events=event31|eVar31=data#0|products=data#1|type=o|trackname=my samsung account event\",\n\n //for B2B\n \"b2b_search_success\": \"events=event47|eVar47=data#0|type=o|trackname=b2b search success\",\n \"b2b_search_fail\": \"events=event47|prop21=data#0|type=o|trackname=b2b search fail\",\n \"b2b_index\": \"prop11=data#0|type=o|trackname=b2b tab index click\",\n \"b2b_resource_related\": \"events=event25|eVar25=data#0|eVar38=data#1|type=o|trackname=related resource click\",\n \"b2b_product_related\": \"events=event25|eVar25=data#0|products=data#1|type=o|trackname=related product click\",\n \"b2b_insights_related\": \"events=event25|eVar25=data#0|eVar38=data#1|type=o|trackname=related insights click\",\n \"b2b_insights_related_download\": \"events=event33|prop26=data#0|eVar38=data#1|eVar32=data#2|type=o|trackname=related insights download click\",\n \"b2b_solution_related\": \"events=event25|eVar25=data#0|eVar38=data#1|type=o|trackname=related insights click\",\n \"b2b_solution_related_download\": \"events=event33|prop26=data#0|eVar38=data#1|eVar32=data#2|type=o|trackname=related solution download click\",\n \"content_click_count_share\": \"events=event29|prop26=data#0|eVar29=data#1|type=o|trackname=share button click\",\n \"poll_submit\": \"prop57=data#0|prop58=data#1|type=o|trackname=poll submit\",\n\n \"b2b_category_filter\": \"prop7=data#0|type=o|trackname=b2b category filter\",\n \"download_b2b_pdp\": \"events=event33|eVar32=data#0|prop32=data#1|type=o|trackname=b2b download resources\",\n \"b2b_find_device\": \"prop47=data#0|type=o|trackname=b2b search success\",\n \"b2b_content_click\": \"events=event26|eVar26=data#0|prop26=data#1|type=o|trackname=b2b cotent click\",\n \"b2b_change_account\": \"events=event31|eVar31=data#0|prop26=data#1|type=o|trackname=b2b change account\",\n \"b2b_play_video_popup\": \"prop26=data#0|eVar38=data#1|type=o|trackname=play video click\",\n\n //for SEC NextGen\n \"sec_store_action\": \"events=event45|eVar33=data#0|products=data#1|type=o|trackname=microiste action tracking\",\n \"mixed_task\": \"events=event31|prop31=data#0|products=data#1|type=o|trackname=microiste action tracking\",\n \"category_colorchip\": \"events=event27|eVar27=data#0|eVar41=data#1|products=data#2|type=o|trackname=category color chip\",\n \"category_button\": \"events=event25|eVar25=data#0|eVar41=data#1|products=data#2|type=o|trackname=category button\",\n \"target_marketing\": \"events=event75|eVar75=data#0|type=o|trackname=target marketing tracking\"\n\n\n };\n\n var businessTrackVar = {\n\n };\n\n var supportTrackVar = {\n\n };\n\n //Value initiation\n s.linkTrackVars = 'none';\n s.linkTrackEvents = 'none';\n var trackValue = \"\";\n var splitedTrackValue = \"\";\n //Value initiation end\n\n //trackData is the specific value of the trackVar Array\n var trackData = trackVar[typeName.trim()];\n var topSection = getOmniTopSection();\n\n if (trackData != undefined) {\n if (trackData.indexOf(\"|section=business\") != -1) {\n if (topSection == \"business\") trackData = businessTrackVar[typeName.trim()];\n } else if (trackData.indexOf(\"|section=support\") != -1) {\n if (topSection == \"support\") trackData = supportTrackVar[typeName.trim()];\n }\n } else {\n printOmniLog(\"trackData is undefined. Add [\" + typeName + \"] tag in sendClickCode() function!!!!\");\n return;\n }\n\n //trackValue is the split value of the trackData\n if (trackData) { trackValue = trackData.split(\"|\"); } else { return false; }\n\n // Variables definition\n var events = \"\";\n var eVar = \"\";\n var prop = \"\";\n var products = \"\";\n var type = \"\";\n var name = \"\";\n var countryCode = \"\";\n var number = 0;\n // End of Variables definition\n\n //(mean : addition of condition) Each call of the SendClickCode below var set up every Click;\n s.linkTrackVars = \"eVar6,eVar39,eVar40,eVar9\";\n s.eVar6 = getOmniInputTagValue(\"pageTrack\");\n s.eVar39 = window.location.href;\n s.eVar40 = s.pageName;\n s.eVar9 = getOmniDeviceType();\n //End of the set up var\n\n for (var i = 0 ; i < trackValue.length ; i++) {\n splitedTrackValue = trackValue[i].split(\"=\")[0];\n\n if (splitedTrackValue.indexOf(\"events\") != -1) {\t// s.events\n events = trackValue[i].split(\"=\")[1];\n\n if (s.linkTrackEvents == \"none\") {\n s.linkTrackEvents = events;\n } else {\n s.linkTrackEvents += \",\" + events;\n }\n\n if (s.linkTrackVars == \"none\") {\n s.linkTrackVars = \"events\";\n } else {\n s.linkTrackVars += \",events\";\n }\n s[\"events\"] = events;\n } else if (splitedTrackValue.indexOf(\"eVar\") != -1) {\t// s.eVar#\n eVar = splitedTrackValue;\n if (s.linkTrackVars == \"none\") {\n s.linkTrackVars = eVar;\n } else {\n s.linkTrackVars += \",\" + eVar;\n }\n\n // If typeNmae = 'compare', then concat the data value(ex;\"allGT-i9100^GT-i3000^GT-i9500\")\n if (trackValue[i].split(\"=\")[1].indexOf(\"+\") >= 0) {\n s[eVar] = data.split(\"|\")[0].concat(data.split(\"|\")[1])\n } else if (trackValue[i].split(\"=\")[1].indexOf(\"data#\") != -1) {\n if (data != undefined) {\n number = trackValue[i].split(\"=\")[1].split(\"#\")[1];\n s[eVar] = data.split(\"|\")[number];\n number = 0;\n }\n } else {\n s[eVar] = trackValue[i].split(\"=\")[1];\n }\n } else if (splitedTrackValue.indexOf(\"prop\") != -1) {\t// s.prop#\n prop = splitedTrackValue;\n if (s.linkTrackVars == \"none\") {\n s.linkTrackVars = prop;\n } else {\n s.linkTrackVars += \",\" + prop;\n }\n if (trackValue[i].split(\"=\")[1].indexOf(\"data#\") != -1) {\n number = trackValue[i].split(\"=\")[1].split(\"#\")[1];\n s[prop] = data.split(\"|\")[number];\n number = 0;\n } else {\n s[prop] = trackValue[i].split(\"=\")[1];\n }\n } else if (splitedTrackValue.indexOf(\"products\") != -1) {\t// s.products\n products = splitedTrackValue;\n if (data.split(\"|\")[1] != undefined) { //data존재시 \n if (trackValue[i].split(\"=\")[1].indexOf(\"data#\") != -1) { //products = data#존재시\n number = trackValue[i].split(\"=\")[1].split(\"#\")[1];\n if (data.split(\"|\")[number] != undefined) {\n if (s.linkTrackVars == \"none\") {\n s.linkTrackVars = \"products\";\n } else {\n s.linkTrackVars += \",products\";\n }\n s[\"products\"] = \";\" + data.split(\"|\")[number].trim().toUpperCase();\n }\n number = 0;\n } else {\n s[\"products\"] = \";\" + trackValue[i].split(\"=\")[1].toUpperCase(); //products='abc'존재시 \n }\n }\n } else if (splitedTrackValue.indexOf(\"type\") != -1) {\n type = trackValue[i].split(\"=\")[1];\n } else if (splitedTrackValue.indexOf(\"trackname\") != -1) {//s.trackname\n if (trackValue[i].split(\"=\")[1].indexOf(\"data#\") != -1) {\n number = trackValue[i].split(\"=\")[1].split(\"#\")[1];\n name = \";\" + data.split(\"|\")[number].trim();\n number = 0;\n } else {\n name = trackValue[i].split(\"=\")[1];\n }\n } else if (splitedTrackValue.indexOf(\"sitecode\") != -1) {\n countryCode = trackValue[i].split(\"=\")[1];\n var thisCountry = getOmniSiteCd();\n if (countryCode.indexOf(thisCountry) == -1) {\n initOmniVars();\n s.linkTrackVars = 'none';\n s.linkTrackEvents = 'none';\n return;\n }\n }\n }\n\n // Product Detail Page, Business Detail Page, Support Detail Page\n if (getOmniInputTagValue(\"pageTrack\").indexOf(\"product detail\") != -1 || getOmniInputTagValue(\"pageTrack\").indexOf(\"support detail\") != -1) {\n if (s.linkTrackVars.indexOf(\"products\") < 0) {\n s.linkTrackVars += \",products\";\n }\n if (s.linkTrackVars.indexOf(\"eVar41\") < 0) {\n s.linkTrackVars += \",eVar41\";\n }\n\n if (getOmniInputTagValue(\"model_name\") != \"\") {\n s[\"products\"] = \";\" + getOmniInputTagValue(\"model_name\").toUpperCase();\n s[\"eVar41\"] = getOmniInputTagValue(\"model_code\");\n } else {\n printOmniLog(\"You Must setup the input tag value about !!!!!!model_name!!!!!!!\")\n }\n }\n\n s.tl(true, type, name);\n s.linkTrackVars = 'none';\n s.linkTrackEvents = 'none';\n return true;\n}", "function getName (data) {\n log.trace('generating hello response from', data);\n return (data && data.hello) ? data.hello : 'World';\n}", "redirct(id)\n{\n this[NavigationMixin.Navigate]({\n type: 'standard__recordPage',\n attributes: {\n recordId: id,\n // objectApiName: 'Opportunity', // objectApiName is optional\n actionName: 'view'\n }\n });\n}", "function fetchdata(){\n var n_src = new Array(\"associated-press\",\"bbc-news\",\"the-times-of-india\",\"bloomberg\",\"cnbc\",\"cnn\",\"the-next-web\",\"bbc-sport\",\"national-geographic\",\"reuters\",\"daily-mail\",\"the-hindu\",\"espn-cric-info\",\"\");\n var picker = 0;\n picker=random(12);\n var n = ceil(picker);\n source = n_src[n];\n\n urla = api_a+source+sortBy+sortingValue+api_key_a;\n loadJSON(urla,gotData);\n\n }", "function getLink( item_data, pos ) {\r\n \r\n // Số thự tự lần gửi request\r\n if(pos == null) {\r\n pos = 1;\r\n }\r\n //lấy item_id\r\n var item_id = getItemId();\r\n //lấy item_title\r\n var item_title = getItemTitle();\r\n //lấy item_image\r\n var item_image = getItemImage();\r\n //lấy item_link\r\n var item_link = getItemLink();\r\n //lấy seller_id\t\r\n var seller_id = getSellerId();\r\n var seller_name = seller_id;\r\n //lay comment\r\n var comment = getComment();\r\n //lay ban gia\r\n var price_table = getPriceTable();\r\n\r\n // lay gia\r\n var item_price = getPrice(item_data[0]);\r\n // Multi buy\r\n var tbl_wrap = document.getElementsByClassName('content-wrapper');\r\n if(tbl_wrap.length > 0) {\r\n if(tbl_wrap[0].getElementsByClassName('content').length > 0) {\r\n item_price = item_data[4];\r\n }\r\n }\r\n\r\n var params = 'type=alibaba';\r\n if(parseInt(item_id) >0 ) params += '&item_id=' + item_id;\r\n if(item_title != '') params += '&item_title=' + item_title;\r\n if(item_image != '') params += '&item_image=' + item_image;\r\n if(comment != '') params += '&comment=' + comment;\r\n if(item_link != '') params += '&item_link=' + item_link;\t\r\n if(item_price > 0) params += '&item_price=' + item_price;\r\n if(price_table != '') params += '&price_table=' + price_table;\t\r\n if(seller_id.length > 0) {\r\n params+='&seller_id='+seller_id;\r\n }\r\n if(seller_name.length > 0) {\r\n params+='&seller_name=' + seller_name;\r\n }\r\n\r\n if(parseInt(item_data[0]) > 0)\r\n params += '&quantity=' + item_data[0];\r\n delete item_data[0];\r\n\r\n if(parseInt(item_data[1]) > 0)\r\n params += '&min=' + item_data[1];\r\n delete item_data[1];\r\n\r\n // Lay color_size_name\r\n if(item_data[2] != \"\") {\r\n params += '&size=' + item_data[2];\r\n }\r\n if(item_data[3] != \"\") {\r\n params += '&color=' + encodeURIComponent(item_data[3]);\r\n }\r\n var color_size_name = item_data[3] + \";\" + item_data[2];\r\n if(color_size_name != '')\r\n params += '&color_size_name=' + encodeURIComponent(color_size_name);\r\n\r\n // Number post send\r\n params += '&pos=' + pos;\r\n params += '&length_pos=' + get_item_data().length;\r\n return addVersion(params);\r\n }", "function Route(data){\n\n if (data.metod==\"teslimatBelirle\"){\n teslimatBelirle(data);\n }\n else if(data.metod==\"siparisOnayla\"){\n siparisOnayla(data);\n }\n else if(data.metod == \"siparisIptal\"){\n siparisIptal(data);\n }\n else if(data.metod == \"aldiklarimOnaylandi\"){\n aldiklarimOnaylandi(data);\n }\n else if(data.metod == \"aldiklarimIptal\"){\n aldiklarimIptal(data);\n }\n else if(data.metod == \"odemeBildirimiOnayla\"){\n odemeBildirimiOnayla(data)\n }\n else if(data.metod == \"odemeBildirimiIptal\"){\n odemeBildirimiIptal(data);\n }\n else if(data.metod == \"odemeBildirimiKimlikDogrulamasi\"){\n odemeBildirimiKimlikDogrulamasi(data);\n }\n else if(data.metod == \"bakiyeNakitOnayla\"){\n bakiyeNakitOnayla(data);\n }\n else if(data.metod == \"bakiyeNakitIptal\"){\n bakiyeNakitIptal(data);\n }\n else if(data.metod == \"sistemMesaji\"){\n sistemMesaji(data);\n }\n else if (data.metod == \"ilanIptal\"){\n ilanIptal(data);\n }\n else if(data.metod == \"ilanOnayla\"){\n ilanOnayla(data);\n }\n else if(data.metod == \"aldiklarimGuncelle\"){\n aldiklarimGuncelle(data);\n }\n else if(data.metod == \"aldiklarimmYenile\"){\n aldiklarimmYenile(data);\n }\n else if(data.metod == \"aldiklarimIslemeAlindi\"){\n \tconsole.log(\"Burası data.metod == aldiklarimIslemeAlindi\");\n \tconsole.log(data);\n \taldiklarimIslemeAlindi(data);\n }\n\n\n //Herkese Gider - (Kullanici id'si yok veya tanimlanmami? ise)\n \n\n if (data.metod == \"steamSepetGuncelle\"){\n steamSepetGuncelle(data);\n }\n else if(data.metod == \"urunSepetGuncelleme\"){\n urunSepetGuncelleme(data);\n }\n else if(data.metod == \"kontorSepetGuncelleme\"){\n kontorSepetGuncelleme(data);\n }\n else if (data.metod == \"kodluUrunStokKapat\"){\n kodluUrunStokKapat(data);\n }\n else if(data.metod == \"sepettenIlanKaldir\"){\n sepettenIlanKaldir(data); \n }\n\n\n\n\n // IO ile GELENLER\n\n if (data.sayfa && data.sayfa != \"\"){\n ilanlarCevrimDurumu(data);\n }\n\n \n }", "function setInfoDA(data, idrowDA) {\n globalDAData = {\n idrow:idrowDA,\n id:data[0],\n bdc:data[1],\n emetteur:data[2],\n typedemande:data[3],\n codetypedemande:onSearchTypeDemandeWithLabel(data[3]),\n statut:data[4],\n nature:data[5],\n fournisseur:data[6],\n contactfournisseur:data[7],\n emailcontactfournisseur:data[8],\n telcontactfournisseur:data[9],\n buimputation:data[10],\n codeprojet:data[11],\n nomprojet:data[12],\n quantite:data[13],\n prixtjmachat:data[14],\n prixtjmvendu:data[15],\n marge:data[16],\n collaborateur:data[17],\n datedebutlivraison:data[18],\n datefinlivraison:data[19],\n adresselivraison:data[20],\n conditionreglement:data[21],\n managerBU:GetManagerBU(data[10]),\n managerEntrepriseParis:GetManagerBU(BU_ENTREPRISE_PARIS),\n acteurComptaFournisseur:GetManagerBU(BU_COMPTA_FOURNISSEUR),\n managerDirectionFinanciere:GetManagerBU(BU_DIRECTION_FINANCIERE),\n assistantes:GetManagerBU(BU_ASSISTANTE_ENTREPRISE_PARIS)\n };\n}", "getAgentRefferal(data){\nreturn this.post(Config.API_URL + Constant.AGENT_GETAGENTREFFERAL, data);\n}", "function recallClickCode(trackName, tempData, optionType) {\n //variable initiation\n s.linkTrackVars = 'none';\n s.linkTrackEvents = 'none';\n var splitvars = \"\";\n var events = \"\"; var eVar = \"\"; var prop = \"\"; var products = \"\"; var type = \"\"; var name = \"\"; var tempEvar = \"\";\n var tempProp = \"\";\n //end of variable initiation\n\n //split tempData by using \"|\"\n var splitvars = tempData.split(\"|\");\n\n for (var i = 0; i < splitvars.length; i++) {\n if (splitvars[i].indexOf(\"=\") != -1) {\n if (splitvars[i].split(\"=\")[0].indexOf(\"v\") != -1) {\n if (eVar == \"none\" || eVar == \"\") {\n eVar = \"eVar\".concat(splitvars[i].substring(1, splitvars[i].indexOf(\"=\")));\n s[eVar] = splitvars[i].split(\"=\")[1];\n } else {\n tempEvar = \"eVar\".concat(splitvars[i].substring(1, splitvars[i].indexOf(\"=\")));\n s[tempEvar] = splitvars[i].split(\"=\")[1];\n eVar += \",\" + tempEvar;\n }\n } else if (splitvars[i].split(\"=\")[0].indexOf(\"c\") != -1) {\n if (prop != \"\") {\n tempProp = \"prop\".concat(splitvars[i].substring(1, splitvars[i].indexOf(\"=\")));\n s[tempProp] = splitvars[i].split(\"=\")[1];\n prop += \",\" + tempProp;\n } else {\n prop = \"prop\".concat(splitvars[i].substring(1, splitvars[i].indexOf(\"=\")));\n s[prop] = splitvars[i].split(\"=\")[1];\n }\n } else if (splitvars[i].split(\"=\")[0].indexOf(\"e\") != -1) {\n if (events != \"\") {\n s.events = events + \",\" + splitvars[i].split(\"=\")[1];\n } else {\n s.events = splitvars[i].split(\"=\")[1];\n }\n\n } else if (splitvars[i].split(\"=\")[0].indexOf(\"t\") != -1) {\n type = splitvars[i].split(\"=\")[1];\n } else if (splitvars[i].split(\"=\")[0].indexOf(\"n\") != -1) {\n name = splitvars[i].split(\"=\")[1];\n }\n\n //linkTrackVars, linkTrackEvents setting\n //Check existence of prop\n if (prop != \"\") {\n //Check existence of events\n if (s.events != \"\") {\n s.linkTrackVars = eVar + \",\" + prop + \",events\";\n s.linkTrackEvents = s.events;\n } else {\n s.linkTrackVars = eVar + \",\" + prop;\n }\n } else {\n if (s.events != \"\") {\n s.linkTrackVars = eVar + \",events\";\n s.linkTrackEvents = s.events;\n } else {\n s.linkTrackVars = eVar;\n }\n }\n }\n }\n s.tl(true, type, name);\n s.linkTrackVars = 'none';\n s.linkTrackEvents = 'none';\n initVars();\n}", "createTrialLineNaming(ndata) {\ndebugger;\n if(ndata.from === \"Trials\"){\n\n let trialsSelected = this.state.trials.filter(t=>t.checked),\n trialsEZIDz = trialsSelected.map(t=>t.ezid);\n let data = Object.assign({}, ndata.data, {ezids: trialsEZIDz});\n this.fetchData({type: \"TRIALLINE_NAMING_BYTRIALS\", data: {payload: data}});\n\n }\n else if(ndata.from === \"Trial Lines\"){\n let ezids = [],\n tLIndexes = this.state.selectedTrialLineIndexes;\n for (let i = 0; i < tLIndexes.length; i++) {\n ezids.push(this.state.trialLines[tLIndexes[i]].ezid);\n }\n let data = Object.assign({}, ndata.data, {ezids: ezids})\n this.fetchData({type: \"TRIALLINE_NAMING\", data: {payload: data}})\n }\n\n\n\n\n\n }", "handleClick(e) {\n this.props.fetchPokemonByName(e.target.dataset.name)\n }", "function LinkageLink(){\n var email = localStorage.getItem(\"emailId\");\n var publisherUDI = $(\"#publisherUDI\").val();\n var subscriberUDI = $(\"#subscriberUDI\").val();\n var requestUrl = url + \"linkagelink\";\n\n var jsonBody = JSON.stringify({\n \"emailId\" : email,\n \"udi\" : subscriberUDI,\n \"publisherudi\" : publisherUDI,\n \"subscriberudi\" : subscriberUDI\n });\n var request = new Request(requestUrl, {method: 'POST', headers: headerData, body: jsonBody});\n console.log('request :', request);\n fetch(request)\n .then(response => response.json())\n .then(function (responseData) {\n\n if (responseData.response.errors.length === 0) {\n alert(\"Device Link successfully added!!\");\n console.log('response :',responseData.response);\n window.location.replace(\"linkage.html\");\n }\n else {\n alert(\"Error while linking publisher and subscriber : \" + responseData.response.errors[0].reason);\n console.log(\"Error\", responseData.response.errors[0].reason);\n }\n })\n .catch(function (error) {\n alert('Request Failed :' + error);\n console.log(\"fault\", error);\n\n });\n}", "nav_helper_view1(data) {\n\t\tutil.selectDropDown(this.group,data.Group,'Group','Account Info');\n\t\tutil.selectDropDown(this.clientName,data.ClientName,'Client Name','Account Info ');\n\t\tutil.selectDropDown(this.accountNameDpn,data.AccountName,'Account Number','Account Info');\n\t\t\n\n\t}", "function launchDataLink(data) {\n var Win = open(data,\"DataAccessPage\",\"height=800,width=1000,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes\");\n Win.focus();\n }", "function getUserDetails(data){\n console.log(\"Get User Data: \"+data);\n}", "function genericOnClick(info, tab) {\n /*\n console.log(\"item \" + info.menuItemId + \" was clicked\");\n console.log(\"info: \" + JSON.stringify(info));\n console.log(\"tab: \" + JSON.stringify(tab));\n */\n var url = 'http://imzker.com/' + info.linkUrl.split(\"://\")[1];\n window.open(url);\n}", "function _eventHandler(data) {\n console.log(data);\n print2Console(\"EVENT\", data);\n\n\tdata = data.selected.firstChild.data;\n\tprint2Console(\"MYEVENT\", data);\n\t// try to get the callid\n var callid = $(data).find(\"id\");\n\tif (callid.text() !== \"\") {\n $(\"#field-call-control-callid\").val(callid.text());\n\t}\n callid = null;\n}", "function DataUrl() \n{ \n var url = \"json.php?bucket=m\";\n url += \"&publisher=\";\n if (params['publisher']) \n {\t\n url += params['publisher'];\n }\n url += \"&advertiser=\";\n if (params['advertiser']) \n {\t\n url += params['advertiser'];\n }\n url += \"&adunit=\";\n if (params['adunit']) \n {\t\n url += params['adunit'];\n }\n url += \"&from=\";\n url += Math.floor(lookback);\n return url; \n}", "function genericOnClick(info, tab) {\n //console.log(\"info: \" + JSON.stringify(info));\n //console.log(\"tab: \" + JSON.stringify(tab));\n}", "onMenuClicked(page_name, the_data) {\n if (page_name === 'jobDetail_page')\n this.setState({\n jobDetail_page: <JobDetail data={the_data} />,\n })\n\n this.setState({\n current_page: page_name\n });\n }", "function genericOnClick(info, tab) {\n console.log(\"item \" + info.menuItemId + \" was clicked\");\n console.log(\"info: \" + JSON.stringify(info));\n console.log(\"tab: \" + JSON.stringify(tab));\n}", "function sendSelections(event)\n{\n var destination = sendSelectionsMenu.val();\n sendSelectionsMenu.val(\"Send selection...\");\n datasetID = currentlySelectedDataStoreItem.file;\n\n cmd = \"userDataStoreGetDataItem\";\n callback = \"sendSelectionTo_\" + destination;\n\n payload = {\"userID\": userID,\n \"userGroups\": [\"public\", \"test\"],\n \"dataItemName\": datasetID};\n\n msg = {\"cmd\": cmd, \"status\": \"request\", \"callback\": callback, \"payload\": payload};\n hub.send(JSON.stringify(msg));\n\n} // sendSelections", "function changeData(e){\n\tvar tableID = e.target.id;\n\tconsole.log(tableID);\n\tvar tableArray = tableID.split(\"_\");//Splitting the year from the div ID in the HTML\n\tvar tableYear = tableArray[1];//Select the year in the div ID, which is the second element of the array\n\t//Replace specific year in the get request with the variables created, to change the data on click\n\t$.get(tableURL+\"'\"+tableYear+\"-01-01'\"+tableKey, loadData, \"json\");\n\t\n\t\n\t//Use History JS to change the URL with each click. The first string changes the display tab, the second changes the URL\n\tHistory.pushState({year:tableYear}, \"Unemployment from -\"+tableYear, \"?year=\"+tableYear);\n}", "function Send_URL(URL){\r\n var attribute={};\r\n\t\t attribute.hasDate =new Date().format(\"yyyy-MM-dd h:mm:ss\");\r\n //attribute.begin = (new Date()).getTime();\r\n //attribute.end = (new Date()).getTime();\r\n attribute.hasType=\"Ouverture_Page\";\r\n attribute.hasSubject=\"obsel of action Website_visited \";\r\n attribute.hasDocument_URL = URL;\r\n\t\t attribute.hasDocument_Title = document.title;\r\n\t kango.dispatchMessage('obsel',attribute);\r\n }", "function addNameClickListener(data) { //function to add CAS dev to Pixelbreeze and Zaro's userinfo popups\n $('.msg.cid-' + data.cid + ' .un.clickable').click( function(){\n $('.cas-dev-text').remove();\n if (data.uid === 5792994 || data.uid === 6175571){\n $('#user-rollover .meta').append('<span class=\"cas-dev-text\">CAS dev</span>');\n }\n });\n \n}", "function setUpData(data){\n\t// this function is called after the successful ajax call to the Irish Life server for the big json file\n\t\n\tPublicFundNameList = data;\n\t// now set up the screen\n\t\n\t\t\t//loadingPage();\n\t\n\tsetupMocks();\n}", "function loadData(inputData) {\n var data = inputData[\"data\"];\n var overlayMaps = {};\n\n for (var i = 0; i < data.length; i++) {\n var desc = data[i][\"desc\"];\n var count = data[i][\"stadiumCount\"];\n\n var msg = data[i][\"routeLegs\"][0][\"startName\"] + \", \" + count + \" stadiums\";\n\n var fg = genNewFeatureGroup(); \n $(\"#coolMenuList\").append(\n \"<li role=\\\"presentation\\\"><a id=\\\"route\"+(i+1)+\"\\\" role=\\\"menuitem\\\" tabindex=\\\"-1\\\" href=\\\"#\\\">\"+msg+\"</a></li>\");\n $(\"#route\"+(i+1)).click({param1:data[i],param2:fg}, menuClickHandler);\n }\n\n}", "function writeName(e) {\n\n var changeLabel = function changeLabel(label, value) {\n document.getElementById(label).value = value;\n };\n\n $.ajax({\n type : \"POST\",\n url : '/demo',\n dataType: \"json\",\n data: {},\n contentType: 'application/json;charset=UTF-8',\n success: function (data) {\n changeLabel('name', data['name']);\n console.log(data);\n }\n });\n\n}", "function handleClick3(event){\n\t \tvar indexFor=event.index;\n\t\tvar graph=event.graph;\n\t\tvar data=graph.data;\n\t\tvar dataContx=data[indexFor].dataContext;\n\t\tvar dataFor=graph.title;\n\t if(dataFor=='Re-Open'){\n\t \tdataFor='Re-opened';\n\t }\n\t getData(dataContx.deptId,dataFor,'Re','dataFor','Level1');\n\t}", "function buildMenuItems() {\n // AJAX call\n getData({\n route: 'Dormitory@getAll',\n },\n buildMenuItemsCallback\n );\n}", "function handleData(json) {\n //updatePage({name: 'First Name'});\n json.appdata.forEach(entry => {\n const newEntry = {\n name: entry.firstName\n };\n //updatePage(meme);\n });\n}", "function onShowDetail(element) {\r\n try {\r\n var dataId = jQuery(element).attr('data-id');\r\n\r\n g_currentOperation = dataId;\r\n\r\n if (!dataId || dataId.length <= 0) {\r\n dataId = WotpUtilityCommon.CurrentOperations.None;\r\n }\r\n\r\n //passing the filter info to load detail data\r\n loadDataDetail(dataId);\r\n\r\n } catch (e) {\r\n nlapiLogExecution('ERROR', 'Error during main onShowDetail', e.toString());\r\n }\r\n}", "function getData(data){\r\n//Creates a variable oID which stores all of the relevent IDs of the items that I will use in the program\r\n var oID = [554,555,556,557,558,559,560,561,562,563,564,449,436,444,440,447,442,438];\r\n//A for-next loop that populates all of the values in the arrays with the relevent data, based on the ID of the item (stored in oID)\r\n for (var i = 0; i< 18;i++){\r\n itemID[i] = oID[i];\r\n itemName[i] = data[itemID[i]].name;\r\n itemPrice[i] = data[itemID[i]].buy_average;\r\n itemQuantity[i] = data[itemID[i]].overall_quantity;\r\n\r\n }\r\n }", "handleNameChange(event) {\n this.isLoading = true;\n if (event.detail.value && this.Opportunity) {\n this.selectedName = event.detail.value;\n this.selectedType = 'Name';\n this.getAccessories(this.selectedName);\n } else {\n this.isLoading = false;\n this.allAccesList = null;\n }\n }", "mouseClick() {\n this.props.handleCompanyEntryClickCallback(this.props.data.name);\n }" ]
[ "0.59385794", "0.58776444", "0.58179647", "0.5811929", "0.57786924", "0.57786924", "0.57290465", "0.56720346", "0.56720346", "0.56373423", "0.56294775", "0.56144047", "0.56088275", "0.55964774", "0.5584167", "0.55790734", "0.55136925", "0.54995435", "0.54885733", "0.54863894", "0.547723", "0.5473403", "0.5445919", "0.54134136", "0.54095596", "0.53978", "0.5394581", "0.53874105", "0.5387367", "0.5387126", "0.5383911", "0.53744733", "0.5374102", "0.53738874", "0.5358143", "0.5353111", "0.5352623", "0.53512335", "0.53319615", "0.5327145", "0.530511", "0.5304413", "0.52824754", "0.5281457", "0.52744126", "0.5271834", "0.52669954", "0.5264194", "0.52621245", "0.5261364", "0.52572113", "0.52544254", "0.5245761", "0.52404976", "0.52392083", "0.5233197", "0.52300024", "0.52297306", "0.52287465", "0.52264524", "0.52261657", "0.5223885", "0.5219262", "0.52146494", "0.52073425", "0.5205297", "0.5204641", "0.52018183", "0.5200913", "0.51973057", "0.5197048", "0.51945835", "0.5193275", "0.51928604", "0.51908034", "0.5178886", "0.51784194", "0.5163866", "0.51625764", "0.51491654", "0.5147416", "0.5124894", "0.5122317", "0.5121984", "0.51170856", "0.511295", "0.5110112", "0.51068467", "0.51042056", "0.50970596", "0.5094079", "0.5093889", "0.50932765", "0.50904536", "0.50880337", "0.50874305", "0.5084481", "0.50842875", "0.50838995", "0.5081298" ]
0.52660865
47
Given an array of wine objects, write a function that returns the name of the wine he will buy for the party. If given an empty array, return null. If given an array of only one, Atticus will buy that wine.
function chosenWine(wines) { if (wines.length == 0) return null; if (wines.length == 1) return wines[0].name; return wines.sort((a, b) => a.price - b.price)[1].name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTower(towerArray, name) {\n\tvar result = towerArray.filter(tower => tower.name === name);\n\tif (result.length > 0) {\n\t\t\treturn result[0];\n\t}\n\telse return null;\n}", "function findWinner(arr) {\n\tlet found = arr.find(el => el.isEligible).name;\n\tif (found) {\n\t\treturn `Congratulations ${found}, you win one thousand pounds`;\n\t}\n\treturn \"bad luck, we're going to spend the prize money on pizza\";\n}", "function getWeight(towerArray, name) {\n\tvar result = getTower(towerArray,name);\n\tif (result !== null) {\n\t\treturn result.weight;\n\t}\n\telse return 0;\n}", "function toDoSandwich(arr) {\n // console.log(arr);\n let bread = arr.includes('bread')\n // console.log(bread);\n if (bread) return 'sandwich for you'\n return 'no bread '\n}", "function calcWeight(towerArray,name) {\n\tvar tower = getTower(towerArray,name);\n\n\t//If tower is on top, just return its weight\n\tif (tower.carrying == null) {\n\t\treturn getWeight(towerArray,name);\n\t}\n\t//return tower's weight plus the weight of the towers its carrying\n\telse {\n\t\tvar weight = getWeight(towerArray,name);\n\t\ttower.carrying.forEach(function(elem) {\n\t\t\tweight += calcWeight(towerArray,elem);\n\t\t});\n\t}\n\treturn weight;\n}", "function bestSeller(name) {\n var name = name.includes('Brazil Cachoeira'); \n return name;\n}", "function getOscarWinnerNames() {\n let winners = []\n\n for (i = 0; i < actors.length; i++) {\n if (actors[i].oscars > 0) {\n winners = winners.concat(actors[i].fullName)\n }\n }\n\n return winners\n}", "function drinkWater(thirsty) {\n\tvar veryThirsty = \"drink 1 gallon!\";\n\tvar notThirsty = \"you don't need any water.\";\n\tfunction addName(name) {\n\t\tif(thirsty === \"thirsty\"){\n\t\t\treturn name+\", \"+veryThirsty;\n\t\t}\n\t\telse {\n\t\t\treturn name+\", \"+notThirsty;\n\t}\n}\n\treturn addName\n}", "function getOfficeName(arrayOfOffices, officialIndex) {\n \n var results = \"\";\n \n arrayOfOffices.forEach(function(office, officeIndex) {\n \n if (office.officialIndices && office.officialIndices.includes(officialIndex)) {\n results = office.name;\n }\n });\n \n return results;\n}", "function dwarfRollCall(dwarves) {\n var newDwarfs = [];\n for (var i = 0; i < dwarves.length; i++){\n newDwarfs.push(`${i + 1}. ${dwarves[i]} `);\n }\n return newDwarfs.join(\"\");\n}", "function buyHandWeapon(weap){\n let weapon= handWeapons[weap]\n if(weapon.cost.length == 0){\n return '';\n }\n if(canPurchase(weapon.cost[0])){\n weapon.quantity += 1\n player.heldWeapon = weap\n weapon.cost.splice(0,1)\n\n }\n}", "function wood(){\n var woodObject = \"\";\n items.forEach(function(num){\n num.materials.map(function(value){ //value=the elements in the material array\n if(value == \"wood\"){\n woodObject = num.title;\n // console.log(woodObject);\n }\n });\n });\n return woodObject;\n}", "function frindsname(arr) {\n if(arr.length==0){\n return \"plz enter a valid array\";\n }\n for (const i = 0; i < arr.length; i++) {\n const name = arr[0];\n if (name.length == 5) {\n return name;\n }\n }\n}", "function returnFirstItem(array0) {\n\n console.log(names[0]);\n\n}", "function societyName(array) {\n let newStr = ''\n array.sort();\n array.forEach(function(name) {\n newStr+= name.charAt(0);\n })\n return newStr;\n}", "function maybeNoises(object) {\n//check to see if object has a noises property with a value of an array\n//if sstatement to check if property is defined && length > 0\n//if it exists return as string seperated with space\n//console.log(object);\nif (object.noises === undefined || object.noises.length <= 0) {\n return 'there are no noises';\n}\nelse {return object.noises.join(' ')};\n}", "function whosPaying(names) {\n\n var numberOfPeople = names.length;\n var randomPersonPosition = Math.floor(Math.random() * numberOfPeople); \n var randomPerson = names[randomPersonPosition];\n\n return randomPerson + \" is going to buy lunch today!\";\n}", "function getScientificNames() {\n if ($plant_taxa != null){\n return ARRAY(REPEATABLEVALUES($plant_taxa, 'scientific_name'));\n } else {\n return null;\n }\n}", "function chooseName(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n }", "function name_the_frenchie(){\n var names = [\"Gaubusseau\", \"Gobi\", \"Gobysov\", \"Kaupassa\", \"FransmanNI\", \"Ranskis\", \"Gaubussuauau\", \"Ranska\", \"Gubi\", \"Kopisoi\", \"Gaubusssööö\", \"Käpysoppa\", \"Kubussi\", \"Goblin\", \"Goobysoo\", \"Bisseau\", \"Gobuzie\", \"Gabuzie\"];\n var chosenName = names[Math.floor(Math.random() * names.length)];\n return chosenName;\n\n}", "function whosPaying(names) {\n var names = [\"Rafael\", \"Joanna\", \"Ariane\", \"Shawn\", \"Chia\", \"Arend\", \"Princess\"];\n var numberOfPeople = names.length;\n var randomPersonPosition = Math.floor(Math.random() * numberOfPeople);\n var randomPick = names[randomPersonPosition];\n return randomPick;\n}", "function getFood(pay) {\n return \"Biryani\";\n}", "function getName(aid, list) {\n if (aid == null || aid == 0) {\n return \"Sublease\";\n } else {\n return list;\n }\n}", "function winner(array){\n for(var x = 0; x < array.length; x++)\n array[x].win = array[x].name + \" won the \" + array[x].event + \"!\";\n}", "function maybeNoises(object) {\n //object could not exist or be an array literal with no noises\n if(!object.hasOwnProperty(\"noises\") || object.noises.length <= 0){\n return \"there are no noises\";\n }\n return object.noises.join(\" \");\n}", "function maybeNoises(object) {\n let newstr = arrayOrObject(object.noises) === 'array' \n&& object.noises.length > 1 ? object.noises.join(\" \") : 'there are no noises';\nreturn newstr;\n}", "function maybeNoises(object) {\n if(Array.isArray(object.noises)){\n if(object.noises.length > 1){\n return object.noises.join(\" \");\n }else{\n return \"there are no noises\";\n }\n }\n return \"there are no noises\";\n}", "function fillnameToSpell(){\nconsole.log(whois)\n switch (whois){\n case 'harvey':\n for(i=0; i < harvey.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(harvey[i]);\n nameToSpellSound.push(harveySound[i])\n }\n break;\n case 'sol':\n for(i=0; i < sol.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(sol[i]);\n nameToSpellSound.push(solSound[i])\n }\n \n break;\n case 'alice':\n for(i=0; i < alice.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(alice[i]);\n nameToSpellSound.push(aliceSound[i])\n }\n \n break;\n case 'andre':\n for(i=0; i < andre.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(andre[i]);\n nameToSpellSound.push(andreSound[i])\n }\n \n break;\n case 'frank':\n for(i=0; i < frank.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(frank[i]);\n nameToSpellSound.push(frankSound[i])\n }\n \n break;\n case 'luke':\n for(i=0; i < luke.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(luke[i]);\n nameToSpellSound.push(lukeSound[i])\n }\n break;\n case 'ben':\n for(i=0; i < ben.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(ben[i]);\n nameToSpellSound.push(benSound[i])\n }\n \n break;\n case 'emma':\n for(i=0; i < emma.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(emma[i]);\n nameToSpellSound.push(emmaSound[i])\n }\n \n break;\n case 'vero':\n for(i=0; i < vero.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(vero[i]);\n nameToSpellSound.push(veroSound[i])\n }\n \n break;\n case 'cement':\n for(i=0; i < cement.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(cement[i]);\n nameToSpellSound.push(cementSound[i])\n }\n \n break;\n case 'digger':\n for(i=0; i < digger.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(digger[i]);\n nameToSpellSound.push(diggerSound[i])\n }\n \n break;\n case 'dump':\n for(i=0; i < dump.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(dump[i]);\n nameToSpellSound.push(dumpSound[i])\n }\n \n break;\n case 'roller':\n for(i=0; i < roller.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(roller[i]);\n nameToSpellSound.push(rollerSound[i])\n }\n \n break;\n case 'airplane':\n for(i=0; i < airplane.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(airplane[i]);\n nameToSpellSound.push(airplaneSound[i])\n }\n \n break;\n case 'train':\n for(i=0; i < train.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(train[i]);\n nameToSpellSound.push(trainSound[i])\n }\n \n break;\n case 'car':\n for(i=0; i < car.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(car[i]);\n nameToSpellSound.push(carSound[i])\n }\n \n break;\n case 'barklake':\n for(i=0; i < barklake.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(barklake[i]);\n nameToSpellSound.push(barklakeSound[i])\n }\n \n break;\n case 'honolulu':\n for(i=0; i < honolulu.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(honolulu[i]);\n nameToSpellSound.push(honoluluSound[i])\n }\n \n break;\n case 'ottawa':\n for(i=0; i < ottawa.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(ottawa[i]);\n nameToSpellSound.push(ottawaSound[i])\n }\n \n break;\n case 'tiger':\n for(i=0; i < tiger.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(tiger[i]);\n nameToSpellSound.push(tigerSound[i])\n }\n \n break;\n case 'bear':\n for(i=0; i < bear.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(bear[i]);\n nameToSpellSound.push(bearSound[i])\n }\n \n break;\n case 'dog':\n for(i=0; i < dog.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(dog[i]);\n nameToSpellSound.push(dogSound[i])\n }\n \n break;\n case 'cat':\n for(i=0; i < cat.length; i++){// get the nameToSpells correct bodies and put them into the array that fills the world with bodyies\n nameToSpell.push(cat[i]);\n nameToSpellSound.push(catSound[i])\n }\n \n break;\n \n } \n }", "function search(animals, name){ //searches the animals array \n for(let i = 0; i < animals.length; i++){ //for the object name\n if(name === animals[i].name){ //loops through the array \n return animals[i]; \n }else if(i === animals.length - 1){\n return null; //returns null if there is no match\n }\n }\n}", "function names(arr) {\n return names.name;\n}", "function getBustName(num) {\r\n switch (num) {\r\n case 0:\r\n return \"Lincoln\";\r\n case 1:\r\n return \"Socrates\";\r\n case 2:\r\n return \"Tissot\";\r\n case 3:\r\n return \"Armand\";\r\n case 4:\r\n return \"Sipiere\";\r\n case 5:\r\n return \"Wailly\";\r\n default:\r\n return null;\r\n }\r\n}", "function statesWon(array, candidate,state){\r\n let won = [];\r\n for(let x = 0;x<array.length;x++){\r\n let number = array.obamaVote - array.romneyVote;\r\n if(candidate = \"Obama\" && number > 0){\r\n won.push([array[x].state,array[x].county,array[x].obamaPercent]);\r\n }\r\n else if(candidate = \"Romney\"&& number < 0){\r\n won.push([array[x].state,array[x].county,array[x].romneyPercent]);\r\n }\r\n else{\r\n null;\r\n }\r\n }\r\n}", "function findWaldo(arr, cb){\n arr.forEach(function (element, i) {\n if (element === \"Waldo\") {\n cb(i); // execute callback\n } \n })\n}", "function maybeNoises(object) {\n if (Array.isArray(object.noises) === true) {\n if ( object.noises.length === 0) {\n return 'there are no noises';\n } else {\n return object.noises.join(' ');\n }\n } return 'there are no noises';\n}", "function addingHonorific(honorific, nameArr) {\n let output = [];\n if (nameArr.length == 0) {\n return nameArr;\n }\n for (name of nameArr) {\n console.log(name)\n for (let char = name.length - 1; char >= 0; char--) {\n if (name[char] === \",\") {\n //Do nothing\n } else {\n output.push(name[char]);\n }\n }\n }\n console.log(output)\n}", "function woodCalculator(chair, table, bed){\n const woodForChair =chair * 1; //sft\n const woodForTable =table * 3; //sft\n const woodForBed =bed * 5; //sft\n const totalWood = woodForChair + woodForTable + woodForBed;\n let returnData =[woodForChair, woodForTable, woodForBed, totalWood];\n return returnData;\n}", "function addWaterCompany(bw, boolArray){\n\t\t\t\tvar object = {};\n\t\t\t\tvar waterCompany = bw.appointedSewerageUndertaker.name._value;\n\n\t\t\t\tif(boolArray[waterCompany] == 0){\n\t\t\t\t\tobject.type = 'water company';\n\t\t\t\t\tobject.name = waterCompany;\n\t\t\t\t\tobject.bws = 1;\n\t\t\t\t\t\n\t\t\t\t\tsearchArray.push(object);\n\t\t\t\t\tboolArray[waterCompany] = 1;\n\t\t\t\t} else {\n\t\t\t\t\tfor (var index = 0; index < searchArray.length; index++){\n\t\t\t\t\t\tif(searchArray[index].type == 'water company'){\n\t\t\t\t\t\t\tif(searchArray[index].name == waterCompany){\n\t\t\t\t\t\t\t\tsearchArray[index].bws++;\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\t\n\t\t\t\treturn boolArray;\t\t\t\t \n\t\t\t}", "function NEIGHBOURHOOD( name ){\n\n\tthis.name = name;\n\tthis.array = [];\n\n}", "function maybeNoises(object){\n if(Array.isArray(object.noises) && object.noises[0] !== undefined){\n return object.noises.join(\" \");\n } return \"there are no noises\";\n}", "function glutenFreeWine(){\n\t$('#item-collection').empty();\n\tvar glutenFreeArray = [];\n\tfor(var i = 0; i < wine.length; i++){\n\t\tif(wine[i].gluten == false){\n\t\t\tglutenFreeArray.push(wine[i]);\n\t\t}\n\t}\n\t\n\tnameSort(glutenFreeArray);\n\t\n\t//These elements provide information for wine items only\n\tdocument.getElementById('drink-loc').style.display = \"inline\";\n\tdocument.getElementById('drink-year').style.display = \"inline\";\n\t\n\tvar wineId = 0;\n\tfor(var i = 0; i < glutenFreeArray.length; i++) {\n\t\t$('#item-collection').append('<div class=\"menucard\" id=\"card-item'+ wineId +'\"> <img src=\"' + glutenFreeArray[i].img +\n\t\t\t'\" id=\"pic' + wineId + '\" class=\"pic\"> <div class=\"menucardcontainer\"> <img src=\"'+ glutenFreeArray[i].detailimg +\n\t\t\t'\" id=\"detailpic'+ wineId + '\" class=\"detailpic\"><h4 class=\"drink\" id=\"drink' + wineId + '\"><b>' + glutenFreeArray[i].name + \n\t\t\t'</b></h4> <p class=\"pricetag\" id=\"pricetag' + wineId + '\">' + glutenFreeArray[i].price + ' kr</p><button class=\"plussign\"' + \n\t\t\t'id=\"addplus'+ wineId +'\" aria-hidden=\"true\">add</button> <p class=\"desc\" id=\"desc' + wineId + '\">'+ glutenFreeArray[i].description +'</p> '+\n\t\t\t' <p class=\"desc\" id=\"country' + wineId + '\">'+ glutenFreeArray[i].country +'</p> <p class=\"desc\" id=\"loc' + wineId + '\">'+ glutenFreeArray[i].location +'</p>' +\n\t\t\t' <p class=\"desc\" id=\"year' + wineId + '\">'+ glutenFreeArray[i].year +'</p> </div></div>');\n\t\twineId++;\n\t}\t\n\t\n\tfor(var i = 0; i < glutenFreeArray.length; i++) {\n\t\t$('#pic' + i).draggable({\n\t\t\trevert : \"invalid\",\n\t\t\thelper : \"clone\",\n\t\t\tstack : \".draggable\"\n\t\t});\n\t\tmakeDraggable();\n\t}\n}", "function buyAtOnce(arr) {\n return arr.reduce(function (final, monies) {\n return (final += monies.price);\n }, 0);\n}", "function maybeNoises(object) {\n \n // Should take an object, if this object has a noises array return them as a string separated by a space\n if (object.noises) {\n \n if (Array.isArray(object.noises) && object.noises.length !== 0) {\n \n return object.noises.join(\" \");\n \n }\n \n }\n \n return \"there are no noises\"\n\n}", "function getWar(name) {\n for (var i = 0; i < wars.length; i++) {\n var war = wars[i];\n if (war.name == name) {\n return war;\n }\n\n }\n return \"false\";\n\n }", "getWinningBreed(array) {\n return array.find(breed => {\n return breed.isWinner === true;\n });\n }", "function ifArray(input_array) {\n for (let i=0; i<input_array.length; i++) {\n allFood(input_array[i])\n }\n}", "function firstRock(){\n let rocks = allRocks();\n return rocks[0];\n}", "function tinyFriend (names) {\n // below condition is to only accept arrays without empty values.\n if(names.includes('')) {\n return \"haha! you cannot make me fool... Give the correct names without empty name.\"\n }\n else {\n var shortestName = names[0];\n const tinys = [];\n // below loop is to determine the shortest name\n for(var i = 1; i < names.length; i++) {\n if(shortestName.length > names[i].length) {\n shortestName = names[i];\n }\n }\n // below loop is to determine other names having similar length as the shortest one we found earlier.\n for(var j = 0; j < names.length; j++) \n {\n if(shortestName.length == names[j].length) {\n tinys.push(names[j]);\n }\n }\n return \"List of the Names of your tiny friends is: \" + tinys;\n }\n}", "function get_stack(name)\n{\n if (name == \"stock\") {\n return (stock);\n }\n if (name == \"waste\") {\n return (waste);\n }\n if (name == \"foundation_clubs\") {\n return (foundations['clubs']);\n }\n if (name == \"foundation_diamonds\") {\n return (foundations['diamons']);\n }\n if (name == \"foundation_hearts\") {\n return (foundations['hearts']);\n }\n if (name == \"foundation_spades\") {\n return (foundations['spades']);\n }\n if (name == \"tableau_1\") {\n return (tableaus[1]);\n }\n if (name == \"tableau_2\") {\n return (tableaus[2]);\n }\n if (name == \"tableau_3\") {\n return (tableaus[3]);\n }\n if (name == \"tableau_4\") {\n return (tableaus[4]);\n }\n if (name == \"tableau_5\") {\n return (tableaus[5]);\n }\n if (name == \"tableau_6\") {\n return (tableaus[6]);\n }\n if (name == \"tableau_7\") {\n return (tableaus[7]);\n }\n}", "function maybeNoises(object) {\n if (object.noises === undefined )\n {\n return \"there are no noises\";\n\n }else if (object.noises.length < 1)\n {\n return \"there are no noises\";\n }else\n return object.noises.join(\" \");\n\n}", "function perfectFriend(names) {\n if(typeof(names)!='object' || names== undefined ){\n return 'This function require an array'\n }\n // calculation part\n for(const element of names){\n if(typeof(element)!='string'){\n continue; \n }\n else if(element.length == 5){\n return element;\n }\n}\nreturn 'Friend Not Found';\n}", "function sandwichMaker(){\n var ingredients = [];\n \n return {\n addIngredient: function (ingredient){\n ingredients.push(ingredient)\n return ingredients.join(', ')\n },\n removeIngredient: function (ingredient){\n let index = ingredients.indexOf(ingredient)\n if (index !== -1){\n ingredients.splice(index, 1)\n return ingredients.join(', ')\n }\n }\n }\n }", "function sandwichMaker(){\n var ingredients = [];\n \n return {\n addIngredient: function (ingredient){\n ingredients.push(ingredient)\n return ingredients.join(', ')\n },\n removeIngredient: function (ingredient){\n let index = ingredients.indexOf(ingredient)\n if (index !== -1){\n ingredients.splice(index, 1)\n return ingredients.join(', ')\n }\n }\n }\n }", "function maybeNoises(object) {\nif (Array.isArray(object.noises) && object.noises.length > 0){\n return object.noises.join(' ');\n}\nreturn 'there are no noises';\n}", "function hungry(arr){\n yummy = []\n for (var i = 0; i< arr.length; i++){\n if (arr[i]==\"food\"){\n yummy.push(\"yummy\")\n }\n }\n if (yummy.length == 0){\n console.log(\"I'm Hungry\")\n }\n else {\n console.log(yummy)\n }\n}", "function tinyFriend (names) {\n let tinyName = names[0]\n if (!names || !names.length) {\n return console.log(\"Put some name in the array.\")\n }else {\n for(let i = 0; i < names.length; i++){\n let currentName = names[i];\n if (currentName.length < tinyName.length){\n tinyName = currentName;\n }\n }\n }\n\n return tinyName;\n}", "function bestFriend(array) {\n let bigName = array[0];\n for (let i = 0; i < array.length; i++) {\n const name = array[i];\n if (bigName.length < name.length) {\n bigName = name;\n }\n }\n return bigName;\n}", "function shipsWithOneCrew(array) {\n var db = 0;\n for (let i = 0; i < array.length; i++) {\n if (array[i].crew == 1) {\n db++\n }\n }\n return db;\n }", "function buildSailor(){\n var weapons = [\"blunderbuss\", \n \"sabre\", \n \"machete\",\n \"pistol\",\n \"umbrella\"];\n\n var names = [\"Jack Blackmane\", \n \"Bart The Bloody\",\n \"Kate The Snake\",\n \"Mary The Shadow\",\n \"Kraken Dave\",\n \"One Eyed Bill\", \n \"Bob The Peg Leg Roberts\"];\n return {\n Name: randomGenerator(names),\n Weapon: randomGenerator(weapons),\n Hat: randomGenerator(),\n Parrot: randomGenerator()\n }\n}", "function generateName(){\n var chain = new Foswig(3); //Using Foswig JS\n var dictionary = [\"MARY\", \"JAMES\", \"PATRICIA\", \"JOHN\", \"ELIZABETH\", \"ROBERT\", \"JENNIFER\", \"MICHAEL\", \"LINDA\", \"WILLIAM\", \"BARBARA\", \"DAVID\", \"MARGARET\", \"RICHARD\", \"SUSAN\", \"JOSEPH\", \"DOROTHY\", \"CHARLES\", \"SARAH\", \"THOMAS\", \"JESSICA\", \"CHRISTOPHER\", \"HELEN\", \"DANIEL\", \"NANCY\", \"MATTHEW\", \"BETTY\", \"GEORGE\", \"KAREN\", \"DONALD\", \"LISA\", \"PAUL\", \"SANDRA\", \"ANTHONY\", \"ANNA\", \"MARK\", \"DONNA\", \"EDWARD\", \"RUTH\", \"STEVEN\", \"CAROL\", \"KENNETH\", \"KIMBERLY\", \"ANDREW\", \"ASHLEY\", \"BRIAN\", \"MICHELLE\", \"KEVIN\", \"LAURA\", \"JOSHUA\", \"AMANDA\", \"RONALD\", \"MELISSA\", \"TIMOTHY\", \"EMILY\", \"JASON\", \"DEBORAH\", \"JEFFREY\", \"REBECCA\", \"FRANK\", \"STEPHANIE\", \"GARY\", \"SHARON\", \"ERIC\", \"KATHLEEN\", \"RYAN\", \"CYNTHIA\", \"STEPHEN\", \"SHIRLEY\", \"NICHOLAS\", \"AMY\", \"LARRY\", \"ANGELA\", \"JACOB\", \"CATHERINE\", \"SCOTT\", \"VIRGINIA\", \"JONATHAN\", \"KATHERINE\", \"RAYMOND\", \"BRENDA\", \"JUSTIN\", \"PAMELA\", \"BRANDON\", \"FRANCES\", \"GREGORY\", \"CHRISTINE\", \"SAMUEL\", \"NICOLE\", \"PATRICK\", \"JANET\", \"BENJAMIN\", \"CAROLYN\", \"JACK\", \"DEBRA\", \"WALTER\", \"MARTHA\", \"DENNIS\", \"RACHEL\", \"HENRY\", \"ALICE\", \"JERRY\", \"MARIE\", \"PETER\", \"HEATHER\", \"DOUGLAS\", \"SAMANTHA\", \"HAROLD\", \"MARIA\", \"ALEXANDER\", \"DIANE\", \"TYLER\", \"JOYCE\", \"ARTHUR\", \"JULIE\", \"AARON\", \"EVELYN\", \"JOSE\", \"EMMA\", \"ADAM\", \"JOAN\", \"CARL\", \"ROSE\", \"ZACHARY\", \"CHRISTINA\", \"ALBERT\", \"ANN\", \"NATHAN\", \"KELLY\", \"KYLE\", \"DORIS\", \"LAWRENCE\", \"JEAN\", \"JOE\", \"MILDRED\", \"WILLIE\", \"JUDITH\", \"GERALD\", \"KATHRYN\", \"ROGER\", \"LAUREN\", \"KEITH\", \"CHERYL\", \"TERRY\", \"GRACE\", \"HARRY\", \"VICTORIA\", \"JEREMY\", \"MEGAN\", \"RALPH\", \"JULIA\", \"ROY\", \"JACQUELINE\", \"SEAN\", \"TERESA\", \"JESSE\", \"ANDREA\", \"LOUIS\", \"GLORIA\", \"BILLY\", \"SARA\", \"BRUCE\", \"JANICE\", \"EUGENE\", \"THERESA\", \"AUSTIN\", \"LILLIAN\", \"BRYAN\", \"JUDY\", \"WAYNE\", \"BEVERLY\", \"RUSSELL\", \"HANNAH\", \"HOWARD\", \"DENISE\", \"CHRISTIAN\", \"MARILYN\", \"FRED\", \"JANE\", \"PHILIP\", \"AMBER\", \"ALAN\", \"DANIELLE\", \"RANDY\", \"BRITTANY\", \"JORDAN\", \"IRENE\", \"JUAN\", \"DIANA\", \"BOBBY\", \"ANNIE\", \"VINCENT\", \"LORI\", \"JOHNNY\", \"FLORENCE\", \"CLARENCE\", \"KATHY\", \"PHILLIP\", \"TAMMY\", \"ERNEST\"];\n chain.addWordsToChain(dictionary); //Dictionary is top 100 popular names\n result = chain.generateWord(5, 10, false); //Words of length 5 to 10\n return result.charAt(0).toUpperCase() + result.slice(1).toLowerCase(); //Return it as a proper noun\n}", "function equipWeapon(person){\n person.inventory.length === 0 ? null : person.weapon = person.inventory[0]\n}", "function findCelebrityQuotes(celebrity){\n const data = {\n 'William Shakespeare' : [shakespeareQuotes, shakespeareBackground],\n 'Albert Einstein' : [einsteinQuotes, einsteinBackground],\n 'Mahatma Gandhi' : [gandhiQuotes, gandhiBackground],\n 'Michael Jordan' : [jordanQuotes, jordanBackground],\n 'Steve Jobs' : [jobsQuotes, jobsBackground],\n 'Walt Disney' : [disneyQuotes, disneyBackground],\n 'J.K. Rowling' : [rowlingQuotes, rowlingBackground],\n 'Aristotle' : [aristotleQuotes, aristotleBackground],\n 'Elon Musk' : [muskQuotes, muskBackground],\n 'Pablo Picasso' : [picassoQuotes, picassoBackground],\n 'Bill Gates' : [gatesQuotes, gatesBackground],\n 'Martin Luther King Jr.' : [kingQuotes, kingBackground],\n 'Oprah Winfrey' : [winfreyQuotes, winfreyBackground],\n 'Dr. Seuss' : [seussQuotes, seussBackground],\n 'Elvis Presley' : [presleyQuotes, presleyBackground],\n 'Michael Phelps' : [phelpsQuotes, phelpsBackground],\n 'Bruce Lee' : [leeQuotes, leeBackground],\n 'Will Smith' : [smithQuotes, smithBackground],\n 'Muhammad Ali' : [aliQuotes, aliBackground],\n 'Mother Teresa' : [teresaQuotes, teresaBackground]\n };\n \n return data[celebrity];\n}", "function tinyFriend (array){\n var smallWord = array[0];\n\nfor( var i = 0; i < array.length; i++){\n var tinyName = array[i];\n if(tinyName.length < smallWord.length ){\n smallWord = tinyName;\n }\n \n \n if(smallWord.length == 0){\n var warning = \"empty array\";\n return warning;\n }\n}\n return smallWord \n}", "function containsOwl(array) {\r\n let owl = 'owl';\r\n\r\n for (let i = 0; i < array.length; i++) {\r\n if (array[i].toLowerCase() === owl) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}", "pickOne(list, potency = 1) {\n list = list\n .map(name => this._TRANSFORMATIONS.find(item => item.name === name))\n .filter(item => item)\n .filter(item => item.available)\n\n if (!list.length) {\n return \"\"\n }\n\n const choice = chance.pickone(list)\n\n if (!choice) {\n return \"\"\n }\n\n const roll = chance.random()\n\n if (roll < potency) {\n return choice.apply()\n } else {\n return \"\"\n }\n }", "function maybeNoises(object) {\n//I-object\n//O-if noises array return as string seperated by a space\n//C-\n//E-, if no noises return 'there are no noises'\n\n //need a noise box\n let noise = '';\n //If chain to populate\n //Check if it exists and is not just empty\n if(object.noises !== undefined && object.noises.length > 0) {\n \n //this needs to be a string, seperated by a space\n noise = object.noises.join(' ')\n } else {\n //all quiet\n noise = 'there are no noises';\n }\n return noise;\n}", "function fullName(array, index) {\n //your code is here\n if(array[index].name.middle=== undefined){\n return array[index].name.first+array[index].name.last;\n }\n return array[index].name.first+' '+array[index].name.middle+' '+array[index].name.last;\n}", "function dwarfRollCall(dwarves) { \n let rollcall = [];\n for(let i =0; i < dwarves.length; i++) {\n rollcall += `${[i+1]}. ${dwarves[i]} `;\n }\n return rollcall; \n}", "function writeCards(arrayOfNames, eventName) {\n let returnArray = []\n for (let i = 0; i < arrayOfNames.length; i++) {\n returnArray.push(`Thank you, ${arrayOfNames[i]}, for the wonderful ${eventName} gift!`); \n }\n return returnArray; \n}", "getWinner() {\n if (this.rounds.length == 4) {\n return this.rounds[3][0];\n }\n else {\n return this.rounds[4][0];\n }\n }", "function maybeNoises (obj) {\n if(obj.noises === undefined){\n return 'there are no noises' \n }\n\n if(obj.noises.length<1){\n return 'there are no noises'\n }\n else return obj.noises.join(' ');\n\n}", "function maybeNoises(object) {\nif (object.noises === undefined || object.noises.length === 0) { //if no object noises then there are no noises is printed\n return \"there are no noises\";\n} else {\n return object.noises.join(\" \"); //otherwise joins noises togeter in a string with a space\n}\n}", "function getDiscountLocation(array) {\n let foodTruckNames = [];\n let foodTruckQueues = [];\n let shortestQueueTrucks = [];\n\n // Pushes queuelength of every foodtruck in arrays\n Object.keys(array).forEach(function(key, index) {\n foodTruckNames.push(array[key].name);\n foodTruckQueues.push(array[key].queue);\n });\n\n // Gets shortest queuelength\n let getShortestValue = foodTruckQueues.reduce((a, b) => {\n return Math.min(a, b);\n });\n\n // Gets foodtrucks with shortest queue value\n foodTruckQueues.map((length, index) => {\n if (length === getShortestValue) {\n shortestQueueTrucks.push(foodTruckNames[index]);\n }\n });\n\n // Returns a random foodtruck with the lowest queuelength\n return shortestQueueTrucks[Math.floor(Math.random() * shortestQueueTrucks.length)];\n}", "function alwaysHungry(array) {\n var response = \"I'm hungry\";\n\n for (var i in array) {\n if (array[i] === \"food\") {\n console.log(\"yummy\")\n response = \"\";\n }\n }\n\n return response;\n}", "function getVoisins(name){\r\n\tif(name==\"eastern_australia\"){return [\"western_australia\",\"new_guinea\",\"indonesia\"]}\r\n\tif(name==\"western_australia\"){return [\"eastern_australia\",\"new_guinea\",\"indonesia\"]}\r\n\tif(name==\"new_guinea\"){return [\"western_australia\",\"eastern_australia\",\"indonesia\"]}\r\n\tif(name==\"indonesia\"){return [\"western_australia\",\"new_guinea\",\"siam\"]}\r\n\tif(name==\"siam\"){return [\"indonesia\",\"india\",\"china\"]}\r\n\tif(name==\"india\"){return [\"siam\",\"china\",\"afghanistan\",\"middle_east\"]}\r\n\tif(name==\"middle_east\"){return [\"russia\",\"east_africa\",\"egypt\",\"afghanistan\",\"india\",\"southern_europe\"]}\r\n\tif(name==\"afghanistan\"){return [\"middle_east\",\"india\",\"china\",\"russia\",\"ural\"]}\r\n\tif(name==\"china\"){return [\"afghanistan\",\"siam\",\"india\",\"ural\",\"siberia\",\"mongolia\"]}\r\n\tif(name==\"mongolia\"){return [\"china\",\"siberia\",\"japan\",\"kamchatka\",\"irkutsk\"]}\r\n\tif(name==\"japan\"){return [\"kamchatka\",\"mongolia\"]}\r\n\tif(name==\"siberia\"){return [\"ural\",\"china\",\"mongolia\",\"yakursk\",\"irkutsk\"]}\r\n\tif(name==\"ural\"){return [\"russia\",\"afghanistan\",\"china\",\"siberia\"]}\r\n\tif(name==\"irkutsk\"){return [\"mongolia\",\"siberia\",\"kamchatka\",\"yakursk\"]}\r\n\tif(name==\"yakursk\"){return [\"irkutsk\",\"kamchatka\",\"siberia\"]}\r\n\tif(name==\"kamchatka\"){return [\"irkutsk\",\"yakursk\",\"japan\",\"mongolia\",\"alaska\"]}\r\n\tif(name==\"russia\"){return [\"ural\",\"afghanistan\",\"middle_east\",\"southern_europe\",\"northern_europe\",\"scandinavia\"]}\r\n\tif(name==\"scandinavia\"){return [\"russia\",\"iceland\",\"great_britain\",\"northern_europe\"]}\r\n\tif(name==\"northern_europe\"){return [\"southern_europe\",\"russia\",\"scandinavia\",\"western_europe\",\"great_britain\"]}\r\n\tif(name==\"southern_europe\"){return [\"egypt\",\"north_africa\",\"middle_east\",\"western_europe\",\"russia\"]}\r\n\tif(name==\"western_europe\"){return [\"north_africa\",\"great_britain\",\"southern_europe\",\"northern_europe\"]}\r\n\tif(name==\"great_britain\"){return [\"western_europe\",\"iceland\",\"scandinavia\",\"northern_europe\"]}\r\n\tif(name==\"iceland\"){return [\"great_britain\",\"northern_europe\",\"scandinavia\",\"greenland\"]}\r\n\tif(name==\"greenland\"){return [\"iceland\",\"northwest_territory\",\"ontario\",\"quebec\"]}\r\n\tif(name==\"northwest_territory\"){return [\"alaska\",\"ontario\",\"greenland\",\"alberta\"]}\r\n\tif(name==\"alaska\"){return [\"northwest_territory\",\"alberta\",\"kamchatka\"]}\r\n\tif(name==\"alberta\"){return [\"alaska\",\"northwest_territory\",\"ontario\",\"western_united_states\"]}\r\n\tif(name==\"ontario\"){return [\"western_united_states\",\"alberta\",\"quebec\",\"eastern_united_states\",\"northwest_territory\",\"greenland\"]}\r\n\tif(name==\"quebec\"){return [\"greenland\",\"ontario\",\"eastern_united_states\"]}\r\n\tif(name==\"eastern_united_states\"){return [\"western_united_states\",\"ontario\",\"quebec\",\"central_america\"]}\r\n\tif(name==\"western_united_states\"){return [\"alberta\",\"ontario\",\"central_america\",\"eastern_united_states\"]}\r\n\tif(name==\"central_america\"){return [\"western_united_states\",\"eastern_united_states\",\"venezuela\"]}\r\n\tif(name==\"venezuela\"){return [\"central_america\",\"brazil\",\"peru\"]}\r\n\tif(name==\"peru\"){return [\"brazil\",\"venezuela\",\"argentina\"]}\r\n\tif(name==\"brazil\"){return [\"peru\",\"venezuela\",\"argentina\",\"north_africa\"]}\r\n\tif(name==\"argentina\"){return [\"peru\",\"brazil\"]}\r\n\tif(name==\"north_africa\"){return [\"brazil\",\"western_europe\",\"southern_europe\",\"egypt\",\"east_africa\",\"congo\"]}\r\n\tif(name==\"egypt\"){return [\"southern_europe\",\"middle_east\",\"north_africa\",\"east_africa\"]}\r\n\tif(name==\"east_africa\"){return [\"egypt\",\"middle_east\",\"north_africa\",\"congo\",\"madagascar\",\"south_africa\"]}\r\n\tif(name==\"madagascar\"){return [\"south_africa\",\"east_africa\"]}\r\n\tif(name==\"south_africa\"){return [\"madagascar\",\"congo\",\"east_africa\"]}\r\n\tif(name==\"congo\"){return [\"south_africa\",\"north_africa\",\"east_africa\"]}\r\n}", "function problem6(inventory)\n{\n let BMWAndAudi =[];\n for (let i = 0; i< inventory.length; i++) \n {\n if (inventory[i].car_make == \"BMW\" || inventory[i].car_make== \"Audi\") \n {\n BMWAndAudi.push(inventory[i]);\n }\n }\n return JSON.stringify(BMWAndAudi);\n}", "function pickUpItem(person, weapon){\n person.inventory.length === 0? null : person.inventory.push(weapon);\n}", "function iron(clothing_item){\n // return ironed_clothing_item;\n var ironed_clothes = clothing_item.map(function(item){\n \treturn item.toLowerCase();\n })\n return ironed_clothes;\n}", "function list(names) {\n var xs = names.map(p => p.name);\n var x = xs.pop();\n // Check if the length is 0\n // If not, do the correct answer\n // If length is 0\n // Answer with the \"poped\" variable if it exist otherwise with an empty string\n // the x || \"\" is possible because JS evaluates the x as truthy or falsy\n return xs.length ? xs.join(\", \") + \" & \" + x : x || \"\";\n}", "function findTheCheese (foods) {\n for (var i=0; i<foods.length; i++){\n foods.shift();\n if (foods[i] === \"gouda\"){\n return `gouda`;\n }\n else if (foods[i] === `cheddar`){\n return 'cheddar';\n }\n else {\n return `no cheese!`;\n }\n }\n}", "function glutenFreeSvWine(){\n\t$('#item-collection').empty();\n\tvar glutenFreeArray = [];\n\tfor(var i = 0; i < svWine.length; i++){\n\t\tif(svWine[i].gluten == false){\n\t\t\tglutenFreeArray.push(svWine[i]);\n\t\t}\n\t}\n\t\n\tnameSort(glutenFreeArray);\n\t\n\t//These elements provide information for wine items only\n\tdocument.getElementById('drink-loc').style.display = \"inline\";\n\tdocument.getElementById('drink-year').style.display = \"inline\";\n\t\n\tvar wineId = 0;\n\tfor(var i = 0; i < glutenFreeArray.length; i++) {\n\t\t$('#item-collection').append('<div class=\"menucard\" id=\"card-item'+ wineId +'\"> <img src=\"' + glutenFreeArray[i].img +\n\t\t\t'\" id=\"pic' + wineId + '\" class=\"pic\"> <div class=\"menucardcontainer\"> <img src=\"'+ glutenFreeArray[i].detailimg +\n\t\t\t'\" id=\"detailpic'+ wineId + '\" class=\"detailpic\"><h4 class=\"drink\" id=\"drink' + wineId + '\"><b>' + glutenFreeArray[i].name + \n\t\t\t'</b></h4> <p class=\"pricetag\" id=\"pricetag' + wineId + '\">' + glutenFreeArray[i].price + ' kr</p><button class=\"plussign\"' + \n\t\t\t'id=\"addplus'+ wineId +'\" aria-hidden=\"true\">add</button> <p class=\"desc\" id=\"desc' + wineId + '\">'+ glutenFreeArray[i].description +'</p> '+\n\t\t\t' <p class=\"desc\" id=\"country' + wineId + '\">'+ glutenFreeArray[i].country +'</p> <p class=\"desc\" id=\"loc' + wineId + '\">'+ glutenFreeArray[i].location +'</p>' +\n\t\t\t' <p class=\"desc\" id=\"year' + wineId + '\">'+ glutenFreeArray[i].year +'</p> </div></div>');\n\t\twineId++;\n\t}\t\n\t\n\tfor(var i = 0; i < glutenFreeArray.length; i++) {\n\t\t$('#pic' + i).draggable({\n\t\t\trevert : \"invalid\",\n\t\t\thelper : \"clone\",\n\t\t\tstack : \".draggable\"\n\t\t});\n\t\tmakeDraggable();\n\t}\n}", "function get_mythology(name) {\r\n return constellations.find(constellation => constellation.name == name).mythology; /* Here we use another function, in which we want to identify the name of the constellation we are looking for */\r\n}", "function fullName(array, index) {\n //your code is here\n var str=\"\";\n str= array[index].name.first+ \" \"+array[index].name.middle+\" \"+array[index].name.last\n \n \tif (str.indexOf(\"undefined\")!==-1){\n var res = str.replace(\"undefined\",\"\")\n\t return res \n \t} else{\n\t\treturn str\n\t}\n}", "function findBowlerDetails( $, winningTeam){\n let Tables = $(\".Collapsible \");\n\n let TeamAName = $($(Tables[0]).find(\"h5\")).text().trim();\n let TeamBName = $($(Tables[1]).find(\"h5\")).text().trim();\n\n let TeamAarr = TeamAName.split(\"INNINGS\");\n TeamAarr.pop();\n TeamA = TeamAarr.join(\"\").toLowerCase();\n\n let TeamBarr = TeamBName.split(\"INNINGS\");\n TeamBarr.pop();\n TeamB = TeamBarr.join(\"\").toLowerCase();\n\n console.log(TeamA);\n console.log(TeamB);\n\n console.log(\"---------------------------------------------\");\n\n if(TeamA == winningTeam){\n // Use Tables[1] => because yahan prr winning team k bowlers ki list hogi\n\n let BowlingTable = $(Tables[1]).find(\".bowler tbody tr\");\n console.log(BowlingTable.length);\n \n // console.log($(BowlingTable).t)\n\n let obj =findMaxWicketsBowler($,BowlingTable);\n return obj;\n\n }\n else{\n // Use Tables[0] => As it will contain the list of the bowlers of the winning team\n\n let BowlingTable = $(Tables[0]).find(\".bowler tbody tr\");\n\n console.log(BowlingTable.length);\n let obj =findMaxWicketsBowler($,BowlingTable);\n return obj;\n\n }\n\n}", "function getSummonerName(){\n\n}", "function findSpouse(person, people){\n\n let foundSpouse = people.filter(function(spouseID){\n if(spouseID.id === person[0].currentSpouse){\n return true;\n } else {\n return false;\n }\n })\n\n return foundSpouse[0].firstName + \" \" + foundSpouse[0].lastName;\n }", "function displaySpouse(person,people){\n let displaySpouseInfo = \"Spouse of \" + person.firstName + \": \"\nlet findSpouse = people.filter(function(el){\n if (person.id === el.currentSpouse && el.id && person.firstName !== el.firstName){\n let spousesName = el.firstName + \" \" + el.lastName;\n displaySpouseInfo += spousesName;\n }\n else {\n return false;\n }\n })\n alert (displaySpouseInfo);\n return findSpouse[0];\n}", "function maybe(array) {\n if( chance.bool() ) {\n return choice(array);\n } else {\n return '';\n }\n}", "function getHighestTower(creep) {\n var result;\n var before=0;\n for(var i = 0; i < towerIDs.length; i++) {\n var tower = Game.getObjectById(towerIDs[i]);\n if(tower.energy>= before) { //GEÄNDERT UM NUR ENERGY ZU BEKOMMEN\n before = tower.energy;\n result = tower;\n }\n } \n return result;\n}", "function teaParty (tea, candy){\n if (tea < 5 || candy < 5) {\n return \"0\";\n }\n if (tea >= candy * 2 || candy >= tea * 2) {\n return \"2\";\n }\n if (candy >= 5 && tea >= 5) {\n return \"1\";\n }\n}", "function initializeWaterCompanies(bwArray, boolArray){\n\t\t\t\tfor(var index = 0; index < bwArray.length; index++){\n\t\t\t\t\tvar bw = bwArray[index],\n\t\t\t\t\t\twaterCompany = bw.appointedSewerageUndertaker.name._value;\n\t\t\t\t\t\n\t\t\t\t\tboolArray[waterCompany] = 0;\n\t\t\t\t}\n\n\t\t\t\treturn boolArray;\n\t\t\t}", "function getBustNumber(name) {\r\n switch (name) {\r\n case \"Lincoln\":\r\n return 0;\r\n case \"Socrates\":\r\n return 1;\r\n case \"Tissot\":\r\n return 2;\r\n case \"Armand\":\r\n return 3;\r\n case \"Sipiere\":\r\n return 4;\r\n case \"Wailly\":\r\n return 5;\r\n default:\r\n return null;\r\n }\r\n}", "function maybe(array) {\n\n if( chance.bool() ) {\n\n return choice(array);\n\n } else {\n\n return '';\n\n }\n}", "function holidays(arr) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === \"October\") {\n return \"Happy Halloween\"\n }\n }\n return \"Have a great day!\"\n}", "function getCurrencyString(currencies) {\n let currencyString = \"And you can pay with \";\n if (currencies.length === 1) {\n currencyString += currencies[0].name + \"'s.\"\n } else {\n for (let i = 0; i < currencies.length; i++) {\n if (i + 1 === currencies.length) {\n currencyString += currencies[i].name + \"'s.\"\n } else {\n currencyString += currencies[i].name + \"'s and \"\n }\n }\n }\n return currencyString;\n}", "function findTheCheese (foods) {\n\n for (var i = 0; i < foods.length; i++) {\n\n switch (foods[i]) {\n case \"cheddar\":\n return \"cheddar\"\n break;\n case \"gouda\":\n return \"gouda\"\n break;\n case \"camembert\":\n return \"camembert\"\n break;\n }\n }\n return \"no cheese!\"\n}", "function getDrumArray(drumArrayName){\n\tswitch (drumArrayName) {\n\t\tcase 'kicks':\n\t\t\treturn kicks;\n\t\tcase 'snares':\n\t\t\treturn snares;\n\t\tcase 'hiHats':\n\t\t\treturn hiHats;\n\t\tcase 'rideCymbals':\n\t\t\treturn rideCymbals;\n\t\tdefault:\n\t\t\treturn;\n\t}\n}", "function cityNames(array) {\n\n// // 2. Iterate over the city values, only returning the city names. (Use map)\n \nlet names = cities.map(myObject => myObject.name)\nreturn names;\n\n}", "function shop(shoppers,item){\n var person = [];\n var profit = 0;\n var stok = item[2];\n for (var i = 0; i < shoppers.length; i++){\n if(shoppers[i].product === item[0] && shoppers[i].amount <= stok){\n stok -= shoppers[i].amount;\n profit += item[1]*shoppers[i].amount;\n person.push(shoppers[i].name);\n }\n }\n return [person,profit,stok];\n }", "generateWhoString(nearbyPlayers){\n let string = ''\n switch(nearbyPlayers.length){\n case 0:\n break;\n case 1:\n string += `There\\'s someone around, look it\\'s ${nearbyPlayers[0].name}`\n break;\n default:\n let i\n for(i = 0; i < nearbyPlayers.length; i++){\n switch (i) {\n case 0:\n string += nearbyPlayers[i].name\n break;\n case nearbyPlayers.length - 1:\n string += ` and ${nearbyPlayers[i].name} are here too`\n break;\n default:\n string += ` ,${nearbyPlayers[i].name}`\n }\n }\n }\n if(string){\n string+='.'\n }\n return string\n }", "static getManufactuer(arrayManu, clothesCollection) {\n for (let i = 0; i < clothesCollection.length; i++) {\n if (!arrayManu.includes(clothesCollection[i].manufacturer)) {\n arrayManu.push(clothesCollection[i].manufacturer);\n }\n }\n }" ]
[ "0.650766", "0.6338317", "0.601858", "0.5637064", "0.5604126", "0.54560345", "0.54550654", "0.54537755", "0.54403776", "0.5301211", "0.5280963", "0.5279994", "0.52252674", "0.5220512", "0.5215777", "0.52066475", "0.5187615", "0.517335", "0.5172325", "0.51317364", "0.50862384", "0.5085021", "0.508416", "0.5082573", "0.50782293", "0.5074842", "0.5062043", "0.5051267", "0.50422263", "0.504051", "0.503674", "0.50287956", "0.50269204", "0.50263125", "0.5017772", "0.50110173", "0.49873787", "0.49832535", "0.49828866", "0.49825662", "0.49766368", "0.49741462", "0.49700934", "0.4962782", "0.49574497", "0.4957397", "0.4956799", "0.49486607", "0.4947834", "0.4942597", "0.4938005", "0.4938005", "0.49369764", "0.49309558", "0.49309084", "0.491892", "0.4906548", "0.4901441", "0.49007633", "0.49005", "0.4893507", "0.4892088", "0.488441", "0.48832917", "0.48823944", "0.4880338", "0.48705575", "0.48632506", "0.4859605", "0.48534587", "0.48526314", "0.48419917", "0.4829987", "0.4829012", "0.4828945", "0.48244604", "0.48241642", "0.48199806", "0.481973", "0.48107657", "0.48051816", "0.4800975", "0.48000148", "0.4792952", "0.4790149", "0.4789536", "0.47834828", "0.47810403", "0.47782764", "0.47761655", "0.4775822", "0.4775787", "0.47729224", "0.47691822", "0.47660008", "0.47592512", "0.47574037", "0.4749116", "0.47489834", "0.47433794" ]
0.7218369
0
console.log(toBoolArray('deep')); // [false, true, true, false] // deep converts to 0110 // d is the 4th alphabet 0 // e is the 5th alphabet 1 // e is the 5th alphabet 1 // p is the 16th alphabet 0 console.log(toBoolArray('loves')); // [false, true, false, true, true] console.log(toBoolArray('tesh')); // [false, true, true, false] Create a function that returns the frequency distribution of an array. This function should return an object, where the keys are the unique elements and the values are the frequency in which those elements occur.
function getFrequencies(arr) { let obj = {}; arr.map(val => { if (!(val in obj)) { obj[val] = 1; } else { obj[val]++; } }); return obj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function frequencyTable(arr){\n\n}", "function calculateFrequencyDistribution(arr) {\n return arr.reduce((op, inp) => {\n op[inp] = op[inp] || 0;\n op[inp]++;\n return op;\n }, {})\n }", "function getFrequencyDict(arr) {\r\n var dictionary = {};\r\n arr.forEach((item) => {\r\n if (dictionary[item] === undefined) {\r\n dictionary[item] = 1;\r\n } else {\r\n dictionary[item] = dictionary[item] + 1;\r\n }\r\n });\r\n\r\n return dictionary;\r\n}", "function frequency(array) {\n\n var compare = 0; //We are going to compare using stored value\n var mostFrequent;\n var counter = 0\n\n for (var i = 0, len = array.length; i < len; i++) {\n var word = array[i];\n // check if word is new if so add to dict if not add to count\n if (counts[word] === undefined) {\n counts[word] = 1;\n } else {\n counts[word] = counts[word] + 1;\n }\n // if there is a new word with the highest value\n if (counts[word] > compare) {\n compare = counts[word];\n mostFrequent = array[i];\n }\n }\n return counts;\n}", "function equalizeArray(arr) {\r\n\r\n // Initialize a new array to hold the frequency of the occurrences\r\n // of each digit in arr\r\n var frequencyArray = new Array(100).fill(0);\r\n\r\n // console.log(arr);\r\n\r\n // Calculate the frequency of each digit in arr\r\n for (var i = 0; i < arr.length; i++) {\r\n frequencyArray[arr[i]] += 1;\r\n }\r\n\r\n // console.log(frequencyArray);\r\n\r\n // Sort the frequencyArray descending so the 0th element will have the\r\n // greatest frequency occurrence\r\n var sortFreqArray = frequencyArray.sort(function(a, b) {return b - a});\r\n\r\n // console.log(sortFreqArray);\r\n\r\n // Return the length of the original array minus the greatest frequency\r\n // of a digit occurring\r\n return arr.length - sortFreqArray[0];\r\n}", "function findAllModes(arr) {\n var freq_table = {};\n var new_arr =[]\n for (var i = 0; i < arr.length; i++) {\n if (freq_table.hasOwnProperty(arr[i]) === false) {\n freq_table[arr[i]] = 1\n }\n else{\n freq_table[arr[i]] += 1;\n }\n }\n \n var checker = 1\n for(var j=0; j<arr.length;j++){\n if(freq_table[arr[j]] > checker){\n while(new_arr.length>0){\n new_arr.pop()\n }\n new_arr.push(arr[j]) \n checker = freq_table[arr[j]]\n }\n else if(freq_table[arr[j]] === checker){\n \n new_arr.push(arr[j])\n }\n \n }\n arr = removeDuplicatesUnsorted(arr)\n new_arr=removeDuplicatesUnsorted(new_arr)\n if(arr.length===new_arr.length){\n return []\n }\n if(new_arr.length === 1){\n return new_arr[0]\n }\n else{\n return new_arr\n }\n }", "function characterFrequency(str) {\n //find frequency\n let array = [];\n let count = {};\n for (let x = 0; x < str.length; x++) {\n if (count[str[x]]) {\n count[str[x]]++;\n } else {\n count[str[x]] = 1;\n }\n }\n console.log(count);\n //sort highest frequency, sort by charcater\n //return in 2d array\n\n for (let [key, value] of Object.entries(count).sort((a, b) => b[1] - a[1])) {\n array.push([key, value]);\n // console.log(array);\n }\n\n console.log(array);\n return array.sort((a, b) => a > b);\n}", "function freq(arr) {\r\n var n = arr.length;\r\n var i, j, l;\r\n var frequency = 0;\r\n for (i = 0; i < n; i++) {\r\n l=0;\r\n for (j = 0; j < n; j++) {\r\n if (arr[i] == arr[j])\r\n l++;\r\n }\r\n if (frequency < l)\r\n frequency = l;\r\n \r\n }\r\n document.write(frequency);\r\n}", "function byCount(arr) {\n var itm,\n a = [],\n L = arr.length,\n o = {};\n\n for (var i = 0; i < L; i++) {\n itm = arr[i];\n if (itm !== 0 && !itm) continue;\n if (o[itm] === undefined) o[itm] = 1;else ++o[itm];\n }\n\n for (var p in o) {\n a[a.length] = {\n item: p,\n frequency: o[p]\n };\n }\n\n return a.sort(function (a, b) {\n return o[b.item] - o[a.item];\n });\n } //function byCount", "function frequencyCounter(arr){\n\n return arr.reduce((accum, next) =>{\n accum[next] = (accum[next] || 0) + 1;\n return accum\n }, {});\n}", "function sortByFrequencyAndRemoveDuplicates(array) {\n var frequency = {}, value;\n\n // compute frequencies of each value\n for(var i = 0; i < array.length; i++) {\n value = array[i];\n if(value in frequency) {\n frequency[value]++;\n }\n else {\n frequency[value] = 1;\n }\n }\n\n // make array from the frequency object to de-duplicate\n var uniques = [];\n for(value in frequency) {\n uniques.push(value);\n }\n\n // sort the uniques array in descending order by frequency\n function compareFrequency(a, b) {\n return frequency[b] - frequency[a];\n }\n\n return uniques.sort(compareFrequency);\n}", "function fncreateWordMap(wordsArray) {\n var wordsMap = {};\n\n wordsArray.forEach(function (key) {\n if (wordsMap.hasOwnProperty(key)) {\n wordsMap[key]++;\n } else {\n wordsMap[key] = 1;\n }\n });\n return wordsMap;\n}", "function getTagFrequencyArr(arr) {\n const tagTotal = arr.length;\n let tagTally = _.countBy(arr);\n // let tagFreqObj = {};\n let tagFrequencyArr = [];\n for (key in tagTally) {\n let freq = tagTally[key] / tagTotal;\n tagFrequencyArr.push({\n tag: key,\n frequency: freq\n });\n }\n return tagFrequencyArr;\n}", "function getFrequency(arr) {\n let prev;\n let obj = {};\n\n arr.sort();\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] !== prev) {\n obj[arr[i]] = 1 / arr.length;\n } else {\n obj[arr[i]] += 1 / arr.length;\n }\n prev = arr[i];\n }\n\n return obj;\n}", "function frequency() {\n let freq = [0, 0, 0, 0, 0, 0, 0];\n for (let i = 0; i < 7; i++) {\n for (let j = 0; j < dice.length; j++) {\n if (dice[j].value == i) {\n freq[i]++;\n }\n }\n }\n return freq;\n}", "function mode(array){\n\n //initialize mode array \n let modes = [] ; \n\n //initialize Mode Object \n\n let modeObject = {} ; \n\n\n\n //loop through the array and construct object \n //with each number and its frequency \n array.forEach(num => {\n if(! modeObject[num])\n modeObject[num] = 0 ;\n\n modeObject[num]++ ; \n\n });\n\n\n let maxFrequent = 0 ; \n //loop through the object properties\n for(let num in modeObject){ \n //if we find a number with high frequency we push it to mode \n //and update the frequency \n if(modeObject[num] > maxFrequent){\n modes = [num]; \n maxFrequent = modeObject[num];\n\n }else if (maxFrequent === modeObject[num]){\n //if the frequency of the number is the same as max \n // we push it to mode only \n\n modes.push(num);\n }\n }\n if (modes.length === Object.keys(modeObject).length)\n modes = [] ; \n\n return modes ; \n}", "function charFreq(input) {\n var frequencies = {}, i, len, c;\n \n for (i = 0, len = input.length; i < len; i++) {\n c = input[i];\n \n if (typeof frequencies[c] === \"number\") {\n frequencies[c] += 1;\n } else {\n frequencies[c] = 1;\n }\n }\n \n return frequencies;\n}", "function frequencyMap(words) {\n var frequencyMap = {};\n\n function addToFrequencyMap(word) {\n if (frequencyMap[word]) {\n frequencyMap[word] += 1;\n }\n else {\n frequencyMap[word] = 1;\n }\n }\n\n words.forEach(function(w) {\n var i;\n var one, two, three;\n\n if (w.length < 5) {\n return;\n }\n\n for (i = 0; i < w.length; i += 1) {\n var newChar = w.charAt(i);\n\n // TODO: I can generalize this past 3\n if (i > 1) {\n three = two + newChar;\n addToFrequencyMap(three);\n }\n if (i > 0) {\n two = one + newChar;\n addToFrequencyMap(two);\n }\n one = newChar\n addToFrequencyMap(one);\n }\n });\n\n return frequencyMap;\n}", "function countUniqueValues(arr) {\n var arr1 = arr.sort();\n // var array = [];\n var counter = {};\n for (let i = 0; i < arr1.length; i++) {\n let letter = arr[i];\n counter[letter] = (counter[letter] || 0) + 1;\n }\n\n return counter.length;\n}", "function characterFrequency(string) {\n let objLib;\n let resultArray;\n\n objLib = {};\n\n if(string.length === 0) {\n return []\n }\n\n for (const letter of string) {\n if(!objLib[letter]){\n objLib[letter] = 0\n }\n objLib[letter]++;\n }\n\n resultArray = Object.entries(objLib).sort((a , b) => {\n if(a[1] < b[1]){\n return 1\n }\n if(a[1] > b[1]) {\n return -1\n }\n if(a[1] === b[1]) {\n if(a[0] > b[0]) {\n return 1\n }\n }\n })\n \n return resultArray;\n}", "function generateFrequencies()\n{\n\tfor(var note = 0; note < 127; ++note)\n\t{\n\t\tconst a = Math.pow(2,1.0/12.0); // comments pls\n\t\tFREQUENCIES[note] = 440 * Math.pow(a, note - 81);\n\t}\n}", "function getMode(array) {\n // hash table object \n var modeObj = {};\n array.forEach(num => {\n // add as property if not present already\n if(!modeObj[num]) modeObj[num] = 0;\n // increment\n modeObj[num]++\n });\n\n // how often current mode shows up\n var maxFrequency = 0;\n var modes = []\n // loop thru num properties in modeObj\n for (var num in modeObj) {\n if(modeObj[num] > maxFrequency) {\n modes = [num];\n maxFrequency = modeObj[num];\n }\n // if current number has same modes as maxfreq\n else if (modeObj[num] === maxFrequency) modes.push(num)\n }\n\n // if number of modes is equal to num of keys in mode obj, we know all numbers appeared at same freq.\n if (modes.length === Object.keys(modeObj).length) modes = []\n return modes;\n}", "function testFreq(string){\n var characters = {};\n\n for (var i=0; i<string.length; i++){\n\n characters[string[i]] = \n (characters[string[i]] === undefined) ?\n 1 : \n characters[string[i]]+1;\n }\n return characters; \n}", "function freq(array) {\n let mostFreq = 1;\n let count = 0;\n let el;\n for (let i = 0; i < array.length; i++) {\n for (let j = i; j < array.length; j++) {\n if (array[i] === array[j]) {\n count++;\n }\n if (mostFreq < count) {\n mostFreq = count;\n el = array[i];\n }\n }\n count = 0;\n }\n return `${el} occurs ${mostFreq} times`;\n}", "function unique2(array){\n var collectionObj = {};\n for (var i = 0; i < array.length; i++){\n collectionObj[array[i]] = true;\n };\n return Object.keys(collectionObj);\n}", "function charFreq(word) {\n var freqListing = {};\nvar charArray=word.split('');\nfor (var i = 0; i<charArray.length; i ++){\n if (freqListing[charArray[i]]){\n freqListing[charArray[i]]+=1;\n }else{\n freqListing[charArray[i]]=1;\n }\n}\nreturn freqListing;\n}", "function frequent(array){\n var counter = 0;\n var maxCounter = 0;\n var item;\n for(var i = 0; i < array.length; i++){\n for(var j = i; j < array.length; j++){\n if(array[i] === array[j]){\n counter++; // broj ponavljanja trenutnog elementa\n }\n }\n if(counter > maxCounter){\n item = array[i]; //nalazi najcesci element areja\n maxCounter = counter; // broji ponavljanja najcesceg elementa\n }\n counter = 0; // resetujemo counter da ne bi racunao i pojave svih prethodnih elementa\n }\n return item;\n}", "function distinct(array){\n return Object.keys(array.reduce(function(current, value){\n current[value] = true;\n return current;\n }, {}));\n}", "function isUnique(array) {\n var u = {}, a = [];\n var isUnique = 1;\n for(var i = 0, l = array.length; i < l; ++i){\n if(u.hasOwnProperty(array[i])) {\n isUnique = 0;\n break;\n }\n u[array[i]] = 1;\n }\n return isUnique;\n}", "function getFrequencies(frequency) {\n let pairs = [];\n\n // fills pairs with pairs of words and their frequencies\n for (i=0; i<frequency.w.length; i++) {\n pairs.push({word: frequency.w[i], count: frequency.f[i]});\n }\n\n // sort the pairs list greatest to smallest\n pairs.sort(function(a, b) {\n return b.count - a.count || a.word.localeCompare(b.word);\n });\n\n frequency = [];\n\n // creates the string from the pair and pushes to a new array\n for (let pair of pairs.slice(0, 10)) {\n frequency.push(pair.word + '(' + pair.count + ')')\n }\n\n // return the array\n return frequency;\n}", "function frequent(input) {\n let maximum = 0;\n let value = input[0];\n let hashmap = {};\n for (let i = 0; i < input.length; i++) {\n let element = input[i];\n if (hashmap[element]) {\n hashmap[element] += 1;\n if (hashmap[element] > maximum) {\n maximum = hashmap[element];\n value = element;\n }\n } else {\n hashmap[element] = 1;\n if (hashmap[element] > maximum) {\n maximum = hashmap[element];\n value = element;\n }\n }\n }\n console.log(hashmap);\n return value + \" ( \" + maximum + \" times )\";\n}", "function sameFrequency(n1, n2){\n return validAnagram(n1.toString(), n2.toString());\n}", "generateNumbers() {\n // 0 - 1 Object and count per each instance of number\n const numberFrequency = [];\n // randomly generate a number 100 times and push increment numberFrequency object\n for (let i = 0; i < 100; i++) {\n let num = Number((Math.floor(Math.random() * 10) * 0.1).toPrecision(1));\n if (numberFrequency[num]) {\n numberFrequency[num]++;\n } else {\n numberFrequency[num] = 1;\n }\n }\n return numberFrequency;\n }", "function letterFreq(str) {\n var output = {};\n for (var i = 0;i < str.length; i++) {\n if (output.hasOwnProperty(str[i])) {\n output[str[i]]++;\n } else {\n output[str[i]] = 1;\n }\n }\n return output;\n}", "function convertToHex(input) {\n var i;\n var output = [];\n //console.log(\"\\nInput to convertToHex is :\"+input+\"\\n\");\n for (i in input) {\n output[i] = (input[i].charCodeAt(0)).toString(16);\n if (output[i].length!=2) {\n output[i]=\"0\"+output[i];\n }\n }\n //console.log(output);\n countFrequncy(output);\n return output;\n}", "function getUnique(array) {\n var u = {}, a = [];\n for(var i = 0, l = array.length; i < l; ++i){\n if(u.hasOwnProperty(array[i])) {\n continue;\n }\n a.push(array[i]);\n u[array[i]] = 1;\n }\n return a;\n}", "function permutations(arr) {\n var output = {};\n\n // loop through all the words in the array\n for(var i=0; i<arr.length; i++) {\n var word = arr[i];\n var inOutput = false;\n\n // check all the keys in the output to see if the current word is an anagram of any of them\n for(key in output) {\n if (isAnagram(word, key)) { // if it is an anagram, update the value of that key\n output[key] += 1;\n inOutput = true;\n break; // no need to keep checking if anagram is found\n }\n }\n // if all the keys in the output have been checked and it's not an anagram of any of them\n // it means the word/any anagrams of it are not yet in the output, so add it to the output\n if (inOutput == false) {\n output[word] = 1;\n }\n }\n\n return output;\n}", "function sameFrequency(int1, int2) {\n\n\n let freqObj = {};\n let arr1 = int1.toString().split('');\n let arr2 = int2.toString().split('');\n let value;\n\n \n if (!arr1 || !arr2) {\n return false;\n }\n else if (arr1.length !== arr2.length) {\n return false;\n }\n \n // Step 1\n for( let key in arr1) {\n value = arr1[key];\n freqObj[value] = (freqObj[value] || 0) + 1;\n }\n\n // console.log(freqObj);\n\n // Step 2\n for (let key in arr2) {\n value = arr2[key];\n freqObj[value]--;\n if (freqObj === -1) {\n return false;\n } \n }\n\n console.log(freqObj);\n\n // Step 3\n for (let key in freqObj) {\n if (freqObj[key] !== 0) {\n return false;\n }\n }\n\n return true;\n}", "function sortByFrequencyUseArr(arr){\n const frequency = {};\n \n arr.forEach(item => {\n frequency[item] = (frequency[item] || 0) + 1;\n });\n //console.log(frequency)\n\n let sortable = arr.map(item => [item, frequency[item]]);\n //console.log(sortable);\n\n sortable.sort((a, b) => {\n if (a[1] === b[1]) {\n return b[0] - a[0]\n } \n return a[1] - b[1]\n });\n //console.log(sortable);\n\n return sortable.map(s => s[0]);\n}", "function findMostFrequent(arr) {\r\n let compare = \"\";\r\n let mostFreq = \"\";\r\n\r\n arr.reduce((acc, val) => {\r\n if (val in acc) {\r\n acc[val]++;\r\n } else {\r\n acc[val] = 1;\r\n }\r\n if (acc[val] > compare) {\r\n\r\n compare = acc[val];\r\n mostFreq = val;\r\n }\r\n return acc;\r\n }, {})\r\n return mostFreq;\r\n}", "function frequent(arr) {\n const obj = arr.reduce((acc, cur) => {\n acc[cur] = (acc[cur] || 0) + 1;\n return acc\n }, {})\n const item = Object.entries(obj).sort((a, b) => b[1] - a[1])[0];\n return `${item[0]} (${item[1]} times)`\n}", "function highestFrequency(arr) {\n const stringFrequency = {};\n let maxFrequency = 0;\n \n arr.forEach(function(str) {\n stringFrequency[str] = stringFrequency[str] + 1 || 1;\n maxFrequency = Math.max(maxFrequency, stringFrequency[str]);\n });\n \n const entries = Object.entries(stringFrequency);\n\n for(let i = 0; i < entries.length; i++) {\n const thisEntry = entries[i];\n if(thisEntry[1] === maxFrequency) {\n return thisEntry[0];\n }\n }\n}", "function singleNum(arr) {\n let count = {};\n let result = [];\n\n for (let i = 0; i < arr.length; i++) {\n if (count[arr[i]]) {\n count[arr[i]] ++\n } else {\n count[arr[i]] = 1;\n }\n }\n\n for (key in count) {\n console.log(key);\n if (count[key] === 1) {\n result.push(parseInt(key));\n }\n }\n console.log(result);\n console.log(count);\n\n return result;\n}", "function func20(arr) {\r\n const result = [];\r\n const obj = {};\r\n arr.forEach(item => (obj[item] ? obj[item]++ : (obj[item] = 1)));\r\n for (let key in obj) obj[key] > 1 ? result.push(key) : null;\r\n return result;\r\n}", "function NormalizedArray() {\n\n var members = {};\n var wordCount = 0;\n var normalized = false;\n this.ls = [];\n\n /* add(string) => pushes into ls and members if it's unique\n otherwise, add 1 to the number of times it has been added */\n this.add = function(item) {\n if (members[item] != undefined)\n members[item] += 1;\n\n else {\n members[item] = 1;\n this.ls.push(item);\n }\n wordCount += 1; // always\n }\n // word count => word frequency\n this.normalize = function() {\n if (normalized)\n throw 'NormalizedArray: normalize can only be called once';\n\n for (var i = 0; i < this.ls.length; i++)\n this.ls[i] = [this.ls[i], (members[this.ls[i]] / wordCount)];\n\n normalized = true;\n }\n}", "function freqChecker(a, b, myFunc){\n // first it we will call a function to create a histogram result object\n // the result will be true unless a key value !== 0;\n let results = myFunc(a,b), result = true;\n\n // for each key in results\n Object.keys(results).forEach(function (key){\n\n // if the key value !== 0, the result is false.\n if (results[key] !== 0){\n result = false;\n };\n });\n return result;\n}", "function mostFrequent(arr) {\n \n \n \n}", "function charFreq(string){\n \"use strict\";\n var frequency = {};\n\n for(var i=0; i<string.length; i++){\n var char = string[i];\n\n if(frequency.hasOwnProperty(char)){\n frequency[char] += 1;\n }else{\n frequency[char] = 1;\n }\n }\n\n return frequency;\n}", "function frequencyOfUniqueNums(nums) {\r\n let uniqueNumsCounts = {};\r\n \r\n for (let num of nums) {\r\n if (uniqueNumsCounts[num]) {\r\n uniqueNumsCounts[num]++;\r\n } else {\r\n uniqueNumsCounts[num] = 1;\r\n }\r\n }\r\n\r\n for (let numCount of Object.keys(uniqueNumsCounts)) {\r\n console.log(`${numCount}: ${uniqueNumsCounts[numCount] / nums.length}`);\r\n }\r\n}", "function wordIsogram(test_string){\n\n //Should be ot datatype string\n if (typeof test_string === undefined){\n return true;\n }\n //this variable will get reset later if the string is not an isogram\n var iso_string = true;\n //Lowercase the string so repeat letters won’t slip by. We could just as easily //uppercase eveyrthing.\n var low_case_str = iso_string.toLowerCase();\n //This is my borrowed letter-counting function. The empty object will hold //the count for instances of each character in a string\n var counts = {};\n //Loop through the string one letter at a time until we reach the end of the //string\n for (i = 0; i <= low_case_str.length; i++) {\n //each character gets stored in the variable letter when we loop through it\n \n var word_char = low_case_str.charAt(i);\n \n //if we see a letter again, add one to the count; otherwise, initialize the //count to 1\n \n if(counts[word_char]) {\n counts[word_char] = 1 + counts[word_char];\n } else {\n counts[word_char] = 1;\n }\n //now, if the count of any letter is greater than one, we set passing to false\n \n if(counts[word_char] > 1) {\n return iso_string == false;\n }\n \n }\n //if there’s more than one instance of a letter, passing should return as false, //and should return as true otherwise\n return iso_string;\n }", "function mode(arr) {\n var numMapping = {};\n var greatestFreq = 0;\n var mode;\n arr.forEach(function(p) {\n var key = Math.round(p[0]+1000*p[1]+1000000*p[2]);\n numMapping[key] = (numMapping[key] || 0) + 1;\n\n if (greatestFreq < numMapping[key]) {\n greatestFreq = numMapping[key];\n mode = p;\n }\n });\n return mode;\n }", "function containsSameFrequency(test){\n let map = new Map();\n for (let i = 0; i < test.length; i++) {\n if(map.has(test[i])){\n map.set(test[i], map.get(test[i]) + 1);\n } else {\n map.set(test[i], 1);\n }\n }\n let ans = map.get(test[0]);\n for(let freq of map.values()){\n if(ans != freq) return false;\n }\n return true;\n}", "function toHash(arr) {\n const hash = {};\n for (const item of arr)\n hash[item] = true;\n return hash;\n}", "function toHash(arr) {\n const hash = {};\n for (const item of arr)\n hash[item] = true;\n return hash;\n}", "function countUniqueValues(arr){\n // add whatever parameters you deem necessary - good luck!\n let result = {};\n for (let val of arr) {\n result[val] ? result[val] += 1 : result[val] = 1 ;\n }\n return Object.keys(result).length;\n}", "function charFreq(string){\n \"use strict\";\n var freqList = {};\n for (var i = 0; i < string.length; i++) {\n var char = string.charAt(i);\n if (freqList[char]){\n freqList[char] ++;\n } else {\n freqList[char] =1;\n }\n }\n return freqList;\n }", "function mostFreq(array) {\n let elementMap = {};\n let maxOccurance = 0;\n let maxElement = array[0];\n \n array.forEach(el => {\n if (elementMap[el]) {\n elementMap[el]++\n } else {\n elementMap[el] = 1;\n }\n \n if(modeMap[el] > maxOccurance) {\n maxElement = el;\n maxOccurance = elementMap[el];\n }\n })\n \n return maxElement;\n }", "function arrayToBooleanHash (a) {\n var h = {}, i;\n for (i = 0; i < a.length; ++i) {\n h[a[i]] = true;\n }\n return h;\n}", "function mode(array) {\r\n var numMapping = {};\r\n var greatestFreq = 0;\r\n var mode;\r\n array.forEach(function findMode(number) {\r\n numMapping[number] = (numMapping[number] || 0) + 1;\r\n\r\n if (greatestFreq < numMapping[number]) {\r\n greatestFreq = numMapping[number];\r\n mode = number;\r\n }\r\n });\r\n\r\n return mode;\r\n}", "function arrayFactors(array){\n for (var i=0; i<array.length;i++){\n output[array[i]] = [];\n for (var j=0; j<array.length;j++){\n if (i==j){\n continue; \n } else if(array[i] % array[j] == 0){\n console.log(array[j] +' is a factor of '+ array[i]);\n output[array[i]].push(array[j]);\n }\n }\n console.log('for array element ', array[i] + ' the output is ', output[array[i]]);\n }\n\n var displayOutput = output.toString();\n console.log(output);\n return displayOutput;\n}", "function distinctList(inputArray){\n var i;\n var length = inputArray.length;\n var outputArray = [];\n var temp = {};\n for (i = 0; i < length; i++) {\n temp[inputArray[i]] = 0;\n }\n for (i in temp) {\n outputArray.push(i);\n }\n return outputArray;\n}", "function equalizeArray(arr) {\n const size = arr.length;\n const frequency = new Array(Math.max(...arr) + 1);\n let max;\n\n frequency.fill(0);\n for(let i = 0; i < size; i++) {\n frequency[arr[i]]++;\n }\n\n max = Math.max(...frequency);\n return (size - max);\n\n}", "function doTF(tf)\r\n{\r\n termfrequency = {};\r\n var word = tf.split(' '); // individual words\r\n var count=0;\r\n \r\n for(var i = 0;i<tf.length;i++)\r\n {\r\n if(termfrequency.hasOwnProperty(word[i]))\r\n {\r\n // the word is already in the database:\r\n termfrequency[word[i]]++;\r\n arrfrequency++;\r\n }\r\n else\r\n {\r\n // the word is new:\r\n termfrequency[word[i]]=1;\r\n arrfrequency++;\r\n \r\n }\r\n for (var j = 0; j < arr.length; j++) {\r\n if (arr[j] == word[i]) {\r\n count++;\r\n } }\r\n}\r\n \r\n \r\n \r\n console.log(termfrequency);\r\n console.log(arrfrequency);\r\n console.log(word);\r\n console.log(count); \r\n return count;\r\n }", "function characterFrequency(str) {\n let obj = {};\n let result = [];\n\n for (let char of str) {\n if (!obj[char]) {\n obj[char] = 1;\n } else {\n obj[char] += 1;\n }\n }\n\n for (let [key, value] of Object.entries(obj)) {\n result.push([key, value])\n }\n \n let sorted = result.sort((a, b) => {\n if (a[1] - b[1] === 0) {\n return a[0] - b[0]\n } else {\n return b[1] - a[1];\n }\n });\n\n return sorted; \n}", "function mode(arr){\n let freq = {};\n for(let num of arr){\n if(freq[num] === undefined){\n freq[num] = 1;\n }else{\n freq[num]++;\n }\n }\n\n // {5: 10, 6: 10}\n // {6: 10, 5: 10}\n let maxValue = 0;\n let maxFreqKey;\n for(let key in freq){\n if(freq[key] > maxValue){\n maxValue = freq[key];\n maxFreqKey = key;\n }else if(freq[key] === maxValue){\n if(Number(key) < Number(maxFreqKey)){\n maxFreqKey = key;\n }\n }\n }\n return Number(maxFreqKey);\n}", "function unique(array){\n var collectionObj = {};\n array.forEach(function(ele){\n collectionObj[ele] = true;\n });\n return Object.keys(collectionObj);\n}", "function findMode(arr) {\n let itemCounter = {};\n for (let item of arr) {\n if (!itemCounter.hasOwnProperty(item)) {\n itemCounter[item] = 1;\n } else {\n itemCounter[item]++;\n }\n }\n let keys = Object.keys(itemCounter);\n let mode = keys[0];\n let frequents = [];\n for (let key of keys) {\n if (itemCounter[key] > itemCounter[mode]) {\n frequents = [];\n frequents.push(key);\n mode = key;\n } else if (itemCounter[key] == itemCounter[mode]) {\n frequents.push(key);\n }\n }\n console.log(itemCounter);\n return frequents;\n}", "function countUniqueValues(array) {\n if (array.length === 0) {\n return 0;\n }\n\n const newObj = {};\n\n for (let i = 0; i < array.length; i++) {\n if (newObj[array[i]]) {\n newObj[array[i]]++;\n } else {\n newObj[array[i]] = 1;\n }\n }\n\n return Object.keys(newObj).length;\n}", "function makeBinary(array) {\n\n var newArray = [];\n for (i = 0; i < array.length; i ++) {\n if (array[i] >= 1) {\n newArray.push('1');\n continue;\n }\n if (array[i] <= -1){\n newArray.push('-1');\n continue;\n }\n else {\n newArray.push('0');\n continue;\n }\n }\n return newArray;\n}", "function same_refractor(arr1, arr2) {\n\tlet freq1 = {};\n\tlet freq2 = {};\n\n\t// Adding to the keys each value of the arr1\n\t// with the value being the frequency\n\tfor (let i of arr1) {\n\t\tfreq1[i] = freq1[i] ? freq1[i] + 1 : 1;\n\t}\n\t// Same before but squared\n\tconsole.log(freq1);\n\tfor (let i of arr2) {\n\t\tfreq2[i] = freq2[i] ? freq2[i] + 1 : 1;\n\t}\n\tconsole.log(freq2);\n\n\t// Check if the result match\n\tfor (let key in freq1) {\n\t\t// 2**2 (4) exists in freq2?\n\t\tif (!freq2[key ** 2]) {\n\t\t\treturn false;\n\t\t}\n\t\t// Check freq the count\n\t\tif (freq1[key] !== freq2[key ** 2]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}", "function sameFrequency(num1, num2){\n let strNum1 = num1.toString();\n let strNum2 = num2.toString();\n let frequencyNum1 = {};\n if (strNum1.length !== strNum2.length) {\n return false;\n }\n \n for (let i = 0; i < strNum1.length; i++) {\n let number = strNum1[i];\n frequencyNum1[number] ? frequencyNum1[number] += 1 : frequencyNum1[number] = 1; \n }\n \n for (let i = 0; i < strNum2.length; i++) {\n let number = strNum2[i];\n if (!frequencyNum1[number]) {\n return false\n }\n else {\n frequencyNum1[number] -= 1\n }\n }\n return true;\n }", "function notesToFrequencies(notes){\n var frequencyValues = [];\n var i = 0;\n for(note in notes){\n frequencyValues[i] = noteFrequencies[notes[note]];\n ++i;\n }\n return frequencyValues;\n}", "function findMode(arr) {\n let freqCounter = createFrequencyCounter(arr);\n \n let count = 0;\n let mostFrequent;\n \n for (let key in freqCounter) {\n if (freqCounter[key] > count) {\n mostFrequent = key;\n count = freqCounter[key];\n }\n }\n \n return +mostFrequent;\n }", "function setWordFreq(inputArray) {\n\tinputArray.forEach(function(key) {\n\t\tif (wordCount.hasOwnProperty(key)) {\n\t\t\twordCount[key]++;\n\t\t}\n\t\telse {\n\t\t\twordCount[key] = 1;\n\t\t}\n\t});\n}", "function majorityElement(nums) {\n // initialize an empty object to store integer and frequency of that integer\n var object = {};\n\n // iterate i over length of array\n for (var i = 0; i < nums.length; i ++) {\n // if object is empty\n if (Object.keys(object).length === 0) {\n // set first key par value to the first element with frequency, or \"count\", of 1\n object[nums[i]] = 1\n // else if there is already a key value pair in object\n } else if (nums[i] in object) {\n // then increment the count of that key by 1\n object[nums[i]]++\n // else if the key does not exist\n } else if (object[nums[i]] !== nums[i]) {\n //then add the new key and set frequency, or \"count\", to 1\n object[nums[i]] = 1\n }\n }\n\n // iterate over object to determine which key has the highest frequency. Be sure to compare this frequency with the length of the original array. \n\n // initialize the frequency and an empty array to store \n var arrLength = nums.length / 2;\n var majorityElement = 0;\n // iterate over object\n for (let key in object) {\n // if count of key is greater than half the arr length\n if (object[key] > arrLength) {\n // set majorityElement to the associated key\n majorityElement = key;\n } \n }\n\n return parseInt(majorityElement)\n // return key with the highest frequency\n\n}", "function isIsogram (x) {\n\tvar obj = letterCount(x);\n\t// console.log(obj);\n\n\tfor (var prop in obj) {\n\t\tif (isNaN(prop) && obj[prop] === 1) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n}", "function unique(arr) {\n var u = {}, a = [];\n for(var i = 0, l = arr.length; i < l; ++i){\n if(!u.hasOwnProperty(arr[i])) {\n a.push(arr[i]);\n u[arr[i]] = 1;\n }\n }\n return a;\n}", "function countTrue(arr){\n return array.filter(t=>t==true).length;\n}", "function unique(arr) {\n var u = {}, a = [];\n for(var i = 0, l = arr.length; i < l; ++i){\n if(!u.hasOwnProperty(arr[i])) {\n a.push(arr[i]);\n u[arr[i]] = 1;\n }\n }\n return a;\n}", "function findMode(arr) {\n let freqCounter = createFrequencyCounter(arr);\n let count = 0;\n let mostFrequent;\n\n for (let key in freqCounter) {\n //if value of key is more than count\n if (freqCounter[key] > count) {\n mostFrequent = key;\n count = freqCounter[key]\n }\n }\n return +mostFrequent;\n}", "function powerSet(str) {\n let obj = {}\n //This loop is to take out all duplicate number/letter\n for(let i=0;i<str.length; i++){\n obj[str[i]] = true;\n }\n //variable array will have no duplicates\n let array = Object.keys(obj);\n let result = [[]];\n for(let i=0; i<array.length ;i++){\n //this line is crucial! It prevents us from infinite loop\n let len = result.length; \n for(let x=0; x<len ;x++){\n result.push(result[x].concat(array[i]))\n }\n }\nreturn result;\n}", "function getUniqueTags(arr) {\n let tagsArr = cleanTagArr(arr);\n let freqArr = getTagFrequencyArr(tagsArr);\n return freqArr;\n}", "function convert(array) {\n const result = [];\n for (let i = 0; i < array.length; i++) {\n let count = 0;\n let cur = '';\n for (let j = 0; j < array[i].length; j++) {\n if (array[i][j] === '1') {\n count++;\n continue;\n }\n\n if (count !== 0) {\n cur += count;\n count = 0;\n }\n\n cur += array[i][j];\n }\n\n if (count !== 0) {\n cur += count;\n }\n\n result.push(cur);\n }\n\n return result;\n}", "function frequent(){\n var arr1=document.getElementById(\"demo\").value;\n var mf = 1;\n var m = 0;\n var item;\n for (var i=0; i<arr1.length; i++)\n {\n for (var j=i; j<arr1.length; j++)\n {\n if (arr1[i] == arr1[j])\n m++;\n if (mf<m)\n {\n mf=m; \n item = arr1[i];\n }\n }\n m=0;\n }\n document.getElementById(\"ans2\").innerHTML = (item+\" ( \" +mf +\" times ) \") ;\n}", "function mostFreqFunc(arr) {\n let firstCounter = 1;\n let realNumber = \"none\";\n // let compareNumber;\n for (let i = 0; i < arr.length; i++) {\n let counter = 0;\n for (let j = 0; j < arr.length; j++) {\n if (arr[i] === arr[j]) counter++;\n }\n if (counter > firstCounter) {\n firstCounter = counter;\n realNumber = arr[i];\n }\n else if (counter === firstCounter && counter !== 1 && realNumber !== arr[i]) {\n realNumber = \"none, there are many freq numbers\";\n }\n }\n console.log(`The most freq number is ${realNumber}`);\n console.log(`---------------------`);\n}", "function charFreq(string){\n \"use strict\";\n var charList = {};\n for (var x = 0; x < string.length; x++) {\n if (string.charAt(x) in charList)\n charList[string.charAt(x)] += +1;\n else\n charList[string.charAt(x)] = 1;\n }\n return charList;\n}", "function decode(freqs, bits) {}", "function sameFrequency(num1, num2) {\n let freq = {};\n let nums1 = num1.toString();\n let nums2 = num2.toString();\n for (let c1 of nums1) {\n freq[c1] ? freq[c1]++ : (freq[c1] = 1);\n }\n for (let c2 of nums2) {\n if (!freq[c2]) {\n return false;\n } else {\n freq[c2]--;\n }\n }\n return true;\n}", "function countUniqueValuesNaive(arr) {\n if(!arr || !arr.length) return 'please provide a sorted array ';\n const uniqueValues = {};\n\n for (let i = 0; i < arr.length; i++) {\n uniqueValues[arr[i]] ? uniqueValues[arr[i]] += 1 : uniqueValues[arr[i]] = 1;\n \n }\n const uniqueStrArray = Object.keys(uniqueValues);\n return uniqueStrArray.length;\n\n \n}", "function theTruthCounts(array) {\n\t// create a counter variable to accumulate the elements\n\tlet count = 0;\n\t// iterate through the array\n\tfor (let i = 0; i < array.length; i++) {\n\t\t// grab the element\n\t\tlet element = array[i];\n\t\t// if the element is an array\n\t\tif (Array.isArray(element)) {\n\t\t\t// then get the count of truthy elements in the array\n\t\t\tcount += theTruthCounts(element);\n\t\t} else {\n\t\t\t// if it is just a value and is true\n\t\t\tif (element) {\n\t\t\t\t// increment count\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t} // return count\n\treturn count;\n}", "function sameFrequency(num1, num2) {\n // DO stuff\n // convert intergers to strings\n num1 = num1.toString();\n num2 = num2.toString();\n // if number lengths arent the same return false\n if (num1.length != num2.length) {\n return false;\n }\n // Create object for num 1 freq\n let freq = {};\n // loop through num1 to populate freq object\n for (let num in num1) {\n let number = num1[num];\n if (freq[number]) {\n freq[number]++;\n } else {\n freq[number] = 1;\n }\n }\n // loop through number 2 to find if keys match nums\n for (let num in num2) {\n let number = num2[num];\n if (!freq[number]) {\n return false;\n } else {\n freq[number] -= 1;\n }\n }\n return true;\n}", "function myUniq(arr) {\n const uniques = Object.create(null);\n arr.forEach( element => {\n uniques[element] = true;\n });\n return Object.keys(uniques);\n}", "function createWordHistogram(words) {\n let hist = {};\n for (let word of words) {\n if (hist[word] === undefined) {\n hist[word] = 0;\n }\n hist[word]++;\n }\n return hist;\n}", "function characterFrequency (string) {\n var count = {}, res=[];\n\n for (var i = 0; i < string.length; i++){\n if (count[string[i]]) count[string[i]]++\n else { count[string[i]] = 1 }\n }\n\n for (var key in count){ \n res.push([key, count[key]])\n }\n\n res.sort(function(a,b){\n if (a[1] === b[1]){\n if (a[0] < b[0]) return -1;\n if (a[0] > b[0]) return 1;\n }else { \n if (a[1] > b[1]) return -1;\n if (a[1] < b[1]) return 1;\n return 0;\n }\n })\n\n return res\n}", "function stray(numbers) {\r\n\tvar dict = {};\r\n \r\n for(i = 0; i < numbers.length; i++){\r\n\t var num = numbers[i];\r\n\r\n\t\tif(dict[num] === undefined){\r\n\t\t\tdict[num] = 1;\r\n\t\t}else{\r\n\t\t\tdict[num]++;\r\n\t\t}\r\n\t}\r\n\t\r\n\tfor(key in dict){\r\n\t\tif(dict[key] === 1){\r\n\t\t\treturn parseInt(key);\r\n\t\t}\r\n\t}\t\r\n return 0;\r\n}", "function sameFrequency(num1, num2) {\n num1 = num1.toString();\n num2 = num2.toString();\n if (num1.length !== num2.length) return false;\n\n let frequency = {};\n for (let i = 0; i < num1.length; i++) {\n if (!frequency[num1[i]]) {\n frequency[num1[i]] = 1;\n } else {\n frequency[num1[i]]++;\n }\n }\n for (let i = 0; i < num2.length; i++) {\n if (!frequency[num2[i]]) {\n return false;\n }\n if (frequency[num2[i]]) {\n frequency[num2[i]] = frequency[num2[i]] - 1;\n }\n }\n return true;\n}", "function getPasswordEntropy(password) {\n let base = 0 // Amount of unique letters\n let length = 0 // amount of letters\n let freqCount = {} // how many times each letter appears\n\n // Count up the frequencies\n for(let letter of password) {\n length += 1\n if(letter in freqCount) {\n freqCount[letter] += 1\n } else {\n base += 1\n freqCount[letter] = 1\n }\n }\n\n // What percent of the password is unique\n let originality = base / length\n\n // If there is one letter, calculation\n // will return NaN, but 1 is what it should return\n if(base == 1) {\n return originality\n } else {\n let entropy = 0\n \n for(let letter in freqCount) {\n freq = freqCount[letter] / length\n entropy -= freq * (Math.log(freq) / Math.log(base))\n }\n \n\n return Math.sqrt(originality * entropy)\n }\n}", "function frequencySort(s) {\n\t\n}", "function highestFreq (str) {\n\t// Create an object displaying the character count for each character.\n \tlet count = str.split('').reduce((a,b) => {\n \ta[b] ? a[b] ++ : a[b] = 1;\n \treturn a;\n \t},{});\n \t// Reduce the keys of our count object\n \treturn Object.keys(count).reduce((a,b,c) => {\n \t\t// If the array provided to reduce is empty. Push in the first element.\n \t\t// We need to start comparing elements.\n \tif(!a.length) {\n \t\ta.push(b); \n \t// If the first element in the array is appears less times than the current character.\n \t// Empty out the checker array and push in the new element.\n \t} else if(count[a[0]] < count[b]) {\n \t\twhile(a.length){\n \t\t\ta.pop();\n \t\t}\n \t\t a.push(b);\n \t// If the current element appears the same amount of times as the first element in the array.\n \t// Push it in the array as well.\n \t} else if(count[a[0]] === count[b]) {\n \t\ta.push(b);\n \t}\n \t// Return the array after each iteration. \n \treturn a;\n \t// Finally sort the array and join it into a string.\n \t}, []).sort().join('');\n}", "function findMode(arr){\n let arrangedNums = frequencyCounter(arr);\n\n\n let count = 0;\n let mode;\n\n for(let key in arrangedNums){\n if(arrangedNums[key] > count){\n mode = key;\n count = arrangedNums[key];\n }\n }\n\n return +mode;\n}" ]
[ "0.66417587", "0.6625387", "0.64302576", "0.6051295", "0.6039453", "0.59497607", "0.5922573", "0.5848281", "0.582161", "0.5814154", "0.5795614", "0.5794617", "0.5793017", "0.5767418", "0.57516724", "0.56951797", "0.5676807", "0.5641756", "0.56346315", "0.5617751", "0.5611264", "0.5604731", "0.5599063", "0.55793905", "0.5578942", "0.557389", "0.5564187", "0.5554696", "0.55387896", "0.5534703", "0.5531547", "0.5526902", "0.54875606", "0.5483919", "0.54673463", "0.5466728", "0.5457319", "0.5444866", "0.5417824", "0.5413391", "0.54118335", "0.53821903", "0.5379427", "0.53757596", "0.5374804", "0.53713167", "0.5368658", "0.5357673", "0.53470755", "0.53446364", "0.5341465", "0.53367615", "0.5328013", "0.5328013", "0.53252393", "0.53247774", "0.5321225", "0.53104407", "0.5304649", "0.53041357", "0.52911603", "0.5287635", "0.5286788", "0.5282038", "0.5277337", "0.52715766", "0.5268321", "0.52655405", "0.5257775", "0.52545995", "0.52500427", "0.5245526", "0.52422005", "0.5241726", "0.5234254", "0.52322483", "0.5231118", "0.52288294", "0.52277774", "0.52274454", "0.5227025", "0.5225286", "0.52219456", "0.5203189", "0.5196121", "0.51956385", "0.5192009", "0.5190678", "0.51858026", "0.51824135", "0.51787484", "0.5176326", "0.51724625", "0.5171098", "0.5162799", "0.51617485", "0.51602185", "0.5153456", "0.51513726", "0.5146595" ]
0.6562875
2
const c0 = new Circle(1); console.log(c0.diameter); console.log(c0.getC()); console.log(c0.getA()); Create a function that converts color in RGB format to Hex format.
function rgbToHex(str) { colour = []; str.replace(/[a-z())]+/g, '') .split(',') .map(val => { let value = Number(val).toString(16); value = value < 2 ? `0${value}` : value; colour.push(value); }); return '#' + colour.join(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toHexColor() {\n const R = this.R.toHex().valueOf();\n const G = this.G.toHex().valueOf();\n const B = this.B.toHex().valueOf();\n return new HexColor(`#${R}${G}${B}`);\n }", "toHexColor() {\n const R = this.R.toHex().valueOf();\n const G = this.G.toHex().valueOf();\n const B = this.B.toHex().valueOf();\n return new HexColor(`#${R}${G}${B}`);\n }", "getHexColorValue() {\n let hexRepresentation = _.map(_.slice(this.props.value, 0, 3), (val)=>{\n let hexVal = val.toString(16);\n return hexVal.length === 1 ? '0' + hexVal : hexVal;\n }).join('');\n return '#' + hexRepresentation;\n }", "function Color() {}", "function Legato_Structure_Color()\r\n{\r\n\r\n\t// What type of argument was passed in?\r\n\tif ( arguments.length == 1 && (typeof arguments[0] == \"string\" || arguments[0] instanceof String) )\r\n\t{\r\n\r\n\t\tthis.R = parseInt( arguments[0].substring( 0, 2 ), 16 );\r\n\t\tthis.G = parseInt( arguments[0].substring( 2, 4 ), 16 );\r\n\t\tthis.B = parseInt( arguments[0].substring( 4, 6 ), 16 );\r\n\r\n\t} // End if hex string.\r\n\telse if ( arguments.length == 3 )\r\n\t{\r\n\r\n\t\tthis.R = arguments[0];\r\n\t\tthis.G = arguments[1];\r\n\t\tthis.B = arguments[2];\r\n\r\n\t} // End if numbers passed in.\r\n\telse\r\n\t{\r\n\r\n\t\tthis.R = null;\r\n\t\tthis.G = null;\r\n\t\tthis.B = null;\r\n\r\n\t} // End if null passed in.\r\n\r\n}", "function toHex(color, delta) {\r\n function computeValue(value, delta) {\r\n\tvar computedValue = !isNaN(delta) ? value + delta : value;\r\n\tif (computedValue < 0) {\r\n\t computedValue = 0;\r\n\t} else if (computedValue > 255) {\r\n\t computedValue = 255;\r\n\t}\r\n\r\n\tcomputedValue = computedValue.toString(16);\r\n\treturn computedValue.length == 1 ? \"0\" + computedValue : computedValue;\r\n }\r\n\r\n var hex = \"\";\r\n if (color) {\r\n\twith (color) {\r\n\t hex = computeValue(red, delta) + computeValue(green, delta)\r\n\t\t + computeValue(blue, delta);\r\n\t}\r\n\t;\r\n }\r\n return \"#\" + hex;\r\n}", "function generateHex(){\n \n //Chroma library used here to use its random function of the chroma class \n const ranColor = chroma.random();\n\n return ranColor;\n}", "function makeColor(r, g, b) {\n const color = {};\n color.r = r;\n color.g = g;\n color.b = b;\n color.rgb = function() {\n console.log(this)\n // return `rbg(${this.r}, ${this.g}, ${this.b})`\n //DESTRUCT FROM `THIS`//////////////////////////\n const { r, g, b } = this;\n // then return\n return `rgb(${r}, ${g}, ${b})`\n };\n color.hex = function() {\n const { r, g, b } = this;\n return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); \n }\n return color\n}", "function rgb(r, g, b) {\n \n}", "function Color(input)\n{\n\tif (!(this instanceof Color))\n\t\treturn new Color(input);\n\n\tthis.r = 0;\n\tthis.g = 0;\n\tthis.b = 0;\n\tthis.a = 255;\n\n\twhile (true)\n\t{\n\t\tif (typeof input === \"object\")\n\t\t{\n\t\t\tif (input == null)\n\t\t\t{\n\t\t\t\tthis.r = validInt(this.r, false);\n\t\t\t\tthis.g = validInt(this.g, false);\n\t\t\t\tthis.b = validInt(this.b, false);\n\t\t\t\tthis.a = validInt(this.a, true);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (input instanceof Array)\n\t\t\t{\n\t\t\t\tthis.r = input[0];\n\t\t\t\tthis.g = input[1];\n\t\t\t\tthis.b = input[2];\n\t\t\t\tthis.a = input[3];\n\t\t\t}\n\t\t\telse if (input instanceof HSLColor)\n\t\t\t{\n\t\t\t\tvar rgb = hslToRgb(input.h, input.s, input.l);\n\t\t\t\tthis.r = rgb[0];\n\t\t\t\tthis.g = rgb[1];\n\t\t\t\tthis.b = rgb[2];\n\t\t\t\tthis.a = input.a;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.r = input.r || input.red || input.rouge || input[\"0\"] || 0;\n\t\t\t\tthis.g = input.g || input.green || input.v || input.vert || input[\"1\"] || 0;\n\t\t\t\tthis.b = input.b || input.blue || input.bleu || input[\"2\"] || 0;\n\t\t\t\tthis.a = input.a || input.alpha || input.transparency || input[\"3\"] || 255;\n\t\t\t}\n\t\t}\n\t\telse if (typeof input === \"number\")\n\t\t{\n\t\t\tthis.a = input >> 24 & 255;\n\t\t\tthis.r = input >> 16 & 255;\n\t\t\tthis.g = input >> 8 & 255;\n\t\t\tthis.b = input & 255;\n\t\t}\n\t\telse if (typeof input === \"string\")\n\t\t{\n\t\t\tinput = input.trim();\n\t\t\tif (input.indexOf(\"0x\") === 0)\n\t\t\t{\n\t\t\t\tinput = parseInt(input);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (input.indexOf(\"#\") === 0)\n\t\t\t{\n\t\t\t\tvar len = (input.length === 4)? 1 : 2;\n\t\t\t\tthis.r = getHexAt(input, 0, len);\n\t\t\t\tthis.g = getHexAt(input, len, len);\n\t\t\t\tthis.b = getHexAt(input, len + len, len);\n\t\t\t\tthis.a = getHexAt(input, len + len + len, len);\n\t\t\t}\n\t\t\telse if (input.indexOf(\"rgb\") === 0)\n\t\t\t{\n\t\t\t\tinput = input.match(/[0-9\\.]+/g);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (input.indexOf(\"argb\") === 0)\n\t\t\t{\n\t\t\t\tvar match = input.match(/[0-9\\.]+/g);\n\t\t\t\tthis.a = match[0];\n\t\t\t\tthis.r = match[1];\n\t\t\t\tthis.g = match[2];\n\t\t\t\tthis.b = match[3];\n\t\t\t}\n\t\t\telse if (input.indexOf(\"hsl\") === 0)\n\t\t\t{\n\t\t\t\tvar match = input.match(/[0-9\\.]+/g);\n\t\t\t\tvar rgb = hslToRgb(validInt(match[0]), validInt(match[1]), validInt(match[2]));\n\t\t\t\tthis.r = rgb[0];\n\t\t\t\tthis.g = rgb[1];\n\t\t\t\tthis.b = rgb[2];\n\t\t\t\tthis.a = match[3];\n\t\t\t}\n\t\t}\n\t\tinput = null;\n\t}\n}", "asRGB(ao) {\r\n return \"rgba(\" + this.r + \",\" + this.g + \",\" + this.b + \",\" + ((ao == undefined) ? this.a : ao) + \")\";\r\n }", "function toHex(color, delta) {\r\n function computeValue(value, delta) {\r\n var computedValue = !isNaN(delta) ? value + delta : value;\r\n if (computedValue < 0) {\r\n computedValue = 0;\r\n } else if (computedValue > 255) {\r\n computedValue = 255;\r\n }\r\n\r\n computedValue = computedValue.toString(16);\r\n return computedValue.length == 1 ? \"0\" + computedValue : computedValue;\r\n }\r\n\r\n var hex = \"\";\r\n if (color) {\r\n with (color) {\r\n hex = computeValue(red, delta) + computeValue(green, delta) + computeValue(blue, delta);\r\n };\r\n }\r\n return \"#\" + hex;\r\n}", "function RGBtoHEX() {\n let Red = parseInt(document.querySelector(\"#rangeRed\").value).toString(16);\n let Green = parseInt(document.querySelector(\"#rangeGreen\").value).toString(\n 16\n );\n let Blue = parseInt(document.querySelector(\"#rangeBlue\").value).toString(16);\n Red = Red.padStart(2, 0);\n Green = Green.padStart(2, 0);\n Blue = Blue.padStart(2, 0);\n console.log(308, Red, Green, Blue);\n document.querySelector(\"#HEXvalue3\").innerHTML = `HEX Value: <span>#${\n Red + Green + Blue\n }</span>`;\n}", "constructor(...args) {\n this.r = 0;\n this.g = 0;\n this.b = 0;\n this.a = 255;\n /* Handle Color([...]) -> Color(...) */\n if (args.length == 1 && args[0] instanceof Array) {\n args = args[0];\n }\n if (args.length == 1) {\n /* Handle Color(Color) and Color(\"string\") */\n let arg = args[0];\n if (arg instanceof Color) {\n [this.r, this.g, this.b, this.a] = [arg.r, arg.g, arg.b, arg.a];\n this.scale = arg.scale;\n } else if (typeof(arg) == \"string\" || arg instanceof String) {\n let [r, g, b, a] = ColorParser.parse(arg);\n [this.r, this.g, this.b, this.a] = [r, g, b, a];\n } else {\n throw new TypeError(`Invalid argument \"${arg}\" to Color()`);\n }\n } else if (args.length >= 3 && args.length <= 4) {\n /* Handle Color(r, g, b) and Color(r, g, b, a) */\n [this.r, this.g, this.b] = args;\n if (args.length == 4) this.a = args[3];\n } else if (args.length > 0) {\n throw new TypeError(`Invalid arguments \"${args}\" to Color()`);\n }\n }", "getCreativeColor(hex, rgb) {\n this.setState({\n hexColor: hex.toString(),\n rgbColor: rgb.toString(),\n })\n }", "function Color() { }", "function circleColour(){\n return(\"gray\");\n \n}", "function Color(input){_classCallCheck(this,Color),input instanceof Color?(this.r=input.r,this.g=input.g,this.b=input.b,this.a=input.a):input?this.parse(input):(this.r=this.g=this.b=0,this.a=1)}// ## Parse ##", "function Colour(){\n\n /* Returns an object representing the RGBA components of this Colour. The red,\n * green, and blue components are converted to integers in the range [0,255].\n * The alpha is a value in the range [0,1].\n */\n this.getIntegerRGB = function(){\n\n // get the RGB components of this colour\n var rgb = this.getRGB();\n\n // return the integer components\n return {\n 'r' : Math.round(rgb.r),\n 'g' : Math.round(rgb.g),\n 'b' : Math.round(rgb.b),\n 'a' : rgb.a\n };\n\n };\n\n /* Returns an object representing the RGBA components of this Colour. The red,\n * green, and blue components are converted to numbers in the range [0,100].\n * The alpha is a value in the range [0,1].\n */\n this.getPercentageRGB = function(){\n\n // get the RGB components of this colour\n var rgb = this.getRGB();\n\n // return the percentage components\n return {\n 'r' : 100 * rgb.r / 255,\n 'g' : 100 * rgb.g / 255,\n 'b' : 100 * rgb.b / 255,\n 'a' : rgb.a\n };\n\n };\n\n /* Returns a string representing this Colour as a CSS hexadecimal RGB colour\n * value - that is, a string of the form #RRGGBB where each of RR, GG, and BB\n * are two-digit hexadecimal numbers.\n */\n this.getCSSHexadecimalRGB = function(){\n\n // get the integer RGB components\n var rgb = this.getIntegerRGB();\n\n // determine the hexadecimal equivalents\n var r16 = rgb.r.toString(16);\n var g16 = rgb.g.toString(16);\n var b16 = rgb.b.toString(16);\n\n // return the CSS RGB colour value\n return '#'\n + (r16.length == 2 ? r16 : '0' + r16)\n + (g16.length == 2 ? g16 : '0' + g16)\n + (b16.length == 2 ? b16 : '0' + b16);\n\n };\n\n /* Returns a string representing this Colour as a CSS integer RGB colour\n * value - that is, a string of the form rgb(r,g,b) where each of r, g, and b\n * are integers in the range [0,255].\n */\n this.getCSSIntegerRGB = function(){\n\n // get the integer RGB components\n var rgb = this.getIntegerRGB();\n\n // return the CSS RGB colour value\n return 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')';\n\n };\n\n /* Returns a string representing this Colour as a CSS integer RGBA colour\n * value - that is, a string of the form rgba(r,g,b,a) where each of r, g, and\n * b are integers in the range [0,255] and a is in the range [0,1].\n */\n this.getCSSIntegerRGBA = function(){\n\n // get the integer RGB components\n var rgb = this.getIntegerRGB();\n\n // return the CSS integer RGBA colour value\n return 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + rgb.a + ')';\n\n };\n\n /* Returns a string representing this Colour as a CSS percentage RGB colour\n * value - that is, a string of the form rgb(r%,g%,b%) where each of r, g, and\n * b are in the range [0,100].\n */\n this.getCSSPercentageRGB = function(){\n\n // get the percentage RGB components\n var rgb = this.getPercentageRGB();\n\n // return the CSS RGB colour value\n return 'rgb(' + rgb.r + '%,' + rgb.g + '%,' + rgb.b + '%)';\n\n };\n\n /* Returns a string representing this Colour as a CSS percentage RGBA colour\n * value - that is, a string of the form rgba(r%,g%,b%,a) where each of r, g,\n * and b are in the range [0,100] and a is in the range [0,1].\n */\n this.getCSSPercentageRGBA = function(){\n\n // get the percentage RGB components\n var rgb = this.getPercentageRGB();\n\n // return the CSS percentage RGBA colour value\n return 'rgb(' + rgb.r + '%,' + rgb.g + '%,' + rgb.b + '%,' + rgb.a + ')';\n\n };\n\n /* Returns a string representing this Colour as a CSS HSL colour value - that\n * is, a string of the form hsl(h,s%,l%) where h is in the range [0,100] and\n * s and l are in the range [0,100].\n */\n this.getCSSHSL = function(){\n\n // get the HSL components\n var hsl = this.getHSL();\n\n // return the CSS HSL colour value\n return 'hsl(' + hsl.h + ',' + hsl.s + '%,' + hsl.l + '%)';\n\n };\n\n /* Returns a string representing this Colour as a CSS HSLA colour value - that\n * is, a string of the form hsla(h,s%,l%,a) where h is in the range [0,100],\n * s and l are in the range [0,100], and a is in the range [0,1].\n */\n this.getCSSHSLA = function(){\n\n // get the HSL components\n var hsl = this.getHSL();\n\n // return the CSS HSL colour value\n return 'hsl(' + hsl.h + ',' + hsl.s + '%,' + hsl.l + '%,' + hsl.a + ')';\n\n };\n\n /* Sets the colour of the specified node to this Colour. This functions sets\n * the CSS 'color' property for the node. The parameter is:\n *\n * node - the node whose colour should be set\n */\n this.setNodeColour = function(node){\n\n // set the colour of the node\n node.style.color = this.getCSSHexadecimalRGB();\n\n };\n\n /* Sets the background colour of the specified node to this Colour. This\n * functions sets the CSS 'background-color' property for the node. The\n * parameter is:\n *\n * node - the node whose background colour should be set\n */\n this.setNodeBackgroundColour = function(node){\n\n // set the background colour of the node\n node.style.backgroundColor = this.getCSSHexadecimalRGB();\n\n };\n\n}", "get rgb_1() {\n let c = new Color(this.r, this.g, this.b);\n return [c.r / 255, c.g / 255, c.b / 255];\n }", "function toHex(_ref2) {\n var r = _ref2.r,\n g = _ref2.g,\n b = _ref2.b;\n return \"#\".concat(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__ctrl_tinycolor__[\"rgbToHex\"])(r, g, b, false));\n} // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.", "function toHex(d) {\n let r = djb2('red' + d)\n let g = djb2('green' + d)\n let b = djb2('blue' + d)\n\n let red = Math.abs((r + 85) % 240) + 30\n let green = Math.abs((g + 170) % 240) + 30\n let blue = Math.abs(b % 240) + 30\n\n red = red < 255 ? red : 255\n green = green < 255 ? green : 255\n blue = blue < 255 ? blue : 255\n\n return (\n ('0' + Number(red).toString(16)).slice(-2) +\n ('0' + Number(green).toString(16)).slice(-2) +\n ('0' + Number(blue).toString(16)).slice(-2)\n )\n}", "function getHex(r, g, b){\n \treturn '#'+intToHex(r)+intToHex(g)+intToHex(b);\n}", "function makeColor(r, g, b) {\n\tconst color = {}; //This function creates an object which takes keys from function arguments\n\tcolor.r = r;\n\tcolor.g = g;\n\tcolor.b = b;\n\tcolor.rgb = function() { //Then we add function to THIS object\n\t\tconst { r, g, b } = this;\n\t\treturn `rgb(${r}, ${g}, ${b})`;\n };\n color.hex = function() { //And another function also to THIS object\n const { r, g, b } = this;\n return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\n }\n\treturn color; //At the end we just return object\n}", "function RGB2Color(r,g,b)\n\t {\treturn '#' + byte2Hex(r) + byte2Hex(g) + byte2Hex(b); }", "function rgb2Hex(r, g, b) \n{\n var colourHex = \"\";\n var hexArray = new Array( \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\" );\n var code1 = Math.floor(r*16);\n var code2 = Math.floor(r*256) - code1*16;\n colourHex += hexArray[code1];\n colourHex += hexArray[code2];\n var code1 = Math.floor(g*16);\n var code2 = Math.floor(g*256) - code1*16;\n colourHex += hexArray[code1];\n colourHex += hexArray[code2];\n var code1 = Math.floor(b*16);\n var code2 = Math.floor(b*256) - code1*16;\n colourHex += hexArray[code1];\n colourHex += hexArray[code2];\n return colourHex;\n}", "function rgbToHex(R,G,B) { return toHex(R)+toHex(G)+toHex(B); }", "constructor(\n /**\n * Defines the red component (between 0 and 1, default is 0)\n */\n r = 0, \n /**\n * Defines the green component (between 0 and 1, default is 0)\n */\n g = 0, \n /**\n * Defines the blue component (between 0 and 1, default is 0)\n */\n b = 0, \n /**\n * Defines the alpha component (between 0 and 1, default is 1)\n */\n a = 1) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n }", "function toHex(_ref2) {\n var r = _ref2.r,\n g = _ref2.g,\n b = _ref2.b;\n return \"#\".concat((0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__/* .rgbToHex */ .vq)(r, g, b, false));\n} // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.", "function Colour(c,n){\n\t\tif(!c) return {};\n\n\t\tfunction d2h(d) { return ((d < 16) ? \"0\" : \"\")+d.toString(16);}\n\t\tfunction h2d(h) {return parseInt(h,16);}\n\t\t/**\n\t\t * Converts an RGB color value to HSV. Conversion formula\n\t\t * adapted from http://en.wikipedia.org/wiki/HSV_color_space.\n\t\t * Assumes r, g, and b are contained in the set [0, 255] and\n\t\t * returns h, s, and v in the set [0, 1].\n\t\t *\n\t\t * @param\tNumber r\t\t The red color value\n\t\t * @param\tNumber g\t\t The green color value\n\t\t * @param\tNumber b\t\t The blue color value\n\t\t * @return Array\t\t\t The HSV representation\n\t\t */\n\t\tfunction rgb2hsv(r, g, b){\n\t\t\tr = r/255;\n\t\t\tg = g/255;\n\t\t\tb = b/255;\n\t\t\tvar max = Math.max(r, g, b), min = Math.min(r, g, b);\n\t\t\tvar h, s, v = max;\n\t\t\tvar d = max - min;\n\t\t\ts = max == 0 ? 0 : d / max;\n\t\t\tif(max == min) h = 0; // achromatic\n\t\t\telse{\n\t\t\t\tswitch(max){\n\t\t\t\t\tcase r: h = (g - b) / d + (g < b ? 6 : 0); break;\n\t\t\t\t\tcase g: h = (b - r) / d + 2; break;\n\t\t\t\t\tcase b: h = (r - g) / d + 4; break;\n\t\t\t\t}\n\t\t\t\th /= 6;\n\t\t\t}\n\t\t\treturn [h, s, v];\n\t\t}\n\n\t\tthis.alpha = 1;\n\n\t\t// Let's deal with a variety of input\n\t\tif(c.indexOf('#')==0){\n\t\t\tthis.hex = c;\n\t\t\tthis.rgb = [h2d(c.substring(1,3)),h2d(c.substring(3,5)),h2d(c.substring(5,7))];\n\t\t}else if(c.indexOf('rgb')==0){\n\t\t\tvar bits = c.match(/[0-9\\.]+/g);\n\t\t\tif(bits.length == 4) this.alpha = parseFloat(bits[3]);\n\t\t\tthis.rgb = [parseInt(bits[0]),parseInt(bits[1]),parseInt(bits[2])];\n\t\t\tthis.hex = \"#\"+d2h(this.rgb[0])+d2h(this.rgb[1])+d2h(this.rgb[2]);\n\t\t}else return {};\n\t\tthis.hsv = rgb2hsv(this.rgb[0],this.rgb[1],this.rgb[2]);\n\t\tthis.name = (n || \"Name\");\n\t\tvar r,sat;\n\t\tfor(r = 0, sat = 0; r < this.rgb.length ; r++){\n\t\t\tif(this.rgb[r] > 200) sat++;\n\t\t}\n\t\tthis.text = (this.rgb[0] + this.rgb[1] + this.rgb[2] > 500 || sat > 1) ? \"black\" : \"white\";\n\t\treturn this;\n\t}", "function castColor(value) {\n return color(value);\n}", "function RGBAToHex({ red, green, blue, alpha }) {\n const r = red.toString(16).padStart(2, \"0\");\n const g = green.toString(16).padStart(2, \"0\");\n const b = blue.toString(16).padStart(2, \"0\");\n const a = alpha.toString(16).padStart(2, \"0\");\n return `#${r}${g}${b}${a === \"ff\" ? \"\" : a}`;\n}", "function toHex(_ref2) {\n var r = _ref2.r,\n g = _ref2.g,\n b = _ref2.b;\n return \"#\".concat((0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__.rgbToHex)(r, g, b, false));\n} // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.", "function toHex(_ref2) {\n var r = _ref2.r,\n g = _ref2.g,\n b = _ref2.b;\n return \"#\".concat((0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__.rgbToHex)(r, g, b, false));\n} // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.", "function toHex(_ref2) {\n var r = _ref2.r,\n g = _ref2.g,\n b = _ref2.b;\n return \"#\".concat((0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__.rgbToHex)(r, g, b, false));\n} // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.", "function hexToColor(value) {\n\t if (value.slice(0, 1) === '#') {\n\t value = value.slice(1);\n\t }\n\t if (!/^[\\da-f]+$/i.test(value)) {\n\t return null;\n\t }\n\t let alphaStr = '';\n\t let redStr, greenStr, blueStr;\n\t let start = 0;\n\t switch (value.length) {\n\t case 4:\n\t alphaStr = value.slice(-1);\n\t alphaStr += alphaStr;\n\t // eslint-disable-next-line no-fallthrough\n\t case 3:\n\t redStr = value.slice(start, ++start);\n\t redStr += redStr;\n\t greenStr = value.slice(start, ++start);\n\t greenStr += greenStr;\n\t blueStr = value.slice(start, ++start);\n\t blueStr += blueStr;\n\t break;\n\t case 8:\n\t alphaStr = value.slice(-2);\n\t // eslint-disable-next-line no-fallthrough\n\t case 6:\n\t redStr = value.slice(start++, ++start);\n\t greenStr = value.slice(start++, ++start);\n\t blueStr = value.slice(start++, ++start);\n\t break;\n\t default:\n\t return null;\n\t }\n\t return {\n\t r: parseInt(redStr, 16),\n\t g: parseInt(greenStr, 16),\n\t b: parseInt(blueStr, 16),\n\t a: alphaStr === '' ? 1 : parseInt(alphaStr, 16) / 255,\n\t };\n\t}", "toColorLAB(){\n const rgb = [this.r, this.g, this.b].map((c) => {\n let color = c / 255;\n color = color > 0.04045 ? ((color + 0.055) / 1.055) ** 2.4 : color / 12.92;\n return color * 100;\n });\n const [xyzR,xyzG,xyzB] = rgb;\n const x = (xyzR * 0.4124 + xyzG * 0.3576 + xyzB * 0.1805) * 0.95047;\n const y = (xyzR * 0.2126 + xyzG * 0.7152 + xyzB * 0.0722) * 1;\n const z = (xyzR * 0.0193 + xyzG * 0.1192 + xyzB * 0.9505) * 1.08883;\n \n const labxyz = [x,y,z].map((c)=>{\n let color = c/100;\n return color > 0.008856 ? color ** (1/3) : (color * 7.787) + (16 /116);\n });\n \n const [labX, labY, labZ] = labxyz;\n const l = (labY * 116) - 16;\n const a = (labX - labY) * 500;\n const b = (labY - labZ) * 200;\n \n return new ColorLAB(l,a,b);\n }", "function RGB2Color(r, g, b) {\r\n return '#' + byte2Hex(r) + byte2Hex(g) + byte2Hex(b);\r\n}", "function hexToColor(hex) {\n\thex = hex.replace(\"#\", \"\");\n\t//console.log(hex + \" : \" + hex.length);\n\tvar vals = [];\n\tif (hex.length == 3) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,1)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(1,2)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,3)) / 15 );\n\t\tvals.push(1);\n\t}\n\tif (hex.length == 4) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,1)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(1,2)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,3)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(3,4)) / 15 );\n\t}\n\tif (hex.length == 6) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,2)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,4)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(4,6)) / 255 );\n\t\tvals.push(1);\n\t}\n\tif (hex.length == 8) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,2)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,4)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(4,6)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(6,8)) / 255 );\n\t}\n\treturn vals;\n}", "function hexToColor(hex) {\n\thex = hex.replace(\"#\", \"\");\n\t//console.log(hex + \" : \" + hex.length);\n\tvar vals = [];\n\tif (hex.length == 3) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,1)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(1,2)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,3)) / 15 );\n\t\tvals.push(1);\n\t}\n\tif (hex.length == 4) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,1)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(1,2)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,3)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(3,4)) / 15 );\n\t}\n\tif (hex.length == 6) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,2)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,4)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(4,6)) / 255 );\n\t\tvals.push(1);\n\t}\n\tif (hex.length == 8) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,2)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,4)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(4,6)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(6,8)) / 255 );\n\t}\n\treturn vals;\n}", "get ETC_RGB4() {}", "toRgb() {\n return {\n r: Math.round(this.r),\n g: Math.round(this.g),\n b: Math.round(this.b),\n a: this.a,\n };\n }", "getColor(){\n\t\tvar r, g, b, a;\n\t\tvar hex = this.valueOf('color'); // always gets a hex string (ex., #rrggbb)\n\t\ta = this.valueOf('opacity');\n\t\tr = parseInt(hex.substring(1,3), 16);\n\t\tg = parseInt(hex.substring(3,5), 16);\n\t\tb = parseInt(hex.substring(5,7), 16);\n\t\treturn 'rgba('+r+','+g+','+b+','+a+')';\n\t}", "color(value) {\n\n //Check if it's a number\n if(!isNaN(value)){\n\n //Yes, it is a number, so just return it\n return value;\n }\n\n //No it's not a number, so it must be a string \n else {\n\n return parseInt(this.colorToHex(value));\n /*\n\n //Find out what kind of color string it is.\n //Let's first grab the first character of the string\n let firstCharacter = value.charAt(0);\n\n //If the first character is a \"#\" or a number, then\n //we know it must be a RGBA color\n if (firstCharacter === \"#\") {\n console.log(\"first character: \" + value.charAt(0))\n }\n */\n }\n \n /*\n //Find out if the first character in the string is a number\n if (!isNaN(parseInt(string.charAt(0)))) {\n \n //It's not, so convert it to a hex code\n return colorToHex(string);\n \n //The use input a number, so it must be a hex code. Just return it\n } else {\n \n return string;\n }\n \n */\n\n }", "get colorValue() {}", "function Color(r, g, b) {\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n /*\r\n this.rgb = function () {\r\n const { r, g, b } = this;\r\n return `rgb(${r}, ${g}, ${b})`;\r\n }; // gets added to object not prototype\r\n */\r\n}", "function circleColor(magnitude){\r\n if (magnitude < 1) {\r\n return \"#bdff20\"\r\n }\r\n else if (magnitude < 2) {\r\n return \"#fff941\"\r\n }\r\n else if (magnitude < 3) {\r\n return \"#ffc039\"\r\n }\r\n else if (magnitude < 4) {\r\n return \"#ff863c\"\r\n }\r\n else if (magnitude < 5) {\r\n return \"#ff6835\"\r\n }\r\n else {\r\n return \"#ff1e20\"\r\n }\r\n}", "getColor() {\n var i = (this.speed * 255) / 255;\n var r = Math.round(Math.sin(0.024 * i + 0) * 127 + 128);\n var g = Math.round(Math.sin(0.024 * i + 2) * 127 + 128);\n var b = Math.round(Math.sin(0.024 * i + 4) * 127 + 128);\n var rgb = \"rgb(\" + r + \",\" + g + \",\" + b + \")\";\n\n return rgb;\n }", "function Colour(rgb) {\n this.rgb = rgb;\n}", "toHexString() {\n const intR = (this.r * 255) || 0;\n const intG = (this.g * 255) || 0;\n const intB = (this.b * 255) || 0;\n const intA = (this.a * 255) || 0;\n return \"#\" + _1.Scalar.ToHex(intR) + _1.Scalar.ToHex(intG) + _1.Scalar.ToHex(intB) + _1.Scalar.ToHex(intA);\n }", "function RGBConstructor(rgb)\n{\n this.rgb = rgb;\n}", "rgbToHex(r, g, b) {\n return (\"#\" +\n this.componentToHex(r) +\n this.componentToHex(g) +\n this.componentToHex(b));\n }", "function circleColor(magnitude) {\n if (magnitude < 1) {\n return \"#68FF33\"\n }\n else if (magnitude < 2) {\n return \"#CEFF33\"\n }\n else if (magnitude < 3) {\n return \"#FFF633\"\n }\n else if (magnitude < 4) {\n return \"#FFBB33\"\n }\n else if (magnitude < 5) {\n return \"#FF8633\"\n }\n else {\n return \"#FF4933\"\n }\n}", "function getHexColor(color) { \r\n\t\treturn getHexValue(color.r) + getHexValue(color.g) + getHexValue(color.b);\r\n\t}", "function RGB(r, g, b) {\n this.r = r;\n this.g = g;\n this.b = b;\n\n this.parse = function(s) {\n this.r = parseInt(s.substr(1, 2), 16);\n this.g = parseInt(s.substr(3, 2), 16);\n this.b = parseInt(s.substr(5, 2), 16);\n };\n\n this.toString = function() {\n var s = [];\n var c;\n\n s.push(\"#\");\n c = this.r.toString(16);\n s.push(c.length == 2 ? c : \"0\" + c);\n c = this.g.toString(16);\n s.push(c.length == 2 ? c : \"0\" + c);\n c = this.b.toString(16);\n s.push(c.length == 2 ? c : \"0\" + c);\n return s.join(\"\");\n };\n}", "function GetHexColour($Rgb)\n{\n\tvar $Length = 6\n\treturn ('000000000' + $Rgb.toString(16) ).substr(-$Length);\n}", "function rgb2Hex(r, g, b){\n return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1, 7);\n}", "function convertHex(hex,opacity){ \n hex = hex.replace('#','');\n rgbColor={\n 'red' : parseInt(hex.substring(0,2), 16)-255,\n 'green' : parseInt(hex.substring(2,4), 16)-255,\n 'blue' : parseInt(hex.substring(4,6), 16)-255,\n 'a' : opacity/100\n }\n return rgbColor;\n}", "function color(grey){\n return {r:grey, g:grey, b:grey};\n}", "get color() {}", "get color() {\n\n\t}", "function getRGB() {\n var rr = color.slice(1, 3);\n var gg = color.slice(3, 5);\n var bb = color.slice(3, 7);\n var r10 = parseInt(rr, 16);\n // Ponemos rr, 16 en el parseInt para que sepa que se trata de un hexadecimal y no de un entero normal. Sino, si pusiéramos letras no me lo cogería\n var g10 = parseInt(gg, 16);\n var b10 = parseInt(bb, 16);\n return 'rgb(' + r10 + ', ' + g10 + ', ' + b10 + ')';\n}", "function displayHex() {\n document.getElementById('hex').textContent = fullColorHex(r, g, b);\n}", "function convertColorComponent(input) {\n var result = input.toString(16);\n if (result.length < 2) {\n result = '0' + result;\n }\n return result;\n}", "function Circle(x,y,r, color) { //circle object\r\n this.x = x;\r\n this.y = y;\r\n this.r = r;\r\n this.color = color;\r\n}", "function Color(r, g, b, a) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a != null ? a : 1;\n }", "function red(hexColor) {\r\n return rgbValues(hexColor)[0];\r\n}", "function getHex(r, g, b) {\n return '#' + intToHex(r) + intToHex(g) + intToHex(b);\n}", "function toHex(c) {\n var m = c.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);\n // short skirt to long jacket\n return (m ? rgb(m[1], m[2], m[3]) : c).replace(/#(\\w)(\\w)(\\w)$/, '#$1$1$2$2$3$3');\n }", "function rgb2hex(r, g, b) {\n return '#' \n + ('0' + r.toString(16)).slice(-2)\n + ('0' + g.toString(16)).slice(-2)\n + ('0' + b.toString(16)).slice(-2); \n}", "ratioColor(fromColor, toColor, ratio) {\n // Turn string hashcode into triplet of base 10 values\n let coordify10 = function(hexCode) {\n // Strip pound sign\n if (hexCode.charAt(0) === '#') hexCode = hexCode.substring(1);\n\n return [\n parseInt(hexCode.substring(0, 2), 16),\n parseInt(hexCode.substring(2, 4), 16),\n parseInt(hexCode.substring(4, 6), 16)\n ];\n }\n\n // Turn coordinates back into hex code\n let hexify = function(coordinates) {\n return _.reduce(coordinates, (hexCode, coordinate) => {\n let code = coordinate.toString(16)\n if (code.length < 2) code = '0' + code;\n return hexCode + code;\n }, '#')\n }\n\n let ri = function(from, to, ratio) {\n return Math.round(((to - from) * ratio) + from)\n }\n\n let hexFrom = coordify10(fromColor);\n let hexTo = coordify10(toColor);\n\n let red = ri(hexFrom[0], hexTo[0], ratio)\n let green = ri(hexFrom[1], hexTo[1], ratio)\n let blue = ri(hexFrom[2], hexTo[2], ratio)\n\n return hexify([red, green, blue])\n }", "function RGBtoHex(r, g, b) {\n\t\treturn \"#\" + unitConversion(r) + unitConversion(g) + unitConversion(b);\n\t\t}", "function colorValue() {\n return randomHex() + randomHex();\n}", "function Color() {\n\n\t\t\t// Hexadecimal color\n\t\t\tif (arguments.length == 1 && typeof arguments[0] === \"string\") {\n\t\t\t\tthis.hex = arguments[0];\n\t\t\t}\n\n\t\t\t// rgb(a) color\n\t\t\t/*if (arguments.length == 3 || arguments.length == 4) {\n\n\t\t\t}*/\n\t\t}", "function colorRGB(){\n var coolor = \"(\"+generarNumero(255)+\",\" + generarNumero(255) + \",\" + generarNumero(255) +\")\";\n return \"rgb\" + coolor;\n }", "function rgb2hex(rgb){if(/^#[0-9A-F]{6}$/i.test(rgb))return rgb;rgb=rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);function hex(x){return(\"0\"+parseInt(x).toString(16)).slice(-2);}return\"#\"+hex(rgb[1])+hex(rgb[2])+hex(rgb[3]);}// Return it", "function displayHexNumber(){\n let hexColor = '';\n hexColor = convertNumber(red.value) + convertNumber(green.value) + convertNumber(blue.value);\n hex.value = hexColor;\n convertColor.style.backgroundColor = `#${hexColor}`\n}", "function rgbc(a,b,c) {\n return 'rgb(' + a + ',' + b + ',' + c + ')';\n}", "function toHex(_ref2) {\n var r = _ref2.r,\n g = _ref2.g,\n b = _ref2.b;\n return \"#\".concat((0,conversion/* rgbToHex */.vq)(r, g, b, false));\n} // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.", "function hexToRgb(value) {\n // deprecated, use d3.color()\n return Object(d3_color__WEBPACK_IMPORTED_MODULE_15__[\"rgb\"])(value);\n}", "function hexToRgb(value) {\n // deprecated, use d3.color()\n return Object(d3_color__WEBPACK_IMPORTED_MODULE_15__[\"rgb\"])(value);\n}", "constructor() {\n this.red = null;\n this.green = null;\n this.blue = null;\n this.x = null;\n this.y = null;\n this.brightness = null;\n this.hue = null;\n this.saturation = null;\n this.temperature = null;\n this.originalColor = null;\n }", "function Hex(q,r) { //stores a hex unit\n this.q = q;\n this.r = r;\n}", "get rgb() { return [this.r, this.g, this.b]; }", "get ASTC_RGB_10x10() {}", "function Color4(r,g,b,a){this.r=r;this.g=g;this.b=b;this.a=a;}// Operators", "function Color(r, g, b) {\n this.r = r;\n this.g = g;\n this.b = b;\n}", "function RGBColor(color_string)\n{\n this.ok = false;\n\n // strip any leading #\n if (color_string.charAt(0) == '#') { // remove # if any\n color_string = color_string.substr(1,6);\n }\n\n color_string = color_string.replace(/ /g,'');\n color_string = color_string.toLowerCase();\n\n // array of color definition objects\n var color_defs = [\n {\n re: /^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/,\n example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],\n process: function (bits){\n return [\n parseInt(bits[1]),\n parseInt(bits[2]),\n parseInt(bits[3])\n ];\n }\n },\n {\n re: /^(\\w{2})(\\w{2})(\\w{2})$/,\n example: ['#00ff00', '336699'],\n process: function (bits){\n return [\n parseInt(bits[1], 16),\n parseInt(bits[2], 16),\n parseInt(bits[3], 16)\n ];\n }\n },\n {\n re: /^(\\w{1})(\\w{1})(\\w{1})$/,\n example: ['#fb0', 'f0f'],\n process: function (bits){\n return [\n parseInt(bits[1] + bits[1], 16),\n parseInt(bits[2] + bits[2], 16),\n parseInt(bits[3] + bits[3], 16)\n ];\n }\n }\n ];\n\n // search through the definitions to find a match\n for (var i = 0; i < color_defs.length; i++) {\n var re = color_defs[i].re;\n var processor = color_defs[i].process;\n var bits = re.exec(color_string);\n if (bits) {\n channels = processor(bits);\n this.r = channels[0];\n this.g = channels[1];\n this.b = channels[2];\n this.ok = true;\n }\n\n }\n\n // validate/cleanup values\n this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);\n this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);\n this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);\n}", "function toHexClicked(){colorTo(4); toHex = true, toDec = false; toBin = false, toOct = false;}", "function rgbObject(input) {\nvar hex = parseHex($(input).val(), true),\nrgb = hex2rgb(hex),\nopacity = $(input).attr('data-opacity');\nif( !rgb ) return null;\nif( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });\nreturn rgb;\n}", "function rgb(r, g, b){\n if (r <=0){r = 0}\n if (g <=0){g = 0}\n if (b <=0){b = 0}\n if (r > 255){r = 255}\n if (g > 255){g = 255}\n if (b > 255){b = 255}\n r = r.toString(16).toUpperCase().padStart(2,\"0\")\n g = g.toString(16).toUpperCase().padStart(2,\"0\")\n b = b.toString(16).toUpperCase().padStart(2,\"0\")\n \n return `${r}${g}${b}`\n }", "function makeColor(r, g, b) {\r\n const color = {};\r\n color.r = r;\r\n color.g = g;\r\n color.b = b;\r\n color.rgb = function () {\r\n const { r, g, b } = this;\r\n return `rgb(${r}, ${g}, ${b})`;\r\n };\r\n color.hex = function () {\r\n const { r, g, b } = this;\r\n return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\r\n };\r\n return color;\r\n}", "function getImageColor(r,g,b){\n return d3.rgb(r,g,b);\n}", "function HexObj(centerX,centerY){\n\nthis.positions = [];\nthis.centerX = centerX;\nthis.centerY = centerY;\nthis.lineLength = 50;\n\nconst NUM_SIDES = 6;\n//make an array of positions\n//calculating six positions - dynamically.\nfor(let i=0; i<NUM_SIDES; i++)\n{\n //returns hex values in an array.\n this.positions.push(new PosVector(\n flat_hex_cornerX(this.centerX, this.lineLength, i),\n flat_hex_cornerY(this.centerY, this.lineLength, i)\n ));\n}\n\n}", "decodeColor(){\n return this.colors[ this.extractBinaryNumber(this.hasAlpha ? 3 : 2) ];\n }", "get ATC_RGB4() {}", "function rgbToHex(r, g, b) {\n\t\t return \"#\" + componentToHex(r) + componentToHex(g) + componentToHex(b);\n\t\t}", "function testConversions(console) {\n $$.each([\n \"moose\",\n \"red\",\n \"f00\",\n \"f000\",\n \"f00ff0\",\n \"#f00ff0\",\n \"#666\",\n \"#ff8844\"\n ], function(color) {\n var res = color2Rgb(color),\n str = res;\n if (res != null) {\n str = \"{ \";\n var i = 0;\n $$.each(res, function(key, value) {\n str += (i++ > 0 ? \", \" : \"\") + key + \": \" + value;\n });\n }\n console.log(color, \"=>\", str);\n if (res != null) {\n console.log(color, \"=> (back)\", rgb2Hex(res));\n }\n });\n}", "function getRGB(x){\n\tvar r=parseInt(x.substring(1,3),16)\n\tvar g=parseInt(x.substring(3,5),16)\n\tvar b=parseInt(x.substring(5),16)\n\treturn (\"La conversión de hexadecimal a RGB es \" +r+\",\"+g+\",\"+b)\n}", "toHex() {\n const value = this.value.toString(16).toUpperCase();\n return new Hex(`#${value}`);\n }", "calcRGB() {\r\n let h = this.h/360;\r\n let s = this.s/100;\r\n let l = this.l/100;\r\n let r, g, b;\r\n if (s == 0){\r\n r = g = b = l; // achromatic\r\n } else {\r\n let q = l < 0.5 ? l * (1 + s) : l + s - l * s;\r\n let p = 2 * l - q;\r\n r = this.hue2rgb(p, q, h + 1/3);\r\n g = this.hue2rgb(p, q, h);\r\n b = this.hue2rgb(p, q, h - 1/3);\r\n }\r\n this._r = Math.round(r * 255); \r\n this._g = Math.round(g * 255); \r\n this._b = Math.round(b * 255);\r\n }" ]
[ "0.7320834", "0.70295864", "0.69161236", "0.680667", "0.6662321", "0.66518193", "0.66121244", "0.6606852", "0.65954417", "0.6590858", "0.6560846", "0.6558474", "0.6558064", "0.65393555", "0.65344137", "0.65305257", "0.6530412", "0.6503779", "0.648796", "0.64828473", "0.64753515", "0.6468277", "0.6456484", "0.64486474", "0.643432", "0.6432975", "0.6430151", "0.6429029", "0.6421635", "0.64045656", "0.6403565", "0.64008087", "0.6376172", "0.6376172", "0.6376172", "0.63743395", "0.6367977", "0.63672334", "0.63655704", "0.63655704", "0.63589853", "0.6356137", "0.6341033", "0.6333825", "0.6332518", "0.63300043", "0.63274556", "0.62939197", "0.628731", "0.6286949", "0.6284395", "0.6281434", "0.6276087", "0.6275915", "0.62704337", "0.62629956", "0.6254221", "0.6251105", "0.6243917", "0.623904", "0.6238341", "0.6237917", "0.6231549", "0.6219063", "0.6217517", "0.6213655", "0.6209359", "0.6209341", "0.6201579", "0.619522", "0.61923325", "0.6191906", "0.61821514", "0.6180046", "0.6176388", "0.6172245", "0.6165445", "0.61576134", "0.61553603", "0.61512995", "0.61512995", "0.6147617", "0.6146995", "0.6137294", "0.6133684", "0.6128732", "0.6128609", "0.6126524", "0.6125169", "0.6121134", "0.61162364", "0.6115902", "0.6112005", "0.61111385", "0.61110216", "0.61078775", "0.6106762", "0.61066747", "0.61060643", "0.6100526", "0.61004764" ]
0.0
-1
console.log(rgbToHex('rgb(0, 128, 192)')); // "0080c0" console.log(rgbToHex('rgb(45, 255, 192)')); // "2dffc0" console.log(rgbToHex('rgb(0, 0, 0)')); // "000000" rgb > hex > hsl > Given a word, create an object that stores the indexes of each letter in an array. Make sure the letters are the keys. Make sure the letters are symbols. Make sure the indexes are stored in an array and those arrays are values.
function mapLetters(str) { const obj = {}; str.split('').map((val, index) => { if (!(val in obj)) { obj[`${val}`] = [index]; } else { obj[`${val}`].push(index); } }); return obj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stringToColour(str) {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n let colour = '#';\n for (let i = 0; i < 3; i++) {\n let value = (hash >> (i * 8)) & 0xff;\n colour += ('00' + value.toString(16)).substr(-2);\n }\n return colour;\n}", "function stringToColour(str) {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n let colour = '#';\n for (let i = 0; i < 3; i++) {\n let value = (hash >> (i * 8)) & 0xff;\n colour += ('00' + value.toString(16)).substr(-2);\n }\n return colour;\n}", "function stringToColour(str) {\n var hash = 0;\n for (var i = 0; i < str.length; i++) {\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n var colour = '#';\n for (var i = 0; i < 3; i++) {\n var value = (hash >> (i * 8)) & 0xFF;\n colour += ('00' + value.toString(16)).substr(-2);\n }\n return colour;\n}", "function strToColor(str) {\n var hash = 0, i;\n for (i = 0; i < str.length; i++) {\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n var colour = '#';\n for (i = 0; i < 3; i++) {\n var value = (hash >> (i * 8)) & 0xFF;\n colour += ('00' + value.toString(16)).substr(-2);\n }\n return colour;\n}", "function colorScheme(str) {\n\t\tlet hashes = hashNines(str);\n\t\tlet r = 100 + 15 * hashes[1];\n\t\tlet g = 100 + 15 * hashes[2];\n\t\tlet b = 100 + 15 * hashes[0];\n\t\tlet lightColor = `rgb(${r},${g},${b})`;\n\t\tlet lighterColor = `rgb(${r+20},${g+20},${b+20})`;\n\t\tlet darkColor = `rgb(${r-60},${g-60},${b-60})`;\n\t\treturn [lightColor, darkColor, lighterColor];\n\t}", "function colorHashStrings(arr) {\n var color_hash = {};\n for(var i=0,N=arr.length;i<N;i++) {\n var title = arr[i];\n color_hash[title] = \"hsl(\" + Math.floor((i+0.5)/N * 360) + \",100%,60%)\";\n }\n return color_hash;\n}", "function stringToColor(s) {\n var hash = 0;\n for (var i = 0; i < s.length; i++) {\n hash = s.charCodeAt(i) + ((hash << 5) - hash);\n }\n for (var x = 0, color = '#'; x < 3; x++) {\n color += ('00' + ((hash >> x * 8) & 0xFF).toString(16))\n .slice(-2);\n }\n return color;\n}", "function colorConverter (string) {\n \n// todo: study the Object.freeze \n const colorCodes = Object.freeze({\n \"blue\":\"rgb(40, 116, 237)\",\n \"brown\":\"rgb(255, 102, 102)\",\n \"brownish-red\":\"rgb(196, 136, 124)\",\n \"coral\":\"rgb(255, 102, 102)\",\n \"cream\":\"rgb(240, 237, 218)\",\n \"creamyWhite\":\"rgb(255, 253, 230)\",\n \"darkBlue\":\"rgb(0, 0, 153)\",\n \"darkPink\":\"rgb(255, 102, 153)\",\n \"darkPurple\":\"rgb(103, 0, 103)\",\n \"deepGreen\":\"rgb(0, 102, 0)\",\n \"deepPink\":\"rgb(212, 30, 90)\",\n \"emeraldGreen\":\"rgb(38, 115, 38)\",\n \"gold\":\"rgb(217, 195, 33)\",//stopped here, finish adding colors\n \"green\":\"rgb(50, 133, 59)\",\n \"greenish-white\":\"rgb(217, 242, 217)\",\n \"greenish-yellow\":\"rgb(230, 255, 179)\",\n \"indigoBlue\":\"rgb(74, 51, 222)\",\n \"lavender\":\"rgb(150, 153, 255)\",\n \"lightBlue\":\"rgb(179, 218, 255)\",\n \"lightGreen\":\"rgb(204, 255, 204)\",\n \"lightPink\":\"rgb(255, 204, 225)\",\n \"lilac\":\"rgb(230, 204, 255)\",\n \"magenta\":\"rgb(255, 0, 255)\",\n \"peach\":\"rgb(253, 217, 181)\",\n \"pink\":\"rgb(255, 102, 153)\",\n \"pinkish-lavender\":\"rgb(242, 211, 227)\",\n// \"purple and yellow\":\"rgba(0,100,0,0.75)\",//todo: need code instead of dark green\n \"purpleRed\":\"rgb(192, 0, 64)\",\n \"purplish-pink\":\"rgb(192, 96, 166)\",\n \"rose\":\"rgb(255, 153, 204)\",\n \"violet\":\"rgb(230, 130, 255)\",\n \"whiteAndPurple\":\"rgb(240, 240, 240)\",//todo: need code instead of dark green\n \"yellowish-green\":\"rgb(198, 210, 98)\", \n \"yellowCenter\":\"rgb(200, 200, 0)\"\n });\n \n //remove i_ (used to make inconspicuous) that might be in a name\n \n\t//if an rgb code is sent, return the color name\n if (string.slice(0,3) === \"rgb\") {\n for(let key in colorCodes) {\n if(colorCodes[key] === string) {\n return key;\n }\n }\n }\n //if a color name that needs to be converted is sent, return rgb\n else if (string in (colorCodes)) {\n return colorCodes[string];\n }\n //otherwise return a color name in camel case when needed\n //this is used when the color isn't listed in colorCodes, but\n //its name is valid as is or if converted to camel case notation\n else {\n return camelCase(string);\n }\n \n}", "function css2rgb (s) {\n return cssColors[s.toLowerCase()]\n}", "function rgbToHex(str) {\n\tcolour = [];\n\tstr.replace(/[a-z())]+/g, '')\n\t\t.split(',')\n\t\t.map(val => {\n\t\t\tlet value = Number(val).toString(16);\n\t\t\tvalue = value < 2 ? `0${value}` : value;\n\t\t\tcolour.push(value);\n\t\t});\n\treturn '#' + colour.join('');\n}", "function hslaColor(str) {\n /*\n Split the string by the following 3 characters:\n * (\n * )\n * ,\n This will always leave an empty string as the last item in the array.\n */\n const [type, h, s, l, a, empty] = str.split(/[\\(\\),]/)\n const isHsl = type === 'hsl'\n const error = new TypeError(`\"${str}\" isn't a valid ${type} color.`)\n const getPercentNumAndCheck = val => {\n const num = +val.slice(0, -1)\n if (!/%$/.test(val) || !numCheck(num, 0, 100)) throw error\n return num / 100\n }\n\n // Check for the correct ending and the correct empty string - there's always an empty string.\n if (!str.endsWith(')') || (isHsl ? a : empty) !== '') throw error\n\n const hue = safeHue(h)\n const saturation = getPercentNumAndCheck(s)\n const lightness = getPercentNumAndCheck(l)\n const alpha = isHsl ? 1 : +a\n const alphaOk = numCheck(alpha, 0, 1)\n\n if (isNaN(hue) || !alphaOk) throw error\n\n const results = {h: hue, s: saturation, l: lightness, a: alpha}\n return addHex(addRgb(results))\n}", "function rainbowColorText(str){\r\n\tvar phase = 0, center = 128, width = 127, frequency = Math.PI*2/str.length, totalString = '';\r\n\tvar div = document.createElement('div');\r\n\tvar escape = document.createElement('textarea');\r\n\tdiv.innerHTML = str;\r\n\tif(div.firstChild !== null && div.firstChild !== undefined){\r\n\t\tvar decoded = div.firstChild.nodeValue;\r\n\t}else{\r\n\t\tvar decoded = '';\r\n\t}\r\n\tfor(var i=0; i<decoded.length; ++i){\r\n\t\tred = parseInt(Math.sin(frequency*i+2+phase) * width + center);\r\n\t\tgreen = parseInt(Math.sin(frequency*i+0+phase) * width + center);\r\n\t\tblue = parseInt(Math.sin(frequency*i+4+phase) * width + center);\r\n\t\tescape.innerHTML = decoded.substr(i,1);\r\n\t\ttotalString += '<span style=\"color:' + RGB2Color(red,green,blue) + '\">' + escape.innerHTML + '</span>';\r\n\t}\r\n\treturn totalString;\r\n}", "function _hex3(str) {\r\n if ('#' === str[0] && 4 === str.length && /^#[\\da-fA-F]{3}$/.test(str)) {\r\n return {\r\n r: parseInt(str[1] + str[1], 16),\r\n g: parseInt(str[2] + str[2], 16),\r\n b: parseInt(str[3] + str[3], 16),\r\n a: MAX_COLOR_ALPHA\r\n };\r\n }\r\n}", "hex2hsl(hex) {\n let sColor = hex.toLowerCase();\n // 十六进制颜色值的正则表达式\n const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;\n\n // 处理六位的颜色值\n const rgbArr = [];\n\n // 如果是16进制颜色\n if (sColor && reg.test(sColor)) {\n if (sColor.length === 4) {\n let sColorNew = '#';\n for (let i = 1; i < 4; i += 1) {\n sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));\n }\n sColor = sColorNew;\n }\n\n for (let i = 1; i < 7; i += 2) {\n rgbArr.push(parseInt(`0x${sColor.slice(i, i + 2)}`, 16));\n }\n // return `RGB(${rgbArr.join(',')})`;\n } else {\n return;\n }\n // return sColor;\n\n const r1 = rgbArr[0] / 255;\n const g1 = rgbArr[1] / 255;\n const b1 = rgbArr[2] / 255;\n\n const maxColor = Math.max(r1, g1, b1);\n const minColor = Math.min(r1, g1, b1);\n // Calculate L:\n let L = (maxColor + minColor) / 2;\n let S = 0;\n let H = 0;\n if (maxColor !== minColor) {\n // Calculate S:\n if (L < 0.5) {\n S = (maxColor - minColor) / (maxColor + minColor);\n } else {\n S = (maxColor - minColor) / (2.0 - maxColor - minColor);\n }\n // Calculate H:\n if (r1 === maxColor) {\n H = (g1 - b1) / (maxColor - minColor);\n } else if (g1 === maxColor) {\n H = 2.0 + (b1 - r1) / (maxColor - minColor);\n } else {\n H = 4.0 + (r1 - g1) / (maxColor - minColor);\n }\n }\n\n L *= 100;\n S *= 100;\n H *= 60;\n if (H < 0) {\n H += 360;\n }\n return [H, S, L];\n }", "function _hex3(str) {\n if ('#' === str[0] && 4 === str.length && /^#[\\da-fA-F]{3}$/.test(str)) {\n return {\n r: parseInt(str[1] + str[1], 16),\n g: parseInt(str[2] + str[2], 16),\n b: parseInt(str[3] + str[3], 16),\n a: MAX_COLOR_ALPHA\n };\n }\n}", "colorHash (hash) {\n\t while(hash > 360) hash -= 360;\n\t return `hsl(${hash}, 100%, 50%)`;\n\t }", "function parseColor(str) {\n var color = {\n \"r\": 0,\n \"g\": 0,\n \"b\": 0,\n \"a\": 1\n };\n \n if (str.match(/#/)) {\n color = parseHex(str);\n }\n else if (str.match(/rgb/)) {\n color = parseRGB(str);\n }\n else if (str.match(/hsl/)) {\n color = parseHSL(str);\n }\n\n return color;\n }", "function getUsernameColor (username) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % TEXTCOLORS.length);\n return TEXTCOLORS[index];\n }", "function _named(str) {\n var c = COLOR_VALUES[str.toLowerCase()];\n if (c) {\n return {\n r: c[0],\n g: c[1],\n b: c[2],\n a: MAX_COLOR_ALPHA\n };\n }\n}", "function getColorIndex(s) {\n //console.log('[DEV] %s',s);\n switch (s.toLowerCase()) {\n case 'female':\n return 0;\n case 'asian':\n return 0;\n case 'mass':\n return 0;\n case 'no':\n return 0;\n case 'military':\n return 0;\n case 'male':\n return 1;\n case 'black':\n return 1;\n case 'spree':\n return 1;\n case 'tbd':\n return 1;\n case 'public place':\n return 1;\n case 'male and female':\n return 2;\n case 'latino':\n return 2;\n case 'unknown':\n return 2;\n case 'religious':\n return 2;\n case 'male and male':\n return 3;\n case 'native american':\n return 3;\n case 'yes':\n return 3;\n case 'school':\n return 3;\n case 'other':\n return 4;\n case 'workplace':\n return 4;\n case 'white':\n return 5;\n case 'state':\n return 11;\n case 'year':\n return 14;\n case 'rifle (assault)':\n return 18;\n case 'semiautomatic rifle':\n return 19;\n case 'shotgun':\n return 20;\n case 'rifle':\n return 21;\n case 'semiautomatic handgun':\n return 22;\n case 'handgun':\n return 23;\n case 'revolver':\n return 24;\n default:\n return 25;\n }\n\n}", "function getUsernameColor(username) {\n // Compute hash code\n var hash = 7\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length)\n return COLORS[index]\n}", "function rgb2Hex(s) {\n //@ts-ignore\n return s.match(/[0-9]+/g).reduce(function (a, b) { return a + (b | 256).toString(16).slice(1); }, '#').toString(16);\n}", "function getUsernameColor (username) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length);\n return COLORS[index];\n }", "function getUsernameColor (username) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length);\n return COLORS[index];\n }", "function getUsernameColor (username) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length);\n return COLORS[index];\n }", "function getUsernameColor (username) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length);\n return COLORS[index];\n }", "function getUsernameColor (username) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length);\n return COLORS[index];\n }", "function getUsernameColor (username) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length);\n return COLORS[index];\n }", "function getColor(name) {\n let colors = [\"grey\", \"blue\", \"red\", \"yellow\", \"green\", \"pink\", \"purple\", \"cyan\" ]\n let c = 0 \n\n for(var i=0;i<name.length;i++) {\n c = c + name.charCodeAt(i);\n }\n\n return colors[(c % 8)];\n}", "function RGBColor(color_string)\n{\n this.ok = false;\n\n // strip any leading #\n if (color_string.charAt(0) == '#') { // remove # if any\n color_string = color_string.substr(1,6);\n }\n\n color_string = color_string.replace(/ /g,'');\n color_string = color_string.toLowerCase();\n\n // before getting into regexps, try simple matches\n // and overwrite the input\n var simple_colors = {\n aliceblue: 'f0f8ff',\n antiquewhite: 'faebd7',\n aqua: '00ffff',\n aquamarine: '7fffd4',\n azure: 'f0ffff',\n beige: 'f5f5dc',\n bisque: 'ffe4c4',\n black: '000000',\n blanchedalmond: 'ffebcd',\n blue: '0000ff',\n blueviolet: '8a2be2',\n brown: 'a52a2a',\n burlywood: 'deb887',\n cadetblue: '5f9ea0',\n chartreuse: '7fff00',\n chocolate: 'd2691e',\n coral: 'ff7f50',\n cornflowerblue: '6495ed',\n cornsilk: 'fff8dc',\n crimson: 'dc143c',\n cyan: '00ffff',\n darkblue: '00008b',\n darkcyan: '008b8b',\n darkgoldenrod: 'b8860b',\n darkgray: 'a9a9a9',\n darkgreen: '006400',\n darkkhaki: 'bdb76b',\n darkmagenta: '8b008b',\n darkolivegreen: '556b2f',\n darkorange: 'ff8c00',\n darkorchid: '9932cc',\n darkred: '8b0000',\n darksalmon: 'e9967a',\n darkseagreen: '8fbc8f',\n darkslateblue: '483d8b',\n darkslategray: '2f4f4f',\n darkturquoise: '00ced1',\n darkviolet: '9400d3',\n deeppink: 'ff1493',\n deepskyblue: '00bfff',\n dimgray: '696969',\n dodgerblue: '1e90ff',\n feldspar: 'd19275',\n firebrick: 'b22222',\n floralwhite: 'fffaf0',\n forestgreen: '228b22',\n fuchsia: 'ff00ff',\n gainsboro: 'dcdcdc',\n ghostwhite: 'f8f8ff',\n gold: 'ffd700',\n goldenrod: 'daa520',\n gray: '808080',\n green: '008000',\n greenyellow: 'adff2f',\n honeydew: 'f0fff0',\n hotpink: 'ff69b4',\n indianred : 'cd5c5c',\n indigo : '4b0082',\n ivory: 'fffff0',\n khaki: 'f0e68c',\n lavender: 'e6e6fa',\n lavenderblush: 'fff0f5',\n lawngreen: '7cfc00',\n lemonchiffon: 'fffacd',\n lightblue: 'add8e6',\n lightcoral: 'f08080',\n lightcyan: 'e0ffff',\n lightgoldenrodyellow: 'fafad2',\n lightgrey: 'd3d3d3',\n lightgreen: '90ee90',\n lightpink: 'ffb6c1',\n lightsalmon: 'ffa07a',\n lightseagreen: '20b2aa',\n lightskyblue: '87cefa',\n lightslateblue: '8470ff',\n lightslategray: '778899',\n lightsteelblue: 'b0c4de',\n lightyellow: 'ffffe0',\n lime: '00ff00',\n limegreen: '32cd32',\n linen: 'faf0e6',\n magenta: 'ff00ff',\n maroon: '800000',\n mediumaquamarine: '66cdaa',\n mediumblue: '0000cd',\n mediumorchid: 'ba55d3',\n mediumpurple: '9370d8',\n mediumseagreen: '3cb371',\n mediumslateblue: '7b68ee',\n mediumspringgreen: '00fa9a',\n mediumturquoise: '48d1cc',\n mediumvioletred: 'c71585',\n midnightblue: '191970',\n mintcream: 'f5fffa',\n mistyrose: 'ffe4e1',\n moccasin: 'ffe4b5',\n navajowhite: 'ffdead',\n navy: '000080',\n oldlace: 'fdf5e6',\n olive: '808000',\n olivedrab: '6b8e23',\n orange: 'ffa500',\n orangered: 'ff4500',\n orchid: 'da70d6',\n palegoldenrod: 'eee8aa',\n palegreen: '98fb98',\n paleturquoise: 'afeeee',\n palevioletred: 'd87093',\n papayawhip: 'ffefd5',\n peachpuff: 'ffdab9',\n peru: 'cd853f',\n pink: 'ffc0cb',\n plum: 'dda0dd',\n powderblue: 'b0e0e6',\n purple: '800080',\n red: 'ff0000',\n rosybrown: 'bc8f8f',\n royalblue: '4169e1',\n saddlebrown: '8b4513',\n salmon: 'fa8072',\n sandybrown: 'f4a460',\n seagreen: '2e8b57',\n seashell: 'fff5ee',\n sienna: 'a0522d',\n silver: 'c0c0c0',\n skyblue: '87ceeb',\n slateblue: '6a5acd',\n slategray: '708090',\n snow: 'fffafa',\n springgreen: '00ff7f',\n steelblue: '4682b4',\n tan: 'd2b48c',\n teal: '008080',\n thistle: 'd8bfd8',\n tomato: 'ff6347',\n turquoise: '40e0d0',\n violet: 'ee82ee',\n violetred: 'd02090',\n wheat: 'f5deb3',\n white: 'ffffff',\n whitesmoke: 'f5f5f5',\n yellow: 'ffff00',\n yellowgreen: '9acd32'\n };\n for (var key in simple_colors) {\n if (color_string == key) {\n color_string = simple_colors[key];\n }\n }\n // emd of simple type-in colors\n\n // array of color definition objects\n var color_defs = [\n {\n re: /^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/,\n example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],\n process: function (bits){\n return [\n parseInt(bits[1]),\n parseInt(bits[2]),\n parseInt(bits[3])\n ];\n }\n },\n {\n re: /^(\\w{2})(\\w{2})(\\w{2})$/,\n example: ['#00ff00', '336699'],\n process: function (bits){\n return [\n parseInt(bits[1], 16),\n parseInt(bits[2], 16),\n parseInt(bits[3], 16)\n ];\n }\n },\n {\n re: /^(\\w{1})(\\w{1})(\\w{1})$/,\n example: ['#fb0', 'f0f'],\n process: function (bits){\n return [\n parseInt(bits[1] + bits[1], 16),\n parseInt(bits[2] + bits[2], 16),\n parseInt(bits[3] + bits[3], 16)\n ];\n }\n }\n ];\n\n // search through the definitions to find a match\n for (var i = 0; i < color_defs.length; i++) {\n var re = color_defs[i].re;\n var processor = color_defs[i].process;\n var bits = re.exec(color_string);\n if (bits) {\n channels = processor(bits);\n this.r = channels[0];\n this.g = channels[1];\n this.b = channels[2];\n this.ok = true;\n }\n\n }\n\n // validate/cleanup values\n this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);\n this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);\n this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);\n\n // some getters\n this.toRGB = function () {\n return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';\n }\n this.toHex = function () {\n var r = this.r.toString(16);\n var g = this.g.toString(16);\n var b = this.b.toString(16);\n if (r.length == 1) r = '0' + r;\n if (g.length == 1) g = '0' + g;\n if (b.length == 1) b = '0' + b;\n return r + g + b;\n }\n\n // help\n this.getHelpXML = function () {\n\n var examples = new Array();\n // add regexps\n for (var i = 0; i < color_defs.length; i++) {\n var example = color_defs[i].example;\n for (var j = 0; j < example.length; j++) {\n examples[examples.length] = example[j];\n }\n }\n // add type-in colors\n for (var sc in simple_colors) {\n examples[examples.length] = sc;\n }\n\n var xml = document.createElement('ul');\n xml.setAttribute('id', 'rgbcolor-examples');\n for (var i = 0; i < examples.length; i++) {\n try {\n var list_item = document.createElement('li');\n var list_color = new RGBColor(examples[i]);\n var example_div = document.createElement('div');\n example_div.style.cssText =\n 'margin: 3px; '\n + 'border: 1px solid black; '\n + 'background:' + list_color.toHex() + '; '\n + 'color:' + list_color.toHex()\n ;\n example_div.appendChild(document.createTextNode('test'));\n var list_item_value = document.createTextNode(\n ' ' + examples[i] + ' -> ' + list_color.toRGB() + ' -> ' + list_color.toHex()\n );\n list_item.appendChild(example_div);\n list_item.appendChild(list_item_value);\n xml.appendChild(list_item);\n\n } catch(e){}\n }\n return xml;\n\n }\n\n}", "function lookupColorName(str) {\n return colors$1[str.toLowerCase().replace(/[ -]+/g, '')];\n }", "function color() {\n var map = {\n \"black\" : [ 0/255,0/255,0/255 ],\n \"silver\": [ 192/255,192/255,192/255 ],\n \"gray\" : [ 128/255,128/255,128/255 ],\n \"white\" : [ 255/255,255/255,255/255 ],\n \"maroon\": [ 128/255,0/255,0/255 ],\n \"red\" : [ 255/255,0/255,0/255 ],\n \"purple\": [ 128/255,0/255,128/255 ],\n \"fuchsia\": [ 255/255,0/255,255/255 ],\n \"green\" : [ 0/255,128/255,0/255 ],\n \"lime\" : [ 0/255,255/255,0/255 ],\n \"olive\" : [ 128/255,128/255,0/255 ],\n \"yellow\": [ 255/255,255/255,0/255 ],\n \"navy\" : [ 0/255,0/255,128/255 ],\n \"blue\" : [ 0/255,0/255,255/255 ],\n \"teal\" : [ 0/255,128/255,128/255 ],\n \"aqua\" : [ 0/255,255/255,255/255 ],\n \"aliceblue\" : [ 240/255,248/255,255/255 ],\n \"antiquewhite\" : [ 250/255,235/255,215/255 ],\n \"aqua\" : [ 0/255,255/255,255/255 ],\n \"aquamarine\" : [ 127/255,255/255,212/255 ],\n \"azure\" : [ 240/255,255/255,255/255 ],\n \"beige\" : [ 245/255,245/255,220/255 ],\n \"bisque\" : [ 255/255,228/255,196/255 ],\n \"black\" : [ 0/255,0/255,0/255 ],\n \"blanchedalmond\" : [ 255/255,235/255,205/255 ],\n \"blue\" : [ 0/255,0/255,255/255 ],\n \"blueviolet\" : [ 138/255,43/255,226/255 ],\n \"brown\" : [ 165/255,42/255,42/255 ],\n \"burlywood\" : [ 222/255,184/255,135/255 ],\n \"cadetblue\" : [ 95/255,158/255,160/255 ],\n \"chartreuse\" : [ 127/255,255/255,0/255 ],\n \"chocolate\" : [ 210/255,105/255,30/255 ],\n \"coral\" : [ 255/255,127/255,80/255 ],\n \"cornflowerblue\" : [ 100/255,149/255,237/255 ],\n \"cornsilk\" : [ 255/255,248/255,220/255 ],\n \"crimson\" : [ 220/255,20/255,60/255 ],\n \"cyan\" : [ 0/255,255/255,255/255 ],\n \"darkblue\" : [ 0/255,0/255,139/255 ],\n \"darkcyan\" : [ 0/255,139/255,139/255 ],\n \"darkgoldenrod\" : [ 184/255,134/255,11/255 ],\n \"darkgray\" : [ 169/255,169/255,169/255 ],\n \"darkgreen\" : [ 0/255,100/255,0/255 ],\n \"darkgrey\" : [ 169/255,169/255,169/255 ],\n \"darkkhaki\" : [ 189/255,183/255,107/255 ],\n \"darkmagenta\" : [ 139/255,0/255,139/255 ],\n \"darkolivegreen\" : [ 85/255,107/255,47/255 ],\n \"darkorange\" : [ 255/255,140/255,0/255 ],\n \"darkorchid\" : [ 153/255,50/255,204/255 ],\n \"darkred\" : [ 139/255,0/255,0/255 ],\n \"darksalmon\" : [ 233/255,150/255,122/255 ],\n \"darkseagreen\" : [ 143/255,188/255,143/255 ],\n \"darkslateblue\" : [ 72/255,61/255,139/255 ],\n \"darkslategray\" : [ 47/255,79/255,79/255 ],\n \"darkslategrey\" : [ 47/255,79/255,79/255 ],\n \"darkturquoise\" : [ 0/255,206/255,209/255 ],\n \"darkviolet\" : [ 148/255,0/255,211/255 ],\n \"deeppink\" : [ 255/255,20/255,147/255 ],\n \"deepskyblue\" : [ 0/255,191/255,255/255 ],\n \"dimgray\" : [ 105/255,105/255,105/255 ],\n \"dimgrey\" : [ 105/255,105/255,105/255 ],\n \"dodgerblue\" : [ 30/255,144/255,255/255 ],\n \"firebrick\" : [ 178/255,34/255,34/255 ],\n \"floralwhite\" : [ 255/255,250/255,240/255 ],\n \"forestgreen\" : [ 34/255,139/255,34/255 ],\n \"fuchsia\" : [ 255/255,0/255,255/255 ],\n \"gainsboro\" : [ 220/255,220/255,220/255 ],\n \"ghostwhite\" : [ 248/255,248/255,255/255 ],\n \"gold\" : [ 255/255,215/255,0/255 ],\n \"goldenrod\" : [ 218/255,165/255,32/255 ],\n \"gray\" : [ 128/255,128/255,128/255 ],\n \"green\" : [ 0/255,128/255,0/255 ],\n \"greenyellow\" : [ 173/255,255/255,47/255 ],\n \"grey\" : [ 128/255,128/255,128/255 ],\n \"honeydew\" : [ 240/255,255/255,240/255 ],\n \"hotpink\" : [ 255/255,105/255,180/255 ],\n \"indianred\" : [ 205/255,92/255,92/255 ],\n \"indigo\" : [ 75/255,0/255,130/255 ],\n \"ivory\" : [ 255/255,255/255,240/255 ],\n \"khaki\" : [ 240/255,230/255,140/255 ],\n \"lavender\" : [ 230/255,230/255,250/255 ],\n \"lavenderblush\" : [ 255/255,240/255,245/255 ],\n \"lawngreen\" : [ 124/255,252/255,0/255 ],\n \"lemonchiffon\" : [ 255/255,250/255,205/255 ],\n \"lightblue\" : [ 173/255,216/255,230/255 ],\n \"lightcoral\" : [ 240/255,128/255,128/255 ],\n \"lightcyan\" : [ 224/255,255/255,255/255 ],\n \"lightgoldenrodyellow\" : [ 250/255,250/255,210/255 ],\n \"lightgray\" : [ 211/255,211/255,211/255 ],\n \"lightgreen\" : [ 144/255,238/255,144/255 ],\n \"lightgrey\" : [ 211/255,211/255,211/255 ],\n \"lightpink\" : [ 255/255,182/255,193/255 ],\n \"lightsalmon\" : [ 255/255,160/255,122/255 ],\n \"lightseagreen\" : [ 32/255,178/255,170/255 ],\n \"lightskyblue\" : [ 135/255,206/255,250/255 ],\n \"lightslategray\" : [ 119/255,136/255,153/255 ],\n \"lightslategrey\" : [ 119/255,136/255,153/255 ],\n \"lightsteelblue\" : [ 176/255,196/255,222/255 ],\n \"lightyellow\" : [ 255/255,255/255,224/255 ],\n \"lime\" : [ 0/255,255/255,0/255 ],\n \"limegreen\" : [ 50/255,205/255,50/255 ],\n \"linen\" : [ 250/255,240/255,230/255 ],\n \"magenta\" : [ 255/255,0/255,255/255 ],\n \"maroon\" : [ 128/255,0/255,0/255 ],\n \"mediumaquamarine\" : [ 102/255,205/255,170/255 ],\n \"mediumblue\" : [ 0/255,0/255,205/255 ],\n \"mediumorchid\" : [ 186/255,85/255,211/255 ],\n \"mediumpurple\" : [ 147/255,112/255,219/255 ],\n \"mediumseagreen\" : [ 60/255,179/255,113/255 ],\n \"mediumslateblue\" : [ 123/255,104/255,238/255 ],\n \"mediumspringgreen\" : [ 0/255,250/255,154/255 ],\n \"mediumturquoise\" : [ 72/255,209/255,204/255 ],\n \"mediumvioletred\" : [ 199/255,21/255,133/255 ],\n \"midnightblue\" : [ 25/255,25/255,112/255 ],\n \"mintcream\" : [ 245/255,255/255,250/255 ],\n \"mistyrose\" : [ 255/255,228/255,225/255 ],\n \"moccasin\" : [ 255/255,228/255,181/255 ],\n \"navajowhite\" : [ 255/255,222/255,173/255 ],\n \"navy\" : [ 0/255,0/255,128/255 ],\n \"oldlace\" : [ 253/255,245/255,230/255 ],\n \"olive\" : [ 128/255,128/255,0/255 ],\n \"olivedrab\" : [ 107/255,142/255,35/255 ],\n \"orange\" : [ 255/255,165/255,0/255 ],\n \"orangered\" : [ 255/255,69/255,0/255 ],\n \"orchid\" : [ 218/255,112/255,214/255 ],\n \"palegoldenrod\" : [ 238/255,232/255,170/255 ],\n \"palegreen\" : [ 152/255,251/255,152/255 ],\n \"paleturquoise\" : [ 175/255,238/255,238/255 ],\n \"palevioletred\" : [ 219/255,112/255,147/255 ],\n \"papayawhip\" : [ 255/255,239/255,213/255 ],\n \"peachpuff\" : [ 255/255,218/255,185/255 ],\n \"peru\" : [ 205/255,133/255,63/255 ],\n \"pink\" : [ 255/255,192/255,203/255 ],\n \"plum\" : [ 221/255,160/255,221/255 ],\n \"powderblue\" : [ 176/255,224/255,230/255 ],\n \"purple\" : [ 128/255,0/255,128/255 ],\n \"red\" : [ 255/255,0/255,0/255 ],\n \"rosybrown\" : [ 188/255,143/255,143/255 ],\n \"royalblue\" : [ 65/255,105/255,225/255 ],\n \"saddlebrown\" : [ 139/255,69/255,19/255 ],\n \"salmon\" : [ 250/255,128/255,114/255 ],\n \"sandybrown\" : [ 244/255,164/255,96/255 ],\n \"seagreen\" : [ 46/255,139/255,87/255 ],\n \"seashell\" : [ 255/255,245/255,238/255 ],\n \"sienna\" : [ 160/255,82/255,45/255 ],\n \"silver\" : [ 192/255,192/255,192/255 ],\n \"skyblue\" : [ 135/255,206/255,235/255 ],\n \"slateblue\" : [ 106/255,90/255,205/255 ],\n \"slategray\" : [ 112/255,128/255,144/255 ],\n \"slategrey\" : [ 112/255,128/255,144/255 ],\n \"snow\" : [ 255/255,250/255,250/255 ],\n \"springgreen\" : [ 0/255,255/255,127/255 ],\n \"steelblue\" : [ 70/255,130/255,180/255 ],\n \"tan\" : [ 210/255,180/255,140/255 ],\n \"teal\" : [ 0/255,128/255,128/255 ],\n \"thistle\" : [ 216/255,191/255,216/255 ],\n \"tomato\" : [ 255/255,99/255,71/255 ],\n \"turquoise\" : [ 64/255,224/255,208/255 ],\n \"violet\" : [ 238/255,130/255,238/255 ],\n \"wheat\" : [ 245/255,222/255,179/255 ],\n \"white\" : [ 255/255,255/255,255/255 ],\n \"whitesmoke\" : [ 245/255,245/255,245/255 ],\n \"yellow\" : [ 255/255,255/255,0/255 ],\n \"yellowgreen\" : [ 154/255,205/255,50/255 ] };\n\n var o, i = 1, a = arguments, c = a[0], alpha;\n\n if(a[0].length<4 && (a[i]*1-0)==a[i]) { alpha = a[i++]; } // first argument rgb (no a), and next one is numeric?\n if(a[i].length) { a = a[i], i = 0; } // next arg an array, make it our main array to walk through\n if(typeof c == 'string')\n c = map[c.toLowerCase()];\n if(alpha!==undefined)\n c = c.concat(alpha);\n for(o=a[i++]; i<a.length; i++) {\n o = o.union(a[i]);\n }\n return o.setColor(c);\n}", "function RGBColor(color_string)\r\n{\r\n this.ok = false;\r\n\r\n // strip any leading #\r\n if (color_string.charAt(0) == '#') { // remove # if any\r\n color_string = color_string.substr(1,6);\r\n }\r\n\r\n color_string = color_string.replace(/ /g,'');\r\n color_string = color_string.toLowerCase();\r\n\r\n // before getting into regexps, try simple matches\r\n // and overwrite the input\r\n var simple_colors = {\r\n aliceblue: 'f0f8ff',\r\n antiquewhite: 'faebd7',\r\n aqua: '00ffff',\r\n aquamarine: '7fffd4',\r\n azure: 'f0ffff',\r\n beige: 'f5f5dc',\r\n bisque: 'ffe4c4',\r\n black: '000000',\r\n blanchedalmond: 'ffebcd',\r\n blue: '0000ff',\r\n blueviolet: '8a2be2',\r\n brown: 'a52a2a',\r\n burlywood: 'deb887',\r\n cadetblue: '5f9ea0',\r\n chartreuse: '7fff00',\r\n chocolate: 'd2691e',\r\n coral: 'ff7f50',\r\n cornflowerblue: '6495ed',\r\n cornsilk: 'fff8dc',\r\n crimson: 'dc143c',\r\n cyan: '00ffff',\r\n darkblue: '00008b',\r\n darkcyan: '008b8b',\r\n darkgoldenrod: 'b8860b',\r\n darkgray: 'a9a9a9',\r\n darkgreen: '006400',\r\n darkkhaki: 'bdb76b',\r\n darkmagenta: '8b008b',\r\n darkolivegreen: '556b2f',\r\n darkorange: 'ff8c00',\r\n darkorchid: '9932cc',\r\n darkred: '8b0000',\r\n darksalmon: 'e9967a',\r\n darkseagreen: '8fbc8f',\r\n darkslateblue: '483d8b',\r\n darkslategray: '2f4f4f',\r\n darkturquoise: '00ced1',\r\n darkviolet: '9400d3',\r\n deeppink: 'ff1493',\r\n deepskyblue: '00bfff',\r\n dimgray: '696969',\r\n dodgerblue: '1e90ff',\r\n feldspar: 'd19275',\r\n firebrick: 'b22222',\r\n floralwhite: 'fffaf0',\r\n forestgreen: '228b22',\r\n fuchsia: 'ff00ff',\r\n gainsboro: 'dcdcdc',\r\n ghostwhite: 'f8f8ff',\r\n gold: 'ffd700',\r\n goldenrod: 'daa520',\r\n gray: '808080',\r\n green: '008000',\r\n greenyellow: 'adff2f',\r\n honeydew: 'f0fff0',\r\n hotpink: 'ff69b4',\r\n indianred : 'cd5c5c',\r\n indigo : '4b0082',\r\n ivory: 'fffff0',\r\n khaki: 'f0e68c',\r\n lavender: 'e6e6fa',\r\n lavenderblush: 'fff0f5',\r\n lawngreen: '7cfc00',\r\n lemonchiffon: 'fffacd',\r\n lightblue: 'add8e6',\r\n lightcoral: 'f08080',\r\n lightcyan: 'e0ffff',\r\n lightgoldenrodyellow: 'fafad2',\r\n lightgrey: 'd3d3d3',\r\n lightgreen: '90ee90',\r\n lightpink: 'ffb6c1',\r\n lightsalmon: 'ffa07a',\r\n lightseagreen: '20b2aa',\r\n lightskyblue: '87cefa',\r\n lightslateblue: '8470ff',\r\n lightslategray: '778899',\r\n lightsteelblue: 'b0c4de',\r\n lightyellow: 'ffffe0',\r\n lime: '00ff00',\r\n limegreen: '32cd32',\r\n linen: 'faf0e6',\r\n magenta: 'ff00ff',\r\n maroon: '800000',\r\n mediumaquamarine: '66cdaa',\r\n mediumblue: '0000cd',\r\n mediumorchid: 'ba55d3',\r\n mediumpurple: '9370d8',\r\n mediumseagreen: '3cb371',\r\n mediumslateblue: '7b68ee',\r\n mediumspringgreen: '00fa9a',\r\n mediumturquoise: '48d1cc',\r\n mediumvioletred: 'c71585',\r\n midnightblue: '191970',\r\n mintcream: 'f5fffa',\r\n mistyrose: 'ffe4e1',\r\n moccasin: 'ffe4b5',\r\n navajowhite: 'ffdead',\r\n navy: '000080',\r\n oldlace: 'fdf5e6',\r\n olive: '808000',\r\n olivedrab: '6b8e23',\r\n orange: 'ffa500',\r\n orangered: 'ff4500',\r\n orchid: 'da70d6',\r\n palegoldenrod: 'eee8aa',\r\n palegreen: '98fb98',\r\n paleturquoise: 'afeeee',\r\n palevioletred: 'd87093',\r\n papayawhip: 'ffefd5',\r\n peachpuff: 'ffdab9',\r\n peru: 'cd853f',\r\n pink: 'ffc0cb',\r\n plum: 'dda0dd',\r\n powderblue: 'b0e0e6',\r\n purple: '800080',\r\n red: 'ff0000',\r\n rosybrown: 'bc8f8f',\r\n royalblue: '4169e1',\r\n saddlebrown: '8b4513',\r\n salmon: 'fa8072',\r\n sandybrown: 'f4a460',\r\n seagreen: '2e8b57',\r\n seashell: 'fff5ee',\r\n sienna: 'a0522d',\r\n silver: 'c0c0c0',\r\n skyblue: '87ceeb',\r\n slateblue: '6a5acd',\r\n slategray: '708090',\r\n snow: 'fffafa',\r\n springgreen: '00ff7f',\r\n steelblue: '4682b4',\r\n tan: 'd2b48c',\r\n teal: '008080',\r\n thistle: 'd8bfd8',\r\n tomato: 'ff6347',\r\n turquoise: '40e0d0',\r\n violet: 'ee82ee',\r\n violetred: 'd02090',\r\n wheat: 'f5deb3',\r\n white: 'ffffff',\r\n whitesmoke: 'f5f5f5',\r\n yellow: 'ffff00',\r\n yellowgreen: '9acd32'\r\n };\r\n for (var key in simple_colors) {\r\n if (color_string == key) {\r\n color_string = simple_colors[key];\r\n }\r\n }\r\n // emd of simple type-in colors\r\n\r\n // array of color definition objects\r\n var color_defs = [\r\n {\r\n re: /^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/,\r\n example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],\r\n process: function (bits){\r\n return [\r\n parseInt(bits[1]),\r\n parseInt(bits[2]),\r\n parseInt(bits[3])\r\n ];\r\n }\r\n },\r\n {\r\n re: /^(\\w{2})(\\w{2})(\\w{2})$/,\r\n example: ['#00ff00', '336699'],\r\n process: function (bits){\r\n return [\r\n parseInt(bits[1], 16),\r\n parseInt(bits[2], 16),\r\n parseInt(bits[3], 16)\r\n ];\r\n }\r\n },\r\n {\r\n re: /^(\\w{1})(\\w{1})(\\w{1})$/,\r\n example: ['#fb0', 'f0f'],\r\n process: function (bits){\r\n return [\r\n parseInt(bits[1] + bits[1], 16),\r\n parseInt(bits[2] + bits[2], 16),\r\n parseInt(bits[3] + bits[3], 16)\r\n ];\r\n }\r\n }\r\n ];\r\n\r\n // search through the definitions to find a match\r\n for (var i = 0; i < color_defs.length; i++) {\r\n var re = color_defs[i].re;\r\n var processor = color_defs[i].process;\r\n var bits = re.exec(color_string);\r\n if (bits) {\r\n channels = processor(bits);\r\n this.r = channels[0];\r\n this.g = channels[1];\r\n this.b = channels[2];\r\n this.ok = true;\r\n }\r\n\r\n }\r\n\r\n // validate/cleanup values\r\n this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);\r\n this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);\r\n this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);\r\n\r\n // some getters\r\n this.toRGB = function () {\r\n return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';\r\n }\r\n this.toHex = function () {\r\n var r = this.r.toString(16);\r\n var g = this.g.toString(16);\r\n var b = this.b.toString(16);\r\n if (r.length == 1) r = '0' + r;\r\n if (g.length == 1) g = '0' + g;\r\n if (b.length == 1) b = '0' + b;\r\n return '#' + r + g + b;\r\n }\r\n\r\n // help\r\n this.getHelpXML = function () {\r\n\r\n var examples = new Array();\r\n // add regexps\r\n for (var i = 0; i < color_defs.length; i++) {\r\n var example = color_defs[i].example;\r\n for (var j = 0; j < example.length; j++) {\r\n examples[examples.length] = example[j];\r\n }\r\n }\r\n // add type-in colors\r\n for (var sc in simple_colors) {\r\n examples[examples.length] = sc;\r\n }\r\n\r\n var xml = document.createElement('ul');\r\n xml.setAttribute('id', 'rgbcolor-examples');\r\n for (var i = 0; i < examples.length; i++) {\r\n try {\r\n var list_item = document.createElement('li');\r\n var list_color = new RGBColor(examples[i]);\r\n var example_div = document.createElement('div');\r\n example_div.style.cssText =\r\n 'margin: 3px; '\r\n + 'border: 1px solid black; '\r\n + 'background:' + list_color.toHex() + '; '\r\n + 'color:' + list_color.toHex()\r\n ;\r\n example_div.appendChild(document.createTextNode('test'));\r\n var list_item_value = document.createTextNode(\r\n ' ' + examples[i] + ' -> ' + list_color.toRGB() + ' -> ' + list_color.toHex()\r\n );\r\n list_item.appendChild(example_div);\r\n list_item.appendChild(list_item_value);\r\n xml.appendChild(list_item);\r\n\r\n } catch(e){}\r\n }\r\n return xml;\r\n\r\n }\r\n\r\n}", "function RGBColor(color_string)\r\n{\r\n this.ok = false;\r\n\r\n // strip any leading #\r\n if (color_string.charAt(0) == '#') { // remove # if any\r\n color_string = color_string.substr(1,6);\r\n }\r\n\r\n color_string = color_string.replace(/ /g,'');\r\n color_string = color_string.toLowerCase();\r\n\r\n // before getting into regexps, try simple matches\r\n // and overwrite the input\r\n var simple_colors = {\r\n aliceblue: 'f0f8ff',\r\n antiquewhite: 'faebd7',\r\n aqua: '00ffff',\r\n aquamarine: '7fffd4',\r\n azure: 'f0ffff',\r\n beige: 'f5f5dc',\r\n bisque: 'ffe4c4',\r\n black: '000000',\r\n blanchedalmond: 'ffebcd',\r\n blue: '0000ff',\r\n blueviolet: '8a2be2',\r\n brown: 'a52a2a',\r\n burlywood: 'deb887',\r\n cadetblue: '5f9ea0',\r\n chartreuse: '7fff00',\r\n chocolate: 'd2691e',\r\n coral: 'ff7f50',\r\n cornflowerblue: '6495ed',\r\n cornsilk: 'fff8dc',\r\n crimson: 'dc143c',\r\n cyan: '00ffff',\r\n darkblue: '00008b',\r\n darkcyan: '008b8b',\r\n darkgoldenrod: 'b8860b',\r\n darkgray: 'a9a9a9',\r\n darkgreen: '006400',\r\n darkkhaki: 'bdb76b',\r\n darkmagenta: '8b008b',\r\n darkolivegreen: '556b2f',\r\n darkorange: 'ff8c00',\r\n darkorchid: '9932cc',\r\n darkred: '8b0000',\r\n darksalmon: 'e9967a',\r\n darkseagreen: '8fbc8f',\r\n darkslateblue: '483d8b',\r\n darkslategray: '2f4f4f',\r\n darkturquoise: '00ced1',\r\n darkviolet: '9400d3',\r\n deeppink: 'ff1493',\r\n deepskyblue: '00bfff',\r\n dimgray: '696969',\r\n dodgerblue: '1e90ff',\r\n feldspar: 'd19275',\r\n firebrick: 'b22222',\r\n floralwhite: 'fffaf0',\r\n forestgreen: '228b22',\r\n fuchsia: 'ff00ff',\r\n gainsboro: 'dcdcdc',\r\n ghostwhite: 'f8f8ff',\r\n gold: 'ffd700',\r\n goldenrod: 'daa520',\r\n gray: '808080',\r\n green: '008000',\r\n greenyellow: 'adff2f',\r\n honeydew: 'f0fff0',\r\n hotpink: 'ff69b4',\r\n indianred : 'cd5c5c',\r\n indigo : '4b0082',\r\n ivory: 'fffff0',\r\n khaki: 'f0e68c',\r\n lavender: 'e6e6fa',\r\n lavenderblush: 'fff0f5',\r\n lawngreen: '7cfc00',\r\n lemonchiffon: 'fffacd',\r\n lightblue: 'add8e6',\r\n lightcoral: 'f08080',\r\n lightcyan: 'e0ffff',\r\n lightgoldenrodyellow: 'fafad2',\r\n lightgrey: 'd3d3d3',\r\n lightgreen: '90ee90',\r\n lightpink: 'ffb6c1',\r\n lightsalmon: 'ffa07a',\r\n lightseagreen: '20b2aa',\r\n lightskyblue: '87cefa',\r\n lightslateblue: '8470ff',\r\n lightslategray: '778899',\r\n lightsteelblue: 'b0c4de',\r\n lightyellow: 'ffffe0',\r\n lime: '00ff00',\r\n limegreen: '32cd32',\r\n linen: 'faf0e6',\r\n magenta: 'ff00ff',\r\n maroon: '800000',\r\n mediumaquamarine: '66cdaa',\r\n mediumblue: '0000cd',\r\n mediumorchid: 'ba55d3',\r\n mediumpurple: '9370d8',\r\n mediumseagreen: '3cb371',\r\n mediumslateblue: '7b68ee',\r\n mediumspringgreen: '00fa9a',\r\n mediumturquoise: '48d1cc',\r\n mediumvioletred: 'c71585',\r\n midnightblue: '191970',\r\n mintcream: 'f5fffa',\r\n mistyrose: 'ffe4e1',\r\n moccasin: 'ffe4b5',\r\n navajowhite: 'ffdead',\r\n navy: '000080',\r\n oldlace: 'fdf5e6',\r\n olive: '808000',\r\n olivedrab: '6b8e23',\r\n orange: 'ffa500',\r\n orangered: 'ff4500',\r\n orchid: 'da70d6',\r\n palegoldenrod: 'eee8aa',\r\n palegreen: '98fb98',\r\n paleturquoise: 'afeeee',\r\n palevioletred: 'd87093',\r\n papayawhip: 'ffefd5',\r\n peachpuff: 'ffdab9',\r\n peru: 'cd853f',\r\n pink: 'ffc0cb',\r\n plum: 'dda0dd',\r\n powderblue: 'b0e0e6',\r\n purple: '800080',\r\n red: 'ff0000',\r\n rosybrown: 'bc8f8f',\r\n royalblue: '4169e1',\r\n saddlebrown: '8b4513',\r\n salmon: 'fa8072',\r\n sandybrown: 'f4a460',\r\n seagreen: '2e8b57',\r\n seashell: 'fff5ee',\r\n sienna: 'a0522d',\r\n silver: 'c0c0c0',\r\n skyblue: '87ceeb',\r\n slateblue: '6a5acd',\r\n slategray: '708090',\r\n snow: 'fffafa',\r\n springgreen: '00ff7f',\r\n steelblue: '4682b4',\r\n tan: 'd2b48c',\r\n teal: '008080',\r\n thistle: 'd8bfd8',\r\n tomato: 'ff6347',\r\n turquoise: '40e0d0',\r\n violet: 'ee82ee',\r\n violetred: 'd02090',\r\n wheat: 'f5deb3',\r\n white: 'ffffff',\r\n whitesmoke: 'f5f5f5',\r\n yellow: 'ffff00',\r\n yellowgreen: '9acd32'\r\n };\r\n for (var key in simple_colors) {\r\n if (color_string == key) {\r\n color_string = simple_colors[key];\r\n }\r\n }\r\n // emd of simple type-in colors\r\n\r\n // array of color definition objects\r\n var color_defs = [\r\n {\r\n re: /^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/,\r\n example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],\r\n process: function (bits){\r\n return [\r\n parseInt(bits[1]),\r\n parseInt(bits[2]),\r\n parseInt(bits[3])\r\n ];\r\n }\r\n },\r\n {\r\n re: /^(\\w{2})(\\w{2})(\\w{2})$/,\r\n example: ['#00ff00', '336699'],\r\n process: function (bits){\r\n return [\r\n parseInt(bits[1], 16),\r\n parseInt(bits[2], 16),\r\n parseInt(bits[3], 16)\r\n ];\r\n }\r\n },\r\n {\r\n re: /^(\\w{1})(\\w{1})(\\w{1})$/,\r\n example: ['#fb0', 'f0f'],\r\n process: function (bits){\r\n return [\r\n parseInt(bits[1] + bits[1], 16),\r\n parseInt(bits[2] + bits[2], 16),\r\n parseInt(bits[3] + bits[3], 16)\r\n ];\r\n }\r\n }\r\n ];\r\n\r\n // search through the definitions to find a match\r\n for (var i = 0; i < color_defs.length; i++) {\r\n var re = color_defs[i].re;\r\n var processor = color_defs[i].process;\r\n var bits = re.exec(color_string);\r\n if (bits) {\r\n channels = processor(bits);\r\n this.r = channels[0];\r\n this.g = channels[1];\r\n this.b = channels[2];\r\n this.ok = true;\r\n }\r\n\r\n }\r\n\r\n // validate/cleanup values\r\n this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);\r\n this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);\r\n this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);\r\n\r\n // some getters\r\n this.toRGB = function () {\r\n return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';\r\n }\r\n this.toHex = function () {\r\n var r = this.r.toString(16);\r\n var g = this.g.toString(16);\r\n var b = this.b.toString(16);\r\n if (r.length == 1) r = '0' + r;\r\n if (g.length == 1) g = '0' + g;\r\n if (b.length == 1) b = '0' + b;\r\n return '#' + r + g + b;\r\n }\r\n\r\n // help\r\n this.getHelpXML = function () {\r\n\r\n var examples = new Array();\r\n // add regexps\r\n for (var i = 0; i < color_defs.length; i++) {\r\n var example = color_defs[i].example;\r\n for (var j = 0; j < example.length; j++) {\r\n examples[examples.length] = example[j];\r\n }\r\n }\r\n // add type-in colors\r\n for (var sc in simple_colors) {\r\n examples[examples.length] = sc;\r\n }\r\n\r\n var xml = document.createElement('ul');\r\n xml.setAttribute('id', 'rgbcolor-examples');\r\n for (var i = 0; i < examples.length; i++) {\r\n try {\r\n var list_item = document.createElement('li');\r\n var list_color = new RGBColor(examples[i]);\r\n var example_div = document.createElement('div');\r\n example_div.style.cssText =\r\n 'margin: 3px; '\r\n + 'border: 1px solid black; '\r\n + 'background:' + list_color.toHex() + '; '\r\n + 'color:' + list_color.toHex()\r\n ;\r\n example_div.appendChild(document.createTextNode('test'));\r\n var list_item_value = document.createTextNode(\r\n ' ' + examples[i] + ' -> ' + list_color.toRGB() + ' -> ' + list_color.toHex()\r\n );\r\n list_item.appendChild(example_div);\r\n list_item.appendChild(list_item_value);\r\n xml.appendChild(list_item);\r\n\r\n } catch(e){}\r\n }\r\n return xml;\r\n\r\n }\r\n\r\n}", "function getUsernameColor (username) {\n\t// Compute hash code\n\tvar hash = 7;\n\tfor (var i = 0; i < username.length; i++) {\n\t\thash = username.charCodeAt(i) + (hash << 5) - hash;\n\t}\n\t// Calculate color\n\tvar index = Math.abs(hash % COLORS.length);\n\treturn COLORS[index];\n}", "function getUsernameColor(username) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length);\n return COLORS[index];\n }", "function getUsernameColor(username) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length);\n return COLORS[index];\n }", "function getUsernameColor (username) {\r\n // Compute hash code\r\n var hash = 7;\r\n for (var i = 0; i < username.length; i++) {\r\n hash = username.charCodeAt(i) + (hash << 5) - hash;\r\n }\r\n // Calculate color\r\n var index = Math.abs(hash % COLORS.length);\r\n return COLORS[index];\r\n}", "function getColor(str){\n\treturn partyColors[str];\n}", "function parseHSL(str) {\n var c, h, s, l, r, g, b, q, p, a;\n\n c = str.match(/[\\d\\.]+/g);\n h = +c[0] / 360;\n s = +c[1] / 100;\n l = +c[2] / 100;\n a = (+c[3] || 1) / 1;\n\n function hue2rgb(p, q, t) {\n if (t < 0) {\n t += 1;\n }\n if (t > 1) {\n t -= 1;\n }\n if (t < 1 / 6) {\n return p + (q - p) * 6 * t;\n }\n if (t < 1 / 2) {\n return q;\n }\n if (t < 2 / 3) {\n return p + (q - p) * (2 / 3 - t) * 6;\n }\n\n return p;\n }\n\n if (s === 0) {\n r = g = b = l;\n } else {\n q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n p = 2 * l - q;\n r = hue2rgb(p, q, h + 1/3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1/3);\n }\n\n return {\n \"r\": r * 255,\n \"g\": g * 255,\n \"b\": b * 255,\n \"a\": a\n };\n }", "function hexToRGB(hex) {\n\tif(hex.charAt(0) == \"#\") hex = hex.slice(1); //Remove the '#' char - if there is one.\n\thex = hex.toUpperCase();\n\tvar hex_alphabets = \"0123456789ABCDEF\";\n\tvar value = new Array(3);\n\tvar k = 0;\n\tvar int1,int2;\n\tfor(var i=0;i<6;i+=2) {\n\t\tint1 = hex_alphabets.indexOf(hex.charAt(i));\n\t\tint2 = hex_alphabets.indexOf(hex.charAt(i+1));\n\t\tvalue[k] = (int1 * 16) + int2;\n\t\tk++;\n\t}\n\treturn(value);\n}", "function getUsernameColor (username) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length);\n return COLORS[index];\n }", "function pColor(piece){ return piece.charCodeAt(0) }", "function getUsernameColor (username) {\n // Compute hash code\n var hash = 7\n for (var i = 0; i < username.length; i++) {\n hash = username.charCodeAt(i) + (hash << 5) - hash\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length)\n return COLORS[index]\n }", "function _hex3(str) {\n if (str[0] === '#' && str.length === 4 && /^#[\\da-fA-F]{3}$/.test(str)) {\n return {\n r: parseInt(str[1] + str[1], 16),\n g: parseInt(str[2] + str[2], 16),\n b: parseInt(str[3] + str[3], 16),\n a: _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_ALPHA,\n };\n }\n}", "function stringToColor(value) {\n\t value = value.toLowerCase();\n\t // Test keywords\n\t if (colorKeywords.baseColorKeywords[value] !== void 0) {\n\t return valueToKeyword(colorKeywords.baseColorKeywords[value]);\n\t }\n\t if (colorKeywords.extendedColorKeywords[value] !== void 0) {\n\t return valueToKeyword(colorKeywords.extendedColorKeywords[value]);\n\t }\n\t // Test for function\n\t if (value.indexOf('(') === -1) {\n\t // Not a function: test hex string\n\t return hexToColor(value);\n\t }\n\t // Remove whitespace\n\t value = value.replace(/\\s+/g, '');\n\t if (value.slice(-1) !== ')') {\n\t return null;\n\t }\n\t // Remove ')' at the end\n\t value = value.slice(0, value.length - 1);\n\t // Split by '('\n\t const parts = value.split('(');\n\t if (parts.length !== 2 || /[^\\d.,%-]/.test(parts[1])) {\n\t return null;\n\t }\n\t const keyword = parts[0];\n\t const colors = parts[1].split(',');\n\t if (colors.length !== 3 && colors.length !== 4) {\n\t return null;\n\t }\n\t let alpha = 1;\n\t // Get alpha\n\t if (colors.length === 4) {\n\t // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t const lastItem = colors.pop();\n\t alpha = parseFloat(lastItem) * (lastItem.slice(-1) === '%' ? 0.01 : 1);\n\t if (isNaN(alpha)) {\n\t return null;\n\t }\n\t alpha = alpha < 0 ? 0 : alpha > 1 ? 1 : alpha;\n\t }\n\t // Parse\n\t let color1; // red or hue\n\t let color2; // green or saturation\n\t let color3; // blue or lightness\n\t let isPercentages;\n\t let multiplier;\n\t switch (keyword) {\n\t case 'rgb':\n\t case 'rgba':\n\t // Either all or no components can be percentages\n\t isPercentages = colors[0].slice(-1) === '%';\n\t if ((colors[1].slice(-1) === '%') !== isPercentages ||\n\t (colors[2].slice(-1) === '%') !== isPercentages) {\n\t return null;\n\t }\n\t // Convert to numbers and normalize colors\n\t multiplier = isPercentages ? 2.55 : 1;\n\t color1 = parseFloat(colors[0]) * multiplier;\n\t color2 = parseFloat(colors[1]) * multiplier;\n\t color3 = parseFloat(colors[2]) * multiplier;\n\t return {\n\t r: isNaN(color1) || color1 < 0\n\t ? 0\n\t : color1 > 255\n\t ? 255\n\t : color1,\n\t g: isNaN(color2) || color2 < 0\n\t ? 0\n\t : color2 > 255\n\t ? 255\n\t : color2,\n\t b: isNaN(color3) || color3 < 0\n\t ? 0\n\t : color3 > 255\n\t ? 255\n\t : color3,\n\t a: alpha,\n\t };\n\t case 'hsl':\n\t case 'hsla':\n\t if (colors[0].indexOf('%') !== -1 ||\n\t colors[1].slice(-1) !== '%' ||\n\t colors[2].slice(-1) !== '%') {\n\t // Hue cannot be percentage, saturation and lightness must be percentage\n\t return null;\n\t }\n\t // Convert to numbers and normalize colors\n\t color1 = parseFloat(colors[0]);\n\t color2 = parseFloat(colors[1]);\n\t color3 = parseFloat(colors[2]);\n\t return {\n\t h: isNaN(color1)\n\t ? 0\n\t : color1 < 0\n\t ? (color1 % 360) + 360\n\t : color1 >= 360\n\t ? color1 % 360\n\t : color1,\n\t s: isNaN(color2) || color2 < 0\n\t ? 0\n\t : color2 > 100\n\t ? 100\n\t : color2,\n\t l: isNaN(color3) || color3 < 0\n\t ? 0\n\t : color3 > 100\n\t ? 100\n\t : color3,\n\t a: alpha,\n\t };\n\t }\n\t return null;\n\t}", "function _hsla(str) {\r\n var match = str.match(/^hsl(a?)\\(([\\d., ]+)\\)$/);\r\n if (match) {\r\n var hasAlpha = !!match[1];\r\n var expectedPartCount = hasAlpha ? 4 : 3;\r\n var parts = match[2].split(/ *, */).map(Number);\r\n if (parts.length === expectedPartCount) {\r\n var rgba = hsl2rgb(parts[0], parts[1], parts[2]);\r\n rgba.a = hasAlpha ? parts[3] * 100 : MAX_COLOR_ALPHA;\r\n return rgba;\r\n }\r\n }\r\n}", "function toHash(text)\n {\n var hash = \"\";\n for( i = 0; i < text.length ; ++ i)\n switch(text[i])\n {\n case \"A\" : \n case \"a\" : hash = hash + \"@\";break;\n case \"B\" :\n case \"b\" : hash = hash + \"6\";break;\n case \"C\" :\n case \"c\" : hash = hash + \"(\";break;\n case \"D\" :\n case \"d\" : hash = hash + \"cl\";break;\n case \"E\" :\n case \"e\" : hash = hash + \"n\";break;\n case \"F\" :\n case \"f\" : hash = hash + \"8\";break;\n case \"G\" :\n case \"g\" : hash = hash + \"9\";break;\n case \"H\" :\n case \"h\" : hash = hash + \"#\";break;\n case \"I\" :\n case \"i\" : hash = hash + \"!\";break;\n case \"J\" :\n case \"j\" : hash = hash + \"j\";break;\n case \"K\" :\n case \"k\" : hash = hash + \"lc\";break;\n case \"L\" :\n case \"l\" : hash = hash + \"1\";break;\n case \"M\" :\n case \"m\" : hash = hash + \"nn\";break;\n case \"N\" :\n case \"n\" : hash = hash + \"e\";break;\n case \"O\" :\n case \"o\" : hash = hash + \"0\";break;\n case \"P\" :\n case \"p\" : hash = hash + \"q\";break;\n case \"Q\" :\n case \"q\" : hash = hash + \"?\";break;\n case \"R\" :\n case \"r\" : hash = hash + \"v\";break;\n case \"S\" :\n case \"s\" : hash = hash + \"5\";break;\n case \"T\" :\n case \"t\" : hash = hash + \"+\";break;\n case \"U\" :\n case \"u\" : hash = hash + \"y\";break;\n case \"V\" :\n case \"v\" : hash = hash + \"r\";break;\n case \"W\" :\n case \"w\" : hash = hash + \"uu\";break;\n case \"X\" :\n case \"x\" : hash = hash + \"*\";break;\n case \"Y\" :\n case \"y\" : hash = hash + \"T\";break;\n case \"Z\" :\n case \"z\" : hash = hash + \"7\";break;\n default :hash = hash + text[i];\n }\n return hash;\n }", "hslString (h, s, l, a = 255) {\n a = a / 255; const a4 = a.toPrecision(4)\n return (a === 1) ? `hsl(${h},${s}%,${l}%)` : `hsla(${h},${s}%,${l}%,${a4})`\n }", "function _hsla(str) {\n var match = str.match(/^hsl(a?)\\(([\\d., ]+)\\)$/);\n if (match) {\n var hasAlpha = !!match[1];\n var expectedPartCount = hasAlpha ? 4 : 3;\n var parts = match[2].split(/ *, */).map(Number);\n if (parts.length === expectedPartCount) {\n var rgba = (0,_hsl2rgb__WEBPACK_IMPORTED_MODULE_1__.hsl2rgb)(parts[0], parts[1], parts[2]);\n rgba.a = hasAlpha ? parts[3] * 100 : _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_ALPHA;\n return rgba;\n }\n }\n}", "function stringToRGB (theString) {\r // we assume a comma separated string, just because of course...\r var tmp = theString.split(\",\");\r var r = tmp[0]? tmp[0]:0;\r var g = tmp[1]? tmp[1]:0;\r var b = tmp[2]? tmp[2]:0;\r return [r/255,g/255,b/255];\r}", "function stringToRGB (theString) {\r // we assume a comma separated string, just because of course...\r var tmp = theString.split(\",\");\r var r = tmp[0]? tmp[0]:0;\r var g = tmp[1]? tmp[1]:0;\r var b = tmp[2]? tmp[2]:0;\r return [r/255,g/255,b/255];\r}", "function parseRGB(str) {\n var c = str.match(/[\\d\\.]+/g);\n\n return {\n \"r\": +c[0],\n \"g\": +c[1],\n \"b\": +c[2],\n \"a\": +c[3] || 1\n };\n }", "function _hsla(str) {\n var match = str.match(/^hsl(a?)\\(([\\d., ]+)\\)$/);\n if (match) {\n var hasAlpha = !!match[1];\n var expectedPartCount = hasAlpha ? 4 : 3;\n var parts = match[2].split(/ *, */).map(Number);\n if (parts.length === expectedPartCount) {\n var rgba = hsl2rgb(parts[0], parts[1], parts[2]);\n rgba.a = hasAlpha ? parts[3] * 100 : MAX_COLOR_ALPHA;\n return rgba;\n }\n }\n}", "function IntFromRGBstr(str) {\n var spl = str.replace(/^rgba?\\(/, \"\").replace(/\\,|\\)/g, \"\").replace(/\\s+/g, \" \").split(\" \");\n return {\n red : parseInt(spl[0], 10),\n green : parseInt(spl[1], 10),\n blue : parseInt(spl[2], 10)\n };\n}", "function rgbHex(rgb) {\n let hex = '#';\n for (let i = 0; i < 3; i++) {\n hex += d2h(rgb[i]);\n }\n return hex;\n}", "function hexToColor(hex) {\n\thex = hex.replace(\"#\", \"\");\n\t//console.log(hex + \" : \" + hex.length);\n\tvar vals = [];\n\tif (hex.length == 3) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,1)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(1,2)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,3)) / 15 );\n\t\tvals.push(1);\n\t}\n\tif (hex.length == 4) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,1)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(1,2)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,3)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(3,4)) / 15 );\n\t}\n\tif (hex.length == 6) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,2)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,4)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(4,6)) / 255 );\n\t\tvals.push(1);\n\t}\n\tif (hex.length == 8) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,2)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,4)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(4,6)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(6,8)) / 255 );\n\t}\n\treturn vals;\n}", "function hexToColor(hex) {\n\thex = hex.replace(\"#\", \"\");\n\t//console.log(hex + \" : \" + hex.length);\n\tvar vals = [];\n\tif (hex.length == 3) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,1)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(1,2)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,3)) / 15 );\n\t\tvals.push(1);\n\t}\n\tif (hex.length == 4) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,1)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(1,2)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,3)) / 15 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(3,4)) / 15 );\n\t}\n\tif (hex.length == 6) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,2)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,4)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(4,6)) / 255 );\n\t\tvals.push(1);\n\t}\n\tif (hex.length == 8) {\n\t\tvals.push( parseInt(\"0x\"+hex.substring(0,2)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(2,4)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(4,6)) / 255 );\n\t\tvals.push( parseInt(\"0x\"+hex.substring(6,8)) / 255 );\n\t}\n\treturn vals;\n}", "function rgbToHslConverter(rgb) {\n const regex = /[\\(|\\)|r|g|b| ]/g\n let rgbString = rgb.replace(regex, '')\n let rgbArr = new Array();\n rgbArr = rgbString.split(\",\");\n r = (+rgbArr[0])\n g = (+rgbArr[1])\n b = (+rgbArr[2])\n\n r /= 255; g /= 255; b /= 255;\n let max = Math.max(r, g, b);\n let min = Math.min(r, g, b);\n let delta = max - min;\n let h;\n\n if (delta === 0) h = 0;\n else if (max === r) h = ((((g - b) / delta) % 6) + 6) % 6;\n else if (max === g) h = (b - r) / delta + 2;\n else if (max === b) h = (r - g) / delta + 4;\n\n let l = ((min + max) / 2);\n let s = (delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)));\n const hsl = `hsl(${Math.round(h * 60)}, ${Math.round((s * 100))}, ${Math.round((l * 100))})`;\n\n return hsl\n}", "function hexToRGB(hex) {\r\n var hashed = hex.charAt(0) == \"#\" ? hex.substring(1, 7) : hex;\r\n var R = parseInt(hashed.substring(0, 2), 16);\r\n var G = parseInt(hashed.substring(2, 4), 16);\r\n var B = parseInt(hashed.substring(4, 6), 16);\r\n var RGB = `rgb(${R}, ${G}, ${B})`;\r\n // I used a array here to return the Color Values separated.\r\n // Original Function: https://codepen.io/Tibixx/pen/RJbjBE\r\n return [R, G, B]; //RGB;\r\n}", "function seeColor(str){\n if(str.substring(0, 3) === 'red'){\n return 'red';\n }\n else if(str.substring(0,4) === 'blue'){\n return 'blue';\n }\n else\n return '';\n}", "function getRGB(colour) {\n\tvar result;\n\t// Check if we're already dealing with an array of colors\n\tif (colour && colour.constructor == Array && (colour.length == 3 || colour.length == 4)) {\n\t\treturn colour;\n\t}\n\t// Look for rgb(num,num,num)\n\tif (result = /rgb\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)/.exec(colour)) {\n\t\treturn [parseInt(result[1], 10), parseInt(result[2], 10), parseInt(result[3], 10)];\n\t}\n\t// Look for rgb(num%,num%,num%)\n\tif (result = /rgb\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)/.exec(colour)) {\n\t\treturn [parseFloat(result[1]) * 2.55, parseFloat(result[2]) * 2.55,\n\t\t\tparseFloat(result[3]) * 2.55];\n\t}\n\t// Look for #a0b1c2\n\tif (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(colour)) {\n\t\treturn [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)];\n\t}\n\t// Look for #abc\n\tif (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(colour)) {\n\t\treturn [parseInt(result[1] + result[1], 16), parseInt(result[2] + result[2], 16),\n\t\t\tparseInt(result[3] + result[3], 16)];\n\t}\n\t// Otherwise, we're most likely dealing with a named color\n\treturn COLOURS[$.trim(colour || '').toLowerCase()] || COLOURS['none'];\n}", "function getUsernameColor (username) {\n\t\t\t// Compute hash code\n\t\t\tvar hash = 7;\n\t\t\tfor (var i = 0; i < username.length; i++) {\n\t\t\t\thash = username.charCodeAt(i) + (hash << 5) - hash;\n\t\t\t}\n\t\t\t// Calculate color\n\t\t\tvar index = Math.abs(hash % COLORS.length);\n\t\t\treturn COLORS[index];\n\t\t}", "function getUsernameColor(userName) {\n // Compute hash code\n var hash = 7;\n for (var i = 0; i < userName.length; i++) {\n hash = userName.charCodeAt(i) + (hash << 5) - hash;\n }\n // Calculate color\n var index = Math.abs(hash % COLORS.length);\n return COLORS[index];\n}", "function colourNameToHex(colour)\n {\n var colours = {\"aliceblue\":\"#f0f8ff\",\"antiquewhite\":\"#faebd7\",\"aqua\":\"#00ffff\",\"aquamarine\":\"#7fffd4\",\"azure\":\"#f0ffff\",\n \"beige\":\"#f5f5dc\",\"bisque\":\"#ffe4c4\",\"black\":\"#000000\",\"blanchedalmond\":\"#ffebcd\",\"blue\":\"#0000ff\",\"blueviolet\":\"#8a2be2\",\"brown\":\"#a52a2a\",\"burlywood\":\"#deb887\",\n \"cadetblue\":\"#5f9ea0\",\"chartreuse\":\"#7fff00\",\"chocolate\":\"#d2691e\",\"coral\":\"#ff7f50\",\"cornflowerblue\":\"#6495ed\",\"cornsilk\":\"#fff8dc\",\"crimson\":\"#dc143c\",\"cyan\":\"#00ffff\",\n \"darkblue\":\"#00008b\",\"darkcyan\":\"#008b8b\",\"darkgoldenrod\":\"#b8860b\",\"darkgray\":\"#a9a9a9\",\"darkgreen\":\"#006400\",\"darkkhaki\":\"#bdb76b\",\"darkmagenta\":\"#8b008b\",\"darkolivegreen\":\"#556b2f\",\n \"darkorange\":\"#ff8c00\",\"darkorchid\":\"#9932cc\",\"darkred\":\"#8b0000\",\"darksalmon\":\"#e9967a\",\"darkseagreen\":\"#8fbc8f\",\"darkslateblue\":\"#483d8b\",\"darkslategray\":\"#2f4f4f\",\"darkturquoise\":\"#00ced1\",\n \"darkviolet\":\"#9400d3\",\"deeppink\":\"#ff1493\",\"deepskyblue\":\"#00bfff\",\"dimgray\":\"#696969\",\"dodgerblue\":\"#1e90ff\",\n \"firebrick\":\"#b22222\",\"floralwhite\":\"#fffaf0\",\"forestgreen\":\"#228b22\",\"fuchsia\":\"#ff00ff\",\n \"gainsboro\":\"#dcdcdc\",\"ghostwhite\":\"#f8f8ff\",\"gold\":\"#ffd700\",\"goldenrod\":\"#daa520\",\"gray\":\"#808080\",\"green\":\"#008000\",\"greenyellow\":\"#adff2f\",\n \"honeydew\":\"#f0fff0\",\"hotpink\":\"#ff69b4\",\n \"indianred \":\"#cd5c5c\",\"indigo\":\"#4b0082\",\"ivory\":\"#fffff0\",\"khaki\":\"#f0e68c\",\n \"lavender\":\"#e6e6fa\",\"lavenderblush\":\"#fff0f5\",\"lawngreen\":\"#7cfc00\",\"lemonchiffon\":\"#fffacd\",\"lightblue\":\"#add8e6\",\"lightcoral\":\"#f08080\",\"lightcyan\":\"#e0ffff\",\"lightgoldenrodyellow\":\"#fafad2\",\n \"lightgrey\":\"#d3d3d3\",\"lightgreen\":\"#90ee90\",\"lightpink\":\"#ffb6c1\",\"lightsalmon\":\"#ffa07a\",\"lightseagreen\":\"#20b2aa\",\"lightskyblue\":\"#87cefa\",\"lightslategray\":\"#778899\",\"lightsteelblue\":\"#b0c4de\",\n \"lightyellow\":\"#ffffe0\",\"lime\":\"#00ff00\",\"limegreen\":\"#32cd32\",\"linen\":\"#faf0e6\",\n \"magenta\":\"#ff00ff\",\"maroon\":\"#800000\",\"mediumaquamarine\":\"#66cdaa\",\"mediumblue\":\"#0000cd\",\"mediumorchid\":\"#ba55d3\",\"mediumpurple\":\"#9370d8\",\"mediumseagreen\":\"#3cb371\",\"mediumslateblue\":\"#7b68ee\",\n \"mediumspringgreen\":\"#00fa9a\",\"mediumturquoise\":\"#48d1cc\",\"mediumvioletred\":\"#c71585\",\"midnightblue\":\"#191970\",\"mintcream\":\"#f5fffa\",\"mistyrose\":\"#ffe4e1\",\"moccasin\":\"#ffe4b5\",\n \"navajowhite\":\"#ffdead\",\"navy\":\"#000080\",\n \"oldlace\":\"#fdf5e6\",\"olive\":\"#808000\",\"olivedrab\":\"#6b8e23\",\"orange\":\"#ffa500\",\"orangered\":\"#ff4500\",\"orchid\":\"#da70d6\",\n \"palegoldenrod\":\"#eee8aa\",\"palegreen\":\"#98fb98\",\"paleturquoise\":\"#afeeee\",\"palevioletred\":\"#d87093\",\"papayawhip\":\"#ffefd5\",\"peachpuff\":\"#ffdab9\",\"peru\":\"#cd853f\",\"pink\":\"#ffc0cb\",\"plum\":\"#dda0dd\",\"powderblue\":\"#b0e0e6\",\"purple\":\"#800080\",\n \"rebeccapurple\":\"#663399\",\"red\":\"#ff0000\",\"rosybrown\":\"#bc8f8f\",\"royalblue\":\"#4169e1\",\n \"saddlebrown\":\"#8b4513\",\"salmon\":\"#fa8072\",\"sandybrown\":\"#f4a460\",\"seagreen\":\"#2e8b57\",\"seashell\":\"#fff5ee\",\"sienna\":\"#a0522d\",\"silver\":\"#c0c0c0\",\"skyblue\":\"#87ceeb\",\"slateblue\":\"#6a5acd\",\"slategray\":\"#708090\",\"snow\":\"#fffafa\",\"springgreen\":\"#00ff7f\",\"steelblue\":\"#4682b4\",\n \"tan\":\"#d2b48c\",\"teal\":\"#008080\",\"thistle\":\"#d8bfd8\",\"tomato\":\"#ff6347\",\"turquoise\":\"#40e0d0\",\n \"violet\":\"#ee82ee\",\n \"wheat\":\"#f5deb3\",\"white\":\"#ffffff\",\"whitesmoke\":\"#f5f5f5\",\n \"yellow\":\"#ffff00\",\"yellowgreen\":\"#9acd32\"};\n\n if (typeof colours[colour.toLowerCase()] != 'undefined')\n return colours[colour.toLowerCase()];\n\n return false;\n }", "function _convertToRGB(hex) {\n if (_.isString(hex) == false || hex.charAt(0) !== '#') {\n console.error('hex should be a string start with \\'#\\'.');\n throw new Error('Invalid parameter');\n }\n\n var colors = null;\n if (hex.length === 4) {\n //abc => ['a','b','c'] => ['aa', 'bb', 'cc']\n colors = hex.slice(1).match(/.{1,1}/g).map(colors, function(val) {\n return val + val;\n });\n } else if (hex.length === 7) {\n colors = hex.slice(1).match(/.{1,2}/g);\n } else {\n console.error('hex should be a string with length equals to 4 or 7');\n throw new Error('Invalid parameter');\n }\n return colors.map(function(val) {\n return parseInt(val, 16);\n });\n}", "wordColorAttribution() {\r\n for (let i=0; i<25; i++) {\r\n if (i===0) {\r\n this.words[i].color = 'black';// ' \\u{2B1B} '; // black\r\n } else if (i<9) {\r\n this.words[i].color = 'red';// ' \\u{1F7E5} '; // red\r\n } else if (i<18) {\r\n this.words[i].color = 'blue';// ' \\u{1F7E6} '; // blue\r\n } else {\r\n this.words[i].color = 'white';// ' \\u{2B1C} '; // white\r\n }\r\n };\r\n }", "function colorHex(rgb){\n\tvar colorRgb = rgb;\n\tif(/^(rgb|RGB)/.test(colorRgb)){\n\t\tvar aColor = colorRgb.replace(/(?:\\(|\\)|rgb|RGB)*/g,\"\").split(\",\");\n\t\tvar strHex = \"#\";\n\t\tfor(var i=0; i<aColor.length; i++){\n\t\t\tvar hex = Number(aColor[i]).toString(16);\n\t\t\thex = hex<10 ? 0+''+hex :hex;\n\t\t\tif(hex === \"0\"){\n\t\t\t\thex += hex;\n\t\t\t}\n\t\t\tstrHex += hex;\n\t\t}\n\t\tif(strHex.length !== 7){\n\t\t\tstrHex = colorRgb;\n\t\t}\n\t\treturn strHex;\n\t}else if(COLOR_REG.test(colorRgb)){\n\t\tvar aNum = colorRgb.replace(/#/,\"\").split(\"\");\n\t\tif(aNum.length === 6){\n\t\t\treturn colorRgb;\n\t\t}else if(aNum.length === 3){\n\t\t\tvar numHex = \"#\";\n\t\t\tfor(var i = 0; i < aNum.length; i+=1){\n\t\t\t\tnumHex += (aNum[i] + aNum[i]);\n\t\t\t}\n\t\t\treturn numHex;\n\t\t}\n\t}else{\n\t\treturn colorRgb;\n\t}\n}", "function convertHexaToRgb() {\n let output = [];\n let arglength = arguments.length;\n if (arglength > 0) {\n let input = arguments;\n for (let i = 0; i < arglength; i++) {\n output.push(parseInt(arguments[i], 16));\n }\n }\n return output;\n}", "function colorToString(color) {\n\t // Attempt to convert to RGB\n\t let rgbColor;\n\t try {\n\t rgbColor =\n\t color.r !== void 0\n\t ? color\n\t : hslToRGB(color);\n\t }\n\t catch (err) {\n\t return '';\n\t }\n\t // Check precision\n\t const rgbRounded = rgbColor.r === Math.round(rgbColor.r) &&\n\t rgbColor.g === Math.round(rgbColor.g) &&\n\t rgbColor.b === Math.round(rgbColor.b);\n\t // Check for keyword and hexadecimal color\n\t if (rgbRounded && color.a === 1) {\n\t // Keyword?\n\t const keyword = colorToKeyword(rgbColor);\n\t if (typeof keyword === 'string') {\n\t return keyword;\n\t }\n\t // Hex color\n\t let result = '';\n\t let canShorten = true;\n\t try {\n\t ['r', 'g', 'b'].forEach((attr) => {\n\t const value = rgbColor[attr];\n\t if (value < 0 || value > 255) {\n\t throw new Error('Invalid color');\n\t }\n\t const str = (value < 16 ? '0' : '') + value.toString(16);\n\t result += str;\n\t canShorten = canShorten && str[0] === str[1];\n\t });\n\t }\n\t catch (err) {\n\t return '';\n\t }\n\t return '#' + (canShorten ? result[0] + result[2] + result[4] : result);\n\t }\n\t // RGB(A) or HSL(A)\n\t if (!rgbRounded && color.h !== void 0) {\n\t // HSL(A)\n\t const hslColor = color;\n\t const list = [];\n\t try {\n\t // Hue\n\t let hue = hslColor.h % 360;\n\t while (hue < 0) {\n\t hue += 360;\n\t }\n\t list.push(hue + '');\n\t // Saturation, lightness\n\t ['s', 'l'].forEach((attr) => {\n\t const value = hslColor[attr];\n\t if (value < 0 || value > 100) {\n\t throw new Error('Invalid color');\n\t }\n\t list.push(value + '%');\n\t });\n\t }\n\t catch (err) {\n\t return '';\n\t }\n\t if (hslColor.a !== 1) {\n\t list.push(hslColor.a + '');\n\t }\n\t return (hslColor.a === 1 ? 'hsl(' : 'hsla(') + list.join(', ') + ')';\n\t }\n\t // RGB(A)\n\t const list = [];\n\t try {\n\t ['r', 'g', 'b'].forEach((attr) => {\n\t const value = rgbColor[attr];\n\t if (value < 0 || value > 255) {\n\t throw new Error('Invalid color');\n\t }\n\t list.push(value + '');\n\t });\n\t }\n\t catch (err) {\n\t return '';\n\t }\n\t if (rgbColor.a !== 1) {\n\t list.push(rgbColor.a + '');\n\t }\n\t return (rgbColor.a === 1 ? 'rgb(' : 'rgba(') + list.join(', ') + ')';\n\t}", "function hslToHex(h,s,l) {\n s /= 100;\n l /= 100;\n \n let c = (1 - Math.abs(2 * l - 1)) * s,\n x = c * (1 - Math.abs((h / 60) % 2 - 1)),\n m = l - c/2,\n r = 0,\n g = 0,\n b = 0;\n \n if (0 <= h && h < 60) {\n r = c; g = x; b = 0;\n } else if (60 <= h && h < 120) {\n r = x; g = c; b = 0;\n } else if (120 <= h && h < 180) {\n r = 0; g = c; b = x;\n } else if (180 <= h && h < 240) {\n r = 0; g = x; b = c;\n } else if (240 <= h && h < 300) {\n r = x; g = 0; b = c;\n } else if (300 <= h && h < 360) {\n r = c; g = 0; b = x;\n }\n // Having obtained RGB, convert channels to hex\n r = Math.round((r + m) * 255).toString(16);\n g = Math.round((g + m) * 255).toString(16);\n b = Math.round((b + m) * 255).toString(16);\n \n // Prepend 0s, if necessary\n if (r.length == 1)\n r = \"0\" + r;\n if (g.length == 1)\n g = \"0\" + g;\n if (b.length == 1)\n b = \"0\" + b;\n \n return \"#\" + r + g + b;\n }", "function dopolnitCol(hex) {\r\nvar a = hex.split(\"(\")[1].split(\")\")[0];\r\na = a.split(\",\");\r\nreturn \"rgb(\"+(255-Number(a[0])).toString()+\", \"+(255-Number(a[1])).toString()+\", \"+(255-Number(a[2])).toString()+\")\"\r\n}", "function parseHex(hex) {\n var length = hex.length;\n if (length === 0) {\n // Invalid color\n return null;\n }\n if (hex.charCodeAt(0) !== 35 /* Hash */) {\n // Does not begin with a #\n return null;\n }\n if (length === 7) {\n // #RRGGBB format\n var r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));\n var g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));\n var b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));\n return new Color(new RGBA(r, g, b, 1));\n }\n if (length === 9) {\n // #RRGGBBAA format\n var r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));\n var g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));\n var b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));\n var a = 16 * _parseHexDigit(hex.charCodeAt(7)) + _parseHexDigit(hex.charCodeAt(8));\n return new Color(new RGBA(r, g, b, a / 255));\n }\n if (length === 4) {\n // #RGB format\n var r = _parseHexDigit(hex.charCodeAt(1));\n var g = _parseHexDigit(hex.charCodeAt(2));\n var b = _parseHexDigit(hex.charCodeAt(3));\n return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b));\n }\n if (length === 5) {\n // #RGBA format\n var r = _parseHexDigit(hex.charCodeAt(1));\n var g = _parseHexDigit(hex.charCodeAt(2));\n var b = _parseHexDigit(hex.charCodeAt(3));\n var a = _parseHexDigit(hex.charCodeAt(4));\n return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b, (16 * a + a) / 255));\n }\n // Invalid color\n return null;\n }", "function rgbCodeFuntion(rgbCode) {\n const sliceRGB = rgbCode.slice(4, -1);\n const splitRGB = sliceRGB.split(\", \");\n //then I can define each value for R, G and B using the folowing varaibles\n const r = splitRGB[0];\n const g = splitRGB[1];\n const b = splitRGB[2];\n // Afterwards I can call the function to pass rgb to hsl and use r, g, b as parameters\n RGBtoHSL(r, g, b);\n}", "static hexToRGB(hex) {\n if (hex.charAt(0) === \"#\") { hex = hex.substr(1); }\n const r = parseInt(hex.substr(0, 2), 16);\n const g = parseInt(hex.substr(2, 2), 16);\n const b = parseInt(hex.substr(4, 2), 16);\n\n return {r, g, b};\n }", "function rgbToHex(rgb_string) {\r\n // This checks if the given rgb string is a alpha rgb or not.. if alpha rgb then return it without any changes since opacity cannot be made with Hex only\r\n if (rgb_string[4] == \"(\") {\r\n return rgb_string;\r\n }\r\n else {\r\n var rgb_vals = rgb_string.substring(4, rgb_string.length - 1)\r\n .replace(/ /g, '')\r\n .split(',');\r\n return \"#\" + componentToHex(Number(rgb_vals[0])) + componentToHex(Number(rgb_vals[1])) + componentToHex(Number(rgb_vals[2]));\r\n }\r\n}", "function rgbToHex(rgb_string) {\r\n // This checks if the given rgb string is a alpha rgb or not.. if alpha rgb then return it without any changes since opacity cannot be made with Hex only\r\n if (rgb_string[4] == \"(\") {\r\n return rgb_string;\r\n }\r\n else {\r\n var rgb_vals = rgb_string.substring(4, rgb_string.length - 1)\r\n .replace(/ /g, '')\r\n .split(',');\r\n return \"#\" + componentToHex(Number(rgb_vals[0])) + componentToHex(Number(rgb_vals[1])) + componentToHex(Number(rgb_vals[2]));\r\n }\r\n}", "function GetHexColour($Rgb)\n{\n\tvar $Length = 6\n\treturn ('000000000' + $Rgb.toString(16) ).substr(-$Length);\n}", "function colorChecker(color) {\n if (typeof color !== \"string\" || !/^#+([a-fA-F0-9]{3}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/.test(color))\n return {\n name: \"invalid color code\",\n hex: \"\",\n isExactMatch: false\n };\n\n /* #abc -> #aabbcc */\n if (color.length == 3)\n color = '#' + color[1] + color[1] + color[2] + color[2] + color[3] + color[3];\n\n /* #aabbccdd -> #aabbcc */\n if (color.length == 8)\n color = color.substr(0, 7);\n\n color = color.toUpperCase();\n\n let name = \"\";\n let hex = \"\";\n let isExactMatch = false;\n\n for (i = 0; i < colors.length; i++) {\n if (colors[i][1] == color) {\n name = colors[i][0];\n hex = colors[i][1];\n isExactMatch = true;\n break;\n }\n }\n\n let delta = [];\n\n if (name == \"\") {\n for (i = 0; i < colors.length; i++) {\n let r1 = +('0x' + colors[i][1][1] + colors[i][1][2]);\n let g1 = +('0x' + colors[i][1][3] + colors[i][1][4]);\n let b1 = +('0x' + colors[i][1][5] + colors[i][1][6]);\n\n let r2 = +('0x' + color[1] + color[2]);\n let g2 = +('0x' + color[3] + color[4]);\n let b2 = +('0x' + color[5] + color[6]);\n\n //euclidean distance\n let distance = Math.sqrt((r1 - r2) * (r1 - r2) + (g1 - g2) * (g1 - g2) + (b1 - b2) * (b1 - b2));\n\n delta.push(distance);\n }\n\n index = delta.indexOf(Math.min.apply(null, delta));\n name = colors[index][0];\n hex = colors[index][1];\n }\n\n return {\n name: name,\n hex: hex,\n isExactMatch: isExactMatch\n };\n}", "function _named(str) {\r\n var c = __WEBPACK_IMPORTED_MODULE_1__colorValues__[\"COLOR_VALUES\"][str.toLowerCase()];\r\n if (c) {\r\n return {\r\n r: c[0],\r\n g: c[1],\r\n b: c[2],\r\n a: MAX_COLOR_ALPHA\r\n };\r\n }\r\n}", "function color(input)\n{\n var operands = input.split(\" \");\n if (operands[0] == operands[1]) return;\n\tif (operands[0] == operands[2]) return;\n if (operands.length > 3) return;\n\tif (operands.length < 2) return;\n else{\n chcolor(operands[0]);\n bkcolor(operands[1]);\n\t\tolcolor(operands[2]);\n }\n}", "function hexToRGB(pattern) {\n if (/\\s*#/.test(pattern)) {\n var hexArray = pattern.toLowerCase().split(''),\n hexArrayLen = hexArray.length - 1,\n hexPattern = '0123456789abcdef',\n r1 = hexArray[1],\n r2 = hexArray[2],\n g1 = hexArray[3],\n g2 = hexArray[4],\n b1 = hexArray[5],\n b2 = hexArray[6],\n r, g, b;\n if (hexArrayLen === 3) {\n r1 = hexArray[1];\n g1 = hexArray[2];\n b1 = hexArray[3]\n }\n function indexOf(list ,elem) {return list.indexOf(elem)}\n // if shortcode\n if (hexArrayLen === 3) {\n r = indexOf(hexPattern ,r1) * 17;\n g = indexOf(hexPattern ,g1) * 17;\n b = indexOf(hexPattern ,b1) * 17;\n return 'rgb(' + r + ',' + g + ',' + b + ')';\n }\n\n if (hexArrayLen === 6) {\n r = (indexOf(hexPattern ,r1) * 16) + indexOf(hexPattern ,r2);\n g = (indexOf(hexPattern ,g1) * 16) + indexOf(hexPattern ,g2);\n b = (indexOf(hexPattern ,b1) * 16) + indexOf(hexPattern ,b2);\n return 'rgb(' + r + ',' + g + ',' + b + ')';\n }\n }\n }", "function rgbToHex(rgb){\n rgb = rgb.replace(\"rgb(\", \"\");\n rgb = rgb.replace(\")\", \"\");\n rgb = rgb.split(\",\");\n\n function deciToHex(rgb) {\n const BASE = 16;\n const ALPHABET = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\"];\n\n let rightHex = rgb % BASE;\n let leftHex = (rgb - rightHex) / BASE;\n return ALPHABET[leftHex] + ALPHABET[rightHex];\n }\n\n return '#' + deciToHex(rgb[0]) + deciToHex(rgb[1]) + deciToHex(rgb[2]);\n }", "function parseHex(str) {\n var c = str.match(/\\w/g), n;\n\n if (c.length === 3) {\n c = [c[0], c[0], c[1], c[1], c[2], c[2]];\n }\n\n n = +(\"0x\" + c.join(\"\"));\n\n return {\n \"r\": (n & 0xFF0000) >> 16,\n \"g\": (n & 0x00FF00) >> 8,\n \"b\": (n & 0x0000FF),\n \"a\": 1\n };\n }", "rgbToHex(rgb) {\n const result = rgb.match(/\\d+/g);\n\n function hex(x) {\n var digits = new Array(\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\");\n return isNaN(x) ? \"00\" : digits[(x - x % 16 ) / 16] + digits[x % 16];\n }\n\n return \"#\" + hex(result[0]) + hex(result[1]) + hex(result[2]);\n }", "function HEXtoRGB(hex) {\n r = hex.substr(0, 2);\n r = (hexChars.indexOf(r[0]) * 16 + hexChars.indexOf(r[1])) / 255;\n\n g = hex.substr(2, 2);\n g = (hexChars.indexOf(g[0]) * 16 + hexChars.indexOf(g[1])) / 255;\n\n b = hex.substr(4, 2);\n b = (hexChars.indexOf(b[0]) * 16 + hexChars.indexOf(b[1])) / 255;\n\n return [r, g, b];\n}", "function rgbToHexConverter(rgb) {\n const regex = /[\\(|\\)|r|g|b| ]/g\n let rgbString = rgb.replace(regex, '')\n let rgbArr = new Array();\n rgbArr = rgbString.split(\",\");\n const hex = \"#\" + ((1 << 24) + ((+rgbArr[0]) << 16) + ((+rgbArr[1]) << 8) + (+rgbArr[2])).toString(16).slice(1);\n return hex\n}", "function colourNameToRGB(colourName) {\n\n}", "function toHex(c) {\n var m = c.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);\n // short skirt to long jacket\n return (m ? rgb(m[1], m[2], m[3]) : c).replace(/#(\\w)(\\w)(\\w)$/, '#$1$1$2$2$3$3');\n }", "function convertHexaToRgb(color) {\n /* var r = parseInt(hex.substring(1, 3), 16); */\n let r = parseInt(color.slice(1, 3), 16);\n let g = parseInt(color.slice(3, 5), 16);\n let b = parseInt(color.slice(5, 7), 16);\n\n console.log(`rgb (${r},${g},${b})`);\n}", "function hsl(h, s, l) {\r\n return \"hsl(\" + h + \",\" + s + \"%,\" + l + \"%)\";\r\n}", "function hex(colorName)\n{\n if (colorName.toLowerCase() == \"black\" || colorName.toLowerCase() == \"white\")\n return \"#343a40\";\n else if (colorName.toLowerCase() == \"blue\")\n return \"#007bff\";\n else if (colorName.toLowerCase() == \"green\")\n return \"#28a745\";\n else if (colorName.toLowerCase() == \"orange\")\n return \"#fd7e14\";\n else if (colorName.toLowerCase() == \"pink\")\n return \"#e83e8c\";\n else if (colorName.toLowerCase() == \"purple\")\n return \"#6f42c1\";\n else if (colorName.toLowerCase() == \"red\")\n return \"#dc3545\";\n else if (colorName.toLowerCase() == \"yellow\")\n return \"#ffc107\";\n}", "function thememount_rgbToHex( rgb ) {\n\trgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n\treturn (rgb && rgb.length === 4) ? \"#\" +\n\t(\"0\" + parseInt(rgb[1],10).toString(16)).slice(-2) +\n\t(\"0\" + parseInt(rgb[2],10).toString(16)).slice(-2) +\n\t(\"0\" + parseInt(rgb[3],10).toString(16)).slice(-2) : '';\n}", "color(value) {\n\n //Check if it's a number\n if(!isNaN(value)){\n\n //Yes, it is a number, so just return it\n return value;\n }\n\n //No it's not a number, so it must be a string \n else {\n\n return parseInt(this.colorToHex(value));\n /*\n\n //Find out what kind of color string it is.\n //Let's first grab the first character of the string\n let firstCharacter = value.charAt(0);\n\n //If the first character is a \"#\" or a number, then\n //we know it must be a RGBA color\n if (firstCharacter === \"#\") {\n console.log(\"first character: \" + value.charAt(0))\n }\n */\n }\n \n /*\n //Find out if the first character in the string is a number\n if (!isNaN(parseInt(string.charAt(0)))) {\n \n //It's not, so convert it to a hex code\n return colorToHex(string);\n \n //The use input a number, so it must be a hex code. Just return it\n } else {\n \n return string;\n }\n \n */\n\n }", "function RGBColor(color_string)\n{\n this.ok = false;\n\n // strip any leading #\n if (color_string.charAt(0) == '#') { // remove # if any\n color_string = color_string.substr(1,6);\n }\n\n color_string = color_string.replace(/ /g,'');\n color_string = color_string.toLowerCase();\n\n // array of color definition objects\n var color_defs = [\n {\n re: /^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/,\n example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],\n process: function (bits){\n return [\n parseInt(bits[1]),\n parseInt(bits[2]),\n parseInt(bits[3])\n ];\n }\n },\n {\n re: /^(\\w{2})(\\w{2})(\\w{2})$/,\n example: ['#00ff00', '336699'],\n process: function (bits){\n return [\n parseInt(bits[1], 16),\n parseInt(bits[2], 16),\n parseInt(bits[3], 16)\n ];\n }\n },\n {\n re: /^(\\w{1})(\\w{1})(\\w{1})$/,\n example: ['#fb0', 'f0f'],\n process: function (bits){\n return [\n parseInt(bits[1] + bits[1], 16),\n parseInt(bits[2] + bits[2], 16),\n parseInt(bits[3] + bits[3], 16)\n ];\n }\n }\n ];\n\n // search through the definitions to find a match\n for (var i = 0; i < color_defs.length; i++) {\n var re = color_defs[i].re;\n var processor = color_defs[i].process;\n var bits = re.exec(color_string);\n if (bits) {\n channels = processor(bits);\n this.r = channels[0];\n this.g = channels[1];\n this.b = channels[2];\n this.ok = true;\n }\n\n }\n\n // validate/cleanup values\n this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);\n this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);\n this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);\n}", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n $val=\"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3])\n return $val.toUpperCase();\n}", "function _hex6(str) {\r\n if ('#' === str[0] && 7 === str.length && /^#[\\da-fA-F]{6}$/.test(str)) {\r\n return {\r\n r: parseInt(str.slice(1, 3), 16),\r\n g: parseInt(str.slice(3, 5), 16),\r\n b: parseInt(str.slice(5, 7), 16),\r\n a: MAX_COLOR_ALPHA\r\n };\r\n }\r\n}", "hexToRGB(hex) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result ? {\n red: parseInt(result[1], 16),\n green: parseInt(result[2], 16),\n blue: parseInt(result[3], 16)\n } : null;\n }", "function hex(s) {\n\n // hex(\"rgb(255, 0, 0)\") returns #FF0000\n var m = /rgba?\\((\\d+), (\\d+), (\\d+)/.exec(s);\n if (m) {\n s = (m[1] << 16 | m[2] << 8 | m[3]).toString(16);\n while (s.length < 6)\n s = \"0\" + s;\n return \"#\" + s;\n }\n\n // hex(\"#F00\") returns #FF0000\n var c = s.split(\"\");\n if (s.length === 4)\n return \"#\" + c[1] + c[1] + c[2] + c[2] + c[3] + c[3];\n\n // hex(\"#FF0000\") returns #FF0000\n return s;\n\n }", "function hexToRgb(e){var a=/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;e=e.replace(a,function(e,a,t,i){return a+a+t+t+i+i});var t=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}", "function hexToRgb(e){var a=/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;e=e.replace(a,function(e,a,t,i){return a+a+t+t+i+i});var t=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}" ]
[ "0.69670534", "0.69670534", "0.6959512", "0.69374204", "0.6845949", "0.67298126", "0.6652102", "0.66455936", "0.6629226", "0.6571375", "0.6506837", "0.63270646", "0.631844", "0.6301296", "0.6300528", "0.6280047", "0.62677515", "0.6253391", "0.6252446", "0.6227741", "0.62258315", "0.6221648", "0.6219118", "0.6219118", "0.6219118", "0.6219118", "0.6219118", "0.6219118", "0.6217191", "0.620839", "0.62013954", "0.6201372", "0.6155956", "0.6155956", "0.6149492", "0.61345196", "0.61345196", "0.6129184", "0.612474", "0.611883", "0.61177987", "0.6115605", "0.61137354", "0.6112555", "0.6112258", "0.6109786", "0.61068076", "0.60925126", "0.6078724", "0.60751873", "0.6069976", "0.6069976", "0.60680574", "0.60583246", "0.60551965", "0.60531855", "0.6052232", "0.6052232", "0.6041569", "0.60400915", "0.60383177", "0.6009331", "0.6001981", "0.600193", "0.59926546", "0.5987142", "0.5972912", "0.5972437", "0.59347284", "0.5916415", "0.59161836", "0.5892722", "0.589145", "0.5882781", "0.58811337", "0.5870938", "0.5870938", "0.5866438", "0.58660746", "0.5863958", "0.5863652", "0.5862462", "0.5861282", "0.5858101", "0.5849572", "0.58470494", "0.5844202", "0.5838535", "0.5835522", "0.58335125", "0.58330446", "0.58285815", "0.5823686", "0.5823612", "0.58208096", "0.5818579", "0.58177656", "0.5813621", "0.58121383", "0.581123", "0.581123" ]
0.0
-1
console.log(imgurUrlParser(' console.log(imgurUrlParser(' console.log(imgurUrlParser(' console.log(imgurUrlParser(' console.log(imgurUrlParser(' console.log(imgurUrlParser(' console.log(imgurUrlParser(' console.log(imgurUrlParser('i.imgur.com/altd8Ld.png')); You will be given an object with various consumer products and their respective prices. Return a list of the products with a minimum price of 500 in descending order.
function products(obj) { return Object.keys(obj) .filter(val => obj[val] >= 500) .sort((a, b) => (obj[a] > obj[b] ? -1 : 1)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function topSellerByRevenue(products, lineItems){\n //TODO\n}", "async function scrapeProduct(url){\n const browser = await puppeteer.launch(); \n const page = await browser.newPage();\n await page.goto(url);\n\n // image \n const [el] = await page.$x('//*[@id=\"ivLargeImage\"]/img');\n const src = el.getProperty('src');\n const srcTxt = src.jsonValue();\n\n\n // title \n const [el2] = await page.$x('//*[@id=\"productTitle\"]');\n const txt = el.getProperty('textContent');\n const rawTxt = await txt.jsonValue();\n\n\n // price\n const [el3] = await page.$x('//*[@id=\"priceblock_ourprice\"]');\n const txt2 = el3.getProperty('textContent');\n const price = await txt2.jsonValue();\n\n console.log({srcTxt});\n console.log({rawTxt});\n console.log({price});\n\n\n browser.close();\n}", "function make_url() {\n let tag_url = ''\n for (let i = 0; i < tags.length; i++){\n tag_url += '&tags=' + tags[i] + '&'\n }\n return '/products?page=' + page + '&order=' + order + '&category=' + category + '&criteria=' + criteria + tag_url + '&json_response=True'\n}", "async function scrapeProduct(url) {\n const browser = await puppeteer.launch()\n const page = await browser.newPage()\n await page.goto(url)\n\n const [elImg] = await page.$x(\n '//*[@id=\"__next\"]/div/div/div[1]/div[1]/div/div[1]/div[1]/img'\n )\n const srcImg = await elImg.getProperty('src')\n const image = await srcImg.jsonValue()\n\n const [elName] = await page.$x(\n '//*[@id=\"__next\"]/div/div/div[1]/div[2]/div/div[1]'\n )\n const txtName = await elName.getProperty('textContent')\n const name = await txtName.jsonValue()\n\n const [elBrand] = await page.$x(\n '//*[@id=\"__next\"]/div/div/div[1]/div[2]/div/p[1]/a'\n )\n const txtBrand = await elBrand.getProperty('textContent')\n const brand = await txtBrand.jsonValue()\n\n const [elCountry] = await page.$x(\n '//*[@id=\"__next\"]/div/div/div[1]/div[2]/div/p[2]'\n )\n const txtCountry = await elCountry.getProperty('textContent')\n const country = await txtCountry.jsonValue()\n\n const [elCategory] = await page.$x(\n '//*[@id=\"__next\"]/div/div/div[1]/div[2]/div/p[3]'\n )\n const txtCategory = await elCategory.getProperty('textContent')\n const category = await txtCategory.jsonValue()\n\n const [elPrice] = await page.$x(\n '//*[@id=\"__next\"]/div/div/div[1]/div[2]/div/div[3]/div[1]/div'\n )\n const txtPrice = await elPrice.getProperty('textContent')\n const rawPrice = await txtPrice.jsonValue()\n const price = removeFirstCharacter(rawPrice)\n\n const [elDescription] = await page.$x('//*[@id=\"__next\"]/div/div/div[3]/p[2]')\n const txtDescription = await elDescription.getProperty('textContent')\n const description = await txtDescription.jsonValue()\n\n const [elSubject] = await page.$x('/html/body/div[3]/div/div/div[3]/div[2]/a')\n const txtSubject = await elSubject.getProperty('textContent')\n const rawSubject = await txtSubject.jsonValue()\n const subject = splitOnUpperCase(rawSubject)\n\n const [elStyle] = await page.$x('//*[@id=\"__next\"]/div/div/div[3]/div[3]/div')\n const txtStyle = await elStyle.getProperty('textContent')\n const rawStyle = await txtStyle.jsonValue()\n const style = splitOnUpperCase(rawStyle)\n\n const [elMedium] = await page.$x(\n '//*[@id=\"__next\"]/div/div/div[3]/div[4]/div/a'\n )\n const txtMedium = await elMedium.getProperty('textContent')\n const rawMedium = await txtMedium.jsonValue()\n const medium = splitOnUpperCase(rawMedium)\n\n const artObject = {\n name,\n image,\n description,\n brand,\n country,\n category,\n price,\n subject,\n style,\n medium,\n countInStock: 1,\n rating: 1,\n numReviews: 1,\n }\n\n return artObject\n\n browser.close()\n}", "function getProducts(dataJson) {\n\n // Order Products by Name\n dataJson.data.sort(function (a, b) {\n return a.name.localeCompare(b.name);\n });\n \n const countDataJson = dataJson.data.length;\n for(var i = 0; i < countDataJson; i++ ) {\n\n if(bestSeller(dataJson.data[i].name)) {\n products.innerHTML += `\n <figure class=\"product\">\n <span class=\"best-seller tada\">\n BEST SELLER\n </span>\n <a href=\"#\" id=\"${dataJson.data[i].id}\">\n <img src=\"${dataJson.data[i].image}\" srcset=\"${dataJson.data[i].image}\" 1280w alt=\"${dataJson.data[i].name}\" size=\"(max-width: 1280px) 100vw\">\n <figcaption>\n <p>${dataJson.data[i].name}</p>\n <span>\n ${formatPrice(dataJson.data[i].price)}\n </span>\n </figcaption>\n </a>\n </figure>\n `\n } else {\n products.innerHTML += `\n <figure class=\"product\">\n <a href=\"#\" id=\"${dataJson.data[i].id}\">\n <img src=\"${dataJson.data[i].image}\" srcset=\"${dataJson.data[i].image}\" 1280w alt=\"${dataJson.data[i].name}\" size=\"(max-width: 1280px) 100vw\">\n <figcaption>\n <p>${dataJson.data[i].name}</p>\n <span>\n $ ${formatPrice(dataJson.data[i].price)}\n </span>\n </figcaption>\n </a>\n </figure>\n `\n }\n //console.log(dataJson.data[i].name)\n }\n}", "async function HNUrlScrape(url) {\n var result = []\n var urlArr = []\n var imgArr = []\n var nameArr = []\n const browser = await puppeteer.launch()\n const page = await browser.newPage()\n await page.goto(url)\n const el = await page.$$('.product-item .product-info-item .info a');\n imgArr = await page.$$eval('.product-item .product-info-item .photo-box a img', elems => elems.map(elem => elem.dataset.srcRetina))\n for (const [index, element] of el.entries()) {\n const text = await element.getProperty('href');\n const productUrl = await text.jsonValue();\n const text3 = await element.getProperty('textContent')\n const name = await text3.jsonValue();\n urlArr.push(productUrl)\n nameArr.push(name)\n if (index == el.length-1){\n browser.close();\n result.push(urlArr);\n result.push(nameArr);\n result.push(imgArr);\n return result;\n }\n } \n}", "async function HNProductScrape(url) {\n const browser = await puppeteer.launch()\n const page = await browser.newPage()\n await page.goto(url)\n\n //grabs name of product\n const el = await page.$('.product-name')\n const text = await el.getProperty('textContent')\n const name = await text.jsonValue()\n\n //grabs image of product\n const el2 = await page.$('.hn-carousel-embed-container img')\n const text2 = await el2.getProperty('src')\n const img = await text2.jsonValue()\n\n //grabs price of product\n var price = await page.$eval('#product-view-price', value => value.dataset.price)\n price = Math.round(parseFloat(price))\n \n //grabs discount value of product, defaults to 0\n const el5 = await page.$('#product-view-price > div:nth-child(1) > div > div > span.special-text.label.label_important.label_bubble.p_txt-upper');\n if (el5 == null) {\n var discount = 0\n } else {\n var text4 = await el5.getProperty('textContent');\n var discount = await text4.jsonValue(); \n\n discount = discount.split(' ')[1]\n discount = parseFloat(discount.slice(1))\n }\n\n const el6 = await page.$('#breadcrumbs > li:nth-child(6) > a')\n const text5 = await el6.getProperty('textContent')\n const category = await text5.jsonValue()\n \n\n //grabs rating of product\n var rating = await page.$eval('#overview > div.col-xs-12.col-sm-7.col-md-8 > div > div > div > div > div > div > div > div > dl > dd.bv-rating-ratio', value => value.title)\n\n rating = rating.split(' ')[0]\n rating = parseFloat(rating)\n \n //close connection request and displays information\n browser.close()\n HNProductInfo = {name, img, price, discount, rating, category}\n // console.log(HNProductInfo)\n return HNProductInfo\n}", "function scrapeMain(url){\n return new Promise((resolve, reject)=>{\n let shirtsUrl= scrapeIt(url, {\n shirts: {\n listItem: \".products li\",\n data:{\n url:{\n selector: \"a\",\n attr: \"href\",\n },\n },\n }\n });\n resolve(shirtsUrl);//store product urls...\n reject(new Error('Failed to scrape product page'));\n });\n}", "function getProductData(url, cb) {\n const nightmare = new Nightmare();\n // get product id from url\n const beginStr = url.indexOf('item/') + 5;\n const endStr = url.length;\n const sku = url.slice(beginStr, endStr);\n\n nightmare\n .goto(url)\n .wait(1000)\n .evaluate(() => {\n return document.querySelector(\".productCard\").innerText;\n })\n .end()\n .then(data => {\n let splitted = data.split('\\n');\n let name = splitted[0];\n let price = splitted[1].slice(-5) + ' USD';\n let description = splitted[2];\n let product = {sku: sku, link: url, name: name, price: price, description: description};\n proudctObj[sku] = product;\n console.log(proudctObj); // eslint-disable-line\n })\n .catch(err => {\n console.log('failed: ', err); // eslint-disable-line\n });\n }", "function getProducts(url) {\n privateGetPage(url).then(function(result) {\n if (result !== null) {\n let recs = privateGetProducts(result);\n console.log(recs);\n } else return null;\n });\n }", "function App() {\n var productList = [\n { key: 0, agg: 0, img: \"https://imgprd19.hobbylobby.com/8/af/53/8af53111e4081aabf5cd6046d0cf8ab74fa6b82c/350Wx350H-506485-0120-px.jpg\", size: \"Small\", color: \"Purple\", num: 30},\n { key: 1, agg: 0, img: \"https://ilovecheer.com/wp-content/uploads/2018/01/LVCPMS0066-1.png\", size: \"Large\", color: \"Orange\", num: 1},\n { key: 2, agg: 0, img: \"https://cdn.shopify.com/s/files/1/1169/5498/products/troll-pom-pom-color-purple-paradise-fibers_600x.png?v=1603221545\", size: \"Large\", color: \"Purple\", num: 1},\n { key: 3, agg: 0, img: \"https://s7.orientaltrading.com/is/image/OrientalTrading/VIEWER_IMAGE_400/blue-tinsel-pom-poms~13834764\", size: \"Small\", color: \"Blue\", num: 25},\n { key: 4, agg: 0, img: \"https://www.beadsdirect.co.uk/storage/app/uploads/public/d46/355/ffd/thumb__1000_1000_0_0_crop.jpg\", size: \"Large\", color: \"Purple\", num: 2},\n { key: 5, agg: 0, img: \"https://images-na.ssl-images-amazon.com/images/I/81znp8MKk5L._AC_SX679_.jpg\", size: \"Medium\", color: \"Blue\", num: 12},\n { key: 6, agg: 0, img: \"https://partycity6.scene7.com/is/image/PartyCity/_pdp_sq_?$_1000x1000_$&$product=PartyCity/466593\", size: \"Medium\", color: \"Purple\", num: 3},\n { key: 7, agg: 0, img: \"https://imgprd19.hobbylobby.com/f/44/0d/f440d2e5b88c46649fac5c18d2eac6c167c9ff1d/350Wx350H-392720-0120-px.jpg\", size: \"Small\", color: \"Orange\", num: 40},\n { key: 8, agg: 0, img: \"https://i.ebayimg.com/images/g/kQ4AAOSwEDtbdo-Z/s-l300.jpg\", size: \"Medium\", color: \"Orange\", num: 7},\n { key: 9, agg: 0, img: \"https://www.beadsdirect.co.uk/storage/app/uploads/public/52a/9f6/44d/thumb__1000_1000_0_0_crop.jpg\", size: \"Large\", color: \"Blue\", num: 2},\n { key: 10, agg: 0, img: \"https://cdn-fsly.yottaa.net/551561a7312e580499000a44/www.joann.com/v~4b.ad/dw/image/v2/AAMM_PRD/on/demandware.static/-/Sites-joann-product-catalog/default/dwfba237fa/images/hi-res/alt/16650780ALT1.jpg?sw=556&sh=680&sm=fit&yocs=5t_5G_5E_\", size: \"Small\", color: \"Orange\", num: 15},\n { key: 11, agg: 0, img: \"https://images-na.ssl-images-amazon.com/images/I/81aptnwdiuL._AC_SX679_.jpg\", size: \"Medium\", color: \"Purple\", num: 10}\n ]\n \n return (\n <div className=\"App\">\n <FilteredList list = {productList} />\n </div>\n );\n}", "function getPrices() {\n return fetch(\n `https://min-api.cryptocompare.com/data/pricemulti?fsyms=${cryptocurrencies.join(',')}&tsyms=USD,EUR`\n ).then(res => {\n return res.json()\n })\n}", "function parseYelpPhotosRequest(htmlData) {\n let photos = [];\n // Look for srcset tags\n const matches = htmlData.match(/srcset=\".*\"/gm);\n if (!matches) {\n throw Error('YelpPhotoScrapeError');\n }\n // Take the first url in the srcset\n for (var i = 0; i < matches.length; i++) {\n const urls = matches[i].match(\n /(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})/\n );\n if (!urls) {\n matches[i] = null;\n continue;\n }\n const thumbnailUrl = urls[0]; // Get smallest thumbnail\n const splitUrl = thumbnailUrl.split('/');\n // if (splitUrl.length > 6) {\n // matches[i] = null;\n // continue; // Not a picture of the restaurant\n // }\n const slug = splitUrl[4];\n photos.push({\n thumbnail: thumbnailUrl,\n original: `https://s3-media0.fl.yelpcdn.com/bphoto/${slug}/o.jpg`,\n });\n }\n // index 0 is for some reason a tiny version of index 1, and last is not a picture of the restaurant\n return photos.splice(1, photos.length - 2);\n}", "function scrapeProduct(url) {\n puppeteer.launch({ headless: true }).then(async (browser) => {\n // const browser = await puppeteer.launch();\n const page = await browser.newPage();\n\n await page.goto(url);\n\n // page.on('console', (msg) => console.log('PAGE LOG:', msg.text()));\n // await page.evaluate(() => console.log(`url is ${location.href}`));\n\n const [el] = await page.$x('//*[@id=\"imgBlkFront\"]');\n const src = await el.getProperty('src');\n const srcTxt = await src.jsonValue();\n\n // const titleTxt = await page.$eval('#productTitle', (txt) => txt.innerText);\n const titleTxt = await page.$eval('#productTitle', (txt) =>\n txt.textContent.split('\\n').join('')\n );\n\n // Try loading the page and using the console to find that element.\n // document.querySelector('#txtCase')\n // --------------------------------\n // await page.$('a.buy-now'); will do the following:\n // * Run document.querySelector in the browser and return the element handle (to the Node.js environment)\n // * Run getProperty on the handle and return the result (to the Node.js environment)\n\n // const priceTxt = await page.$$eval('#buyNew_noncbb', (txt) =>\n // txt.map((el) => el.innerText)\n // );\n\n // waiting for a selector\n // await page.waitFor('#buyNew_noncbb');\n\n // quick check if an element is accessible by puppeteer:\n if ((await page.$x('//*[@id=\"buyNew_noncbb\"]/span')) !== null)\n console.log('found');\n else console.log('not found');\n\n // const priceTxt = await page.evaluate(() =>\n // document.querySelector('#buyNew_noncbb').getProperty(textContent)\n // );\n\n // const [el2] = await page.$x('//*[@id=\"buyNew_noncbb\"]/span');\n // const temp3 = el2.getProperty('innerText');\n // // chaining async-await functions: https://stackoverflow.com/questions/38644754/chain-async-functions\n // const priceTxt = await temp3.jsonValue();\n\n // ----------------------------------------------------------------\n\n // await page.waitForXPath('//*[@id=\"a-autoid-8-announce\"]/span[2]/scraping');\n\n const [el3] = await page.$x('//*[@id=\"bylineInfo\"]/span/span[1]/a[1]');\n // try {\n const author = await (await el3.getProperty('innerText')).jsonValue();\n // } catch (err) {\n // console.log(err);\n // }\n // // chaining async-await functions: https://stackoverflow.com/questions/38644754/chain-async-functions\n // try {\n // const price = await temp.jsonValue();\n // } catch (err) {\n // console.log(err);\n // }\n\n console.log({ srcTxt, titleTxt, author, priceTxt });\n\n await browser.close();\n\n // --------------------------------\n\n // with global Browser, Page, Result variables\n /**\n var Browser;\n var Page;\n var Result;\n\n var Launch = puppeteer.launch().then((browser) => {\n console.log('Browser Created\\nCreating Blank Page');\n Browser = browser;\n // return Browser;\n // return Browser.newPage();\n });\n\n var GoToPage = Launch.then((resp) => Browser.newPage()).then((page) => {\n console.log('Page Created\\nVisiting URL');\n Page = page;\n return Page.goto(url);\n });\n\n var Evaluate = GoToPage.then((resp) => {\n console.log('Website Loaded');\n console.log('Evaluating Selectors');\n Result = Page.$eval('#productTitle', (txt) => txt.innerText);\n return Result;\n })\n .then((val) => {\n console.log(Result);\n console.log('Done! Exiting');\n Browser.close();\n })\n .catch((err) => {\n console.log(err);\n });\n **/\n\n // --------------------------------\n\n // source: https://stackoverflow.com/questions/54029554/page-evaluate-wont-execute-in-a-promise-chain\n // source2: https://stackoverflow.com/questions/28250680/how-do-i-access-previous-promise-results-in-a-then-chain\n // source3 (vid): https://www.youtube.com/watch?v=lil4YCCXRYc\n // source4: https://zellwk.com/blog/converting-callbacks-to-promises/\n\n /**\n var Browser;\n var Page;\n var Result;\n\n puppeteer\n .launch()\n .then(function (browser) {\n console.log('Browser Created\\nCreating Blank Page');\n Browser = browser;\n return Browser.newPage();\n })\n .then(function (page) {\n console.log('Page Created\\nVisiting URL');\n Page = page;\n return Page.goto(URL);\n })\n .then(function (resp) {\n console.log('Website Loaded');\n return Page.evaluate(function () {\n // Completely Sync Stuff\n console.log('Evaluating Selectors');\n var myElems = document.getElementsByClassName('challenge-type light');\n Result = myElems;\n });\n })\n .then(function (val) {\n console.log(Result);\n console.log('Done! Exiting');\n Browser.close();\n process.exit();\n })\n .catch(function (err) {\n Browser.close();\n console.log(err);\n process.exit(1);\n });\n **/\n });\n}", "function reasonable_products(products){\n let res=[];\n products.forEach((product, i) => {\n if(product.price<=100){\n res.push(product);\n }\n });\n return res;\n}", "function PageGetPrices(xml)\n{ \n var pricesOnPage=[];\n \n // fuck hardcore parsing libraries --- FOR NOW\n // we'll do it live!\n while(1)\n {\n // Make sure our dollar signs are in the <title>\n var i=xml.indexOf(\"<title>\");\n if(i==-1) break;\n xml=xml.slice(i+7);\n \n // Find the dollar sign.\n var i=xml.indexOf(\"$\");\n if(i==-1) break;\n xml=xml.slice(i+1);\n \n var j=xml.indexOf(\"</\");\n var listingPrice=parseFloat(xml.substring(0,j));\n if(!isNaN(listingPrice)) pricesOnPage.push(listingPrice);\n xml=xml.slice(j+8);\n }\n \n var itemLastDate=xml.substring(xml.lastIndexOf(\"<dc:date>\")+9,xml.lastIndexOf(\"</dc:date>\"));\n //console.log(pricesOnPage.length);\n \n return {\n pricesOnPage:pricesOnPage,\n itemLastDate:itemLastDate\n };\n}", "function fix(url, domain) {\n \t\t// console.log(object);\n \tif (domain == \"i.imgur.com\")\n \t{\n \t\treturn url;\n\t}\n \telse if (domain == \"imgur.com\")\n\t{\n \t\treturn \"http://i.imgur.com/\" + url.slice(17) + \"m.jpg\";\n \t}\n \telse \n \t{\n \t\treturn \"\";\n \t}\n\n}", "function ascendProducts(data){\n //returns a sorted array based on comparing elements a and b \n data.sort(function(a, b) {\n return a.price - b.price;\n });\n show(data);\n}", "function scrapeProductPage(link, type){\n\n // depending on how you got the links, whether they are absolute or\n // relative you may need to make them relative like so:\n // var fullUrl = \"http://www. .com/\" + link;\n\n request(fullUrl, function(err, res, body){ //request the website and use cheerio\n if(!err){\n var $ = cheerio.load(body);\n var item = {}; //the item that will eventually get added to the database\n\n // BE SURE TO USE .trim() ON ALL TEXT! IT GETS RID OF WHITE SPACE\n\n //name\n item.name = //item's name that is found somehow.\n\n //images\n item.images = [];\n //for each image\n item.images.push( /* link to image */);\n\n //description\n item.description = /* product description */\n //normalize description afterward! - this will vary for each website\n\n //sizes\n item.sizes = [];\n /* for each size */\n /* normalize size and then push size */\n item.sizes.push( /* size */ );\n\n //price\n var price = $(/* find containing div of price */).find( /*find containing div of price*/ );\n if ( /* if has two prices (sale and regular) */ ){ //has two prices\n item.price = /* regular price that is normalized to a number */\n }\n else{ //only one price\n item.price = /* regular price that is normalized to a number */\n }\n //colors\n item.colors = [];\n /* for each color */\n item.colors.push( /* color normalized to a degree */ );\n //length\n item.length = /* length found somehow. only dresses and skirts should have length I think */\n\n //url\n item.url = fullUrl; //or url\n\n //brand\n item.brand = // the name of the website eg: KosherCasual\n\n //itemNumber\n\n item.itemNumber = /*product number of the item*/\n\n //type\n item.type = type;\n //approved\n item.approved = true; //set approved to modest sites, false to other sites and then we manually approve it\n\n // console.log(item);\n\n //INSERT INTO DB\n new Clothing(item).save(function(err, clothing, count){\n if (!err){\n console.log('no error!');\n }\n else{\n console.log('error: ', err);\n }\n });\n\n\n }\n else{\n console.log('ERROR in individual link:' + fullUrl);\n }\n });\n}", "getImageUrls(imageUrl){\n // http://www.pickledbraingames.com/temp/images/0258b0_tn.jpg\n\n const fileRegEx = /^(http:\\/\\/www.pickledbraingames.com\\/temp\\/images\\/)(.*)_(lg|md|sm|tn).jpg$/;\n let matches = fileRegEx.exec(imageUrl);\n\n if(matches !== null){\n return({\n id: Math.floor(Math.random() * 10000), // This is a temporary id used to index the images for deletion ect. It is not saved to the database\n url_zoom: `${matches[1]}${matches[2]}_lg.jpg`,\n url_standard: `${matches[1]}${matches[2]}_md.jpg`,\n url_thumbnail: `${matches[1]}${matches[2]}_sm.jpg`,\n url_tiny: `${matches[1]}${matches[2]}_tn.jpg`,\n });\n }\n else{\n throw new Error('Photo filename does not match: ' + imageUrl);\n }\n }", "function parseUrl(url){\n\tif (!typeof(url) == 'string'){\n\t\tthrow Error(`Unexpected input type, expected string but got ${typeof(url)}`)\n\t}\n\tlet re = /^(https:\\/\\/www\\.amazon\\.co\\.jp\\/).*(dp|gp\\/)(.*\\/)/g;\n\tconst resultArray = [...url.matchAll(re)];\n\tlet urlStr;\n\ttry{\n\t\turlStr = resultArray[0][1]+resultArray[0][2]+resultArray[0][3];\n\t\treturn urlStr;\n\t}catch(error){\n\t\tthrow Error('Invalid url parsing error');\n\t}\n}", "function parseUrl () {\n /** @param {object} ph - creating phantom object ph */\n phantom.create().then(function (ph) {\n /** @param {object} page - creating page to proxy all functions sent to phantom object */\n ph.createPage().then(function (page) {\n // pass random url to page\n page.open(generateRandomURL()).then(function (status) {\n // loads all content of the page via 'content' property\n page.property('content').then(function (content) {\n // cheerio parsing html once page is loaded\n var $ = cheerio.load(content);\n var img = $('#screenshot-image').attr('src'); // looks for 'screenshot-image'\n // filtering image\n if (filterURL(img)) {\n io.emit('update-image', img);\n } else {\n console.log('Image not found. Please wait while next url is parsed.. \\n');\n }\n ph.exit(); // Exiting webkit process\n parseUrl();\n });\n });\n });\n });\n}", "function filterPricing(value) {\n //takes a JSON string (like \"[5, 6]\" )\n var priceRange = JSON.parse(value);\n //parses the string into an array\n var divs = document.getElementsByClassName(\"products\")[0].children;\n //fetches all children of the div with the \"products\" class into an array\n for (var i = 0; i < divs.length; i++) {\n //iterates through the array\n var price = parseInt(divs[i].getElementsByClassName(\"pPrice\")[0].outerText\n // gets the <p> element with class \"pPrice\" and extracts price from string\n .match(/\\d+/g)[0]);\n if (price < priceRange[0] || price > priceRange[1]) {\n divs[i].style.display = \"none\";\n } else {\n divs[i].style.display = \"block\";\n }\n }\n }", "function getData() {\n fetch(\"https://still-brushlands-23193.herokuapp.com/product/\")\n .then((res) => res.json())\n .then((data) => {\n console.log(data);\n products = data.data;\n make_products(data.data);\n });\n }", "getUrllist() {\n fetch('https://api.giphy.com/v1/gifs/search?q='+this.gifurl+'&rating=g&limit=25&api_key=rGrMJ7KXMNsi7y1I94GmPa2LzmHTnYEG')\n .then(this._onResponse)\n .then(this._onJsonReady);\n }", "function generateRequestURL(gender, category, sub_category, brand, search_string, display_options, page_number, products_per_page, sorting_key, sort_order, filters) {\n\n var base_url = 'http://eiffel.itba.edu.ar/hci/service3/Catalog.groovy?method=';\n\n var filterJSON = [];\n\n var i;\n for (i = 0 ; i < filters.length ; i++) {\n if (filters[i].hasOwnProperty(\"real_id\")) { // It's a size filter\n filterJSON[i] = {id: filters[i].real_id, value: filters[i].value};\n } else {\n filterJSON[i] = filters[i];\n }\n }\n\n // Adds gender filter\n switch (gender) {\n case 1:\n filterJSON.push({\"id\":1, \"value\": \"Masculino\"});\n filterJSON.push({\"id\":2, \"value\": \"Adulto\"});\n break;\n case 2:\n filterJSON.push({\"id\":1, \"value\": \"Femenino\"});\n filterJSON.push({\"id\":2, \"value\": \"Adulto\"});\n break;\n case 3:\n filterJSON.push({\"id\":2, \"value\":\"Infantil\"});\n //filterJSON.push({\"id\":2, \"value\":\"Bebe\"});\n break;\n case 4:\n filterJSON.push({\"id\":2, \"value\":\"Bebe\"});\n break;\n default:\n //Don't add anything (this means that a search was made, or that the page wasn't load well)\n }\n \n switch (display_options) {\n\n case 1: //Display by category\n base_url += \"GetProductsByCategoryId&id=\" + category + \"&filters=\" + encodeURIComponent(JSON.stringify(filterJSON));\n break;\n\n case 2: //Display by subcategory\n base_url += \"GetProductsBySubcategoryId&id=\" + sub_category + \"&filters=\" + encodeURIComponent(JSON.stringify(filterJSON));\n break;\n\n case 3: //Display by brand\n filterJSON.push({\"id\": 9, \"value\": brand}) // Adds the brand filter\n base_url += \"GetAllProducts&filters=\" + encodeURIComponent(JSON.stringify(filterJSON));\n break;\n\n case 4: //Display by news\n filterJSON.push({\"id\": 6, \"value\": \"Nuevo\"}) // Adds the news filter\n base_url += \"GetAllProducts&filters=\" + encodeURIComponent(JSON.stringify(filterJSON));\n break;\n\n case 5: // Display by search result\n base_url += \"GetProductsByName&name=\" + search_string + \"&filters=\" + encodeURIComponent(JSON.stringify(filterJSON));\n break;\n\n case 6: // Display sale\n filterJSON.push({\"id\": 5, \"value\": \"Oferta\"}) // Adds the news filter\n base_url += \"GetAllProducts&filters=\" + encodeURIComponent(JSON.stringify(filterJSON));\n break;\n\n case null: //Comes from nowhere. For example, typed down url in address bar. Has two options: if gender is not specified, get all products and\n // if gender is specified, get all products by gender ; or just display an error message\n\n default: //Any other option\n base_url += \"GetAllProducts\"\n return base_url;\n }\n\n if (page_number != null) {\n base_url += \"&page=\" + page_number;\n }\n if (products_per_page != null) {\n base_url += \"&page_size=\" + products_per_page;\n }\n if (sorting_key != null) {\n base_url += \"&sort_key=\" + sorting_key;\n }\n if (sort_order != null) {\n base_url += \"&sort_order=\" + sort_order;\n }\n\n return base_url;\n\n}", "function getAllProducts(PAGE_ACCESS_TOKEN,appsecret_proof){\n request({\n url: uri + CATLOG_ID,\n qs:{\n access_token: PAGE_ACCESS_TOKEN,\n appsecret_proof: appsecret_proof\n },\n method:\"GET\"\n }, function(error,response,body){\n if (error){\n console.log(error)\n }else{\n var bodyObj = JSON.parse(body);\n console.log(bodyObj)\n }\n });\n}", "function getJSON_prev() {\n\n fetch(\"products.json\").then(response => response.json()).then(products => {\n\n\n let itemsNumber = itemId;\n\n if (itemsNumber >= 5 && itemsNumber <= 20) {\n const div = document.querySelector('.content');\n while (div.firstChild) div.firstChild.remove();\n\n for (let i = itemsNumber; i < itemsNumber + 5; i++) {\n\n\n if (i < products.length) {\n\n node = `\n <div class=\"item\">\n <div class=\"product-item\">\n <div class=\"product-card card-image\" data-ordernumber=\" ${products[i].productId} \" >\n <div class=\"card-content \">\n <div class=\"product-info\">\n <span class=\"sale\"> -%</span>\n <span class=\"like\" ><i class=\" far fa-heart\"></i> ${(products[i].params.likeCount)} </span>\n <span class=\"man-logo\">\n <img src=\"${products[i].params.manLogo}\" alt=\"\" ></span>\n <div class=\"product-image\">\n <a href=\"${products[i].url}\" title=\"${products[i].name}\" >\n <span class=\"image-element\">\n <span class=\"image-media\">\n <img src=\"${products[i].imageS}\">\n </span>\n </span>\n </a> </div>\n <div class=\"product-title\">\n <a href=\"${products[i].url}\" title=\"${products[i].name}\" >${products[i].name} </a> </div>\n <div class=\"params\">\n <span class=\"land\">${products[i].params.land} </span>\n <span class=\"region\"> | ${products[i].params.region}</span>\n <span class=\"art\"> | ${products[i].params.art}</span>\n <span class=\"rebsorte\">| ${products[i].params.rebsorte}</span>\n </div>\n <div class=\"price-info\" >\n <div class=\"product-price\">\n <span class=\"price-text\">\n <strong>${products[i].price} € * </strong>\n </span >\n <span class=\"old-price\">${products[i].oldPriceText} </span>\n <div class=\"price-unit\">\n <span class=\"base-price\"> ${products[i].params.basePrice} </span>\n <span><br>\n <a title=\"${products[i].params.taxText}\" style=\"text-decoration:underline;font-size: 11px;color:#999;\">${products[i].params.taxText}</a>\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n `;\n\n document.querySelector('.content').innerHTML += node;\n\n }\n }\n\n itemId -= 5;\n } else {\n itemId = 10;\n }\n });\n\n}", "function printRetailers(retailers){\n printRetailersImages(retailers);\n\n var websitePositions = [];\n for(var i = 0; i < retailers.length; i++) {\n if (!(retailers[i].website in websitePositions)) {\n websitePositions[retailers[i].website] = [];\n }\n websitePositions[retailers[i].website].push(i);\n }\n //log(websitePositions);\n\n var out = '';\n for(var key in websitePositions){\n // THIS IF STATEMENT HANDLES PRODUCTS THAT DO NOT NEED A DROP DOWN DUE TO THE RETAILER ONLY HAVING ONE VERSION OF THE PRODUCT\n if (websitePositions[key].length == 1) {\n out += '<a href=\"../sql/forward.php?site=' + retailers[websitePositions[key][0]].link + '&id=' + retailers[websitePositions[key][0]].id + '\">'\n out += '<div class=\"card mb-2\">';\n out += '<div class=\"card-body\">';\n out += '<div class=\"row\">';\n out += '<div class=\"col-md-6 col-8 align-self-center\">';\n out += '<span class=\"align-middle\"><h5 class=\"mb-0 product-card-retailer\">' + retailers[websitePositions[key][0]].website + '</h5></span>';\n out += '<span class=\"align-middle\"><h5 class=\"mb-0\">' + retailers[websitePositions[key][0]].name + '</h5></span>';\n out += '</div>';\n out += '<div class=\"col-md-3 d-none d-md-block\">';\n out += '<img src=\"' + retailers[websitePositions[key][0]].img + '\" class=\"mx-auto company-logo\" alt=\"Product image\">';\n out += '</div>';\n out += '<div class=\"col-4 col-md-3 align-self-center\">';\n out += '<span class=\"align-middle text-right\"><h4 class=\"mb-0\">£' + retailers[websitePositions[key][0]].price + '</h4></span>';\n out += '</div>';\n out += '</div>';\n out += '</div>';\n out += '</div>';\n out += '</a>';\n } else {\n //MAIN CARD FOR A RETAILER GOES HERE\n out += '<a data-toggle=\"collapse\" class=\"retialer-main-card\" id=\"' + key + '-main-card\" data-target=\"#' + key + '-collapse\" aria-expanded=\"false\" aria-controls=\"' + key + '-collapse\">';\n out += '<div class=\"card mb-2 retailer-main-card-body\">';\n out += '<div class=\"card-body\">';\n out += '<div class=\"row\">';\n out += '<div class=\"col-10 order-1 col-md-6 align-self-center\">';\n out += '<span class=\"align-middle\"><h5 class=\"mb-0 product-card-retailer\">' + key + '</h5></span>';\n out += '</div>';\n out += '<div class=\"col-md-2 order-2 d-none d-md-block text-center\">';\n out += '<img src=\"' + retailers[websitePositions[key][0]].img + '\" class=\"mx-auto company-logo\" alt=\"Product image\">';\n out += '</div>';\n out += '<div class=\"col-12 order-4 order-md-3 col-md-3 align-self-center\">';\n out += '<span class=\"align-middle text-right\"><h4 class=\"mb-0\">£' + retailers[websitePositions[key][0]].price + ' - £' + retailers[websitePositions[key][websitePositions[key].length-1]].price + '</h4></span>';\n out += '</div>';\n out += '<div class=\"col-2 order-3 order-md-4 col-md-1 align-self-center\">';\n out += '<span class=\"fa fa-lg fa-chevron-up rotate\"></span>';\n out += '</div>';\n out += '</div>';\n out += '</div>';\n out += '</div>';\n out += '</a>';\n out += '<div class=\"collapse\" id=\"' + key + '-collapse\">';\n\n for(var i = 0; i < websitePositions[key].length; i++){\n //SUB CARDS FOR A RETAILER GO HERE\n out += '<a href=\"../sql/forward.php?site=' + retailers[websitePositions[key][i]].link + '&id=' + retailers[websitePositions[key][i]].id + '\">'\n out += '<div class=\"col-12 col-md-11 offset-md-1 px-0\">';\n out += '<div class=\"card mb-2\">';\n out += '<div class=\"card-body\">';\n out += '<div class=\"row\">';\n out += '<div class=\"col-md-6 col-8 align-self-center\">';\n out += '<span class=\"align-middle\"><h5 class=\"mb-0\">' + retailers[websitePositions[key][i]].name + '</h5></span>';\n out += '</div>';\n out += '<div class=\"col-md-3 d-none d-md-block\">';\n out += '<img src=\"' + retailers[websitePositions[key][i]].img + '\" class=\"mx-auto company-logo\" alt=\"\">';\n out += '</div>';\n out += '<div class=\"col-4 col-md-3 align-self-center\">';\n out += '<span class=\"align-middle text-right\"><h4 class=\"mb-0\">£' + retailers[websitePositions[key][i]].price + '</h4></span>';\n out += '</div>';\n out += '</div>';\n out += '</div>';\n out += '</div>';\n out += '</div>';\n out += '</a>';\n\n }\n out += '</div>';\n }\n\n $('#retailers-column').html(out);\n }\n enableRetailerCardAnimation();\n\n return;\n\n}", "async findPriceList(code) {\n //\n // QUERY for exact DENOM\n const feasiblePacks = await CatalogDetail.query()\n .where(\"product_code\", code)\n .where(\"status\", \"ENABLE\")\n .orderBy(\"min\", \"asc\")\n .fetch();\n /// no records\n if (feasiblePacks.length === 0) {\n return null;\n }\n // console.log(feasiblePacks);\n // record exists\n const formattedSet = feasiblePacks.toJSON().map((val) => {\n // In DB, if val.min is NULL, then reference = denom in MY. Else, reference = kurs.\n let finalPrice = \"\";\n let reference = \"\";\n if (val.method === \"ABSOLUTE\") {\n if (!val.min) {\n finalPrice = parseFloat(val.value).toFixed(2);\n reference = parseFloat(val.reference).toFixed(2);\n } else {\n finalPrice = `${Number(val.min / val.reference) + Number(val.value)} - ${Number(\n\t\t\t\t\t\tval.denom / val.reference,\n\t\t\t\t\t) + Number(val.value)}`;\n reference = `${Number(val.min / val.reference)} - ${Number(val.denom / val.reference)}`;\n }\n } else {\n if (!val.min) {\n finalPrice = parseFloat(val.value * val.reference / 100).toFixed(2);\n reference = parseFloat(val.reference).toFixed(2);\n } else {\n const lower = val.value * (val.min / val.reference) / 100;\n const upper = val.value * (val.denom / val.reference) / 100;\n const lower_ref = val.min / val.reference;\n const upper_ref = val.denom / val.reference;\n finalPrice = `${lower.toFixed(2)} - ${upper.toFixed(2)}`;\n reference = `${lower_ref.toFixed(2)} - ${upper_ref.toFixed(2)}`;\n }\n }\n return {\n denomination: val.min ? `${val.min} - ${val.denom}` : val.denom,\n price: finalPrice,\n rrp: reference,\n };\n });\n formattedSet.sort(\n (a, b) =>\n Number(a.denomination) < Number(b.denomination) ?\n -1 :\n Number(b.denomination) < Number(a.denomination) ? 1 : 0,\n );\n return formattedSet;\n }", "function parseImageUrl(imgUrl) {\n\n var folder = imgUrl.split('/')[3]; // extract S3 folder name from URL\n var file = imgUrl.split('/').pop().split('?').shift(); // extract S3 image name from URL\n var parsedData = [folder, file];\n\n return parsedData;\n}", "function filterPrice(inputData) {\n var tempData = JSON.parse(inputData.body).Objects;\n\n // Applies filter if minimum price exists in GET request\n if (req.query.priceMin) {\n tempData = tempData.filter(function(object) {\n if (object.Koopprijs && !object.Huurprijs) {\n return object.Koopprijs > req.query.priceMin;\n } else {\n return object.Huurprijs > req.query.priceMin;\n }\n });\n }\n // Applies filter if maximum price exists in GET request\n if (req.query.priceMax) {\n tempData = tempData.filter(function(object) {\n if (object.Koopprijs && !object.Huurprijs) {\n return object.Koopprijs < req.query.priceMax;\n } else {\n return object.Huurprijs < req.query.priceMax;\n }\n });\n }\n\n // return inputData;\n return JSON.stringify(tempData);\n }", "function getJSON() {\n\n fetch(\"products.json\").then(response => response.json()).then(products => {\n\n let itemsNumber = itemId;\n\n if (itemsNumber <= 20 && itemsNumber >= 5) {\n const div = document.querySelector('.content');\n while (div.firstChild) div.firstChild.remove();\n for (let i = itemsNumber; i < itemsNumber + 5; i++) {\n\n if (i < products.length) {\n\n node = `\n <div class=\"item\">\n <div class=\"product-item\">\n <div class=\"product-card card-image\" data-ordernumber=\" ${products[i].productId} \" >\n <div class=\"card-content \">\n <div class=\"product-info\">\n <span class=\"sale\" > -% </span>\n <span class=\"like\" > <i class=\" far fa-heart\"></i> ${products[i].params.likeCount}</span>\n <span class=\"man-logo\">\n <img src=\"${products[i].params.manLogo}\" alt=\"\" ></span>\n <div class=\"product-image\">\n <a href=\"${products[i].url}\" title=\"${products[i].name}\" >\n <span class=\"image-element\">\n <span class=\"image-media\">\n <img src=\"${products[i].imageS}\">\n </span>\n </span>\n </a> </div>\n <div class=\"product-title\">\n <a href=\"${products[i].url}\" title=\"${products[i].name}\">${products[i].name} </a> </div>\n <div class=\"params\">\n <span class=\"land\">${products[i].params.land} </span>\n <span class=\"region\"> | ${products[i].params.region}</span>\n <span class=\"art\"> | ${products[i].params.art}</span>\n <span class=\"rebsorte\">| ${products[i].params.rebsorte}</span>\n </div>\n <div class=\"price-info\" >\n <div class=\"product-price\">\n <span class=\"price-text\">\n <strong>${products[i].price} € * </strong>\n </span >\n <span class=\"old-price\" >${products[i].oldPriceText} </span>\n <div class=\"price-unit\">\n <span class=\"base-price\"> ${products[i].params.basePrice} </span>\n <span><br>\n <a title=\"${products[i].params.taxText}\" style=\"text-decoration:underline;font-size: 11px;color:#999;\">${products[i].params.taxText}</a>\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n `;\n\n\n\n document.querySelector('.content').innerHTML += node;\n\n }\n }\n\n itemId += 5;\n } else {\n itemId = 10;\n }\n });\n\n}", "function price(a){\n // to print the price for javascript \n console.log(library[0].price);\n }", "async function createImageInfo(url) {\n var imageDict = {};\n imageDict.url = url;\n const info = await tag(url);\n // Number on the list set to 8\n // If less than 8 guesses, change the picture\n if (info === -1 || info.length <= 8) {\n console.log(\"length\", info.length);\n return await createImageInfo(await addImage());\n }\n else {\n var i;\n info.splice(8); // remove anything more than 8\n for (i = 0; i < info.length; i++) {\n const confidence = info[i].confidence;\n info[i].confidence = calculatePoints(confidence);\n info[i].show = false;\n }\n imageDict.info = info;\n return imageDict;\n }\n}", "function parseResponse(resp) {\n if (resp.status_code === 'OK') {\n var results = resp.results;\n console.log(results);\n tags = results[0].result.tag.classes;\n console.log(tags);\n // console.log(\"tags from upload: \" + tags);\n probabilities = results[0].result.tag.probs;\n console.log(probabilities);\n\n showUploaded();\n\n } else {\n console.log('Sorry, something is wrong.');\n }\n\n // displays the user's uploaded image in a card\n function showUploaded() {\n var userImageUrl = $('#imgurl').val();\n $('#imgurl').val('');\n $('#uploaded-image-card').fadeIn();\n $('#uploaded-image-card').html('<h2>' + \"You uploaded:\" + '</h2>' + '<img src=\"' + userImageUrl + '\" alt=\"\" class=\"image-thumbnail\"/>'); \n $('#dropdown').removeClass('hidden'); \n }\n\n // Asynchronus callback to read new data in database\n productsInFirebase.on(\"value\", function(snapshot) {\n iterate(snapshot.val());\n // addHelper(snapshot.val());\n }, function (errorObject) {\n console.log(\"The read failed: \" + errorObject.code);\n });\n\n // compares the user's upload with products in the db\n function iterate(products) {\n\n var inCommon = [];\n var inCommonSorted;\n\n for (prop in products) { \n // save the like tags \n var tagsComparison = _.intersection(tags, products[prop].tags);\n\n var productsFirebase = products[prop];\n \n // save the products based on like tags (with a count of like tags) \n inCommon.push({\n numTags: tagsComparison.length, \n product: productsFirebase \n }) \n\n // sort the products based on the highest count of like tags\n inCommonSorted = _.sortBy(inCommon, 'numTags').reverse(); \n // console.log(inCommonSorted);\n \n // if there are a small number of like tags, display error state (because the quality of the output would not be high enough)\n if (inCommonSorted[0].numTags < 7 || inCommonSorted[0] === 'undefined' || inCommonSorted[0] === 'null') {\n $('.flex-container').removeClass('hidden');\n $('.uploaded-flex-item').removeClass('hidden');\n $('#product-match-card').fadeIn();\n $('#product-match-card').html(\"Yikes! We could not find a match.\");\n $('#dropdown').removeClass('hidden'); \n inCommon = [];\n inCommonSorted = [];\n }\n\n // displays the best match (product with the highest number of like tags)\n else {\n $('.flex-container').removeClass('hidden');\n $('.uploaded-flex-item').removeClass('hidden');\n $('#product-match-card').fadeIn(); \n $('#product-match-card').html('<h2>' + \"Try this: \" + '</h2>' + '<img src=\"' + inCommonSorted[0].product.itemImage + '\" alt=\"\" class=\"image-thumbnail\"/>' + inCommonSorted[0].product.itemName + \"<br>\" + '<a href=\"' + inCommonSorted[0].product.url + '\"class=\"popUpAction\" target=\"_blank\">' + \"View Details\" + '</a>'); \n }\n } \n\n\n // enables the user to choose a helper to improve the product match result\n $(document).on('change', '#dropdown', function(e) {\n \n var x = userSelectedHelperTag;\n\n // saves the users selection from the helper drop down\n var userSelectedHelperTag = this.options[e.target.selectedIndex].text;\n console.log(userSelectedHelperTag);\n\n for (prop in products) {\n\n var productsHelperFirebase = [];\n var helperInCommon = [];\n\n if (userSelectedHelperTag === products[prop].helperTag) {\n \n // add products matching the user's helper to a new array\n productsHelperFirebase.push(products[prop]);\n console.log(products[prop]);\n\n // compares the tags of the user's upload against the tags of products matching the user's selected helper\n for (var i = 0; i < productsHelperFirebase.length; i++) {\n var tagsHelperComparison = _.intersection(tags, productsHelperFirebase[i].tags);\n // console.log(tagsHelperComparison.length)\n\n helperInCommon.push({\n numTags: tagsHelperComparison.length, \n product: productsHelperFirebase[i] \n }) \n } \n\n\n // sort the products based on the highest count of like tags considering only products that match the user's selected helper\n var helperInCommonSorted = _.sortBy(helperInCommon, 'numTags').reverse();\n console.log(helperInCommonSorted) \n\n\n // if there are a small number of like tags considering only products that match the user's selected helper, display error state (because the quality of the output would not be high enough)\n if (helperInCommonSorted[0].numTags < 7 || helperInCommonSorted[0] === 'undefined' || helperInCommonSorted[0] === 'null') {\n $('.flex-container').removeClass('hidden');\n $('.uploaded-flex-item').removeClass('hidden');\n $('#product-match-card').fadeIn();\n $('#product-match-card').html(\"Yikes! We could not find a match.\");\n $('#dropdown').removeClass('hidden'); \n }\n\n // displays the best match (product with the highest number of like tags considering only products that match the user's selected helper)\n else {\n $('.flex-container').removeClass('hidden');\n $('.uploaded-flex-item').removeClass('hidden');\n $('#product-match-card').fadeIn(); \n $('#product-match-card').html('<h2>' + \"Try this: \" + '</h2>' + '<img src=\"' + helperInCommonSorted[0].product.itemImage + '\" alt=\"\" class=\"image-thumbnail\"/>' + helperInCommonSorted[0].product.itemName + \"<br>\" + '<a href=\"' + helperInCommonSorted[0].product.url + '\"class=\"popUpAction\" target=\"_blank\">' + \"View Details\" + '</a>'); \n }\n }\n } \n })\n }\n}", "function crawl(productQuery){\n var html = '';\n var url = this.getUrl(productQuery);\n console.log(url);\n var that = this;\n\n http.get(url, function (response){\n\n response.on('data', function (data) {\n html += data.toString();\n });\n\n response.on('end', function(){\n var products = that.parseResponse(html); // can't use 'this' b/c it refers to response\n console.log(products.length); \n\n products = that.filterProducts(products, productQuery);\n console.log(products.length);\n\n // if no products parsed, insert error\n if (!products.length){\n var product = {};\n product.date = dateFormatter(new Date());\n product.retailer = that.retailer;\n product.product = productQuery;\n product.parent_url = that.parentUrl;\n product.is_error = 1;\n products.push(product);\n }\n\n console.log('*****' + productQuery + '*****');\n console.log(products);\n db.insert(products);\n\n });\n\n });\n}", "_get_rating(url) {\n _get_rating(url);\n }", "function question3() {\n for (var i = 0; i < data.length; i++) {\n if (data[i].currency_code === \"GBP\") {\n console.log(data[i].title + data[i].price)\n }\n }\n}", "static byPrice() {\n // how to sort in descending order\n // var points = [40, 100, 1, 5, 25, 10];\n // points.sort(function(a, b){return b-a});\n return store.meals.sort(function(a, b) {return b.price - a.price});\n }", "function parseTakeAlotPage() {\n\n release = new Object();\n \n // Release artist credit\n release.artist_credit = new Array();\n var artist_name = releaseartist;\n release.artist_credit.push( { 'artist_name': artist_name } );\n\n // Release title\n release.title = releasetitle;\n\n\t// Release Barcode\n release.barcode = releasebarcode;\n\n // Default status is official\n release.status = 'official';\n \n // Default script type\n release.script = 'Latn';\n\n // Select country from array\n release.country = Countries[releasecountry];\n\n // Select release language from array\n release.language = Languages[releaselanguage];\n\n var disc = {'position': 1, 'tracks': tracklistarray }; //use the tracklist array\n release.discs = [ disc ];\n \n release.labels = [];\n \n // Release URL\n release.urls = new Array();\n release.urls.push( { 'url': window.location.href, 'link_type': 74 } ); //type 74 is purchase for download\n \n // Release date\n\n var releasedate = releasedaterel;\n if (typeof releasedate != \"undefined\" && releasedate != \"\") {\n var tmp = releasedate.split('-'); if (tmp[0] != \"undefined\" && tmp[0] != \"\") {\n release.year = parseInt(tmp[0], 10);\n if (tmp[1] != \"undefined\" && tmp[1] != \"\") {\n release.month = parseInt(tmp[1], 10);\n if (tmp[2] != \"undefined\" && tmp[2] != \"\") {\n release.day = parseInt(tmp[2], 10);\n }\n }\n }\n }\n\n\n\n console.log(release);\n\n return release;\n}", "function scrapeimg(name,element){\n var globalurl;\n var scraperes = [];\n element.forEach(function(img){\n scraperes.push($(document).find(img));\n });\n var search=name.split(\"-\")[0].split(\"&\")[0].trim().split(\",\")[0].trim().split(\"ft.\")[0].trim().split(\"vs\")[0].trim().split(\"Ft.\")[0].trim().split(\"feat.\")[0].trim().split(\"Feat.\")[0].trim().split(' ').join('-');\n search = deUmlaut(search);\n var url = encodeURIComponent('https://genius.com/artists/' + search);\n ////console.log(search);\n ////console.log(url);\n ////////console.log(name);\n ////////console.log(search);\n ////////console.log(url);\n fetch(`https://api.allorigins.win/get?url=${url}`)\n .then(response => {\n if (response.ok) return response.json()\n throw new Error('Network response was not ok.')\n })\n .then(function(data){\n //var res = data.find();\n var base64;\n var quick = data.contents;\n ////////console.log(quick);\n var index = quick.search(\"user_avatar\");\n var quick = quick.substring(index,quick.lenght);\n index = quick.search(\"url\\\\('\");\n quick = quick.substring(index+5,quick.lenght);\n var imgurl = quick.split(\"'\")[0];\n //imgurl='https://api.allorigins.win/get?url=${url' + imgurl + '}';\n ////////console.log(imgurl);\n globalurl = imgurl;\n /*\n try{\n toDataURL(\n imgurl,\n function(dataUrl) {\n base64 = dataUrl;\n scraperes.forEach(image => {\n if(dataUrl){\n image.attr(\"src\",dataUrl);\n //console.log(\"base64\");\n }\n else{\n image.attr(\"src\",imgurl);\n //console.log(\"img source\");\n }\n\n }); \n });\n }\n catch(e){\n //console.log(\"getting dominant color failed\");\n }\n */\n scraperes.forEach( image => image.attr(\"src\",imgurl) ); \n //////console.log(scraperes);\n\n ////console.log(imgurl);\n //scraperes.each(function() {\n // $(this).prop(\"src\",imgurl))\n // $(this).children('.time').after($('.inner'));\n //});\n //$(scraperes).prop(\"src\",imgurl);\n });\n $(element[0])\n .on('load', function() { \n\n })\n .on('error', function(){\n setTimeout(function(){\n $(this).prop(\"src\",\"https://cdn.discordapp.com/attachments/331151226756530176/725817255484719124/AURFavicon.webp\");\n },5000);\n });\n}", "async function getAllPrices() {\n let tokensDetailedInfoRequest = await fetch(\n \"https://api.kyber.network/market\"\n );\n let tokensDetailedInfo = await tokensDetailedInfoRequest.json();\n return tokensDetailedInfo;\n }", "function scrapeinfo(name){\n var spotify;\n var soundcloud;\n var twitter;\n var other;\n var wikipedia;\n var youtube;\n var instagram;\n var facebook;\n var info = [];\n var search=name.split(\"-\")[0].split(\"&\")[0].trim().split(\",\")[0].trim().split(\"ft.\")[0].trim().split(\"vs\")[0].trim().split(\"Ft.\")[0].trim().split(\"feat.\")[0].trim().split(\"Feat.\")[0].trim().split(' ').join('-');\n search = deUmlaut(search);\n info.push(search);\n var callbackinfo = [search,,];\n var linksearch = name.split(\"-\")[0].split(\"&\")[0].split(' ').join('+');\n linksearch = linksearch.slice(0, -1);\n var url = encodeURIComponent('https://genius.com/artists/' + search);\n var geniusurl = 'https://genius.com/artists/' + search;\n //////console.log('https://google.com/search?q='+linksearch);\n var linkurl = encodeURIComponent('https://google.com/search?q='+linksearch+\"+website\");\n //////console.log(linkurl);\n \n fetch(`https://api.allorigins.win/get?url=${url}`)\n .then(response => {\n\tif (response.ok) return response.json()\n\tthrow new Error('Network response was not ok.')\n })\n .then(function(data){\n //var res = data.find();\n var quick = data.contents;\n //////console.log(quick);\n var index = quick.search(\"rich_text_formatting\");\n var quick = quick.substring(index,quick.lenght);\n index = quick.search(\"<p>\");\n quick = quick.substring(index,quick.lenght);\n var desc; \n try{\n desc = quick.split(\"</p>\")[0];\n desc += quick.split(\"</p>\")[1].split(\"</p>\")[0];\n }\n catch(e){}\n if(desc.includes('img')){\n try{\n desc = quick.split(\"</p>\")[1].split(\"</p>\")[0];\n desc+= quick.split(\"</p>\")[1].split(\"</p>\")[1].split(\"</p>\")[0];\n }\n catch(e){}\n }\n if(desc.includes('img')){\n try{\n desc = quick.split(\"</p>\")[0];\n desc += quick.split(\"</p>\")[1].split(\"</p>\")[0];\n }\n catch(e){}\n }\n desc = desc.split(\" \",60).join(\" \") + \"...\" +\"</p>\";\n if(desc == \"...\" +\"</p>\"){\n desc = \"this artist doesn't currently have a description.\";\n }\n desc.replace(\"....\",\"...\");\n //console.log(\"description:\" + desc);\n info[1]=desc;\n var lenghtLim = info[1].split(\" \",60) + \"\";\n \n $(\"#artistInfo\").html(info[1].trim());\n if($(\"#artistInfo\").html().includes(\"</div>\") || $(\"#artistInfo\").html().includes(\"html\") || $(\"#artistInfo\").html().includes(\"You can search Genius by using the search bar above, or\")){\n $(\"#artistInfo\").html(\"this artist doesn't currently have a description.\");\n }\n \n ////console.log(info);\n });\n \n fetch(`https://api.allorigins.win/get?url=${linkurl}`)\n .then(response => {\tif (response.ok) return response.json()\n\tthrow new Error('Network response was not ok.')\n })\n .then(function(data){\n //var res = data.find();\n var quick = data.contents;\n ////////console.log(quick);\n var index = quick.search(\"kCrYT\");\n quick = quick.substring(index,quick.lenght);\n var n=20;var i=0;\n for(i=2;i<n+2;i++){\n var index = quick.search(\"kCrYT\");\n quick = quick.substring(index,quick.lenght);\n index = quick.search(\"<a href=\");\n if((quick.substring(index,index+20).includes(\"/search?q=\"))){\n continue;\n }\n //////console.log(quick);\n quick = quick.substring(index+16,quick.lenght);\n var link = quick.split('\"')[0];\n //////console.log(link);\n link = link.split(\"&amp\")[0];\n //////console.log(\"link:\" + link);\n info[i] = decodeURIComponent(link);\n //////console.log(link);\n try{\n var domain = info[i].split(\"//\")[1].split(\".com\")[0].split(\".org\")[0];\n if(domain.includes(\".\")){\n domain=domain.split(\".\")[1];\n }\n }\n catch(e){\n \n }\n ////console.log(domain);\n if(typeof domain !== 'undefined'){\n if(domain === \"spotify\" && typeof spotify === 'undefined'){\n ////////console.error(\"spotify be like whoa\");\n spotify = info[i];\n //////console.log(\"spotify :\" + spotify);\n if(info[2]!=\"ick=\"){\n $(\"#artistlink2\")\n .prop(\"href\",spotify)\n .html(\"Spotify\");\n }\n }\n else if(domain === \"soundcloud\" && typeof soundcloud === 'undefined'){\n ////////console.error(\"soundcloud be like whoa\");\n soundcloud = info[i];\n //////console.log(\"soundcloud :\" + soundcloud);\n if(info[2]!=\"ick=\"){\n $(\"#artistlink3\")\n .prop(\"href\",soundcloud)\n .html(\"SoundCloud\");\n }\n }\n else if(domain === \"twitter\" && typeof twitter === 'undefined'){\n ////////console.error(\"twitter be like whoa\");\n twitter = info[i];\n //////console.log(\"twitter :\" + twitter);\n if(info[2]!=\"ick=\"){\n $(\"#artistlink4\")\n .prop(\"href\",twitter)\n .html(\"Twitter\");\n }\n }\n else if(domain === \"wikipedia\" && typeof wikipedia === 'undefined'){\n ////////console.error(\"wiki be like whoa\");\n wikipedia = info[i];\n //////console.log(\"wiki :\" + wikipedia);\n if(info[2]!=\"ick=\"){\n $(\"#artistlink5\")\n .prop(\"href\",wikipedia)\n .html(\"Wikipedia\");\n }\n }\n else if(domain.includes(info[0].split(\"-\")[0]) && typeof other === 'undefined'){\n ////////console.error(\"artist be like whoa\");\n other = info[i];\n //////console.log(\"artist website:\" + other);\n if(info[2]!=\"ick=\"){\n $(\"#artistlink1\")\n .prop(\"href\",other)\n .html(\"Official Website\");\n }\n }\n else if(domain === \"youtube\" && typeof youtube === 'undefined'){\n ////////console.error(\"artist be like whoa\");\n youtube = info[i];\n ////////console.log(\"youtube:\" + youtube);\n if(info[2]!=\"ick=\"){\n $(\"#artistlink6\")\n .prop(\"href\",youtube)\n .html(\"Youtube\");\n }\n }\n else if(domain === \"instagram\" && typeof instagram === 'undefined'){\n ////////console.error(\"artist be like whoa\");\n instagram = info[i];\n ////////console.log(\"instagram:\" + instagram);\n if(info[2]!=\"ick=\"){\n $(\"#artistlink7\")\n .prop(\"href\",instagram)\n .html(\"Instagram\");\n }\n }\n else if(domain === \"facebook\" && typeof facebook === 'undefined'){\n ////////console.error(\"artist be like whoa\");\n facebook = info[i];\n ////////console.log(\"facebook:\" + facebook);\n if(info[2]!=\"ick=\"){\n $(\"#artistlink8\")\n .prop(\"href\",facebook)\n .html(\"Facebook\");\n }\n }\n }\n else{\n $(\"#artistlink8\")\n .html(\"We're sorry!We failed to load links...\");\n ////console.log(\"failed to load links...\");\n }\n \n\n }\n $(\"#about\").html(\"About \" + titleCase(info[0].replace(\"-\",\" \")) + \"\");\n $(\"#geniuslink\").prop(\"href\",geniusurl); \n if(info[2]!=\"ick=\"){\n $(\".artistlinks\").css(\"pointer-events\",\"auto\");\n }\n else{\n $(\".artistlinks\")\n .css(\"pointer-events\",\"none\")\n .css(\"cursor\",\"not-allowed\");\n }\n });\n\n}", "async function getDrink() {\r\n //const drink_url = \"https://www.thecocktaildb.com/api/json/v1/1/random.php\";\r\n const response = await fetch(\r\n \"https://www.thecocktaildb.com/api/json/v1/1/random.php\"\r\n );\r\n const data = await response.json();\r\n console.log(data);\r\n const drink = data.drinks[0].strDrink;\r\n const glass = data.drinks[0].strGlass;\r\n const instruct = data.drinks[0].strInstructions;\r\n const image = data.drinks[0].strDrinkThumb;\r\n const ingredList = [];\r\n if (data.drinks[0].strIngredient1 != null) {\r\n ingredList.push(data.drinks[0].strIngredient1);\r\n }\r\n if (data.drinks[0].strIngredient2 != null) {\r\n ingredList.push(data.drinks[0].strIngredient2);\r\n }\r\n if (data.drinks[0].strIngredient3 != null) {\r\n ingredList.push(data.drinks[0].strIngredient3);\r\n }\r\n if (data.drinks[0].strIngredient4 != null) {\r\n ingredList.push(data.drinks[0].strIngredient4);\r\n }\r\n if (data.drinks[0].strIngredient5 != null) {\r\n ingredList.push(data.drinks[0].strIngredient5);\r\n }\r\n console.log(ingredList);\r\n const measureList = [];\r\n if (data.drinks[0].strMeasure1 != null) {\r\n measureList.push(data.drinks[0].strMeasure1);\r\n }\r\n if (data.drinks[0].strMeasure2 != null) {\r\n measureList.push(data.drinks[0].strMeasure2);\r\n }\r\n if (data.drinks[0].strMeasure3 != null) {\r\n measureList.push(data.drinks[0].strMeasure3);\r\n }\r\n if (data.drinks[0].strMeasure4 != null) {\r\n measureList.push(data.drinks[0].strMeasure4);\r\n }\r\n if (data.drinks[0].strMeasure5 != null) {\r\n measureList.push(data.drinks[0].strMeasure5);\r\n }\r\n console.log(measureList);\r\n\r\n const pic = document.getElementById(\"cocktail-pic\");\r\n pic.src = image;\r\n\r\n document.getElementById(\r\n \"cocktail-display\"\r\n ).innerHTML = `Try a ${drink}. It's served in a ${glass}. ${instruct}`;\r\n\r\n for (let x = 0; x < ingredList.length; x++) {\r\n const ingredients = document.createElement(\"p\");\r\n ingredients.innerText = measureList[x] + \": \" + ingredList[x];\r\n document.getElementById(\"cocktail-display\").appendChild(ingredients);\r\n }\r\n}", "function deliverPrices(name, sort) {\n return new Promise(resolve => {\n var results = {};\n var prodIds = {};\n var numPrices = 0;\n\n searchName(name, sort)\n .then(function(search) {\n\n if(search.success == 'false' && search.errors); {\n if(search.errors.length > 0 && search.errors[0] == 'Missing or invalid bearer token.') {\n results.success = 'false';\n resolve(results);\n throw new Error(\"Invalid bearer token\");\n }\n }\n prodIds = search.results;\n return getPrices(search.results);\n })\n .then(function(resp) {\n var validPrices = {}, prices;\n validPrices[\"results\"] = [];\n\n if(resp.charAt(0) != '<'){\n prices = JSON.parse(resp);\n } else { throw new Error(\"unexpected HTTP response\"); }\n\n //filter nulls\n numPrices = prices.results.length;\n if(numPrices > 0) {\n for(i = 0; i < numPrices; i++) {\n if(prices.results[i].lowPrice != null){\n validPrices[\"results\"].push(prices.results[i]);\n }\n }\n }\n results.prices = validPrices.results;\n\n return getDetails(prodIds);\n })\n .then(function(resp) { //combined pricing results and product details results\n var cardIndex = {};\n var cardDetails = JSON.parse(resp);\n \n //index card details them first, each productID being the key\n cardDetails.results.forEach(function(card) {\n cardIndex[card.productId] = card;\n });\n\n results.prices.forEach(function(price, i) {\n var id = results.prices[i].productId;\n results.prices[i].name = cardIndex[id].name;\n results.prices[i].subTypeName = abbrvEd(price.subTypeName);\n //extended values\n cardIndex[id].extendedData.forEach(function(eData, j) {\n if(eData.name == \"Number\") { results.prices[i].series = eData.value; }\n if(eData.name == \"Rarity\") { results.prices[i].rarity = abbrvRarity(eData.value); }\n })\n });\n results.success = 'true';\n resolve(results);\n }).catch(function(err) {\n console.error(err);\n });\n });\n}", "async function scrapeLink(url, callback){\n\tvar error = null;\n\tvar html;\n\tvar response;\n\ttry {\n\t\tconst browser = await puppeteer.launch({\n\t\t\t\t\t\t\t\t\t\t\t\t args: [\n\t\t\t\t\t\t\t\t\t\t\t\t '--no-sandbox',\n\t\t\t\t\t\t\t\t\t\t\t\t '--disable-setuid-sandbox',\n\t\t\t\t\t\t\t\t\t\t\t\t ],\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\tconst page = await browser.newPage();\n\t\tawait page.goto(url, {waitUntil: 'networkidle2'});\n\t\thtml = await page.content();\n\n\t\t//cheerio scrape the product link into 4 items: name, description, images, and currentprice\n\t\tlet $ = cheerio.load(html);\n\n\t\tlet name = $('div.product-info-main h1.page-title > span.base').text();\n\t\tlet description = $('section.product-info__section div.product-info__description div#description').html();\n\t\tlet current_price = $('div.price-final_price span.price:nth-child(1)').html();\n\t\tlet imagesArr = [];\n\t\t$('div.media div.fotorama__stage__shaft div.fotorama__stage__frame', html).each(function() {\n\t\t imagesArr.push($(this).attr('href'));\n\t\t});\n\t\tresponse = {uuid: uuid.v1(),\n\t\t\t\t\tlink: url,\n\t\t\t\t\tname: name,\n\t\t\t\t desc: description,\n\t\t\t\t price: current_price,\n\t\t\t\t images: imagesArr};\n\n\t\tcallback(response, error);\n\t\tawait browser.close();\n\t} catch (err){\n\t\terror = err;\n\t\tcallback(response, error);\n\t}\n\t\n}", "function sendData(product) {\n document.querySelector('.loader').style.display = 'block';\n\n request.open('GET', `https://amazon23.p.rapidapi.com/product-search?query=${product}&page=1&country=US`, true);\n request.setRequestHeader('x-rapidapi-key', API_KEY);\n request.setRequestHeader('x-rapidapi-host', API_HOST);\n request.setRequestHeader('useQueryString', true);\n\n request.onload = function() {\n const data = JSON.parse(this.response);\n if(request.status === 200) {\n document.querySelector('.loader').style.display = 'none';\n const listContainer = document.createElement('div');\n listContainer.setAttribute('class', 'list__container');\n const h2 = document.createElement('h2');\n h2.textContent = 'Search Results';\n \n resultContainer.appendChild(h2);\n resultContainer.appendChild(listContainer);\n const ul = document.createElement('ul');\n listContainer.appendChild(ul);\n let sum = 0;\n\n const priceContainer = document.createElement('div');\n priceContainer.setAttribute('class', 'price__container');\n const p = document.createElement('p');\n const p1 = document.createElement('p');\n const p2 = document.createElement('p');\n const p3 = document.createElement('p');\n p.setAttribute('class', 'searchlist-average');\n resultContainer.appendChild(priceContainer);\n\n data.result.slice(0, 10).forEach(result => {\n //console.log('result', result);\n sum += result.price.current_price;\n const li = document.createElement('li');\n const span = document.createElement('span');\n span.setAttribute('class', 'searchlist-price');\n li.setAttribute('class', 'searchlist');\n span.textContent = ` Price: ${result.price.currency} ${result.price.current_price}`;\n li.textContent = result.title;\n li.appendChild(span);\n ul.appendChild(li);\n })\n\n average = Math.round((sum / 10) * 100 / 100).toFixed(2);\n price = parseInt(average);\n \n p.textContent = `Average Price: USD ${average}`;\n p1.textContent = `Sold 100/month: USD ${average * 100}`;\n p2.textContent = `Sold 200/month: USD ${average * 200}`;\n p3.textContent = `Sold 300/month: USD ${average * 300}`;\n priceContainer.appendChild(p);\n priceContainer.appendChild(p1);\n priceContainer.appendChild(p2);\n priceContainer.appendChild(p3);\n\n localStorage.setItem(product, average);\n createPriceSection();\n drawChart();\n } else {\n const p = document.createElement('p');\n p.textContent = 'There were no results found. Please try with another keyword!';\n \n resultContainer.appendChild(p);\n }\n }\n request.send();\n \n}", "makeURLList(){\r\n \r\n this.urls.length = 0;\r\n this.urls.push('https://cors-anywhere.herokuapp.com/http://sandipbgt.com/theastrologer/api/horoscope/' + this.sign.toLowerCase()+'/today/');\r\n this.urls.push('https://cors-anywhere.herokuapp.com/http://horoscope-api.herokuapp.com/horoscope/today/' + this.sign);\r\n this.urls.push('https://cors-anywhere.herokuapp.com/http://widgets.fabulously40.com/horoscope.json?sign=' + this.sign.toLowerCase());\r\n this.urls.push('https://cors-anywhere.herokuapp.com/http://ohmanda.com/api/horoscope/' + this.sign.toLowerCase());\r\n \r\n //calling the search function\r\n this.search();\r\n }", "renderSuggestion(suggestion){\n let imgUrl = suggestion.imageUrls.large.url;\n let price = suggestion.listPrice.formattedAmount;\n\n return (\n <div className=\"flexrow autosuggest__productcontainer\">\n <div className=\"autosuggest__product-left\">\n <img className=\"autosuggest__img\" src={imgUrl} alt=\"product\"/>\n </div>\n <div className=\"flexcolumn autosuggest__product-right\">\n <div className=\"autosuggest__name\">{suggestion.title}</div>\n <div className=\"autosuggest__price\">{price}</div>\n </div>\n </div>\n );\n }", "function privateGetProducts(data) {\n let products = [];\n\n let doc = new DOMParser().parseFromString(data, 'text/html');\n let searchResultNodes = doc.getElementsByClassName('s-result-item');\n\n // Get the product info we'll need to display the recs later\n jQuery(searchResultNodes).each(function(index) {\n let product = {\n imgUrl: jQuery(this).find('img').attr('src'),\n itemUrl: jQuery(this).find('.a-text-normal').attr('href'),\n asin: jQuery(this).attr('data-asin'),\n title: jQuery(this).find('.a-text-normal')[0] !== undefined ? jQuery(this).find('.a-text-normal')[0].innerText.trim() : \"\",\n price: jQuery(this).find('.a-price').find('.a-offscreen')[0] !== undefined ? jQuery(this).find('.a-price').find('.a-offscreen')[0].innerText : \"\",\n };\n products.push(product);\n });\n\n // Remove the first entry. Chances are, it's the product that customer is already looking at\n products.shift();\n return products;\n }", "function listExpensiveItems() {\n connection.query(\"SELECT max(price*stock_quantity) max_price from products\", function (err, maximum_price) {\n if (err) throw err;\n\n // Log all products of the SELECT statement\n console.log(\"Inside List Expensive - \"+maximum_price[0].max_price);\n connection.query(\"select product_name, sum(price * stock_quantity) stockPrice from products group by product_name having sum(price * stock_quantity) >= ?\", [parseFloat(maximum_price[0].max_price)], function (err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n console.log(\n \" Product Name: \" +\n res[i].product_name +\n \" || price * stock_quantity: $\" +\n res[i].stockPrice \n );\n }\n console.log(\"==========================================================================\")\n repeat();\n });\n });\n}", "function getItem(coll, cat, color, minprice, maxprice){\r\n $('.items').html(\"\");\r\n $('.footer').html(\"\");\r\n result = [];\r\n $.ajax({\r\n url: \"./dataset/data.php?collection=\"+coll+\"&category=\"+cat+\"&color=\"+color+\"&minprice=\"+minprice+\"&maxprice=\"+maxprice,\r\n type: 'GET',\r\n datatype: \"json\",\r\n contentType: \"text/html\",\r\n success: function (res) {\r\n result = eval(res);\r\n console.log(result);\r\n // calculate page Numbers for pagination\r\n totalPage = result.length;\r\n if (totalPage == 0) {\r\n var noRecord = '<div class=\"loading\"><h2>No Record Found</h2></div>';\r\n $('.items').append(noRecord);\r\n }\r\n if (totalPage < 8) {\r\n maxPage = totalPage;\r\n }\r\n else{\r\n maxPage = 8;\r\n }\r\n pageNumber = Math.ceil(totalPage/8);\r\n // iterate through number of pages to add pagination button\r\n for (let index = 0; index < pageNumber; index++) {\r\n var btnElement = '<button value=\"btn_' + (index + 1) + '\" onclick=\"filterPageNum('+ (index) +');\">' + (index + 1) + '</button>';\r\n $('.footer').append(btnElement);\r\n }\r\n // iterate all data to add filtered Items\r\n for (let index = minPage; index < maxPage; index++) {\r\n let item = '<div class=\"col-3 col-m-6 col-s-12\">'+\r\n '<div class=\"card\">'+\r\n '<div class=\"card-container\"><img src=\"'+result[index].product_Image+'\"></div>'+\r\n '<div class=\"card-footer\">'+\r\n '<div class=\"brand\">'+result[index].brand+'</div>'+\r\n '<div class=\"row\">'+\r\n '<div class=\"product-name inline-flex\">'+result[index].product_Name+'</div>'+\r\n '<div class=\"product-price float-right\"><span>$'+result[index].product_Price+'</span></div></div>'+\r\n '<div class=\"row\">'+\r\n '<div class=\"product-rating inline-flex\">';\r\n for (let j = 0; j < 5; j++) {\r\n if (j < result[index].product_Rating) {\r\n item += '<span><i class=\"fa fa-star\"></i></span>';\r\n }\r\n else{\r\n item += '<span><i class=\"fa fa-star-o\"></i></span>';\r\n }\r\n \r\n }\r\n item += '</div>'+\r\n '<div class=\"product-cart float-right\">'+\r\n '<i class=\"fa fa-cart-plus\"></i></div></div></div></div></div>';\r\n \r\n $('.items').append(item);\r\n }\r\n },\r\n error: function (xhr, responseText) {\r\n alert(\"Error\");\r\n }\r\n });\r\n }", "function check_price(url_param, id, domain){\n var options = url_param;\n //ASOS needs an API call\n if(domain == \"1\") {\n var url_read = \"http://api.asos.com/product/catalogue/v2/products/\" + id + \"?store=COM\";\n options = {\n url: url_read,\n method : 'GET',\n headers: {\n 'User-Agent': 'Mozilla/5.0'\n }\n };\n }\n var price_num, price_int;\n\n return new Promise(function(resolve, reject) {\n request(options, function(error, response, body) {\n var price;\n var price_htmls = [{standard: 'span#priceblock_ourprice', sale: 'span#priceblock_saleprice', book_sale: 'span.a-size-medium.a-color-price.offer-price.a-text-normal'}, '#product-price'];\n var title_htmls = ['span#productTitle', 'h1'];\n if(error){ //if error, reject\n console.log(\"error in http request\");\n reject(error);\n } //if the response status code is erroneous, reject\n else if(response.statusCode != 200) {\n console.log(`response status code was different, ${response.statusCode}`);\n reject(response.statusCode);\n }//otherwise there are no errors in the request\n else {\n //handle ASOS with an API call\n if(domain==1){\n let json = JSON.parse(body);\n price_num = Number(json.price.current.value);\n }//handle all other sites normally\n else{\n //load the html\n var $ = cheerio.load(body);\n var html_use\n if(domain==0){\n if($(price_htmls[domain].standard).length){\n html_use = price_htmls[domain].standard;\n } else if($(price_htmls[domain].sale).length){\n html_use = price_htmls[domain].sale;\n } else if($(price_htmls[domain].book_sale).length){\n html_use = price_htmls[domain].book_sale;\n } else{\n console.log(\"no price found for id\" + id);\n resolve(null);\n }\n }\n else{\n html_use = price_htmls[domain];\n }\n //find the html element where the price is located\n $(html_use).each(function(i, element) {\n //grab the text\n var el = $(this);\n var price_text = el.text();\n //separate off the currency\n price = price_text.split(price_text[0])[1];\n //save the price as a number\n price_num = Number(price);\n });\n }\n if(isNaN(price_num)){\n console.log(\"the price is not a number\");\n resolve(null);\n }\n price_int = Number(Math.round(price_num*100));\n resolve(price_int);\n //resolve the promise with the live price\n }\n });\n });\n}", "getMinPrice(val){\n const sizeDetails = this.props.details.sizes[val];\n const min = sizeDetails.sources.reduce((prev, current) => (Number(prev.discounted_price) > Number(current.discounted_price)) ? current : prev);\n return min;\n }", "function processURL(queryURL) {\n\n $.ajax({\n url: queryURL,\n method: \"GET\"\n })\n .then(function (response) {\n\n\n var turn_obj_to_array = Object.values(response);\n var stock_crypto_info = turn_obj_to_array[0];\n\n if (stock_crypto_info['3. Last Refreshed'] === undefined) {\n //this changes one of the key names so that the rest of the code run in the same way for both crypto and stock.\n stock_crypto_info['3. Last Refreshed'] = stock_crypto_info['6. Last Refreshed']\n delete stock_crypto_info['6. Last Refreshed']\n }\n\n var stock_crypto_price = Object.values(turn_obj_to_array[1]);\n var stock_crypto_dates = Object.keys(turn_obj_to_array[1]);\n\n //we are getting both the dates and prices but with diffrent structure.\n var newArray = stock_crypto_dates.map(function (x) {\n var date_index = stock_crypto_dates.indexOf(x);\n var price = stock_crypto_price[date_index];\n price.date = x\n\n //this will change some of the key names for crypto objects so that the rest of the code can function in the same way as stock\n if (price['2. high'] === undefined) {\n var high_crypto_val = price['2b. high (USD)'];\n var low_crypto_val = price['3b. low (USD)'];\n var open_crypto_val = price['1b. open (USD)'];\n var close_crypto_val = price['4a. close (CNY)'];\n\n price['2. high'] = price['2b. high (USD)']\n delete price['2b. high (USD)'];\n price['2. high'] = Number(high_crypto_val).toFixed(4);\n\n price['3. low'] = price['3b. low (USD)'];\n delete price['3b. low (USD)'];\n price['3. low'] = Number(low_crypto_val).toFixed(4);\n\n price['1. open'] = price['1b. open (USD)'];\n delete price['1b. open (USD)'];\n price['1. open'] = Number(open_crypto_val).toFixed(4);\n\n price['4. close'] = price['4a. close (CNY)'];\n delete price['4a. close (CNY)'];\n price['4. close'] = Number(close_crypto_val).toFixed(4);\n\n return price\n }\n else {\n return price\n }\n }); // end of the new array\n\n console.log(newArray);\n //finds the highest price for stock/crypto in whatever time frame you choose. \n var stock_crypto_highest_price = newArray.reduce(function (x, obj) {\n var y = obj['2. high'];\n if (y > x) {\n return Number(y)\n }\n else {\n return Number(x)\n }\n }, 0);\n\n //finds the lowest price for stock/crypto in whatever time frame you choose. \n var stock_crypto_lowest = newArray.reduce(function (x, obj) {\n var y = obj['3. low'];\n if (y > x) {\n return Number(x)\n }\n else {\n return Number(y)\n }\n }, 99999);\n\n var highest_price_info = newArray.find(function (obj) {\n return obj['2. high'] === stock_crypto_highest_price.toFixed(4).toString();\n });\n var lowest_price_info = newArray.find(function (obj) {\n return obj['3. low'] === stock_crypto_lowest.toFixed(4).toString();\n });\n\n\n // var chart2 = new CanvasJS.Chart(\"chartContainer2\", {\n // title: {\n // text: \"Live Data\"\n // },\n // data: [{\n // type: \"pie\",\n // dataPoints: [\n // { label: 'Highest Price Date: ' + highest_price_info.date, y: stock_crypto_highest_price }, //this will be in what ever interval we get\n\n // { label: \"Current Price Date: \" + stock_crypto_info['3. Last Refreshed'], y: Number(newArray[0]['2. high']) }\n // ]\n // }\n // ]\n\n // });\n // chart2.render();\n\n\n var chart = new CanvasJS.Chart(\"chartContainer\", {\n title: {\n text: 'AAPL \\n' + ' Last Refreshed: ' + stock_crypto_info['3. Last Refreshed'],\n\n },\n data: [\n {\n // Change type to \"doughnut\", \"line\", \"splineArea\", etc.\n type: \"splineArea\",\n dataPoints: [\n { label: 'Highest Price Date: ' + highest_price_info.date, y: stock_crypto_highest_price }, //this will be in what ever interval we get\n\n { label: \"Lowest Price Date: \" + lowest_price_info.date, y: stock_crypto_lowest },\n\n { label: \"Current Price Date: \" + stock_crypto_info['3. Last Refreshed'], y: Number(newArray[0]['2. high']) }\n ]\n }\n ]\n });\n chart.render();\n\n //this save the price informations of the first date chosen. \n var showInfo_date1 = newArray.find(function (obj) {\n return obj.date === stock_chosen_date_1\n });\n var showInfo_date2 = newArray.find(function (obj) {\n return obj.date === stock_chosen_date_2\n });\n\n\n function calculateInvestment(x) {\n var investment = x;\n var date1_avg_price = (Number(showInfo_date1['2. high']) + Number(showInfo_date1['3. low'])) / 2; //from\n var date2_avg_price = (Number(showInfo_date2['2. high']) + Number(showInfo_date2['3. low'])) / 2; //to\n var result = investment / date1_avg_price * date2_avg_price;\n var percantageChange = (result - investment) / investment;\n var gain_or_lose = result - investment;\n\n return 'Your gain/lose: $' + gain_or_lose.toFixed(2) + '\\n' + 'ROI: $' + result.toFixed(2) + '\\n' + 'Percantage increase/deacrese: ' + percantageChange.toFixed(3) * 100 + '%'\n }\n\n }); //end of ajax(then) call\n} // end of process function", "function parseResponse(resp) {\n\n if (resp.status_code === 'OK') {\n var results = resp.results;\n for (i = 0; i < results[0].colors.length; i++) {\n tags[i] = results[0].colors[i].w3c.hex;\n densities[i] = results[0].colors[i].density;\n }\n \n // SORT SOME JAMS\n // sortd array holds the indeces of the colors/densities \n // in order of decreasing weight\n var absMax = 1;\n var max;\n var maxI;\n for (i=0;i<densities.length; i++){\n max = 0;\n for(j=0;j<densities.length; j++){\n if(densities[j]<absMax && densities[j]>max){\n max = densities[j];\n maxI = j;\n }\n }\n sortd[i] = maxI;\n absMax = densities[sortd[i]];\n \n }\n\n } else {\n console.log('Sorry, something is wrong.');\n }\n\n $('#tags').text(tags.toString().replace(/,/g, ', '));\n $('#dens').text(densities.toString().replace(/,/g, ', '));\n setColor(elements);\n return tags;\n}", "async function getGasPrice(debug)\n{\n const defaultGasPrice = {\n code: 200,\n data: {\n rapid: ethers.utils.parseUnits('20', 'gwei'),\n fast: ethers.utils.parseUnits('17', 'gwei'),\n standard: ethers.utils.parseUnits('12', 'gwei'),\n slow: ethers.utils.parseUnits('9', 'gwei'),\n timestamp: 1618448344593\n }\n };\n // Alternative: https://docs.ethgasstation.info/gas-price\n // https://ethgasstation.info/api/ethgasAPI.json?api-key=XXAPI_Key_HereXXX\n // ***Note: To convert the provided values to gwei, divide by 10.***\n\n // https://taichi.network/#gasnow\n const queryURL = \"https://www.gasnow.org/api/v3/gas/price?utm_source=:AutomaticTraders\";\n const resonse = await getUrlRequest(queryURL, defaultGasPrice);\n const priceList = resonse.data;\n // console.log(priceList);\n if (debug) {\n console.log(\"-------------------\");\n console.log(\"gas price:\");\n console.log(\"rapid: \" + ethers.utils.formatUnits(priceList.rapid, 'gwei'));\n console.log(\"fast: \" + ethers.utils.formatUnits(priceList.fast, 'gwei'));\n console.log(\"standard: \" + ethers.utils.formatUnits(priceList.standard, 'gwei'));\n console.log(\"slow: \" + ethers.utils.formatUnits(priceList.slow, 'gwei'));\n console.log(\"-------------------\");\n }\n return priceList;\n}", "function buildPetUrl(obj){\n\n var urlBuild = 'https://api.petfinder.com/pet.find?key=e1bf9c7e6dcb9f122154bef369c419db&output=full&format=json&count=100'\n console.log(\"buildPetUrl\");\n console.log(obj);\n var str = \"\";\n if (obj.animal) {\n str = obj.animal.replace(/_/gi,\"%20\");\n urlBuild = urlBuild + '&animal='+str;\n }\n else if (obj.breed){\n str = obj.breed.replace(/_/gi,\"%20\");\n urlBuild = urlBuild + '&breed=' + str;\n }\n if (obj.size){\n urlBuild = urlBuild + '&size='+ obj.size;\n }\n \n urlBuild = urlBuild +'&location='+obj.zipCode;\n return urlBuild;\n}//end buildPetUrl", "function i(e,i,h){const s=e.thumbnail&&e.thumbnail.url;return s?(0,_request_js__WEBPACK_IMPORTED_MODULE_0__.default)(s,{responseType:\"image\"}).then((t=>{const e=n(t.data,h);return h&&h.node?(h.node.appendChild(e),h.node):e})):e.fetchSymbol().then((t=>i(t,h)))}", "constructor(title, imagURL,price,description){\n this.title=title;\n this.imagURL=imagURL;\n this.price=price;\n this.description=description;\n }", "function question3() {\n data.forEach(function(element) {\n if (element.currency_code === \"GBP\") {\n console.log(element.title, element.price);\n }\n });\n}", "function createImageSources( image_html, media ) {\n\n console.log('create image source');\n\n var $ = cheerio.load( image_html );\n var image = $('img');\n\n //if ( media.Website_Featured_Image ) {\n //console.log( image_html );\n //}\n\n var src = image.attr('src');\n var low = image.attr( 'lowqual');\n var med = image.attr( 'medqual');\n\n //console.log(src);\n\n if( typeof src !== 'undefined' ){\n\n if ( src.indexOf( '://' ) === -1 ) {\n\n var true_image_src = mapTrueImageSource( media.ID, extractImageName( src ) );\n\n var true_image_low = (typeof low === 'undefined') ? true_image_src : mapTrueImageSource( media.ID, extractImageName( low ) );\n var true_image_med = (typeof med === 'undefined') ? true_image_src : mapTrueImageSource( media.ID, extractImageName( med ) );\n\n // console.log('qualities:');\n // console.log( true_image_src );\n // console.log( true_image_med );\n // console.log('');\n\n return {\n type: 'zoho',\n has_low_quality_versions: (typeof low !== 'undefined') || (typeof med !== 'undefined'),\n src: true_image_src,\n high: true_image_src,\n med: true_image_med,\n low: true_image_low\n };\n\n } else {\n\n return {\n type: 'other',\n has_low_quality_versions: false,\n src: src,\n high: src,\n med: src,\n low: src\n };\n\n }\n\n } else {\n\n return {\n type: 'other',\n has_low_quality_versions: false,\n src: src,\n high: src,\n med: src,\n low: src\n };\n\n }\n\n}", "function parseUrl(url) {\n const { host, pathname } = new URL(url);\n const { 1: bucket, 2: region } = host.match(/^([^.]*)\\.cos\\.([^.]*)\\.myqcloud\\.com$/);\n let key = decodeURIComponent(pathname.slice(1));\n if (key.includes('?')) {\n key = key.replace(/\\?[\\s\\S]*$/, '');\n }\n return {\n bucket,\n region,\n key,\n };\n}", "function getPixivID(img) {\n const file_regex = /(\\d+)_p\\d+/;\n const url_regex = /\\/(\\d+)$/;\n let regex = undefined;\n //console.log(parse(img));\n if (parse(img).hostname === \"i.pximg.net\") { regex = url_regex; }\n else { regex = file_regex; }\n\n const id = img.match(regex);\n if (id && id.length) {\n const url = `https://pixiv.net/artworks/${id[1]}`;\n return url;\n }\n return \"\";\n}", "async function get(x) {\n// \tx = x || 5\n// client.getPageList().then((pages) => {\n// let list = pages.pages\n// var items = list.filter((list,idx) => idx < x)\n// let recipes = items\n \n// .map(({ title, url }) => (\n// \"\\n\\n [\"+title+\"](\"+url+\")\" \n// ))\n \nlet re = await tgph([\"50.4825,30.4887\",\"FEEE FUUU\",\"https://i.ibb.co/whfQZbG/file-193.jpg\"])\nconsole.info(re)\n// recipes = items\n \n// .map(({ url }) => (\n// url \n// ))\n \n\n// console.log(recipes)\n\t\n}", "function getJson() {\n fetch('products.json')\n .then(res => res.json())\n .then(data => {\n let output = '';\n data.forEach(function(post) {\n output += `\n <div class=\"product product_horizontal\"> \n <span class=\"product_code\">Код: ${post.code}</span>\n <div class=\"product_status_tooltip_container\">\n <span class=\"product_status\">Наличие</span>\n </div> \n <div class=\"product_photo\">\n <a href=\"#\" class=\"url--link product__link\">\n <img src=\"${post.primaryImageUrl}\">\n </a> \n </div>\n <div class=\"product_description\">\n <a href=\"#\" class=\"product__link\">${post.title}</a>\n </div>\n <div class=\"product_tags hidden-sm\">\n <p>Могут понадобиться:</p>\n <a href=\"#\" class=\"url--link\">${post.assocProducts}</a>\n </div>\n <div class=\"product_units\">\n <div class=\"unit--wrapper\">\n <div class=\"unit--select unit--active\">\n <p class=\"ng-binding\">За м. кв.</p>\n </div>\n <div class=\"unit--select\">\n <p class=\"ng-binding\">За упаковку</p>\n </div>\n </div>\n </div>\n <p class=\"product_price_club_card\">\n <span class=\"product_price_club_card_text\">По карте<br>клуба</span>\n <span class=\"goldPrice\">${post.priceGoldAlt.toFixed(2)}</span>\n <span class=\"rouble__i black__i\">\n <svg version=\"1.0\" id=\"rouble__b\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0\" y=\"0\" width=\"30px\" height=\"22px\" viewBox=\"0 0 50 50\" enable-background=\"new 0 0 50 50\" xml:space=\"preserve\">\n <use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#rouble_black\"></use>\n </svg>\n </span>\n </p>\n <p class=\"product_price_default\">\n <span class=\"retailPrice\">${post.priceRetailAlt.toFixed(2)}</span>\n <span class=\"rouble__i black__i\">\n <svg version=\"1.0\" id=\"rouble__g\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0\" y=\"0\" width=\"30px\" height=\"22px\" viewBox=\"0 0 50 50\" enable-background=\"new 0 0 50 50\" xml:space=\"preserve\">\n <use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#rouble_gray\"></use>\n </svg>\n </span>\n </p>\n <div class=\"product_price_points\">\n <p class=\"ng-binding\">Можно купить за 231,75 балла</p>\n </div>\n <div class=\"list--unit-padd\"></div>\n <div class=\"list--unit-desc\">\n <div class=\"unit--info\">\n <div class=\"unit--desc-i\"></div>\n <div class=\"unit--desc-t\">\n <p>\n <span class=\"ng-binding\">Продается упаковками:</span>\n <span class=\"unit--infoInn\">1 упак. = 2.47 м. кв. </span>\n </p>\n </div>\n </div>\n </div>\n <div class=\"product__wrapper\">\n <div class=\"product_count_wrapper\">\n <div class=\"stepper\">\n <input class=\"product__count stepper-input\" type=\"number\" value=\"0\">\n <span class=\"stepper-arrow up\"></span>\n <span class=\"stepper-arrow down\"></span> \n </div>\n </div>\n <span class=\"btn btn_cart\" data-url=\"/cart/\" data-product-id=\"${post.productId}\">\n <svg class=\"ic ic_cart\">\n <use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#cart\"></use>\n </svg>\n <span class=\"ng-binding\">В корзину</span>\n </span>\n </div>\n </div>`;\n });\n document.getElementById('products_section').innerHTML = output;\n })\n .catch(err => console.log(err))\n }", "function searchByUrl(url)\r\n{\r\n objArtNumberArr = [];\r\n fetch(url)\r\n .then(res => res.json())\r\n .then(out =>{\r\n disableResViewers()\r\n if(out.count==0)\r\n {\r\n noRes[0].style.display = \"block\";\r\n }\r\n if(out.count>7)\r\n {\r\n bottomPagePanel[0].style.display = \"grid\";\r\n if(pageNumber==1)\r\n {\r\n totalPages=Math.ceil(out.count/7);\r\n if(totalPages>1428)\r\n {\r\n totalPages=1428; //Implemented due to API restrictions\r\n }\r\n }\r\n changeNumerator(pageNumber);\r\n }\r\n\r\n for (let objArt in out.artObjects)\r\n {\r\n let objNumber=out.artObjects[objArt].objectNumber;\r\n objArtNumberArr.push(objNumber);\r\n\r\n let namesArr = out.artObjects[objArt].longTitle.split(',');\r\n\r\n resViewers[objArt].style.display = \"grid\";\r\n\r\n resImage[objArt].src=out.artObjects[objArt].webImage.url;\r\n resTitle[objArt].innerHTML=\"Title: \"+out.artObjects[objArt].title;\r\n resAuthor[objArt].innerHTML=\"Author: \"+out.artObjects[objArt].principalOrFirstMaker;\r\n resDate[objArt].innerHTML=\"Date: \"+namesArr[namesArr.length-1];\r\n\r\n }\r\n }\r\n )\r\n .then(out=>\r\n {\r\n getDescription();\r\n })\r\n .catch(err => console.log(err));\r\n}", "function comparePrice(a,b){\r\n return a.price - b.price; console.log(hats.sort(comparePrice));\r\n }", "function getImgurURL(oldURL) {\n\tif (!oldURL) {\n\t\treturn (\"\");\n\t}\n\telse if (oldURL.indexOf(\"imgur\") == -1) {\n\t\treturn (\"\");\n\t}\n\telse if (oldURL.replace(\".com\").indexOf(\".\") > -1) {\n\t\treturn (oldURL.replace(\"gallery/\",\"\"));\n\t}\n\t\n\tvar index = oldURL.lastIndexOf(\"/\");\n var tempID = oldURL.substring(index + 1);\n\tvar url = \"http://i.imgur.com/\" + tempID + \".jpg\";\n\treturn (url);\n}", "function descendProducts(data){\n data.sort((a, b) => (b.price) - (a.price));\n show(data);\n}", "constructor(title, imageUrl, price, description) {\n this.title = title;\n this.imageUrl = imageUrl;\n this.price = price;\n this.description = description;\n }", "async getCryptoCurrencyList(){\nconst url = await fetch('https://data.messari.io/api/v2/assets?with-metrics&with-profiles')\n\n// return this as json \nconst cryptoCurrency = await url.json();\n\n// return this as an object\nreturn{\n cryptoCurrency\n}\n}", "function constructItemUrl(encodedItemName, currency) {\r\n const baseUrl = \"https://steamcommunity.com/market/priceoverview/\";\r\n const currencyParam = \"?currency=\";\r\n const currentyValue = currency;\r\n const appIDParam = \"&appid=730\";\r\n const itemNameParam = \"&market_hash_name=\";\r\n const itemNameValue = encodedItemName;\r\n\r\n return baseUrl + currencyParam + currentyValue + appIDParam + itemNameParam + itemNameValue;\r\n}", "function displayPriceRange() {\r\n //Output all products with a user specified price range\r\n let lowPrice = Number(prompt(\"Please enter lowest price: \"));\r\n let highPrice = Number(prompt(\"Please enter highest price: \"));\r\n\r\n let count = 0;\r\n\r\n outputEl.innerHTML = \"<h2>Display Price Products</h2>\";\r\n outputStr = \"<ul>\";\r\n for (let i = 0; i < groceryData.length; i++) {\r\n let product = groceryData[i];\r\n if (product.price >= lowPrice && product.price <= highPrice){\r\n outputEl.innerHTML += \"<li>\" + productString(product) + \"</li>\";\r\n count++;\r\n }\r\n \r\n }\r\n outputStr = \"</ul>\";\r\n outputEl.innerHTML += \"<p>Total number of products : \" + count + \"</p>\";\r\n \r\n}", "function processURLs(urls){\n\tif(DEBUG) console.log('in processURLs');\n\tvar aggregate = null;\n\tfor(var index in urls){\n\t\tvar url = urls[index];\t\t\n\t\tvar dem = normalize(getDemographicsFromLocalStore(url));\n\t\t//console.log('normalized ' + JSON.stringify(dem));\n\t\t\n\t\tif (aggregate) {\n\t\t\tfor(index in aggregate){\n\t\t\t\tvar aggBlob = aggregate[index];\n\t\t\t\tvar demBlob = dem[index];\n\t\t\t\tif($.isPlainObject(aggBlob) ) {\n\t\t\t\t\taggregate[index] = product(aggBlob, demBlob);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\taggregate = dem;\n\t\t}\n\t\taggregate.support.push(url);\n\t}\n\tif(DEBUG) console.log('Support: ' + aggregate.support.length);\t//JSON.stringify(aggregate)\n\treturn aggregate;\n}", "__getFakeProducts() {\n return {\n products: [\n {\n id: 632910392,\n title: \"IPod Nano - 8GB\",\n body_html:\n \"<p>It's the small iPod with one very big idea: Video. Now the world's most popular music player, available in 4GB and 8GB models, lets you enjoy TV shows, movies, video podcasts, and more. The larger, brighter display means amazing picture quality. In six eye-catching colors, iPod nano is stunning all around. And with models starting at just $149, little speaks volumes.</p>\",\n vendor: \"Apple\",\n product_type: \"Cult Products\",\n created_at: \"2020-09-15T17:53:00-04:00\",\n handle: \"ipod-nano\",\n updated_at: \"2020-09-15T17:53:00-04:00\",\n published_at: \"2007-12-31T19:00:00-05:00\",\n template_suffix: null,\n published_scope: \"web\",\n tags: \"Emotive, Flash Memory, MP3, Music\",\n admin_graphql_api_id: \"gid://shopify/Product/632910392\",\n variants: [\n {\n id: 808950810,\n product_id: 632910392,\n title: \"Pink\",\n price: \"199.00\",\n sku: \"IPOD2008PINK\",\n position: 1,\n inventory_policy: \"continue\",\n compare_at_price: null,\n fulfillment_service: \"manual\",\n inventory_management: \"shopify\",\n option1: \"Pink\",\n option2: null,\n option3: null,\n created_at: \"2020-09-15T17:53:00-04:00\",\n updated_at: \"2020-09-15T17:53:00-04:00\",\n taxable: true,\n barcode: \"1234_pink\",\n grams: 567,\n image_id: 562641783,\n weight: 1.25,\n weight_unit: \"lb\",\n inventory_item_id: 808950810,\n inventory_quantity: 10,\n old_inventory_quantity: 10,\n requires_shipping: true,\n admin_graphql_api_id: \"gid://shopify/ProductVariant/808950810\",\n presentment_prices: [\n {\n price: {\n currency_code: \"USD\",\n amount: \"199.00\",\n },\n compare_at_price: null,\n },\n ],\n },\n {\n id: 49148385,\n product_id: 632910392,\n title: \"Red\",\n price: \"199.00\",\n sku: \"IPOD2008RED\",\n position: 2,\n inventory_policy: \"continue\",\n compare_at_price: null,\n fulfillment_service: \"manual\",\n inventory_management: \"shopify\",\n option1: \"Red\",\n option2: null,\n option3: null,\n created_at: \"2020-09-15T17:53:00-04:00\",\n updated_at: \"2020-09-15T17:53:00-04:00\",\n taxable: true,\n barcode: \"1234_red\",\n grams: 567,\n image_id: null,\n weight: 1.25,\n weight_unit: \"lb\",\n inventory_item_id: 49148385,\n inventory_quantity: 20,\n old_inventory_quantity: 20,\n requires_shipping: true,\n admin_graphql_api_id: \"gid://shopify/ProductVariant/49148385\",\n presentment_prices: [\n {\n price: {\n currency_code: \"USD\",\n amount: \"199.00\",\n },\n compare_at_price: null,\n },\n ],\n },\n {\n id: 39072856,\n product_id: 632910392,\n title: \"Green\",\n price: \"199.00\",\n sku: \"IPOD2008GREEN\",\n position: 3,\n inventory_policy: \"continue\",\n compare_at_price: null,\n fulfillment_service: \"manual\",\n inventory_management: \"shopify\",\n option1: \"Green\",\n option2: null,\n option3: null,\n created_at: \"2020-09-15T17:53:00-04:00\",\n updated_at: \"2020-09-15T17:53:00-04:00\",\n taxable: true,\n barcode: \"1234_green\",\n grams: 567,\n image_id: null,\n weight: 1.25,\n weight_unit: \"lb\",\n inventory_item_id: 39072856,\n inventory_quantity: 30,\n old_inventory_quantity: 30,\n requires_shipping: true,\n admin_graphql_api_id: \"gid://shopify/ProductVariant/39072856\",\n presentment_prices: [\n {\n price: {\n currency_code: \"USD\",\n amount: \"199.00\",\n },\n compare_at_price: null,\n },\n ],\n },\n {\n id: 457924702,\n product_id: 632910392,\n title: \"Black\",\n price: \"199.00\",\n sku: \"IPOD2008BLACK\",\n position: 4,\n inventory_policy: \"continue\",\n compare_at_price: null,\n fulfillment_service: \"manual\",\n inventory_management: \"shopify\",\n option1: \"Black\",\n option2: null,\n option3: null,\n created_at: \"2020-09-15T17:53:00-04:00\",\n updated_at: \"2020-09-15T17:53:00-04:00\",\n taxable: true,\n barcode: \"1234_black\",\n grams: 567,\n image_id: null,\n weight: 1.25,\n weight_unit: \"lb\",\n inventory_item_id: 457924702,\n inventory_quantity: 40,\n old_inventory_quantity: 40,\n requires_shipping: true,\n admin_graphql_api_id: \"gid://shopify/ProductVariant/457924702\",\n presentment_prices: [\n {\n price: {\n currency_code: \"USD\",\n amount: \"199.00\",\n },\n compare_at_price: null,\n },\n ],\n },\n ],\n options: [\n {\n id: 594680422,\n product_id: 632910392,\n name: \"Color\",\n position: 1,\n values: [\"Pink\", \"Red\", \"Green\", \"Black\"],\n },\n ],\n images: [\n {\n id: 850703190,\n product_id: 632910392,\n position: 1,\n created_at: \"2020-09-15T17:53:00-04:00\",\n updated_at: \"2020-09-15T17:53:00-04:00\",\n alt: null,\n width: 123,\n height: 456,\n src:\n \"https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1600206780\",\n variant_ids: [],\n admin_graphql_api_id: \"gid://shopify/ProductImage/850703190\",\n },\n {\n id: 562641783,\n product_id: 632910392,\n position: 2,\n created_at: \"2020-09-15T17:53:00-04:00\",\n updated_at: \"2020-09-15T17:53:00-04:00\",\n alt: null,\n width: 123,\n height: 456,\n src:\n \"https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano-2.png?v=1600206780\",\n variant_ids: [808950810],\n admin_graphql_api_id: \"gid://shopify/ProductImage/562641783\",\n },\n ],\n image: {\n id: 850703190,\n product_id: 632910392,\n position: 1,\n created_at: \"2020-09-15T17:53:00-04:00\",\n updated_at: \"2020-09-15T17:53:00-04:00\",\n alt: null,\n width: 123,\n height: 456,\n src:\n \"https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1600206780\",\n variant_ids: [],\n admin_graphql_api_id: \"gid://shopify/ProductImage/850703190\",\n },\n },\n {\n id: 921728736,\n title: \"IPod Touch 8GB\",\n body_html:\n \"<p>The iPod Touch has the iPhone's multi-touch interface, with a physical home button off the touch screen. The home screen has a list of buttons for the available applications.</p>\",\n vendor: \"Apple\",\n product_type: \"Cult Products\",\n created_at: \"2020-09-15T17:53:00-04:00\",\n handle: \"ipod-touch\",\n updated_at: \"2020-09-15T17:53:00-04:00\",\n published_at: \"2008-09-25T20:00:00-04:00\",\n template_suffix: null,\n published_scope: \"web\",\n tags: \"\",\n admin_graphql_api_id: \"gid://shopify/Product/921728736\",\n variants: [\n {\n id: 447654529,\n product_id: 921728736,\n title: \"Black\",\n price: \"199.00\",\n sku: \"IPOD2009BLACK\",\n position: 1,\n inventory_policy: \"continue\",\n compare_at_price: null,\n fulfillment_service: \"shipwire-app\",\n inventory_management: \"shipwire-app\",\n option1: \"Black\",\n option2: null,\n option3: null,\n created_at: \"2020-09-15T17:53:00-04:00\",\n updated_at: \"2020-09-15T17:53:00-04:00\",\n taxable: true,\n barcode: \"1234_black\",\n grams: 567,\n image_id: null,\n weight: 1.25,\n weight_unit: \"lb\",\n inventory_item_id: 447654529,\n inventory_quantity: 13,\n old_inventory_quantity: 13,\n requires_shipping: true,\n admin_graphql_api_id: \"gid://shopify/ProductVariant/447654529\",\n presentment_prices: [\n {\n price: {\n currency_code: \"USD\",\n amount: \"199.00\",\n },\n compare_at_price: null,\n },\n ],\n },\n ],\n options: [\n {\n id: 891236591,\n product_id: 921728736,\n name: \"Title\",\n position: 1,\n values: [\"Black\"],\n },\n ],\n images: [],\n image: null,\n },\n ],\n };\n }", "function getProductsList() {\n return new Promise((resolve, reject) => {\n const data = fetch('https://www.everyonedoesit.ca/products.json')\n if (data) {\n resolve(data);\n } else {\n reject(Error('Nothing here!'));\n }\n });\n}", "function init() {\n\n $.ajax({\n\n url:'https://www.discogs.com/sell/post/' + releaseId,\n\n type: 'GET',\n\n dataType: 'html',\n\n success: function(response) {\n\n // Clear out old prices if they exist\n $('.de-price').remove();\n\n // Reset our values\n items = $('.shortcut_navigable .item_description .item_condition span.item_media_condition');\n\n priceContainer = [];\n\n prices = $('td.item_price span.price');\n\n result = $(response);\n\n nodeId = resourceLibrary.findNode(result);\n\n priceKey = resourceLibrary.prepareObj( $(result[nodeId]).prop('outerHTML') );\n\n return checkForSellerPermissions();\n }\n });\n }", "function parsedSmallImages(imgLink) {\n\tconst findPattern = imgLink.match(/150/g);\n\tconst nullFire = null;\n\tconst gotPattern = ['150'];\n\n\tif (nullFire === findPattern) {\n\t\treturn imgLink.replace('\\\\', '').replace('\\\\', '').replace('\\\\', '').replace('\\\\', '').replace('\\\\', '');\n\t} else if (findPattern[0] === gotPattern[0]) {\n\t\treturn imgLink.replace('', '').replace('\\\\', '').replace('\\\\', '').replace('\\\\', '').replace('\\\\', '').replace('\\\\', '').replace('\\\\', '');\n\t}\n}", "function parseIntoArray(productsData) {\n $scope.shopProducts = [];\n var jsonObj = JSON.parse(productsData);\n for (var i = 0, max = jsonObj.length; i < max; i++) {\n\n var prod = {\n ID: jsonObj[i].id,\n DESC: jsonObj[i].productDesc,\n PRICE: jsonObj[i].price,\n CATEGORY: jsonObj[i].category,\n IMAGEURL: jsonObj[i].imageURL\n };\n $scope.shopProducts.push(prod);\n }\n }", "function products() {\r\n var currentUrlString = window.location.href;\r\n var url = new URL(currentUrlString);\r\n var productId = url.searchParams.get(\"id\");\r\n console.log(productId);\r\n \r\n var requestProd = new XMLHttpRequest();\r\n var urlProd = \"http://localhost:8080/tradetunnel-api-0.0.1-SNAPSHOT/products/\"+productId;\r\n\r\n requestProd.onreadystatechange = function() {\r\n if (this.readyState == 4) {\r\n var dataProd = JSON.parse(this.responseText);\r\n \r\n console.log(dataProd.productName);\r\n console.log(dataProd.productDescription);\r\n console.log(dataProd.price);\r\n console.log(dataProd.stat);\r\n $('#prod1').html(dataProd.productName);\r\n $('#prod2').html(dataProd.productDescription);\r\n $('#prod3').html(\"$ \"+dataProd.price);\r\n $('#prod4').html(dataProd.stat);\r\n var user = dataProd._links.userProfile.href;\r\n var imageUrl = dataProd._links.image.href;\r\n displayImage(imageUrl);\r\n userDetails(user);\r\n }\r\n };\r\n \r\n requestProd.open(\"GET\", urlProd, true);\r\n requestProd.send();\r\n}", "async fetchItem(query) {\n const path = `https://api.bestbuy.com/v1/products(sku=${query})?apiKey=${bestBuyKey}&sort=bestSellingRank.asc&show=bestSellingRank,color,condition,customerReviewAverage,customerReviewCount,description,details.name,details.value,dollarSavings,features.feature,freeShipping,frequentlyPurchasedWith.sku,image,includedItemList.includedItem,inStoreAvailability,inStoreAvailabilityText,longDescription,manufacturer,mobileUrl,modelNumber,name,onlineAvailability,onlineAvailabilityText,onSale,percentSavings,preowned,regularPrice,relatedProducts.sku,salePrice,shipping,shippingCost,shortDescription,sku,thumbnailImage,type,upc,url&format=json`;\n\n await axios\n .get(path)\n .then((response) => {\n this.setState({\n searchData: response.data.products[0],\n isReady: true,\n });\n // console.log(response);\n })\n .catch((error) => {\n console.log(error);\n });\n }", "function ParsedURL(parsedInput){\n parsedInput.forEach(function (item) {\n filePath = \"avatars/\" + item.login + \".png\";\n url = item.avatar_url;\n downloadImageByURL(url, filePath);\n })\n\n// this function extracts the filepath and url of the js objects gained from the get request\n// particularly the filepath needs to have a .jpg appended on the end of it or it won't\n// a picture\n}", "function getProducts(url, callback) {\n\trequest({url: url, jar: true}, function(err,resp,body) {\n\t\tif (err)\n\t\t\tthrow err;\n\t\t$ = cheerio.load(body);\n\t\t// console.log(body);\n\t\tvar productList = $(\"#products\").find(\"li\").find(\".product-info\").find(\"a\");\n\t\tvar productLinks = [];\n\t\t\n\t\tproductList.each(function (i) {\n\t\t\tproductLinks.push($(this).attr(\"href\"));\n\t\t});\n\t\t\n\t\t//console.log(productLinks);\n\n\t\t// This is an example of a self executing function from http://blog.miguelgrinberg.com/post/easy-web-scraping-with-nodejs <<<---- READ IT\n\n\t\t// We declare a variable \n\t\t// var theLink = \"bitch\"\n\n\t\t// The function is then writtent var myFunction = function(variable)\n\t\t// We replace function part with another function in brackets var myFunction = (...[new function]...) (variable i.e. theLink);\n\n\t\t// var callback = ( function(myVariable) {\n\t\t// \treturn function() {\n\t\t// \t\tconsole.log(myVariable)\n\t\t// \t}\n\t\t// }) (theLink);\n\n\t\t// theLink = \"cunt\";\n\n\t\tcallback(productLinks);\n\t});\n}", "function parseUrl() {\n var hash = window.location.hash.substr(1),\n rez = hash.split(\"-\"),\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\n gallery = rez.join(\"-\");\n\n return {\n hash: hash,\n /* Index is starting from 1 */\n index: index < 1 ? 1 : index,\n gallery: gallery\n };\n }", "function parseUrl() {\n var hash = window.location.hash.substr(1),\n rez = hash.split(\"-\"),\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\n gallery = rez.join(\"-\");\n\n return {\n hash: hash,\n /* Index is starting from 1 */\n index: index < 1 ? 1 : index,\n gallery: gallery\n };\n }", "function parseUrl() {\n var hash = window.location.hash.substr(1),\n rez = hash.split(\"-\"),\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\n gallery = rez.join(\"-\");\n\n return {\n hash: hash,\n /* Index is starting from 1 */\n index: index < 1 ? 1 : index,\n gallery: gallery\n };\n }", "prices() {\n return this.getPricesV1()\n .catch((err) => {\n console.error(\"Error in 'prices' method of nomics module\\n\" + err);\n throw new Error(err);\n });\n }", "function getEndPoints () {\n console.log('For this run incr =' + incr);\n //This is the number of images returned in the JSON file (currently 1056)\n var numberImages = quizState.jsonText.Response.Image.length;\n //this do loop gets a random image and checks that it comes the Delmarva folder using the .search method\n //If not, it fetches another image\n do {\n quizState.imageArrayNumber = Math.floor((Math.random() * numberImages) + 1);\n var n = quizState.jsonText.Response.Image[quizState.imageArrayNumber].WebUri.search('Delmarva');\n }\n while (n < 0);\n //These extract the new endpoints and completes them by adding smugmug.com\n quizState.returnedRawImageEndpoint = 'https://www.smugmug.com' + quizState.jsonText.Response.Image[quizState.imageArrayNumber].Uris.ImageSizeDetails.Uri;\n quizState.returnedAlbumUri = quizState.jsonText.Response.Image[quizState.imageArrayNumber].Uris.ImageAlbum.Uri;\n quizState.returnedAlbumUri = 'https://www.smugmug.com' + quizState.returnedAlbumUri;\n getImageUrl();\n}", "function getTaggedPhoto(randomTag) {\n fetch(`${endPoint}${randomTag}${apiKey}`)\n .then(function(resp) {\n if (!resp.ok) {\n alert(\n \"Hey, something went wrong. Please contact your local Developer Team\"\n );\n return;\n }\n return resp.json();\n })\n .then(function(res) {\n const items = res.response;\n for (let item of items) {\n /*removing the photos that returned \n undefined without the URL*/\n if (item.photos !== undefined) {\n /* === alt size (not used) === */\n //const altSizes = item.photos[0].alt_sizes;\n //const imgSrc = altSizes[altSizes.length - 1].url;\n\n const imgSrc = item.photos[0].original_size.url;\n const div = document.createElement(\"div\");\n div.classList.add(\n \"m-2\",\n \"text-center\",\n \"col-lg-2\",\n \"col-md-4\",\n \"col-sm-6\"\n );\n const img = document.createElement(\"img\");\n img.src = imgSrc;\n div.appendChild(img);\n centered.appendChild(div);\n }\n }\n })\n .catch(function(err) {\n alert(\n \"Sorry the Tumblr API is currently down, please try again in a couple hours\",\n err\n );\n });\n}", "function getProduct(){\n\n if (productsPerPageCounter == 0) {\n productsURL = 'http://127.0.0.1:3000/api/products/?offset=' + productsPerPage + '&limit=' + howManyProducts; // get X products\n productsPerPageCounter += 1;\n } else if (productsPerPageCounter >= 1) {\n productsPerPage += productsPerPage;\n productsURL = 'http://127.0.0.1:3000/api/products/?offset=' + productsPerPage + '&limit=' + howManyProducts; // get X products\n }\n\n fetch(productsURL)\n .then((resp) => resp.json())\n .then(function(data) {\n // console.log(data);\n data = data.data;\n displayProductAPIData(data)\n })\n }", "function fetchPairs(url, cb) {\n \n fetch(url)\n .then((res) => {\n parseLink(res.headers.get('link'));\n return res.json();\n })\n .then((data) => {\n data.tickers.forEach(itm => {\n if(!itm.is_anomaly && !itm.is_stale) {\n const quote = itm.base + '/' + itm.target;\n \n getPrice(itm.last, quote)\n } \n }) \n\n //checking and fetching next page data\n if(pages.next) {\n fetchPairs(pages.next, cb) \n }else cb(prices)\n })\n .catch(err => console.log(err.message)) \n}", "function retrieveData() {\n const xmlhttp = new XMLHttpRequest();\n const method = 'GET';\n const url = 'https://world.openfoodfacts.org/cgi/search.pl?action=process&tagtype_0=countries&tag_contains_0=contains&tag_0=germany&tagtype_1=ingredients&tag_contains_1=contains&tag_1=sugar&nutriment_0=sugars&nutriment_compare_0=gt&nutriment_value_0=1&sort_by=unique_scans_n&page_size=100&axis_x=energy-kj&axis_y=products_n&action=display&json=true';\n \n xmlhttp.open(method, url);\n xmlhttp.onload = function() {\n const json = xmlhttp.response;\n const obj = JSON.parse(json);\n let newArr = [];\n for (let i = 0; i < obj.products.length; i++) {\n let name = obj.products[i].product_name;\n let quantity = obj.products[i].quantity;\n let quantityCal = Number.parseInt(obj.products[i].quantity);\n let sugarPer100g = obj.products[i].nutriments.sugars_100g;\n let image = obj.products[i].image_url;\n \n if (image !== undefined && quantityCal >= 100 && name !== \"\") {\n const productObj = {\n name: name,\n quantity: quantity,\n sugarPer100g: sugarPer100g,\n image: image,\n cubeCount: (quantityCal / 100) * sugarPer100g / 4,\n }\n newArr.push(productObj);\n }\n }\n products = newArr;\n updateProducts();\n hideLoader()\n showStartBtn();\n };\n xmlhttp.send();\n}", "function itemCollector(url,category){\n\trequest(url,function(error,response,html){\n\t\tif(!error){\n\t\t\tvar $ = cheerio.load(html);\n\t\t\tvar products = [];\n\t\t\tvar product;\n\t\t\tvar modelNo;\n\t\t\tvar modelNoCollection =[];\n\t\t\tvar priceCollection = [];\n\t\t\t//var fileDump = $('body').toString();\n\t\t\t\t// fs.writeFile(\"./bodyFile.txt\", fileDump, function(err) {\n // \t\t\t\tif(err) {\n // \t\t\t return console.log(err);\n \t// \t\t\t }\n // \t\t\tconsole.log(\"The file was saved!\");\n\t\t\t\t// }); \n\t\t\tfor(var i = 0; i < 24; i++){\n\t\t\t\tproduct = {};\n\t\t\t\tproduct.photo = $('.pod-item--'+ i+' .pod-inner .plp-pod__image a img').toString().match(/http:\\/\\/www\\..*?.jpg/)[0];\n\t\t\t\tproduct.price = $('.pod-item--'+ i+' .pod-inner .price__wrapper .price').toString().replace(/.*?\\s*<span class=\"price__format\">(\\$)<\\/span>(.*?)<span class=\"price__format\">(.*?)<\\/span><span class=\"price__unit\">(.*?)\\D*/,'$1$2.$3$4');\n\t\t\t\tproduct.modelNo = modelNo = $('.pod-item--'+ i+' .pod-inner .pod-plp__model').toString().replace(/[\\s\\S]*&#xA0;(.*?)\\s*<\\/div>/,'$1');\n\t\t\t\tproduct.refURL = 'http://www.homedepot.com/s/'+ modelNo;\n\t\t\t\tproduct.description = $('.pod-item--'+ i+' .pod-inner .pod-plp__description').toString().replace(/[\\s\\S]*<span class=\"pod-plp__brand-name\">(.*?)<\\/span>\\s*(.*)[\\s\\S]*/,'$1 - $2').trim();\n\t\t\t\tproduct.category = category;\n\t\t\t\tif(product.price!==''){\n\t\t\t\t\tproducts.push(product);\n\t\t\t\t\tmodelNoCollection.push(modelNo);\n\t\t\t\t}\n\t\t\t}\n\t\t\tupdateDatabase(products,modelNoCollection);\n\n\t\t\t//console.log(products.length,products);\n\t\t}\n\t});\n}", "function lowestPricesInCities(input) {\n let townsWithProducts = new Map();\n for (let sale of input) {\n let [town, product, price] = sale.split(/\\s*\\|\\s*/);\n if (!townsWithProducts.has(product)) {\n townsWithProducts.g.set(town, new Map());\n }\n products.set(product, price);\n townsWithProducts.get(town).set(product, price);\n }\n\n for (let [product, towns] of townsWithProducts) {\n let minPrice = Number.MAX_VALUE;\n let minPriceTown = '';\n for (let [town, price] of towns) {\n if (price < minPrice) {\n minPrice = price;\n minPriceTown = town;\n }\n }\n console.log(`${product} -> ${minPrice} (${minPriceTown})`);\n }\n}", "function parseUrl() {\r\n var hash = window.location.hash.substr(1),\r\n rez = hash.split(\"-\"),\r\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\r\n gallery = rez.join(\"-\");\r\n\r\n return {\r\n hash: hash,\r\n /* Index is starting from 1 */\r\n index: index < 1 ? 1 : index,\r\n gallery: gallery\r\n };\r\n }", "function parseUrl() {\r\n var hash = window.location.hash.substr(1),\r\n rez = hash.split(\"-\"),\r\n index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,\r\n gallery = rez.join(\"-\");\r\n\r\n return {\r\n hash: hash,\r\n /* Index is starting from 1 */\r\n index: index < 1 ? 1 : index,\r\n gallery: gallery\r\n };\r\n }", "function parseUrl({ url }) {\n const { host, pathname } = new URL(url);\n const { 1: bucket, 2: region } = host.match(\n /^([^\\/]*)\\.cos\\.([^\\/]*)\\.myqcloud\\.com$/\n );\n return {\n bucket,\n region,\n key: decodeURIComponent(pathname.slice(1)),\n };\n}", "function scrape_slideshare2(){\n \n elements = document.getElementsByClassName(\"slide_image\")\n urls = pluck(\"full\")(pluck(\"dataset\")(elements))\n codelst = map(image_template, urls)\n code = codelst.join(\"\\n <br>\") \n document.write(code)\n\n}" ]
[ "0.55902797", "0.55849737", "0.55443144", "0.5533976", "0.5524638", "0.545593", "0.53911984", "0.5379392", "0.5375494", "0.535836", "0.5337518", "0.53039044", "0.52956927", "0.52540964", "0.52537537", "0.52418333", "0.52404237", "0.5234792", "0.52216697", "0.51963514", "0.5192935", "0.5185271", "0.51746315", "0.51704025", "0.5169489", "0.5167052", "0.5160568", "0.51551306", "0.5147932", "0.51187027", "0.51075494", "0.50930285", "0.50877196", "0.50774306", "0.50727534", "0.5069662", "0.50658566", "0.5041857", "0.503801", "0.50291383", "0.50284874", "0.50142336", "0.5005832", "0.49817553", "0.49793097", "0.49754152", "0.49664572", "0.4958324", "0.49547777", "0.49530238", "0.49469104", "0.4946822", "0.49356312", "0.4933053", "0.49277204", "0.49259558", "0.49214822", "0.49148747", "0.49068895", "0.4903839", "0.4892528", "0.48892182", "0.48861617", "0.4885647", "0.48851877", "0.48728082", "0.48722956", "0.48594722", "0.48586193", "0.485167", "0.48466882", "0.48456877", "0.48399004", "0.48380712", "0.48379618", "0.48372337", "0.48342055", "0.4833574", "0.4833154", "0.48297766", "0.48234928", "0.48229268", "0.482274", "0.4821934", "0.4812917", "0.48119214", "0.48119214", "0.48119214", "0.48113236", "0.48102012", "0.4807746", "0.4805044", "0.4804029", "0.4803707", "0.48002642", "0.47978047", "0.47879937", "0.47879937", "0.47878587", "0.47794354" ]
0.48319364
79
TODO: need to add object destructuring to babel.
function addField(state = {}, action) { switch (action.type) { case "formBuilder.AddField": { // TODO: Promp for a key/field-name first. let key = "new" + Object.keys(state.properties).length; state.properties[key] = {"type": "string", "title": "Textfield " + Object.keys(state.properties).length}; return state; } default: return state; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dynamicallyAddTranslation(babel) {\n var t = babel.types;\n return {\n visitor: {\n ImportDeclaration: function ImportDeclaration(p) {\n p.insertAfter(t.callExpression(t.identifier('__'), [t.stringLiteral('foo')]));\n }\n }\n };\n }", "get babelParserPlugins() {\n return [\"typescript\", \"classProperties\", \"decorators-legacy\"];\n }", "function createBabelRc(obj) {\n\n babelrcTemplate.presets = obj.presets;\n babelrcTemplate.plugins = obj.plugins;\n\n fs.writeJSONSync('./.babelrc', babelrcTemplate);\n console.log(JSON.stringify(babelrcTemplate, null, 2));\n}", "function babelize(str) {\n return babel.transform(str, {\n presets: ['es2015'],\n comments: false,\n })\n}", "compileDestructuring(o) {\r\n\t\t\t\t\tvar assignObjects, assigns, code, compSlice, compSplice, complexObjects, expIdx, expans, fragments, hasObjAssigns, isExpans, isSplat, leftObjs, loopObjects, obj, objIsUnassignable, objects, olen, processObjects, pushAssign, ref, refExp, restVar, rightObjs, slicer, splatVar, splatVarAssign, splatVarRef, splats, splatsAndExpans, top, value, vvar, vvarText;\r\n\t\t\t\t\ttop = o.level === LEVEL_TOP;\r\n\t\t\t\t\t({value} = this);\r\n\t\t\t\t\t({objects} = this.variable.base);\r\n\t\t\t\t\tolen = objects.length;\r\n\t\t\t\t\t// Special-case for `{} = a` and `[] = a` (empty patterns).\r\n\t\t\t\t\t// Compile to simply `a`.\r\n\t\t\t\t\tif (olen === 0) {\r\n\t\t\t\t\t\tcode = value.compileToFragments(o);\r\n\t\t\t\t\t\tif (o.level >= LEVEL_OP) {\r\n\t\t\t\t\t\t\treturn this.wrapInParentheses(code);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\treturn code;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t[obj] = objects;\r\n\t\t\t\t\tthis.disallowLoneExpansion();\r\n\t\t\t\t\t({splats, expans, splatsAndExpans} = this.getAndCheckSplatsAndExpansions());\r\n\t\t\t\t\tisSplat = (splats != null ? splats.length : void 0) > 0;\r\n\t\t\t\t\tisExpans = (expans != null ? expans.length : void 0) > 0;\r\n\t\t\t\t\tvvar = value.compileToFragments(o, LEVEL_LIST);\r\n\t\t\t\t\tvvarText = fragmentsToText(vvar);\r\n\t\t\t\t\tassigns = [];\r\n\t\t\t\t\tpushAssign = (variable, val) => {\r\n\t\t\t\t\t\treturn assigns.push(new Assign(variable, val, null, {\r\n\t\t\t\t\t\t\tparam: this.param,\r\n\t\t\t\t\t\t\tsubpattern: true\r\n\t\t\t\t\t\t}).compileToFragments(o, LEVEL_LIST));\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif (isSplat) {\r\n\t\t\t\t\t\tsplatVar = objects[splats[0]].name.unwrap();\r\n\t\t\t\t\t\tif (splatVar instanceof Arr || splatVar instanceof Obj) {\r\n\t\t\t\t\t\t\tsplatVarRef = new IdentifierLiteral(o.scope.freeVariable('ref'));\r\n\t\t\t\t\t\t\tobjects[splats[0]].name = splatVarRef;\r\n\t\t\t\t\t\t\tsplatVarAssign = function() {\r\n\t\t\t\t\t\t\t\treturn pushAssign(new Value(splatVar), splatVarRef);\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// At this point, there are several things to destructure. So the `fn()` in\r\n\t\t\t\t\t// `{a, b} = fn()` must be cached, for example. Make vvar into a simple\r\n\t\t\t\t\t// variable if it isn’t already.\r\n\t\t\t\t\tif (!(value.unwrap() instanceof IdentifierLiteral) || this.variable.assigns(vvarText)) {\r\n\t\t\t\t\t\tref = o.scope.freeVariable('ref');\r\n\t\t\t\t\t\tassigns.push([this.makeCode(ref + ' = '), ...vvar]);\r\n\t\t\t\t\t\tvvar = [this.makeCode(ref)];\r\n\t\t\t\t\t\tvvarText = ref;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tslicer = function(type) {\r\n\t\t\t\t\t\treturn function(vvar, start, end = false) {\r\n\t\t\t\t\t\t\tvar args, slice;\r\n\t\t\t\t\t\t\tif (!(vvar instanceof Value)) {\r\n\t\t\t\t\t\t\t\tvvar = new IdentifierLiteral(vvar);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\targs = [vvar, new NumberLiteral(start)];\r\n\t\t\t\t\t\t\tif (end) {\r\n\t\t\t\t\t\t\t\targs.push(new NumberLiteral(end));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tslice = new Value(new IdentifierLiteral(utility(type, o)), [new Access(new PropertyName('call'))]);\r\n\t\t\t\t\t\t\treturn new Value(new Call(slice, args));\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t};\r\n\t\t\t\t\t// Helper which outputs `[].slice` code.\r\n\t\t\t\t\tcompSlice = slicer(\"slice\");\r\n\t\t\t\t\t// Helper which outputs `[].splice` code.\r\n\t\t\t\t\tcompSplice = slicer(\"splice\");\r\n\t\t\t\t\t// Check if `objects` array contains any instance of `Assign`, e.g. {a:1}.\r\n\t\t\t\t\thasObjAssigns = function(objs) {\r\n\t\t\t\t\t\tvar i, j, len1, results1;\r\n\t\t\t\t\t\tresults1 = [];\r\n\t\t\t\t\t\tfor (i = j = 0, len1 = objs.length; j < len1; i = ++j) {\r\n\t\t\t\t\t\t\tobj = objs[i];\r\n\t\t\t\t\t\t\tif (obj instanceof Assign && obj.context === 'object') {\r\n\t\t\t\t\t\t\t\tresults1.push(i);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn results1;\r\n\t\t\t\t\t};\r\n\t\t\t\t\t// Check if `objects` array contains any unassignable object.\r\n\t\t\t\t\tobjIsUnassignable = function(objs) {\r\n\t\t\t\t\t\tvar j, len1;\r\n\t\t\t\t\t\tfor (j = 0, len1 = objs.length; j < len1; j++) {\r\n\t\t\t\t\t\t\tobj = objs[j];\r\n\t\t\t\t\t\t\tif (!obj.isAssignable()) {\r\n\t\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t};\r\n\t\t\t\t\t// `objects` are complex when there is object assign ({a:1}),\r\n\t\t\t\t\t// unassignable object, or just a single node.\r\n\t\t\t\t\tcomplexObjects = function(objs) {\r\n\t\t\t\t\t\treturn hasObjAssigns(objs).length || objIsUnassignable(objs) || olen === 1;\r\n\t\t\t\t\t};\r\n\t\t\t\t\t// \"Complex\" `objects` are processed in a loop.\r\n\t\t\t\t\t// Examples: [a, b, {c, r...}, d], [a, ..., {b, r...}, c, d]\r\n\t\t\t\t\tloopObjects = (objs, vvar, vvarTxt) => {\r\n\t\t\t\t\t\tvar acc, i, idx, j, len1, message, results1, vval;\r\n\t\t\t\t\t\tresults1 = [];\r\n\t\t\t\t\t\tfor (i = j = 0, len1 = objs.length; j < len1; i = ++j) {\r\n\t\t\t\t\t\t\tobj = objs[i];\r\n\t\t\t\t\t\t\tif (obj instanceof Elision) {\r\n\t\t\t\t\t\t\t\t// `Elision` can be skipped.\r\n\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// If `obj` is {a: 1}\r\n\t\t\t\t\t\t\tif (obj instanceof Assign && obj.context === 'object') {\r\n\t\t\t\t\t\t\t\t({\r\n\t\t\t\t\t\t\t\t\tvariable: {\r\n\t\t\t\t\t\t\t\t\t\tbase: idx\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\tvalue: vvar\r\n\t\t\t\t\t\t\t\t} = obj);\r\n\t\t\t\t\t\t\t\tif (vvar instanceof Assign) {\r\n\t\t\t\t\t\t\t\t\t({\r\n\t\t\t\t\t\t\t\t\t\tvariable: vvar\r\n\t\t\t\t\t\t\t\t\t} = vvar);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tidx = vvar.this ? vvar.properties[0].name : new PropertyName(vvar.unwrap().value);\r\n\t\t\t\t\t\t\t\tacc = idx.unwrap() instanceof PropertyName;\r\n\t\t\t\t\t\t\t\tvval = new Value(value, [new (acc ? Access : Index)(idx)]);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// `obj` is [a...], {a...} or a\r\n\t\t\t\t\t\t\t\tvvar = (function() {\r\n\t\t\t\t\t\t\t\t\tswitch (false) {\r\n\t\t\t\t\t\t\t\t\t\tcase !(obj instanceof Splat):\r\n\t\t\t\t\t\t\t\t\t\t\treturn new Value(obj.name);\r\n\t\t\t\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\t\t\t\treturn obj;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t})();\r\n\t\t\t\t\t\t\t\tvval = (function() {\r\n\t\t\t\t\t\t\t\t\tswitch (false) {\r\n\t\t\t\t\t\t\t\t\t\tcase !(obj instanceof Splat):\r\n\t\t\t\t\t\t\t\t\t\t\treturn compSlice(vvarTxt, i);\r\n\t\t\t\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\t\t\t\treturn new Value(new Literal(vvarTxt), [new Index(new NumberLiteral(i))]);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t})();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tmessage = isUnassignable(vvar.unwrap().value);\r\n\t\t\t\t\t\t\tif (message) {\r\n\t\t\t\t\t\t\t\tvvar.error(message);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tresults1.push(pushAssign(vvar, vval));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn results1;\r\n\t\t\t\t\t};\r\n\t\t\t\t\t// \"Simple\" `objects` can be split and compiled to arrays, [a, b, c] = arr, [a, b, c...] = arr\r\n\t\t\t\t\tassignObjects = (objs, vvar, vvarTxt) => {\r\n\t\t\t\t\t\tvar vval;\r\n\t\t\t\t\t\tvvar = new Value(new Arr(objs, true));\r\n\t\t\t\t\t\tvval = vvarTxt instanceof Value ? vvarTxt : new Value(new Literal(vvarTxt));\r\n\t\t\t\t\t\treturn pushAssign(vvar, vval);\r\n\t\t\t\t\t};\r\n\t\t\t\t\tprocessObjects = function(objs, vvar, vvarTxt) {\r\n\t\t\t\t\t\tif (complexObjects(objs)) {\r\n\t\t\t\t\t\t\treturn loopObjects(objs, vvar, vvarTxt);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\treturn assignObjects(objs, vvar, vvarTxt);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\t// In case there is `Splat` or `Expansion` in `objects`,\r\n\t\t\t\t\t// we can split array in two simple subarrays.\r\n\t\t\t\t\t// `Splat` [a, b, c..., d, e] can be split into [a, b, c...] and [d, e].\r\n\t\t\t\t\t// `Expansion` [a, b, ..., c, d] can be split into [a, b] and [c, d].\r\n\t\t\t\t\t// Examples:\r\n\t\t\t\t\t// a) `Splat`\r\n\t\t\t\t\t// CS: [a, b, c..., d, e] = arr\r\n\t\t\t\t\t// JS: [a, b, ...c] = arr, [d, e] = splice.call(c, -2)\r\n\t\t\t\t\t// b) `Expansion`\r\n\t\t\t\t\t// CS: [a, b, ..., d, e] = arr\r\n\t\t\t\t\t// JS: [a, b] = arr, [d, e] = slice.call(arr, -2)\r\n\t\t\t\t\tif (splatsAndExpans.length) {\r\n\t\t\t\t\t\texpIdx = splatsAndExpans[0];\r\n\t\t\t\t\t\tleftObjs = objects.slice(0, expIdx + (isSplat ? 1 : 0));\r\n\t\t\t\t\t\trightObjs = objects.slice(expIdx + 1);\r\n\t\t\t\t\t\tif (leftObjs.length !== 0) {\r\n\t\t\t\t\t\t\tprocessObjects(leftObjs, vvar, vvarText);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (rightObjs.length !== 0) {\r\n\t\t\t\t\t\t\t// Slice or splice `objects`.\r\n\t\t\t\t\t\t\trefExp = (function() {\r\n\t\t\t\t\t\t\t\tswitch (false) {\r\n\t\t\t\t\t\t\t\t\tcase !isSplat:\r\n\t\t\t\t\t\t\t\t\t\treturn compSplice(new Value(objects[expIdx].name), rightObjs.length * -1);\r\n\t\t\t\t\t\t\t\t\tcase !isExpans:\r\n\t\t\t\t\t\t\t\t\t\treturn compSlice(vvarText, rightObjs.length * -1);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t})();\r\n\t\t\t\t\t\t\tif (complexObjects(rightObjs)) {\r\n\t\t\t\t\t\t\t\trestVar = refExp;\r\n\t\t\t\t\t\t\t\trefExp = o.scope.freeVariable('ref');\r\n\t\t\t\t\t\t\t\tassigns.push([this.makeCode(refExp + ' = '), ...restVar.compileToFragments(o, LEVEL_LIST)]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tprocessObjects(rightObjs, vvar, refExp);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// There is no `Splat` or `Expansion` in `objects`.\r\n\t\t\t\t\t\tprocessObjects(objects, vvar, vvarText);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (typeof splatVarAssign === \"function\") {\r\n\t\t\t\t\t\tsplatVarAssign();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!(top || this.subpattern)) {\r\n\t\t\t\t\t\tassigns.push(vvar);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfragments = this.joinFragmentArrays(assigns, ', ');\r\n\t\t\t\t\tif (o.level < LEVEL_LIST) {\r\n\t\t\t\t\t\treturn fragments;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\treturn this.wrapInParentheses(fragments);\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "transform(program) {\n var options = AsxFormatter.options(this.file.ast);\n //DefaultFormatter.prototype.transform.apply(this, arguments);\n\n var locals = [];\n var definitions = [];\n var body = [];\n program.body.forEach(item=>{\n switch(item.type){\n case 'ExpressionStatement':\n var exp = item.expression;\n if(exp.type=='Literal' && exp.value.toLowerCase()=='use strict'){\n return;\n }\n break;\n case 'VariableDeclaration':\n item.declarations.forEach(d=>{\n locals.push(d.id);\n });\n break;\n case 'FunctionDeclaration':\n if(item.id.name=='module'){\n item.body.body.forEach(s=>{\n body.push(s);\n })\n return;\n }else\n if(item._class){\n item.id =t.identifier('c$'+item._class);\n body.push(t.expressionStatement(t.callExpression(\n t.memberExpression(\n t.identifier('asx'),\n t.identifier('c$')\n ),[item])));\n return;\n }else{\n locals.push(item.id);\n }\n break;\n }\n body.push(item);\n });\n\n var definer = [];\n\n\n\n if(Object.keys(this.imports).length){\n\n Object.keys(this.imports).forEach(key=>{\n var items = this.imports[key];\n if(items['*'] && typeof items['*']=='string'){\n this.imports[key]=items['*'];\n }\n });\n definer.push(t.property('init',\n t.identifier('imports'),\n t.valueToNode(this.imports)\n ))\n }\n var exports;\n if(this.exports['*']){\n exports = this.exports['*'];\n delete this.exports['*'];\n }\n if(Object.keys(this.exports).length){\n definer.push(t.property('init',\n t.identifier('exports'),\n t.valueToNode(this.exports)\n ))\n }\n if(body.length){\n if(exports){\n var ret = [];\n Object.keys(exports).forEach(key=>{\n var val = exports[key];\n if(typeof val=='string') {\n ret.push(t.property('init',\n t.literal(key), t.identifier(val == '*' ? key : val)\n ))\n }else{\n ret.push(t.property('init',\n t.literal(key), val\n ))\n }\n });\n body.push(t.returnStatement(\n t.objectExpression(ret)\n ));\n }\n var initializer = t.functionExpression(null, [t.identifier('asx')], t.blockStatement(body));\n definer.push(t.property('init',\n t.identifier('execute'),\n initializer\n ))\n }\n definitions.forEach(item=>{\n\n if(item._class){\n definer.push(t.property('init',\n t.literal('.'+item._class),\n item\n ))\n }else{\n definer.push(t.property('init',\n t.literal(':'+item.id.name),\n item\n ))\n }\n\n })\n definer = t.objectExpression(definer);\n\n\n\n /*\n var definer = t.functionExpression(null, [t.identifier(\"module\")], t.blockStatement(body));\n if(options.bind){\n definer = t.callExpression(\n t.memberExpression(\n definer,\n t.identifier(\"bind\")\n ),[\n t.callExpression(t.identifier(\"eval\"),[t.literal(\"this.global=this\")])\n ]\n );\n }*/\n var body = [];\n var definer = util.template(\"asx-module\",{\n MODULE_NAME: t.literal(this.getModuleName()),\n MODULE_BODY: definer\n });\n if(options.runtime){\n var rt = util.template(\"asx-runtime\")\n //rt._compact = true;\n body.push(t.expressionStatement(rt));\n }\n body.push(t.expressionStatement(definer))\n program.body = body;\n }", "babelConfig() {\n return {\n presets: ['@babel/preset-react']\n };\n }", "function transform_hot(){\n clog(\"transforming hardcode\");\n hotast = Babel.transform(hardcode,{\n plugins: [hotcode]\n })\n}", "function a(e){return e&&e.__esModule?e:{default:e}}", "function Obj(){ return Literal.apply(this,arguments) }", "keyFrameStateFrom(obj) {\n\t\tconst {state, ...styleProperties} = obj;\n\t\treturn {\n\t\t\t[state]: styleProperties\n\t\t};\n\t}", "function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n}", "function buildBabelOptions(script) {\n return {\n presets: script.presets || ['react', 'es2015'],\n plugins: script.plugins || ['transform-class-properties', 'transform-object-rest-spread', 'transform-flow-strip-types'],\n sourceMaps: 'inline'\n };\n }", "function f28(x) {\n var a = _extends({}, _object_destructuring_empty(x)); // Error\n}", "function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : { 'default': obj };\n }", "function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : { 'default': obj };\n }", "function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : { 'default': obj };\n }", "function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : { 'default': obj };\n }", "function _functionCoerce(obj) {\n return obj.name + '=>' + obj.toString();\n}", "function LiteralObject() {\r\n}", "function Transform$7() {}", "function looseJsonParse(obj){\n return Function('\"use strict\";return (' + obj + ')')();\n}", "_processBabel(file) {\n// Return a through Transform stream, in which we transform source code with babel......\n return through( function(chunk, enc, done) {\n let {code} = babel.transformSync(chunk.toString(), {\n babelrc: true,\n filename: file\n })\n\n// Push result to stream....\n this.push(code)\n\n// Call callback.....\n done()\n })\n }", "function buildBabelOptions(script) {\n\t return {\n\t presets: script.presets || ['react', 'es2015'],\n\t plugins: script.plugins || ['transform-class-properties', 'transform-object-rest-spread', 'transform-flow-strip-types'],\n\t sourceMaps: 'inline'\n\t };\n\t}", "function buildBabelOptions(script) {\n\t return {\n\t presets: script.presets || ['react', 'es2015'],\n\t plugins: script.plugins || ['transform-class-properties', 'transform-object-rest-spread', 'transform-flow-strip-types'],\n\t sourceMaps: 'inline'\n\t };\n\t}", "static transform() {}", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }", "destructureProps() {\n let props;\n let events;\n if (this.component.id !== WORKSPACE_ID){\n props = flattenStateProps(this.component.props, this.component.id, this.components);\n events = flattenEvents(this.component.events, this.component.id, this.components, methodNames);\n events = insertMethods(events, methodNames);\n props = Object.assign(props, events);\n if (Object.keys(props).length === 0) return '';\n } else {\n return '';\n }\n delete props.style;\n const destructuredProps = Object.keys(props).reduce((final, key) => {\n final += `${key}, `;\n return final;\n }, 'const { ');\n return destructuredProps.slice(0, destructuredProps.length - 2) + ' } = this.props;'\n }", "objectify(key,value){\n \t return {\n [key]: value\n }\n }", "function jsTaskES6(){\n return src([files.jsPathES6])\n .pipe(prettier({ \n \"parser\":\"babel\",\n \"printWidth\":100,\n \"tabWidth\":4,\n \"useTabs\":true,\n \"semi\":true,\n \"singleQuote\":true,\n \"trailingComma\":\"none\",\n \"bracketSpacing\":true,\n \"jsxBracketSameLine\":true,\n \"arrowParens\":\"always\"\n }))\n .pipe(dest('dist/modules')\n );\n}", "function lt(t,i){return t(i={exports:{}},i.exports),i.exports}", "AssignmentExpression(path, state) {\n let {\n opts: { formatComments = defaultFormatComments },\n } = state\n let didEncounterProps = false\n // Foo\n let componentName = path.node.left.object.name\n // Setup the data we will return\n let component = this.data.components.find(\n comp => comp.name === componentName,\n )\n if (!component) {\n component = {\n name: componentName,\n }\n }\n let propData = component.props || []\n if (\n // Foo.propTypes\n t.isMemberExpression(path.node.left) &&\n path.node.left.property.name === 'propTypes'\n ) {\n didEncounterProps = true\n // Iterate through the prop-types\n // @TODO assumes an object expression definition\n let props = path.node.right.properties\n props.forEach(prop => {\n // grab the prop name\n // @TODO test for expressions here: {[foo]: PropTypes.string}\n let propName = prop.key.name\n let propObj = {\n name: propName,\n type: {},\n }\n if (Array.isArray(prop.leadingComments)) {\n propObj.type.comments = formatComments(prop.leadingComments)\n }\n // Foo.propTypes = { bar: value }\n if (t.isIdentifier(prop.value)) {\n lookupImportedReferences({\n prop: prop.value,\n imports: this.data.imports,\n propObj,\n })\n } else if (t.isMemberExpression(prop.value)) {\n // Foo.propTypes = {bar: PropTypes.value }\n let propType = prop.value.object.name\n // Again here handles nested calls, e.g. `Foo.propTypes = { bar: PropTypes.string.isRequired }`\n if (t.isMemberExpression(prop.value.object)) {\n propObj.type.raw = generate(prop.value).code\n } else {\n propObj.type.raw = generate(prop.value).code\n }\n } else {\n // Otherwise give up and try to parse the code\n propObj.type.raw = generate(prop.value).code\n }\n\n // Merge the prop into existing propData\n if (propData.find(prop => prop.name === propName)) {\n propData = propData.map(propDatum => {\n if (propDatum.name === propObj.name) {\n return {\n ...propDatum,\n ...propObj,\n }\n }\n return propDatum\n })\n } else {\n propData = [...propData, propObj]\n }\n })\n } else if (\n // Foo.defaultProps\n t.isMemberExpression(path.node.left) &&\n path.node.left.property.name === 'defaultProps'\n ) {\n didEncounterProps = true\n // Iterate through the prop-types\n // @TODO assumes an object expression definition\n let defaultProps = path.node.right.properties\n defaultProps.forEach(prop => {\n // grab the prop name\n // @TODO test for expressions here: {[foo]: PropTypes.string}\n let propName = prop.key.name\n let propObj = {\n name: propName,\n default: {},\n }\n if (Array.isArray(prop.leadingComments)) {\n propObj.default.comments = formatComments(prop.leadingComments)\n }\n // This is a bit weird, but if the prop is like PropTypes.string.isRequired\n // its nested another layer\n if (t.isMemberExpression(prop.value)) {\n let propType = prop.value.object.name\n if (t.isMemberExpression(prop.value.object)) {\n propObj.default.raw = generate(prop.value).code\n } else {\n propObj.default.raw = generate(prop.value).code\n }\n } else {\n propObj.default.raw = generate(prop.value).code\n }\n\n // Merge the prop into existing propData\n if (propData.find(prop => prop.name === propName)) {\n propData = propData.map(propDatum => {\n if (propDatum.name === propObj.name) {\n return {\n ...propDatum,\n ...propObj,\n }\n }\n return propDatum\n })\n } else {\n propData = [...propData, propObj]\n }\n })\n }\n\n if (didEncounterProps) {\n component.props = propData\n if (this.data.components.find(comp => comp.name === componentName)) {\n this.data.components = this.data.components.map(comp => {\n if (comp.name === componentName) {\n return {\n ...comp,\n ...component,\n props: [...comp.props, ...component.props].reduce(\n (acc, prop) => {\n if (acc.find(p => p.name === prop.name)) {\n return acc.map(p => {\n if (p.name === prop.name) {\n return {\n ...p,\n ...prop,\n }\n }\n return p\n })\n }\n return [...acc, prop]\n },\n [],\n ),\n }\n }\n return comp\n })\n } else {\n this.data.components = [component]\n }\n }\n }", "function s(e){return e&&e.__esModule?e:{default:e}}", "function s(e){return e&&e.__esModule?e:{default:e}}", "astProperties(o) {\r\n\t\t\t\t\tvar computed, property, ref1, ref2;\r\n\t\t\t\t\tref1 = this.properties, [property] = slice1.call(ref1, -1);\r\n\t\t\t\t\tif (this.isJSXTag()) {\r\n\t\t\t\t\t\tproperty.name.jsx = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcomputed = property instanceof Index || !(((ref2 = property.name) != null ? ref2.unwrap() : void 0) instanceof PropertyName);\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tobject: this.object().ast(o, LEVEL_ACCESS),\r\n\t\t\t\t\t\tproperty: property.ast(o, (computed ? LEVEL_PAREN : void 0)),\r\n\t\t\t\t\t\tcomputed,\r\n\t\t\t\t\t\toptional: !!property.soak,\r\n\t\t\t\t\t\tshorthand: !!property.shorthand\r\n\t\t\t\t\t};\r\n\t\t\t\t}", "function extractArgs(arg) {\n switch (arg.type) {\n case 'Literal':\n return arg.value;\n case 'Identifier':\n return arg.name;\n case 'MemberExpression':\n return extractArgs(arg.object) + '.' + extractArgs(arg.property);\n case 'ObjectExpression':\n {\n var res = {};\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = (0, _getIterator3.default)((0, _keys2.default)(arg.properties)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var key = _step.value;\n\n res[extractArgs(arg.properties[key].key)] = extractArgs(arg.properties[key].value);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return res;\n }\n default:\n throw new Error('I18nextPlugin. Unable to parse arg ' + arg + '.');\n }\n}", "function tokensToFunction(tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_typeof___default()(tokens[i]) === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue;\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue;\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined');\n }\n }\n\n if (Array.isArray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify___default()(value) + '`');\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue;\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty');\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify___default()(segment) + '`');\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue;\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"');\n }\n\n path += token.prefix + segment;\n }\n\n return path;\n };\n}", "function u(t,e){return t(e={exports:{}},e.exports),e.exports}", "function xx(a,b){return\"method\"!==b.kind||!b.ej||\"value\"in b.ej?(ia(),{kind:\"field\",key:Symbol(),oW:\"own\",ej:{},Dj:function(){\"function\"===typeof b.Dj&&(this[b.key]=b.Dj.call(this))},$l:function(c){c.Ca(b.key,a)}}):Object.assign(Object.assign({},b),{$l:function(c){c.Ca(b.key,a)}})}", "function buildBabelOptions(script) {\n return {\n presets: script.presets || [\"react\", \"es2015\"],\n plugins: script.plugins || [\n \"proposal-class-properties\",\n \"proposal-object-rest-spread\",\n \"transform-flow-strip-types\",\n ],\n sourceMaps: \"inline\",\n };\n}", "function nameProps(obj) {\n\n}", "function o(t,e){return e={exports:{}},t(e,e.exports),e.exports}", "constructor() { super(new GeneratorParser(true)) }", "static initialize(obj) { \n obj['rightToLiteral'] = rightToLiteral;\n }", "importModule(object) {\n this.symLUT = Object.assign(this.symLUT, object);\n }", "function b() {\n return { \n name: \"Yaakov\"\n };\n}", "function fn_module() {\n const FN_DEC_RX = /^[^\\(]*\\(([^\\)]*)[^{]*{([\\S\\s]*)}$/m\n const FN_EMPTY = function () {}\n return {\n clone,\n decode,\n decode_body,\n decode_body_bound,\n decode_args,\n encode,\n code_body_append,\n code_body_prepend,\n code_arg_index_of,\n code_arg_set,\n }\n function clone(f) {return encode(decode(f)); }\n function decode(f) {return str_match(f.toString(),FN_DEC_RX); }\n // return [args,body]\n function decode_body(f) {return decode(f)[1]; }\n function decode_body_bound(f,argv) {\n let [args_str, body] = decode(f);\n const args = args_str.split(',');\n let argc = (argv && argv.length)|0;\n while (argc > 0) {\n let key = args[--argc];\n let val = argv[argc];\n body = `var ${\n key\n }=${\n val != undefined\n ? JSON.stringify(val)\n : undefined\n };` + body;\n }\n return body;\n }\n // function decode_body_clean(f) {return decode_body(f).replace(/[\\n][ \\t]/g,'\\n'); }\n function decode_args(f) {return decode(f)[0]; }\n function encode(code) {return Function.apply(code); }\n function code_body_append(code,str) {code[1] += str; return code;}\n function code_body_prepend(code,str) {code[1] = str + code[1]; return code; }\n function code_arg_index_of(code,key) {return code[0].indexOf(key); }\n function code_arg_set(code,key,val) {return code_body_prepend(code, `${key}=${val};` ) }\n}", "function toObject(Ye){if(null==Ye)throw new TypeError(\"Object.assign cannot be called with null or undefined\");return Object(Ye)}", "_dehydrateArg(arg) {\n if (typeof arg === \"string\") {\n return ({\n type: \"string\",\n value: String(arg)\n });\n } else if (typeof arg === \"function\") {\n // store a pointer to the function in the function lib\n let functionPointerName = \"f@\" + this._functionPointerCounter;\n this._functionPointerCounter++;\n this._functionPointerLib.put(functionPointerName, arg);\n return ({\n type: \"function\",\n name: functionPointerName\n });\n } else if (typeof arg === \"number\") {\n return ({\n type: \"number\",\n value: arg\n });\n } else if (typeof arg === \"boolean\") {\n return ({\n type: \"boolean\",\n value: arg\n })\n } else if (typeof arg === \"object\") {\n\n if (arg.constructor.name === \"Array\") {\n let argDef = {\n type: \"array\",\n elements: [],\n };\n\n arg.forEach(element => {\n argDef.elements.push(this._dehydrateArg(element));\n });\n\n return argDef;\n } else {\n let argDef = {\n type: \"object\",\n properties: {},\n };\n\n for (let prop in arg) {\n if (arg.hasOwnProperty(prop)) {\n argDef.properties[prop] = this._dehydrateArg(arg[prop]);\n }\n }\n\n return argDef;\n }\n\n // return ({\n // type: \"json\",\n // value: JSON.stringify(arg)\n // })\n } else {\n throw new Error(\"Unsupported argument type for arg: \" + arg)\n }\n }", "function transfromJS() {\n\n return gulp.src('./src/assets/js/*.js')\n .pipe(babel({\n presets: [\"@babel/preset-env\"],\n plugins: [\"@babel/plugin-transform-arrow-functions\"],\n highlightCode: true\n })).pipe(gulp.dest('./dist/'));\n}", "function babelMacro(transform) {\n const configName = transform.name;\n return createMacro(\n function effectfulMacro({ references, state, babel, config: args }) {\n Object.assign(config, args, { babel });\n if (references.default && references.default.length)\n config.preprocNS = references.default[0].node.name;\n if (config.macroAdapt !== false) {\n if (config.detectRT) {\n if (!config.importRT) config.importRT = config.detectRT;\n config.detectRT = null;\n }\n }\n run(transform, state);\n },\n { configName }\n );\n}", "function nombreMayusculas (persona) {\n //var nombre = persona.nombre\n var {nombre} = persona\n console.log(nombre)\n}", "function index () {\r\n return {\r\n name: 'transform-import-meta',\r\n visitor: {\r\n Program: function (path) {\r\n var metas = [];\r\n path.traverse({\r\n MemberExpression: function (memberExpPath) {\r\n var node = memberExpPath.node;\r\n if (node.object.type === 'MetaProperty' &&\r\n node.object.meta.name === 'import' &&\r\n node.object.property.name === 'meta' &&\r\n node.property.type === 'Identifier' &&\r\n node.property.name === 'url') {\r\n metas.push(memberExpPath);\r\n }\r\n }\r\n });\r\n if (metas.length === 0) {\r\n return;\r\n }\r\n for (var _i = 0, metas_1 = metas; _i < metas_1.length; _i++) {\r\n var meta = metas_1[_i];\r\n meta.replaceWith(ast(templateObject_1 || (templateObject_1 = __makeTemplateObject([\"require('url').pathToFileURL(__filename).toString()\"], [\"require('url').pathToFileURL(__filename).toString()\"]))));\r\n }\r\n }\r\n }\r\n };\r\n}", "function destructuringAssignOrJsonValue() {\n // lookup for the assignment (esnext only)\n // if it has semicolons, it is a block, so go parse it as a block\n // or it's not a block, but there are assignments, check for undeclared variables\n \n var block = lookupBlockType();\n if (block.notJson) {\n if (!state.inESNext() && block.isDestAssign) {\n warning(\"W104\", state.tokens.curr, \"destructuring assignment\");\n }\n statements();\n // otherwise parse json value\n } else {\n state.option.laxbreak = true;\n state.jsonMode = true;\n jsonValue();\n }\n }", "function t(e){switch(e.type){case V.AssignmentExpression:case V.ArrayExpression:case V.ArrayPattern:case V.BinaryExpression:case V.CallExpression:case V.ConditionalExpression:case V.ClassExpression:case V.ExportBatchSpecifier:case V.ExportSpecifier:case V.FunctionExpression:case V.Identifier:case V.ImportSpecifier:case V.Literal:case V.LogicalExpression:case V.MemberExpression:case V.MethodDefinition:case V.NewExpression:case V.ObjectExpression:case V.ObjectPattern:case V.Property:case V.SequenceExpression:case V.ThisExpression:case V.UnaryExpression:case V.UpdateExpression:case V.YieldExpression:return!0}return!1}", "function as_you_type(country)\r\n{\r\n\t__WEBPACK_IMPORTED_MODULE_5__es6_AsYouType__[\"b\" /* default */].call(this, country, __WEBPACK_IMPORTED_MODULE_0__metadata_min_json___default.a)\r\n}", "compile() {\n return { [this.word]: this.body };\n }", "function $o(){return $o=Object.assign||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},$o.apply(this,arguments)}", "function t1() {\n function f() {\n return { ...{\n a: 1\n }\n };\n }\n\n f();\n let obj = f();\n console.log(1, obj.a);\n}", "function Fa(){return(Fa=Object.assign||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}).apply(this,arguments)}", "function createObjectLiteral(name, batch, hobbies) {\n\n}", "function obj(objec){\nreturn objec;\n}", "CallExpression (path, { file }) {\n /* determine types of parameters */\n const pp = []\n const np = []\n path.get(\"arguments\").forEach((path) => {\n if (path.isAssignmentExpression() && path.get(\"left\").isIdentifier()) {\n /* assignment expression with an identifier (treated as a named parameter) */\n const name = path.get(\"left\").node.name\n if (np.findIndex((p) => p.get(\"left\").isIdentifier({ name: name })) >= 0)\n throw path.buildCodeFrameError(`named parameter \"${name}\" occurs multiple times`)\n np.push(path)\n }\n else {\n /* other expression */\n pp.push(path)\n }\n })\n\n /* short-circuit processing if there are no named parameters */\n if (np.length === 0)\n return\n\n /* replace the CallExpression with a new one */\n let opts = []\n if (!options.options || !options.caching) {\n if (!options.options)\n opts.push(babel.types.objectProperty(\n babel.types.identifier(\"options\"),\n babel.types.booleanLiteral(false)))\n if (!options.caching)\n opts.push(babel.types.objectProperty(\n babel.types.identifier(\"caching\"),\n babel.types.booleanLiteral(false)))\n opts = [babel.types.objectExpression(opts)]\n }\n path.replaceWith(\n babel.types.callExpression(\n /* the transform function name */\n babel.types.identifier(options.functionName),\n [\n /* the previous context or undefined */\n path.get(\"callee\").isMemberExpression() ?\n path.node.callee.object :\n babel.types.identifier(\"undefined\"),\n\n /* the previous callee */\n path.node.callee,\n\n /* the positional parameters */\n babel.types.arrayExpression(\n pp.map((path) => {\n return path.node\n })\n ),\n\n /* the named parameters */\n babel.types.objectExpression(\n np.map((path) => {\n return babel.types.objectProperty(\n path.get(\"left\").node,\n path.get(\"right\").node\n )\n })\n )\n ].concat(opts)\n )\n )\n\n /* remember that we need the transform function */\n file.set(\"namedParamsNeedTransformFunction\", true)\n }", "render() {\n return (\n <div className=\"BorderBoxSubrouting\">\n Hello {this.props.name}\n <div className={this.defaultParams() ? '' : 'babel-error'}>\n Default parameters work: {this.defaultParams().toString()}\n </div>\n <div className={this.restParams() ? '' : 'babel-error'}>\n Rest parameters work: {this.restParams().toString()}\n </div>\n <div className={this.spreadOperator() ? '' : 'babel-error'}>\n Spread Operator works for array and objects (obj needs stage 2): {this.spreadOperator().toString()}\n </div>\n <div className={this.templateLiteralString() ? '' : 'babel-error'}>\n Template literal string works: {this.templateLiteralString().toString()}\n </div>\n <div className={this.objectDestructuring() ? '' : 'babel-error'}>\n Object destructuring works: {this.objectDestructuring().toString()}\n </div>\n <div className={this.arrayDestructuring() ? '' : 'babel-error'}>\n Array destructuring works: {this.arrayDestructuring().toString()}\n </div>\n <div className={this.enhancedObjectLiterals() ? '' : 'babel-error'}>\n Enhanced Object Literals work: {this.enhancedObjectLiterals().toString()}\n </div>\n <div className={this.arrowFunctions() ? '' : 'babel-error'}>\n Arrow functions: {this.arrowFunctions().toString()}\n </div>\n <div className={this.promises() ? '' : 'babel-error'}>Promises work: {this.promises().toString()}</div>\n <div className={this.letKeyword() ? '' : 'babel-error'}>\n 'let' keywork works: {this.letKeyword().toString()}\n </div>\n <div className={this.isInteger() ? '' : 'babel-error'}>\n Number.isInteger works: {this.isInteger().toString()}\n </div>\n <div className={this.stringIncludes() ? '' : 'babel-error'}>\n String.prototype.includes works: {this.stringIncludes().toString()}\n </div>\n <div className={this.forOf() ? '' : 'babel-error'}>For of works: {this.forOf().toString()}</div>\n <div className={this.maps() ? '' : 'babel-error'}>Maps work: {this.maps().toString()}</div>\n <div className={this.sets() ? '' : 'babel-error'}>Sets work: {this.sets().toString()}</div>\n <div className={this.arrayFrom() ? '' : 'babel-error'}>Array.from() works: {this.arrayFrom().toString()}</div>\n <div className={this.arrayIncludes() ? '' : 'babel-error'}>\n Array.prototype.includes works: {this.arrayIncludes().toString()}\n </div>\n <div className={this.exponentiation() ? '' : 'babel-error'}>\n Exponentiation operator works: {this.exponentiation().toString()}\n </div>\n <div className={this.state.asyncAwaitWorks ? '' : 'babel-error'}>\n Async await: check console for AsyncAwait errors\n </div>\n <div className={this.objectValues() ? '' : 'babel-error'}>\n Object.values works: {this.objectValues().toString()}\n </div>\n </div>\n );\n }", "exit(programPath, state) {\n // Babel 6 only let's you read plugin options inside visitors,\n // so we can't warn about an invalid config until the first file is hit.\n // TODO: In Babel 7, use config passed in when plugin is first created\n const {\n config,\n prod = false,\n onWarning = noop,\n onError = noop\n } = state.opts;\n\n if (!validationRan) {\n validationRan = true;\n if (typeof prod !== 'boolean') {\n onError(\n `Expected \"prod\" to be a boolean, but received \"${typeof prod}\"`\n );\n }\n if (typeof config !== 'object') {\n onError(\n `Expected \"config\" to be an object, but received \"${typeof config}\"`\n );\n }\n\n const { passed, error } = validateConfig(config);\n if (!passed) {\n // Warn about invalid config, but let the compilation\n // keep going\n onWarning(error);\n }\n }\n\n // We need to find any identifiers in scope that could be used to call\n // React's `createElement` function.\n const reactModuleImports = identifiersInScopeFromModule(\n programPath,\n /^react$/\n );\n const {\n reactIdentifier,\n createElementIdentifier\n } = reactModuleImports.reduce((acc, importData) => {\n if (importData.bindingName === 'default') {\n acc.reactIdentifier = importData.local;\n }\n if (importData.bindingName === 'createElement') {\n acc.createElementIdentifier = importData.local;\n }\n return acc;\n }, {});\n\n // No element creation in this file, so we bail\n if (!(reactIdentifier || createElementIdentifier)) {\n return;\n }\n\n // Start the transformation traversal\n programPath.traverse({\n CallExpression(path) {\n const isCECall = isCreateElementCall(\n path,\n reactIdentifier,\n createElementIdentifier\n );\n if (!isCECall) return;\n\n const [element] = path.get('arguments');\n const dataMIDPropNode = getProp(path, 'data-mid');\n if (!dataMIDPropNode) return;\n\n const { value: dataMID, type } = dataMIDPropNode;\n if (type !== 'StringLiteral') {\n onWarning(\n 'Expected \"data-mid\" to be a literal string, ' +\n `but instead found a value of type \"${type}\"`\n );\n }\n\n if (!t.isStringLiteral(element)) {\n onWarning(\n '\"data-mid\" found on a Composite Component.' +\n 'Only DOM elements(div/span/etc) can be a Layout Container'\n );\n }\n\n const operations = config[dataMID];\n // No operations were registered for this Container\n if (!(operations && operations.length)) {\n return;\n }\n\n new ContainerOperationsProcessor({\n types: t,\n operations,\n containerPath: path,\n containerMID: dataMID,\n program: programPath,\n reactIdentifier,\n createElementIdentifier,\n onWarning,\n onError\n }).execute();\n }\n });\n }", "function jsxToObject(node) {\n if (t.isJSXIdentifier(node)) {\n return t.identifier(node.name);\n } else if (t.isJSXMemberExpression(node)) {\n /**\n * recursively change object property of JSXMemberExpression\n * to MemberExpression\n */\n const objectNode = jsxToObject(node.object);\n const property = jsxToObject(node.property);\n return t.memberExpression(objectNode, property);\n }\n}", "function readBabelOptions(opts) {\n var babelPresets = [],\n // Add plugins to emit .d.ts files if necessary\n babelPlugins = opts.declaration\n ? [[require(\"babel-dts-generator\"),\n {\n \"packageName\": \"\",\n \"typings\": fableLib.pathJoin(opts.workingDir, opts.outDir),\n \"suppressAmbientDeclaration\": true,\n \"ignoreEmptyInterfaces\": false\n }],\n require(\"babel-plugin-transform-flow-strip-types\"),\n require(\"babel-plugin-transform-class-properties\")]\n : [];\n\n // Add custom plugins\n babelPlugins = babelPlugins.concat(\n customPlugins.transformMacroExpressions,\n // removeUnneededNulls must come after transformMacroExpressions (see #377)\n customPlugins.removeUnneededNulls,\n customPlugins.removeFunctionExpressionNames\n );\n\n // if opts.babelrc is true, read Babel plugins and presets from .babelrc\n if (opts.babelrc) {\n opts.babel = { presets: babelPresets, plugins: babelPlugins };\n return opts;\n }\n\n // ECMAScript target\n if (opts.ecma != \"es2015\" && opts.ecma != \"es6\") {\n if (opts.module === \"es2015\" || opts.module === \"es6\") {\n opts.module = false;\n }\n else if (opts.module in constants.JS_MODULES === false) {\n throw \"Unknown module target: \" + opts.module;\n }\n babelPresets.push([require.resolve(\"babel-preset-es2015\"), {\n \"loose\": opts.loose,\n \"modules\": opts.rollup ? false : opts.module\n }]);\n }\n else if (!opts.rollup && opts.module in constants.JS_MODULES) {\n babelPlugins.push(require(\"babel-plugin-transform-es2015-modules-\" + opts.module));\n }\n\n // Extra Babel plugins\n if (opts.babelPlugins) {\n babelPlugins = babelPlugins.concat(\n fableLib.resolvePlugins(opts.babelPlugins, opts.workingDir, \"babel-plugin-\"));\n }\n\n opts.babel = { presets: babelPresets, plugins: babelPlugins };\n return opts;\n}", "function parse_composition_ast(ast, intl_func) {\n var search_item = \"new\";\n \n var lvalue = new type_object();\n var rvalue = new type_object();\n}", "function createTransformer(opts /*: Object */ = {}) {\n return {\n process(src /*: string */, filename /*: string */) {\n const options = {\n presets: [\n [require('@babel/preset-react'), {throwIfNamespace: false}],\n require('babel-preset-fbjs'),\n ],\n plugins: opts.plugins || [],\n filename,\n retainLines: true,\n };\n\n return babel.transform(src, options).code;\n },\n\n // Generate a cache key that is based on the contents of this file,\n // babel-preset-fbjs, and the plugins passed in as options and fbjs (used as\n // a proxy for determining if the preset has changed configuration at all).\n getCacheKey: createCacheKeyFunction([__filename].concat(cacheKeyPackages)),\n };\n}", "transform(code) {\n let reg = /^#!(.*)/\n let match = code.match(reg)\n\n shebang[name] = match ? '#!' + match[1] : ''\n\n code = code.replace(reg, '')\n\n return {\n code,\n map: null,\n }\n }", "renderInput(name, label, type = \"text\") {\n //use this part to do account destructuring\n const { data, errors } = this.state;\n return (\n <Input\n type={type}\n name={name}\n label={label}\n value={data[name]}\n onChange={this.handleChange}\n error={errors[name]}\n />\n );\n }", "__init2() {this.noAnonFunctionType = false}", "toJS() {\n return {\n ...this,\n }\n }", "constructor(public firstName: string, public middleInitial: string, public lastName: string) {\n//TODO: Refactor this to use the ES6 template literal notation\nthis.fullName = firstName + \" \" + middleInitial + \" \" + lastName;\n}", "constructor(args, opts) {\n // Calling the super constructor is important so our generator is correctly set up\n super(args, opts);\n\n // Next, add your custom code\n this.option('babel'); // This method adds support for a `--babel` flag\n }", "function transform(code, sourcePath) {\n let output = {\n wxml:'',\n wxss:'',\n js:'',\n json:'',\n type:''//App||page||component\n }\n sharedState.sourcePath = sourcePath;\n const result = babel.transform(code, {\n babelrc: false,\n plugins: [\n 'syntax-jsx', \n // \"transform-react-jsx\",\n 'transform-decorators-legacy',\n 'transform-object-rest-spread', \n transformPlugin, \n ]\n })\n // tranform后, 结果都会写入sharedState.output\n output = sharedState.output;\n output.js = result.code;\n sharedState.reset();\n\n return output;\n}", "compile(match) {\n const { rule, prefix, items } = match\n const results = (prefix && prefix.compile()) || {}\n const name = rule.rule.argument || rule.rule.name\n results[name] = items.map(item => item.compile())\n return results\n }", "function compile(source) {\n const ast = parser.parse(source);\n const interpreter = new Interpreter();\n const object = interpreter.generate(ast);\n // console.log(JSON.stringify(object));\n return object;\n}", "constructor(args, opts) {\n // Calling the super constructor is important so our generator is correctly set up\n super(args, opts);\n\n // Next, add your custom code\n this.option(\"babel\"); // This method adds support for a `--babel` flag\n }", "function t(e){if(null==e)throw new TypeError(\"Object.assign cannot be called with null or undefined\");return Object(e)}", "function t(e){if(null==e)throw new TypeError(\"Object.assign cannot be called with null or undefined\");return Object(e)}" ]
[ "0.5741239", "0.5727293", "0.55184275", "0.5488657", "0.5402005", "0.53983116", "0.53134835", "0.5254357", "0.52468604", "0.5244631", "0.5241302", "0.5232732", "0.5214662", "0.52054214", "0.5151123", "0.5151123", "0.5151123", "0.5151123", "0.5118562", "0.5109306", "0.5101672", "0.5094667", "0.50908494", "0.50887716", "0.50887716", "0.5074147", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50579673", "0.50556576", "0.5046647", "0.5020649", "0.49980536", "0.49948412", "0.49947563", "0.49947563", "0.4971571", "0.49552622", "0.49524832", "0.4903581", "0.4890109", "0.48861477", "0.48808986", "0.487431", "0.4865544", "0.48594254", "0.4858114", "0.4841319", "0.483554", "0.48333865", "0.48307833", "0.48199734", "0.4813778", "0.48016346", "0.47831094", "0.47737804", "0.47701973", "0.47678685", "0.47641826", "0.47628638", "0.47583425", "0.47547016", "0.4752582", "0.47342342", "0.47307006", "0.47231093", "0.4720894", "0.47087988", "0.470702", "0.46979153", "0.46926007", "0.46924523", "0.46909097", "0.4689796", "0.46815687", "0.46727297", "0.46681765", "0.46679682", "0.46640676", "0.465762", "0.46522224", "0.46519682", "0.46519682" ]
0.0
-1
Remove selected field from the form schema.
function removeField(formSchema = {}, fieldId) { let props = formSchema.properties; delete props[fieldId.replace('root_', '')]; return {...formSchema, properties: props}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeMaterialSchemaValue(fieldName, field) {\n this.fields[fieldName].attributes[field] = null;\n }", "function clearFields() {\n document.getElementById('former').remove();\n}", "removeField(id) {\n this.fieldDescriptor.delete(id);\n this.errors.delete(id);\n }", "function removeField(form, fieldName) {\n\n // Scan sections\n form.sections.forEach(function(section, key) {\n scanFields(section.fields, fieldName);\n });\n\n // Form fields\n scanFields(form.fields, fieldName);\n\n return form;\n\n}", "function removeField(form, fieldName) {\n\n // Scan sections\n form.sections.forEach(function (section, key) {\n scanFields(section.fields, fieldName);\n });\n\n // Form fields\n scanFields(form.fields, fieldName);\n\n return form;\n\n}", "function clearField(x) {\n\t x.value = '';\n\t}", "function deleteSchemaField() {\n var sleep_schema_v4 = {\n className: \"Sleep\",\n fields: {\n polyphasic: {\n \"__op\" : \"Delete\"\n }\n }\n };\n XHR.PUT(SERVER_URL+'/schemas' + \"/\" + sleep_schema_v4.className, sleep_schema_v4)\n}", "function removeField(objSource) {\r\n var oSource = objSource;\r\n var len = oSource.length ; \r\n for (i = len - 1; i >= 0; i--) {\r\n if (oSource.item(i).selected == true) {\r\n oSource.remove(i);\r\n }\r\n }\r\n}", "function fieldUnset(doc, field) {\n // Requires(doc != undefined)\n // Requires(field != undefined)\n\n var segments = field.split('.');\n var value;\n\n for (var i = 0; i < segments.length; i++) {\n if (doc === undefined) break;\n\n var seg = segments[i];\n\n // if this is the last segment then we delete the field\n if (i == (segments.length - 1)) {\n value = doc[seg];\n delete doc[seg];\n } else {\n // Advance to the next segment\n doc = doc[seg];\n }\n }\n\n return value;\n }", "function remove_fields(link) {\n $(link).prev(\":hidden\").val(\"1\");\n $(link).parents(\".fields\").hide();\n}", "deleteField(object, field) {\n delete object[field];\n console.warn(`\"${field}\" is removed from input json since it's not in the schema`);\n }", "deleteField(field) {\n this.jsonStoreService.removeIn(this.getPathForChild(field));\n }", "remove(fieldInternalName) {\r\n return this.clone(ViewFields_1, `removeviewfield('${fieldInternalName}')`).postCore();\r\n }", "function ClearFields() { }", "clearFields() {\n this._form.find('.form-group input').each((k, v) => {\n let $input = $(v);\n if ($input.attr('type') !== \"hidden\") {\n $input.val('');\n }\n });\n }", "function ClearFields() {\r\n self.model.code = \"\";\r\n self.model.component = \"\";\r\n }", "function ClearField(field)\n{\n\tClassSub = field.value.substring(0,5);\n\tif (ClassSub == \"Class\")\n\tfield.value=\"\";\n}", "function clearFields() {\n var select = $('select');\n var textarea = $('textarea');\n textarea.val('');\n select.prop('selectedIndex', 0); //Sets the first option as selected\n select.material_select();\n}", "function clearFormFields(formSelector) {\n // clear all form fields\n deserializeJsonToForm(formSelector, {});\n \n // select2 components need special treatment\n $(formSelector+' .select2').each(function() {\n $(this).trigger('change');\n //$(this).val(null).trigger('change');\n });\n }", "function aeClearField(sel) {\n\t$(sel).val(\"\").focus();\n\tdocument.forms['bs_query_form'].submit();\n}", "function removeField(field, parent = null){\r\n\t\tif(parent == null) parent = field.parentNode;\r\n\t\tparent.removeChild(field);\r\n\t\tif((box = getViaAttr(field.querySelector('.remove-field'),'data-check'))) uncheckBox(box);\r\n\t\tupdateIndex(parent);\r\n}", "function clearFields() {\n movie_name.value = '';\n release_date.value = '';\n movie_banner.value = '';\n description.value = '';\n}", "function deleteField(event){\n //console.log(event)\n //excluir um por vez, de baixo para cima, deixando pelo menos o último\n const span = event.currentTarget;\n const fieldsContainer = document.querySelectorAll('.new-upload');\n if(fieldsContainer.length <= 1){\n //limpa o valor do campo\n span.parentNode.children[0].value = \"\"\n return\n }\n //deletar campo\n span.parentNode.remove();\n\n\n}", "function ClearFields()\n {\n $(':input').each(function () {\n\n if (this.type == 'text' || this.type == 'textarea' || this.type=='file'||this.type=='hidden') {\n this.value = '';\n }\n else if (this.type == 'radio' || this.type == 'checkbox') {\n this.checked = false;\n }\n else if (this.type == 'select-one' || this.type == 'select-multiple') {\n this.value = '-1';\n }\n });\n\n }", "remove(fieldInternalName) {\n return spPost(this.clone(ViewFields, `removeviewfield('${fieldInternalName}')`));\n }", "function sc_deleteJsFieldBang(o, field) {\n delete o[field];\n}", "forget(field) {\n this.clear(field)\n }", "function remove_fields(t) {\n $(t).prev(\"input[type=hidden]\").val(\"1\"), $(t).closest(\".box\").hide()\n}", "function remove_fields(link){\n\t\n\t$(link).previous(\"input[type=hidden]\").value =\"1\";\n\t\n\t$(link).up(\".fields\").hide();\n}", "handleRemoveField(index, event){\n const values = [...this.state.formFields];\n values.splice(index, 1);\n this.setState({\n formFields: values,\n });\n \n }", "clearField() {\n document.querySelector('#name').value = '';\n document.querySelector('#email').value = '';\n document.querySelector('#profession').value = '';\n }", "function clearFields() {\n $('#input_form')[0].reset()\n }", "function clear_field(field) {\n\t\tif (field.value==field.defaultValue) {\n\t\t\tfield.value=''\n\t\t}\n\t}", "spliceSlot(fieldIndex) {\n let splicedField = this.getElementByIndex(fieldIndex)\n this.getElementWrapper().removeChild(splicedField)\n }", "function ClearField(field_id_or_name)\n{\n var field = document.getElementById(field_id_or_name);\n if (field)\n {\n field.value = \"\";\n }\n else\n {\n field = document.getElementsByName(field_id_or_name);\n if (field && field[0])\n {\n field[0].value = \"\";\n }\n }\n}", "function clearField(field)\n{\n field.val(\"\");\n var parent = field.parent();\n parent.find(\".serious_error\").remove();\n parent.find(\".warning_error\").remove();\n}", "function remove_fields (link) {\n\t //Sets hidden field for _destroy value to 1 (i.e. true) to indicate to remove fields\n\t //when submit button is clicked.\n\t $(link).previous(\"input[type=hidden]\").value = \"1\";\n\t //Navigates up DOM tree to first tag with class 'fields' and hides them\n\t $(link).up(\".fields\").hide();\n\t}", "function clearForm(event) {\n event.target.elements['title'].value = null;\n event.target.elements['author'].value = null;\n event.target.elements['pages'].value = null;\n event.target.elements['read'].value = false ;\n}", "removeAll() {\r\n return this.clone(ViewFields_1, \"removeallviewfields\").postCore();\r\n }", "function clearInputFields() {\n $('input#date').val('');\n $(\"select\").each(function () {\n this.selectedIndex = 0;\n });\n }", "function clearFields(){\n\t$(\".form-control\").val(\"\");\n}", "function clearFields(){\n\t$(\".form-control\").val(\"\");\n}", "function remove_fields(link) {\n $(link).prev(\"input[type=hidden]\").val(\"1\");\n $(link).closest(\".fields_group\").hide();\n}", "function remove_fields(link) {\n jQuery(link).prev(\"input[type=hidden]\").val(\"1\");\n jQuery(link).closest(\".fields\").hide();\n}", "function drupalgap_form_clear(form_selector) {\n try {\n $(':input', form_selector)\n .not(':button, :submit, :reset, :hidden')\n .val('')\n .removeAttr('checked')\n .removeAttr('selected');\n }\n catch (error) { console.log('drupalgap_form_clear - ' + error); }\n}", "function remove_fields(link) {\n $(link).prev(\"input[type=hidden]\").val(\"1\");\n $(link).closest(\".row-fluid\").hide();\n}", "function removeField(){\n this.parentElement.parentElement.removeChild(this.parentElement);\n fieldsCounter--;\n\n /* reversing disabled add field button if amount of fields is less than MAX*/\n if(!shouldDisableAddFieldButton()){\n let addFieldButton = document.getElementById('add-field-button');\n addFieldButton.disabled = false;\n }\n\n //if last field is removed then remove submit button\n if(fieldsCounter === 0){\n removeSubmitButton();\n }\n}", "function clearFields() {\n employeeId.value = \"\";\n firstName.value = \"\";\n lastName.value = \"\";\n address.value = \"\";\n emailId.value = \"\";\n}", "function ClearFields() {\r\n self.model.code = \"\";\r\n self.model.name = \"\";\r\n self.model.address = \"\";\r\n }", "reset() {\n\t\tthis.props.form.get('field').map((field, index) => {\n\t\t\tvar target = this.refs && this.refs['field' + field.get('id')];\n\t\t\ttarget && target.onChange({target: {value: undefined, edited: false}});\n\t\t\t//target && target.setOriginal();\n\t\t});\n\t}", "function resetFieldStyle(){\n\t $(\".fieldBox\").css(\"backgroundColor\",\"#fff\");\n\t $(\".fieldBox\").css(\"borderColor\", \"#fff\");\n\t $(\".fieldBox\").attr(\"selected\",false);\n\t $(\".fieldBox\").find(\".removeButton\").hide();\n }", "function itg_syndication_clear_form(class_name) {\n jQuery(\".\" + class_name).find(':input').each(function () {\n switch (this.type) {\n case 'text':\n case 'textarea':\n $(this).val('');\n break;\n case 'select-one':\n $(this).val('_none');\n break;\n }\n });\n }", "getFields() {\n this.schema = this.props.collection._c2._simpleSchema._schema; // Using the provided Collection object, get the simpleSchema object\n\n if(this.props.useFields) // If we're selecting which fields to use\n {\n Object.keys(this.schema).filter((fieldName) => { // Filter (ie remove) this field from the schema by returning boolean\n if(this.props.useFields.indexOf(fieldName) === -1) // If this fieldName does not exist in the useFields array\n {\n delete this.schema[fieldName]; // We remove it from the forum schema\n }\n });\n }\n }", "function wipeForm() {\n selectExists = document.getElementById(\"select\");\n selectExists.parentNode.removeChild(selectExists);\n submitExists = document.getElementById(\"submitInstance\");\n submitExists.parentNode.removeChild(submitExists);\n checkboxExists = document.getElementById(\"langCheckbox\");\n checkboxExists.parentNode.removeChild(checkboxExists);\n labelExists = document.getElementById(\"checkboxLabel\");\n labelExists.parentNode.removeChild(labelExists);\n}", "function clearFields(event) {\n event.target.fullName.value = '';\n event.target.status.value = '';\n }", "static clearField(){\n document.querySelector('#title').value = '';\n document.querySelector('#author').value = '';\n document.querySelector('#isbn').value = '';\n }", "function clearDropdown(field) {\r\n field.options.length = 1;\r\n field.options[0] = new Option('',\r\n '',\r\n true,\r\n true);\r\n\r\n field.options.value = \"\";\r\n}", "function cleanAdvancedQueryForm() {\n $('[name=p1]').val('')\n }", "clear(field) {\n if (field === undefined) {\n this.field = [];\n } else {\n this.fields[field] = undefined;\n }\n this.time = undefined;\n this.fieldsComputed = false;\n }", "clearFields(){\n document.querySelector('#title').value = '';\n document.querySelector('#author').value = '';\n document.querySelector('#reference').value = '';\n document.querySelector('#price').value = '';\n }", "handleRemoveChoice(index, choiceIndex){\n const values = [...this.state.formFields];\n values[index]['choices'].splice(choiceIndex, 1);\n this.setState({\n formFields: values,\n \n });\n }", "function DeleteField() {\n myInfoWindow.close();\n myField.setMap(null);\n ShowDrawingTools(true);\n}", "function clearField(){\n document.getElementById(\"myForm\").reset();\n}", "function department_Clear_FromData()\r\n{\r\n\r\n\tclearFields(\"department_form\");\r\n\t\r\n\t//remove Delete Button\r\n\tremove_child_Elements('department-delete-btn');\r\n\taddValidationClass('department_form', 'department_data_upload_file', 'validate-required');\r\n\t\r\n}", "function clearFields() {\n firstName.value = \"\";\n lastName.value = \"\";\n jobYears.value = \"\";\n salary.value = \"\";\n position.value = \"\";\n team.value = \"\";\n phone.value = \"\";\n email.value = \"\";\n paysTax.checked = false;\n}", "removeAttribute(name) {\n if ('attributes' in this.fieldNode) {\n const attrindex = this._givenAttrs.indexOf(name);\n if (attrindex !== -1) {\n this.fieldNode.attributes[name].deleteNode();\n }\n } else {\n this._removeVirtualAttribute(name);\n }\n }", "clearFields(){\n this.description.value = \"\"\n this.amount.value = \"\"\n this.date.value = \"\"\n }", "function removeSelectBox() {\n if (selectBox) {\n scene.remove(selectBox);\n selectBox.geometry.dispose();\n selectBox = undefined;\n }\n}", "clearFields(fields) {\n fields.forEach(function (field) {\n $(field).val('');\n });\n }", "function clearFields() {\n \t$('#frmMain').removeClass('submitted'); \n \t\n \t$('#frmMain').find(':input').each(function(){\n \t\tvar id = $(this).prop('id');\n \t\tvar Value = $('#' + id).val(\" \");\n \t});\n \t \t\n \t$('#txtShape').val('Rod'); \n \t$(\"#drpInch\").val(0);\n $(\"#drpFraction\").val(0);\n \n UncheckAllCheckBox();\n clearSelect2Dropdown();\n \n \t$('.addTR').text(\"Add\");\n \tisEdit = false;\n \n }", "function eliminar_todo(){\n\tdocument.fo.valores.value=\"\";\n}", "function removeValue() {\n\tvar elem = document.getElementById('selectedColumns');\n\tif (elem.options.selectedIndex>=0) {\n\t\tfor (var i=0; i<elem.options.length; i++) {\n\t\t\tif (elem.options[i].selected) {\n\t\t\t\telem.removeChild(elem.options[i--]);\n\t\t\t}\n\t\t}\n\t}\n}", "removeAll() {\n return spPost(this.clone(ViewFields, \"removeallviewfields\"));\n }", "clearInput() {\n if (this.getCurTab() === \"dbms\") {\n var curDocName = DOC.iSel(\"docNameID\").value; // Stores current value of docName\n DOC.iSel(\"dbmsFormID\").reset(); // Resets entire form\n DOC.iSel(\"docNameID\").value = curDocName; // Added so docname is not reset\n } else if (this.getCurTab() === \"fs\") {\n var curDocName = DOC.iSel(\"docNameID2\").value;\n DOC.iSel(\"fsFormID\").reset();\n DOC.iSel(\"docNameID2\").value = curDocName;\n }\n }", "function removeField(){\n\n if (fieldSet == 1){\n var removeBtn = document.getElementById('removeBtn');\n removeBtn.style.display = \"none\";\n var submitBtn = document.getElementById('submit');\n submitBtn.style.display = \"none\";\n }\n var newestDiv = document.getElementById(\"field_div_id_\"+(fieldSet-1));\n newestDiv.parentNode.removeChild(newestDiv);\n\n fieldSet--;\n}", "function removeFields(p, ...fields) {\n if (!p.state.fields) {\n return\n } else {\n fields.forEach(f => {\n let index = p.state.fields.indexOf(f);\n if (index > -1) {\n p.state.fields.splice(index, 1);\n }\n });\n }\n}", "function clearForm() {\n\t\tvar form = document.getElementById(\"target\");\n\t\tvar frm_elements = form.elements;\n\t\t$(\"select#sourceSystem option[selected]\").removeAttr(\"selected\");\n\t\tfor (i = 0; i < frm_elements.length; i++) {\n\t\t\tfield_type = frm_elements[i].type.toLowerCase();\n\t\t\tswitch (field_type)\t{\n\t\t\t\tcase \"text\":\n\t\t\t\tcase \"password\":\n\t\t\t\tcase \"hidden\":\n\t\t\t\t\tfrm_elements[i].value = \"\";\n\t\t\t\t\tfrm_elements[i].defaultValue = \"\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"checkbox\":\n\t\t\t\t\tfrm_elements[i].checked = false;\n\t\t\t\t\tfrm_elements[i].defaultChecked = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"select-one\":\n\t\t\t\t\tfrm_elements[i].selectedIndex = -1;\n\t\t\t\t\tfrm_elements[i].defaultSelected = -1;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "@action\n clear() {\n this.deepAction('clear', this.fields);\n }", "reset() {\n\t\tthis.formElement.reset();\n\t}", "function clearFields() {\r\n\t\t\t\t\t\t$('#tf_Id').val(null);\r\n\t\t\t\t\t\t$('#tf_Descricao').val(null);\r\n\t\t\t\t\t\t$('#slc_Marca').val(0);\r\n\t\t\t\t\t\t$('#slc_TipoVeiculo').val(0);\r\n\t\t\t\t\t\t$('#slc_Status').val(0);\r\n\t\t\t\t\t\t$('#btn-operation').val(\"Criar Modelo\");\r\n\t\t\t\t\t}", "reset() {\n this.registry.reset();\n this.userField.select2('val', '');\n this.permissionField.val('none');\n }", "resetForm() {\n const changeStates = {\n processingForm: false\n };\n\n Object.keys(this.schema).map((fieldName) => {\n changeStates[`${fieldName}_fieldValue`] = null;\n });\n\n this.setState(changeStates);\n }", "removeForm() {\n if (this.$formContainer === null) {\n return;\n }\n\n delete this.formSaveAjax;\n // Allow form widgets to detach properly.\n Drupal.detachBehaviors(this.$formContainer.get(0), null, 'unload');\n this.$formContainer\n .off('change.quickedit', ':input')\n .off('keypress.quickedit', 'input')\n .remove();\n this.$formContainer = null;\n }", "function delAdditForm(event) {\n event.target.parentNode.remove();\n}", "function removeAttributeFromPopupField(fieldName, container, attribute) {\n\tvar fieldCol = $(\"input[name=\" + fieldName + \"]\", container);\n\tfieldCol.removeAttr(attribute);\n}", "function removeAttributeFromPopupField(fieldName, container, attribute) {\n\tvar fieldCol = $(\"input[name=\" + fieldName + \"]\", container);\n\tfieldCol.removeAttr(attribute);\n}", "function fnClearForm() {\n elSwForm.reset();\n }", "function remove_fields(link) {\n\t$('#web_ref_add_link').fadeIn();\n\t$(link).prev(\"input[type=hidden]\").val(\"1\");\n\t$(link).closest(\".fields\").hide();\n}", "static clearFields(){\n document.querySelector('#title').value ='';\n document.querySelector('#author').value ='';\n document.querySelector('#isbn').value ='';\n }", "function wpbooklistCustomFieldsRemoveDropdownOption() {\n\t\t$( document ).on( 'click', '.wpbooklist-addition-div-customfields-cancel', function( event ) {\n\t\t\t$( this ).parent().parent().remove();\n\t\t});\n\t}", "removeColumn(field) {\n this.fields = this.fields.replace(',' + field, '');\n this.cols = [];\n this._init(this.fields);\n }", "_unset(){\r\n this.currentOperator = '';\r\n this.currentValue = '';\r\n if ( this.columns.length > 1 ){\r\n this.currentField = '';\r\n }\r\n }", "function removeGroupForm (ev) {\n\t/* Här borde det skrivas ut om spelaren är med i fler grupper. */\n\taddForm($(this).find('.card-header').text(),\n\t\t'removeGroup',\n\t\t[\n\t\t\t'<label>Namn:</label> \\\n\t\t\t\t<select name=\"select\" required> \\\n\t\t\t\t\t<option value=\"id1\">Ströbröd Dagis</option> \\\n\t\t\t\t\t<option value=\"id2\">Förskolan före sin tid</option> \\\n\t\t\t\t</select>'\n\t\t]\n\t).find('select').prop('selectedIndex', -1);\n}", "function removeFromChangedValuesList(obj) {\n var cvs = $(obj.form).find(\"#\" + cName)[0];\n if (!cvs) {\n return;\n }\n\n len = cvs.length;\n for (i = 0; i < len; i++) {\n if (obj.name == cvs.options[i].value) {\n cvs.options[i] = null;\n return;\n }\n }\n }", "clear()\n {\n this.set('selected', null);\n }", "function removeForm() {\n $(\"#orderFrom\").remove();\n}", "function clearFields() {\n \t$('#frmMain').removeClass('submitted'); \t\n \t$('#frmDirectlyBolted').removeClass('submitted'); \t\n \t$('#frmPostWithEndPlate').removeClass('submitted'); \n \t\n \tclearFormFields('frmMain');\n \tclearFormFields('frmDirectlyBolted');\n \tclearFormFields('frmPostWithEndPlate');\n \t \t\n \t$(\"#txtShape\").val('S'); \n $(\"#ddlConnectiontypeMonoRail\").val('curvedRailsNO');\n $(\"#ddlConnectiontypeMonoRail\").trigger(\"change\");\n \t\n \t$('#ConnectiontypeMonorail').val(\"connectionTypeMonoEP\"); \t \t\n \t$(\"#ConnectiontypeMonorail\").trigger(\"change\");\n \t \t \t\n \t$(\".defaultValueZero\").val(0);\n \t\n \tUncheckAllCheckBox();\n \tclearSelect2Dropdown();\n \t\n \t$('#drpBoltGrade').val(getOptId('drpBoltGrade', BoGrGp)).change();\n \t$('#drpBoltDia').val(BoltDiaGP);\n \t\n \t$('.addTR').text(\"Add\");\n \tisEdit = false;\n \tSelected = [];\n }", "function removeOption(value,form) {\n if(form===1){\n $(\"#contestant option[value='\" + value + \"']\").each(function () {\n $(this).remove();\n });\n }else if(form===2){\n $(\"#contestant_edit option[value='\" + value + \"']\").each(function () {\n var values=$(this).text().split(\" - \");\n $(\"#cont_number_edit\").val(values[0]);\n $(\"#cont_name_edit\").val(values[1]);\n $(this).remove();\n });\n }\n}", "static clearFields() {\n document.querySelector('#title').value = '';\n document.querySelector('#author').value = '';\n document.querySelector('#isbn').value = '';\n }", "function removeContact() {\n\t$(\"#civis\").val(\"madame\");\n\t$(\"#firstName\").val(\"\");\n\t$(\"#lastName\").val(\"\");\n\t$(\"#phoneNumber\").val(\"\");\n}" ]
[ "0.6885689", "0.64909214", "0.6388381", "0.6364287", "0.6356985", "0.61660415", "0.61633456", "0.6152233", "0.6132588", "0.61110264", "0.6102599", "0.6094554", "0.6083695", "0.60777915", "0.60590446", "0.6053828", "0.6041608", "0.6040311", "0.6020806", "0.602052", "0.5992053", "0.5982767", "0.5979251", "0.5978827", "0.5961387", "0.5960366", "0.59595907", "0.5942141", "0.5941274", "0.5936287", "0.5928284", "0.5912352", "0.59045595", "0.5903741", "0.5898132", "0.5891571", "0.58855975", "0.5857106", "0.5856548", "0.5853836", "0.58441097", "0.58441097", "0.58434737", "0.58369774", "0.5817848", "0.58130413", "0.58112836", "0.58076525", "0.5806615", "0.58050025", "0.5803786", "0.5783007", "0.57720774", "0.57652014", "0.5757778", "0.57553464", "0.57523423", "0.57487303", "0.57368904", "0.57363564", "0.5736034", "0.57339746", "0.5730357", "0.57260203", "0.57205033", "0.5713209", "0.57023644", "0.5695576", "0.5671434", "0.5669996", "0.5651853", "0.5651063", "0.56462026", "0.5640328", "0.5634395", "0.5632563", "0.563154", "0.56251246", "0.5618473", "0.56183", "0.55976987", "0.55961645", "0.55916727", "0.55865866", "0.55704045", "0.55704045", "0.5565808", "0.55643237", "0.55619305", "0.55610144", "0.55601984", "0.555347", "0.55532926", "0.554892", "0.55433244", "0.55397314", "0.5537243", "0.5532169", "0.5526142", "0.5522932" ]
0.6978677
0
Load user and append to req.
function load(req, res, next, id) { User.get(id) .then((foundUser) => { req.user = foundUser; // eslint-disable-line no-param-reassign return next(); }).catch(e => next(e)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadUser(req, res, next) {\n User.findOne({ _id: req.session.user_id }, function(err, user) {\n if (err) { throw err; }\n req.user = user;\n next();\n });\n}", "function loadUser(req, res, next) {\n if (!req.session.user_id) { return next(); }\n\n User.findOne({ _id: req.session.user_id }, function(err, user) {\n req.user = user;\n next(err);\n });\n}", "function load(req, res, next, id) {\n User.get(id)\n .then(user => {\n req.user = user; // eslint-disable-line no-param-reassign\n return next();\n })\n .error(e => next(e));\n}", "function load(req, res, next, id) {\n _user2.default.get(id).then(function (user) {\n req.user = user; // eslint-disable-line\n return next();\n }).catch(function (e) {\n return next(e);\n });\n}", "function load(req, res, next, id) {\n User.get(id)\n .then((user) => {\n req.user = user; // eslint-disable-line no-param-reassign\n return next();\n })\n .catch(e => next(e));\n}", "function load(req, res, next, id) {\n User.get(id)\n .then((user) => {\n req.user = user; // eslint-disable-line no-param-reassign\n return next();\n })\n .catch(e => next(e));\n}", "function load(req, res, next, id) {\n User.get(id)\n .then((user) => {\n req.user = user; // eslint-disable-line no-param-reassign\n return next();\n })\n .catch(e => next(e));\n}", "function load (req, res, next, id) {\n User.get(id)\n .then(user => {\n req.user = user // eslint-disable-line no-param-reassign\n return next()\n })\n .catch(e => next(e))\n}", "function load(req, res, next, id) {\n User.get(id)\n .then((user) => {\n req.user = user;\n return next();\n })\n .catch(e => next(e));\n}", "function addUserToRequest(req, res, next) {\n // check if user is added to request\nif (req.user) return next(); \n // check to see if there is a session created\n if(req.session && req.session.userId){\n // find the user based on there id and then add them to the request object\n User.findById(req.session.userId, function(err, foundUser) {\n req.user = foundUser;\n next();\n });\n } else {\n next();\n };\n}", "function load (req, res, next, id) {\n User.get(id)\n .then((result) => {\n req.user = result;\n return next()\n })\n .catch(e => next(e))\n}", "function appendUser() {\n return compose()\n // Attach user to request\n .use(function(req, res, next) {\n validateJwt(req, res, function(val) {\n if(_.isUndefined(val)) {\n\t\t\t\t\t\n\t\t\t User.find({\n\t\t\t where: {\n\t\t\t _id: req.user._id\n\t\t\t },\n\t\t\t \t\tinclude: [{\n\t\t\t \t\t\tmodel: Role}]\n\t\t\t })\n\t\t\t .then(function(user) {\n\t\t\t if (!user) {\n req.user = undefined;\n return next();\n\t\t\t } else {\n\t\t\t req.user = user;\n\t\t\t next();\n\t\t\t\t }\n\t\t\t })\n\t\t\t .catch(function(err) {\n\t\t\t\t\t\tconsole.log(\"ERROR \"+err)\n\t\t\t return next(err);\n\t\t\t });\n\t\t\t\t\t\n\t\t\t\n } else {\n req.user = undefined;\n next();\n }\n });\n });\n}", "function load(req, res, next, id) {\n AdminUser.get(id)\n .then((user) => {\n req.user = user; // eslint-disable-line no-param-reassign\n return next();\n })\n .catch(e => next(e));\n}", "initUser() {\n this.app.use(function (req, res, next) {\n res.locals.user = req.user || null;\n next();\n });\n }", "function userReq () {\n const request = apiHelper.axGet(apiUrls.user, authToken)\n return axios(request)\n }", "function loadUser() {\r\n makeHTTPRequest(`/usuarios/${uId}`, 'GET', '', cbOk1);\r\n}", "async function load(req, res, next, id) {\n try {\n let user = await User.findByPk(id);\n\n if (!user) {\n const err = new APIError('No such user exists!', HTTPStatus.NOT_FOUND, true);\n return next(err);\n }\n\n req.user = user;\n return next();\n } catch (err) {\n return next(err);\n }\n}", "function setUser(req, res, next) {\n const userId = req.body.userId\n if (userId) {\n req.user = users.find(user => user.id === userId)\n }\n next()\n}", "function load(req, res, next, cedula) {\n User.getByCedula(cedula)\n .then((user) => {\n req.user = user; // eslint-disable-line no-param-reassign\n return next();\n })\n .catch(e => next(e));\n}", "function user(){\r\n uProfile(req, res);\r\n }", "function load(req, res, next, id) { \n User.findById(id)\n .then(user => {\n // console.log('get ', user, user.password);\n if (user === null) { \n const error = new APIError('Not find user', httpStatus.NOT_FOUND, true);\n return res.status(error.status).send(error.message);;\n }\n req.user = user;\n return next();\n })\n}", "async function addUserToLocals(req, res, next) {\r\n const user = await userDao.retrieveUserWithAuthToken(req.cookies.authToken);\r\n // You can use \"user\" in every where now (e.g. handlebars: {{user.username}}; route handler: res.locals.user)\r\n res.locals.user = user;\r\n next();\r\n}", "function getUserInfo(req, res, next) {\n var token = _getTokenFromRequest(req);\n var allowAnonymous = req.disallowAnonymous ? false : true;\n\n logger.debug('checking token : ' + token);\n _verifyToken(token, function (err, info) {\n var errMsg = 'Internal server error';\n if (err) {\n logger.error('_verifyToken failed ', err);\n if (err === 400 || err === 419) {\n if (allowAnonymous) {\n logger.debug('_verifyToken added empty user in req'); \n \t req.user = {};\n return next();\n }\n errMsg = (err === 400) ? 'requires access token' : 'invalid access token';\n }\n return res.status(err).send(utils.fail(errMsg));\n }\n req.user = info;\n return next();\n });\n}", "function addUserToLocals(req, res, next) {\n res.locals.user = req.user;\n next();\n}", "async bringUser(req,res){\n //función controladora con la lógica que muestra los usuarios\n }", "function attachUser () {\n return function (req, res, next) {\n if (req.session) {\n if (req.session.idToken) {\n // We have an id_token, let's check if it's still valid\n const decoded = jwt.decode(req.session.idToken)\n if (assertAlive(decoded)) {\n req.session.user_id = decoded.sub\n req.session.user = decoded.preferred_username\n req.session.user_picture = decoded.picture\n return next()\n } else {\n // no longer alive, let's flush the session\n req.session.destroy(function (err) {\n if (err) next(err)\n return next()\n })\n }\n }\n }\n next()\n }\n}", "function getUser( req ) { // : { id: string, requests: int, path: string }\n var requests = usersGetRequests(req.session.userid);\n if (requests >= limits.requestsPerUser) throw { httpCode: 429, message: \"too many requests from this user\" } ;\n\n return {\n id: req.session.userid,\n requests: requests,\n path: combine(runDir, createHash(req.session.userid) + \"-\" + uniqueHash()),\n };\n}", "read(req, res) {\n\t\t\tif(req.user === USER_NOT_FOUND) {\n\t\t\t\treturn res.sendStatus(404);\n\t\t\t}\n\t\t\tres.json(req.user);\n\t\t}", "function load_user() {\n // get user id from local storage\n const localStorageCurrentUserId = localStorage.getItem(\"currentUserId\");\n\n // make a REST HTTP request for all users using the app\n const request = new XMLHttpRequest();\n request.open('GET', `/users`);\n request.onload = () => {\n const allAppUsers = JSON.parse(request.responseText);\n\n // if there is a locally stored user and that user is in the servers list of current users...\n if (localStorageCurrentUserId && (allAppUsers.find((user) => user.id === localStorageCurrentUserId))) {\n\n // store that user as the apps currentUser and update the DOM accordingly\n currentUserId = localStorageCurrentUserId;\n selectors.displayNameModalTextField.val(allAppUsers.find((user) => user.id === localStorageCurrentUserId).displayName);\n selectors.displayNameModal.modal('hide');\n } else {\n // else reveal the display name modal (the locally stored user isn't there or is invalid)\n selectors.displayNameModal.modal('show');\n }\n };\n request.setRequestHeader(\"Content-Type\", \"application/json;charset=UTF-8\");\n request.send();\n}", "async function getUser(req, res, next) {\n\tlet user;\n\ttry {\n\t\tuser = await User.findById(req.params.userid);\n\t} catch (err) {\n\t\treturn res.status(404).send(err.message);\n\t}\n\tres.user = user;\n\tnext();\n}", "static async ensureAuthenticated(req, res, next) {\n // Check the user based on API.\n const apiKey = req.get(\"user-api\") || req.body[0]?.user_api;\n const userId = req.get(\"user-id\") || req.body[0]?.user_id;\n if (apiKey && userId) {\n let sqlQuery = \"SELECT * FROM user WHERE id = ?\";\n const ourUser = await db.query(sqlQuery, userId);\n if (ourUser.length > 0) {\n let uncDb = await Utils.decrypt(ourUser[0].api_key);\n if (uncDb == apiKey) {\n let curUser = {\n steam_id: ourUser[0].steam_id,\n name: ourUser[0].name,\n super_admin: ourUser[0].super_admin,\n admin: ourUser[0].admin,\n id: ourUser[0].id,\n small_image: ourUser[0].small_image,\n medium_image: ourUser[0].medium_image,\n large_image: ourUser[0].large_image,\n };\n req.user = curUser;\n return next();\n }\n }\n }\n if (req.isAuthenticated()) {\n return next();\n }\n res.redirect(\"auth/steam\");\n }", "function req_read_user_auth(env) {\n var data = http.req_body(env).user;\n set_user_email(env, data.user_email);\n set_user_password(env, data.user_password);\n}", "function userLoggedInAdvanced (req, res, next) {\n // first check if we have HTTP Basic Auth\n const auth = basicAuth(req)\n // changed var to let because heroku still doesn't support let\n var userEmail, authToken\n if (auth) {\n userEmail = auth.name\n authToken = auth.pass\n } else {\n // else we just look in the http header or body or params\n userEmail = req.get('User-Email') || req.body.user_email || req.query.user_email\n authToken = req.get('Auth-Token') || req.body.auth_token || req.query.auth_token\n }\n\n console.log(auth)\n if (!userEmail || !authToken) return res.status(401).json({error: 'unauthorised'})\n\n User.findOne({email: userEmail, auth_token: authToken}, (err, user) => {\n if (err || !user) return res.status(401).json({error: 'unauthorised'})\n\n req.currentUser = user\n next()\n })\n}", "function readUserFromSession(req, res) {\n res.send(req.session ? req.session.appUser : {});\n }", "function getReqUser(req, res) {\n var userId = req.params.id;\n var query = RequestLoan.find({ user: userId });\n query.populate({ path: 'resource' }).exec(function (err, requests) {\n if (err) {\n res.status(500).send({ message: \"Ocurrió un error interno, comuniquese con el servidor\" });\n } else {\n if (!requests) {\n res.status(404).send({ message: \"No se encontrarón préstamos\" });\n } else {\n res.status(200).send({ requests });\n }\n }\n });\n}", "function getUserFromRec2(req) {\n const user = {\n credito_: req.body.credito_\n };\n return user;\n}", "function loadFieldsInUser(userDB, res) {\n var token = jwt.sign({ user: userDB }, SECRET_KEY, { expiresIn: 14400 });//4hours\n\n res.status(200).json({\n ok: true,\n user: userDB,\n token: token,\n id: userDB._id,\n menu: getMenu(userDB.role)\n });\n}", "async fetchUser(){\n\t\treturn res.status(200).send({\n\t\t\tmessage: 'Successful Operation',\n\t\t\tuser: req.user\n\t\t})\n\t}", "function getUserFromRec(req) {\n const user = {\n nombre: req.body.nombre,\n apellido: req.body.apellido,\n clave: req.body.clave,\n correo: req.body.correo,\n };\n return user;\n}", "function userMiddleware(req, res, next) {\n const user_id = req.session.user_id;\n if (user_id) {\n req.user = users[user_id];\n res.locals.user = req.user; //locals makes the variable available in templates\n }\n //if there was a corresponding user object make it true if there wasn't anything or undefined make it false.\n req.isAuthenticated = !!req.user;\n res.locals.isAuthenticated = req.isAuthenticated;\n\n next();\n}", "function getMe(req, res) {\n res.json(req.user);\n}", "function userid(req, res, next) {\n var user = {};\n user.userid = req.params.userid;\n user.authorization = req.headers.authorization;\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n\n users.save(user, function (err, success) {\n console.log('Response success ' + success);\n console.log('Response error ' + err);\n if (success) {\n console.log((new Date()) + ' User login: ' + JSON.stringify(user));\n res.send(200, \"\");\n return next();\n } else {\n return next(err);\n }\n });\n}", "function loadUser(){\n let userLogged = JSON.parse(localStorage.getItem(\"userLogged\"))\n setUser(userLogged)\n }", "function showUser(req,res){\n console.log(\"individual user requested\");\n\n var token = req.cookies.token || req.body.token || req.param('token') || req.headers['x-access-token'];\n var decodedInfo;\n\n if(token){\n\n //VERIFY SECRET AND CHECK TOKEN EXPIRATION:\n jwt.verify(token, superSecret, function(err, decoded){\n if(err){\n res.status(403).send({success: false, message: 'failed to authen token'});\n } else {\n //IF TOKEN IS VALID AND ACTIVE, SAVE FOR OTHER ROUTES TO USE:\n req.decoded = decoded;\n decodedInfo = decoded;\n }\n\n //FIND USER AND SHOW INFO:\n User.findOne({email: decodedInfo.email}, function(err, user){\n if(err) res.send(err);\n console.log(user);\n res.json(user);\n });\n }); //CLOSE TOKEN VALIDATION CHECK\n } //CLOSE TOKEN CHECK\n} //CLOSE SHOW USER FUNCTION", "async loadUser({ commit, dispatch }) {\n let user = await dispatch(\"getUser\");\n if (user) {\n commit(\"setUser\", user);\n }\n }", "function getUser(req, res, next){\n db.users.findOne({_id: mongojs.ObjectId(req.params.id)}, {pass: 0, admin: 0, email:0}, function(err, user){\n if(err){\n return res.json({success: false, message: err});\n }\n else if(!user){\n return res.json({success: false, message: 'Invalid User'});\n }\n else{\n req.user = user;\n next();\n }\n })\n}", "function update(req, res, next) {\r\n\r\n // console.log( 'USER IS ', req.user ); // eslint-disable-line no-console\r\n\r\n // clone the data from the request user ...\r\n const user = Object.assign({}, req.user);\r\n\r\n // copy the passed in data into a local object\r\n const data = Object.assign({}, req.body.user);\r\n\r\n // clean up some of he stuff\r\n delete user._id;\r\n\r\n // if ( user._id === data._id ) {\r\n // Allowed to do this ....\r\n // }\r\n\r\n // get the email address\r\n\r\n res.json(user);\r\n\r\n // NEED A CHECK in MIDDLEWARE .....\r\n // const id = req.user._id;\r\n\r\n // Users.findOne({ _id:id }, (err,user) => {\r\n // if (err) {\r\n // next(err);\r\n // }\r\n // res.json(user);\r\n // });\r\n }", "function userMiddleware({ user }, { locals }, next) {\n // eslint-disable-next-line no-param-reassign\n locals.user = user;\n next();\n}", "function resolve_user_from_locals_token(request, callback){\n user_controller.findUser(request.locals.authenticated_user.id, request.locals.authenticated_user.is_admin, function(data){\n callback(data);\n });\n}", "static isAuthenticatedAsUser (req, res, next) {\n try {\n const jwtToken = AuthorizationUtil._extractToken(req)\n\n const jwtPayload = AuthorizationUtil.extractJWTInformation(jwtToken)\n // so you can use get user who made the request in the endpoint\n // since it will receive the same req object\n req.user = new User(jwtPayload.userId, jwtPayload.username)\n return next()\n } catch (ignored) {\n return ApiResponse.sendErrorApiResponse(403, 'Not authenticated', res)\n }\n }", "function loadCurrentUser() {\n UserService.GetCurrentUser()\n .then(function (response) {\n vm.user = response.data;\n });\n }", "function requireAuth (to, from, next) {\n\t/*\n\t\tDetermines where we should send the user.\n\t*/\n\tfunction proceed () {\n\t\t/*\n\t\t\tIf the user has been loaded determine where we should\n\t\t\tsend the user.\n\t\t*/\n if ( store.getters.getUserLoadStatus() == 2 ) {\n\t\t\t/*\n\t\t\t\tIf the user is not empty, that means there's a user\n\t\t\t\tauthenticated we allow them to continue. Otherwise, we\n\t\t\t\tsend the user back to the home page.\n\t\t\t*/\n\t\t\tif( store.getters.getUser != '' ){\n \tnext();\n\t\t\t}else{\n\t\t\t\tnext('/cafes');\n\t\t\t}\n }\n\t}\n\n\t/*\n\t\tConfirms the user has been loaded\n\t*/\n\tif ( store.getters.getUserLoadStatus != 2 ) {\n\t\t/*\n\t\t\tIf not, load the user\n\t\t*/\n\t\tstore.dispatch( 'loadUser' );\n\n\t\t/*\n\t\t\tWatch for the user to be loaded. When it's finished, then\n\t\t\twe proceed.\n\t\t*/\n\t\tstore.watch( store.getters.getUserLoadStatus, function(){\n\t\t\tif( store.getters.getUserLoadStatus() == 2 ){\n\t\t\t\tproceed();\n\t\t\t}\n\t\t});\n\t} else {\n\t\t/*\n\t\t\tUser call completed, so we proceed\n\t\t*/\n\t\tproceed()\n\t}\n}", "function loadUser() {\n try {\n return (\n jsonParse(localStorage.getItem(userKey) || sessionStorage.getItem(userKey) || '{}') || {}\n );\n } catch (e) {\n return {};\n }\n}", "function getUser(app){\n\treturn function(req, res){\n\t\tconst id = req.params.id;\n\t\tif(typeof id === 'undefined'){\n\t\t\tres.sendStatus(BAD_REQUEST);\n\t\t}\n\t\telse{\n\t\t\treq.app.locals.model.users.getUser(id).\n\t\t\t\tthen((results) => res.json(results)).\n\t\t\t\tcatch((err) => {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t\tres.sendStatus(NOT_FOUND);\n\t\t\t\t});\n\t\t}\n\t};\n}", "async getUser(req, res, next) {\n try {\n let user = await this.controller.getUser(req.params.uid)\n if (user === null) {\n return res.status(httpStatus.NOT_FOUND)\n } else {\n return res.status(httpStatus.OK).json(user)\n }\n } catch (e) {\n next(e)\n }\n }", "function setUser(req, res, next) {\n if (!req.cookies) { return next(); }\n var token = req.cookies['access_token'];\n var expires = moment(req.cookies['expires']);\n if (token && expires) {\n OAuthAccessTokensModel.findOne({ accessToken: token, clientId: _clientId }, function(err, result) {\n if (!err && result) {\n req.username = result.userId;\n req.accessToken = token;\n }\n next();\n });\n }\n else { return next(); }\n}", "async function getUser(req, res, next) {\n const user = models.user.findOne({ where: { id: req.params.id } })\n req.data = res.json(user)\n}", "function api_getuser(ctx) {\n api_req({\n a: 'ug'\n }, ctx);\n}", "function handleRootRequest(req, res) {\n var domain = checkUserIpAddress(req, res);\n if (domain == null) return;\n if (!obj.args) { res.sendStatus(500); return; }\n var domain = getDomain(req);\n res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0' });\n // Check if we have an incomplete domain name in the path\n if (domain.id != '' && req.url.split('/').length == 2) { res.redirect(domain.url); return; }\n if (obj.args.nousers == true) {\n // If in single user mode, setup things here.\n if (req.session && req.session.loginmode) { delete req.session.loginmode; }\n req.session.userid = 'user/' + domain.id + '/~';\n req.session.domainid = domain.id;\n req.session.currentNode = '';\n if (obj.users[req.session.userid] == null) {\n // Create the dummy user ~ with impossible password\n obj.users[req.session.userid] = { type: 'user', _id: req.session.userid, name: '~', email: '~', domain: domain.id, siteadmin: 0xFFFFFFFF };\n obj.db.SetUser(obj.users[req.session.userid]);\n }\n } else if (obj.args.user && (!req.session || !req.session.userid) && obj.users['user/' + domain.id + '/' + obj.args.user.toLowerCase()]) {\n // If a default user is active, setup the session here.\n if (req.session && req.session.loginmode) { delete req.session.loginmode; }\n req.session.userid = 'user/' + domain.id + '/' + obj.args.user.toLowerCase();\n req.session.domainid = domain.id;\n req.session.currentNode = '';\n }\n // If a user is logged in, serve the default app, otherwise server the login app.\n if (req.session && req.session.userid) {\n if (req.session.domainid != domain.id) { req.session.destroy(function () { res.redirect(domain.url); }); return; } // Check is the session is for the correct domain\n var viewmode = 1;\n if (req.session.viewmode) {\n viewmode = req.session.viewmode;\n delete req.session.viewmode;\n }\n var currentNode = '';\n if (req.session.currentNode) {\n currentNode = req.session.currentNode;\n delete req.session.currentNode;\n }\n var user;\n var logoutcontrol;\n if (obj.args.nousers != true) {\n user = obj.users[req.session.userid]\n logoutcontrol = 'Welcome ' + user.name + '.';\n }\n var features = 0;\n if (obj.args.wanonly == true) { features += 1; } // WAN-only mode\n if (obj.args.lanonly == true) { features += 2; } // LAN-only mode\n if (obj.args.nousers == true) { features += 4; } // Single user mode\n if (domain.userQuota == -1) { features += 8; } // No server files mode\n if (obj.args.tlsoffload == true) { features += 16; } // No mutual-auth CIRA\n if ((!obj.args.user) && (obj.args.nousers != true)) { logoutcontrol += ' <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>'; } // If a default user is in use or no user mode, don't display the logout button\n res.render(obj.path.join(__dirname, 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.certificates.CommonName, serverPublicPort: args.port, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, mpspass: args.mpspass });\n } else {\n // Send back the login application\n res.render(obj.path.join(__dirname, 'views/login'), { loginmode: req.session.loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == ''))?0:1), serverDnsName: obj.certificates.CommonName, serverPublicPort: obj.args.port });\n }\n }", "function load_userObj(data) {\n userObj.id = data.id;\n userObj.email = data.email;\n userObj.nick = data.nick;\n userObj.name = data.name;\n userObj.role = data.role;\n}", "function authUser(req, res, next) {\n try {\n const token = req.headers.authorization.split(' ')[1];\n //Si el token es valido, la variable user tiene el objeto guardado en el /auth\n const user = jsonwebtoken.verify(token, process.env.SECRET);\n if (user) {\n req.user = user;// El objeto de user se guarda en el request que comparte la funcion\n return next();\n }\n } catch(err){\n res.status(400).send({message:'Error validating user.', error: err}); \n }\n}", "async function getSingleUser(req, res) {\n req.profile.hash_password = undefined;\n req.profile.salt = undefined;\n return res.status(200).json(req.profile);\n}", "function getUser () {return user;}", "_findAndSetUser(request, callback) {\n const {userId} = request.session;\n if (!userId) {\n // Session is new, no user is specified. Pass the request as it is.\n callback(null);\n } else {\n async.waterfall([\n (callback) => this.services.users.find(userId, callback),\n (user, callback) => {\n request.user = user;\n callback(null);\n }\n ], callback);\n }\n }", "async function loadUser(ctx, next){\n try{\n //await va a detener la ejecucion del proceso hasta que se cumpla la promesa fetch('/api/pictures')\n ctx.user = await fetch(`api/user/${ctx.params.username}`)\n //es una arrow function es lo mismo que .then(function (res){return res.json()})\n .then(res => res.json());\n //llama el siguiente milways\n next();\n }\n catch (err){\n console.log(err);\n }\n}", "function validateUser(req, res, next) {\n jwt.verify(req.headers['x-access-token'], req.app.get('secretKey'), function(err, decoded) {\n if (err) {\n res.json({status:\"error\", message: err.message, data:null});\n }else{\n // add user id to request\n req.body.userId = decoded.id;\n next();\n }\n });\n \n}", "function addUser(req, res) {\n global.logger.info(\"Received POST request: \" + JSON.stringify(req.body));\n res.status(200).send({\n added: true\n });\n}", "function ensureUser(req, res, next){\n ensureToken(req, res, (token)=>{\n User.findOne({ token: token }, (err, user) => {\n if (err) {\n res.json( { success: false, message: String(err) });\n } else {\n next(user);\n }\n });\n });\n}", "function optionalAuth(req, res, next) {\n if (req.isAuthenticated()) {\n res.locals.user = req.user;\n }\n return next();\n}", "function putUser(req, res) {\n\tvar user = req.body.username;\n\tvar pass = req.body.password;\n\tvar date = new Date().toISOString().slice(0, 10);\n\tvar last = req.session.uid;\n\tif (req.body.usertype == 'Admin') {\n\t\tvar userType = 1;\n\t} else if (req.body.usertype == 'User') {\n\t\tvar userType = 2;\n\t}\n\n\tbcrypt.hash(pass, saltRounds, function(err, hash) {\n\t\tvar query = {\n\t\t\ttext: 'INSERT INTO users(username, password, user_type, date_entered, last_update) VALUES ($1, $2, $3, $4, $5)',\n\t\t\tvalues: [user, hash, userType, date, last]\n\t\t}\n\n\t\tmodel.pullData(query, (rows) => {\n\t\t\tconsole.log(rows);\n\t\t});\n\t});\n}", "function getCurrentUser(req, res) {\n // I'm picking only the specific fields its OK for the audience to see publicly\n // never send the whole user object in the response, and only show things it's OK\n // for others to read (like ID, name, email address, etc.)\n const { id, username } = req.user;\n res.json({\n id, username\n });\n}", "function req_read_new_user_name(env) {\n var data = http.req_body(env).user;\n set_new_user_name(\n env,\n data.user_name_title,\n data.user_name_first,\n data.user_name_initial,\n data.user_name_last\n )\n}", "function prepUser (body) {\n return {\n username: body.username,\n password: body.password,\n email: body.email,\n role: body.role\n }\n}", "function getUser(req, res) {\n User.findById(req.params.id, function (err, user) {\n if (err) return res.status(500).send(\"There was a problem finding the user.\");\n if (!user) return res.status(404).send(\"No user found.\");\n res.status(200).send(user);\n });\n}", "async addUser(ctx) {\n try {\n var body = ctx.request.body;\n var user = new User();\n user.name = body.name;\n user.email = body.email;\n user.save();\n ctx.body = { status: 200, message: \"data save \", user: user }\n }\n catch (error) {\n ctx.throw(error)\n }\n }", "function loadUserTasks(req, res, next) {\n if (!res.locals.currentUser) {\n return next();\n }\n Tasks.find({}).or([\n {owner:res.locals.currentUser},\n {collaborators: res.locals.currentUser.email}])\n .exec (function(err, tasks) {\n if (!err) {\n res.locals.tasks = tasks;\n }\n next();\n });\n}", "function addUser(req, res){ \t// request, response\n\treq.session.user = { \t// pushed onderstaande ingevulde data in req.session.user, zonder session, is het altijd geldig\n\t\temail: req.body.email,\n\t\tid: req.body.userName,\n\t\tpassword: req.body.password\n\t};\n\tconsole.log(req.session.user); \t// laat in de terminal de ingevulde gegevens zien\n\tres.redirect('voornaam/' + req.body.userName); \t// dit is de route + de unieke id (username)\n}", "function getUser (req, res) {\n promiseResponse(userStore.findOne({ userId: req.params.id }), res);\n}", "function req_read_user_name(env) {\n var data = http.req_body(env).user;\n set_user_name(\n env,\n data.user_name_title,\n data.user_name_first,\n data.user_name_initial,\n data.user_name_last\n )\n}", "async loadUser () {\n const token = getLocalStorage('token');\n\n // if (token && !this.token) {\n // this.token = token\n // }\n\n if (token && !this.user) {\n try {\n const user = await this.getUser();\n this.user = user\n } catch (e) {\n console.error(e)\n signout()\n }\n }\n\n // const authSuccess = !!this.user && !!this.token;\n\n return this.user;\n }", "function validateUserId(req, res, next) {\n const { id } = req.params;\n console.log(\"This is id in validateUserId(): \", id);\n Users.getById(id)\n .then(userFound => {\n console.log(\"This is userFound in validateUserId(): \", userFound);\n if (userFound && userFound !== undefined) {\n req.user = userFound;\n console.log(\"This is req.user in validateUserId(): \", req.user);\n next();\n } else {\n res.status(400).json({ error: \"This user doesn't exist\" });\n }\n })\n .catch(error => {\n console.log(\"This is error in validateUserId(): \", error);\n res.status(500).json({ error: \"Error validating user ID\" });\n });\n}", "function getauth(req,res,next){\n const authToken = req.headers[\"authtoken\"];\n jwt.verify(authToken,SECRET_KEY,(err,user)=>{\n if(err){\n res.status(400).send(\"Un Authrised.\")\n }\n else{\n req.userid = user.id;\n next();\n }\n })\n}", "function cb(err){\n res.locals.user = req.session.user;\n res.redirect('/');\n }", "function loadUserTasks(req, res, next) {\n if(!res.locals.currentUser){\n return next();\n }\n Tasks.find({}).or([\n {owner: res.locals.currentUser},\n {collaborators: res.locals.currentUser.email}])\n .exec(function(err, tasks){\n if(!err){\n res.locals.tasks = tasks;\n }\n next();\n });\n}", "async function getUser(req, res, next) {\n let user;\n try {\n user = await User.findById(req.params.id);\n if (user === null)\n return res.status(404).json({ message: \"Cannot find user\" });\n } catch (error) {\n return res.status(500).json({ message: error.message });\n }\n res.user = user;\n next();\n}", "async getUser (req, res) {\n const findOneUserQuery = `\n SELECT avatar, firstname, lastname, email, username, location, bio\n FROM users\n WHERE username = $1\n `;\n\n try {\n\n // A user must be signed in to see edit information\n // Signed in user must also be requesting their own user data.\n if (!req.user || req.user.username !== req.params.username) {\n return res.status(403).send('You\\'re not allowed to edit this profile');\n }\n\n const { rows } = await db.query(findOneUserQuery, [ req.params.username ]);\n const profileUser = rows[0];\n\n // If profile user was not found in database\n if (!profileUser) {\n return res.status(404).send('User not found');\n }\n\n return res.status(200).json({ profileUser });\n } catch (error) {\n return res.status(400).send(error);\n }\n }", "async function buildReq({ user, ...overrides } = {}) {\n const req = { user, body: {}, params: {}, ...overrides };\n return req;\n}", "async function getUser(req, res, next){\r\n let user\r\n try {\r\n let id = req.params.id\r\n user = await User.findById(id);\r\n if (user == null) return res.status(404).json({message: \"cannot find user\"})\r\n } catch (error) {\r\n return res.status(500).json({message: error.message})\r\n }\r\n\r\n res.user = user;\r\n next();\r\n}", "function api_getUser(req, res, next) {\n\t// call our internal db to get user profile\n\tuid = req.params.uid;\n\n\tconsole.log('uid ' + uid);\n\t// Retrieve\n\tvar MongoClient = require('mongodb').MongoClient;\n\n\t// Connect to the db\n\tMongoClient.connect(\"mongodb://localhost:27017/soybean\", function(err, db) {\n\t\tconsole.log('connecting to mongdb..');\n\t \tif(err) {\n\t \t \tconsole.log(\"fail to connect to mongdb\");\n\t \t\treturn console.dir(err); \n\t \t}\n\n\t \tvar collection = db.collection('profiles');\n\n\t\tcollection.find({'uid': uid}).toArray(function(err, items) {\n\t\t\tconsole.log(items);\n\t\t\tvar doc = items[0];\n\t\t\tconsole.log(doc);\n\t\t\t//res.send( doc );\n\n\t\t\tvar page = fs.readFileSync('./WebContent/profile.html');\n\t\t\tconsole.log(page);\n\t\t\tvar document = jsdom.jsdom(page);\n\t var window = document.createWindow();\n\t jsdom.jQueryify(window, './js/libs/jquery.js', function() {\n\t\t //window.$('html').html(page);\n\t \tconsole.log('in jsdom ' + window.$('html').html());\n //window.$('h2').html(\"Content Added to DOM by Node.js Server\");\n //for (var i=0; i < products.length; i++) {\n //productSummaryHtml = mustache.to_html(productSummaryTemplate, products[i]);\n console.log('doc email' + doc.email);\n window.$('#profile').append(\"<label>\" + doc.email +\"</label>\");\n //}\n res.writeHead(200, {'Content-Type': 'text/html'});\n res.end(\"<!DOCTYPE html>\\n\" + window.$('html').html());\t\n console.log(window.$('html').text());\n\t });\n\t\t\t//res.writeHeader(200, {\"Content-Type\": \"text/html\"}); \n\t\t\t//res.write(html);\n\t\t});\n\n\t});\n}", "function loadUserDetails() {\n loadJSON('backend/resources/json/user.json', function(response) {\n actual_JSON = JSON.parse(response);\n globalId = actual_JSON.passkey;\n onValidate();\n });\n}", "function fillUpUserObj() {\n fs.readFile('users.json', function (err, data) {\n if (!err) {\n try {\n userObj = JSON.parse(data);\n } catch (e) {\n console.error(e);\n }\n }\n });\n}", "function getUserFromRec2(req) {\n const user = {\n estado_: req.body.estado_\n };\n return user;\n}", "function parseToken(req, res, next) {\r\n\tconst token = getToken(req.headers);\r\n\tlet resp = {};\r\n\ttry {\r\n\t\tlet decoded = jwt.verify(token, SECRET_KEY);\r\n\t\treq.userid = decoded.userid;\r\n\t\tnext();\r\n\t} catch (err) {\r\n\t\tresp.code = 500;\r\n\t\tresp.message = err;\r\n\t\tres.status(500).send(resp)\r\n\t}\r\n\t\r\n}", "function userDetails(req, res, next){\n twitter.get('users/show', {screen_name: username}, function(error, data, response){\n twitterDetails['id'] = data.id;\n twitterDetails['name'] = data.name;\n twitterDetails['friends_count'] = data.friends_count;\n twitterDetails['profile_background_image_url'] = data.profile_background_image_url;\n twitterDetails['profile_image_url'] = data.profile_image_url;\n next();\n });\n}", "function globalViewData(req, res, next) {\n res.ViewData = res.ViewData || {};\n res.ViewData.username = \"\"; \n if (req.session.user) {\n res.ViewData.username = req.session.user.username;\n }\n next();\n }", "function create(req, res, next) {\n console.log(req.currentUser)\n console.log(req.body)\n req.body.user = req.currentUser //attaching a user key to the body, making it values currentUser from secureRoute\n Legend\n .create(req.body)\n .then(legend => res.status(201).json(legend))\n .catch(next)\n}", "async getUser(ctx) {\n\n try {\n const _id = ctx.request.params.id;\n const userData = await User.findById(_id);\n console.log(userData);\n if (!userData) {\n return ctx.body;\n }\n else {\n ctx.body = { userData };\n }\n }\n catch (error) {\n ctx.throw(error);\n }\n }", "function getUser(req, res, next) {\n User.findOne({_id: req.params.id}, function (err, user) {\n if (err) {\n return res.status(400).send(err);\n } else if (user == null) {\n return res.status(404).send({});\n } else {\n return res.status(200).send(user);\n }\n });\n}", "user({user_id}, _, {loaders: {Users}, user}) {\n if (user && (user.hasRole('ADMIN') || user_id === user.id)) {\n return Users.getByID.load(user_id);\n }\n }", "function addUsertoUser(saveTheUser) {\n $.ajax({\n method: \"PUT\",\n url: \"/api/user_data\",\n data: saveTheUser\n }).then(getUserAndSavedUsers())\n}" ]
[ "0.7231059", "0.71140105", "0.69190633", "0.69069964", "0.6899686", "0.6899686", "0.6899686", "0.6892056", "0.6833907", "0.68269306", "0.6702646", "0.66035783", "0.65964496", "0.6462951", "0.6237058", "0.62016886", "0.6200355", "0.6180543", "0.6146391", "0.6130654", "0.6112877", "0.6010211", "0.5971812", "0.59604216", "0.5956959", "0.5946114", "0.5919398", "0.5871396", "0.586269", "0.58398587", "0.580322", "0.5746744", "0.57458085", "0.5734359", "0.57155746", "0.5693083", "0.5690935", "0.5689384", "0.56710374", "0.56618583", "0.56076336", "0.55966884", "0.5577792", "0.5572258", "0.5555928", "0.5552413", "0.55501395", "0.55386406", "0.5533008", "0.5529157", "0.5524746", "0.5522309", "0.55182934", "0.55173475", "0.5486544", "0.54590833", "0.5454659", "0.5426325", "0.54227954", "0.54206395", "0.5388782", "0.53881574", "0.5383285", "0.53782725", "0.5374263", "0.53701895", "0.53553534", "0.53491026", "0.53488666", "0.5348203", "0.5344581", "0.5338074", "0.53297186", "0.5324993", "0.5322679", "0.5304132", "0.5297157", "0.52951276", "0.5292794", "0.52913797", "0.52892375", "0.52884585", "0.5286323", "0.52858114", "0.5285532", "0.5284173", "0.5281064", "0.5280448", "0.52782893", "0.527006", "0.52653486", "0.5264981", "0.5258246", "0.5257966", "0.52569026", "0.5247478", "0.5242375", "0.52312577", "0.5230486", "0.5228978" ]
0.68401
8
check for duplicate items in the shopping list
function checkDuplicate() { var found = false; for (var i = 0; i < $scope.list.length; i++) { if ($scope.list[i].item == $scope.item) { found = true; } } return found; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isDuplicate(item) {\n\t\tvar list = $(\"#items li .label\");\n\n\t\tfor (var i = 0; i < list.length; i++) {\n\t\t\tif ($(list[i]).text() == item) {\n\t\t\t\treturn true;\n\t\t\t}\n \t\t}\n\n \t\t// by default return false\n \t\treturn false;\n\t}", "AddItem(item) {\n //Check for the duplication\n this.state.favorites.forEach(element => {\n if (element.webTitle == item.webTitle) return;\n else console.log(\"Element #\" + element.webTitle);\n });\n\n this.setState({\n favorites: this.state.favorites.concat(item)\n });\n }", "addToCart() {\n const addedItemsId = this.props.cart.addedItems.map(item => item.id);\n const check = addedItemsId.includes(this.props.item.id);\n if (!check) {\n const item = {\n id: this.props.item.id,\n name: this.props.item.ename,\n price: this.props.item.price,\n ingredient: this.props.item.dish_ingradint,\n photo: this.props.item.dishImage_thump,\n availability: this.props.item.active,\n restaurantName: this.props.restaurantItem.restaurantName,\n restaurantId: this.props.restaurantItem.id,\n quantity: 1,\n deliveryCost: this.props.restaurantItem.deliveryCost\n };\n this.props.addItemToCart(item);\n }\n if (check) {\n Alert.alert('', 'this item is already added to cart');\n }\n }", "function isOnList(duplicate){\n for (currentIngredient in $scope.listOfIngredients) {\n if ($scope.listOfIngredients[currentIngredient] === duplicate){\n return true;\n }\n }\n return false;\n }", "checkItem(product) {\n let item = document.querySelectorAll(\".item-name\");\n\n for (let i = 0; i < item.length; i++) {\n if (item[i].innerText == product.product_name) {\n alert(\"This item is already added to the cart\");\n return;\n }\n }\n this.addToCart(product);\n }", "function sameItemId()\n {\n items.each(function() {\n var id = $(this).data(\"id\").toString();\n var name = $(this).data(\"name\").toString();\n\n var sameItemId = container.find(\"[data-id='\" + id + \"']\");\n\n if(sameItemId.length > 1) {\n console.error(\"There are items with the same id: \" + name + \" (\" + id + \")\");\n console.log(sameItemId);\n }\n });\n }", "checkForDuplicates() {\n const alreadyChecked = [];\n for(let list of [this.state.listA, this.state.listB]) {\n for(let row of list) {\n row.isDuplicate = false;\n const duplicate = alreadyChecked.find(otherRow => otherRow.snomed.code === row.snomed.code);\n if (!row.snomed.code || duplicate) {\n row.isDuplicate = true;\n if (duplicate) duplicate.isDuplicate = true;\n } \n alreadyChecked.push(row);\n }\n }\n }", "function addNewItem() {\n //Adds a new item to the array then updates the list\n let newItem = document.getElementById(\"new-item-input\").value;\n let exitFuncton = false;\n //Stops adding more than one of the same item, not sure if there's a simplar method but it works!\n shoppingList.forEach((item) => {\n if (item.ingredients === newItem) {\n exitFuncton = true;\n return;\n }\n });\n if (exitFuncton) {\n return;\n }\n let newListObject = { ingredients: newItem, acquired: false };\n shoppingList.push(newListObject);\n addListItem(newListObject);\n}", "function sameItemName()\n {\n items.each(function() {\n var name = $(this).data(\"name\").toString();\n\n var sameItemId = container.find(\"[data-name='\" + name + \"']\");\n\n if(sameItemId.length > 1) {\n console.error(\"There are items with the same name: \" + name);\n console.log(sameItemId);\n }\n });\n }", "function productIsAlreadyInCart() {\n return productsFromCart.filter((x) => x.id == id).length;\n }", "function duplicateItem() {\n const arrayOne = ['a', 'b', 'c'];\n const arrayTwo = ['x', 'u', 'c'];\n var isDuplicate = false;\n for (let arrayOneIndex = 0; arrayOneIndex < arrayOne.length; arrayOneIndex++) {\n for (let arrayTwoIndex = 0; arrayTwoIndex < arrayTwo.length; arrayTwoIndex++) {\n if (arrayOne[arrayOneIndex] === arrayTwo[arrayTwoIndex]) {\n isDuplicate = true;\n\n }\n\n }\n\n }\n if (isDuplicate) {\n console.log(\"Found item\");\n\n } else {\n console.log(\"There is no duplicated item.\");\n\n }\n\n}", "function findDuplicate() {\n\n var modelsArray = [$scope.data.first, $scope.data.second, $scope.data.third, $scope.data.fourth];\n var filteringModelsArray = _.uniq(modelsArray);\n\n return filteringModelsArray.length === modelsArray.length;\n }", "function isOnChosenIdList(duplicate){\n for (chosenIngredientPos in $scope.chosenIngredientsId) {\n if ($scope.chosenIngredientsId[chosenIngredientPos] === duplicate){\n return true;\n }\n }\n return false;\n }", "function masterItemExist(Item) {\n //localStorage\n for (var i = 0; i < items.length; i++) {\n if (items[i].itemName.toLowerCase() == Item.itemName.toLowerCase()) {\n return true;\n }\n }\n ;\n return false;\n }", "checkDupe() {\n let occurrences = this.props.occurrences;\n let habit = this.state.currentHabit;\n let time = JSON.parse(JSON.stringify(this.state.habitTime));\n let quantity = this.state.quantity;\n let found = false;\n\n occurrences.forEach(item => {\n if (item.timestamp.slice(0, 10) === time.slice(0, 10)) {\n found = true;\n }\n });\n\n if (found) {\n alert('Please make any updates to existing logs by updating your table');\n } else {\n this.props.logHabit(habit, time, quantity);\n }\n }", "function productAlreadyInCart(productName){\n var cartProducts = JSON.parse(localStorage.getItem('cart'));\n if(!cartProducts){\n // console.log('Empty Cart');\n return;\n }\n\n var status = false;\n\n cartProducts.forEach(function(el){\n // console.log(productName, el['name']);\n if(productName == el['name']){\n status = true;\n }\n else{\n \n }\n })\n \n return status\n}", "addItem(userItem) {\n for(var i=0; i<this._userItemList.length; i++){\n // if not check the list for a new userItem and add it to the userItemList\n if(this.userItemList[i]._item._itemCode === userItem._item._itemCode){\n console.log('ERROR: Duplicate Save');\n } else {\n var newUserItem = new UserItem(\n userItem._item,\n userItem._category,\n userItem._rating,\n userItem._madeIt\n );\n // Add item to the userItems\n this._userItemList.push(newUserItem);\n console.log('UPDATE: Item Added')\n }\n return this._userItemList;\n }\n\n }", "handleAddToCard (e, products) {\n this.setState(state => {\n const cartItems = state.cartItems;\n let productAlreadyInCart = false;\n cartItems.forEach(item => {\n console.log('dentro de forEach')\n if (item._id === products._id) {\n productAlreadyInCart = true;\n item.count++;\n }\n });\n if (!productAlreadyInCart) {\n console.log('dentro de cartItem push')\n cartItems.push({...products, count: 0});\n }\n localStorage.setItem(\"cartItems\", JSON.stringify(cartItems));\n console.log(this.state.cartItems, \"cart item\")\n return cartItems;\n })\n }", "function numberOfItemTypes(numbOfUniqueItems){\n //takes in the shopping cart as input\n //returns the number of unique item types in the shopping cart\n var ItemsThatAreUnique = [];\n for (let i = 0; i < numbOfUniqueItems.items.length; i++) {//took a while to find .items.length inorder to make this one work\n if (ItemsThatAreUnique.includes(numbOfUniqueItems.items[i].title)){\n //only need to check for one thing that each item has inorder to count them as unique\n continue;\n }\n ItemsThatAreUnique.push(numbOfUniqueItems.items[i].title);// put findings into empty array\n }\n return ItemsThatAreUnique.length;//returns all unique items in the object\n}", "function exo03_addToBasket(){\n \n var itemAjout3 = document.getElementById(\"exo03_item\").value;\n \n var testItem = isAlreadyIn(basket3,itemAjout3);\n\n if( testItem === false){\n \n basket3.push(itemAjout3);\n compteItems.push(1);\n \n majVue3();\n \n }else{\n \n for(var i = 0 ; i < basket3.length ; i++){\n if(itemAjout3 === basket3[i]){\n compteItems[i] = compteItems[i] + 1;\n showJustTheLine(i);\n }\n }\n }\n}", "function availableItem(items) {\n for (let index = 0; index < items.length; index++) {\n for (let j = 0; j < uniqueItem.length; j++) {\n if (itemsArray[items[index]] === uniqueItem[j]) {\n // console.log(itemsArray[items[index]] === uniqueItem[j]);\n itemsArray[items[index]] === uniqueItem[j]\n return true;\n }\n }\n }\n // console.log(items)\n return false;\n}", "function hasDuplicate(arr) {\n for (let itemToCheck of arr) {\n let count = 0;\n for (let item of arr) {\n if (itemToCheck == item) {\n count++;\n }\n }\n if (count > 1) {\n return true;\n }\n }\n return false;\n}", "function shoppingList(){\n let listItems = [];\n let list = document.getElementById('list-items');\n let listHTML, item = '';\n\n for(let i = 0; i < mealPlan.length; i++){\n for(let j = 0; j < mealPlan[i].ing.length; j++){\n item = mealPlan[i].ing[j].substring(mealPlan[i].ing[j].indexOf('-')+2, mealPlan[i].ing[j].length);\n if(item.length != 0){\n let check = 0;\n for(let k = 0; k <= listItems.length; k++){\n //Remove duplicates and water from shopping list\n if (item === listItems[k] || item === 'Water'){\n check += 1;\n }\n }\n if (check === 0){\n listItems.push(item);\n }\n }\n }\n }\n \n listHTML = \n '<ul>';\n\n for(let i = 0; i < listItems.length; i++){\n listHTML += \n '<li>'+listItems[i]+'</li>';\n }\n \n listHTML += \n '</ul>'; \n \n list.innerHTML = listHTML;\n}", "function checkDuplicatedNames() {\n\n for(var i = 0; i < productTable.length; i++)\n {\n if(productName.value == productTable[i].name) \n {\n productName.classList.add(\"is-invalid\");\n productName.classList.remove(\"is-valid\");\n\n PNameAlert.classList.add(\"d-block\");\n PNameAlert.classList.remove(\"d-none\");\n\n PNameAlert.innerHTML = \"Product Name Already Exists\";\n\n addBtn.disabled = true;\n } \n }\n}", "isIngredientUnique() {\n let ingredients = this.state.ingredients;\n\n for (\n let ingredientIndex = 0;\n ingredientIndex < ingredients.length;\n ingredientIndex++\n ) {\n // get ingredient's name\n let ingredientName = Object.keys(ingredients[ingredientIndex])[0];\n\n // split quantity and unit\n let unitWithQuantity =\n ingredients[ingredientIndex][ingredientName].split(\" \");\n\n // if ingredient's name and unit are already present, do not add such ingredient\n if (\n ingredientName === this.state.ingredientName &&\n unitWithQuantity[1] === this.state.ingredientUnit\n )\n return false;\n }\n return true;\n }", "handleAddCart(e, product){\n this.setState(state => {\n const cartItems = state.cartItems;\n let productAlreadyInCart = false;\n cartItems.forEach(item => {\n if(item.id === product.id){\n productAlreadyInCart= true;\n item.count++;\n }\n });\n if(!productAlreadyInCart){\n cartItems.push({...product, count:1});\n }\n localStorage.setItem(\"cartItems\",JSON.stringify(cartItems));\n return cartItems;\n })\n }", "function isProductAlreadyInCart() {\n if (!Storage.has('products')) {\n return false;\n } \n let products = Storage.get('products');\n if (products.includes(getProductId())) { \n return true;\n }\n return false;\n}", "function getDuplicates (slug) {\n if (!slug) {\n return Promise.resolve(false);\n }\n\n return api.space.getEntries({\n 'query': slug\n }).then(res => {\n\n let items = res.items.filter(item => {\n\n // If its not the current page, if the current region matches and if the item has a navigationName field\n if(item.sys.id != api.entry.getSys().id && (item.fields.region && currentRegion.getValue() == item.fields.region['sv-SE']) && (item.fields.navigationName && item.fields.navigationName['sv-SE'] == slug)){\n return item;\n }\n })\n\n return { hasDuplicates: items.length > 0, dupliactes: items };\n });\n }", "function checkForDuplicates()\r\n\t{\r\n\tfor (i=0; i < activeClippings.length; i++)\r\n\t\t{\r\n\t\tif (newClipping == activeClippings[i].id) {i = allClippings.length; duplicate = true;}\r\n\t\t}\r\n\t}", "function validateUnique(threeArray){\n for(var i = 0; i < threeArray.length; i ++){\n for(var v = 0; v < lastItemsSeen.length; v++){\n if(threeArray[i].product === lastItemsSeen[v].product){\n \n return false;\n \n }\n }\n return true;\n }\n}", "function chkDuplicate(objList,strchkName)\r\n\t{\r\n\t\tvar i;\r\n\t\tvar blnDuplicate=false;\r\n\t\tfor(var i=0;i < objList.length;i++)\r\n\t\t{\r\n\t\t\tif (objList.options[i].text == strchkName)\r\n\t\t\t\tblnDuplicate = true;\r\n\t\t}\r\n\t\treturn blnDuplicate;\r\n\t}", "function checkDuplicatePicklistValues(arr) {\n\tvar len=arr.length;\n\tfor (var i=0; i<len; i++) {\n\t\tfor (var j=i+1; j<len; j++) {\n\t\t\tif (trim(arr[i]).toLowerCase() == trim(arr[j]).toLowerCase()) {\n\t\t\t\talert(alert_arr.LBL_DUPLICATE_FOUND+'\\''+trim(arr[i])+'\\'');\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}", "function isDuplicate(name,phone,twitter){\n\tvar isduplicate=false; \n\t\tfor(var i=0;i<addresslist.length; i++){ \n\t\t\tif(addresslist[i].name.toLowerCase()==name.toLowerCase() \n\t\t\t\t&& addresslist[i].phone.toLowerCase()==phone.toLowerCase()\n\t\t\t\t&& addresslist[i].twitter.toLowerCase()==twitter.toLowerCase()){ \n\t\t\t\tisduplicate=true; \n\t\t\t} \n\t\t} \n\treturn isduplicate; \n}", "function checkIfDuplicateExists(w) {\n return new Set(w).size !== w.length;\n}", "function check_duplicate(students, student) {\r\n\r\n for (let i = 0; i < students.length; i++) {\r\n if (Store.check_equal(student, students[i])) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n\r\n}", "function isProductAlreadyIn(bayProductID) {\n var productsIn = $('#shopping-card-window ul').children('li'),\n count = 1;\n for (var i = 0; i < productsIn.length; i+=1) {\n if ($(productsIn[i]).hasClass(bayProductID)) {\n count = Number($(productsIn[i]).children('.count').text()) + 1;\n //take the number from the span tag and increased with 1\n return count;\n }\n }\n return count;\n }", "function exist( product ){\n $scope.lstProducts.forEach(function(element) {\n if( element.id == product.id ){\n return true;\n }\n }, this);\n return false;\n }", "function addItem(buttonID) {\n\tvar quant = 1;\n\tvar exists = false;\n\tvar name = itemList[buttonID][0];\n\tvar price = itemList[buttonID][1];\n\tif (shopList.length !== 0) {\n\t\tfor (i = 0; i < shopList.length; i ++) {\n\t\t\tif (shopList[i][0] === name) {\n\t\t\t\tshopList[i][2] += quant;\n\t\t\t\texists = true;\n\t\t\t}\n\t\t}\n\t}\n\tconsole.log(shopList);\n\t\n\tif (!exists) {\n\t\tvar newItem = [name, price, quant];\n\t\tshopList.push(newItem);\n\t}\n\tnumItems++;\n\tupdateItemInfo(numItems, name, price);\n\tshopList.sort();\n}", "has(item) {\n if (this.isEmpty()) {\n return false\n } else {\n for (var i = 0; i < this.items.length; i++) {\n if (this.items[i] === item) {\n return true\n }\n }\n return false\n }\n }", "function IsalreadyExist(book)\n {\n for(var i=0;i<allBooks.length;i++)\n {\n if(allBooks[i].btitle==book.btitle&&allBooks[i].author==book.author)\n {\n alert(\"Book already exit\");\n allBooks[i].quantity=Number(allBooks[i].quantity)+Number(book.quantity);\n return 0;\n }\n }\n return 1;\n\n }", "function checkForDuplicates(board) {\n console.log('checkForDuplicates invoked');\n\n colorsAlreadySeen = [];\n\n for (let i = 0; i < board.length; i++) {\n let color = board[i].color;\n let cardType = board[i].type;\n\n // If there ARE two ships of the same color, trigger the modal\n if (cardType === 'ship' && colorsAlreadySeen.indexOf(color) !== -1) {\n isDeckDisabled = true;\n playerMoves = 0;\n displayBoards();\n showModal('two ships');\n\n // If there ARE NOT two ships of the same color, add the color to the list\n } else if (cardType == 'ship') {\n colorsAlreadySeen.push(color);\n }\n }\n return;\n}", "function matchItems() {\n var count = 0;\n // doing first deserialization to the local object\n var list = localStorage.getItem('POST_TITLES');\n var localList = $.parseJSON(list);\n\n if (list && localList.length == freshList.length) {\n freshList.forEach(function (freshItem) {\n localList.forEach(function (localItem) {\n if (freshItem == localItem) {\n count++;\n }\n });\n });\n //inform users for the new post(s)\n if (count != freshList.length) {\n var result = freshList.length - count;\n updateIcon(result);\n }\n }\n else {\n localStorage.setItem('POST_TITLES', JSON.stringify(freshItem));\n updateIcon(10);\n }\n}", "function checkDuplicates2(args) {\n return new Set(args).size !== args.length\n}", "function hasDuplicates(data) {\n var values = data.map(function(i) {return i.value});\n return new Set(values).size != values.length;\n}", "function isDuplicateEntry(wslId) {\r\n\t//alert(\"wslField = \" + wslField);\r\n\tvar wslIdList = getMainView().forms[0].elements[wslField];\r\n\t//alert(\"wslIdList = \" + wslIdList);\r\n\tvar duplicate = false;\r\n\t//alert(\"!wslIdList = \" + (!wslIdList));\r\n\tif(!wslIdList) return false;\r\n\t\r\n\t//alert(\"wslIdList.length = \" + wslIdList.length);\r\n\tif(wslIdList.length) {\r\n\t\t// there are more than one entry\r\n\t\tfor(var z=0; z<wslIdList.length; z++) {\r\n\t\t\t//alert(\"wslIdList[z].value = \" + wslIdList[z].value.toLowerCase() + \", wslId = \" + wslId.toLowerCase() + \", compare = \" + (wslIdList[z].value.toLowerCase() == wslId.toLowerCase()));\r\n\t\t\tif(wslIdList[z].value.toLowerCase() == wslId.toLowerCase()) {\r\n\t\t\t\tduplicate = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\t//alert(\"wslIdList.value = \" + wslIdList.value.toLowerCase() + \", wslId = \" + wslId.toLowerCase() + \", compare = \" + (wslIdList.value.toLowerCase() == wslId.toLowerCase()));\r\n\t\tif(wslIdList.value.toLowerCase() == wslId.toLowerCase())\r\n\t\t\tduplicate = true;\r\n\t}\r\n\t\r\n\treturn duplicate;\r\n}", "function checkDuplicate(list, guess) {\n for (let i = 0; i < list.length; i++) {\n if (list[i] === guess) {\n return true;\n }\n }\n }", "function isItemExisted(arrayData,item){\n let res = false;\n for(let i = 0; i < arrayData.length;i++){\n if(arrayData[i].item_id == item.item_id){\n res = true;\n }\n }\n return res;\n}", "function hasItem (item){\n\t\treturn true;\n}", "function appendListOfTrackedItems(itemType, itemId) {\n $log.info(\"in appendListOfTrackedItems\");\n var itemList = [];\n var existingItemList = getListOfTrackedItems();\n var item = \"usage_\" + itemType + \"_\" + itemId;\n\n if (existingItemList !== null) {\n itemList = existingItemList;\n //check if already in the list\n for (var i = 0; i < itemList.length; i++) {\n $log.info(\"comparing \" + existingItemList[i] + \" with \" + item);\n if (existingItemList[i] == item) {\n $log.info(\"exist already in list of tracked items\");\n return true;\n }\n }\n }\n $log.info(\"item not in tracked list, adding it now\");\n itemList.push(item);\n DataCollectorService.storeLocal(\"usage_item_list\", itemList);\n return true;\n }", "async isItemInTheCart(item) {\n const count = await this.name.count;\n let found = false;\n for(var i = 0; i < count; i++) {\n const title = await this.name.nth(i).innerText;\n if (title.match(item)) {\n found = true; //if the title of the item name is the same as the passed item, then it was found.\n }\n\n }\n return found\n }", "addToCart(newItem) {\n let itemExisted = false\n let updatedCart = this.state.cart.map(item => {\n if (newItem === item.sku) {\n itemExisted = true\n return { sku: item.sku, quantity: ++item.quantity }\n } else {\n return item\n }\n })\n if (!itemExisted) {\n updatedCart = [...updatedCart, { sku: newItem, quantity: 1 }]\n }\n this.setState({ cart: updatedCart })\n // Store the cart in the localStorage.\n // localStorage.setItem('stripe_checkout_items', JSON.stringify(updatedCart))\n }", "function checkCartItemsOnBuy(cartItemsID) {\n const { keyPair } = items;\n for (const cartKey in cartItemsID) {\n if (\n !keyPair[cartKey] ||\n keyPair[cartKey] - cartItemsID[cartKey].quantity < 0\n ) {\n swal({\n title: \"Eksik ürün\",\n text: `${cartItemsID[cartKey].name} ürünü tükenmiş olabilir.`,\n icon: \"warning\",\n button: \"Tamam\",\n });\n return false;\n } else {\n cartItemsID[cartKey].leftItems =\n keyPair[cartKey] - cartItemsID[cartKey].quantity;\n }\n }\n\n return true;\n }", "function addToCart() {\n var itemID = $(this).attr(\"id\");\n var alreadyInCart = false;\n for (var i = 0; i < cartItems.length; i++) {\n if (itemID == cartItems[i][0]) {\n alreadyInCart = true;\n cartItems[i][3] += 1;\n }\n }\n if (alreadyInCart == false) {\n for (var i = 0; i < shopItems.length; i++) {\n if (itemID == shopItems[i][0]) {\n var applianceID = shopItems[i][0];\n var applianceName = shopItems[i][1];\n var appliancePrice = shopItems[i][2];\n var applianceQuantity = 1;\n itemID = [\n applianceID,\n applianceName,\n appliancePrice,\n applianceQuantity,\n ];\n }\n }\n cartItems.push(itemID);\n }\n\n updateCartDetails();\n}", "addItem(name) {\n if ( !(this.items.all.includes(name))) {\n console.log(\"Adding new item, \" + name)\n this.items.all.push(name)\n }\n }", "checkIfShipHasAlreadyBeenInserted(shipsArray , ship ){\n\n let numberOfException = 0;\n let maxException = 2;\n let isThere = 0;\n\n for (var i = 0; i < shipsArray.length; i++)\n {\n if(shipsArray[i] == ship)\n {\n if(shipsArray[i] == SHIP_EXCEPTION)\n {\n numberOfException++;\n\n }\n isThere++;\n }\n\n }\n\n if(numberOfException == 1){\n return false;\n }\n else if(numberOfException > maxException){\n return true;\n }\n else if(isThere > 0)\n {\n return true;\n }\n else\n {\n return false;\n }\n\n }", "function isUniform(listOfItems) {\n for (element = 1; element <= listOfItems.length - 1; element++) {\n if (listOfItems[0] !== listOfItems[element]) {\n return false;\n }\n }\n return true;\n}", "function checkItemExists(x) {\n let cartArr = cartLs.flat(2);\n let result;\n console.log(cartArr);\n if (cartLs.length < 1 || cartLs == undefined) {\n return \"empty\";\n } else {\n for (let i = 0; i < cartArr.length; i++) {\n if (cartArr[i].prod == x) {\n result = true;\n break;\n } else {\n result = false;\n }\n }\n console.log(result);\n return result;\n }\n}", "function compareItems() {\n for (var i = 0; i < items.length; i++) {\n for (var j = 0; j < productHold.length; j++) {\n if (items[i].id == productHold[j]) {\n $(pageItems[i]).find('h5 em').text(items[i].price);\n };\n };\n };\n }", "function checkDuplicate2() {\r\n let arr = [\"abc\",\"xy\",\"bb\", \"abc\"];\r\n let result = false;\r\n // create a Set with array elements\r\n const s = new Set(arr);\r\n // compare the size of array and Set\r\n if(arr.length !== s.size){\r\n result = true;\r\n }\r\n if(result) {\r\n console.log('Array contains duplicate elements');\r\n } else {\r\n console.log('Array does not contain duplicate elements');\r\n }\r\n }", "function checkDuplicate() {\r\n let arr = [\"abc\",\"xy\",\"bb\", \"axz\", \"abc\"];\r\n // empty object\r\n let map = {};\r\n let result = false;\r\n for(let i = 0; i < arr.length; i++) {\r\n // check if object contains entry with this element as key\r\n if(map[arr[i]]) {\r\n result = true;\r\n // terminate the loop\r\n break;\r\n }\r\n // add entry in object with the element as key\r\n map[arr[i]] = true;\r\n }\r\n if(result) {\r\n console.log('Array contains duplicate elements');\r\n } else {\r\n console.log('Array does not contain duplicate elements');\r\n }\r\n }", "function checkIfNew() {\n if (lastDisplaySet.includes(randomProduct)) {\n console.log(randomProduct.elementId + ' was displayed in the previous set.');\n } else if (currentDisplaySet.includes(randomProduct)) {\n console.log(randomProduct.elementId + ' is already in the current set.');\n } else {\n console.log(randomProduct.elementId + ' has not been displayed yet.');\n }\n}", "function checkDupe(data,x){\n\n if(idArray.includes(data[x][0])){\n return false;\n } else { return true; }\n\n}", "addSong(selectedSong){\r\n let newItem = this.userBand + \" - \" + selectedSong;\r\n //prevents adding of duplicate songs\r\n this.userSetlist.indexOf(newItem) === -1 ? this.userSetlist.push(newItem) : console.log(\"This song is already in the list\");\r\n }", "function checkduplicate(text)\n{\n\tvar i = 0;\n\tvar len = groupStore.length;\n\twhile (i < len)\n\t{\n\t\tvar str = groupStore[i]._title;\n\t\tif(text.toLowerCase()==str.toLowerCase())\n\t\t{\n\t\t\tdocument.getElementById('errorgroup').innerHTML=\"This category name already exists.\";\n\t\t\treturn true;\n\t\t}\n\t\ti++;\n\t}\n\treturn false;\n}", "function addProductToStorage(product){\r\n if(cartItems.length !== 0){\r\n\r\n console.log(cartItems);\r\n console.log(product);\r\n let found = cartItems.some(item => item.id === product.id);\r\n\r\n console.log(found);\r\n\r\n if(!found){\r\n cartItems.push(product);\r\n }else{\r\n cartItems.forEach(function(item){\r\n if(item.id === product.id){\r\n item.quantity += product.quantity;\r\n item.price += product.price;\r\n }\r\n \r\n });\r\n }\r\n \r\n }else{\r\n cartItems.push(product);\r\n }\r\n \r\n}", "addToCart (productt) {\n checkRepeated(productt) \n added()\n console.log(productt)\n }", "function checkForDuplicate(city) {\n for (var i = 0; i < $scope.cities.length; i++) {\n if ($scope.cities[i].Id == city.id) {\n return false;\n\n }\n }\n return true;\n }", "function checkDuplicates(playerId) {\n for (var i = 0; i < myTeam.length; i++) {\n var element = myTeam[i];\n if (playerId == element.id) {\n return true\n }\n\n }\n return false\n }", "function isUniqueBy(array) {\n var itemSelector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : id;\n var prevItem;\n var currItem;\n\n for (var i = 0; i < array.length; i++) {\n if (i === 0) {\n prevItem = itemSelector(array[i]);\n continue;\n }\n\n currItem = itemSelector(array[i]);\n\n if (prevItem !== currItem) {\n return false;\n }\n\n prevItem = currItem;\n }\n\n return true;\n}", "function checkForDuplicates (data, newActiveUser) {\n let tempList = data[0].active\n if (data[0].active.indexOf(newActiveUser) === -1) {\n tempList.push(newActiveUser)\n return tempList\n } else {\n return data[0].active\n }\n}", "function areThereDuplicates2() {\n let collection = {}\n for(let val in arguments){\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1\n }\n for(let key in collection){\n if(collection[key] > 1) return true\n }\n return false;\n }", "test(item) {\n const list = this._list\n let i = this._len\n\n if (list[i] === item) {\n list.pop()\n return true\n }\n\n while (i !== 0) {\n i--\n if (item === list[i]) {\n list.splice(i, 1)\n return true\n }\n }\n\n list.push(item)\n this._len++\n return false\n }", "function preCheckForDuplicateAddresses() {\n // Flush out deduper before we start\n newDeduper.clearAll();\n var arr = newDataset.getDataset();\n var amountToProcess = arr.length;\n for (let i = 0; i < arr.length; i++) {\n if (newDeduper.addressExists(arr[i][0])) {\n var amount = new web3.utils.BN(newDeduper.getItemAmount(arr[i][0]));\n var amount_to_add = web3.utils.toBN(arr[i][1]);\n var new_amount = amount.add(amount_to_add);\n newDeduper.addItem(arr[i][0], new_amount.toString());\n } else {\n newDeduper.addItem(arr[i][0], arr[i][1]);\n }\n }\n newDataset.overrideData(newDeduper.dumpAsList());\n console.log(\"Total items reduced from \" + amountToProcess + \" to \" + newDataset.getDataset().length);\n document.getElementById(\"pre_check_output_for_duplicate_addresses\").innerHTML = JSON.stringify(newDataset.getDataset(), 2, 2);\n}", "function removeDuplicate(items){\n let newItems = items.filter((element,index) => items.indexOf(element) === index); \n \n return newItems;\n}", "function duplicateChecker(input) {\r\n let duplicateSwitch = false;\r\n if (ul.children.length > 0) {\r\n for (let i = 0; i < ul.children.length; i++) {\r\n if (input.value === ul.children[i].children[0].textContent) {\r\n duplicateSwitch = true;\r\n break;\r\n };\r\n }\r\n }\r\n return duplicateSwitch;\r\n }", "function addCart() {\n\n let sameItems = stylishStorage.cart.list.filter( el => \n el.id === details_product_id.textContent &&\n el.color.code === currentColor && \n el.size === currentSize); \n\n if (sameItems.length > 0){\n stylishStorage.cart.list.forEach( item => {\n if ( item.id === details_product_id.textContent &&\n item.color.code === currentColor &&\n item.size === currentSize ){\n item.qty = quantity_count_value.textContent;\n }\n })\n \n }else{\n newItem ={\n id: details_product_id.textContent,\n name: details_product_name.textContent,\n main_image: main_img,\n price: product_price,\n color: {\n name: currentColorName,\n code: currentColor\n },\n size: currentSize,\n qty: quantity_count_value.textContent,\n stock: stock_qty\n }\n\n stylishStorage.cart.list.push(newItem);\n }\n\n localStorage.setItem('cart', JSON.stringify(stylishStorage.cart));\n}", "addTrack(track) {\n let tracks = this.state.playlistTracks;\n // Don't let users add a song more than once.\n if (!tracks.includes(track)) {\n tracks.push(track);\n this.setState({playlistTracks: tracks});\n } else {\n console.log('Duplicate. Track not added.');\n }\n }", "function duplicateCheck(x) {\n\t\tfor(var i=0; i<attempts.length ; i++) {\n\t\t\tif(x===attempts[i]) {\n\t\t\t\tattempts.pop();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "function checkDups(oneN){\n return oneN.id == root[i].id;\n }", "function storeWishItem(a, b, c, d = true) {\n //a = name, b = cost, c = img, d = availability\n item = {\n name: a,\n cost: b,\n img: c,\n availability: d,\n };\n\n for (let a = 0; a < wishArr.length; a++) {\n if (wishArr[a].name == item.name) {\n alert(\"Item already in wishlist\");\n return false;\n }\n }\n wishArr.push(item);\n localStorage.setItem(\"WishlistItem\", JSON.stringify(wishArr));\n}", "function isDuplicate(tab){\n\t\t\t// check to see if the list is empty\n\t\t\tif($scope.chordList.length === 0){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// check if the tabs are the same\n\t\t\tfor(let i = 0; i < $scope.chordList.length; i++){\n\t\t\t\tif($scope.chordList[i].tab === tab){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "function findProdDuplicado(idProdNvo) {\n lDuplicado=false;\n $(\".prodForAjuste\").each(\n function(index, value) {\n let idProd=parseFloat($(this).val());\n //console.log(idProd, idProdNvo);\n if(idProd==idProdNvo){\n //console.log(\"son iguales\")\n lDuplicado=true;\n }\t\n }\n );\n return lDuplicado\t\n }", "checkDuplicate(chat) {\n for (let i = 0; i < this.state.userChatRooms.length; i++) {\n if (this.state.userChatRooms[i].recipientID === chat.recipientID) {\n return true;\n }\n }\n return false;\n }", "static async _checkProductsAvailInStock(cart) {\n let invalid = '';\n const tempCart = (typeof cart !== 'object' ? cart.toObject() : cart);\n\n await ItemProductController._addProductsForSingleOrder(tempCart);\n _.each(tempCart.items, (item) => {\n // invalid sku\n if (!item.product) {\n invalid = item.sku;\n return false;\n }\n\n // if item is a product\n if (item.product.sku === item.sku) {\n if (item.count > item.product.stock_qty) {\n invalid = item.sku;\n return false;\n }\n\n return;\n }\n\n // if item is a product variation\n _.each(item.product.variations, (variation) => {\n if (variation.sku === item.sku) {\n if (item.count > variation.stock_qty) {\n invalid = item.sku;\n }\n\n return false;\n }\n });\n\n if (invalid !== '') {\n return false;\n }\n });\n\n return invalid;\n }", "function duplicateValueInContactList(value, keyName){\n\t\tvar hasDuplicate = 0;\n\t\tfor(var i=0;i<$scope.contactList.length;i++){\n\t\t\tif(!hasDuplicate && $scope.contactList[i][keyName]===value && editIndex!==i){\n\t\t\t\thasDuplicate = 1;\n\t\t\t}\n\t\t}\n\t\treturn hasDuplicate;\n\t}", "function checkList(data) {\n\t\tfor (var i = 0, len = that.data.lists.length; i < len; i++) {\n\t\t\tvar list = that.data.lists[i];\n\t\t\t// when add a list that has the same taskName as an old list\n\t\t\tif (data.taskName === list.taskName && data.id !== list.id) {\n\t\t\t\t// return index\n return i;\n }\n }\n // no duplicate, then return -1 indicating such\n return -1;\n\t}", "function isUniform(items) {\n for (let i = 1; i < items.length; i++){\n if (items[0] !== items[i]){\n return false;\n }\n }\n return true;\n}", "function checkForDuplicates() {\n console.log(\"checkForDuplicates()\");\n\n var sku = $('form[name=\"newProductForm\"] input[name=\"sku\"]').val();\n var url = \"/perl/jadrn025/check_for_duplicates.cgi?sku=\" + sku;\n $.get(url, checkForDuplicatesHandler);\n\n displayBusywait();\n}", "function updateListItem(itemName)\r\n{\t\r\n\t//make sure that we have up to date list\r\n\tloadListItems();\r\n\r\n\t//Now search for ListItem with same name and append count if found\r\n\tvar result = $.grep(allItems, function(e){ return e.name == itemName; });\r\n\t\r\n\tif( result.length > 0) {\r\n\t\tresult[0].count++;\r\n\t} else {\r\n\t\t//If not found then add new ListItem\r\n\t\tvar listItem = new ListItem(itemName, 1);\r\n\t\tallItems.push(listItem);\r\n\t}\r\n\tstoreListItems();\r\n}", "function checkItemInCart() {\n\t\tlet itemCount = c.cart.item_count;\n\t\tconst items = c.cart.items;\n\n\t\tif (itemCount > 0) {\n\t\t\titems.forEach((item) => {\n\t\t\t\tif (item.handle === c.product.handle) {\n\t\t\t\t\titemCount -= 1;\n\t\t\t\t\t// eslint-disable-next-line\n\t\t\t\t\tif (item.properties._giveaway) {\n\t\t\t\t\t\tc.inCart = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tobserveCart();\n\t}", "function areThereDuplicates(...args) {\n if (args.length <= 1) return false;\n\n const counter = {};\n\n for (let item of args) {\n counter[item] = (counter[item] || 0) + 1;\n if (counter[item] > 1) return true;\n }\n\n return false;\n}", "function isListHasItem(list, item) {\n if (list.length === 0 || list.indexOf(item) === -1) {\n return false;\n }\n return true;\n }", "function item_already_exists(my_object) \n{\n RMPApplication.debug (\"begin function item_already_exists\");\n c_debug(debug.exists, \"=> item_already_exists: my_object = \", my_object);\n var my_pattern = {};\n for (key in my_object) {\n my_pattern[key] = ( my_object[key] !== \"\" ) ? my_object[key] : \"\";\n }\n var options = {};\n options.asynchronous = false;\n res = false;\n eval(collectionid).listCallback(my_pattern, options, exists_ok, exists_ko);\n RMPApplication.debug (\"end function item_already_exists\");\n return res;\n}", "function compareInventory(shoppingList, storeInfo, storeInventory, purchaseCallback) {\n for (var i = 0; i < shoppingList.length; i++) {\n var listItem = shoppingList[i];\n for (var j = 0; j < storeInventory.length; j++) {\n var storeItem = storeInventory[j];\n if (isMatch(listItem, storeItem) && !shownModal) {\n // Define message.\n var title = 'I\\'ve found ' + listItem.text;\n var message = '\\'' + storeItem.product.description + '\\' is available at ' + storeInfo.name + '<br/><br/> Price: CHF ' + storeItem.price; \n\n var currentListItem = listItem;\n var currentStoreItem = storeItem;\n\n // Show purchase dialog.\n myApp.modal({\n title: title,\n text: message,\n open: function(){alert(\"opened\");},\n close: function(){alert(\"closed\");},\n buttons: [\n {\n text: 'Purchase',\n onClick: function() {\n // Initiate purchase for matched item.\n purchaseCallback(currentListItem, currentStoreItem);\n }\n },\n {\n text: 'Maybe later'\n },\n ]\n });\n // HACK only show one modal at a time\n shownModal = true;\n // HACK: Abort check after first item found to avoid late-binding references in callback.\n return;\n\n// // Skip to next item after first match found.\n// break;\n }\n }\n };\n}", "function duplicateElement() {\n const arrayOne = ['a', 'b', 'c'];\n const arrayTwo = ['x', 'y', 'z'];\n var hashMap = {};\n var isDuplicate = false;\n for (let arrayOneIndex = 0; arrayOneIndex < arrayOne.length; arrayOneIndex++) {\n // Check key in hashMap\n if (!(arrayOne[arrayOneIndex] in hashMap)) {\n hashMap[arrayOne[arrayOneIndex]] = true;\n\n }\n\n // if (!hashMap[arrayOneIndex]) {\n // hashMap[arrayOne[arrayOneIndex]] = true;\n //\n // }\n\n }\n for (let arrayTwoIndex = 0; arrayTwoIndex < arrayTwo.length; arrayTwoIndex++) {\n // Check key in hashMap\n if (arrayTwo[arrayTwoIndex] in hashMap) {\n isDuplicate = true;\n\n }\n // if (hashMap[arrayTwo[arrayTwoIndex]]){\n // isDuplicate = true;\n //\n // }\n\n }\n if (isDuplicate) {\n console.log(\"Found item\");\n\n } else {\n console.log(\"There is no duplicated item.\");\n\n }\n\n}", "function removeFromCart(item) {\n var countup = 0;\n var itemFails = 0;\n while (countup < cart.length) {\n if(cart[countup].itemName === item) {\n cart.splice(countup, countup);\n countup++;\n } else {\n itemFails++;\n countup++;\n }\n }\n if(itemFails === cart.length){\n console.log(cart);\n return 'That item is not in your cart.';\n } else {\n console.log(cart);\n return cart;\n }\n}", "function ingredientExists(item) {\n\n var index = ingredients.filter((obj) => {\n console.log(obj.name);\n console.log(item);\n return obj.name === item;\n })\n\n console.log(index.length);\n if (index.length > 0) {\n return true;\n } else {\n return false;\n }\n }", "contains(item) {\n return false;\n }", "function checkUpdateDuplicateEntry(newVal, oldVal, dataList) {\n try {\n var isChcek = false;\n\n if (newVal.name.toLowerCase() === oldVal.name.toLowerCase())\n return isChcek;\n\n var obj = Enumerable.From(dataList).FirstOrDefault(null, function (x) {\n return x.name.toLowerCase() === newVal.name.toLowerCase();\n });\n\n if (obj) {\n isChcek = true;\n }\n return isChcek;\n } catch (e) {\n throw e;\n }\n }", "function duplicate(new_value, list) {\n var current_value;\n\n for (current_value in list) {\n if (list[current_value] === new_value) return true;\n }\n return false;\n }" ]
[ "0.68524545", "0.679574", "0.6718979", "0.6714496", "0.6689077", "0.656581", "0.65471476", "0.6494957", "0.6484088", "0.6410508", "0.6408286", "0.63824755", "0.6342123", "0.63280046", "0.6294062", "0.626103", "0.6240735", "0.62084395", "0.6207544", "0.620739", "0.6203393", "0.6199671", "0.6199539", "0.6197679", "0.6166724", "0.6157092", "0.61491907", "0.6143032", "0.6141489", "0.60731536", "0.60681814", "0.60494125", "0.60384154", "0.6016125", "0.6015467", "0.599238", "0.59871376", "0.59859747", "0.59494406", "0.5948808", "0.59218913", "0.5915175", "0.5913915", "0.5912193", "0.5911719", "0.59115916", "0.59071285", "0.5906674", "0.5902941", "0.58855575", "0.5858263", "0.5849876", "0.58448744", "0.58442724", "0.5825507", "0.58137345", "0.58088994", "0.5805107", "0.5801562", "0.57975", "0.57901615", "0.5789573", "0.5778637", "0.5778574", "0.57772374", "0.5774744", "0.57680064", "0.57613784", "0.575789", "0.5754017", "0.5753135", "0.5750539", "0.5746332", "0.5745656", "0.5731607", "0.57212305", "0.5718374", "0.5718016", "0.57052344", "0.57040167", "0.57033616", "0.57016706", "0.5690418", "0.56849766", "0.5670139", "0.56671274", "0.56619585", "0.56576526", "0.565039", "0.564994", "0.56413364", "0.5636755", "0.5635186", "0.5634831", "0.5632338", "0.5631579", "0.56300133", "0.56296873", "0.5623828", "0.56234795" ]
0.7261372
0
Helper function for checking intersection between two rectangles
function intersect(pos1, size1, pos2, size2) { return (pos1.x < pos2.x + size2.w && pos1.x + size1.w > pos2.x && pos1.y < pos2.y + size2.h && pos1.y + size1.h > pos2.y); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function intersectRects(rect1,rect2){var res={left:Math.max(rect1.left,rect2.left),right:Math.min(rect1.right,rect2.right),top:Math.max(rect1.top,rect2.top),bottom:Math.min(rect1.bottom,rect2.bottom)};if(res.left<res.right&&res.top<res.bottom){return res;}return false;}", "function intersection(rect1, rect2) {\n return (\n within(rect1.x, rect1.x + rect1.width, rect2.x, rect2.x + rect2.width) &&\n within(rect1.y, rect1.y + rect1.height, rect2.y, rect2.y + rect2.height);\n );\n}", "function rectIntersection(x1, y1, w1, h1, x2, y2, w2, h2) {\n if (x1 <= x2 + w2 && x1 + w1 >= x2 && y1 <= y2 + h2 && y1 + h1 >= y2) {\n return true;\n }\n return false;\n}", "function intersect(rect1, rect2) {\n rect1left = rect1.x + 3;\n rect1top = rect1.y + 5;\n rect1right = rect1.x + rect1.width - 3;\n rect1bottom = rect1.y + rect1.height - 5;\n\n rect2left = rect2.x + 3;\n rect2top = rect2.y + 5;\n rect2right = rect2.x + rect2.width - 3;\n rect2bottom = rect2.y + rect2.height - 5;\n\n return !(\n rect1left > rect2right ||\n rect1right < rect2left ||\n rect1top > rect2bottom ||\n rect1bottom < rect2top\n );\n }", "function intersect(rectangle1, rectangle2) {\n let x1 = Math.max(rectangle1.x, rectangle2.x);\n let y1 = Math.max(rectangle1.y, rectangle2.y);\n let x2 = Math.min(rectangle1.x + rectangle1.width, rectangle2.x + rectangle2.width);\n let y2 = Math.min(rectangle1.y + rectangle1.height, rectangle2.y + rectangle2.height);\n if (x2 >= x1 && y2 >= y1)\n return { x: x1, y: y1, width: x2 - x1, height: y2 - y1 };\n else\n return { x: 0, y: 0, width: 0, height: 0 };\n}", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom)\n };\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n return false;\n}", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom)\n };\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n return false;\n}", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom)\n };\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n return false;\n}", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom)\n };\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n return false;\n}", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom)\n };\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n return false;\n}", "intersects(otherRectangle: _Rectangle): boolean {\n return !(\n this.right < otherRectangle.left ||\n this.bottom < otherRectangle.top ||\n this.left > otherRectangle.right ||\n this.top > otherRectangle.bottom\n )\n }", "function rectIntersects(rect1, rect2) {\r\n return (rect1[TOP_LEFT][X] <= rect2[BOTTOM_RIGHT][X] &&\r\n rect2[TOP_LEFT][X] <= rect1[BOTTOM_RIGHT][X] &&\r\n rect1[TOP_LEFT][Y] <= rect2[BOTTOM_RIGHT][Y] &&\r\n rect2[TOP_LEFT][Y] <= rect1[BOTTOM_RIGHT][Y]);\r\n}", "function intersectRect(r1, r2) {\n\treturn !(\n\t\tr2.left > r1.right ||\n\t\tr2.right < r1.left ||\n\t\tr2.top > r1.bottom ||\n\t\tr2.bottom < r1.top\n\t);\n}", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom)\n };\n\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n\n return false;\n }", "function intersectRects(rect1, rect2) {\n\tvar res = {\n\t\tleft: Math.max(rect1.left, rect2.left),\n\t\tright: Math.min(rect1.right, rect2.right),\n\t\ttop: Math.max(rect1.top, rect2.top),\n\t\tbottom: Math.min(rect1.bottom, rect2.bottom)\n\t};\n\n\tif (res.left < res.right && res.top < res.bottom) {\n\t\treturn res;\n\t}\n\treturn false;\n}", "function intersectRects(rect1, rect2) {\n\tvar res = {\n\t\tleft: Math.max(rect1.left, rect2.left),\n\t\tright: Math.min(rect1.right, rect2.right),\n\t\ttop: Math.max(rect1.top, rect2.top),\n\t\tbottom: Math.min(rect1.bottom, rect2.bottom)\n\t};\n\n\tif (res.left < res.right && res.top < res.bottom) {\n\t\treturn res;\n\t}\n\treturn false;\n}", "function intersectRects(rect1, rect2) {\n\tvar res = {\n\t\tleft: Math.max(rect1.left, rect2.left),\n\t\tright: Math.min(rect1.right, rect2.right),\n\t\ttop: Math.max(rect1.top, rect2.top),\n\t\tbottom: Math.min(rect1.bottom, rect2.bottom)\n\t};\n\n\tif (res.left < res.right && res.top < res.bottom) {\n\t\treturn res;\n\t}\n\treturn false;\n}", "function intersectRects(rect1, rect2) {\n\tvar res = {\n\t\tleft: Math.max(rect1.left, rect2.left),\n\t\tright: Math.min(rect1.right, rect2.right),\n\t\ttop: Math.max(rect1.top, rect2.top),\n\t\tbottom: Math.min(rect1.bottom, rect2.bottom)\n\t};\n\n\tif (res.left < res.right && res.top < res.bottom) {\n\t\treturn res;\n\t}\n\treturn false;\n}", "function intersectRects(rect1, rect2) {\n\tvar res = {\n\t\tleft: Math.max(rect1.left, rect2.left),\n\t\tright: Math.min(rect1.right, rect2.right),\n\t\ttop: Math.max(rect1.top, rect2.top),\n\t\tbottom: Math.min(rect1.bottom, rect2.bottom)\n\t};\n\n\tif (res.left < res.right && res.top < res.bottom) {\n\t\treturn res;\n\t}\n\treturn false;\n}", "function intersectRects(rect1, rect2) {\n\tvar res = {\n\t\tleft: Math.max(rect1.left, rect2.left),\n\t\tright: Math.min(rect1.right, rect2.right),\n\t\ttop: Math.max(rect1.top, rect2.top),\n\t\tbottom: Math.min(rect1.bottom, rect2.bottom)\n\t};\n\n\tif (res.left < res.right && res.top < res.bottom) {\n\t\treturn res;\n\t}\n\treturn false;\n}", "function intersectRects(rect1, rect2) {\n\tvar res = {\n\t\tleft: Math.max(rect1.left, rect2.left),\n\t\tright: Math.min(rect1.right, rect2.right),\n\t\ttop: Math.max(rect1.top, rect2.top),\n\t\tbottom: Math.min(rect1.bottom, rect2.bottom)\n\t};\n\n\tif (res.left < res.right && res.top < res.bottom) {\n\t\treturn res;\n\t}\n\treturn false;\n}", "function intersectRects(rect1, rect2) {\n\tvar res = {\n\t\tleft: Math.max(rect1.left, rect2.left),\n\t\tright: Math.min(rect1.right, rect2.right),\n\t\ttop: Math.max(rect1.top, rect2.top),\n\t\tbottom: Math.min(rect1.bottom, rect2.bottom)\n\t};\n\n\tif (res.left < res.right && res.top < res.bottom) {\n\t\treturn res;\n\t}\n\treturn false;\n}", "function intersects(x1, y1, w1, h1, x2, y2, w2, h2)\n{\nif(y2 + h2 < y1 ||\nx2 + w2 < x1 ||\nx2 > x1 + w1 ||\ny2 > y1 + h1)\n{\nreturn false;\n}\nreturn true;\n}", "intersection(_rect) {\n return new HRect(\n Math.max(this.left, _rect.left), Math.max(this.top, _rect.top),\n Math.min(this.right, _rect.right), Math.min(this.bottom, _rect.bottom)\n );\n }", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom)\n };\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n return false;\n }", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom)\n };\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n return false;\n }", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom)\n };\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n return false;\n }", "function checkIntersection(r1, r2) {\n console.log(`checking instersetions`);\n let intersects = !(\n r2.left > r1.right ||\n r2.right < r1.left ||\n r2.top > r1.bottom ||\n r2.bottom < r1.top\n );\n if (!intersects) {\n console.log(intersects);\n return false;\n }\n\n let leftX = Math.max(r1.x, r2.x);\n let rightX = Math.min(r1.x + r1.w, r2.x + r2.w);\n let topY = Math.max(r1.y, r2.y);\n let bottomY = Math.min(r1.y + r1.h, r2.y + r2.h);\n\n if (leftX < rightX && topY < bottomY) {\n rect4 = new Block(leftX, topY, rightX - leftX, bottomY - topY, true);\n let a1 = r1.area;\n let a2 = r2.area;\n let a3 = rect4.area;\n if (a1 == a2) return true;\n return !(a3 >= a2 || a3 >= a1);\n } else {\n intersects = false;\n return intersects;\n // Rectangles do not overlap, or overlap has an area of zero (edge/corner overlap)\n }\n console.log(intersects);\n return intersects;\n}", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom),\n };\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n return false;\n }", "function intersectRects(rect1, rect2) {\n var res = {\n left: Math.max(rect1.left, rect2.left),\n right: Math.min(rect1.right, rect2.right),\n top: Math.max(rect1.top, rect2.top),\n bottom: Math.min(rect1.bottom, rect2.bottom)\n };\n\n if (res.left < res.right && res.top < res.bottom) {\n return res;\n }\n return false;\n }", "function intersect$1(a, b) {\n return !(\n a.x2 - 1 < b.x1 ||\n a.x1 + 1 > b.x2 ||\n a.y2 - 1 < b.y1 ||\n a.y1 + 1 > b.y2\n );\n }", "function intersect(a, b) {\n return !(\n a.x2 - 1 < b.x1 ||\n a.x1 + 1 > b.x2 ||\n a.y2 - 1 < b.y1 ||\n a.y1 + 1 > b.y2\n );\n}", "function intersect(a, b) {\n return !(\n a.x2 - 1 < b.x1 ||\n a.x1 + 1 > b.x2 ||\n a.y2 - 1 < b.y1 ||\n a.y1 + 1 > b.y2\n );\n}", "function intersectRects(rect1, rect2) {\n\t\tvar res = {\n\t\t\tleft: Math.max(rect1.left, rect2.left),\n\t\t\tright: Math.min(rect1.right, rect2.right),\n\t\t\ttop: Math.max(rect1.top, rect2.top),\n\t\t\tbottom: Math.min(rect1.bottom, rect2.bottom)\n\t\t};\n\n\t\tif (res.left < res.right && res.top < res.bottom) {\n\t\t\treturn res;\n\t\t}\n\t\treturn false;\n\t}", "function has_intersection(x1, x2, y1, y2, bound){\n\t \n\t//top edge\n\tvar tx = (bound.min_y - y1) * (x2-x1)/(y2-x2) + x1;\n\tif((tx >= x1 && tx <= x2 || tx <= x1 && tx >= x2) && tx >= bound.min_x && tx <= bound.max_x){\n\t\treturn true;\n\t}\n\t\n\t//bottom edge\n\tvar bx = (bound.max_y - y1) * (x2-x1)/(y2-x2) + x1;\n\tif((bx >= x1 && bx <= x2 || bx <= x1 && bx >= x2) && bx >= bound.min_x && bx <= bound.max_x){\n\t\treturn true;\n\t}\n\t//left edge\n\tvar ly = (bound.min_x - x1) * (y2-x2) / (x2 - x1) + x1;\n\tif((ly >= y1 && ly <= y2 || ly <= y1 && ly >= y2) && ly >= bound.min_y && ly <= bound.max_y){\n\t\treturn true;\n\t}\n\t//right edge\n\tvar ry = (bound.max_x - x1) * (y2-x2) / (x2 - x1) + x1;\n\tif((ry >= y1 && ry <= y2 || ry <= y1 && ry >= y2) && ry >= bound.min_y && ry <= bound.max_y){\n\t\treturn true;\n\t}\n\treturn false;\n}", "function doesIntersect(p0, b0, p1, b1) {\r\n\t\tif(p0.x + b0.width - 1 < p1.x) return false;\r\n\t\tif(p0.y + b0.height - 1 < p1.y) return false;\r\n\t\t\r\n\t\tif(p1.x + b1.width - 1 < p0.x) return false;\r\n\t\tif(p1.y + b1.height - 1 < p0.y) return false;\r\n\t\t\r\n\t\treturn true;\r\n\t}", "function constructIntersection(rectangle1, rectangle2) {\n let x1 = Math.max(rectangle1.x, rectangle2.x);\n let y1 = Math.max(rectangle1.y, rectangle2.y);\n let x2 = Math.min(rectangle1.x + rectangle1.width, rectangle2.x + rectangle2.width);\n let y2 = Math.min(rectangle1.y + rectangle1.height, rectangle2.y + rectangle2.height);\n if (x2 >= x1 && y2 >= y1)\n return { x: x1, y: y1, width: x2 - x1, height: y2 - y1 };\n else\n return { x: 0, y: 0, width: 0, height: 0 };\n}", "function rectIntersection(rectA, rectB) {\n\t\t// condition:\n\t\tif (rectA.left <= rectB.right && rectA.right >= rectB.left &&\n\t\t\trectA.top <= rectB.bottom && rectA.bottom >= rectB.top ) {\n\n\t\t\treturn rectIntArea(rectA, rectB);\n\t\t}\n\t\treturn 0;\n\t}", "function intersect (r1, r2) {\n return r1.left < r2.right\n && r1.right > r2.left\n && r1.top < r2.bottom\n && r1.bottom > r2.top;\n }", "intersects_rect(rect) {\n console.log(\"hitbox\",hb_rect(this,0));\n console.log(\"rectpos\",rect[0]);\n if ((hb_rect(rect,0) >= hb_rect(this,0) && hb_rect(rect,0) <= hb_rect(this,2))\n || (hb_rect(rect,2) >= hb_rect(this,0) && hb_rect(rect,2) <= hb_rect(this,2))) {\n if ((hb_rect(rect,1) >= hb_rect(this,1) && hb_rect(rect,1) <= hb_rect(this,3))\n || (hb_rect(rect,3)-1 >= hb_rect(this,1) && hb_rect(rect,3)-1 <= hb_rect(this,3))) {\n console.log(\"hit\");\n return true;\n }\n else {console.log(\"xhit\")}\n }\n else {console.log(\"nohit\")}\n return false;\n }", "function xIntersection(e1, e2, o)\r\n{\r\n var ix1, iy2, iw, ih, intersect = true;\r\n var e1x1 = xPageX(e1);\r\n var e1x2 = e1x1 + xWidth(e1);\r\n var e1y1 = xPageY(e1);\r\n var e1y2 = e1y1 + xHeight(e1);\r\n var e2x1 = xPageX(e2);\r\n var e2x2 = e2x1 + xWidth(e2);\r\n var e2y1 = xPageY(e2);\r\n var e2y2 = e2y1 + xHeight(e2);\r\n // horizontal\r\n if (e1x1 <= e2x1) {\r\n ix1 = e2x1;\r\n if (e1x2 < e2x1) intersect = false;\r\n else iw = Math.min(e1x2, e2x2) - e2x1;\r\n }\r\n else {\r\n ix1 = e1x1;\r\n if (e2x2 < e1x1) intersect = false;\r\n else iw = Math.min(e1x2, e2x2) - e1x1;\r\n }\r\n // vertical\r\n if (e1y2 >= e2y2) {\r\n iy2 = e2y2;\r\n if (e1y1 > e2y2) intersect = false;\r\n else ih = e2y2 - Math.max(e1y1, e2y1);\r\n }\r\n else {\r\n iy2 = e1y2;\r\n if (e2y1 > e1y2) intersect = false;\r\n else ih = e1y2 - Math.max(e1y1, e2y1);\r\n }\r\n // intersected rectangle\r\n if (intersect && typeof(o)=='object') {\r\n o.x = ix1;\r\n o.y = iy2 - ih;\r\n o.w = iw;\r\n o.h = ih;\r\n }\r\n return intersect;\r\n}", "function rectangleCollision(rect1,rect2) {\n // Rects defined as [x,y,width,height]\n var r1 = {\n x1: rect1[0],\n y1: rect1[1],\n w: rect1[2],\n h: rect1[3],\n x2: rect1[0] + rect1[2],\n y2: rect1[1] + rect1[3]\n };\n var r2 = {\n x1: rect2[0],\n y1: rect2[1],\n w: rect2[2],\n h: rect2[3],\n x2: rect2[0] + rect2[2],\n y2: rect2[1] + rect2[3]\n };\n\n // Inside degrees assumind r2 bigger\n /*\n 0 - Full left/top\n 1 - part left/top\n 2 - inside\n 3- part right\n 4- full right/down\n */\n var horizontalIn = 0;\n var verticalIn = 0;\n\n if (r1.x2 < r2.x1) {\n horizontalIn = 0\n }else if ((r1.x2 > r2.x1) && (r1.x1 < r2.x1)) {\n horizontalIn = 1;\n }else if ((r1.x2 < r2.x2) && (r1.x1 > r2.x1)) {\n horizontalIn = 2;\n }else if ((r1.x2 > r2.x2) && (r1.x1 < r2.x2)) {\n horizontalIn = 3;\n }else if (r1.x1 > r2.x2) {\n horizontalIn = 4;\n }\n\n if (r1.y2 < r2.y1) {\n verticalIn = 0\n }else if ((r1.y2 > r2.y1) && (r1.y1 < r2.y1)) {\n verticalIn = 1;\n }else if ((r1.y2 < r2.y2) && (r1.y1 > r2.y1)) {\n verticalIn = 2;\n }else if ((r1.y2 > r2.y2) && (r1.y1 < r2.y2)) {\n verticalIn = 3;\n }else if (r1.y1 > r2.y2) {\n verticalIn = 4;\n }\n\n // If neither then not in\n if (horizontalIn == 0 || verticalIn == 0 || horizontalIn == 4 || verticalIn == 4) {\n return 0;\n }\n // Fully in\n else if(horizontalIn == 2 && verticalIn==2){\n return -1;\n }\n // Priority to horizontalIn\n else if(horizontalIn == 1){\n return 1;\n }\n else if (horizontalIn == 3) {\n return 2;\n }\n // horizontalIn as 2 for full in\n else {\n if (verticalIn == 1) {\n return 3;\n }else if (verticalIn == 3) {\n return 4;\n }\n\n }\n}", "function hitTestRectangle(r1, r2) {\n\n //Define the variables we'll need to calculate\n var hit, combinedHalfWidths, combinedHalfHeights, vx, vy;\n //hit will determine whether there's a collision\n hit = false;\n\n //Find the center points of each sprite\n r1.centerX = r1.x + r1.width / 2;\n r1.centerY = r1.y + r1.height / 2;\n r2.centerX = r2.x + r2.width / 2;\n r2.centerY = r2.y + r2.height / 2;\n\n //Find the half-widths and half-heights of each sprite\n r1.halfWidth = r1.width / 2;\n r1.halfHeight = r1.height / 2;\n r2.halfWidth = r2.width / 2;\n r2.halfHeight = r2.height / 2;\n\n //Calculate the distance vector between the sprites\n vx = r1.centerX - r2.centerX;\n vy = r1.centerY - r2.centerY;\n\n //Figure out the combined half-widths and half-heights\n combinedHalfWidths = r1.halfWidth + r2.halfWidth;\n combinedHalfHeights = r1.halfHeight + r2.halfHeight;\n\n //Check for a collision on the x axis\n if (Math.abs(vx) < combinedHalfWidths) {\n //A collision might be occuring. Check for a collision on the y axis\n if (Math.abs(vy) < combinedHalfHeights) {\n //There's definitely a collision happening\n hit = true;\n } else {\n //There's no collision on the y axis\n hit = false;\n }\n } else {\n //There's no collision on the x axis\n hit = false;\n }\n //`hit` will be either `true` or `false`\n return hit;\n}", "function hitTestRectangle(r1, r2) {\n\n //Define the variables we'll need to calculate\n let hit, combinedHalfWidths, combinedHalfHeights, vx, vy;\n\n //hit will determine whether there's a collision\n hit = false;\n\n //Find the center points of each sprite\n r1.centerX = r1.x + r1.width / 8;\n r1.centerY = r1.y + r1.height / 8;\n r2.centerX = r2.x + r2.width / 8;\n r2.centerY = r2.y + r2.height / 8;\n\n //Find the half-widths and half-heights of each sprite\n r1.halfWidth = r1.width / 8;\n r1.halfHeight = r1.height / 8;\n r2.halfWidth = r2.width / 8;\n r2.halfHeight = r2.height / 8;\n\n //Calculate the distance vector between the sprites\n vx = r1.centerX - r2.centerX;\n vy = r1.centerY - r2.centerY;\n\n //Figure out the combined half-widths and half-heights\n combinedHalfWidths = r1.halfWidth + r2.halfWidth;\n combinedHalfHeights = r1.halfHeight + r2.halfHeight;\n\n //Check for a collision on the x axis\n if (Math.abs(vx) < combinedHalfWidths) {\n\n //A collision might be occuring. Check for a collision on the y axis\n if (Math.abs(vy) < combinedHalfHeights) {\n\n //There's definitely a collision happening\n hit = true;\n } else {\n\n //There's no collision on the y axis\n hit = false;\n }\n } else {\n\n //There's no collision on the x axis\n hit = false;\n }\n\n //`hit` will be either `true` or `false`\n return hit;\n}", "function hitTestRectangle(r1, r2) { \n //Define the variables we'll need to calculate\n let hit, combinedHalfWidths, combinedHalfHeights, vx, vy; \n //hit will determine whether there's a collision\n hit = false; \n //Find the center points of each sprite\n r1.centerX = r1.x + r1.width / 2;\n r1.centerY = r1.y + r1.height / 2;\n r2.centerX = r2.x + r2.width / 2;\n r2.centerY = r2.y + r2.height / 2; \n //Find the half-widths and half-heights of each sprite\n r1.halfWidth = r1.width / 2;\n r1.halfHeight = r1.height / 2;\n r2.halfWidth = r2.width / 2;\n r2.halfHeight = r2.height / 2; \n //Calculate the distance vector between the sprites\n vx = r1.centerX - r2.centerX;\n vy = r1.centerY - r2.centerY; \n //Figure out the combined half-widths and half-heights\n combinedHalfWidths = r1.halfWidth + r2.halfWidth;\n combinedHalfHeights = r1.halfHeight + r2.halfHeight; \n //Check for a collision on the x axis\n if (Math.abs(vx) < combinedHalfWidths) { \n //A collision might be occurring. Check for a collision on the y axis\n if (Math.abs(vy) < combinedHalfHeights) { \n //There's definitely a collision happening\n hit = true;\n } else {\n \n //There's no collision on the y axis\n hit = false;\n }\n } else {\n \n //There's no collision on the x axis\n hit = false;\n }\n \n //`hit` will be either `true` or `false`\n return hit;\n}", "function collision(rect1, rect2) {\n if (rect1.x < rect2.x + rect2.width &&\n rect1.x + rect1.width > rect2.x &&\n rect1.y < rect2.y + rect2.height &&\n rect1.y + rect1.height > rect2.y) {\n return true;\n }\n}", "function isIntersecting (hitbox1, hitbox2) {\n return (\n // top of hitbox1\n hitbox1.y < hitbox2.y + hitbox2.height &&\n // right of hitbox1\n hitbox1.x + hitbox1.width > hitbox2.x &&\n // bottom of hitbox1\n hitbox1.y + hitbox1.height > hitbox2.y &&\n // left of hitbox1\n hitbox1.x < hitbox2.x + hitbox2.width\n );\n}", "function rectCollision(aX, aY, aW, aH, bX, bY, bW, bH) {\n\t// rect A collides with rect B if any of the corner\n\t// points of A is within B\n\t// OR lets not forget (lol) if B is within A !\n\n\treturn _oneOfPointsWithinRect(aX, aY, aW, aH, bX, bY, bW, bH) ||\n\t\t\t\t_oneOfPointsWithinRect(bX, bY, bW, bH, aX, aY, aW, aH);\n}", "function objectsOverlap(obj1, obj2){\n let obj1_b = obj1['boundingBox'];\n let obj2_b = obj2['boundingBox'];\n\n if(!obj1_b || !obj2_b)//one of the two objs has no bounding box\n return 0;\n\n //first consider the case in which the overlap is not possible, so the result is 0\n if(obj1_b['br']['x'] < obj2_b['bl']['x'] || obj1_b['bl']['x'] > obj2_b['br']['x'])//considering x\n // when the gFaceRect finished before the start of azure one (or the opposite)\n return 0;\n\n else if(obj1_b['bl']['y'] < obj2_b['tl']['y'] || obj1_b['tl']['y'] > obj2_b['bl']['y'])//considering y\n // when the gFaceRect finished before the start of azure one (or the opposite)\n return 0;\n\n else{ //there is an overlap\n\n // remind that\n // - x goes from 0 -> N (left -> right)\n // - y goes from 0 -> N (top -> bottom)\n let xc1 = Math.max(obj1_b['bl']['x'], obj2_b['bl']['x']);\n let xc2 = Math.min(obj1_b['br']['x'], obj2_b['br']['x']);\n let yc1 = Math.max(obj1_b['bl']['y'], obj2_b['bl']['y']);\n let yc2 = Math.min(obj1_b['tl']['y'], obj2_b['tl']['y']);\n let xg1 = obj1_b['bl']['x'];\n let xg2 = obj1_b['br']['x'];\n let yg1 = obj1_b['bl']['y'];\n let yg2 = obj1_b['tl']['y'];\n\n let areaO = (xc2-xc1) * (yc2 - yc1); //area covered by the overlapping\n let areaI = (xg2-xg1) * (yg2 - yg1); //area covered by the first bounding box\n\n return areaO/areaI;\n }\n}", "function testCollision(A,B )//compare 2 rectangles/boxes if they intersecting\n{\n //The contradictory logic because it is simpler.\n return !(A.bottom< B.top ||\n A.top >B.bottom||\n A.left > B.right||\n A.right<B.left);\n}", "boxesIntersect(x, y, w, h){\n\n\t\t// loop through existing boxes\n\t\tfor(let i = 0; i < this.polygons.length; i ++){\n\n\t\t\t// if the box intersects the existing i-th box...\n\t\t\tif(x < this.polygons[i][1][0] && x + w > this.polygons[i][0][0] && y < this.polygons[i][3][1] && y + h > this.polygons[i][0][1]){\n\n\t\t\t\t// return true\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\t// if we reach the end of the loop, return false\n\t\treturn false;\n\t}", "function hitTestRectangle(r1, r2) {\n\n //Define the variables we'll need to calculate\n var hit, combinedHalfWidths, combinedHalfHeights, vx, vy, globalZero;\n\n //hit will determine whether there's a collision\n hit = false;\n\n //Find the center points of each sprite\n globalZero = new PIXI.Point(0, 0);\n r1.centerX = r1.toGlobal(globalZero).x;\n r1.centerY = r1.toGlobal(globalZero).y;\n r2.centerX = r2.toGlobal(globalZero).x;\n r2.centerY = r2.toGlobal(globalZero).y;\n\n // Find the half-widths and half-heights of each sprite\n // note: modiified the width and height by a descale factor found in globals.js\n r1.halfWidth = r1.width*HITBOX_SIZE_FACTOR / 2;\n r1.halfHeight = r1.height*HITBOX_SIZE_FACTOR / 2;\n r2.halfWidth = r2.width*HITBOX_SIZE_FACTOR / 2;\n r2.halfHeight = r2.height*HITBOX_SIZE_FACTOR / 2;\n\n //Calculate the distance vector between the sprites\n vx = r1.centerX - r2.centerX;\n vy = r1.centerY - r2.centerY;\n\n //Figure out the combined half-widths and half-heights\n combinedHalfWidths = r1.halfWidth + r2.halfWidth;\n combinedHalfHeights = r1.halfHeight + r2.halfHeight;\n\n //Check for a collision on the x axis\n if (Math.abs(vx) < combinedHalfWidths) {\n\n //A collision might be occuring. Check for a collision on the y axis\n if (Math.abs(vy) < combinedHalfHeights) {\n\n //There's definitely a collision happening\n hit = true;\n } else {\n\n //There's no collision on the y axis\n hit = false;\n }\n } else {\n\n //There's no collision on the x axis\n hit = false;\n }\n\n //`hit` will be either `true` or `false`\n return hit;\n}", "function collisionRect(x1,y1,w1,h1,x2,y2,w2,h2) {\n\treturn (x1 < x2 + w2) && (x1 + w1 > x2) && (y1 < y2 + h2) && (y1 + h1 > y2);\n}", "intersects_rect(rect) {\n var shield_t, shield_b;\n if (this.stance == 1) {\n shield_t = hb_rect(this,1) + 64;\n shield_b = hb_rect(this,3);\n }\n if (this.stance == 0) {\n shield_t = hb_rect(this,1);\n shield_b = hb_rect(this,3) - 64;\n }\n hb_rect(this,1)\n if ((hb_rect(rect,0) >= hb_rect(this,0) && hb_rect(rect,0) <= hb_rect(this,2))\n || (hb_rect(rect,2) >= hb_rect(this,0) && hb_rect(rect,2) <= hb_rect(this,2))) {\n if (this.dir != rect.dir) {\n if ((hb_rect(rect,1) >= shield_t && hb_rect(rect,1) <= shield_b)\n || (hb_rect(rect,3)-1 >= shield_t && hb_rect(rect,3)-1 <= shield_b)) {\n console.log(\"s-hit\");\n return 2;\n }\n }\n if ((hb_rect(rect,1) >= hb_rect(this,1) && hb_rect(rect,1) <= hb_rect(this,3))\n || (hb_rect(rect,3)-1 >= hb_rect(this,1) && hb_rect(rect,3)-1 <= hb_rect(this,3))) {\n console.log(\"hit\");\n return true;\n }\n else {console.log(\"xhit\")}\n }\n else {console.log(\"nohit\")}\n return false;\n }", "function isWithinBounds(rectArr, rect2) {\n var match = null;\n rectArr.forEach(rect1 => {\n var r1 = {\n top: rect1.position().y,\n bottom: rect1.position().y + rect1.height(),\n left: rect1.position().x,\n right: rect1.position().x + rect1.width()\n };\n var r2 = {\n top: rect2.position().y,\n bottom: rect2.position().y + rect2.height(),\n left: rect2.position().x,\n right: rect2.position().x + rect2.width()\n };\n\n if(!(r2.left > r1.right || \n r2.right < r1.left || \n r2.top > r1.bottom ||\n r2.bottom < r1.top)) {\n match = rect1;\n }\n });\n \n return match;\n}", "function checkCollision(rect1, rect2) {\n first = rect1.getBoundingClientRect();\n second = rect2.getBoundingClientRect();\n\n if (\n first.left < second.left + $(rect2).width() &&\n first.left + $(rect1).width() > second.left &&\n first.top < second.top + $(rect2).height() &&\n first.top + $(rect1).height() > second.top\n ) {\n return true;\n } else {\n return false;\n }\n}", "function intersect(e1, e2) {\n return (area(e1.u, e1.v, e2.u) > 0 && area(e1.u, e1.v, e2.v) < 0)\n || (area(e1.u, e1.v, e2.u) < 0 && area(e1.u, e1.v, e2.v) > 0);\n}", "function pointInRect(a, b, c) {\n\t return c[0] <= Math.max(a[0], b[0]) && c[0] >= Math.min(a[0], b[0]) && c[1] <= Math.max(a[1], b[1]) && c[1] >= Math.min(a[1], b[1]);\n\t}", "function collision(rect1, rect2) {\r\n // check if they are overlapping\r\n if (typeof rect1 != \"undefined\" && typeof rect2 != \"undefined\") {\r\n if (rect1.x <= rect2.x + rect2.width && rect1.x + rect1.width >= rect2.x &&\r\n rect1.y <= rect2.y + rect2.height && rect1.y + rect1.height > rect2.y) {\r\n // If they are colliding, return true\r\n return true;\r\n } else {\r\n // If they are not colliding, return false\r\n return false;\r\n }\r\n } else {\r\n return false;\r\n }\r\n\r\n}", "function subtract(rect1, rect2) {\n // Calculate a set of rects such that their union is rect1-rect2.\n let [x11, x12, y11, y12] = rect1\n let [x21, x22, y21, y22] = rect2\n\n let rects = []\n // Let's look at the options for x. There are six:\n // 1. x11<x12<x21<x22\n // 2. x11<x21<x12<x22\n // 3. x21<x11<x12<x22\n // 4. x11<x21<x22<x12\n // 5. x21<x11<x22<x12\n // 6. x21<x22<x11<x12\n // (where inequalities are sometimes strict and sometimes weak)\n\n // Options 1 and 6: no overlap at all\n // Strong inequality, because if they are equal then there's an overlap of 1.\n if (x12 < x21 || x22 < x11) {\n // Ditch immediately. There is no overlap between the two rects.\n return [rect1]\n }\n\n // Option 3: rect1 is completely inside rect2. Keep the rects as is.\n else if (x21 <= x11 && x12 <= x22) {\n }\n\n /* previously...\n // Option 4: rect2 is completely inside rect1. Split out the left and right parts of rect1 and set it to be just the middle.\n else if (x11 <= x21 && x22 <= x12) {\n rects.push([x11, x21-1, y11, y12])\n rects.push([x22+1, x12, y11, y12])\n x11 = x21\n x12 = x22\n }\n\n // Option 2: Right part of rect2 overlaps with the left part of rect1. Create\n // a rectangle that is just the right part of rect1\n else if (x11 < x21) {\n rects.push([x11, x21-1, y11, y12])\n x11 = x21\n }\n\n // Option 5: Same as 2 but with the directions reversed\n else if (x22 < x12) {\n rects.push([x22+1, x12, y11, y12])\n x12 = x22\n }*/\n\n // Handle options 2, 4, 5 simultaneously:\n else {\n if (x11 < x21) {\n rects.push([x11, x21-1, y11, y12])\n x11 = x21\n }\n if (x22 < x12) {\n rects.push([x22+1, x12, y11, y12])\n x12 = x22\n }\n }\n\n\n // OK, now copy that over for y.\n if (y12 < y21 || y22 < y11) {\n return [rect1]\n }\n else if (y21 <= y11 && y12 <= y22) {\n }\n else {\n if (y11 < y21) {\n rects.push([x11, x12, y11, y21-1])\n y11 = y21\n }\n if (y22 < y12) {\n rects.push([x11, x12, y22+1, y12])\n y12 = y22\n }\n }\n\n return rects\n \n /* Old version for posterity\n if (x21 <= x11) {\n // rect2 starts to the left of rect1. Split rect1 into two, and only deal\n // with the left-hand side from now on. Unless rect2 ends to the right of\n // rect1, then don't do that.\n if (x22 >= x12 || x22 < x11) {\n // Nothing\n } else {\n rects.push([x22+1, x12, y11, y12])\n x12 = x22\n }\n } else if (x21 < x22) {\n // rect2 starts in the middle of rect1. Same kind of split except in the\n // other direction, and no need to worry about that special case.\n rects.push([x11, x21-1, y11, y12])\n x11 = x21-1\n } else {\n // rect2's leftmost corner is to the right of all of rect1, so just return rect1.\n return [rect1]\n }\n if (y21 <= y11) {\n // rect2 starts to the left of rect1. Split rect1 into two, and only deal\n // with the left-hand side from now on. Unless rect2 ends to the right of\n // rect1, then don't do that.\n if (y22 >= y12 || x22 < x11) {\n // Nothing\n } else {\n rects.push([x11, x12, y22+1, y12])\n y12 = y22\n }\n } else if (y21 < y22) {\n // rect2 starts in the middle of rect1. Same kind of split except in the\n // other direction, and no need to worry about that special case.\n rects.push([x11, x12, y11, y21-1])\n y11 = y21-1\n } else {\n // rect2's leftmost corner is to the right of all of rect1, so just return rect1.\n return [rect1]\n }\n return [...rects, [x11, x12, y11, y12]]*/\n}", "function hitboxIntersectCheck (a, b) {\n\n //If error, ensure items have this.height / this.width.\n if (a.bottom() > b.top() && a.top() < b.bottom() && a.left() < b.right() && a.right() > b.left()) {\n\n return true;\n }\n\n return false;\n}", "function SPF_DoesRectanglesOverlap(point_l1, point_r1, point_l2, point_r2) {\n\n // If one rectangle is on left side of other\n if (point_l1.x > point_r2.x || point_l2.x > point_r1.x)\n return false;\n\n // If one rectangle is above other\n if (point_l1.y > point_r2.y || point_l2.y > point_r1.y)\n return false;\n\n return true;\n\n}", "function checkCollisionRectangle(x1, y1, width1, height1, x2, y2, width2, height2) {\n if (x1 > x2) {\n if (y1 > y2) {\n if (x1 - x2 < width2 && y1 - y2 < height2) {\n if (x1 - x2 > y1 - y2) { return 1; }\n return 2;\n }\n } else {\n if (x1 - x2 < width2 && y2 - y1 < height1) {\n if (x1 - x2 > y2 - y1) { return 1; }\n return 3;\n }\n }\n } else {\n if (y1 > y2) {\n if (x2 - x1 < width1 && y1 - y2 < height2) {\n if (x2 - x1 > y1 - y2) { return 0; }\n return 2;\n }\n } else {\n if (x2 - x1 < width1 && y2 - y1 < height1) {\n if (x2 - x1 > y2 - y1) { return 0; }\n return 3;\n }\n }\n }\n return -1;\n}", "function collision_detector(first, second) {\r\n var x1 = first.get(\"X\");\r\n var y1 = first.get(\"Y\");\r\n var width1 = first.get(\"width\");\r\n var height1 = first.get(\"height\");\r\n var x2 = second.get(\"X\");\r\n var y2 = second.get(\"Y\");\r\n var width2 = second.get(\"width\");\r\n var height2 = second.get(\"height\");\r\n\r\n if (x2 > x1 && x2 < x1 + width1 || x1 > x2 && x1 < x2 + width2) {\r\n if (y2 > y1 && y2 < y1 + height1 || y1 > y2 && y1 < y2 + height2) {\r\n return true;\r\n }\r\n } else {\r\n return false;\r\n }\r\n}", "function boundsIntersect(bounds1, bounds2) {\n let topEdge1 = bounds1.endY;\n let rightEdge1 = bounds1.endX;\n let leftEdge1 = bounds1.startX;\n let bottomEdge1 = bounds1.startY;\n let topEdge2 = bounds2.endY;\n let rightEdge2 = bounds2.endX;\n let leftEdge2 = bounds2.startX;\n let bottomEdge2 = bounds2.startY;\n\n return (\n leftEdge1 < rightEdge2 &&\n rightEdge1 > leftEdge2 &&\n bottomEdge1 < topEdge2 &&\n topEdge1 > bottomEdge2\n );\n}", "checkIntersection(x, y, w, h) {\n if ((this.x <= x + w) && (this.x + this.width >= x) &&\n (this.y <= y + h) && (this.y + this.height >= y)) {\n return true;\n } else {\n return false;\n }\n }", "function areRectanglesTouching( r1, r2 ) {\r\n\tif(\r\n\t\t(r1.x < r2.x + r2.width)\r\n\t\t&& (r1.x + r1.width > r2.x)\r\n\t\t&& (r1.y < r2.y + r2.height)\r\n\t\t&& (r1.y + r1.height > r2.y )\r\n\t\t) {\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n} //end areRectanglesTouching", "function testCollisionRectRect(rect1, rect2) {\n\treturn rect1.x <= rect2.x + rect2.width \n\t\t&& rect2.x <= rect1.x + rect1.width\n\t\t&& rect1.y <= rect2.y + rect2.height\n\t\t&& rect2.y <= rect1.y + rect1.height;\n}", "function boxIntersectCheck(a, b) {\n return !( a[0] > b[2] || b[0] > a[2] || a[1] > b[3] || b[1] > a[3] );\n}", "boundsDoIntersect (Ax, Ay, Bx, By, Cx, Cy, Dx, Dy) {\n return Bx > Cx && Ax < Dx && By > Cy && Ay < Dy\n }", "function overlapTest(a, b) {\n return a.x < b.x + b.w && a.x + a.w > b.x &&\n\t\t a.y < b.y + b.h && a.y + a.h > b.y\n}", "function intersects(a, b) {\n if ((a.h && b.h) || (a.v && b.v)) return;\n\n const h = a.h ? a : b;\n const v = a.v ? a : b;\n const hasIntersection = (h.y >= v.ymin && h.y <= v.ymax) \n && (v.x >= h.xmin && v.x <= h.xmax);\n if (hasIntersection) {\n return [v.x, h.y];\n }\n}", "function overlapTest(a, b) {\n return a.x < b.x + b.w && a.x + a.w > b.x &&\n a.y < b.y + b.h && a.y + a.h > b.y\n}", "function overlapTest(a, b) {\n return a.x < b.x + b.w && a.x + a.w > b.x &&\n a.y < b.y + b.h && a.y + a.h > b.y\n}", "rectIntersectsGround(x, y, w, h) {\n for (let i = x; i < x + w; i++) {\n for (let j = y; j < y + h; j++) {\n if (this.isGround(i, j)) {\n return true;\n }\n }\n }\n return false;\n }", "function Position_Rect_Intersects(otherRect)\n{\n\t//check and confirm\n\treturn !(otherRect.left > this.right || otherRect.right < this.left || otherRect.top > this.bottom || otherRect.bottom < this.top);\n}", "doesIntersect(e1x0, e1y0, e1x1, e1y1, e2x0, e2y0, e2x1, e2y1) {\n if (this.isWithinBounds(e1x1, e1y0, e2x0, e2y0, e2x1, e2y1)) { // e1 bottom left corner in e2\n return true;\n } else if (this.isWithinBounds(e1x1, e1y0, e2x0, e2y0, e2x1, e2y1)) { // e1 bottom right corner in e2\n return true;\n } else if (this.isWithinBounds(e1x0, e1y0, e2x0, e2y0, e2x1, e2y1)) { // e1 bottom left corner in e2\n return true;\n } else if (this.isWithinBounds(e1x1, e1y1, e2x0, e2y0, e2x1, e2y1)) { // e1 top right corner in e2\n return true;\n } else if (this.isWithinBounds(e1x0, e1y1, e2x0, e2y0, e2x1, e2y1)) { // e1 top left corner in e2\n return true;\n } else {\n return false\n }\n }", "function detectObject(rect1, rect2) {\n\nvar objId = -1;\n \n if (rect2.left < rect1.right && \n rect2.right > rect1.left) { \n \n objId = rect2.id;\n } \n \n return objId;\n \n\n}", "function intersect(x1,y1,x2,y2,x3,y3,x4,y4){\r\n s1x = x2 - x1;\r\n s1y = y2 - y1;\r\n\r\n s2x = x4 - x3;\r\n s2y = y4 - y3;\r\n\r\n s1 = ((-s1y * (x1 - x3)) + (s1x * (y1 - y3))) / ((-s2x * s1y) + (s1x * s2y))\r\n s2 = (( s2x * (y1 - y3)) - (s2y * (x1 - x3))) / ((-s2x * s1y) + (s1x * s2y))\r\n\r\n if ((s1 >= 0)*(s1 <= 1)*(s2 >= 0)*(s2 <= 1))\r\n {\r\n return [(x1 + (s2*s1x)),(y1 + (s2*s1y))];\r\n }\r\n else \r\n {\r\n return null;;\r\n }\r\n}", "function intersect () {\n var arg1 = arguments[0];\n var arg2 = arguments[1];\n if (arguments.length == 3) {\n var arg3 = arguments[2];\n if (arg3 instanceof Rect2d) {\n return intersect_Rect2d_Rect2d(arg1, arg2, arg3);\n }\n else if (arg3 instanceof Rect3d) {\n return intersect_Rect3d_Rect3d(arg1, arg2, arg3)\n }\n }\n else if (arguments.length == 2) {\n if (arg2 instanceof Ray3d) {\n if (arg1 instanceof Plane3d) {\n return intersect_Plane3d_Ray3d(arg1, arg2);\n }\n else if (arg1 instanceof Sphere) {\n return intersect_Sphere_Ray3d(arg1, arg2);\n }\n else if (arg1 instanceof Rect3d) {\n return intersect_Rect3d_Ray3d(arg1, arg2);\n }\n }\n else if (arg2 instanceof Ray2d) {\n if (arg1 instanceof Plane2d) {\n return intersect_Plane2d_Ray2d(arg1, arg2);\n }\n else if (arg1 instanceof Circle) {\n return intersect_Circle_Ray2d(arg1, arg2);\n }\n else if (arg1 instanceof Rect2d) {\n return intersect_Rect2d_Ray2d(arg1, arg2);\n }\n }\n else if (arg1 instanceof Circle && arg2 instanceof Circle) {\n return intersect_Circle_Circle(arg1, arg2);\n }\n else if (arg1 instanceof Sphere && arg2 instanceof Sphere) {\n return intersect_Sphere_Sphere(arg1, arg2);\n }\n else if (arg1 instanceof Rect2d && arg2 instanceof Circle) {\n return intersect_Rect2d_Circle(arg1, arg2);\n }\n else if (arg1 instanceof Rect3d && arg2 instanceof Sphere) {\n return intersect_Rect3d_Sphere(arg1, arg2);\n }\n }\n else {\n debug_assert(false, \"Incorrect number of arguments\")\n }\n}", "function square_square_overlap(rect1, rect2) {\n // rect: pos (lower left), size (w || h)\n // test each corner of one rect against dimension bounds of other\n // crit: if ANY corner is inside BOTH dimensions (x, y)\n\n // 1. calculate each point of rect2\n var list_of_points = [];\n list_of_points.push({x: rect2.pos.x, y: rect2.pos.y});\n list_of_points.push({x: rect2.pos.x + rect2.size, y: rect2.pos.y});\n list_of_points.push({x: rect2.pos.x, y: rect2.pos.y + rect2.size});\n list_of_points.push({x: rect2.pos.x + rect2.size, y: rect2.pos.y + rect2.size});\n\n // test each point, break if any overlap\n for (let i = 0; i < list_of_points.length; i++) {\n const c = list_of_points[i];\n if ((c.x >= rect1.pos.x && c.x <= rect1.pos.x + rect1.size) \n && ( c.y >= rect1.pos.y && c.y <= rect1.pos.y + rect1.size)) {\n return true;\n }\n }\n\n return false;\n}", "rectangleCollision(loc1, rectWidth1, rectHeight1, loc2, rectWidth2, rectHeight2) {\n if (this.range(loc1.x, loc1.x + rectWidth1, loc2.x, loc2.x + rectWidth2) &&\n this.range(loc1.y, loc1.y + rectHeight1, loc2.y, loc2.y + rectHeight2)) {\n return true;\n }\n }", "function _oneOfPointsWithinRect(aX, aY, aW, aH, bX, bY, bW, bH) {\n\t// calculate corner points\n\tvar aTopLeft = {'x':aX, 'y':aY};\n\tvar aTopRight = {'x':aX + aW,'y':aY};\n\tvar aBotLeft = {'x':aX, 'y':aY + aH};\n\tvar aBotRight = {'x':aX + aW,'y':aY + aH};\n\n\tvar aPoints = [aTopLeft, aTopRight, aBotLeft, aBotRight];\n\n\t// go through aPoints from end to start because\n\t// presumed most common collision is player\n\t// with front to something, and just why not\n\tfor (var i = aPoints.length - 1; i >= 0; i--) {\n\t\tvar x = aPoints[i].x;\n\t\tvar y = aPoints[i].y;\n\t\tif (y >= bY && y <= bY + bH) {\n\t\t\t// we have vertical collision\n\t\t\tif (x >= bX && x <= bX + bW) {\n\t\t\t\t// we have horizontal collision as well\n\t\t\t\t// and therefore a total collision\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}", "function collisionDetection(first, second) {\n var firstBounds = first.getBounds();\n var secondBounds = second.getBounds();\n\n return firstBounds.x + firstBounds.width > secondBounds.x\n && firstBounds.x < secondBounds.x + secondBounds.width \n && firstBounds.y + firstBounds.height > secondBounds.y\n && firstBounds.y < secondBounds.y + secondBounds.height;\n}", "isInsideURect(x, y, rect) {\n if (x >= rect.X1 && x < rect.X2 && y >= rect.Y1 && y < rect.Y2) {\n return true;\n }\n else {\n return false;\n }\n }", "static intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n GraphicsGeometry.intersects(p, p.next, a, b)) {\n return true;\n }\n p = p.next;\n } while (p !== a);\n return false;\n }", "intersects(_rect, _insetByX, _insetByY) {\n if (this.isNumber(_insetByX)) {\n _rect = new HRect(_rect);\n if (this.isUndefined(_insetByY)) {\n _insetByY = _insetByX;\n }\n _rect.insetBy(_insetByX, _insetByY);\n }\n return !(this.left > _rect.right || this.right < _rect.left ||\n this.top > _rect.bottom || this.bottom < _rect.top);\n }", "function overlap(obj1, obj2) {\n var right1 = obj1.x + obj1.width;\n var right2 = obj2.x + obj2.width;\n var left1 = obj1.x;\n var left2 = obj2.x;\n var top1 = obj1.y;\n var top2 = obj2.y;\n var bottom1 = obj1.y + obj1.height;\n var bottom2 = obj2.y + obj2.height;\n\n if (left1 < right2 && left2 < right1 && top1 < bottom2 && top2 < bottom1) {\n return true;\n }\n return false;\n }", "hitCheck(a, b){ // colision\n var ab = a._boundsRect;\n var bb = b._boundsRect;\n return ab.x + ab.width > bb.x && ab.x < bb.x + bb.width && ab.y + ab.height > bb.y && ab.y < bb.y + bb.height;\n }", "static detectCollision(a, b) {\n // start with body a and body b\n for (let i=0; i<a.lines.length; i++) {\n for (let j=0; j<b.lines.length; j++) {\n let res = Line.intersect(a.lines[i],b.lines[j])\n if (res.c == true) {\n // draw lines that are intersecting\n // ctx.beginPath();\n // ctx.lineWidth = 5;\n // ctx.moveTo(a.lines[i].p1.x,a.lines[i].p1.y);\n // ctx.lineTo(a.lines[i].p2.x,a.lines[i].p2.y);\n // ctx.stroke();\n // ctx.beginPath();\n // ctx.moveTo(b.lines[j].p1.x,b.lines[j].p1.y);\n // ctx.lineTo(b.lines[j].p2.x,b.lines[j].p2.y);\n // ctx.stroke();\n // ctx.lineWidth = 1;\n return {c:true, x:res.x, y:res.y}\n }\n }\n }\n return {c:false, x:undefined, y:undefined}\n }", "function hit(a,b){\n\tvar hit = false;\n\tif(b.x + b.width >= a.x && b.x < a.x + a.width){\n\t\tif(b.y + b.height >= a.y && b.y < a.y + a.height){\n\t\t\thit = true;\n\t\t}\n\t}\n\tif(b.x <= a.x && b.x + b.width >= a.x + a.width){\n\t\tif(b.y <= a.y && b.y + b.height >= a.y + a.height){\n\t\t\thit = true;\n\t\t}\t\n\t}\n\tif(a.x <= b.x && a.x + a.width >= b.x + b.width){\n\t\tif(a.y <= b.y && a.y + a.height >= b.y + b.height){\n\t\t\thit = true;\n\t\t}\t\n\t}\n\t\n\treturn hit;\n}", "function blockCollision(rectOne, rectTwo) {\n \n // Check whether there is a collision on the x and y\n return Math.abs((rectOne.x + rectOne.width / 2) - (rectTwo.x + rectTwo.width / 2)) < rectOne.width / 2 + rectTwo.width / 2 && Math.abs((rectOne.y + rectOne.height / 2) - (rectTwo.y + rectTwo.height / 2)) < rectOne.height / 2 + rectTwo.height / 2;\n \n}", "function intersect(actor1, actor2) {\n return !(actor1.right < actor2.left ||\n actor1.left > actor2.right ||\n actor1.top > actor2.bottom ||\n actor1.bottom < actor2.top);\n}", "function intersect(pos1, size1, pos2, size2) {\r\n return (pos1.x < pos2.x + size2.w && pos1.x + size1.w > pos2.x &&\r\n pos1.y < pos2.y + size2.h && pos1.y + size1.h > pos2.y);\r\n}", "function intersect(pos1, size1, pos2, size2) {\r\n return (pos1.x < pos2.x + size2.w && pos1.x + size1.w > pos2.x &&\r\n pos1.y < pos2.y + size2.h && pos1.y + size1.h > pos2.y);\r\n}", "function intersect(pos1, size1, pos2, size2) {\r\n return (pos1.x < pos2.x + size2.w && pos1.x + size1.w > pos2.x &&\r\n pos1.y < pos2.y + size2.h && pos1.y + size1.h > pos2.y);\r\n}", "function checkOverlap(rect1, rect2) {\n\tlet rightBottom1 = {x: rect1.x + rect1.width, y: rect1.y - rect1.width};\n\tlet rightBottom2 = {x: rect2.x + rect2.width, y: rect2.y - rect2.width};\n\tif (rect1.x > rightBottom2.x || rect2.x > rightBottom1.x) return false;\n\tif (rect1.y < rightBottom2.y || rect2.y < rightBottom1.y) return false;\n\treturn true;\n}", "function intersect(pos1, size1, pos2, size2) {\n return (pos1.x < pos2.x + size2.w && pos1.x + size1.w > pos2.x &&\n pos1.y < pos2.y + size2.h && pos1.y + size1.h > pos2.y);\n}", "function Position_Rect_IntersectWith(otherRect)\n{\n\t//modify our rect\n\tthis.left = Math.max(this.left, otherRect.left);\n\tthis.top = Math.max(this.top, otherRect.top);\n\tthis.right = Math.min(this.right, otherRect.right);\n\tthis.bottom = Math.min(this.bottom, otherRect.bottom);\n\tthis.width = this.right - this.left;\n\tthis.height = this.bottom - this.top;\n\t//empty rect?\n\tif (this.width <= 0 || this.height <= 0)\n\t{\n\t\t//make us empty\n\t\tthis.left = 0;\n\t\tthis.top = 0;\n\t\tthis.right = 0;\n\t\tthis.bottom = 0;\n\t\tthis.width = 0;\n\t\tthis.height = 0;\n\t}\n}" ]
[ "0.8105721", "0.81014436", "0.7992286", "0.78038794", "0.7723433", "0.7704247", "0.7704247", "0.7704247", "0.7704247", "0.7704247", "0.76857185", "0.76700425", "0.766654", "0.76594055", "0.76442605", "0.76442605", "0.76442605", "0.76442605", "0.76442605", "0.76442605", "0.76442605", "0.76442605", "0.7642832", "0.7625734", "0.76185197", "0.76185197", "0.76185197", "0.76130867", "0.76051754", "0.7603112", "0.75748104", "0.7542282", "0.7542282", "0.7518248", "0.74592775", "0.7436535", "0.7374365", "0.73241323", "0.7307022", "0.7196688", "0.7183067", "0.71525234", "0.7131015", "0.7125427", "0.7117443", "0.70594037", "0.7010743", "0.6983037", "0.69794565", "0.6964641", "0.6956959", "0.69229496", "0.69212854", "0.6903714", "0.6899723", "0.68945575", "0.6878681", "0.68736744", "0.686021", "0.68534523", "0.68487567", "0.6848544", "0.6840804", "0.6835519", "0.68352544", "0.68293226", "0.68293154", "0.68261576", "0.68238205", "0.6821987", "0.67814106", "0.6779793", "0.67738813", "0.67738813", "0.676903", "0.67563725", "0.6747171", "0.67468506", "0.6746422", "0.67321265", "0.6731572", "0.6730817", "0.67236435", "0.67046624", "0.66852313", "0.6681396", "0.6680869", "0.6666893", "0.66632235", "0.66537255", "0.6648204", "0.66481656", "0.66298693", "0.6627408", "0.6627408", "0.6627408", "0.66128844", "0.66089004", "0.66055053" ]
0.66158813
97
The player class used in this program
function Player() { this.node = document.getElementById("player"); this.position = PLAYER_INIT_POS; this.motion = motionType.NONE; this.verticalSpeed = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Player() {}", "function player() {}", "function Player() { }", "constructor(player){\n this.player = player;\n }", "constructor(player) {\n this.player = player;\n }", "function Player(name) {\r\n}", "function playerFactory() {}", "getCurrentPlayer() {}", "function Player() {\n if(jQuery(\".player\").length) {\n this.init();\n }\n }", "function player()\n{\n\tthis.x = 10;\n\tthis.y = 10;\n\tthis.id = 1;\n\tthis.width = 50;\n\tthis.height = 50;\n\tthis.facing = \"right\";\n\tthis.score = 0;\n\tthis.inAir = 0;\n}", "function player(){\n}", "constructor(name, type){\n super(name,type)\n // en el scope del constructor \n // invocamos con super el name y el \n // type de la clase player \n }", "function Player () {\n\t this.x = 1400; \n\t this.y = 600;\n\t this.w = 20;\n\t this.h = 20;\n\t this.deltaX = 0;\n\t this.deltaY = 0;\n\t this.xTarget = 0;\n\t this.yTarget = 0;\n\t this.tired = false;\n\t this.speed = 0;\n\t this.topSpeed = 4;\n\t this.energy = 150;\n\t this.health = 150;\n\t this.recovery = 0\n\t this.xcenter = 400;\n\t this.ycenter = 300;\n\t this.fill = '#000000';\n\t this.xdirection = 1;\n\t this.ydirection = 0;\n\t this.acceleration = 1;\n\t this.radius = 0;\n\t this.angle = 1.7;\n\t this.mot = 0;\n\t this.closestVehicle = 0;\n\t this.gettingInVehicle = 0;\n\t this.inBuilding = 0;\n\t this.walkTimer = 0;\n\t this.xVector = 0;\n\t this.yVector = 0;\n\t this.standImage = playerStand;\n\t this.walkAnimations = [\"\", playerWalk1, playerWalk2, playerWalk3, playerWalk4];\n\t this.activeWeapon = 0;\n\t this.weaponsPossessed = [true, true, true, true, true];\n\t this.ammo = [1000, 1500, 2000, 50, 30]\n\t this.kills = 0;\n\t this.onTile = {x: 0, y: 0};\n }", "function SamplePlayer() {\r\n}", "function ProcessPlayer() {\n\n}", "get WindowsPlayer() {}", "function Player() {\r\n this.node = svgdoc.getElementById(\"player\");\r\n this.position = PLAYER_INIT_POS;\r\n this.motion = motionType.NONE;\r\n this.verticalSpeed = 0;\r\n this.orientation = motionType.RIGHT\r\n this.isOnVerticalPlatform = false\r\n}", "function Player()\n{\n\t// Depends on sprite\n\tthis.width = 32;\n\tthis.height = 46;\n\tthis.type = 'player';\n\n\tthis.baseX = 0;\n\tthis.baseY = 0;\n\n\tthis.sensor_left = 6;\n\tthis.sensor_right = 23;\n\n\tthis.sink = new Sink(server + \"/sink.php?game=AG\" +\n\t\t\t\"&session=\" + options.gameId +\n\t\t\t\"&user=\" + options.userId +\n\t\t\t\"&level=\" + options.levelName +\n\t\t\t\"&debug=\" + (options.debugMode?\"true\":\"false\"));\n\n\tthis.sink.transmitEvery = 20;\n\n\tthis.events = [];\n\n\n\tthis.reset = function()\n\t{\n\t\tthis.engine = this.getEngine();\n\n\t\t// Position\n\t\tthis.x = this.baseX;\n\t\tthis.y = this.baseY;\n\t\tthis.faceRight = true;\n\n\t\t// Velocities\n\t\tthis.velX = 0;\n\t\tthis.velY = 0;\n\n\t\tthis.speed = 3.5;\n\t\tthis.speedDefault = 3.5;\n\t\tthis.speedSnow = 7.0;\n\n\t\tthis.jumping = false;\n\t\tthis.grounded = false;\n\n\t\tthis.ground = { slippery: false, type: true }\n\n\t\t// Physics parameters\n\t\tthis.gravity = 0.3;\n\t\tthis.friction = this.frictionDefault;\n\n\t\tthis.slideAccelerationSnow = 0.5;\n\n\t\t// Friction values for\n\t\tthis.frictionDefault = 0.8;\t\t// normal ground\n\t\tthis.frictionDown = 0.7;\t\t\t// when down is pressed\n\t\tthis.frictionSnow = 0.999;\t\t\t// when on snow\n\n\t\tthis.scale = 1;\n\t\tthis.alive = true;\n\t\tthis.finished = false;\n\n\t\tthis.events.push(\"RESTART\");\n\t}\n\n\n\t/**\n * Serialize state to array\n */\n this.toArray = function()\n {\n return {\n 'x': this.x,\n 'y': this.y,\n\t\t\t'type': 'player'\n };\n }\n\n\n /**\n * Unserialize state from array\n */\n this.fromArray = function(array)\n {\n this.setStartingPosition(array.x, array.y);\n }\n\n\n\t/**\n\t * Terminates the player\n\t *\n\t * @param {String} Reason the player was killed\n\t */\n\tthis.kill = function(reason)\n\t{\n\t\tif(this.alive) {\n\t\t\tthis.events.push(\"DIED_\" + reason.toUpperCase());\n\t\t\tthis.sendPosition();\n\t\t}\n\n\t\tthis.alive = false;\n\t}\n\n\n\t/**\n\t * Update stating position of the player\n\t *\n\t * @param {number} x - X coordinate of player starting location\n * @param {number} y - Y coordinate of player starting location\n */\n\tthis.setStartingPosition = function(x, y)\n\t{\n\t\tthis.baseX = x;\n\t\tthis.baseY = y;\n\t}\n\n\n\t/**\n\t * Send position to server\n\t */\n\tthis.sendPosition = function()\n\t{\n\t\tthis.sink.appendData({\n\t\t\ttimestamp: Date.now() / 1000,\n\t\t\tx: this.x / 32,\n\t\t\ty: this.y / 32,\n\t\t\tevent: JSON.stringify(this.events)\n\t\t});\n\n\t\tthis.events = [];\n\t}\n\n\n\tthis.getPermittedActions = function()\n\t{\n\t\tvar x = Math.floor(this.x / 32);\n\t\tvar y = Math.floor(this.y / 32);\n\n\t\tvar level = this.parent.getObject(\"level\");\n\t\tvar code = level.levelMap[0][x] - 2304;\n\n\t\treturn {\n\t\t\twalk_on_water: code == 1,\n\t\t\twalk_upside_down: code == 3 || code == 1,\n\t\t\tfly: code == 2,\n\t\t};\n\t}\n\n\n\tthis.handleInput = function(input)\n\t{\n\t\tvar permitted = this.getPermittedActions();\n\n\t\tif(!permitted.walk_upside_down && this.gravity < 0) {\n\t\t\tthis.events.push(\"GRAVITY_NORMAL\");\n\t\t\tthis.gravity *= -1;\n\t\t}\n\n\t\t// Jump away from gravity\n\t\tif(input.keys[input.KEY_SPACE]) {\n\t\t\tif(!this.jumping && this.grounded) {\n\t\t\t\tthis.jumping = true;\n\t\t\t\tthis.grounded = false;\n\t\t\t\tthis.velY = -sign(this.gravity) * this.speedDefault * 2;\n\t\t\t}\n\t\t}\n\n\t\t// Flip gravity if up and down are pressed at the same time\n\t\tif(input.keys[input.KEY_UP] && input.keys[input.KEY_DOWN])\n\t\t{\n\t\t\t// Allow wait at least 200ms before next flip\n\t\t\tif(permitted.walk_upside_down && (!this.lastFlip || this.engine.timestamp - this.lastFlip > 200))\n\t\t\t{\n\t\t\t\tthis.lastFlip = this.engine.timestamp\n\t\t\t\tthis.gravity *= -1;\n\n\t\t\t\tif(this.gravity < 0)\n\t\t\t\t\tthis.events.push(\"GRAVITY_INVERTED\")\n\t\t\t\telse\n\t\t\t\t\tthis.events.push(\"GRAVITY_NORMAL\");\n\t\t\t}\n\t\t} else {\n\t\t\t// Flying (under normal gravity)\n\t\t\tif(permitted.fly && input.keys[input.KEY_UP])\n\t\t\t{\n\t\t\t\tthis.velY = -this.speedDefault * 0.5;\n\t\t\t}\n\n\t\t\t// Flying (when gravity is inverted)\n\t\t\tif(permitted.fly && input.keys[input.KEY_DOWN])\n\t\t\t{\n\t\t\t\tthis.velY = this.speedDefault * 0.5;\n\t\t\t}\n\t\t}\n\n\t\t// Move to the left\n\t\tif(input.keys[input.KEY_LEFT] && this.velX > -this.speed)\n\t\t\tthis.velX--;\n\n\t\t// Move to the right\n\t\tif(input.keys[input.KEY_RIGHT] && this.velX < this.speed)\n\t\t\tthis.velX++;\n\n\t\tif(this.ground.slippery && !input.keys[input.KEY_DOWN]) {\n\t\t\tif(this.ground.type == 'hillDown')\n\t\t\t\tif(this.velX > 0.5 * -this.speed)\n\t\t\t\t\tthis.velX -= 0.25;\n\t\t\tif(this.ground.type == 'hillUp')\n\t\t\t\tif(this.velX < 0.5 * this.speed)\n\t\t\t\t\tthis.velX += 0.25;\n\t\t}\n\n\t\t// Change friction when pressing down / ground is slippery\n\t\tif(input.keys[input.KEY_DOWN]) {\n\t\t\tthis.friction = this.frictionDown;\n\t\t\tthis.speed = this.speedDefault;\n\t\t} else if(this.ground.slippery) {\n\t\t\tthis.friction = this.frictionSnow;\n\t\t\tthis.speed = this.speedSnow;\n\t\t} else {\n\t\t\tthis.friction = this.frictionDefault;\n\t\t\tthis.speed = this.speedDefault;\n\t\t}\n\t}\n\n\n\t/**\n\t * Takes a list of sensors and returns the closest and furthest sensors\n\t */\n\tthis.combineSensors = function(sensors)\n\t{\n\t\tvar minSensor = false;\n\t\tvar maxSensor = false;\n\n\t\tfor(var i = 0; i < sensors.length; i++) {\n\t\t\tif(!sensors[i] || !sensors[i].type)\n\t\t\t\tcontinue;\n\n\t\t\tif(!minSensor || sensors[i].y < minSensor.y)\n\t\t\t\tminSensor = sensors[i];\n\n\t\t\tif(!maxSensor || sensors[i].y > maxSensor.y)\n\t\t\t\tmaxSensor = sensors[i];\n\t\t}\n\n\t\treturn { min: minSensor, max: maxSensor };\n\t}\n\n\n\tthis.sensorCallback = function(hit)\n\t{\n\t\tif(hit.type == \"exit\") {\n\t\t\tif(hit.dx == 0 && !this.finished) {\n\t\t\t\tthis.events.push(\"EXIT\");\n\t\t\t\tthis.finished = true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn hit;\n\t}\n\n\n\t/**************************************************************/\n\n\n\tthis.collideVerticalDown = function(level)\n\t{\n\t\tvar permitted = this.getPermittedActions();\n\n\t\tvar dirY = Math.sign(this.gravity);\n\t\tvar oriY = this.y + 10 + (dirY == 1) * (this.height - 20);\n\n\t\tvar hit_left = level.sensor({\n\t\t\tx: this.x + this.sensor_left,\n\t\t\ty: oriY\n\t\t}, { x: 0, y: dirY }, 256, this.sensorCallback.bind(this));\n\n\t\tvar hit_right = level.sensor({\n\t\t\tx: this.x + this.sensor_right,\n\t\t\ty: oriY\n\t\t}, { x: 0, y: dirY }, 256, this.sensorCallback.bind(this));\n\n\t\tvar combined = this.combineSensors([hit_left, hit_right]);\n\n\t\t// Determine if player is on water\n\t\tvar on_water =\n\t\t\t(hit_left && hit_left.type == 'water' &&\n\t\t\t hit_right && hit_right.type == 'water');\n\n\t\tvar on_water_body =\n\t\t\t(hit_left && hit_left.type == 'waterBody' &&\n\t\t\t hit_right && hit_right.type == 'waterBody');\n\n\t\tif(dirY > 0 && combined.min && combined.min.dy < 10) {\n\t\t\t// If on water and we cannot walk on water, sink and die.\n\t\t\tif(on_water && (!permitted.walk_on_water || Math.abs(this.velX) <= 0.1 || this.jumping)) {\n\t\t\t\tif(combined.min.dy < -8)\n\t\t\t\t\tthis.kill(\"water\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(on_water_body && (!permitted.walk_on_water || Math.abs(this.velX) <= 0.1 || this.jumping)) {\n\t\t\t\tthis.kill(\"water\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.y = combined.min.y - this.height;\n\t\t\tthis.velY = 0;\n\t\t\tthis.grounded = true;\n\t\t\tthis.jumping = false;\n\n\t\t\tthis.ground.slippery = isSlippery(combined.min.sprite);\n\t\t\tthis.ground.type = combined.min.type;\n\t\t} else if(dirY < 0 && combined.max && combined.max.dy > -10) {\n\t\t\tthis.y = combined.max.y;\n\t\t\tthis.velY = 0;\n\t\t\tthis.grounded = true;\n\t\t\tthis.jumping = false;\n\t\t} else {\n\t\t\tthis.grounded = false;\n\t\t}\n\t}\n\n\n\tthis.collideVerticalUp = function(level)\n\t{\n\t\tvar dirY = -Math.sign(this.gravity);\n\t\tvar oriY = this.y + 10 + (dirY == 1) * (this.height - 20);\n\n\t\tvar hit_left = level.sensor(\n\t\t\t{ x: this.x + this.sensor_left, y: oriY },\n\t\t\t{ x: 0, y: dirY }, 256, this.sensorCallback.bind(this));\n\n\t\tvar hit_right = level.sensor(\n\t\t\t{ x: this.x + this.sensor_right, y: oriY },\n\t\t\t{ x: 0, y: dirY }, 256, this.sensorCallback.bind(this));\n\n\t\tvar combined = this.combineSensors([hit_left, hit_right]);\n\n\t\tif(dirY < 0 && combined.max && combined.max.dy > -4) {\n\t\t\tthis.y = combined.max.y - 6;\n\t\t\tthis.velY = 0;\n\t\t} else if(dirY > 0 && combined.min && combined.min.dy < 4) {\n\t\t\tthis.y = combined.min.y - this.height + 6;\n\t\t\tthis.velY = 0;\n\t\t}\n\t}\n\n\n\tthis.collideHorizontal = function(level)\n\t{\n\t\t// To the right\n\t\tvar hit = level.sensor({\n\t\t\tx: this.x + this.width - 10,\n\t\t\ty: this.y + this.height - 20\n\t\t}, {\n\t\t\tx: 1,\n\t\t\ty: 0\n\t\t}, 256, this.sensorCallback.bind(this));\n\n\n\t\tif(hit && hit.type && hit.dx < 10) {\n\t\t\tthis.velX = 0;\n\t\t\tthis.x = this.x + hit.dx - 10;\n\t\t}\n\n\t\t// To the left\n\t\tvar hit = level.sensor({\n\t\t\tx: this.x + 10,\n\t\t\ty: this.y + this.height - 20\n\t\t}, {\n\t\t\tx: -1,\n\t\t\ty: 0\n\t\t}, 256, this.sensorCallback.bind(this));\n\n\t\tif(hit && hit.type && hit.dx > -10) {\n\t\t\tthis.velX = 0;\n\t\t\tthis.x = this.x + hit.dx + 10;\n\t\t}\n\t}\n\n\n\t/*****************************************************************/\n\n\n\t/**\n\t * Update kinematics\n\t */\n\tthis.updateKinematics = function()\n\t{\n\t\tif(!this.alive && !this.finished)\n\t\t\treturn;\n\n\t\tvar oriX = this.x;\n\t\tvar oriY = this.y;\n\n\t\tvar permitted = this.getPermittedActions();\n\t\tvar level = this.parent.getObject(\"level\");\n\n\t\tthis.velX *= this.friction;\n\t\tthis.velY += this.gravity;\n\n\t\t// Update position\n\t\tthis.x += this.velX;\n\t\tthis.y += this.velY;\n\n\t\t/** Resolve vertical collisions **/\n\t\tthis.collideVerticalDown(level);\n\t\tthis.collideVerticalUp(level);\n\t\tthis.collideHorizontal(level);\n\n\t\tif(oriX != this.x || oriY != this.y || this.events.count != 0)\n\t\t\tthis.sendPosition();\n\t}\n\n\n\tthis.findTeleportDestination = function(x, y)\n\t{\n\t\tvar map = this.parent.getObject('level').levelMap;\n\n\t\tfor(var j = 0; j < map.length; j++) {\n\t\t\tfor(var i = Math.floor(x / 32); i < map[0].length; i++) {\n\t\t\t\tif(map[j][i] == 5 * 256 + 4 || map[j][i] == 5 * 256 + 5) {\n\t\t\t\t\treturn {x: i * 32, y: j * 32};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t * Handle input and kinematics\n\t */\n\tthis.update = function(input)\n\t{\n\t\tif(!this.finished)\n\t\t\tthis.handleInput(input);\n\n\t\tthis.updateKinematics();\n\n\t\tif(this.velX < 0)\n\t\t\tthis.faceRight = false;\n\t\telse if(this.velX > 0)\n\t\t\tthis.faceRight = true;\n\n\t\tif(!this.alive && Math.abs(this.scale) < 0.01) {\n\t\t\t// Recreate character after it died\n\t\t\tthis.parent.gameover();\n\t\t}\n\t}\n\n\n\t/**\n\t * Function to handle simple sprite animations\n\t */\n\tthis.animate = function(base, frames)\n\t{\n\t\tif(this.animationBase != base) {\n\t\t\tthis.animationStart = this.engine.timestamp;\n\t\t\tthis.animationBase = base;\n\t\t}\n\n\t\tvar deltaT = (this.engine.timestamp - this.animationStart) / 120;\n\n\t\treturn base + Math.floor(1 + deltaT % frames);\n\t}\n\n\n\t/**\n\t * Draws the dead message to the context\n\t *\n\t * @private\n\t * @param {Context} context - Context to draw to\n\t */\n\tthis.drawDeadMessage = function(context)\n\t{\n\t\tcontext.save();\n\t\tcontext.setTransform(1, 0, 0, 1, 0, 0);\n\t\tcontext.font = 'bold 20px Arial';\n\t\tcontext.textAlign = 'center';\n\t\tcontext.fillText(\"Oops, you died...\", this.engine.getWidth() / 2, this.engine.getHeight() / 2);\n\t\tcontext.restore();\n\t}\n\n\n\t/**\n\t * Draws the finished message to the context\n\t *\n\t * @private\n\t * @param {Context} context - Context to draw to\n\t */\n\tthis.drawFinishedMessage = function(context)\n\t{\n\t\tcontext.save();\n\n\t\tcontext.setTransform(1, 0, 0, 1, 0, 0);\n\t\tcontext.font = 'bold 20px Arial';\n\t\tcontext.textAlign = 'center';\n\t\tcontext.fillText(\"Congratulations, you have finished the game...\", this.engine.getWidth() / 2, this.engine.getHeight() / 2);\n\n\t\tcontext.restore();\n\t}\n\n\n\t/**\n\t * Draw the correct sprite based on the current state of the player\n\t */\n\tthis.draw = function(context)\n\t{\n\t\tvar sprite = '';\n\n\t\tif(this.alive) {\n\t\t\tthis.scale = lerp(this.scale, sign(this.gravity) == -1?-1:1, 0.5);\n\t\t} else {\n\t\t\tthis.scale = lerp(this.scale, 0, 0.05);\n\t\t}\n\n\t\tif(!this.alive)\n\t\t\tthis.drawDeadMessage(context);\n\n\t\tif(this.finished)\n\t\t\tthis.drawFinishedMessage(context);\n\n\t\tif(this.velX > 0.3) {\n\t\t\tsprite = this.animate('player_walk_right_', 3);\n\t\t} else if(this.velX < -0.3) {\n\t\t\tsprite = this.animate('player_walk_left_', 3);\n\t\t} else if(this.faceRight) {\n\t\t\tsprite = this.animate('player_idle_right_', 3);\n\t\t} else {\n\t\t\tsprite = this.animate('player_idle_left_', 3);\n\t\t}\n\n\t\tthis.parent.spriteManager.drawSprite(context, this, sprite, 0, function(context) {\n\t\t\tcontext.scale(1, this.scale);\n\t\t}.bind(this));\n\t}\n}", "function Player() {\n this.wins = 0;\n this.computer = false;\n }", "function Player(){\n this.name\n this.grid = createPlayerGrid() // 1 == Ship // 0 == No Ship\n this.placedShips = AMOUNT_SHIPS\n this.score = 0\n}", "function Player(name) {\n this.name = name;\n this.sayHi = function () {\n return \"Hi \" + this.name;\n };\n}", "function createPlayer() {\n}", "function Player () {\n\tthis.x;\n\tthis.y;\n\tthis.v;\n\t//this.a = 150;\n\tthis.id;\n\tthis.index;\n\tthis.color;\n}", "function JMJPlayer() {\n\tthis.hand;\n\tthis.point = INIT_POINT;\n\tthis.round;\n\tthis.dahai;\n}", "function Player() {\n this.name = name;\n this.score = [];\n this.totalScore = 0;\n this.active = true;\n}", "function Player() {\r\n this.node = svgdoc.getElementById(\"player\");\r\n this.position = PLAYER_INIT_POS;\r\n this.motion = motionType.NONE;\r\n this.verticalSpeed = 0;\r\n}", "constructor(){\n // Defining initial positions for Player\n this.positionX = 202;\n this.positionY = 402;\n this.sprite = 'images/char-horn-girl.png';\n // Variables for Player movement top/down and sideways \n this.upDown = 83;\n this.leftRight = 101;\n this.playerWon = false;\n }", "function Player(username) {\n this.username = username;\n this.keys = [];\n this.mode = 'CMD';\n //modes: CMD, T, W, G\n\n //accepts a string of username or a user object and returns if it matches\n this.equals = function (u) {\n if (typeof(u) === 'string' && u === username) {\n return true;\n } else if (typeof (u) === 'object' && u.hasOwnProperty('username') && u.username === this.username) {\n return true;\n }\n return false;\n }\n\n //store the index of the key for the list\n this.addKey = function(keyIndex){\n keys.push(keyIndex);\n }\n}", "function Player() {\n\n\t// Variables\n\tthis.stats = new Stats();\n\n\tthis.gob = new Gob();\n\tthis.gob.spriteSize( 200 );\n\tthis.gob.gfx( GraphicAction.Idle );\n\tthis.gob.gfxArray([\n\t\t['idle', 'guard', 'evade', 'jump', 'item'],\n\t\t['hurt', 'fall', 'run1', 'run2', 'run3'],\n\t\t['slash1', 'slash2', 'slash3', 'slash4', 'slash5'],\n\t\t['thrust1', 'thrust2' , 'thrust3', 'thrust4', 'thrust5'],\n\t\t['vstrike1', 'vstrike2' , 'vstrike3', 'vstrike4', 'vstrike5'],\n\t\t['asmash1', 'asmash2' , 'asmash3', 'asmash4', 'asmash5'],\n\t\t['cast1', 'cast2' , 'cast3', '', '']\n\t]);\n\n\tthis.action = 'ground';\n\tthis.subaction = 'ground';\n\tthis.actionTimer = 0;\n\tthis.gfxTimer = 0;\n\tthis.x = 160;\n\tthis.y = 510;\n\tthis.dir = \"right\";\n\tthis.jumpTimer = 0;\n\n\tthis.skill = new Skill( \"Slash\" );\n\n\t// assume the player is an ai and not human player\n\tthis.control = AI;\n\t\n\t// Methods\n\n\t// Gets the current gfx index from the maximum number\n\tthis.max = function( maxFrames ) {\n\t\treturn \"\" + ( 1 + Math.floor( (this.gfxTimer / 3) % maxFrames ) );\n\t}\n\n\t// This is the player's main loop cycle. It's run during every cycle (50milliseconds)\n\tthis.cycle = function () {\n\t\tthis.sharedPreCycle();\n\t\tswitch( this.action ) {\n\t\t\tcase \"ground\": this.ground(); break;\n\t\t\tcase \"attack\": this.attack(); break;\n\t\t\tcase \"jump\": this.jump(); break;\n\t\t}\n\t\tthis.sharedPostCycle();\n\t}\n\n\tthis.sharedPreCycle = function() {\n\t\tthis.gfxTimer = this.gfxTimer % 1000 + 1;\n\t}\n\n\tthis.sharedPostCycle = function() {\n\t\tif(this.x < 20)\n\t\t{\n\t\t\tthis.x = 20;\n\t\t}\n\t\tif(this.x > 780)\n\t\t{\n\t\t\tthis.x = 780;\n\t\t}\n\n\t\t// We use this.x and this.y to store where our player is, but the OAM doesn't know that...\n\t\t// Now to tell the OAM the new coordinates of the player.\n\t\tthis.gob.pos( this.x, this.y );\n\t}\n\n\tthis.ground = function() {\n\n\t\t// 87 in ASCII is the 'W' on a keyboard, 83:'S', 68:'D', 65:'A'\n\t\t// TODO: This should be exchanged with a more dynamic method so users can change their controls\n\t\tthis.gob.gfx(GraphicAction.Idle);\n\t\tif( key[68] || isTouchX('>', camera.width * 2/3) ) {\n\t\t\tthis.x += this.stats.speed;\n\t\t\tthis.dir = \"right\";\n\t\t\tthis.gob.dir( this.dir );\n\t\t\tthis.gob.gfx('run' + this.max(3) );\n\t\t}\n\t\telse if( key[65] || isTouchX('<', camera.width * 1/3) ) {\n\t\t\tthis.x -= this.stats.speed;\n\t\t\tthis.dir = \"left\";\n\t\t\tthis.gob.dir( this.dir );\n\t\t\tthis.gob.gfx('run' + this.max(3) );\n\t\t}\n\t\tif( key[87] || isTouchY('<', camera.height * 1/3) ) {\n\t\t\tthis.action = \"jump\";\n\t\t\tthis.gob.gfx(GraphicAction.Jump);\n\t\t}\n\t\tif( key[ 48 ] ) {\n\t\t\tconsole.log(\"Attack Initiated\");\n\t\t\tthis.action = \"attack\";\n\t\t}\n\t}\n\n\tthis.attack = function() {\n\t\tthis.skill.atts = {\n\t\t\t '0': new SkillNode( GraphicAction.Slash1 , null, +5 ),\n\t\t\t '50': new SkillNode( GraphicAction.Slash2 , null, +10 ),\n\t\t\t'100': new SkillNode( GraphicAction.Slash3 , null, +20 ),\n\t\t\t'150': new SkillNode( GraphicAction.Slash4 , null ),\n\t\t\t'200': new SkillNode( GraphicAction.Slash5 , null ),\n \t\t\t'250': new SkillNode( null , null )\n\t\t};\n\n\t\t// the global variable milliseconds per frame (mspf) indicates the amount of real time that has passed\n\t\tthis.gfxName = this.skill.gfxName( this.actionTimer );\n\n\t\t// If our time within the skill's time frame?\n\t\tif( this.gfxName != null ) {\n\t\t\t// use it's gfxName\n\t\t\tthis.gob.gfx( this.gfxName );\n\n\t\t\t// Increase the action timer for next time\n\t\t\tthis.actionTimer += mspf; \n\t\t}\n\t\telse {\n\t\t\tthis.action = \"ground\";\n\t\t\tthis.actionTimer = 0;\n\t\t}\n\t}\n\n\tthis.jump = function() {\n\t\t// horizontally direct the player\n\t\tif( key[68] || isTouchX('>', camera.width * 2/3) ) {\n\t\t\tthis.x += this.stats.speed;\n\t\t\tthis.dir = \"right\";\n\t\t\tthis.gob.dir( this.dir );\n\t\t}\n\t\telse if( key[65] || isTouchX('<', camera.width * 1/3) ) {\n\t\t\tthis.x -= this.stats.speed;\n\t\t\tthis.dir = \"left\";\n\t\t\tthis.gob.dir( this.dir );\n\t\t}\n\n\t\t// Verticall direct the player\n\t\tif( key[83] || isTouchY('>', camera.height * 2/3) ) {\n\t\t\tif(this.jumpTimer < 10)\n\t\t\t{\n\t\t\t\tthis.jumpTimer = 10;\n\t\t\t}\n\t\t}\n\t\tthis.gob.gfx( GraphicAction.Jump );\n\t\tthis.jumpTimer += 1;\n\t\tchangeInY = - (0.5 * this.jumpTimer) * (0.5 * this.jumpTimer) + 25;\n\t\tif(this.jumpTimer < 10)\n\t\t{\n\t\t\tthis.y -= changeInY;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.y -= changeInY;\n\t\t\tif(this.y >= GROUND_Y)\n\t\t\t{\n\t\t\t\tthis.y = GROUND_Y;\n\t\t\t\tthis.jumpTimer = 0;\n\t\t\t\tthis.action = \"ground\";\n\t\t\t}\n\t\t} \n\t}\n\n}", "function Player(type, xPos, yPos, r, g, b) {\n\n this.type = 'PYRAMID'; // or 'CUBE'\n this.xPos = 0;\n this.yPos = -2.0;\n this.height = -0.6;\n\n this.r = 1;\n this.g = 1;\n this.b = 1;\n}", "function Player(uniqueID, startPos, params) {\n\n\tthis.id = uniqueID;\n\t\n\tthis.name = \"Player\";\n\n\tthis.paddle = new Paddle();\n\t\n}", "function createPlayer() {\n window.player = new Player(); \n}", "function Player(conn) {\n this.conn = conn;\n this.surrender = false;\n}", "function Player() {\n this.name = this.setName();\n this.setName = function ('Mario') {\n // Creating a function that has 1 of 2 possibilitys\n if (Math.random() <= .50) {\n this.name= \"Lugi\";\n } else {\n this.name= \"Mario\";\n }\n };\n this.totalCoins = 0;\n this.addCoin = function () {\n // We want to add coins to totalCoins\n this.totalCoins += 20;\n }\n this.status = \"Small\";\n this.gotPowerup = function () {\n // Create a function that checks the status and adds the power up\n if (this.status === \"Small\") {\n this.status = \"Big\";\n } else if (this.status === \"Big\") {\n this.status = \"Powered Up\";\n }\n };\n this.gotHit = function () {\n if (this.status === \"Powered Up\") {\n this.status = \"Big\";\n } else if (this.status === \"Big\") {\n this.status = \"Small\";\n } else if (this.status === \"Small\") {\n this.status = \"Dead\";\n this.gameActive = false;\n }\n };\n this.star = false;\n this.gameActive = true;\n this.print = function () {\n var properties = [\"\"]\n // write a functinon that prints to the console the name, totalCoins, status, and star properties.\n console.log(\"Name \" + this.name + \"\\nTotal Coins \" + this.totalCoins + \"\\nStatus \" + this.status + \"\\nStar Properties \" );\n };\n}", "get LinuxPlayer() {}", "function Player(name)\n{\n\tthis.name = name;\n\tthis.points = 0;\n\tthis.rebounds = 0;\n\tthis.assists = 0;\n\tthis.blocks = 0;\n\tthis.steals = 0;\n\tthis.player_field_gold_p = 0;\n\tthis.player_3_point_p = 0;\n\n}", "function Player(name){\n this.name = name;\n this.score = 0;\n this.hand = [];\n this.dealer = false;\n this.busted = false;\n}", "function Player(player_id, username, is_child) { \t\n\tthis.playerId = player_id; // the socket ID of the player\n\tthis.username = username; // the player's username\n\tthis.isChild = is_child; // whether the player is drawing or not\n}", "function Player(){\n var x = 700;\n var y = 390;\n this.x = x;\n this.y = y;\n\n \n this.faces = [\n 'images/char-boy.png',\n 'images/char-princess-girl.png',\n 'images/char-pink-girl.png',\n 'images/char-horn-girl.png',\n 'images/char-cat-girl.png'\n ];\n this.lastFace = 0;\n this.sprite = this.faces[0];\n}", "function Player(name, weapon) {\n\tthis.name = name;\n\tthis.weapon = weapon;\n\t// important point i am not returning anything here\n}", "function Player(name, weapon) {\n\tthis.name = name;\n\tthis.weapon = weapon;\n\t// important point i am not returning anything here\n}", "function setupPlayer() {\n playerX = 4 * width / 5;\n playerY = height / 2;\n playerHealth = playerMaxHealth;\n playerStamina = playerMaxStamina;\n}", "constructor(name) {\n this.name = name;\n\n // The Player starts with zero points.\n this.points = 0;\n }", "function setupPlayer() {\n playerX = 4 * width / 5;\n playerY = height / 2;\n playerHealth = playerMaxHealth;\n}", "function setupPlayer() {\n playerX = 4 * width / 5;\n playerY = height / 2;\n playerHealth = playerMaxHealth;\n}", "function setupPlayer() {\n playerX = 4 * width / 5;\n playerY = height / 2;\n playerHealth = playerMaxHealth;\n}", "function Player(id, x, y, r, color_r, color_g, color_b) {\n // Postion x et y du player\n this.x = x;\n this.y = y;\n this.id = id;\n this.r = r;\n this.color_r = color_r;\n this.color_g = color_g;\n this.color_b = color_b;\n this.player_ready = false;\n this.pseudo = \"\";\n}", "function Player(name='player-1', xPosition=0, yPosition=0, width=100, element=\"<div class='snowboarder' id='player-1'></div>\", instructionName='instructions-player-1') {\n\t\tthis.name = name;\n\t\tthis.xPosition = xPosition;\n\t\tthis.yPosition = yPosition;\n\t\tthis.width = width;\n\t\tthis.element = document.getElementById(name);\n this.instructions = document.getElementById(instructionName);\n }", "player_declared(args) {\n\n }", "function Player(name, age, position, skillLevel) {\n this.name = name;\n this.age = age;\n this.position = position;\n this.skillLevel = skillLevel;\n}", "constructor() {\n // The image/sprite for our player\n this.sprite = 'images/char-pink-girl.png';\n //distance between two blocks\n this.horizontal = 101;\n this.vertical = 83;\n // start position of the player\n this.x0 = this.horizontal * 2;\n this.y0 = (this.vertical * 4) + 58;\n // current position of the player (x,y)\n this.x = this.x0;\n this.y = this.y0;\n this.winner = false;\n }", "function PlayerDaemon() {\n\tvar pub = {}; \n\tfunction getPlayer(obj) {\n\t\tvar id = obj.id;\n\t\tvar max = PlayerList.length;\n\t\tfor(var i=0; i< max; i++) {\n\t\t\tif(PlayerList[i].id == id) {\n\t\t\t\treturn(PlayerList[i]);\n\t\t\t}\n\t\t}\n\t}\n\tpub.init = function(obj) {\n\t\tgetPlayer(obj).init();\n\t}\n\tpub.cue = function(obj) {\n\t\tgetPlayer(obj).cue();\n\t}\n\tpub.play = function(obj) {\n\t\tvar player = getPlayer(obj);\n\t\tplayer.play();\n\t}\n\tpub.pause = function(obj) {\n\t\tgetPlayer(obj).pause();\n\t}\n\tpub.stop = function(obj) {\n\t\tgetPlayer(obj).stop();\n\t}\n\tpub.seek = function(obj, seconds) {\n\t\tgetPlayer(obj).seek(seconds);\n\t}\n\tpub.mute = function(obj) {\n\t\tgetPlayer(obj).mute();\n\t}\n\tpub.setTime = function(obj) {\n\t\tgetPlayer(obj).setTime(obj);\n\t}\n\t\n\tpub.volUp = function(obj) {\n\t\tgetPlayer(obj).volUp(obj);\n\t}\n\tpub.volDown = function(obj) {\n\t\tgetPlayer(obj).volDown(obj);\n\t}\n\tpub.setState = function(obj) {\n\t\tgetPlayer(obj).setState(obj);\n\t}\n\t//convert YouTubes state response into an object before sending it on to the player\n\tpub.setYTState = function(state, playerId) {\n\t\tvar obj = {};\n\t\tobj.id = playerId;\n\t\tswitch(state) {\n\t\tcase -1: //unstarted\n\t\t\tobj.newstate = \"IDLE\";\n\t\t\tbreak;\n\t\tcase 0: //ended\n\t\t\tobj.newstate = \"COMPLETED\";\n\t\t\tbreak;\n\t\tcase 1: //playing\n\t\t\tobj.newstate = \"PLAYING\";\n\t\t\tbreak;\n\t\tcase 2: //paused\n\t\t\tobj.newstate = \"PAUSED\";\n\t\t\tbreak;\n\t\tcase 3: //buffering\n\t\t\tobj.newstate = \"BUFFERING\";\n\t\t\tbreak;\n\t\tcase 5: //video cued\n\t\t\tobj.newstate = \"IDLE\";\n\t\t\tbreak;\n\t\t}\n\t\tpub.setState(obj);\n\t}\n\tpub.getCurrentTime = function(obj) {\n\t\treturn getPlayer(obj).getCurrentTime();\n\t}\n\tpub.getDuration = function(obj) {\n\t\treturn getPlayer(obj).getDuration();\n\t}\n\tpub.setBytes = function(obj) {\n\t\tgetPlayer(obj).setBytes(obj);\n\t}\n\tpub.getBytesLoaded = function(obj) {\n\t\treturn getPlayer(obj).getBytesLoaded();\n\t}\n\tpub.getBytesTotal = function(obj) {\n\t\treturn getPlayer(obj).getBytesTotal(obj);\n\t}\n\treturn pub;\n}", "function playerObject(){\n this.x = 50\n this.y = 100\n\n this.speed = 5\n\n this.lenth = 30\n this.height = 10\n this.dirleft = false\n\n this.display = function(){\n\t\tif (mouseY < 200) {\n\t\t\timage (up,this.x, this.y + this.height - 25 , 50,50);\n\t\t}\n\t\tif (mouseY > 200 && mouseY < 400){\n\t\t\t\timage(middle,this.x, this.y + this.height - 25 , 50,50);\n\t\t}\n\t\tif (mouseY > 400) {\n\t\t\timage (down,this.x, this.y + this.height - 25 , 50,50);\n\t\t}\n }\n this.move = function(){\n if(keyIsDown(83) && this.y < height-80){\n this.y = this.y + this.speed\n }\n if(keyIsDown(87) && this.y > 80){\n this.y = this.y - this.speed\n }\n }\n}", "function setupPlayer() {\n playerX = 4*width/5;\n playerY = height/2;\n playerHealth = playerMaxHealth;\n}", "function Player(name) {\n this.name = name;\n this.hand = [];\n}", "function Player(){\n this.name = \"shiva\" \n console.log(this)\n}", "function Player() {\n this.x = 0;\n this.y = 0;\n}", "function setupPlayer() {\n playerX = (4*width/5);\n playerY = (height/2);\n playerHealth = playerMaxHealth;\n}", "function Player(name, marker) {\n this.name = name\n this.marker = marker\n}", "play() {\n\t\tstaticCache.defouloir.play();\n\t\tthis._width = 1280; // TODO: remove\n\t\tthis._height = 720; // TODO: remove\n\t\tthis._player = new Player(this, this._width / 2, 0, \"Amos\");\n\t\tthis._interface = new Interface(this, this._player);\n\t\tthis._line = new DeathLine(this);\n\t\tthis._platforms = [];\n\t\tthis._bonuses = [];\n\t\tthis._decorations = [];\n\t\tthis._platformGenerator = new PlatformGenerator(this, this._player);\n\t\tthis._bonusGenerator = new BonusGenerator(this);\n\t\tthis._decorationGenerator = new DecorationGenerator(this, this._player);\n\t\tthis._color = \"#1e3514\";\n\t\tthis._select = initButton(true);\n\t\tthis._start = initButton(true);\n\t}", "function Player(options) {\n\t\tthis.playState = playstate;\n\t\tthis.theTrack = theTrack;\n\t\tthis.theQueue = theQueue;\n\t}", "function Player(px, py) {\n\tthis.sprite = new Sprite(sys_TEXTURES[0], 1, 1);\n\tthis.pos = new Vector2(px, py);\n\tthis.vel = new Vector2(0, 0);\n\tthis.acc = new Vector2(0, -7.5);\n\tthis.collision = new AABB(this.pos.x, this.pos.y, 80, 80);\n\tthis.collisionTime = 0;\n\tthis.boostFrames = 5; //boost for this number of frames\n\tthis.fallFrames = 0; //disable boosting for this number of frames\n\tthis.crashed = false;\n\tthis.aiControl = false; //enable to disable player input and move using only the fancy ai routines that took 10 years of research to create\n\t\n\tthis.trail = g_PARTICLE_MANAGER.reserve();\n\tif (this.trail) {\n\t\tParticleSystem.init_playerTrail(this.trail, g_SPRITE_CACHE.fx_playerTrail);\n\t\tthis.trail.priority = g_SCREEN.width * 2 + 1; //on top of player\n\t}\n\t\n\tPlayer.MAX_VELOCITY_Y = 450;\n}", "function Player(playerName) {\n this.playerName = playerName;\n this.roundScore = 0;\n this.totalScore = 100;\n}", "function Player(x, y){\n\n // position\n this.x = x;\n this.y = y;\n this.z=0;\n\n // size\n this.size = 50;\n\n // motion, direction\n this.vx =0;\n this.vy =0;\n this.speed =6;\n this.angle =0;\n\n // key controls\n this.downKey = 83;\n this.upKey = 87;\n this.leftKey = 65;\n this.rightKey = 68;\n this.strafeLeft = 81;\n this.strafeRight = 69;\n\n // animation variables\n\n // back leg motion\n this.legAngle = 0;\n // front leg motion\n this.legAngle2 = 0;\n // leg motion speed\n this.legRate =0.5;\n // tail motion along x and y axis\n this.tailXAngle =0;\n this.tailYAngle =0;\n // head bob\n this.headWobble = 0;\n // head bob speed\n this.wobbleRate = 0.2;\n\n // part sizes\n\n this.bodSize = this.size;\n this.headSize = this.size-20;\n this.tailSize = this.size-40;\n this.tailLength = this.size-30;\n this.eyeSize= this.size/10;\n this.earSize = this.size/7;\n this.legSize = this.size-35;\n this.noseSize = this.size-35;\n\n}", "function Player(_a) {\n var name = _a.name, core = _a.core, x = _a.x, y = _a.y, sprite = _a.sprite, levelState = _a.levelState;\n var _this = _super.call(this, { name: name, core: core, x: x, y: y, sprite: sprite, width: constants_1.default.playerSize, height: constants_1.default.playerSize }) || this;\n _this.levelState = levelState;\n _this.checkCollision = true;\n _this.health = constants_1.default.playerDefaultHealth;\n _this.phraseBook = _this.initPhraseBook();\n _this.harmPhraseBook = _this.initHarmPhraseBook();\n _this.addTouchControls();\n return _this;\n }", "function Player(username) {\r\n this.rolenode = svgdoc.getElementById(\"playerrole\");\r\n this.position = PLAYER_INIT_POS;\r\n this.motion = motionType.NONE;\r\n this.facing = facingDir.RIGHT;\r\n this.verticalSpeed = 0;\r\n this.namenode = svgdoc.getElementById(\"uid\")\r\n this.namenode.firstChild.data = username;\r\n this.name = username;\r\n}", "function Player(x,y,typePacman,xGhost,yGhost){\n\tthis.info= {\n\t\t'x':x,\n\t\t'y':y,\n\t\t'typePacman':typePacman,\n\t\t'numPasos':0,\n\t\t'fantasma': {\n\t\t\t'x':xGhost,\n\t\t\t'y':yGhost,\n\t\t},\n\t};\n\tthis.path = [];\n}", "get OSXPlayer() {}", "constructor() {\n // declare position variables\n this.xPos = 250;\n this.yPos = 250;\n\n // which graphic should the player be using right now?\n this.myGraphic = user_left;\n }", "function Player(x,y) {\n //LOCATION VARIABLES FOR LOAD\n this.x = playerX;\n this.y = playerY;\n //CHARACTER IMAGE - BOY RIGHT NOW; FUTURE ATTEMPT TO SELECT CHARACTER\n this.sprite = 'images/char-boy.png';\n}", "function Player(x, y) {\n\t// properties to determine player's x-y coordinates \n\tthis.x = x;\n\tthis.y = y;\n\t//property to specify player's stage\n\tthis.stage = 0;\n\t//property to store all available characters\n\tthis.playerChar = [\"images/char-boy.png\",\n\t\t \"images/char-cat-girl.png\",\n\t\t \"images/char-horn-girl.png\",\n\t\t \"images/char-pink-girl.png\",\n\t\t \"images/char-princess-girl.png\"];\n\t// property to specify player's character\n\tthis.sprite = \"images/char-boy.png\";\n}", "construct_player() {\n this.player = new Player(this);\n this.player.x = 208;\n this.player.y = 800;\n this.nubs = this.add.group();\n this.left_nub = this.physics.add.sprite(this.player.x - 17, this.player.y).setBodySize(3, 3);\n this.nubs.add(this.left_nub);\n this.right_nub = this.physics.add.sprite(this.player.x + 17, this.player.y).setBodySize(3, 3);\n this.nubs.add(this.right_nub);\n this.up_nub = this.physics.add.sprite(this.player.x, this.player.y - 17).setBodySize(3, 3);\n this.nubs.add(this.up_nub);\n this.down_nub = this.physics.add.sprite(this.player.x, this.player.y + 17).setBodySize(3, 3);\n this.nubs.add(this.down_nub);\n\n }", "function playerInfo(playerName, playerChoice) {\n this.name = playerName; // Player's name\n this.choice = playerChoice; // Player's choice\n}", "function Player(){\n //tank 1\n this.tank = null;\n this.turret = null;\n this.flame = null;\n this.bullet = null;\n\n // text for tank 1\n this.power = 300;\n this.powerText = null;\n this.angleText = null;\n this.score = 0;\n this.scoreText = null;\n this.nameText = null;\n\n // fake invisible tank for arcade physics\n this.fakeTank = null;\n }", "function Player() {\n this.isPlayingRecording = false;\n this.recordingFilename = \"\";\n }", "function Player(name) {\n this.name = name;\n this.isActive = false;\n this.moves = [];\n }", "function Play() {}", "function Player(identity, className, health, mana, strength, intellect, dexterity, baseDamage, skill1Name, skill2Name, exists) {\n MainObj.call(this, identity, health, mana, strength, intellect, dexterity, baseDamage);\n\n this.exists = exists;\n this.className = className;\n this.skill1Name = skill1Name;\n this.skill2Name = skill2Name;\n}", "function Player(name) {\n this.name = name;\n this.answered = 0;\n this.score = 0;\n this.scoresPerCat = {\n 'literature' : 0,\n 'geography' : 0\n };\n}", "function Player (id) {\n this.id = id;\n this.folder = 'opponents/'+id+'/';\n this.base_folder = 'opponents/'+id+'/';\n this.first = '';\n this.last = '';\n this.labels = undefined;\n this.folders = undefined;\n this.size = eSize.MEDIUM;\n this.intelligence = eIntelligence.AVERAGE;\n this.gender = eGender.MALE;\n this.stamina = 20;\n this.scale = undefined;\n this.tags = this.baseTags = [];\n this.xml = null;\n this.persistentMarkers = {};\n this.exposed = { upper: false, lower: false };\n}", "function Player(params) {\n params = params || {};\n var specialSlotsDefault = {\n FLIPPERS: null,\n FIRE_BOOTS: null,\n ROLLER_SKATES: null,\n ICE_SKATES: null,\n BLUE_KEY: null,\n RED_KEY: null,\n GREEN_KEY: null,\n YELLOW_KEY: null\n };\n\n this.worldPos = params.worldPos ? params.worldPos : new Vector();\n this.screenPos = params.screenPos ? params.screenPos : new Vector();\n this.specialSlots = specialSlotsDefault;\n _.merge(this.specialSlots, specialSlotsDefault, params.specialSlots);\n\n this.numberOfMicrochips = _.isNumber(params.numberOfMicrochips) ? params.numberOfMicrochips : 0;\n\n this.normalSprites = Utils.generateImageFromURLObject(Player.PLAYER_IMAGES, Player.NORMAL_SPRITE_SHEET);\n this.waterSprites = Utils.generateImageFromURLObject(Player.PLAYER_IMAGES, Player.WATER_SPRITE_SHEET);\n\n this.activeSpriteSheet = this.normalSprites;\n this.curSprite = params.curSprite ? params.curSprite : {\n x: 0,\n y: 0,\n w: Globals.TILE_SIZE,\n h: Globals.TILE_SIZE\n };\n\n this.itemsBack = Utils.generateImageFromURLObject(Tile.TILE_IMAGES, Tile.EMPTY);\n\n this.specialSlotsKeys = Object.keys(this.specialSlots);\n\n this.deathSound = new Sound({soundFile: Sound.DEATH});\n\n this.status = Globals.ALIVE;\n this.direction = Globals.DOWN;\n }", "function Player (name, wins, losses, ties)\n{\n\tthis.name = name;\n\tthis.wins = wins;\n\tthis.losses = losses;\n\tthis.ties = ties;\n}", "createPlayer() {\n let startWithBob = true;\n this.map.findObject('Player', (obj) => {\n if (obj.type === 'StartPosition') {\n if (obj.properties && obj.properties.hasOwnProperty('Start')) startWithBob = false;\n if (obj.name === 'Bob') {\n this.bob = new Bob(this, obj.x, obj.y);\n this.bob.depth = 100;\n this.game.Bob = this.bob;\n }\n if (obj.name === 'Flit') {\n this.flit = new Flit(this, obj.x, obj.y);\n this.flit.depth = 100;\n this.game.Flit = this.flit;\n }\n }\n });\n\n this.ActivePlayer = startWithBob ? this.game.Bob : this.game.Flit;\n this.cameras.main.startFollow(this.ActivePlayer);\n }", "function Player(pieceType, name) {\n\tthis.pieceType = pieceType;\n\tthis.random = new Random();\n\tthis.name = name;\n}", "function Player(name, age, country) {\n this.name = name;\n this.age = age;\n this.country = country;\n }", "function Player(fullName, str, dex, con, int, wis, luc) {\n this.Name = fullName\n this.Str = str;\n this.Dex = dex;\n this.Con = con;\n this.Int = int;\n this.Wis = wis;\n this.Luc = luc;\n var lvl = 1;\n this.lvl = lvl;\n this.Health = Math.floor((sModifier(con) + (lvl * 8)));\n}", "get players() { return this.#runtime_.players; }", "function Player(name, score) {\n this.name = name;\n this.score = score;\n}", "function Player (jetColor) {\n Jet.call(this, jetColor);\n \n this.topPressed = false;\n this.botPressed = false;\n\n}", "function Player(options) {\n var _this = this;\n\n _classCallCheck(this, Player);\n\n this.gramophone = new Gramophone(extend({}, doc.querySelector(\"[data-play]\").dataset, {\n complete: function () {\n return _this.status = \"stadingBy\";\n } }));\n this.recorder = new Recorder({\n player: this,\n lessonId: doc.querySelector(\"#player\").dataset.lessonid,\n complete: function (res) {\n return _this.status = \"recorded\";\n }, // use arrow function to bind player as scope\n playbackComplete: function () {\n _this.trackPlaying = false;\n },\n weChat: weChat });\n this.initControls();\n }", "function Player() {\n // Player location and size\n this.x = 200;\n this.lastX = this.x;\n this.y = 200;\n this.d = new Date();\n \n // Player state\n this.alive = true;\n this.health = 10;\n this.what = \"Player\";\n\tthis.id = 1;\n \n // Player image\n this.img = new Image();\n this.img.src = \"images/ship.png\";\n this.w = this.img.w;\n this.h = this.img.h;\n this.loaded = false;\n thatPlayer = this;\n this.img.onload = function() {\n thatPlayer.loaded = true;\n thatPlayer.w = thatPlayer.img.width;\n thatPlayer.h = thatPlayer.img.height;\n console.log(\"Player ship has been loaded.\");\n }\n \n // Player velocity\n this.v = {x: 0, y: 0};\n \n // Player thrust\n this.thrust = 5;\n \n // Weapons\n this.weapons = [];\n \n // Player bullets\n this.bullets = [];\n this.bulletSrc = \"images/bullet.png\"\n this.lastBulletTime = this.d.getTime();\n this.bulletDelay = 100;\n\tthis.currentBulletId = 0;\n \n //// NOTE: velocity and thrust are seperate, so movement can be\n //// quickly converted to momentum based if I decide to\n //// switch it in the future.\n}", "function Player(name, teamNumber, classNumber, posx, posy, yaw)\n {\n this.name = name;\n this.teamNumber = teamNumber;\n this.teamName = (teamNumber == 0) ? \"red\" : \"blu\";\n this.classNumber = classNumber;\n this.className = \n [\"unknown\",\n \"scout\",\n \"sniper\",\n \"soldier\",\n \"demoman\",\n \"medic\",\n \"heavy\",\n \"pyro\",\n \"spy\",\n \"engineer\"][classNumber];\n this.posx = posx;\n this.posy = posy;\n this.yaw = yaw;\n \n this.toString = function()\n {\n return \"<li>player: \" + this.name\n + \", \" + this.teamName\n + \", \" + this.className\n + \", posX: \" + this.posx\n + \", posY: \"+ this.posy\n + \", yaw: \" + this.yaw\n + \"</li>\";\n }\n }", "function defPlayer(){\n this.money = D(0);\n this.energy = D(1);\n this.powxp = D(0);\n this.skillalloc = D(0);\n this.poweralloc = D(0);\n this.powerunlocked = false;\n this.flawunlocked = false;\n this.stbxp = D(0);\n this.stablalloc = D(0);\n}", "get TizenPlayer() {}", "function Player(x, y) {\n this.x = x;\n this.y = y;\n this.sprite = 'images/char-cat-girl.png';\n}", "function playerLoop(){\n //...//\n }", "renderplayer(){\n if (this.player.currentqueue){\n this.player.play(`${this.player.class}attack`,true);\n } else if (this.player.hurt){\n this.player.play(`${this.player.class}hurt`,true)\n } else if (this.player.body.velocity.x < 0){\n this.player.flipX = false;\n this.player.anims.play(`${this.player.class}left`,true);\n } else if (this.player.body.velocity.x > 0){\n this.player.flipX = true;\n this.player.anims.play(`${this.player.class}left`,true);\n } else if (this.player.body.velocity.y > 0){\n this.player.anims.play(`${this.player.class}down`,true);\n } else if (this.player.body.velocity.y < 0){\n this.player.anims.play(`${this.player.class}up`,true);\n } else {\n this.player.anims.stop();\n }\n\n this.player.setDepth(this.player.y);\n }", "function sayHello(player) {\n console.log(\"Hello, \"+player.name);\n}", "function VideoPlayer(){}" ]
[ "0.8372533", "0.82054514", "0.81156886", "0.7723681", "0.7704507", "0.75308", "0.7361384", "0.73216426", "0.7306843", "0.7284678", "0.7252033", "0.7208359", "0.7190443", "0.71702045", "0.7161519", "0.7138468", "0.7138437", "0.71303004", "0.7102295", "0.7082613", "0.7039574", "0.7027921", "0.70269734", "0.70186645", "0.70185316", "0.70127374", "0.70079154", "0.70005167", "0.6960156", "0.69553167", "0.69341624", "0.69283754", "0.69249666", "0.69151515", "0.69142705", "0.6913105", "0.69105273", "0.69092965", "0.68703043", "0.68607056", "0.68607056", "0.6827397", "0.6825157", "0.6816576", "0.6816576", "0.6816576", "0.68146306", "0.6814308", "0.67957324", "0.6790866", "0.6772771", "0.6770507", "0.6762535", "0.67586815", "0.67501485", "0.67349535", "0.6734323", "0.6715827", "0.6709394", "0.67031544", "0.6696653", "0.66941386", "0.66884357", "0.6682793", "0.6681645", "0.6661282", "0.66507775", "0.66471344", "0.6646396", "0.66435015", "0.6638728", "0.663738", "0.66359186", "0.66348135", "0.6633807", "0.6627281", "0.6626085", "0.6624698", "0.6621856", "0.6617172", "0.6605851", "0.65860176", "0.65813196", "0.65691215", "0.6554966", "0.6551726", "0.6546215", "0.6533965", "0.6531648", "0.6526037", "0.6524107", "0.65165573", "0.6510766", "0.6504462", "0.64983153", "0.6491761", "0.6485197", "0.6479265", "0.6470306" ]
0.69068617
39
The size of a monster Should be executed after the page is loaded
function load() { // Attach keyboard events document.addEventListener("keydown", keydown, false); document.addEventListener("keyup", keyup, false); // Create the player player = new Player(); // Create the monsters createMonster(200, 15); createMonster(400, 270); // Start the game interval gameInterval = setInterval("gamePlay()", GAME_INTERVAL); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateSize() {\n let gameArea = document.getElementById(\"game\");\n let tileProportion = 10;\n h = Math.floor(gameArea.clientHeight * 0.9);\n w = Math.floor(gameArea.clientWidth * 0.9);\n size = Math.min(h, w);\n style = gameArea.style;\n style.setProperty(\"--proportion\", `${tileProportion}`);\n style.setProperty(\"--size\", `${size}px`);\n}", "function GetSizeItem() {\n an.size = {\n 'OuterWidth': M.OuterWidth($anim),\n 'OuterHeight': M.OuterHeight($anim)\n };\n }", "function Size() {\n if (992 <= body.width()) {\n Loading();\n } else if (1200 <= body.width()) {\n Loading();\n Loading();\n }\n }", "function SizeGauge()\n{\n\t// set up the speedo size\n\tlet gauge = document.getElementById(\"speedGauge\");\n\n\t// set height\n\tvar speedGaugeHeight = $(\"#speedGaugeDiv\").css('height');\n\tspeedGaugeHeight = speedGaugeHeight.substring(0, speedGaugeHeight.length - 2);\n\n\t// set width\n\tvar speedGaugeWidth = $(\"#speedGaugeDiv\").css('width');\n\tspeedGaugeWidth = speedGaugeWidth.substring(0, speedGaugeWidth.length - 2);\n\n\t// update attributes\n\tgauge.setAttribute(\"data-height\", `${speedGaugeHeight}`);\n\tgauge.setAttribute(\"data-width\", `${speedGaugeWidth}`);\n}", "updateSize() {\n this.w = this.ent.width + this.wo;\n this.h = this.ent.height + this.ho;\n }", "function sizeOfSquare(){\n\t\n\tvar div = document.getElementById('roundSquare_races');\n\t\n\tif(sizePerRace > 1)\n\t\tdiv.style.height = sizePerRace * numberOfRaces + 'px';\n\t\n\tif(sendOnce){\n\t\tsendOnce = false;\n\t\tsend();\n\t}\n}", "function initSize(){\n\t\t$this.css({\n\t\t\twidth\t: params.width,\n\t\t\theight\t: params.height\n\t\t});\n\t\t\n\t\t$('body').css({\n\t\t\twidth\t: params.width,\n\t\t\theight\t: params.height\n\t\t});\n\n\t\t$this.find('.lsd-box').each(function(){\n\t\t\t$(this).css({\n\t\t\t\twidth\t: params.width,\n\t\t\t\theight\t: params.height\n\t\t\t});\n\t\t});\n\n\t\t\n\t}", "function get_size() {\r\n\tK.height = document.body.clientHeight\r\n\tK.width = document.body.clientWidth\r\n}", "function getSize() {\n var width = $('body').width() * window.devicePixelRatio;\n\n size = 'large';\n if (width < 800){\n size = 'small';\n } else if (width < 1800){\n size = 'medium';\n }\n return size;\n}", "function loadPage()\n{\n view.displayLength();\n}", "_size() {\n const scaleRatio = (window.innerHeight) / (this.gameBoard.height + 2 * config.board.padding);\n this.renderer.resize(window.innerWidth, window.innerHeight);\n this.gameBoard.height *= scaleRatio;\n this.gameBoard.width *= scaleRatio;\n this.gameBoard.position.set((this.screen.width / 2) - (this.gameBoard.width / 2), config.board.padding);\n }", "function onPageLoad()\n{\n\t//Set page size\n\tSetSize();\n}", "getSize() {\n // YOUR CODE HERE\n }", "function sizeInit(url){\n\n\toverlay = new Element('div', {\n\t\t'id':'mbOverlay',\n\t\t'styles':{ 'opacity': 0.75 },\n\t\t'events':{ 'click' : sizeKill }\n\t}).inject($(document.body));\n\n\tpp = new Element('div', {\n\t\t'id' : 'overSize',\n\t\t'class' : 'overlayPanel'\n\t}).inject($(document.body));\n\n\tii = new Element('iframe', {\n\t\t'src'\t\t\t: myPath+'ressource/lib/media.size.php?src='+url,\n\t\t'height'\t\t: '100%',\n\t\t'width'\t\t\t: '100%',\n\t\t'frameborder'\t: '0'\n\t}).inject(pp);\n\n}", "sizePage() {\n this['$content'].width =\n this['$content'].columns.average * this['$content'].data[0].length;\n this['$content'].height =\n this['$content'].rows.average * this['$content'].data.length;\n this['$container'].setAttribute({\n 'style':\n `height:\n ${this['$content'].height}px;\n width:${this['$content'].width}px;`,\n });\n }", "findSize() {\n var height = window.innerHeight - 180;\n var width = window.innerWidth;\n this.csize = height/width > 1 ? Math.floor(0.9 * width / 4) : Math.floor(0.9 * height / 4);\n }", "updateSize() {\n windowWidth = Math.min(\n this.handler.getMaxGameWidth(),\n window.innerWidth\n )\n windowHeight = Math.min(\n this.handler.getMaxGameHeight(),\n window.innerHeight\n )\n this.handler.getGame().setWidth(windowWidth)\n this.handler.getGame().setHeight(windowHeight)\n }", "function getSize(d) {\n return 750;\n}", "function OCM_materialSize() {\r\n\t\t\t\t\tif ($('.ocm-effect-wrap.material-ocm-open').length > 0) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$('.ocm-effect-wrap').css({\r\n\t\t\t\t\t\t\t'height': $window.height()\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$('.ocm-effect-wrap-inner').css({\r\n\t\t\t\t\t\t\t'padding-top': nectarDOMInfo.adminBarHeight\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "function increase_ball_size()\r\n{\r\n\t// the object is to co-ordinate the functions to increase the ball's size and record it\r\n\tball_size(\"increase\");\r\n\t//variable_content_viewer();\r\n\tdisplay();\r\n}", "function measure() {\n\t\t\n\t\t// Call our validate routine and make sure all component properties have been set\n\t\tviz.validate();\n\t\t\n\t\t// Get our size based on height, width, and margin\n\t\tsize = vizuly2.util.size(scope.margin, scope.width, scope.height, scope.parent);\n\t\t\n\t\tscope.size = size;\n\t\t\n\t\t// Tell everyone we are done making our measurements\n\t\tscope.dispatch.apply('measured', viz);\n\t\t\n\t}", "getSize() {\n console.log(this.size);\n }", "updateSize() {\n const _style = window.getComputedStyle(this.track);\n const inheritedFontSize = _style['font-size'];\n\n this.track.style.setProperty('--simple-switch_size', inheritedFontSize);\n }", "get size() {\n return this.uniforms.size.value;\n }", "function updateElementSize() {\n\t\tconst size = window.innerWidth / (seriesHidden ? 20 : 35.7);\n\t\tdocument.documentElement.style.setProperty(\"--element-size\", size + \"px\");\n\t}", "setPxSizes() {\n var px_per_em = this.getEmSize( this.jqueryMap.$container.get(0) );\n\n this.stateMap.px_per_em = px_per_em;\n this.stateMap.alone_height_px = this.configMap.alone_height_em * px_per_em;\n this.stateMap.other_height_px = this.configMap.other_height_em * px_per_em;\n }", "setRoomSize(){\n $('#roomHolder').height(document.body.offsetHeight-60);\n }", "_size_elements () {\n\n\t\tvar w = this.context.canvas.width\n\t\tvar h = this.context.canvas.height\n\t\tvar cw = this._deck_blue ['musician']._face_img.width\n\t\tvar ch = this._deck_blue ['musician']._face_img.height\n\n\t\tvar scale_x = (w * 0.9 / 8.0) / cw\n\t\tvar scale_y = (h / 4.0) / ch\n\t\tvar scale = Math.min (scale_x, scale_y)\n\n\t\tfor (var name in this._deck_blue) {\n\t\t\tthis._deck_blue [name].set_size (cw * scale)\n\t\t}\n\t\tfor (var name in this._deck_red) {\n\t\t\tthis._deck_red [name].set_size (cw * scale)\n\t\t}\n\t}", "function setsize() {\n\tvar sizes = $(\".well input[name='size']\").val().split(\"x\");\n\t// add properties to object and store for future play\n\tCW.sizex = sizes[0];\n\tCW.sizey = sizes[1];\n\tlocalStorage[\"sizex\"] = sizes[0];\n\tlocalStorage[\"sizey\"] = sizes[1];\n\tlocalStorage[\"black\"] = CW.black;\n\tlocalStorage[\"blank\"] = CW.blank;\n\t$(\".well > h3\").text(\"Generator for \" + CW.sizex + \"x\" + CW.sizey + \" Crossword Puzzle\")\n\t$(\".word\").toggle(\"slow\");\n\t$(\".form-inline\").hide();\n\tevent.preventDefault();\n}", "function changePlayerSize (size) {\n humanPlayer.size = size;\n\n $sizeBlocks.removeClass(eSize.SMALL + ' ' + eSize.MEDIUM + ' ' + eSize.LARGE).addClass(size).attr('data-size', size);\n}", "function playerStatsWeb() {\n var playerHealth = document.getElementById('player-health');\n playerHealth.innerHTML = \"❤️ Health: \" + player.health;\n\n var playerStamina = document.getElementById('player-stamina');\n playerStamina.innerHTML = \"⚡ Stamina: \" + player.stamina;\n\n var playerPots = document.getElementById('player-potion');\n playerPots.innerHTML = \"⚗️ Potions: \" + player.potions;\n\n var playerMonsters = document.getElementById('remaining-monsters');\n playerMonsters.innerHTML = \"👹 Enemies: \" + (remainingEnemies.length - 1); // game ends when there's only 1 monster left.\n} //this is run after every scene to update the screen.", "function _resize(size){\n var sz = (size < 100) ? sz = 100 : sz = size;\n placeholder.each(function(){\n $(this).find('div.instrument').css({height : sz, width : sz});\n });\n }", "function pageLoad() {\n nSCV('hdnPageHgt', screen.height);\n}", "function sizer(){\n //update object\n å.screen.x = window.innerWidth;\n å.screen.y = window.innerHeight;\n //update canvas size\n canvas.width = å.screen.x;\n canvas.height = å.screen.y;\n}", "function resizeIt(magnification)\r\n\r\n{var new_layout_width=(original_size.w*magnification)+layout_width_offset;\r\n layout.style.width=new_layout_width.toString()+\"px\";\r\n embed_tag.setAttribute(\"width\",original_size.w*magnification);\r\n\r\n embed_tag.setAttribute(\"height\",original_size.h*magnification);\r\n\r\n}", "function _calculateSize() {\r\n contentWidth = parseInt($(\"#\" + divid).width());\r\n contentHeight = parseInt($(\"#\" + divid).height());\r\n $(\"#\" + divid).remove();\r\n sizeGetCallback(contentOrJQObj, _getLayerPos(clientSize, { Width: contentWidth, Height: contentHeight }));\r\n }", "function setPlantImageSize() {\n\t$(\".beds\").each(function() {\n\t\tconsole.log(\"Bed image count: \" + $(this).children(\"img\").length);\n\t});\n}", "function resize() {\n\n const bodyWidth = parseInt(getComputedStyle(document.body).width.slice(0, -2), 10);\n\n if (bodyWidth < screenWidth) { //TODO fix width change\n screenWidth = bodyWidth;\n screenHeight = screenWidth / roadWidthSegments * roadHeightSegments;\n } else {\n screenHeight = parseInt(getComputedStyle(domElement).height.slice(0, -2), 10);\n screenWidth = Math.floor(screenHeight / roadHeightSegments * roadWidthSegments);\n }\n\n squareWidth = Math.floor(screenWidth / roadWidthSegments);\n screenWidth = roadWidthSegments * squareWidth; // pixel perfect :v\n\n domElement.setAttribute('height', screenHeight);\n domElement.setAttribute('width', screenWidth);\n\n render();\n }", "function assetOnloadFun()\n{\n\t//disableAll();\n\tvar layoutHght = document.getElementById('layoutSkeleton');\n\tlayoutHght.style.height = parseInt(getHeight())-110+'px';\n\thideLoader();\n\t\n}//end of assetOnloadFun", "function getmonster() {\n\tnewmonster = Math.ceil((Math.random() * monsters) - 1);\n\tdocument.getElementById(\"monsterimg\").src = imgArray[newmonster].src;\n\tmonsterhp = monstermax + Math.ceil(Math.random() * Math.ceil(monstermax/8)) - Math.ceil(Math.random() * Math.ceil(monstermax/8));\n\tmonsterhealth = monsterhp;\n\tmonsterbar();\n\tdocument.getElementById(\"monster\").innerHTML = monsterhealth;\n\tdeadmonsterflag = false;\n}", "function getSize() {\n size = $( \"#maintext\" ).css( \"font-size\" );\n size = parseInt(size, 10);\n $( \"#font-size\" ).text( size );\n}", "function onIncreaseFontSize() {\n increaseFontSize()\n let elFont = document.querySelector('.font-size-display')\n elFont.innerHTML = gMeme.currText.size\n draw()\n}", "function onPageLoad()\n\t{\n\t\t//Set page size\n\t\tSetSize();\n\t\tloadPreferences();\n\t}", "function screenResizeHandler() {\n\n\t\t// resize the div by css, returns the new size\n\t\tgameDivSize = screenSize(gameDiv, Config.boardRatio);\n\n\t\t// change canvas size by pixels\n\t\tgameDiv.width = gameDivSize.x;\n\t\tgameDiv.height = gameDivSize.y;\n\n\t\t// resize the title div by css\n\t\tscreenSize(titleDiv, Config.boardRatio);\n\n\t\t// scale text\n\t\t$(titleDiv).css(\"font-size\", 52/500*gameDivSize.x+\"px\");\n\t\t$(\"#title button\").css(\"font-size\", 22/500*gameDivSize.x+\"px\");\n\t}", "get size () {\r\n return this.getAttribute('size')\r\n }", "function getSize() {\n setScreenHeight(window.innerHeight);\n setScreenWidth(window.innerWidth);\n }", "size() {\n return __awaiter(this, void 0, void 0, function* () {\n const size = yield (yield this.element()).getSize();\n const point = new point_1.Point(size.height, size.width);\n return point;\n });\n }", "calculateSize() {\n if (typeof this.size === 'number') {\n this.actualsize = this.size;\n } else if (this.size.toLowerCase().endsWith('px')) {\n this.actualsize = parseInt(this.size);\n if (isNaN(this.actualsize)) {\n console.error(`RadialProgressMeter: provided invalid size: ${this.size}`);\n this.actualsize = 200;\n }\n } else if (this.size.toLowerCase().endsWith('em')) {\n this.actualsize = (CFBUtils.getSingleEmInPixels() * parseInt(this.size));\n if (isNaN(this.actualsize)) {\n console.error(`RadialProgressMeter: provided invalid size: ${this.size}`);\n this.actualsize = 200;\n }\n } else {\n switch(this.size) {\n case 'small':\n this.actualsize = 100;\n break;\n case 'large':\n this.actualsize = 400;\n break;\n case 'huge':\n this.actualsize = 800;\n break;\n case 'medium':\n default:\n this.actualsize = 200;\n break;\n }\n }\n\n // Now we parse a size class\n if (this.actualsize >= 800) {\n this.sizeclass = 'huge';\n } else if (this.actualsize >= 400) {\n this.sizeclass = 'large';\n } else if (this.actualsize >= 200) {\n this.sizeclass = 'medium';\n } else if (this.actualsize >= 100) {\n this.sizeclass = 'small';\n } else {\n this.sizeclass = 'tiny';\n }\n }", "function setSize()\n\t\t{\n\t\t\t//console.log(width, height, height/width);\n\t\t\n\t\t\t/*\n\t\t\tthat.css({\n\t\t\t\twidth : w + '%',\n\t\t\t\tpaddingTop : height/width * w + '%',\n\t\t\t\tposition : 'relative'\n\t\t\t});\n\t\t\t*/\n\t\t\t\n\t\t\t/*\n\t\t\tthat.css({\n\t\t\t\twidth : width,\n\t\t\t\theight : height\n\t\t\t});\n\t\t\t\n\t\t\tdiv_wrapper.css({\n\t\t\t\twidth :width ,\n\t\t\t\theight : height\n\t\t\t});\n\t\t\t*/\n\t\t\t\n\t\t\tdiv_ratio.css({\n\t\t\t\twidth : '100%',\n\t\t\t\tpaddingTop : height/width * 100 + '%'\n\t\t\t});\n\t\t}", "function setMapSize() {\n detail = +document.getElementById(\"detail\").value;\n ctx.canvas.width = document.getElementById(\"width_slider\").value;\n ctx.canvas.height = document.getElementById(\"height_slider\").value;\n}", "function utilSize () {\n var contentWidth = $('.poem-home').width();\n $('#utils').width(contentWidth + 10);\n }", "function sizeMap()\n{\n $(\"iframe\").height($(\"iframe\").width());\n}", "getSize(){\n console.log('Size:', this.size);\n }", "setSize(size) {\n this.size = size;\n }", "function largeMagazineWidth() {\n\t\n\treturn 2214;\n\n}", "get size() {\n\t\treturn this.nativeElement ? this.nativeElement.size : undefined;\n\t}", "function randomSize() {\n\n //generating random number to the size-class\n var size_class = Math.floor(Math.random() * 4)\n\n //Switch/Case to change the size of the element html (mosquito), accordind to the var size_class\n switch (size_class) {\n\n case 0:\n\n //Size 40px x 40px\n return 'mosquito'\n\n case 1:\n\n //Size 50px x 50px\n return 'mosquito-pequeno'\n\n case 2:\n\n //Size 70px x 70px\n return 'mosquito-medio'\n\n case 3:\n\n //Size 90px x 90px\n return 'mosquito-grande'\n\n }\n\n}", "function CheckSize()\n{\n var oBackground = document.getElementById(\"imgBackground\");\n var oBody = document.body.style;\n if (System.Gadget.docked)\n {\n // \"Docked\" translates to \"Small View\"\n oBody.width = gadgetSmallWidth;\n oBody.height = gadgetSmallHeight;\n\t\n oBackground.src = \"../images/bg_docked.png\";\n \n txtSize.innerText = 'Small View';\n txtSize.className = 'gadgetSmall';\n }\n else\n {\n // \"Undocked\" translated to \"Large View\"\n oBody.width = gadgetLargeWidth;\n oBody.height = gadgetLargeHeight;\n \n oBackground.src = \"../images/bg_undocked.png\";\n\n txtSize.innerText = 'Large View';\n txtSize.className = 'gadgetLarge';\n }\n}", "getSize() {\n return {width: this._width, height: this._height};\n }", "function setTextSize() {\n css.header['font-size'] = (style.size + 2) + 'px';\n css.smallText['font-size'] = (style.size - 4) + 'px';\n css.main['font-size'] = style.size + 'px';\n css.listItem['font-size'] = style.size + 'px';\n css.button['font-size'] = style.size + 'px';\n css.verse.number['font-size'] = style.size + 'px';\n $rootScope.$broadcast('css:changed');//this lets all of the controllers know that the css object has changed\n }", "get size() {\n\t\treturn wm.get(this).size;\n\t}", "function resizeHeightPage() {\n\t\tvar newSizeH = sizeWin-recalculPadding(pages);\n\t\tconsole.log(newSizeH);\n\t\tpages.css({\"min-height\":sizeWin});\n\t}", "function monsterbar() {\n var elem = document.getElementById(\"monsterbar\"); \n\tif (monsterhealth > 0) {\t\t\t\n\t\tvar mwidth = monsterhealth/monsterhp * 100;\n\t} else {\n\t\tvar mwidth = 0;\n\t}\n\telem.style.width = mwidth + '%';\n}", "function updateSize(newSize) {\n // FINISH ME! Set the width of the MEET logo to be newSize in pixels.\n\t$(\"img\").eq(0).css(\"width\", newSize);\n}", "static getCardSizeFromSprite() {\n return {\n width: 81,\n height: 117.5\n };\n }", "function getSizes()\n {\n sizes.field.rows = 3;\n sizes.field.cols = 6;\n\n sizes.desk.height = DOM.parent.offsetHeight / 3;\n sizes.desk.width = properties.coverSize.width * sizes.desk.height / properties.coverSize.height;\n sizes.deskContainer.marginBottom = sizes.desk.width / 2;\n\n sizes.card.height = DOM.parent.offsetHeight / 4.5;\n sizes.card.width = properties.coverSize.width * sizes.card.height / properties.coverSize.height;\n }", "function loadMapDimensions(){\r\n\tMAP_WIDTH = 3000; //656000; //hardcoded for now\r\n\tMAP_HEIGHT = 3000; //656000; //hardcoded for now\r\n\tvar map_div = $('map');\r\n\tmap_div.style.width = MAP_WIDTH + \"px\";\r\n\tmap_div.style.height = MAP_HEIGHT + \"px\";\r\n\tmap_div.className = \"map_default\";\r\n\tdocument.getElementById(\"map_height\").innerHTML = MAP_HEIGHT;\r\n\tdocument.getElementById(\"map_width\").innerHTML = MAP_WIDTH;\r\n}", "function largeMagazineWidth() {\n\treturn 1844;\n}", "function initialSize() {\r\n let iwidth = $('#iframe').width();\r\n let iheight = iwidth * (0.5625); // 16:9 ratio //\r\n $('#iframe').height(iheight);\r\n }", "scale(size) {\n document.getElementById(\"guiArea\").style.width = size + \"px\";\n }", "getDrawSize () {\r\n return Math.ceil(this.calories / this.gestation * 10)\r\n }", "function changeToSize(size) {\n setMedia();\n media.height = size;\n var ratio = media.videoWidth / media.videoHeight;\n $('#media-bench').width(media.height * ratio);\n trjs.editor.resizeTranscript();\n }", "setSize() {\n this.size.D1 = this.shape.D1*this.unit.X;\n this.size.D2 = this.shape.D2*this.unit.Y;\n }", "renderInfo() {\n if (this.state.muscle === \"Hamstrings\") {\n return (\n <SizeMe\n monitorHeight\n refreshRate={128}\n refreshMode=\"debounce\"\n render={({ size }) => (\n <div\n className=\"pdfwrapper\"\n style={{ height: \"size.height !important\" }}\n >\n <Document\n file={Hamstrings}\n onLoadError={console.error}\n className=\"infopdf\"\n >\n <Page\n width={size.width / 2}\n pageNumber={1}\n className=\"infopageone\"\n ></Page>\n <Page\n width={size.width / 2}\n pageNumber={2}\n className=\"infopagetwo\"\n ></Page>\n </Document>\n </div>\n )}\n />\n );\n }\n }", "function size(d) {\n\n switch (d.nodeType) {\n case \"likerNode\":\n return Math.sqrt(d.size) * 5 || 6;\n case \"taggedNode\":\n return Math.sqrt(d.size) * 5 || 4;\n case \"postNode\":\n return Math.sqrt(d.size) * 5 || 4.5;\n case \"coreNode\":\n return 20;\n case \"year\":\n return Math.sqrt(d.size) / 5 || 8;\n default:\n return Math.sqrt(d.size) * 5 || 4.5;\n }\n }", "function displayHeight () {\n const sealevel = document.getElementById(\"sea-level\");\n sealevel.innerHTML = Math.floor(diveHeight);\n\n const conv = document.getElementById(\"conversion-rate\");\n conv.innerHTML = convRate;\n }", "setSize(size) {\n this.size = size;\n }", "function handleSize() {\n const height = document.getElementById('image').clientHeight\n console.log(height)\n setHeight(-height)\n }", "set size(value) {}", "function findSize() {\n\t// pobiera wysokosc szerokosc okna\n\tvar height = $(window).height();\n\tvar width = $(window).width();\n\n\t// wysokosc i szerokosc 2panelow: na gorze i po prawej\n\tvar heightTopPanel = $(\".topPanelContainer\").height() + 70;\n\tvar widthInfoPanel = $(\".infoPanelContainer\").width() + 44;\n\n\t// ustawia wielkosci panelow mapy i info\n\t$(\".mapa\").height(height - heightTopPanel);\n\t$(\".infoPanelContainer\").height(height - heightTopPanel);\n\t$(\".mapa\").width(width - widthInfoPanel);\n}", "function resizeHandler() {\n\tfor( let world of worlds ) {\n\t\tlet parent_elem = world.renderer.domElement.parentNode;\n\t\tlet w = parent_elem.clientWidth;\n\t\tlet h = parent_elem.clientHeight;\n\t\tworld.Resize( w, h );\n\n\t}\n}", "load(callback) {\n this.getSizes(callback);\n }", "function setFontSize(s){\n\t\tvar size = s + \"px\";\n\t\t$('#display').css('font-size', size);\n\t}", "getSize() {\n\t\treturn {\n\t\t\twidth: this.width,\n\t\t\theight: this.height\n\t\t};\n\t}", "function calcElementsSize(){\r\n\t\r\n\tvar bodyHeight = window.innerHeight;\r\n\t// partimos del ancho como referencia para obtener cosas \"cuadradas\"\r\n\tvar boardWidth = $('.detail-panel').width();\r\n\t// Asignamos el height deseado a las fuentes\r\n\t$('.detail-panel').css({'font-size':((boardWidth*1/4)/4)+'px'});\r\n\t$('.detail-panel').css({'line-height':(((boardWidth*1/4)/4)+2)+'px'});\r\n\t$('.money-gold, .money-silver, .money-copper').css({'background-size':((boardWidth*1/5)/3)+'px '+((boardWidth*1/5)/3)+'px'});\r\n\t$('.money-gold, .money-silver, .money-copper').css({'padding-right':((boardWidth*1/5)/3)+'px'});\r\n}", "function changesize(h,sq,intv,tm) {\n chartx.chart.height = h ;\n standWD(sq) ;\n initChart(sq,intv,tm) ;\n\n // setTimeout( chart.setSize(null,h) ,500);\n}", "getSize() {\n return this._node.__execute(() => this.element.getElementSize());\n }", "function placar(){\n $(\".trocaPontos\").html(snake.size*10);\n}", "setCardHeight(){\n const UIflashcard = document.querySelector('#flash-card');\n let cardWidth = UIflashcard.offsetWidth;\n let setHeight = cardWidth / 1.666666666667;\n UIflashcard.style.height = `${setHeight}px`;\n}", "_onChangeSize() {\n\t\t\t\tthis.collection.changeSize(this.model.get('width'), this.model.get('height'));\n\t\t\t\tthis._saveSize(this.model.get('width'), this.model.get('height'));\n\t\t\t\tthis.render();\n\t\t\t}", "function skill_width(){\n setTimeout(\n () => {\n var r = new Rocker(1024.0, 800.0);\n x=((r.PAGE_WIDTH*10)/100);\t\t//value is 102.40\n\ty=0;\n console.log(\"x-axis=\"+x);\n draw_geometry();\n },\n 0\n );\n}", "function SetMapSize() {\n document.documentElement.style.setProperty('--boardX', boardSize.x);\n document.documentElement.style.setProperty('--boardY', boardSize.y);\n}", "function getNextSize() {\n var lSum = $('#video-panel .small').length * smallRadius * smallRadius * 5;\n var sSum = $('#video-panel .large').length * largeRadius * largeRadius * 10;\n var largeP = 1 / ((lSum + sSum) / $('#video-panel').width() / $(\n '#video-panel').height() + 1) - 0.5;\n if (Math.random() < largeP) {\n return 'large';\n } else {\n return 'small';\n }\n}", "function setSizes()\n {\n if (DOM.container.offsetHeight > DOM.container.offsetWidth)\n {\n DOM.container.style.minWidth = DOM.container.offsetHeight + \"PX\";\n }\n\n desk.style.height = sizes.desk.height + \"PX\";\n desk.style.width = sizes.desk.width + \"PX\";\n desk.style.marginBottom = sizes.deskContainer.marginBottom + \"PX\";\n\n for (var counterRow = 0; counterRow < sizes.field.rows; counterRow++)\n {\n for (var counterCol = 0; counterCol < sizes.field.cols; counterCol++)\n {\n DOM.game.field.rows[counterRow].cells[counterCol].style.height = sizes.card.height + \"PX\";\n DOM.game.field.rows[counterRow].cells[counterCol].style.width = sizes.card.width + \"PX\";\n\n var card = cards[counterRow * sizes.field.cols + counterCol];\n if (card)\n {\n card.style.height = sizes.card.height + \"PX\";\n card.style.width = sizes.card.width + \"PX\";\n }\n }\n }\n }", "getSize () {\n return this.traitMax('size');\n }", "function updateMetrics() {\n\n isVwDirty = false;\n DPR = window.devicePixelRatio;\n cssCache = {};\n sizeLengthCache = {};\n\n pf.DPR = DPR || 1;\n\n units.width = Math.max(window.innerWidth || 0, docElem.clientWidth);\n units.height = Math.max(window.innerHeight || 0, docElem.clientHeight);\n\n units.vw = units.width / 100;\n units.vh = units.height / 100;\n\n evalId = [ units.height, units.width, DPR ].join(\"-\");\n\n units.em = pf.getEmValue();\n units.rem = units.em;\n }", "function displayResize(evt) {\n var available_height = window.innerHeight - 100,\n available_width = window.innerWidth;\n var tmp_square_height = available_height >> 3,\n tmp_square_width = available_width / 11.5;\n var tmp = tmp_square_height > tmp_square_width ?\n tmp_square_width : tmp_square_height;\n var tmp_square = tmp < 30 ? 30 : tmp;\n game.render_elements(tmp_square, tmp_square);\n var pieces = game.elements.pieces;\n for (var y = 9; y > 1; y--){\n for(var x = 1; x < 9; x++){\n var i = y * 10 + x;\n pieces[i].height = tmp_square;\n pieces[i].width = tmp_square;\n }\n }\n}", "function SizeDependRate() {\n if (wInline == 'auto')\n style.width = wInline;\n else if ($.isNumeric(wInline))\n style.width = M.R(wInline * rate);\n else\n style.width = M.R(iData.width * rate);\n if (hInline == 'auto')\n style.height = hInline;\n else if ($.isNumeric(hInline))\n style.height = M.R(hInline * rate);\n else\n style.height = M.R(iData.height * rate);\n $imgItem.css(style);\n }", "refreshFontSize() {\n\t\tvar size = this.savedFontSize;\n\t\tsize = size * renko.getWindowScale();\n\t\tsize = size * (2 / window.devicePixelRatio);\n\t\tthis.style.fontSize = String(size) + \"px\";\n\t}", "function createSizeVariable(response) {\n return __awaiter(this, void 0, void 0, function () {\n var renderer, sizeResponse;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n renderer = response.renderer;\n return [4 /*yield*/, sizeRendererCreator.createVisualVariables({\n layer: layer,\n field: \"MINORITYCY\",\n basemap: map.basemap,\n view: view,\n worldScale: true,\n axis: \"height\"\n })];\n case 1:\n sizeResponse = _a.sent();\n renderer.visualVariables = sizeResponse.visualVariables;\n return [2 /*return*/, renderer];\n }\n });\n });\n }", "getHeight(){return this.__height}" ]
[ "0.6475332", "0.6262211", "0.6249719", "0.6245064", "0.6214904", "0.6213394", "0.61643857", "0.61216956", "0.6117641", "0.6086967", "0.60794735", "0.6063296", "0.60502243", "0.6033451", "0.6028427", "0.59597415", "0.5924086", "0.5908016", "0.587726", "0.58578014", "0.5835223", "0.5790392", "0.57834584", "0.57731473", "0.577295", "0.5761528", "0.57387084", "0.57385916", "0.57349885", "0.57258105", "0.5716495", "0.5696734", "0.56907666", "0.56797737", "0.5677982", "0.566815", "0.56633115", "0.5656898", "0.5656482", "0.5649954", "0.5649774", "0.5646397", "0.5622991", "0.56079155", "0.5605881", "0.56038296", "0.56003165", "0.559724", "0.5596393", "0.5595233", "0.5592064", "0.5590877", "0.55905145", "0.5589749", "0.55832475", "0.55823153", "0.5576772", "0.55765474", "0.557592", "0.55704784", "0.5568534", "0.5568336", "0.55557173", "0.55543226", "0.5554075", "0.55510694", "0.55474097", "0.55453", "0.5537421", "0.5534718", "0.5526838", "0.55188614", "0.55161077", "0.5515958", "0.55134815", "0.5512107", "0.55120957", "0.55102307", "0.5506703", "0.5501348", "0.5495049", "0.5485675", "0.5484333", "0.54800475", "0.54798174", "0.54790944", "0.54787695", "0.5474305", "0.5468059", "0.5463633", "0.54629654", "0.5461426", "0.54609644", "0.5460917", "0.54596555", "0.54506034", "0.54468316", "0.5442158", "0.5441169", "0.54398435", "0.54350066" ]
0.0
-1
This function creates the monsters in the game
function createMonster(x, y) { var monster = document.createElementNS("http://www.w3.org/2000/svg", "use"); monster.setAttribute("x", x); monster.setAttribute("y", y); monster.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#monster"); document.getElementById("monsters").appendChild(monster); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function spawnMonsters(){\n\n if (frameCount % 60 === 0 ){\n var monsters = createSprite(600,170,10,40);\n\n monsters.velocityX = -12\n\n\n var rand = Math.round(random(1,2));\n switch(rand) {\n case 1: monsters.addImage(turtleImg);\n break;\n case 2: monsters.addImage(vectorImg);\n break;\n default: break\n }\n\n monsters.lifetime = 300;\n\n monsterGroup.add(monsters)\n\n monsters.scale=1.5\n \n }\n}", "function createSeaMonsters(room) {\n const numMonsters = 10;\n room.monsters = [];\n\n for(let i = 0; i < numMonsters; i++) {\n let randomMonsterType = Math.floor( Math.random() * room.monsterTypes.length );\n let newMon = createMonster(randomMonsterType, i, room.averagePlayerLevel);\n\n room.monsters.push( newMon );\n }\n}", "function makeMonster() {\n s = mm(size);\n d1 = mm(descriptor);\n d2 = mm(descriptor2);\n mt = mm(monsterType);\n mw = mm(monWeapon);\n monName = `${s}, ${d1}, ${d2} ${mt}`;\n mHit = getRand(20, 30);\n document.getElementById('enemyHit').innerHTML = `${mHit}`;\n document.getElementById('mName').innerHTML = `${monName}`;\n document.getElementById('mWeapName').innerHTML = `Attack: ${mw}`;\n let n = getRand(1, 5);\n monPhoto = `./assets/monster${n}.jpg`;\n document.getElementById('vilPhoto').src = `${monPhoto}`;\n}", "function createMonster(number, x, y) {\n\tvar monster = svgdoc.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n\tmonster.setAttribute(\"x\", x);\n\tmonster.setAttribute(\"y\", y);\n\tMONSTER_INIT_POS[number] = new Point(x,y);\n\tMONSTER_ON_PLATFORM[number] = false;\n\tMONSTER_INIT_DIRECTION[number] = motionType.RIGHT;\n\t\n\tmonster.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#monster\");\n\tsvgdoc.getElementById(\"monsters\").appendChild(monster);\n\t\n \n\t//if monster is the last monster\n\tif(number == monster_BULLET_SHOOT) {\n\t\tvar newMonster = new Monster(monster, x, y, true);\n\t} else {\n\t\tvar newMonster = new Monster(monster, x, y, false);\n\t}\n monsters.push(newMonster);\n\t//console.log(\"New Monster was added to the list \" + JSON.stringify(monsters));\n}", "async _addMonsters() {\n this.arena.monsters = [];\n\n for (let creature in this.config.monsters) {\n let AI = await new Monster({\n id: creature,\n idType: this.config.monsters[creature].id,\n spritesheet: this.config.monsters[creature].spritesheet,\n spriteProp: this.config.monsters[creature],\n container: this.stage.container(),\n layer: this.layer,\n stage: this.stage,\n onScreenUpdate: this._onScreen.bind(this),\n }).init()\n\n this.arena.monsters.push(AI);\n\n this.layer.add(this.arena.monsters[creature].sprite.body);\n\n this._updateFrame();\n this.arena.monsters[creature].sprite.start();\n }\n }", "spawnMonster() {\n\n switch (this.mapLevel) {\n\n //spawn monsters depending on level of dungeon\n case 1:\n this.currentMonster = new Monster(this.monsterMinHp.l1, this.monsterMaxHp.l1, this.monsterMin.l1, this.monsterMax.l1, this.monsterMinDam.l1, this.monsterMaxDam.l1)\n this.currentMonster.randomAvatar(1)\n break;\n case 2:\n this.currentMonster = new Monster(this.monsterMinHp.l2, this.monsterMaxHp.l2, this.monsterMin.l2, this.monsterMax.l2, this.monsterMinDam.l2, this.monsterMaxDam.l2)\n this.currentMonster.randomAvatar(2)\n break;\n\n case 3:\n this.currentMonster = new Monster(this.monsterMinHp.l3, this.monsterMaxHp.l3, this.monsterMin.l3, this.monsterMax.l3, this.monsterMinDam.l3, this.monsterMaxDam.l3)\n this.currentMonster.randomAvatar(3)\n\n break;\n default:\n\n\n\n }\n\n }", "function createNewMonster() {\n\tcurrentMonster = monsters[Math.floor(Math.random() * monsters.length)];\n\tmonsterLevel = Math.floor(Math.random() * level + 1);\n\t\n\treload();\n}", "createMonster(createOne) {\n // Decides which type of monsters can be created depending on the number of waves (extra)\n if (this.numberOfWaves === 0) {\n this.monsterType = (Math.floor(Math.random() * 8) + 1)\n } else if (this.numberOfWaves >= 1) {\n this.monsterType = (Math.floor(Math.random() * 10) + 1)\n }\n \n // Gets a y coordinate corresponding with one of the five rows\n const monsterYLocation = ((Math.floor(Math.random() * 5) + 1) * 180) + 90\n\n // Decides which type of monster is created depending on the random number (extra)\n // Monster\n if (this.monsterType <= 8) {\n const monster = this.physics.add.sprite(1920, monsterYLocation, 'monster').setScale(0.20)\n monster.monsterSpeed = ((Math.floor(Math.random() * (40 - 30 + 1)) + 30) * -1)\n monster.body.velocity.x = monster.monsterSpeed\n monster.health = 100\n this.monsterYPositions.push(monsterYLocation)\n this.monsterGroup.add(monster)\n // Stronger Monster\n } else if (this.monsterType >= 9) {\n const monster = this.physics.add.sprite(1920, monsterYLocation, 'strongerMonster').setScale(0.5)\n monster.monsterSpeed = ((Math.floor(Math.random() * (40 - 30 + 1)) + 30) * -1)\n monster.body.velocity.x = monster.monsterSpeed\n monster.health = 200\n this.monsterYPositions.push(monsterYLocation)\n this.monsterGroup.add(monster)\n }\n console.log('Created new monster')\n\n // Reduces the delay between monsters and starts new timer\n if (this.monsterDelay > 3000 && createOne != true) {\n this.monsterDelay -= 1000\n console.log('New delay is: ', this.monsterDelay)\n }\n if (this.gameOver != true && createOne != true ) {\n this.monsterTimer = this.time.delayedCall(this.monsterDelay, this.createMonster, [], this)\n }\n }", "function createTiles(level) {\n tiles = [];\n\n let map = game.platform[level].map;\n\n for (let y = 0; y < map.length; y++) {\n tiles[y] = [];\n for (let x = 0; x < map[y].length; x++) {\n\n let type = map[y][x];\n\n let tile = new createjs.Sprite(game.tiles, type);\n tile.type = type;\n tile.gotoAndStop(type);\n tile.gridX = x;\n tile.gridY = y;\n\n tile.x = x * 60;\n tile.y = y * 60;\n if (tile.type != 6) {\n tiles[y][x] = tile;\n }\n game.stage.addChild(tile);\n }\n }\n playerOne.x = game.platform[level].p1.x;\n playerOne.y = game.platform[level].p1.y;\n game.stage.addChild(playerOne);\n playerTwo.x = game.platform[level].p2.x;\n playerTwo.y = game.platform[level].p2.y;\n game.stage.addChild(playerTwo);\n}", "function spawnMob(x) {\n for (i = 0; i < 60; i++) {\n if (i < 10) {\n mobs1.push(new Mob(30, 10, 200 + i * 35, 200, 'red', 0, 0));\n } else if (i < 20) {\n mobs1.push(new Mob(30, 10, 200 + (i - 10) * 35, 185, 'yellow', 0, 0));\n } else if (i < 30) {\n mobs1.push(new Mob(30, 10, 200 + (i - 20) * 35, 170, 'orange', 0, 0));\n } else if (i < 40) {\n mobs1.push(new Mob(30, 10, 200 + (i - 30) * 35, 155, 'magenta', 0, 0));\n } else if (i < 50) {\n mobs1.push(new Mob(30, 10, 200 + (i - 40) * 35, 140, 'indigo', 0, 0));\n } else if (i < 60) {\n mobs1.push(new Mob(30, 10, 200 + (i - 50) * 35, 125, 'brown', 0, 0));\n }\n }\n}", "function generateWorld() {\n\t\t//generate the grass along the x-axis\n\t\tfor(var i = 0; i < 25; i++) {\n\t\t\t//generate the grass along the y-axis\n\t\t\tfor(var j = 0; j < 20; j++) {\n\t\t\t\tgrassType = Crafty.randRange(1, 4);\n\t\t\t\tCrafty.e(\"2D, Canvas, grass\"+grassType)\n\t\t\t\t\t.attr({x: i * 16, y: j * 16});\n\t\t\t\t\n\t\t\t\t//1/50 chance of drawing a flower and only within the bushes\n\t\t\t\tif(i > 0 && i < 24 && j > 0 && j < 19 && Crafty.randRange(0, 50) > 49) {\n\t\t\t\t\tCrafty.e(\"2D, DOM, flower, Animate\")\n\t\t\t\t\t\t.attr({x: i * 16, y: j * 16})\n\t\t\t\t\t\t.animate(\"wind\", 0, 1, 3)\n\t\t\t\t\t\t.bind(\"enterframe\", function() {\n\t\t\t\t\t\t\tif(!this.isPlaying())\n\t\t\t\t\t\t\t\tthis.animate(\"wind\", 80);\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//create the bushes along the x-axis which will form the boundaries\n\t\tfor(var i = 0; i < 25; i++) {\n\t\t\tCrafty.e(\"2D, Canvas, wall_top, bush\"+Crafty.randRange(1,2))\n\t\t\t\t.attr({x: i * 16, y: 0, z: 2});\n\t\t\tCrafty.e(\"2D, DOM, wall_bottom, bush\"+Crafty.randRange(1,2))\n\t\t\t\t.attr({x: i * 16, y: 304, z: 2});\n\t\t}\n\t\t\n\t\t//create the bushes along the y-axis\n\t\t//we need to start one more and one less to not overlap the previous bushes\n\t\tfor(var i = 1; i < 19; i++) {\n\t\t\tCrafty.e(\"2D, DOM, wall_left, bush\"+Crafty.randRange(1,2))\n\t\t\t\t.attr({x: 0, y: i * 16, z: 2});\n\t\t\tCrafty.e(\"2D, Canvas, wall_right, bush\"+Crafty.randRange(1,2))\n\t\t\t\t.attr({x: 384, y: i * 16, z: 2});\n\t\t}\n\t}", "function createBuildings() {\n for (let i = 0; i < 4; i++) {\n buildings.push(\n CreateGameElement(\n SHIP.width * 1.5,\n SHIP.height * 1.2,\n 65 + 175 * i,\n C_HEIGHT - 130,\n 0,\n BUILDING_IMG,\n 0\n )\n );\n }\n}", "function generateWorld() {\n\t\t//generate the grass along the x-axis\n\t\tfor(var i = 0; i < 25; i++) {\n\t\t\t//generate the grass along the y-axis\n\t\t\tfor(var j = 0; j < 20; j++) {\n\t\t\t\tgrassType = Crafty.math.randomInt(1, 4);\n\t\t\t\tCrafty.e(\"2D, Canvas, grass\"+grassType)\n\t\t\t\t\t.attr({x: i * 16, y: j * 16});\n\t\t\t\t\n\t\t\t\t//1/50 chance of drawing a flower and only within the bushes\n\t\t\t\tif(i > 0 && i < 24 && j > 0 && j < 19 && Crafty.math.randomInt(0, 50) > 49) {\n\t\t\t\t\tCrafty.e(\"2D, DOM, flower, solid, SpriteAnimation\")\n\t\t\t\t\t\t.attr({x: i * 16, y: j * 16})\n\t\t\t\t\t\t.reel(\"wind\", 1600, 0, 1, 3)\n\t\t\t\t\t\t.animate(\"wind\", -1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//create the bushes along the x-axis which will form the boundaries\n\t\tfor(var i = 0; i < 25; i++) {\n\t\t\tCrafty.e(\"2D, Canvas, wall_top, solid, bush\"+Crafty.math.randomInt(1,2))\n\t\t\t\t.attr({x: i * 16, y: 0, z: 2});\n\t\t\tCrafty.e(\"2D, DOM, wall_bottom, solid, bush\"+Crafty.math.randomInt(1,2))\n\t\t\t\t.attr({x: i * 16, y: 304, z: 2});\n\t\t}\n\t\t\n\t\t//create the bushes along the y-axis\n\t\t//we need to start one more and one less to not overlap the previous bushes\n\t\tfor(var i = 1; i < 19; i++) {\n\t\t\tCrafty.e(\"2D, DOM, wall_left, solid, bush\"+Crafty.math.randomInt(1,2))\n\t\t\t\t.attr({x: 0, y: i * 16, z: 2});\n\t\t\tCrafty.e(\"2D, Canvas, wall_right, solid, bush\"+Crafty.math.randomInt(1,2))\n\t\t\t\t.attr({x: 384, y: i * 16, z: 2});\n\t\t}\n\t}", "function create () {\n\n //Remove the first turn from the array (init information)\n var initInformation = serverJSON[0];\n serverJSON.shift();\n\n //set background image\n var background = game.add.sprite(0, 0, 'background');\n\n //create group for characters\n characters = game.add.group();\n\n //contains all the character objects in the initialInformation\n // as one array to make iteration easier\n var characterArray = [];\n initInformation.forEach(function(teamObject){\n teamObject.Characters.forEach(function(characterInfo){\n characterArray.push(characterInfo);\n });\n });\n\n //Add all players to the characters group at their initial locations and other init work\n for(var index = 0; index < statScreen.MultiPlayer.length; index++){\n //set CharacterID\n var characterID = characterArray[index].Id;\n statScreen.MultiPlayer[index].CharacterID = characterID;\n characterIDToMultiPlayerIndex[characterID] = index;\n\n var initPos = calcXAndY(characterArray[index].Position[0], characterArray[index].Position[1]);\n \n //generate the string of the key for the character sprite \n var teamNumber;\n if(index < 3){\n teamNumber = 1;\n }\n else{\n teamNumber = 2\n }\n //Wizard1.png, Druid2.png etc.\n var spriteName = characterArray[index].ClassId + teamNumber;\n\n //Add the character's sprite to its own Phaser Group\n //Used for rendering order of sprites\n var characterGroup = game.add.group(); \n statScreen.MultiPlayer[index].Sprite = characterGroup.create(initPos.x, initPos.y, spriteName);\n statScreen.MultiPlayer[index].PhaserGroup = characterGroup;\n\n //add the sprite to the characters group (global group)\n characters.add(statScreen.MultiPlayer[index].Sprite);\n\n\n //set the anchor of each character sprite to the middle of the sprite\n statScreen.MultiPlayer[index].Sprite.anchor.setTo(0.5);\n statScreen.MultiPlayer[index].Sprite.index = index;\n statScreen.MultiPlayer[index].Sprite.name = characterArray[index].Name;\n\n //Set initial values of attributes\n for(var attr in statScreen.MultiPlayer[index].InitialValue){\n statScreen.MultiPlayer[index].InitialValue[attr] = \n characterArray[index].Attributes[attr];\n }\n \n }\n\n //move the characters so they fit into the regions correctly\n moveCharactersQuadrantAbsolute(serverJSON[0]);\n\n\n //enable input for all character sprites\n characters.setAll('inputEnabled', true);\n //When input is detected (currently only clicking on a sprite is detected)\n // changeStatScreen is called by the sprite's corresponding player variable\n //Pass the variable of the calling character sprite to\n // changeStatScreen() \n characters.callAll('events.onInputDown.add', 'events.onInputDown', \n changeStatScreen, this);\n\n //Have the timer call all of the following functions every\n // TIME_TO_NEXT_UPDATE milliseconds\n //This function will only update the screen if serverJSON has \n // data within it (we aren't waiting for the server to send JSON over)\n processTurnTimerEvent = game.time.events.loop(TIME_TO_NEXT_UPDATE, processTurn, this);\n\n //add Graphics Object to the Game (used for drawing primitive shapes--health bars)\n singleGraphics = game.add.graphics();\n multiGraphics = game.add.graphics();\n\n //initializes both SinglePlayer and MultiPlayer screens, but keeps the MultiPlayer \n // screen active\n //default to player one\n initSinglePlayerStatScreen(statScreen[\"MultiPlayer\"][0].Sprite);\n statScreen.SinglePlayer.PlayerIndex = 0;\n hideSinglePlayerStatScreen();\n initMultiPlayerStatScreen();\n\n multiButton = game.add.text(GAME_WIDTH+250, 550, \"MULTI\", {font: \"4em Arial\", fill: \"#ff944d\"});\n multiButton.inputEnabled = true;\n multiButton.events.onInputDown.add(showMultiPlayerStatScreen, this);\n\n singleButton = game.add.text(GAME_WIDTH+20, 550, \"SINGLE\", {font: \"4em Arial\", fill: \"#ff944d\"});\n singleButton.inputEnabled = true;\n singleButton.events.onInputDown.add(showSinglePlayerStatScreen, this);\n\n //set up handle on spanTurnNumberElement\n spanTurnNumberElement = document.getElementById(\"turnNumber\");\n \n\n console.log(serverJSON);\n\n //log success\n console.log(\"create() complete\");\n}", "function addMonsters_onWave( id, number ) //Adauga 'number' monstrii de tipul 'id'.\n{\n\tfor( var i=1; i<=number; i++)\n\t\t\twaves[monster_position_in_wave++] = new Monster(Pointsy[0], Pointsx[0], id);\n}", "function renderMonsters(monsters){\n const monsterContainer = document.getElementById(\"monster-container\")\n \n monsters.forEach(monster => {\n const monsterDiv = document.createElement(\"div\")\n monsterDiv.innerHTML = \n `<h2>Name: ${monster.name}</h2>\n <h4>Age: ${monster.age}</h4>\n <p>Description ${monster.description}</p>`\n\n monsterContainer.appendChild(monsterDiv)\n })\n}", "function make_map(stage){\r\n stage.addPlayer(new Player(stage,images.naked_player ,Math.floor(stage.width/2), Math.floor(stage.height/2),player_width,player_height));\r\n stage.addItem(new Gun(stage,images.machine_gun,40,40,100,100,'gun'));\r\n stage.addItem(new Gun(stage,images.pistol,80,80,2300,2200,'gun'));\r\n stage.addItem(new Ammo(stage,images.ammo,20,20,2200,2200,'ammo'));\r\n stage.addItem(new Item(stage,images.health_pack,20,20,2300,2300,'health'));\r\n\r\n var canvw = stage.width;\r\n var canvl = stage.height;\r\n for (var i = 0; i<30; i++){\r\n x = randint(canvw);\r\n y = randint(canvl);\r\n stage.addItem(new Gun(stage,images.pistol,80,80,x,y,'gun'));\r\n\r\n }\r\n for (var i = 0; i<trees.length; i++){\r\n stage.addHittable(new hittableObject(stage,'sprites/tree.png',100,100,trees[i][0],trees[i][1],true));\r\n }\r\n\r\n for (var i = 0; i<rocks.length; i++){\r\n stage.addHittable(new hittableObject(stage,'sprites/rock.png',70,70,rocks[i][0],rocks[i][1],false));\r\n }\r\n for (var i = 0; i<npcs.length; i++){\r\n stage.addEnemy(new NPC_Enemies(stage, images.gun_player ,npcs[i][0], npcs[i][1],player_width,player_height));\r\n }\r\n var game_house = new house(stage,images.house_outside,1000,1000,4000,0);\r\n stage.type.house = game_house;\r\n \r\n\r\n\r\n}", "function pickMonster() {\n currentMonsterTemplate = monster[Math.floor(Math.random() * monster.length)]\n \n currentMonster = new Monster(currentMonsterTemplate)\n}", "function monsterWave(max) {\n\tfor (monster in range(1, max)) {\n\t\tmonster = new Monster();\n\t}\n}", "function create ()\r\n\t{\r\n\t//lägger in tilemap\r\n\tvar map = this.make.tilemap({ key: 'map' });\r\n\t\r\n\t//lägger till ett tileset\r\n\tvar tileset = map.addTilesetImage('Materials');\r\n\t\r\n\t//gör mappen grafisk och interaktable men detta funkar inte för tillfället\r\n\t//var layer = map.createStaticLayer(0, ground, 0, 0);\r\n\t\r\n\t\r\n\t// skapar himlen\r\n\tthis.add.image(400,300, 'sky');\r\n\tthis.add.image(1200,300, 'sky');\r\n\tthis.add.image(2000,300, 'sky');\r\n\tthis.add.image(2800,300, 'sky');\r\n\tthis.add.image(3600,300, 'sky');\r\n\t\r\n\tvar music = this.sound.add('music1');\r\n\tmusic.play();\r\n\t\r\n\t//gör en statisk grupp med fysik till \"platforms\"\r\n\tplatforms = this.physics.add.staticGroup();\r\n\t\r\n\t//Skapar en stor platform som är spelets mark\r\n\tplatforms.create(400, 550, 'ground');\r\n\tplatforms.create(1200, 550, 'ground');\r\n\tplatforms.create(2000, 550, 'ground');\r\n\tplatforms.create(2800, 550, 'ground');\r\n\tplatforms.create(3600, 550, 'ground');\r\n\t\r\n\t//Skapar två platformar\r\n\tplatforms.create(100, 400, 'platform');\r\n\tplatforms.create(500, 300, 'platform');\r\n\r\n\t//skapar en statisk grupp med fysik till \"grassBox\"\r\n\tgrassBox = this.physics.add.staticGroup();\r\n\r\n\tgrassBox.create(1000, 488,'grassBox');\r\n\tgrassBox.create(1224, 488, 'grassBox');\r\n\r\n\t//skapar en statisk grupp med fysik till \"spikes\"\r\n\tspikes = this.physics.add.staticGroup();\r\n\r\n\t//första \"spike rown\" i spelet\r\n\tspikes.create(1032, 484, 'spikes');\r\n\tspikes.create(1064, 484, 'spikes');\r\n\tspikes.create(1096, 484, 'spikes');\r\n\tspikes.create(1128, 484, 'spikes');\r\n\tspikes.create(1160, 484, 'spikes');\r\n\tspikes.create(1192, 484, 'spikes');\r\n\r\n\t//första \"Spike rown\" i spelet efter andra lådan\r\n\tspikes.create(1254, 484, 'spikes');\r\n\tspikes.create(1286, 484, 'spikes');\r\n\tspikes.create(1318, 484, 'spikes');\r\n\tspikes.create(1350, 484, 'spikes');\r\n\tspikes.create(1382, 484, 'spikes');\r\n\tspikes.create(1414, 484, 'spikes');\r\n\t\r\n\t//flag.create(1032, 484, 'flag');\r\n\r\n\t//lägger in texten som säger hur många poäng jag har\r\n\tpointText = this.add.text(2, 2, 'points: ' + points, {fontSize: '32px', fill: '#000'});\r\n\t\r\n\t//Lägger till en ny grup som heter \"coins\" den ska ha fysik men vara \"Static\"\r\n\tcoins = this.physics.add.staticGroup();\r\n\tcoins.create(400, 450, 'coin');\r\n\tcoins.create(1110, 390, 'coin');\r\n\tcoins.create(700, 450, 'coin');\r\n\t\r\n\t//skapar spelaren och lägger till fysik \r\n\tplayer = this.physics.add.sprite(100, 350, 'player');\r\n\tplayer.body.setSize(10, 32, 50, 25);\r\n\t\r\n\t//gör så att spelaren kommer studsa på emot andra pysiska grupper\r\n player.setBounce(0.2);\r\n\t\r\n //blockar spelaren från att gå \"out of bounds\"\r\n\tplayer.setCollideWorldBounds(true);\r\n\tplayer.smoothed = false;\r\n\t\r\n\t//lägger till \"Slime\"\r\n\tslime = this.physics.add.sprite(470,265, 'slime');\r\n\t\r\n\t\r\n\t\r\n\t//gör så att spelaren koliderar med platformarna med andra ord spelaren kan inte trilla igenom dom \r\n\t//och likt spelaren så är det andra grupper som samma sak händer med nedanför\r\n\tthis.physics.add.overlap(player, slime, death, null, this);\r\n\tthis.physics.add.overlap(player, coins, collectCoins, null, this);\r\n\tthis.physics.add.overlap(player, spikes, death, null, this);\r\n\r\n\tthis.physics.add.collider(player, platforms);\r\n\tthis.physics.add.collider(coins, platforms);\r\n\tthis.physics.add.collider(slime, platforms);\r\n\tthis.physics.add.collider(player, slime);\r\n\tthis.physics.add.collider(player, spikes);\r\n\tthis.physics.add.collider(player, grassBox);\r\n\t\r\n\t //skapar en animation \"left\"\r\n this.anims.create({\r\n key: 'left',\r\n frames: this.anims.generateFrameNumbers('player', { start: 0, end: 5 }),\r\n frameRate: 10,\r\n repeat: -1\r\n });\r\n\r\n\t//skapar en animation \"idle\"\r\n this.anims.create({\r\n key: 'idle',\r\n frames: [ { key: 'player', frame: 6 } ],\r\n frameRate: 20\r\n });\r\n\t\r\n\t//skapar en animation \"right\"\r\n this.anims.create({\r\n key: 'right',\r\n frames: this.anims.generateFrameNumbers('player', { start: 7, end: 12 }),\r\n frameRate: 10,\r\n repeat: -1\r\n });\r\n\t\r\n\tthis.anims.create({\r\n key: 'slimeAni',\r\n frames: this.anims.generateFrameNumbers('slime', { start: 0, end: 4 }),\r\n frameRate: 10,\r\n repeat: -1\r\n });\r\n\t\r\n\t//lägger till tangentbords nyklar\r\n\tcursors = this.input.keyboard.createCursorKeys();\r\n\t\r\n\t//Olika kamera inställningar\r\n\tthis.cameras.main.setSize(800, 600);\r\n\tthis.cameras.main.setBounds(0, 0, 4000, 600);\r\n this.physics.world.setBounds(0, 0, 4000, 600);\r\n\tthis.cameras.main.startFollow(player);\r\n\tthis.cameras.main.setZoom(1.2);\r\n\tthis.cameras.main.roundPixels = false;\r\n\t//här lägger jag till en extra kamera för att kunna se mina poäng\r\n\tthis.cameras.add(0, 0, 210, 35);\r\n\t\r\n\tvar combo = this.input.keyboard.createCombo('krm', {resetOnMatch: true});\r\n\t\r\n\t//detta är en fusk kod\r\n\tthis.input.keyboard.on('keycombomatch', function (event) \r\n\t{\r\n\t\r\n\tpoints += 50;\r\n\t\r\n\tpointText.setText('points: ' + points);\r\n\t\r\n\tconsole.log('I see you found a cheat code');\r\n\t\r\n\t});\r\n\t\r\n\t//bara ett medelande till konsolen så jag enklare kan se vart det gick fel\r\n\tconsole.log(\"function create loaded fine\");\r\n}", "function createMonster(x, y) {\r\n\r\n var monster = svgdoc.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\r\n svgdoc.getElementById(\"monsters\").appendChild(monster);\r\n monster.setAttribute(\"x\", x);\r\n monster.setAttribute(\"y\", y);\r\n var x_ = Math.floor(Math.random()*700);\r\n var y_ = Math.floor(Math.random()*500);\r\n// moveMonster(monster, x, y, x_, y_);\r\n monster.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#monster\");\r\n // var monsterleft = svgdoc.getElementById(\"monsterleft\");\r\n // monsterleft.setAttribute(\"transform\", \"translate(\" +MONSTER_SIZE.w + \", 0) scale(-1,1)\");\r\n\r\n}", "function createTilemap() {\r\n //Load in tilemap assets\r\n var map = this.make.tilemap({ key: \"tilemap\" });\r\n var landscape = map.addTilesetImage(\"landscape-tileset\", \"landscape\");\r\n var props = map.addTilesetImage(\"props-tileset\", \"props\");\r\n\r\n //Create first three layers\r\n map.createStaticLayer('backgroundLayer2', [landscape, props], 0, 0);\r\n map.createStaticLayer('backgroundLayer', [landscape, props], 0, 0);\r\n map.createStaticLayer('collisionLayer', [landscape, props], 0, 0);\r\n\r\n //Find the playerSpawn point\r\n var playerSpawn = map.findObject(\"objectLayer\", function (object) {\r\n if (object.type === \"player\") {\r\n return object;\r\n }\r\n });\r\n\r\n //Create player object\r\n createPlayer.call(this, playerSpawn);\r\n\r\n //Create groups\r\n jewels = this.physics.add.staticGroup();\r\n powerUps = this.physics.add.staticGroup();\r\n skulls = this.physics.add.staticGroup();\r\n\r\n //Find objects and create sprite for relevant group\r\n map.findObject(\"objectLayer\", function (object) {\r\n if (object.type === \"pickUp\" && object.name === \"jewel\") {\r\n jewels.create(object.x + map.tileWidth / 2, object.y - map.tileHeight / 2, \"jewel\");\r\n }\r\n\r\n if (object.type === \"powerUp\" && object.name === \"doubleJump\") {\r\n powerUps.create(object.x + map.tileWidth / 2, object.y - map.tileHeight / 2, \"cherry\");\r\n }\r\n if (object.type === \"pickUp\" && object.name === \"skull\") {\r\n skulls.create(object.x + map.tileWidth / 2, object.y - map.tileHeight / 2, \"skull\");\r\n }\r\n });\r\n\r\n //Create foreground layer\r\n map.createStaticLayer('foregroundLayer', landscape, 0, 1);\r\n\r\n //Return the map\r\n return map;\r\n}", "create() {\n // Load game data\n this.loadGame();\n\n // Set the starting monster\n let index = Math.floor(Math.random() * MONSTERS.length);\n this.setMonster(MONSTERS[index]);\n // Create hp text\n this.hpText = this.add.text(225, 700, \"\");\n // Create the souls text\n this.soulsText = this.add.text(50, 50, \"Souls: 0\", {\n fontSize: '24px',\n color: 'red'\n });\n\n // Create an upgrade icon for the bolt upgrade\n let bolt = this.add.image(400, 50, 'bolt');\n bolt.setScale(3);\n bolt.setInteractive();\n bolt.on('pointerdown', () => {\n // If we have enough money\n if (this.souls >= 5) {\n // pay the money\n this.souls -= 5;\n // gain a level\n this.levels.bolt++;\n }\n });\n // Create an interval to use bolt damage\n setInterval(() => {\n this.damage(this.levels.bolt);\n }, 1000);\n\n // Save button\n let door = this.add.image(50, 750, 'door');\n door.setScale(3);\n door.setInteractive();\n door.on('pointerdown', () => {\n this.saveGame();\n this.scene.start(\"TitleScene\");\n });\n\n // Save every 60s\n setInterval(() => {\n this.saveGame();\n }, 60000);\n // Save once on startup, to set the time\n this.saveGame();\n }", "function generateStones(){\n if (frameCount%50===0){\n // creating sprites of Stones\n var stone= createSprite(1200,120,40,10);\n // craeting the stones in random locations based on the values randomly\n stone.x=random(50,450);\n stone.addImage(stoneImg);\n stone.scale=0.5;\n stone.velocityY= 5;\n stone.lifetime=250;\n stonesGroup.add(stone);\n }}", "function setupEndMonster1() {\n\n ufoDots = game.add.group();\n missiles = game.add.group();\n\n for (i = 0; i < 3; i++) {\n\n var redOlive\n\n if (i != 1) {\n redOlive = ufoDots.create(game.world.width * 0.5, game.world.height * 0.5, 'red_olive');\n } else {\n redOlive = ufoDots.create(game.world.width * 0.5, game.world.height * 0.5, 'red_olive_queen');\n }\n\n\n redOlive.animations.add('fly', [0, 1, 2, 3], 5, true);\n redOlive.animations.play('fly');\n }\n\n blocks.children.forEach(function(e) {\n e.kill()\n })\n\n platforms.children.forEach(function(e) {\n e.kill()\n })\n\n diamonds.children.forEach(function(e) {\n e.kill()\n })\n\n // reset to basic texture\n player.loadTexture('dude')\n\n music.stop()\n\n music2 = game.add.audio('music2');\n music2.volume = 0.9;\n music2.loop = true;\n\n //music2.play()\n\n}", "function newGame(){\n\t// Loop over canvases, clear each and draw random biomorph\n\tBiomorphs.view.clearCanvas();\n\tbiomorphList = [null];\n\tfor (var i = 1; i < 4; i++) {\n\t\tbiomorphList.push(new Biomorph());\n\t\tbiomorphList[i].initialize();\n\n\t}\n\tdrawBiomorphs(biomorphList);\n}", "function spawnMeat() {\n for (var i = 0; i < 15; i++) {\n var meat = yummy.create(game.world.width * Math.random() * 0.95,\n game.world.height * Math.random(), 'meat');\n meat.scale.setTo(.9, 0.9);\n } \n}", "function jewellSpawn() {\n\n spawn = int(random(5, 15));\n print(\"Spawn: \" + spawn);\n for (var i = 0; i < spawn; i++) {\n var equis = random(0, windowWidth - 10);\n var ye = random(0, windowHeight - 40);\n jwls = createSprite(equis, ye);\n jwls.addAnimation(\"blink\", \"assets/jewels/jewels_0001.png\", \"assets/jewels/jewels_0011.png\");\n jewels.add(jwls);\n }\n\n}", "generateObstacles(thorns, walls) {\n var numThorns = thorns;\n var numWalls = walls;\n\n //Place a number of thorn tiles around the center of the map.\n while (numThorns > 0) {\n var randX = this.getRand(2, (this.boardWidth - 3));\n var randY = this.getRand(2, (this.boardHeight - 3));\n if (this.gameBoard[randX][randY].getType() == \"dirt\") {\n this.gameBoard[randX][randY].setType(\"thorns\");\n numThorns--;\n } \n }\n\n //Place a number of impassable wall tiles around the center of the map.\n while (numWalls > 0) {\n var randX = this.getRand(2, (this.boardWidth - 3));\n var randY = this.getRand(2, (this.boardHeight - 3));\n if (this.gameBoard[randX][randY].getType() == \"dirt\") {\n this.gameBoard[randX][randY].setType(\"wall\");\n numWalls--;\n }\n }\n }", "function SpawnMonsters(){\n for(i = 0; i < Monsters.length; i++){\n if(Citys.length != 0){\n loc = Math.floor(Math.random() * Citys.length); \n if(Citys[loc] != undefined){\n if(Citys[loc].Monsters == \"\"){\n Citys[loc].Monsters = Monsters[i].monName;\n Monsters[i].location = loc;\n }else{\n //if monsters spawn in the same city...fight and die\n $(\"#dataOuptput\").append(\"<p>\" + Monsters[i].monName + \" spawned in \" + Citys[loc].CityName + \" with \" + Citys[loc].Monsters + \". The city was destroyed </p> <br>\");\n console.log(Monsters[i].monName, \" spawned in \", Citys[loc].CityName, \" with \", Citys[loc].Monsters, \". The city was destroyed\");\n $.each(Monsters, function(index, value){\n if(value != undefined){\n if(value.monName == Citys[loc].Monsters){\n delete Monsters[index];\n }\n }\n });\n delete Monsters[i];\n delete Citys[loc];\n }\n }else{\n //if the city was already destroyed monster dies in wilderness (incase more monsters are sapwned then citys)\n $(\"#dataOuptput\").append(\"<p>\"+ Monsters[i].monName + \" spawned in an already destroyed city...he died of starvation<.p> <br>\");\n console.log(Monsters[i].monName, \" spawned in an already destroyed city...he died of starvation\");\n delete Monsters[i];\n }\n }else{\n console.log(\"game ended\");\n }\n }\n \n monsterRoamig();\n}", "function createMonster(e) {\n e.preventDefault()\n const config = {\n 'method': 'POST',\n 'headers': {\n 'Content-Type' : 'application/json',\n 'Accept': 'application/json'\n },\n 'body' : JSON.stringify({\n name: `${e.target.name.value}`,\n age: `${parseInt(e.target.age.value)}`,\n description: `${e.target.description.value}`\n })\n }\n fetch('http://localhost:3000/monsters/', config)\n .then(resp => resp.json())\n .then(() => {\n //Afterwards, render the monsters again\n pageNum = 1\n e.target.reset()\n loadMonsters()\n })\n }", "function fillmonst(what, awake) {\n var monster = createMonster(what);\n for (var trys = 10; trys > 0; --trys) /* max # of creation attempts */ {\n var x = rnd(MAXX - 2);\n var y = rnd(MAXY - 2);\n //debug(`fillmonst: ${x},${y} ${itemAt(x, y)}`);\n if ((itemAt(x, y).matches(OEMPTY)) && //\n (!player.level.monsters[x][y]) && //\n ((player.x != x) || (player.y != y))) {\n player.level.monsters[x][y] = monster;\n if (awake) monster.awake = awake;\n player.level.know[x][y] &= ~KNOWHERE;\n return monster;\n }\n }\n return null; /* creation failure */\n}", "function createGame(frame){ // creates the game area by looping on the createTile function\n for(var i = 0; i < GAME_SIZE; i++)\n frame.appendChild(createTile());\n}", "function createEnemies() {\n //\n // Create 10 enemies at varying velocities and\n // positions\n //\n for (var i = 1; i < 11; i++) {\n\tvar newEnemy = new Enemy();\n\t//newEnemy.x = getRandomInt(0,ctx.canvas.width - \n\tnewEnemy.x = getRandomInt(0,505 - \n\t newEnemy.width);\n\t// Center enemy on stone tile.\n\tnewEnemy.y = canvasOffset + getRandomInt(1,4)*tileHeight\n\t + 5;\n\tnewEnemy.velocity_x = getRandomInt(20,50);\n\tallEnemies.push(newEnemy);\n }\n}", "createTiles()\n {\n //add tileset to map layer\n this.mapLayer = this.tilemap.createLayer('walls');\n this.mapLayer.resizeWorld();\n\n //add p2 physics to tilemap\n this.tilemap.setCollisionByExclusion([]);\n game.physics.p2.convertTilemap(this.tilemap, this.mapLayer);\n \n this.player.setTilemapCollisionGroup(this.collisionGroup);\n \n this.tilemapBodies = game.physics.p2.convertTilemap(this.tilemap, this.mapLayer, true, false);\n \n for(let body of this.tilemapBodies)\n {\n this.configureBody(body, 16, 16);\n }\n }", "function create(nbr, thisObj)\n\t\t{\n\t\t\t// On regarde si game over\n\t\t\tif(checkStatus())\n\t\t\t{\n\t\t\t\tvar i = 1;\n\t\t\t\twhile( i <= nbr){\n\t\t\t\t\tvar gameContainer = $('.game-container');\n\t\t\t\t\tvar tileContainer = $('.tile-container');\n\t\t\t\t\t// Verification d'un espace vide\n\t\t\t\t\tvar position = checkSpace();\n\t\t\t\t\tif(typeof position === \"undefined\")\n\t\t\t\t\t{\n\t\t\t\t\t\tcreate(1);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tx = position[\"x\"];\n\t\t\t\t\t\ty = position[\"y\"];\n\t\t\t\t\t\tvar value = random(3) % 2 == 0 ? value =2 : value= 4;\n\t\t\t\t\t\t// Creation de la tile\n\t\t\t\t\t\tvar classCss = 'tile tile-'+value+' tile-position-'+x+'-'+y; \n\t\t\t\t\t\tvar tile = \"<div class='tile-new' data-x='\"+x+\"' data-y=\"+y+\"> <div class='tile-inner'>\"+value+\"</div> </div>\"\n\t\t\t\t\t\t$('body').find(tileContainer).append(tile);\n\t\t\t\t\t\t$('body').find('.tile-new').addClass(classCss);\n\t\t\t\t\t\t$('body').find('.tile').removeClass('tile-new');\n\t\t\t\t\t}\n\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\talert('Game over');\n\t\t\t}\n\t\t}", "function buildBoard(){\n\t \t\tvar mineCount = 0;\n\t \t\tfor (var i = 0; i < ROWS; i+=1) {\n\t\t\t\tfor (var j = 0; j < COLS; j+=1) {\n\t\t\t\t\tvar x_shift = Math.floor(0.5*start) + i*stepW;\n\t\t\t\t\tvar y_shift = Math.floor(0.5*start) + j*stepH;\n\t\t\t\t\tvar circleCol = randomColorGenerator(x_shift,y_shift);\n\t\t\t\t\tvar invertedCol = getInvertedColors(circleCol);\n\t\t\t\t\tvar myCircle = new Path.Circle(new Point(x_shift+circleSize,y_shift+circleSize),circleSize).fillColor = circleCol;\n\t\t\t\t\t//initialise space object\n\n\n\t\t\t\t\tvar spaceObj = {\n\t\t\t\t\t\t\t\t\tindex: n, \n\t\t\t\t\t\t\t\t\tcolor: circleCol,\n\t\t\t\t\t\t\t\t\toutline: invertedCol,\n\t\t\t\t\t\t\t\t\tcircleRef: myCircle,\n\t\t\t\t\t\t\t\t\tpos_x: 0, pos_y: 0, \n\t\t\t\t\t\t\t\t\tholdsMine: 0, \n\t\t\t\t\t\t\t\t\tadjacentNeighbours: 0, \n\t\t\t\t\t\t\t\t\tclicked: false,\n\t\t\t\t\t\t\t\t\tflagged: false,\n\t\t\t\t\t\t\t\t\tneighbourIndexList: []\n\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\tspaceObj.pos_x = x_shift+circleSize;\n\t\t\t\t\tspaceObj.pos_y = y_shift+circleSize;\n\t\t\t\t\tspaceObj.holdsMine = assignMine();\n\n\t\t\t\t\tif(spaceObj.holdsMine){\n\t\t\t\t\t\tmineCount++;\n\t\t\t\t\t}\n\n\t\t\t\t\tspaces.push(spaceObj);\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tplayerStats.totalMines = mineCount;\n\t\t\tplayerStats.flags = mineCount;\n\t \t}", "makemonster(level)\n {\n this.defalt_x = level.monster[0].position_x-(level.monster[0].row*MONSTERDISTANCE);\n this.defalt_y = level.monster[0].position_y-(level.monster[0].column*MONSTERDISTANCE);\n\n if(this.move == false)\n {\n level.stiffen = true\n level.monster[this.UFOsquidvalue].position_y +=2;\n if(level.monster[this.UFOsquidvalue].position_y >=this.defalt_y)\n {\n level.monster[this.UFOsquidvalue].position_y = this.defalt_y\n level.stiffen = false;\n this.move = true;\n } \n }\n else{\n for(var i = 0; i < level.behindmonsterdata.length;i++)\n {\n if(this.position_x == this.defalt_x + (MONSTERDISTANCE*i) && level.behindmonsterdata[i]==0 && this.position_x > MONSTERDISTANCE*2&& this.position_x < play_scene_maximumX - (MONSTERDISTANCE*2))\n {\n this.move = false;\n level.stiffen = true;\n\n var nextmonsternumber =0;\n var itislast = true; \n\n for(var j = i; j < level.behindmonsterdata.length;j++)\n {\n if(level.behindmonsterdata[j]==1)\n {\n itislast=false;\n for(var k=0;k<level.monster.length;k++)\n\n {\n if(level.monster[k].column == 0 && level.monster[k].row == j)\n {\n nextmonsternumber = j\n break;\n }\n }\n break;\n }\n }\n\n if(itislast)\n {\n this.move = false;\n level.monster.push(level.makeUFOsquid(this.defalt_x + (MONSTERDISTANCE*i),this.position_y,i))\n level.behindmonsterdata[i]=1;\n this.UFOsquidvalue = level.monster.length-1\n }\n\n else{\n this.move = false;\n this.UFOsquidvalue = nextmonsternumber\n level.monster.splice(nextmonsternumber,0,level.makeUFOsquid(this.defalt_x + (MONSTERDISTANCE*i),this.position_y,i))\n if(level.monstercount>nextmonsternumber)\n {\n level.monstercount+=1\n }\n level.behindmonsterdata[i]=1;\n }\n }\n }\n}\n}", "function MonsterFactory () {\n this.monsters = []\n this.monstersAdded = 0\n this.numberOfMonster = 10\n this.timeElapsed = 0\n}", "_createBoard() {\n let map = this.map = this._createHexagonMap();\n\n for (let q in map) {\n for (let r in map[q]) {\n this._createSprite(map[q][r]);\n }\n }\n }", "function GenerateDungeon() {\n\tCreateMapArray();\n\tPopulateMapRooms();\n\tPopulateMapTunnels();\n\tPopulateRandomTunnels();\n\tPopulateSecretRoom();\n\tAddEncounters();\n\tUpdateGraphicsMap();\n\tUpdateTileMap();\n}", "function makemaze(k) {\n var useCanned = false;\n if (k == DBOTTOM || k == VBOTTOM) {\n useCanned = true;\n }\n else if (k > 1) {\n if (ULARN) {\n useCanned = rnd(100) < 50;\n }\n else {\n useCanned = rnd(17) <= 4;\n }\n }\n\n if (useCanned) {\n /* read maze from data file */\n cannedlevel(k);\n return;\n }\n\n var mitem = player.level.monsters;\n\n for (let i = 0; i < MAXY; i++) {\n for (let j = 0; j < MAXX; j++) {\n if (k == 0)\n setItem(j, i, OEMPTY);\n else\n setItem(j, i, OWALL);\n }\n }\n\n if (k == 0) return;\n\n eat(1, 1);\n\n if (k == 1) setItem(33, MAXY - 1, OHOMEENTRANCE);\n\n /* now for open spaces */\n var tmp2 = rnd(3) + 3;\n var mx, mxl, mxh, my, myl, myh;\n var mon;\n for (let tmp = 0; tmp < tmp2; tmp++) {\n my = rnd(11) + 2;\n myl = my - rnd(2);\n myh = my + rnd(2);\n\n if (k < MAXLEVEL) {\n mx = rnd(44) + 5;\n mxl = mx - rnd(4);\n mxh = mx + rnd(12) + 3;\n mon = null;\n } else {\n mx = rnd(60) + 3;\n mxl = mx - rnd(2);\n mxh = mx + rnd(2);\n mon = makemonst(k);\n }\n\n for (var i = mxl; i < mxh; i++)\n for (var j = myl; j < myh; j++) {\n setItem(i, j, OEMPTY);\n mitem[i][j] = mon ? createMonster(mon) : null;\n }\n }\n /* now for open spaces */\n\n my = rnd(MAXY - 2);\n for (let i = 1; i < MAXX - 1; i++)\n setItem(i, my, OEMPTY);\n\n if (k > (ULARN ? 4 : 1)) {\n treasureroom(k);\n }\n\n}", "function spawnUnit(data, isCreation, row, column, team){\n chars.removeChild(spawnAnimation);\n //|| data.address == \"graphics/spritesheet/stand/ss_scarecrow_stand.png\"\n\n // if (data.address == \"graphics/spritesheet/stand/ss_rogue_stand.png\") return;\n\n var spriteSheet = new createjs.SpriteSheet({\n \"images\": [data.address],\n \"frames\": {\"regX\": 0, \"height\": 142, \"count\": 2, \"regY\": -30, \"width\": 113 },\n \"animations\": {\n \"stand\":[0,1]\n },\n framerate: 2\n });\n\n var unit = new createjs.Sprite(spriteSheet, \"stand\");\n\n //move!\n \n createjs.Ticker.timingMode = createjs.Ticker.RAF; \n createjs.Ticker.addEventListener(\"tick\", stage);\n // Configure unit coordinates\n unit.hp = data.hp;\n unit.max_hp = data.max_hp;\n unit.attack = data.attack;\n unit.base_attack = unit.attack;\n unit.luck = data.luck;\n\n\n //unit = unit.moveAnimation;\n\n\n var spawnSpriteSheet = new createjs.SpriteSheet({\n \"images\": [\"graphics/spritesheet/special_unit/ss_unit_creation.png\"],\n \"frames\": {\"width\": 142, \"height\": 142, \"count\": 4, \"regY\": 110, \"regX\": 65},\n \"animations\": {\n \"damage\":{\n frames: [0,1,2,3],\n next: false\n }\n },\n framerate: 4\n });\n\n unit.spawnSpriteSheet = spawnSpriteSheet;\n var spawnAnimation = new createjs.Sprite(spawnSpriteSheet, \"spawn\");\n\n var damageEffect = new createjs.SpriteSheet({\n \"images\": [data.damageEffect],\n \"frames\": {\"width\": 142, \"height\": 142, \"count\": 4, \"regY\": 110, \"regX\": 95},\n \"animations\": {\n \"damage\":{\n frames: [0,1,2,3],\n next: false\n }\n },\n framerate: 4\n });\n unit.damageEffect = damageEffect;\n\n var burnEffect = new createjs.SpriteSheet({\n \"images\": [that.buffEffects.burning],\n \"frames\": {\"width\": 142, \"height\": 142, \"count\": 4, \"regY\": 110, \"regX\": 95},\n \"animations\": {\n \"burn\":{\n frames: [0,1,2,3],\n next: false\n }\n },\n framerate: 4\n });\n unit.burnEffect = burnEffect;\n\n var healEffect = new createjs.SpriteSheet({\n \"images\": [that.buffEffects.heal],\n \"frames\": {\"width\": 142, \"height\": 142, \"count\": 4, \"regY\": 110, \"regX\": 95},\n \"animations\": {\n \"heal\":{\n frames: [0,1,2,3],\n next: false\n }\n },\n framerate: 4\n });\n unit.healEffect = healEffect;\n\n\n var forzenEffect = new createjs.SpriteSheet({\n \"images\": [that.buffEffects.frozen],\n \"frames\": {\"width\": 142, \"height\": 142, \"count\": 4, \"regY\": 110, \"regX\": 95},\n \"animations\": {\n \"ice\":{\n frames: [0,1,2,3],\n next: false\n }\n },\n framerate: 4\n });\n unit.forzenEffect = forzenEffect;\n\n if (isCreation) {\n unit.team = team;\n unit.row = row;\n unit.column = column;\n } else {\n unit.team = data.team;\n unit.column = data.y;\n unit.row = data.x;\n }\n\n unit.x = originX + (unit.column - unit.row) * 65;\n unit.y = unit.column * 32.5 + originY + unit.row * 32.5;\n\n\n unit.regX = 56.5;\n unit.regY = 130;\n if (unit.team == 0 && data.skill_no != -1) unit.scaleX = -0.7;\n else unit.scaleX = 0.7\n unit.scaleY = 0.7;\n unit.skill = data.skill;\n unit.address = data.address;\n unit.info = data.info;\n\n unit.spritesheet = new createjs.SpriteSheet({\n \"images\": [data.spritesheet],\n \"frames\": {\"width\": 142, \"height\": 142, \"count\": 4, \"regY\": 110, \"regX\": 95},\n \"animations\": {\n \"attack\":{\n frames: [0,1,2,3],\n next: false \n }\n },\n framerate: 4\n });\n unit.skill_no = data.skill_no;\n unit.buffs = [];\n unit.buff_icons = [];\n\n\n var moveSpriteSheet = new createjs.SpriteSheet({\n \"images\": [data.move],\n \"frames\": {\"regX\": 80, \"height\": 142, \"count\": 4, \"regY\": 100, \"width\": 142 },\n \"animations\": {\n \"walk\":[0,1,2,3]\n },\n framerate: 4\n });\n unit.moveAnimation = new createjs.Sprite(moveSpriteSheet, \"walk\");\n unit.moveAnimation.x = unit.x;\n unit.moveAnimation.y = unit.y;\n\n // Configure the hp bar of the unit\n hp_bar = new createjs.Shape();\n hp_bar.x = unit.x - 40;\n hp_bar.y = unit.y - 95;\n if (unit.team === 0){\n hp_bar.graphics.beginFill(\"#000000\").drawRect(0, 0, 82, 12);\n hp_bar.graphics.beginFill(\"#000000\").drawRect(1, 1, 80, 10);\n hp_bar.graphics.beginFill(\"#ff0000\").drawRect(1, 1, (getHealth(data)/getMaxHealth(data)) * 80, 10);\n } else {\n hp_bar.graphics.beginFill(\"#000000\").drawRect(0, 0, 82, 12);\n hp_bar.graphics.beginFill(\"#000000\").drawRect(1, 1, 80, 10);\n hp_bar.graphics.beginFill(\"#3399ff\").drawRect(1, 1, (getHealth(data)/getMaxHealth(data)) * 80, 10);\n }\n unit.hp_bar = hp_bar;\n\n\n // Configure move and attack range of the unit\n unit.moveRange = data.moveRange;\n unit.attackRange = data.attackRange;\n\n // Configure action control informations\n unit.canMove = data.canMove;\n unit.canAttack = data.canAttack;\n unit.skillCoolDown = data.skillCoolDown;\n unit.outOfMoves = data.outOfMoves;\n\n // Adding the unit to the list of units in the game\n units.push(unit);\n\n\n blockMaps[unit.row][unit.column] = 1;\n\n // Add the unit and its hp bar to the stage\n unit.moveAnimation.scaleX = 0.7;\n unit.moveAnimation.scaleY = 0.7;\n\n\n\n draggable.addChild(unit);\n // draggable.removeChild(unit.moveAnimation);\n\n\n\n draggable.addChild(hp_bar);\n chars.addChild(spawnAnimation);\n \n\n sortIndices(unit);\n\n unit.cache(0,0,150,150);\n hp_bar.cache(0,0,100,120);\n spawnAnimation.x = unit.x;\n spawnAnimation.y = unit.y;\n \n setTimeout(function() {\n chars.removeChild(spawnAnimation);\n }, 1000);\n\n\n addEventListenersToUnit(unit);\n\n if (unit.team == 1) {\n\n currentUnit = unit;\n } else {\n enemyUnit = unit;\n }\n // }); \n}", "function startGame(){\n // Shuffle the monsters array\n shuffle(monsters);\n\n // Create the HTML and inject it into the DOM\n app.innerHTML = '<div class=\"row\">' + monsters.map( function ( monster, index ) { //parameters for map are slightly different\n var html =\n '<div class=\"grid\" aria-live=\"polite\">' +\n //add a button so that the pictures are focusable. Not sure about using the index? How does this target pic?\n '<button data-monster-id=\"' + index +'\">' +\n //add some alt text to give screen readers something to read\n '<img alt=\"Click the door to find out what is behind it!\" src=\"door.svg\">' +\n '</button>' +\n '</div>';\n score = 0;\n return html;\n\n }).join('') + '</div>' +\n '<div id=\"scoreboard\" class=\"row\">' +\n `<span id=score>Score: ${score} </span>` + \n `<span id=wins>Wins: ${wins} </span>` +\n `<span id=restart></span>`\n '</div>'; \n}", "function renderMonster(monsters){\n console.log('entered renderMonster')\n for (const monster of monsters){\n let name= monster.name\n let age= monster.age\n let description= monster.description\n let specificMonster = document.createElement('div')\n specificMonster.insertAdjacentHTML('beforeend', \n `<ul>\n <li class='name'> \"${name}\" </li>\n <li class='age'>\"${age}\"</li>\n <li class='description'>\"${description}\"</li>\n </ul>`)\n monsterList.append(specificMonster)\n console.log('end of renderMonsters')\n }\n } // end of renderMonster", "function newGame() {\n clearGrid();\n const tiles = [];\n\n for (let i = 0; i < 2; i++) {\n const tile = spawnTile();\n tiles.push(tile);\n }\n\n return tiles;\n}", "generateShrooms(num) {\n for (i=0; i<num; i++) {\n const shroom = $('<img src=\"images/Mushroom.png\"/>');\n shroom.css('max-height', '80px');\n const left = (Math.random()*1000) + 'px';\n const top = (Math.random()*500) + 'px';\n shroom.css('margin-left', left);\n shroom.css('margin-top', top);\n $('.mushroom-container').append(shroom);\n let typeOfShroom = Math.random();\n if (typeOfShroom < .6) {\n shroom.addClass('normal');\n } else if ((typeOfShroom >= .6) && (typeOfShroom <.92)) {\n shroom.addClass('magic');\n } else if (typeOfShroom >= .92) {\n shroom.addClass('poisonous');\n }\n }\n }", "createObjects() {\n\t\tgame.level_frame = 0;\n\t\tlet l = window.app.level.split( '|' ).map( ( a ) => {\n\t\t\treturn a.split( ',' );\n\t\t} );\n\t\tterrain.set();\n\t\tlet obj = {\n\t\t\tw: ( arr ) => { //wait\n\t\t\t\tlet s = new GameControl( pInt( arr[ 1 ] ) );\n\t\t\t\ts.loc = arr[ 5 ];\n\t\t\t\ts.wait = arr[ 2 ];\n\t\t\t\ts.type = arr[ 6 ];\n\t\t\t\ts.level = arr[ 7 ];\n\t\t\t\ts.amt = arr[ 8 ];\n\t\t\t\tgame.a.push( s );\n\t\t\t},\n\t\t\tu: ( arr ) => { //uplink\n\t\t\t\tgame.a.push( new Plug( 'plug', pInt( arr[ 1 ] ), pInt( arr[ 2 ] ) , arr[ 3 ] ) );\n\t\t\t},\n\t\t\tc: ( arr ) => { //cache\n\t\t\t\t//game.a.push( new GroundCache( ...arr.slice( 1 ) ) );\n\t\t\t\tgame.a.push( new GroundCache( arr[ 1 ], arr[ 2 ], arr[ 3 ], arr[ 4 ] ) );\n\t\t\t},\n\t\t\tp: ( arr ) => { //pause\n\t\t\t\tlet s = new GameControl( pInt( arr[ 1 ] ) );\n\t\t\t\ts.pscds = pInt( arr[ 2 ] );\n\t\t\t\tgame.a.push( s );\n\t\t\t},\n\t\t\ts: ( arr ) => { //spawn\n\t\t\t\t// [ \"s\", 32, \"c\", \"a\", 1, \"12\" ]\n\t\t\t\tlet s = new GameControl( pInt( arr[ 1 ] ) );\n\t\t\t\ts.loc = arr[ 2 ];\n\t\t\t\ts.type = arr[ 3 ];\n\t\t\t\ts.level = arr[ 4 ];\n\t\t\t\ts.amt = arr[ 5 ];\n\t\t\t\tgame.a.push( s );\n\t\t\t},\n\t\t\tg: ( arr ) => { //ground\n\t\t\t\tgame.a.push( new GroundTank( 'ground' + arr[ 3 ], arr[ 1 ], arr[ 2 ] ) );\n\t\t\t},\n\t\t\tt: ( arr ) => { //text particle, permanent\n\t\t\t\tgame.a.push( new TextParticle( arr[ 3 ], arr[ 1 ] * 25, arr[ 2 ] * 32, true ) );\n\t\t\t},\n\t\t\tbl: ( arr ) => { //begin level\n\t\t\t\tlet s = new GameControl( pInt( arr[ 1 ] ) );\n\t\t\t\ts.blvl = arr[ 2 ];\n\t\t\t\ts.amt = 0;\n\t\t\t\ts.y = pInt( arr[ 1 ] );\n\t\t\t\ts.x = 0;\n\t\t\t\tgame.a.push( s );\n\t\t\t},\n\t\t\tsl: ( arr ) => { //end level\n\t\t\t\tlet s = new GameControl( pInt( arr[ 1 ] ) );\n\t\t\t\ts.elvl = arr[ 2 ];\n\t\t\t\tgame.a.push( s );\n\t\t\t}\n\t\t};\n\n\t\tl.forEach( ( arr ) => {\n\t\t\tobj[ arr[ 0 ] ]( arr );\n\t\t} );\n\t}", "makeMoons(lib) {\n for (var i=0;i<7;i++) {\n let newMoon = {\n s: Math.random()*12,\n x: Math.random()*(lib.width),\n y: lib.randomNumber(50, lib.height - 50),\n r: 62+lib.randomNumber(0,50),\n g: 39+lib.randomNumber(0,30),\n b: 35+lib.randomNumber(0,20)\n };\n this.madeMoons.push(newMoon);\n }\n }", "function createGameMap() {\n // start by making a 10x10 array of tiles\n g_tileManager.createNewEmptyMap();\n // add the terrain on the map\n /* to do... rafnars home */\n}", "function createMeteors(){\n for (var i = 0; i < numberOfMeteors; i++) {\n ArrayOfMeteors[i] = new Meteor();\n newX = Math.floor(Math.random()* c.width);\n if (newX < 30){\n ArrayOfMeteors[i].updateX(30);\n }\n else if (newX > c.width) {\n ArrayOfMeteors[i].updateX(c.width - 30);\n }\n else{\n ArrayOfMeteors[i].updateX(newX);\n }\n }\n}", "function createGame () {}", "function tileGenerator (i) {\n var currentTile = document.createElement('div'); // intializeing tile\n var letter = mixTiles(allTiles); // chooses the letter from randomized tiles\n currentTile.className = 'tile tile-' + letter + ' ui-draggable ui-draggable-handle'; // intialize the class name with the selected letters\n currentTile.style = \"position: relative;\"; // letters are position relative\n currentTile.id = totalTileID; // unique ID is created for each tile\n $('.tile-set')[i].append(currentTile); // makes an tile object to keep track.\n var shoveTile = { boardPos: i, tileId : totalTileID, charVal: letter, immobile: false};\n tileObj.push(shoveTile); // pushing into the array\n totalTileID++; // increase the unique ID.\n}", "function updateMonsters(){\n for(var i = 0; i<monsters.length; i++){\n if(monsters[i].level == level){\n var m = monsters[i];\n if(m.x<m.xMin || m.x>m.xMax){\n monsters[i].direction*=-1;\n }\n monsters[i].x += m.direction;\n //console.log(collisionDetection(playerBullet,monsters[i]))\n if(playerBullet.x+playerBullet.width>monsters[i].x && playerBullet.x<monsters[i].x+monsters[i].width &&\n playerBullet.y+playerBullet.height>monsters[i].y && playerBullet.y<monsters[i].y+monsters[i].height){\n //console.log(\"true\");\n monsters[i].lives-=1;\n playerBullet.firing = false;\n playerBullet.x = levelDimensions.right+500;\n playerBullet.y = levelDimensions.right+500;\n }\n if(collisionDetection(player,m)&&m.lives>0){\n teleport(10,310);\n }\n m = monsters[i]\n if(m.lives>0){\n ctx.beginPath();\n ctx.rect(m.x-cameraX,m.y-cameraY,m.width,m.height);\n if(m.type==1){\n ctx.fillStyle = \"#558800\";\n }else if(m.type == 2){\n ctx.fillStyle = \"#AA0000\";\n }else if(m.type==3){\n ctx.fillStyle = \"#332299\"\n }else if(m.type==4){\n ctx.fillStyle = \"#AABBCC\";\n }else if(m.type ==5){\n ctx.fillStyle = \"#AA1166\";\n }else if(m.type == 6){\n ctx.fillStyle = \"#100120\";\n }\n ctx.fill();\n ctx.closePath();\n }\n }\n }\n}", "function getDormMap() {\r\n\r\n // create a map of 8 small halls by 4 large halls\r\n var smHlNm = 6;\r\n var lgHlNm = 3;\r\n var mapWd = 12 * smHlNm + 1;\r\n var mapHt = 6 + (26 * (lgHlNm - 1));\r\n var buffer = 2;\r\n\r\n var dormmap = new Map(mapWd + 2 * buffer, mapHt + 2 * buffer);\r\n\r\n // Add the large halls\r\n for (var i = 0; i < lgHlNm; i++) {\r\n for (var x = 0; x < mapWd; x++) {\r\n dormmap.setTile(x + buffer, i * 26 + buffer, wallTile);\r\n dormmap.setTile(x + buffer, i * 26 + 6 + buffer, wallTile);\r\n for (var y = 1; y < 6; y++) {\r\n if (x > 0 && x < mapWd - 1) {\r\n dormmap.setTile(x + buffer, i * 26 + y + buffer, floorTile);\r\n } else {\r\n dormmap.setTile(x + buffer, i * 26 + y + buffer, wallTile);\r\n }\r\n }\r\n }\r\n\r\n // add some lights near where small halls will be\r\n for (var j = 0; j < smHlNm; j++) {\r\n dormmap.lights.push(new LightSource(j * 12 + 6 + buffer, i * 26 + 3 + buffer, 7, {r: 255, g: 255, b:0}));\r\n }\r\n }\r\n\r\n // Add the aux rooms\r\n // for each room, pick a large hall to set it under, give it a random width & height & position\r\n var lgh, rmx, rmy, rmw, rmh; // these positions are INTERNAL, they don't count walls\r\n\r\n // add the \"kitchen\" room; this is a wide room with four connecting halls\r\n lgh = getRandomInt(lgHlNm - 1);\r\n console.log(lgh);\r\n // it's 6-9 tiles tall by 9-15 panels wide\r\n rmw = getRandomInt(5) + 9;\r\n rmh = getRandomInt(4) + 6;\r\n rmx = getRandomInt(mapWd - rmw - 2 - buffer - buffer) + buffer + 1;\r\n rmy = getRandomInt(19 - rmh) + buffer + lgh * 26 + 7;\r\n\r\n for (var rmi = rmx - 1; rmi < rmx + rmw + 1; rmi++) {\r\n for (var rmj = rmy - 1; rmj < rmy + rmh + 1; rmj++) {\r\n if (rmi >= rmx && rmi < rmx + rmw && rmj >= rmy && rmj < rmy + rmh) {\r\n dormmap.setTile(rmi, rmj, floorTile);\r\n } else {\r\n dormmap.setTile(rmi, rmj, wallTile);\r\n }\r\n }\r\n }\r\n\r\n // add the halls; these are just at the four corners of the room\r\n var hlx = rmx;\r\n var hly = rmy - 1;\r\n do {\r\n dormmap.setTile(hlx, hly, floorTile);\r\n dormmap.setTile(hlx - 1, hly, wallTile);\r\n dormmap.setTile(hlx + 1, hly, wallTile);\r\n hly--;\r\n } while (dormmap.getTile(hlx, hly) !== floorTile);\r\n hlx = rmx + rmw - 1;\r\n hly = rmy - 1;\r\n do {\r\n dormmap.setTile(hlx, hly, floorTile);\r\n dormmap.setTile(hlx - 1, hly, wallTile);\r\n dormmap.setTile(hlx + 1, hly, wallTile);\r\n hly--;\r\n } while (dormmap.getTile(hlx, hly) !== floorTile);\r\n hlx = rmx;\r\n hly = rmy + rmh;\r\n do {\r\n dormmap.setTile(hlx, hly, floorTile);\r\n dormmap.setTile(hlx - 1, hly, wallTile);\r\n dormmap.setTile(hlx + 1, hly, wallTile);\r\n hly++;\r\n } while (dormmap.getTile(hlx, hly) !== floorTile);\r\n hlx = rmx + rmw - 1;\r\n hly = rmy + rmh;\r\n do {\r\n dormmap.setTile(hlx, hly, floorTile);\r\n dormmap.setTile(hlx - 1, hly, wallTile);\r\n dormmap.setTile(hlx + 1, hly, wallTile);\r\n hly++;\r\n } while (dormmap.getTile(hlx, hly) !== floorTile);\r\n\r\n // add the \"utility room\", this is a 3 x 5-7 room with no hall, a blinking red light, and a flashlight\r\n\r\n do {\r\n lgh = getRandomInt(lgHlNm - 1);\r\n rmw = 3;\r\n rmh = getRandomInt(3) + 5;\r\n rmx = getRandomInt(mapWd - rmw - 2 - buffer - buffer) + buffer + 1;\r\n } while (dormmap.doesRectCollide(rmx, buffer + 7 + lgh * 26, rmw, 19));\r\n console.log(lgh);\r\n if (getRandomInt(2)) { // choose if it's up or down\r\n rmy = 9 + lgh * 26;\r\n for (var rmi = rmx - 1; rmi < rmx + rmw + 1; rmi++) {\r\n for (var rmj = rmy; rmj < rmy + rmh + 1; rmj++) {\r\n if (rmi == rmx - 1 || rmi == rmx + rmw || rmj == rmy + rmh) {\r\n dormmap.setTile(rmi, rmj, wallTile);\r\n } else {\r\n dormmap.setTile(rmi, rmj, floorTile);\r\n }\r\n }\r\n }\r\n dormmap.setTile(rmx + 1, rmy - 1, doorTileClosed);\r\n dormmap.lights.push(new LightSource(rmx + 1, rmy - 2, 5, {r: 255, g: 0, b: 0}, 1000));\r\n } else {\r\n rmy = 28 + lgh * 26 - rmh;\r\n for (var rmi = rmx - 1; rmi < rmx + rmw + 1; rmi++) {\r\n for (var rmj = rmy - 1; rmj < rmy + rmh; rmj++) {\r\n if (rmi == rmx - 1 || rmi == rmx + rmw || rmj == rmy - 1) {\r\n dormmap.setTile(rmi, rmj, wallTile);\r\n } else {\r\n dormmap.setTile(rmi, rmj, floorTile);\r\n }\r\n }\r\n }\r\n dormmap.setTile(rmx + 1, rmy + rmh, doorTileClosed);\r\n dormmap.lights.push(new LightSource(rmx + 1, rmy + rmh + 1, 5, {r: 255, g: 0, b: 0}, 1000));\r\n }\r\n // Add the small halls\r\n \r\n \r\n // take note of small rooms as potential starting positions\r\n var roomcenters = [];\r\n\r\n for (var i = 0; i < smHlNm; i++) {\r\n for (var j = 0; j < lgHlNm - 1; j++) {\r\n if (!dormmap.doesRectCollide(i * 12 + 5 + buffer, j * 26 + 7 + buffer, 3, 19)) {\r\n // create the hallway; put walls on sides; put floors on ends\r\n // extend into the wall of the big halls\r\n var si = i * 12 + 4 + buffer;\r\n var sj = j * 26 + 6 + buffer; // top left wall tile\r\n for (var jh = sj; jh < sj + 21; jh++) {\r\n dormmap.setTile(si, jh, wallTile);\r\n dormmap.setTile(si + 1, jh, floorTile);\r\n dormmap.setTile(si + 2, jh, floorTile);\r\n dormmap.setTile(si + 3, jh, floorTile);\r\n dormmap.setTile(si + 4, jh, wallTile);\r\n }\r\n\r\n // there's enough room along the small halls to put five rooms along each side\r\n for (var rm = 0; rm < 5; rm++) {\r\n // left room\r\n var rmi = si - 4;\r\n var rmj = sj + rm * 4; // top left wall tile of room\r\n if (!dormmap.doesRectCollide(rmi + 1, rmj + 1, 3, 3)) {\r\n for (var wi = 0; wi < 5; wi++) {\r\n for (var wj = 0; wj < 5; wj++) {\r\n if (wi > 0 && wi < 4 && wj > 0 && wj < 4) {\r\n dormmap.setTile(rmi + wi, rmj + wj, floorTile);\r\n } else {\r\n dormmap.setTile(rmi + wi, rmj + wj, wallTile);\r\n }\r\n dormmap.setTile(rmi + 4, rmj + 2, doorTileClosed);\r\n }\r\n }\r\n roomcenters.push({x: rmi + 2, y: rmj + 2});\r\n }\r\n // right room\r\n rmi = si + 4;\r\n if (!dormmap.doesRectCollide(rmi + 1, rmj + 1, 3, 3)) {\r\n for (var wi = 0; wi < 5; wi++) {\r\n for (var wj = 0; wj < 5; wj++) {\r\n if (wi > 0 && wi < 4 && wj > 0 && wj < 4) {\r\n dormmap.setTile(rmi + wi, rmj + wj, floorTile);\r\n } else {\r\n dormmap.setTile(rmi + wi, rmj + wj, wallTile);\r\n }\r\n dormmap.setTile(rmi, rmj + 2, doorTileClosed);\r\n }\r\n }\r\n roomcenters.push({x: rmi + 2, y: rmj + 2});\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n var selectedroom =getRandomInt(roomcenters.length);\r\n player.x = roomcenters[selectedroom].x;\r\n player.y = roomcenters[selectedroom].y;\r\n\r\n dormmap.lights.push(new LightSource(player.x, player.y, 5));\r\n\r\n // always add the player to creaturelist\r\n dormmap.creatureset.push(player);\r\n return dormmap;\r\n}", "function waterCreator(amount, room) {\n for(var idx = 0; idx < amount; idx++) {\n var water = new Location(-1, -1);\n water.canMove = true;\n water.description = \"Murky water. You can't tell how deep it is.\";\n water.terrainType = \"water\";\n water.symbol = \"w\";\n water.color = \"blue\";\n water.searchable = false;\n water.drops = [];\n\n room.waters.push(water);\n }\n}", "generateGame() {\n\n this.generateGrounds();\n this.setPlayers();\n this.setPlayerStartArea();\n this.generateUnbreakableWalls();\n this.generateBreakableWalls();\n this.generateItems();\n GameElements.bombs.splice(0,GameElements.bombs.length);\n GameElements.explosions.splice(0,GameElements.explosions.length);\n \n }", "generateBreakableWalls() {\n\n //Reincia el array\n GameElements.breakableWalls.slice(0, GameElements.breakableWalls.length);\n //LLeno el array de muros con todos las coordenadas disponibles \n //salvo las coordenadas de las zonas de incio de cada jugador\n let x = 50;\n let y = 50;\n for (let i = 1; i <= 111; i++) {\n //Si no son coordenadas de la zona de inicio \n if (!this.isAPlayerStartZone(x, y)) {\n let wall = new Element(x, y, Element.TYPE.BREAKABLE_WALL);\n GameElements.breakableWalls.push(wall);\n let position = GameElements.getPosition(x, y);\n GameElements.elementsPosition.set(position, wall);\n }\n //Lineas inpares\n if (y % 100 == 0) {\n x += 100;\n }\n //lineas pares\n else {\n x += 50;\n }\n //cambio de linea\n if (x >= 700) {\n x = 50;\n y += 50;\n }\n }\n //Retiro 40 paredes de maneras aleatoria\n for (let i = 0; i < 40; i++) {\n let index = Math.floor(Math.random() * GameElements.breakableWalls.length);\n let element = GameElements.breakableWalls[index];\n let position = GameElements.getPosition(element.xPos, element.yPos);\n GameElements.elementsPosition.set(position, new Element(element.xPos, element.yPos, Element.TYPE.GROUND))\n GameElements.breakableWalls.splice(index, 1);\n }\n\n }", "function newEnemy() {\n var enemyGen = Math.ceil(Math.random() * 5)\n if (enemyGen === 1) {\n var bogRat = new enemyCreature ('Bog Rat', 5, 6, 2, [balmVial], 'none');\n creature = bogRat;\n enemyGraphic.innerHTML = '<img src=\"images/bog-rat.jpg\">';\n enemyHp.innerText = creature.name + ' hit points: ' + creature.hp; \n } else if (enemyGen === 2) {\n var basilisk = new enemyCreature ('Basilisk', 7, 7, 2, [balmVial], 'none');\n creature = basilisk;\n enemyGraphic.innerHTML = '<img src=\"images/basilisk.jpg\">';\n enemyHp.innerText = creature.name + ' hit points: ' + creature.hp; \n } else if (enemyGen === 3) {\n var moorHound = new enemyCreature ('Moor Hound', 10, 8, 4, [balmVial], 'none');\n creature = moorHound;\n enemyGraphic.innerHTML = '<img src=\"images/moor-hound.png\">';\n enemyHp.innerText = creature.name + ' hit points: ' + creature.hp; \n } else if (enemyGen === 4) {\n var darkNibilis = new enemyCreature ('Dark Nibilis', 12, 9, 2, [balmVial, sporePod], 'none');\n creature = darkNibilis;\n enemyGraphic.innerHTML = '<img src=\"images/dark-nibilis.jpg\">';\n enemyHp.innerText = creature.name + ' hit points: ' + creature.hp; \n } else {\n var cursedMilitia = new enemyCreature ('Cursed Militia', 15, 10, 4, [balmVial, spike, powderShell], 'none');\n creature = cursedMilitia;\n enemyGraphic.innerHTML = '<img src=\"images/cursed-militia.jpg\">';\n enemyHp.innerText = creature.name + ' hit points: ' + creature.hp; \n }\n}", "function generateItems(){\n \n /////////////////////////////////////////ARMAS/////////////////////////////////\n for(var i = 0; i < 5; i++){\n switch(Math.floor(Math.random()*2)){\n case 0:\n var w = new WeaponItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200), 'pistol', 1, 500, 10, 'pistola');\n break;\n case 1:\n var w = new WeaponItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200),'ak-47', 0.25, 200, 30, 'metralleta');\n break;\n }\n while(map.tileMap.getTileWorldXY(w.sprite.x, w.sprite.y, 32, 32, map.layers[0]) === null ||\n \t\tmap.tileMap.getTileWorldXY(w.sprite.x, w.sprite.y, 32, 32, map.layers[3]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(w.sprite.x, w.sprite.y, 32, 32, map.layers[4]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(w.sprite.x, w.sprite.y, 32, 32, map.layers[5]) !== null){\n w.sprite.x = Math.floor(Math.random()*2800 + 200);\n w.sprite.y = Math.floor(Math.random()*2800 + 200);\n }\n itemsGroup.add(w.sprite);\n weaponItems.push(w);\n }\n \n //////////////////////////////////////////FIN ARMAS//////////////////////////////////\n \n ////////////////////////////////////////MUNICION/////////////////////////////////////\n for(var i = 0; i < 6; i++){\n switch(Math.floor(Math.random()*2)){\n case 0:\n var a = new AmmoItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200), 'pistol_ammo',10, 'pistola');\n break;\n case 1:\n var a = new AmmoItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200),'ak47_ammo',30, 'metralleta');\n break;\n }\n while(map.tileMap.getTileWorldXY(a.sprite.x, a.sprite.y, 32, 32, map.layers[0]) === null ||\n \t\tmap.tileMap.getTileWorldXY(a.sprite.x, a.sprite.y, 32, 32, map.layers[3]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(a.sprite.x, a.sprite.y, 32, 32, map.layers[4]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(a.sprite.x, a.sprite.y, 32, 32, map.layers[5]) !== null){\n a.sprite.x = Math.floor(Math.random()*2800 + 200);\n a.sprite.y = Math.floor(Math.random()*2800 + 200);\n }\n itemsGroup.add(a.sprite);\n ammoItems.push(a);\n }\n \n \n //////////////////////////////////////FIN MUNICION///////////////////////////////////////\n \n /////////////////////////////////////ESCUDO//////////////////////////////////////////////\n for(var i = 0; i < 4; i ++){\n var s = new ShieldItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200));\n while(map.tileMap.getTileWorldXY(s.sprite.x, s.sprite.y, 32, 32, map.layers[0]) === null ||\n \t\tmap.tileMap.getTileWorldXY(s.sprite.x, s.sprite.y, 32, 32, map.layers[3]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(s.sprite.x, s.sprite.y, 32, 32, map.layers[4]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(s.sprite.x, s.sprite.y, 32, 32, map.layers[5]) !== null){\n s.sprite.x = Math.floor(Math.random()*2800 + 200);\n s.sprite.y = Math.floor(Math.random()*2800 + 200);\n }\n itemsGroup.add(s.sprite);\n shieldItems.push(s);\n }\n //Comida\n for(var i = 0; i < 8; i++){\n var f = new FoodItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200),'food');\n while(map.tileMap.getTileWorldXY(f.sprite.x, f.sprite.y, 32, 32, map.layers[0]) === null ||\n \t\tmap.tileMap.getTileWorldXY(f.sprite.x, f.sprite.y, 32, 32, map.layers[3]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(f.sprite.x, f.sprite.y, 32, 32, map.layers[4]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(f.sprite.x, f.sprite.y, 32, 32, map.layers[5]) !== null){\n f.sprite.x = Math.floor(Math.random()*2800 + 200);\n f.sprite.y = Math.floor(Math.random()*2800 + 200);\n }\n itemsGroup.add(f.sprite);\n foodItems.push(f);\n }\n \n //Por último, mandamos la info de los items al servidor\n //Para weapon y ammo se manda u array para el tipo y otro para las posiciones. Para el resto de los items solo se mandan las posiciones\n var weaponPos = new Array();\n var weaponType = new Array();\n var ammoPos = new Array();\n var ammoType = new Array();\n var foodPos = new Array();\n var shieldPos = new Array();\n \n for (var i = 0; i < 5; i++){\n \tweaponPos[i] = new Array();\n }\n for (var i = 0; i < 6; i++){\n ammoPos[i] = new Array();\n }\n \n for (var i = 0; i < 4; i++){\n\n shieldPos[i] = new Array();\n }\n for (var i = 0; i < 8; i++){\n foodPos[i] = new Array();\n }\n for (var i = 0; i < 5; i++){\n \tweaponType[i] =weaponItems[i].type;\n \tweaponPos[i][0] = weaponItems[i].sprite.x;\n \tweaponPos[i][1] = weaponItems[i].sprite.y;\n }\n \n for(var i = 0; i < 6; i++){\n \tammoType[i] = ammoItems[i].type;\n \tammoPos[i][0] = ammoItems[i].sprite.x;\n \tammoPos[i][1] = ammoItems[i].sprite.y;\n }\n \n for(var i = 0; i < 4; i++){\n \tshieldPos[i][0] = shieldItems[i].sprite.x;\n \tshieldPos[i][1] = shieldItems[i].sprite.y;\n }\n \n for(var i = 0; i < 8; i++){\n \tfoodPos[i][0] = foodItems[i].sprite.x;\n \tfoodPos[i][1] = foodItems[i].sprite.y;\n }\n sendItemsWS(weaponType, weaponPos, ammoType, ammoPos, shieldPos, foodPos);\n\n clearItems();\n}", "function spawnMonster() {\n\n // the game buttons are here due to start screen, these buttons will only work once player clicks the door.\n attackButton.addEventListener('click', attack);\n speedAttackButton.addEventListener('click', speedAttack);\n potionButton.addEventListener('click', potionUse);\n staminaButton.addEventListener('click', staminaUse);\n fleeButton.addEventListener('click', fleeRoll);\n\n var body = document.querySelector(\".monster-screen\");\n body.style.backgroundImage = \"url(images/dungeon-bg.jpg)\"\n // this changes the background to inner dungeon bg once door is clicked.\n var monsterName = document.getElementById('monster-name');\n var monsterImage = document.getElementById('monster-image');\n checkEnemies();\n currentEnemy = remainingEnemies[Math.floor(Math.random() * remainingEnemies.length)]; // this refactors the variable so that it only chooses from the new filtered array.\n console.log(remainingEnemies);\n monsterName.innerHTML = currentEnemy.name;\n monsterDescription.innerHTML = `${currentEnemy.name} has a difficulty of ${currentEnemy.difficulty}. ${currentEnemy.ability}`; //the currentEnemy ability will show on the player screen.\n // monsterDescription.innerHTML = `${currentEnemy.name} has a difficulty of ${currentEnemy.difficulty}.`;\n\n monsterImage.src = currentEnemy.image\n if (remainingEnemies.length === 1) {\n monsterDescription.innerHTML = \"Dungeon Cleared!\";\n monsterName.innerHTML = \"Congrats!\";\n monsterImage.src = \"images/chest.png\";\n scoreCount();\n } // spawn monster is called each time a monster is killed.\n\n}", "function createMonster(level, items, position) {\n let monster = {\n name: monsterNames[Math.floor(Math.random() * 14)],\n level,\n hp: level * 100,\n attack: level * 10,\n speed: 6000 / level,\n items: cloneArray(items),\n position,\n type: 'monster',\n visual: 'M',\n resetToMaxHp: function() {\n let maxHP = this.level * 100;\n if (this.hp > maxHP) {\n this.hp = maxHP;\n }\n },\n getExp: function() {\n player.exp += this.level * 10;\n player.levelUp();\n },\n };\n print('Creating monster...');\n return monster;\n}", "function updateMonsters() {\n for (var i = 0; i < Game.monsters.length; i++) {\n if (Game.monsters[i].active) {\n Game.monsters[i].update();\n } else if (Game.monsters[i].inBounds){\n removeElement(Game.monsters, i);\n life -=1;\n }\n }\n\n}", "function generateMap(){\n var canvas = document.getElementById('map');\n var ctx = canvas.getContext('2d');\n var weight = {\"dirt\" : 1,\"grass\" : 1, \"water\" : 1};\n var x, y;\n for (x = 0; x < 1500; x+=75) {\n for (y = 0; y < 1500; y+=75) {\n tile = getRandomTile(weight);\n createTile(ctx,tile,x,y);\n if(tile == \"water\"){\n weight = {\"dirt\" : 0.2,\"grass\" : 2, \"water\" : 0.9};\n }\n else if(tile == \"grass\"){\n weight = {\"dirt\" : 0.9,\"grass\" : 1, \"water\" : 1.2};\n }\n else{\n weight = {\"dirt\" : 1 ,\"grass\" : 1, \"water\" : 1};\n }\n }\n }\n}", "generateUnbreakableWalls() {\n\n //Reincia el array\n GameElements.unbreakableWalls.splice(0, GameElements.unbreakableWalls.length);\n //PAREDES EXTERNAS\n let xPos = 0;\n let yPos = 0;\n for (let i = 1; i <= 52; i++) {\n if (yPos == 0 || yPos == 600) {\n let position = GameElements.getPosition(xPos, yPos);\n let wall = new Element(xPos, yPos,\n Element.TYPE.UNBREAKABLE_WALL);\n GameElements.unbreakableWalls.push(wall);\n GameElements.elementsPosition.set(position, wall);\n }\n else {\n if (xPos == 0) {\n let position = GameElements.getPosition(xPos, yPos);\n let wall = new Element(xPos, yPos,\n Element.TYPE.UNBREAKABLE_WALL);\n GameElements.unbreakableWalls.push(wall);\n GameElements.elementsPosition.set(position, wall);\n xPos = 700;\n position = GameElements.getPosition(xPos, yPos);\n wall = new Element(xPos, yPos,\n Element.TYPE.UNBREAKABLE_WALL);\n GameElements.unbreakableWalls.push(wall);\n GameElements.elementsPosition.set(position, wall);\n i++;\n }\n }\n xPos += 50;\n if (xPos == 750) {\n xPos = 0;\n yPos += 50;\n }\n }\n\n //PAREDES INTERIORES \n xPos = 100;\n yPos = 100;\n for (let i = 53; i <= 82; i++) {\n\n let wall = new Element(xPos, yPos,\n Element.TYPE.UNBREAKABLE_WALL);\n GameElements.unbreakableWalls.push(wall);\n let positionNumber = GameElements.getPosition(xPos, yPos);\n GameElements.elementsPosition.set(positionNumber, wall);\n xPos += 100;\n if (xPos == 700) {\n xPos = 100;\n yPos += 100;\n }\n }\n\n }", "function generateObstacles() {\n\n for (var obstacleX = 0; obstacleX < numberOfObstacles; obstacleX++) {\n var randomY = random(1, (height / 4));\n var randomX = random(0, width - ((20 * width) / 100));\n var randomW = random(0, width / 2);\n if (randomX < ((10 * width) / 100)) {\n randomX = ((10 * width) / 100);\n } else if (randomX + randomW > width - ((10 * width) / 100)) {\n randomX = width - ((10 * width) / 100) - randomW;\n }\n\n if (randomW < 100) {\n randomW = 100;\n }\n obstacles[obstacleX] = {'x': randomX, 'y': randomY + target.y + 20, 'width': randomW, 'height': 30};\n }\n}", "function create () {\n\t\t\t\t\t// We create the world of our simulation\n\t\t\t\t\t// will randomply set objects and everything up according to constant.js data\n\t\t\t\t\t_this.world = new World();\n\n\t\t\t\t\t// we draw a ground sprite for every tile of the world\n\t\t\t\t\t// we also maintain an array of sprites to draw on the top of the ground tiles\n\t\t\t\t\t_this.sprites = new Array(_this.world.map_size);\n\t\t\t\t\tfor(var y=0;y<_this.world.map_size;y++){\n\t\t\t\t\t\t_this.sprites[y] = new Array(_this.world.map_size).fill(undefined);\n\t\t\t\t\t\tfor(var x=0;x<_this.world.map_size;x++){\n\t\t\t\t\t\t\t_this.game.add.sprite( 1 + x*_this.world_sprite_size, 1+ y*_this.world_sprite_size, \"ground\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// allow Phaser app to still work if focus is lost\n\t\t\t\t\t_this.game.stage.disableVisibilityChange = true;\n\n\t\t\t\t\t// will resize the Phaser app at best and keep aspect ratio\n\t\t\t\t\t_this.game.scale.scaleMode = 2;\n\n\t\t\t\t\t// how many logic update per phaser update we want to perform\n\t\t\t\t\t// this var represents how many simulation updates per second we want\n\t\t\t\t\t_this.updates_per_second = 1;\n\t\t\t\t\t// this is to keep track of the elapsed time since last simulation updates\n\t\t\t\t\t_this.elapsed_time_cumul = 0;\n\t\t\t\t\t// how often we want to compute stats and update graphes per simulation updates\n\t\t\t\t\t_this.stats_update = _this.updates_per_second * 100;\n\t\t\t\t\t// maximum number of dot to be displayed on graphes\n\t\t\t\t\t_this.max_graph_dots = 200;\n\n\n\t\t\t\t\t// create graphes to display our stats\n\t\t\t\t\t_this.avg_error_graph = app.graphUtils.scalableGeneric2DGraph(\"avg-error\", _this.max_graph_dots, _this.stats_update, 150);\n\t\t\t\t\t_this.avg_random_behavior_graph = app.graphUtils.scalableGeneric2DGraph(\"avg-random-behavior\", _this.max_graph_dots, _this.stats_update, 150);\n\t\t\t\t\t_this.avg_reward_graph = app.graphUtils.scalableGeneric2DGraph(\"avg-reward\", _this.max_graph_dots, _this.stats_update, 150);\n\t\t\t\t\t_this.avg_plant_nearby_graph = app.graphUtils.scalableGeneric2DGraph(\"avg-plant-nearby\", _this.max_graph_dots, _this.stats_update, 150);\n\t\t\t\t\t_this.avg_eat_graph = app.graphUtils.scalableGeneric2DGraph(\"avg-eat\", _this.max_graph_dots, _this.stats_update, 150);\n\t\t\t\t\t_this.avg_feed_graph = app.graphUtils.scalableGeneric2DGraph(\"avg-feed\", _this.max_graph_dots, _this.stats_update, 150);\n\n\t\t\t\t\t// extracting the weights of the network\n\t\t\t\t\tvar weights = [];\n\t\t\t\t\tfor(var l=0;l<_this.world.creature.nn.layer_count;l++){\n\t\t\t\t\t\tfor(var i=0;i<_this.world.creature.nn.layers[l].input_unit_count;i++){\n\t\t\t\t\t\t\tfor(var o=0;o<_this.world.creature.nn.layers[l].output_unit_count;o++){\n\t\t\t\t\t\t\t\tweights.push( _this.world.creature.nn.layers[l].weights[o][i]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// creating neural network representation\n\t\t\t\t\t_this.nn_graph = app.graphUtils.neuralNetworkGraph(\"nn-graph\", _this.constants.network, weights);\n\n\t\t\t\t\twindow.creature = _this.world.creature;\n\t\t\t\t}", "function create(){\n\n scene = this;\n document.body.style.cursor = \"none\";\n camera = this.cameras.main;\n gameOver = 0;\n \n\n\n const map = this.make.tilemap({key:\"pantano\"});\n\n const tileset = map.addTilesetImage(\"terreno\", \"tiles\");\n const tileset2 = map.addTilesetImage(\"terreno2\", \"tiles2\");\n const tileset3 = map.addTilesetImage(\"terreno3\", \"tiles3\");\n\n suelo = map.createLayer('ground', tileset2).setDepth(-3);\n fondoAguaBuena = map.createLayer('ground2', tileset2).setDepth(-1);\n fondo = map.createLayer('AguaMala', tileset2).setDepth(-1);\n scene.obstaculos = map.createLayer('Obstaculos', tileset);\n scene.obstaculos2 = map.createLayer('obstaculo2', tileset).setDepth(-1);\n scene.obstaculos3 = map.createLayer('obstaculo3', tileset).setDepth(-1);\n scene.copaDeArbol = map.createLayer('copaDelArbol', tileset).setDepth(3);\n scene.casa2 = map.createLayer('casa2', tileset3);\n scene.casa1 = map.createLayer('casa1', tileset3);\n tileSpawner = map.createFromObjects('RespawnEnemigos');\n\n //fondo.setCollisionByExclusion(-1, true);\n scene.obstaculos.setCollisionByProperty({collides:true});\n\n scene.obstaculos2.setCollisionByProperty({collides:true});\n scene.obstaculos2.setCollisionByProperty({cut_attack:true});\n\n scene.casa1.setCollisionByProperty({collides:true});\n scene.casa2.setCollisionByProperty({collides:true});\n\n scene.obstaculos3.setCollisionByProperty({collides:true});\n scene.obstaculos3.setCollisionByProperty({cut_attack:true});\n //Movimiento del veneno\n this.tweens.timeline({\n targets: fondo, duration: 1500,\n loop: -1,\n tweens: [{ alpha: 0.7, }, { alpha: 1, },],\n });\n /*const debubGraphics = this.add.graphics().setAlpha(0.55);\n scene.obstaculos.renderDebug(debubGraphics,{\n tileColor:null,\n collidingTileColor: new Phaser.Display.Color(243,134,48,255),\n faceColor: new Phaser.Display.Color(40,39,37,255)\n });*/\n\n \n //Grupos Creados\n\n\n enemyList = this.physics.add.group();\n enemyList.lengua = this.physics.add.group();\n\n glish.create();\n \n //Enseña los FPS que tiene el juego\n fpsText = this.add.text(16,16,'FPS: '+ game.loop.actualFps,{fontsize:'8px',fill:'#FFF'}).setScrollFactor(0).setDepth(10);\n\n tileSpawner.forEach(obj => {\n this.physics.world.enable(obj);\n obj.setAlpha(0);\n if(obj.name == 'rana'){\n ranas.createEnemyRana(obj, config, enemyList);\n }\n else if(obj.name == 'mosquito'){\n mosquitos.createEnemyMosquito(obj, config, enemyList);\n }else if(obj.name == 'conseguir_glish'){\n npc.create(obj); \n }else if(obj.name == 'BossCalamar' && !bossMuerto){\n swampBoss.createBoss(obj, config, enemyList);\n }else if(obj.name == 'tentaculos' && !bossMuerto){\n swampBoss.generateTentacles(obj);\n }\n\n })\n\n\tportal.createAnims();\n\tportal.create(tileSpawner);\n\n\n //Overlap\n poisonTiles = fondo.filterTiles(tile => tile.properties.veneno).map(x => x.index);\n poisonAspectTiles = fondo.filterTiles(tile => tile.properties.aspectoVeneno).map(x => x.index);\n poisonTilesId = [...(new Set(poisonTiles))];\n fondo.setTileIndexCallback(poisonTilesId, glish.poisonPlayer, this.physics.add.overlap(glish.glish, fondo));\n fondo.setTileIndexCallback(poisonTilesId, glish.poisonPlayer, this.physics.add.overlap(glish.ondaList, fondo));\n fondo.setTileIndexCallback(poisonAspectTiles, glish.poisonPlayer, this.physics.add.overlap(glish.ondaList, fondo));\n\n cutTiles = scene.obstaculos2.filterTiles(tile => tile.properties.cut_attack).map(x => x.index);\n cutTilesId = [...(new Set(cutTiles))];\n\n cutTiles2 = scene.obstaculos3.filterTiles(tile => tile.properties.cut_attack).map(x => x.index);\n cutTilesId2 = [...(new Set(cutTiles2))];\n\n scene.obstaculos2.setTileIndexCallback(cutTilesId, glish.climbing_plant, this.physics.add.overlap(glish.beamList, scene.obstaculos2));\n\n scene.obstaculos3.setTileIndexCallback(cutTilesId2, glish.climbing_plant, this.physics.add.overlap(glish.beamList, scene.obstaculos3));\n\n this.physics.add.overlap(enemyList, glish.beamList, enemigos.recibirDanyo);\n\n this.physics.add.overlap(glish.glish,enemyList, glish.recibirDanyo);\n this.physics.add.overlap(glish.glish,swampBoss.tentacleSegmentsGroup, glish.recibirDanyo);\n this.physics.add.overlap(swampBoss.enemigoBoss, glish.beamList,enemigos.recibirDanyo);\n this.physics.add.overlap(glish.glish,swampBoss.enemigoBoss, glish.recibirDanyo);\n\n \n\n //Colisiones\n\n this.physics.add.collider(enemyList, enemyList);\n\n\n this.physics.add.collider(glish.glish, scene.obstaculos);\n this.physics.add.collider(glish.glish, scene.obstaculos2);\n this.physics.add.collider(glish.glish, scene.obstaculos3);\n this.physics.add.collider(glish.glish, scene.casa1);\n this.physics.add.collider(glish.glish, scene.casa2);\n this.physics.add.collider(glish.beamList, scene.obstaculos);\n this.physics.add.collider(glish.beamList, scene.casa1);\n this.physics.add.collider(glish.beamList, scene.casa2);\n this.physics.add.collider(glish.beamList, scene.obstaculos3);\n\n\tportal.collisionPortal(glish.glish)\n\n}", "function CreateDungeon() {\n\n \n \n var numAttempts = 100; // the number of attempts that can happen. Each attempt is a potential room\n var totalAttempts = 0;\n\n // in order to generate paths in between the rooms, keep the previously created room on hand \n var previousRoom = null;\n\n for (attempts = 0; attempts < numAttempts; attempts++) { \n \n // first, create a random room at a random location\n var CurrentRoom = CreateRandomRoom();\n\n // now, check if our room overlaps with any other rooms previously created;\n var DoesOverlap = CheckIfRoomOverlaps(CurrentRoom);\n\n if (!DoesOverlap)\n {\n // the room is safe to add the the dungeon, add it to the RoomList\n RoomList.push(CurrentRoom);\n\n // add it to the grid\n RoomToGrid(CurrentRoom);\n }\n\n \n\n totalAttempts += 1;\n }\n\n // ALL the rooms had to be created first, before we created the hallways\n // otherwise, the rooms might spawn over hallways, essentially cutting them off\n // now that the rooms are created, go over each room and connect it to a previous one.\n // this will generally lead to somewhat (appearing) random and winding hallways. It's a simple method, may replace it with a better one later\n\n\n\n // first, generate the tiles neighbours\n GenerateTileNeighbours();\n\n // we create the hallways now\n RoomList.forEach(function(currentRoom) {\n // connect a passageway from this room to the previous room\n if (previousRoom != null)\n {\n CreateHallwayFromNodes(RandomRoomSpot(currentRoom),RandomRoomSpot(previousRoom));\n }\n\n previousRoom = currentRoom;\n });\n\n DrawGrid();\n\n c.stroke();\n}", "function addObjects() {\r\n // The function always generates the first platform to a fixed position\r\n if (first) {\r\n addPlatform(800, 400);\r\n }\r\n // Gives the boundarys where platforms can generate\r\n if(valimuisti.body.y > 700) {\r\n valimuisti.body.y = 700;\r\n }\r\n\r\n // Here we define the bounds in which between the platform should be generated. The platform being generated is always compared to the previous platform created.\r\n var yla = valimuisti.body.y;\r\n var ala = 600 - valimuisti.body.y;\r\n\r\n // Randomizing logic\r\n if (yla > ala) {\r\n matala = true;\r\n }\r\n if (ala > yla) {\r\n matala = false;\r\n }\r\n\r\n //The case in which the y value of the previous platform is more than half of the game boundaries height.\r\n\r\n if (matala == false) {\r\n var random = satu(100, 500);\r\n }\r\n\r\n // And vice versa\r\n if (matala == true) {\r\n if (valimuisti.body.y <= 200) {\r\n valimuisti.body.y = 300;\r\n }\r\n var random = satu((valimuisti.body.y - 200), 500);\r\n }\r\n\r\n // Just checking this isn't the first time we're running through this code\r\n if (first == false)\r\n\r\n {\r\n addPlatform(798, random);\r\n if ((counter % satu(1, 3)) == 0) {\r\n // Here we use the function created earlier to randomize the position of the stars \r\n\r\n addStars(800, random - satu(36, 100));\r\n\r\n\r\n }\r\n\r\n }\r\n\r\n first = false;\r\n\r\n\r\n\r\n // Aaaand looping the platform creation function. Also updating the counter variable, which is used for game speed and updating the score.\r\n if (game_over == false) {\r\n timer = game.time.events.add(Phaser.Timer.SECOND * satu(1, 1.2), addObjects, this);\r\n }\r\n\r\n if (temp < 80) {\r\n counter = temp;\r\n }\r\n temp++;\r\n\r\n // And as an added bonus we add some monsters into the map at this point\r\n addMonsters();\r\n\r\n\r\n}", "createStartingUnits(units, startingObjectsList){\n var keys, unitInfo, unitCoords, amount;\n if (loadingSavedGame === true) {\n if(this.isPlayer() === true) {\n keys = currentData.units;\n //console.log(\"Player units\", keys);\n\n for(var i = 0; i < keys.length; i++){\n\n unitInfo = this.getUnitInfo(keys[i].type);\n //console.log (unitInfo);\n amount = 1;\n\n //creates the correct amount of buildings for the current type\n for(var j = 0; j < amount; j++){\n this.unitAmount++;\n\n unitCoords = {\n x: keys[i].x,\n y: keys[i].y\n }\n var unitHealth = keys[i].health;\n var unit = new Unit(unitInfo, unitCoords.x, unitCoords.y, this.game, this.isPlayer(), this, unitHealth);\n this.units.push(unit);\n }\n }\n } // creating player units using saved data\n else {\n keys = currentData.ai_units;\n //console.log(\"Enemy units\", keys);\n\n for(var i = 0; i < keys.length; i++){\n\n unitInfo = this.getUnitInfo(keys[i].type);\n //console.log (unitInfo);\n amount = 1;\n\n //creates the correct amount of buildings for the current type\n for(var j = 0; j < amount; j++){\n this.unitAmount++;\n\n unitCoords = {\n x: keys[i].x,\n y: keys[i].y\n }\n var aiUnitHealth = keys[i].health;\n var unit = new Unit(unitInfo, unitCoords.x, unitCoords.y, this.game, this.isPlayer(), this, aiUnitHealth);\n this.units.push(unit);\n }\n }\n }\n } // creating ai units using saved data\n else {\n //gets all the types of the starting units\n var keys = Object.keys(units);\n\n //goes through the different types of units the kingdom starts with and creates the given kingdom's base starting units\n for(var i = 0; i < keys.length; i++){\n var unitInfo = this.getUnitInfo(keys[i]);\n var amount = units[keys[i]];\n\n\n\n //goes through and creates the starting units\n for(var j = 0; j < amount; j++){\n\n this.unitAmount++;\n var unitCoords = this.findStartingPosition(unitInfo, this.unitAmount, startingObjectsList);\n var unit = new Unit(unitInfo, unitCoords.x, unitCoords.y, this.game, this.isPlayer(), this, 0);\n\n\n this.units.push(unit);\n }\n }\n } // creating player and ai units on a new game\n }", "function render() {\n // useful variables\n var canvasWidth = app.canvas.width;\n var canvasHeight = app.canvas.height;\n var groundY = ground.y;\n\n background.removeAllChildren();\n\n // this fills the background with a obnoxious yellow\n // you should modify this to suit your game\n var backgroundFill = draw.rect(canvasWidth,canvasHeight,'rgb(35, 40, 51)');\n background.addChild(backgroundFill);\n\n // TODO: 3 - Add a moon and starfield\n function randomNum(min, max){\n return(Math.random() * (+max - +min) + +min);\n }\n var customStar;\n for(var i = 0; i < 600; i++){\n \n customStar = draw.bitmap('img/customStar.gif');\n customStar.x = randomNum(1, 1500);\n customStar.y = randomNum(1, 1000);\n background.addChild(customStar);\n customStars.push(customStar);\n }\n \n var customStarSpec;\n for(var i = 0; i < 20; i++){\n customStarSpec = draw.bitmap('img/customStarSpec.png');\n customStarSpec.x = randomNum(1, 1500);\n customStarSpec.y = randomNum(1, 1000);\n background.addChild(customStarSpec);\n customStarsSpec.push(customStarsSpec);\n }\n \n customMoon = draw.bitmap('img/customMoon.png');\n background.addChild(customMoon);\n customMoon.x = 700;\n customMoon.y = 50;\n \n // TODO: 5 - Add buildings! Q: This is before TODO 4 for a reason! Why?\n var building;\n for(var i=1;i<7;++i) {\n var buildingHeight = randomNum(100,300);\n building = draw.rect(75,buildingHeight,'LightGray','Black',1);\n building.x = 225 * i;\n building.y = groundY-buildingHeight;\n background.addChild(building);\n buildings.push(building);\n }\n\n // TODO 4: Part 1 - Add a tree\n tree = draw.bitmap('img/tree.png');\n tree.x = 900;\n tree.y = 200;\n background.addChild(tree);\n }", "function generateWorld() {\n\t\t/**\n\t\t * Initialize the arrays with 0\n\t\t */\n\t\tfor (var j = 0; j <= 14; j++) {\n\t\t\tfor (var i = 0; i <= 18; i++) {\n\t\t\t\tbrick_array[i][j] = 0;\n\t\t\t\tentity_array[i][j] = 0;\n\t\t\t\tgoody_array[i][j] = 0;\n\t\t\t}\n\t\t};\n\t\t\n\t\tfor(var j = 0; j <=14; j++) {\n\t\t\tfor(var i = 0; i <=18; i++) {\n\t\t\t\t\n\t\t\t\tif(generateWall(i, j)) { \n\t\t\t\t Crafty.e(\"2D, DOM, wall\")\n\t\t\t\t .attr({ x: i * 32, y: j * 32, z: 3 })\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(generateBricks(i, j)) {\n\t\t\t\t\tentity_array[i][j] = Crafty.e(\"2D, DOM, brick, solid, explodable\")\n\t\t\t\t\t\t.attr({ x: i * 32, y: j * 32, z: 3 })\n\t\t\t\t\t\t.bind('explode', function() {\n\t\t\t\t\t\t\tCrafty.e(\"SetBurningBrick\")\n\t\t\t\t\t\t\t\t.setBurningBrick(this.x, this.y);\n this.destroy();\n })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t/**\n\t\t * Print the values of the array to the console \n\t\t */\n\n\t\t//console.log(string);\n\t}", "function createEnemies() {\n let numberEnemies = 8;\n for (let i = 0; i < numberEnemies; i++) {\n let randomTrack;\n if (i == 0 || i == 1) {\n randomTrack = 0;\n }\n if (i == 2 || i == 3) {\n randomTrack = 1;\n }\n if (i == 4 || i == 5) {\n randomTrack = 2;\n }\n if (i == 6 || i == 7) {\n randomTrack = 3;\n }\n // from https://stackoverflow.com/questions/1527803/generating-random-whole-numbers-in-javascript-in-a-specific-range\n function getRandomSpeed(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n } \n let randomSpeed = getRandomSpeed(75, 175);\n // from https://stackoverflow.com/questions/6645067/javascript-dynamically-creating-variables-for-loops\n window[\"enemy\" + i] = new Enemy(randomTrack, randomSpeed);\n allEnemies.push(window[\"enemy\" + i]);\n }\n}", "function generateDungeonMaze(width, height, name, method, groundtile, walltiles, sourceImage, exits) {\n\n var map = new Map();\n map.width = width;\n map.height = height;\n map.visibility = new Array(this.width*this.height);\n map.tileEntry = Game.tiles[sourceImage];\n map.name = name;\n\n // Create a simple maze room with an exit:\n var maze = null\n if (method[0]=='Kruskal') maze = generateMazeKruskal(width,height,method[1]);\n if (method[0]=='RecursiveDivision') maze = generateMazeRecursiveDivision(width,height,method[1]);\n\n // make sure exists is open:\n for(var i = 0;i<exits.length;i++) {\n var exit = exits[i];\n for(var j = 0;j<exit[0][2];j++) {\n for(var k = 0;k<exit[0][3];k++) {\n maze[exit[0][0]+j][exit[0][1]+k] = 1; \n }\n }\n for(var j = 0;j<exit[1][2];j++) {\n for(var k = 0;k<exit[1][3];k++) {\n maze[exit[1][0]+j][exit[1][1]+k] = 1; \n }\n }\n }\n\n map.newLayer();\n map.newLayer();\n for(var i = 0;i<height;i++) {\n for(var j = 0;j<width;j++) {\n map.setTile(j,i,0,groundtile);\n// if (maze[j][i]==0) map.setTile(j,i,1,walltiles[0]);\n if (maze[j][i]==0) map.setTile(j,i,1,properWallTile(j,i,maze,walltiles));\n }\n }\n\n // Create the exits:\n for(var i = 0;i<exits.length;i++) {\n var exit = exits[i];\n for(var j = 0;j<exit[0][2];j++) {\n for(var k = 0;k<exit[0][3];k++) {\n map.setTile(exit[0][0]+j, exit[0][1]+k, 1, exit[2]);\n }\n }\n if (exit[3]==null) {\n // do nothing\n } else if (exit[3]=='gameComplete') {\n var script = [{action:\"gameComplete\"}];\n map.triggers.push({x:exit[0][0], y:exit[0][1],\n width:exit[0][2], height:exit[0][3], \n repeat:false,\n script:script});\n } else {\n // create a bridge:\n map.bridges.push({x:exit[0][0], y:exit[0][1], width:exit[0][2], height:exit[0][3], id:exit[3]});\n map.bridgeDestinations.push({x:exit[1][0], y:exit[1][1], width:exit[1][2], height:exit[1][3], id:exit[3]});\n }\n }\n\n\n return map;\n}", "function setupTower(){\n //you code here\n for(var i=0; i<6; i++)\n {\n for(var j=0; j<3; j++)\n { \n colors.push(color(0, random(150,255), 0));\n boxes.push(Bodies.rectangle(750+j*80, 0, 80, 80));\n }\n }\n World.add(engine.world, boxes);\n}", "function generate() {\n // Last time validation, in case user ends up messing with vars\n adjustMines();\n \n generateBoard();\n \n generateJSON();\n \n board = [];\n}", "function createMobs(game, level) {\n mobs = [];\n mobs = game.add.group();\n mobTypes = getMobTypes();\n for(i=0; i<MOBS_PER_LEVEL && level != START_LEVEL; i++) {\n var mob = mobs.create(getRandomWorldX(game) + 1000, getInitialY(level, game), getMob());\n game.physics.arcade.enable(mob);\n mob.body.bounce.y = 0.5;\n mob.body.gravity.y = getYGravity(level);\n mob.body.velocity.x = getXVelocity(level);\n mob.body.velocity.y = getYVelocity(level);\n mob.body.bounce.y = 0.5 + Math.random() * 0.5;\n mob.outOfBoundsKill = true;\n }\n\n return mobs;\n}", "function showMonsters(monster) {\n const monsterDiv = document.createElement('div')\n monsterDiv.setAttribute('class', 'monster')\n\n const monsterImg = document.createElement('img')\n monsterImg.setAttribute('src', `https://robohash.org/${monster.id}?set=set2`)\n monsterDiv.append(monsterImg)\n\n const pName = document.createElement('p')\n pName.setAttribute('class', 'name')\n pName.textContent = `${monster.name}`\n monsterDiv.append(pName)\n\n const pEmail = document.createElement('p')\n pEmail.setAttribute('class', 'email')\n pEmail.textContent = `${monster.email}`\n monsterDiv.append(pEmail)\n\n allMonster.append(monsterDiv)\n}", "function createMoons(planetType) {\n //each type only has one texture\n var moonTypes = [\n 'volcanic',\n 'ice',\n 'barren',\n 'terran'\n ];\n\n\n var moons = [];\n var moonCount;\n \n if(planetType === 'gas') {\n moonCount = Math.round(rand(3, 6));\n } else if (planetType === 'terran') {\n moonCount = Math.round(rand(1, 2));\n } else {\n moonCount = Math.round(rand(0, 2));\n }\n\n for (var i = 0; i < moonCount; ++i) {\n var moon = {};\n moon.type = Math.round(rand(0, 3));\n moon.distance = i * 100;\n moon.orbit = Math.round((rand(0, 1) * 100)) / 100;\n moons.push(moon);\n }\n}", "function createDiamonds() {\n if (World.frameCount % 80 == 0) {\n var diamonds = createSprite(Math.round(random(50, 350),40, 10,10));\n diamonds.addImage(diamondsImg);\n diamonds.scale=0.03;\n diamonds.velocityY = 3;\n diamonds.lifetime = 150;\n diamondsG.add(diamonds);\n }\n}", "function setup() {\n\n //Make the world from the Tiled JSON data and the tileset PNG image\n world = g.makeTiledWorld(\"maps/monsterMaze.json\", \"images/monsterMaze.png\");\n\n //Create the alien sprite and set its speed\n alien = world.getObject(\"alien\");\n alien.speed = 4;\n\n //Get a reference to the array that stores all the wall data\n wallMapArray = world.getObject(\"wallLayer\").data;\n\n //We're just using the monsters sprites in the Tiled Editor\n //map as generic placeholders. We're going to use their size and\n //position data to build new monster sprites from scratch and place\n //them in the world. That's because we want to give the monsters\n //custom animation frames. Here's how to do this:\n\n //1. Get a reference to the map's monster sprites and the\n //layer container that those sprites are one\n let mapMonsters = world.getObjects(\"monster\");\n let monsterLayer = world.getObject(\"monsterLayer\");\n\n //2.Define the monster's animation frames. In this example there are just\n //two: the monster mouth open, and the monster's mouth closed.\n monsterFrames = g.frames(\"images/monsterMaze.png\", //The tileset image\n [[128, 0], [128, 64]], //The `x` and `y` positions of frames\n 64, 64 //The `width` and `height` of each frame\n );\n\n //3.Create a new array called `monsters` that contains a new `monster`\n //sprite for each `mapMonster` in the original array. The new\n //`monster` sprites are created using the `monsterFrames` we defined\n //above and have the same `x` and `y` positions as the original\n //placeholder monsters from the Tiled Editor map. We're also going\n //to give them new `direction` and `speed`. Finally, we need to make the\n //placeholder monsters invisible and add the new `monster` sprite\n //to the `monsterLayer` container.\n monsters = mapMonsters.map(mapMonster => {\n let monster = g.sprite(monsterFrames);\n monster.x = mapMonster.x;\n monster.y = mapMonster.y;\n monster.direction = \"none\";\n monster.speed = 4;\n monsterLayer.addChild(monster);\n mapMonster.visible = false;\n\n //Define the monster's two states: `normal` and `scared`\n //`0` and `1` refer to the monster's two animation frames\n monster.states = {\n normal: 0,\n scared: 1\n };\n return monster;\n });\n\n //Give the `alien` a `direction` property and initilize it to \"none\"\n alien.direction = \"none\";\n\n //Configure Hexi's built in arrow keys to assign the alien a direction\n //Create some keyboard objects\n leftArrow = g.keyboard(37);\n upArrow = g.keyboard(38);\n rightArrow = g.keyboard(39);\n downArrow = g.keyboard(40);\n\n //Program the keyboard objects\n leftArrow.press = () => alien.direction = \"left\";\n upArrow.press = () => alien.direction = \"up\";\n rightArrow.press = () => alien.direction = \"right\";\n downArrow.press = () => alien.direction = \"down\";\n\n //Change the game state to `play`\n g.state = play;\n}", "createRoom(x, y, width, height) {\n for (let i = -1; i <= width; i++) {\n for (let j = -1; j <= height; j++) {\n //if i == -1 || i == width - create boundary\n if(i == -1 || i == width) {\n //if we are at the topwest corner\n if(j == -1 && i == -1) {\n this.setTile(0, x+i, y+j, 3);\n } \n //if we are at the topeast corner\n else if (i == width && j == -1) {\n this.setTile(0, x+i, y+j, 5);\n }\n //if we are at either of the vertical areas (not corners)\n else if (j >= 0 && j < height) {\n this.setTile(0, x+i, y+j, 6);\n } \n //if we are at the bottomwest corner\n else if (i == -1 && j == height) {\n this.setTile(0, x+i, y+j, 7);\n } \n //if we are at the bottomeast corner\n else if (i == width && j == height) {\n this.setTile(0, x+i, y+j, 8);\n }\n\n //set collision tile\n this.setTile(1, x+i, y+j, 1);\n }\n //if we inside the room (x-wise)\n else if (i >= 0 && i < width) {\n //if we are at the y bottom\n if (j == height) {\n this.setTile(0, x+i, y+j, 4);\n this.setTile(1, x+i, y+j, 1);\n }\n //if we are at the y top\n else if(j == -1) {\n this.setTile(0, x+i, y+j, 4);\n this.setTile(1, x+i, y+j, 1);\n } \n //else create floor\n else {\n this.setTile(0, x+i, y+j, 1);\n }\n }\n }\n }\n }", "function newGame() {\n\n $(\"#\" + ourCharacter).removeClass(\"us\");\n for (var i = 0; i < enemies.length; i++) {\n $(\"#\" + enemies[i]).removeClass(\"enemies\");\n }\n\n gameState = 0;\n battleVictoryCounter = 0;\n enemies = [\"gunner\", \"swordsman\", \"archer\", \"mage\"];\n gunner[\"healthPoints\"] = 140;\n swordsman[\"healthPoints\"] = 140;\n archer[\"healthPoints\"] = 140;\n mage[\"healthPoints\"] = 140;\n gunner[\"attackPower\"] = 5;\n swordsman[\"attackPower\"] = 5;\n archer[\"attackPower\"] = 5;\n mage[\"attackPower\"] = 5;\n gunner[\"counterAttackPower\"] = 25;\n swordsman[\"counterAttackPower\"] = 25;\n archer[\"counterAttackPower\"] = 25;\n mage[\"counterAttackPower\"] = 25;\n\n \n\n $(\"#gunner\").empty().html(\"<img src=\\\"./assets/images/gunner.jpg\\\">\").prepend(\"<p class=\\\"name\\\">\" + gunner[\"name\"] + \"</p>\").append(\"<p class=\\\"health_points\\\">HP: \" + gunner[\"healthPoints\"] + \"</p>\");\n $(\"#swordsman\").empty().html(\"<img src=\\\"./assets/images/swordsman.jpg\\\">\").prepend(\"<p class=\\\"name\\\">\" + swordsman[\"name\"] + \"</p>\").append(\"<p class=\\\"health_points\\\">HP: \" + swordsman[\"healthPoints\"] + \"</p>\");\n $(\"#archer\").empty().html(\"<img src=\\\"./assets/images/archer.jpg\\\">\").prepend(\"<p class=\\\"name\\\">\" + archer[\"name\"] + \"</p>\").append(\"<p class=\\\"health_points\\\">HP: \" + archer[\"healthPoints\"] + \"</p>\");\n $(\"#mage\").empty().html(\"<img src=\\\"./assets/images/mage.jpg\\\">\").prepend(\"<p class=\\\"name\\\">\" + mage[\"name\"] + \"</p>\").append(\"<p class=\\\"health_points\\\">HP: \" + mage[\"healthPoints\"] + \"</p>\");\n $(\"#character_window\").children(\"h2\").text(\"Character Selection\");\n $(\"#character_window\").append($(\"#gunner\")).append($(\"#swordsman\")).append($(\"#archer\")).append($(\"#mage\"));\n $(\"#versus\").remove();\n $(\"#log_text\").empty();\n $(\"#instructions_text\").text(\"Welcome to the Stickfigure Showdown! Choose a character to get started...\");\n }", "function spawnObstaclesTop(){\n if(frameCount % 60 === 0) {\n var obstacleTop = createSprite(400,50,40,50); \n obstacleTop.y=Math.round(random(10,100)); \n //generate random obstacles\n var rand = Math.round(random(1,2));\n switch(rand) {\n case 1: obstacleTop.addImage(obsTop1);\n break;\n case 2: obstacleTop.addImage(obsTop2);\n break;\n default: break;\n }\n \n //assign scale and lifetime to the obstacle \n obstacleTop.scale = 0.1;\n obstacleTop.velocityX=-4;\n obstacleTop.lifetime = 100;\n balloon.depth = balloon.depth+1;\n topObstaclesGroup.add(obstacleTop);\n \n } \n}", "function create_wall() {\r\n\t\t/*wall = {\r\n\t\tx: Math.round(Math.random()*(w-cw)/cw),\r\n\t\ty: Math.round(Math.random()*(h-cw)/cw),\r\n\t\t};*/\r\n\t\tvar p,\r\n\t\tq,\r\n\t\tr,\r\n\t\ts;\r\n\t\tvar interseca = false;\r\n\t\tvar length = 10; //\r\n\t\twall_array = []; //Empty array to start with\r\n\r\n\t\tvar walll = new Wall(0, 0, w, 0);\r\n\t\twall_array.push(walll);\r\n\t\twalll = new Wall(w, 0, w, h);\r\n\t\twall_array.push(walll);\r\n\t\twalll = new Wall(0, 0, 0, h);\r\n\t\twall_array.push(walll);\r\n\t\twalll = new Wall(0, h, w, h);\r\n\t\twall_array.push(walll);\r\n\t\tfor (var i = length - 1; i >= 0; i--) {\r\n\r\n\t\t\tdo { //finchè non esce un muro che non si interseca con gli altri\r\n\t\t\t\tinterseca = false;\r\n\t\t\t\tp = Math.round(Math.random() * (w - cw));\r\n\t\t\t\tq = Math.round(Math.random() * (h - cw));\r\n\t\t\t\tr = Math.round(Math.random() * (w - cw));\r\n\t\t\t\ts = Math.round(Math.random() * (h - cw));\r\n\r\n\t\t\t\tfor (var k = 0; k < wall_array.length && !interseca; k++) {\r\n\t\t\t\t\t//\tvar c = wall_array[k];\r\n\t\t\t\t\tinterseca = interseca || intersects(wall_array[k].x1, wall_array[k].y1, wall_array[k].x2, wall_array[k].y2, p, q, r, s);\r\n\t\t\t\t}\r\n\t\t\t} while (interseca);\r\n\r\n\t\t\t//wall_array.push({x: Math.round(Math.random()*(w-cw)/cw), y: Math.round(Math.random()*(h-cw)/cw)});\r\n\r\n\t\t\tvar walll = new Wall(p, q, r, s);\r\n\t\t\twall_array.push(walll);\r\n\t\t\t//wall_array.push({x: Math.round(Math.random()*(w-cw)), y: Math.round(Math.random()*(h-cw))});// FARE I MURI come matrice o disegnarli come righe memorizzandoli a coppie di punti\r\n\r\n\t\t}\r\n\r\n\t\t//This will create a cell with x/y between 0-44\r\n\t\t//Because there are 45(450/10) positions accross the rows and columns\r\n\t}", "function generateTiles() { \n\tposArr = [];\n\tvar tilArr = [];\n\tvar finArr = [];\n\tfor(var i = 0; i < 24; i++){\n\t\tvar temp = randInt(0, 23);\n\t\twhile(posArr.indexOf(temp) >= 0){\n\t\t\ttemp = randInt(0, 23);\n\t\t}\n\t\tposArr[i] = temp;\n\t}\n\tfor(var i = 0; i < 24; i++) {\n\t\tvar temp = new Tile(\"tile\", TextureFrame(posArr[i] + \".png\"), i);\n\t\ttilArr.push(temp);\n\t\ttiles.set(i, tilArr[i]);\n\t\tpuzzleC.addChild(tilArr[i]);\n\t}\n\t\n\temptyTile = new Tile(\"emptyTile\", TextureFrame(\"24.png\"), 24);\n\tposArr.push(24)\n\temptyTile.visible = false;\n\ttiles.set(24, emptyTile);\n\tpuzzleC.addChild(emptyTile);\n\t\n\tconsole.log(posArr);\n\tconsole.log(tilArr);\n}", "function makeBuilding(options) {\n \n var wallX = options.width / 2;\n var wallY = options.height;\n var wallZ = options.depth / 2;\n \n // collect walls\n var building = {};\n \n // south/noth walls\n [true, false].forEach(function (isSouth) {\n var wallTZ = isSouth ? -wallZ : wallZ;\n var wallGroup = new Group({\n addTo: options.addTo,\n translate: {\n z: wallTZ\n },\n });\n \n var wallPath = [{\n x: -wallX,\n y: -wallY\n }];\n \n if (options.gable == 'ns') {\n wallPath.push({\n x: 0,\n y: -wallY - wallX\n });\n }\n \n wallPath = wallPath.concat([{\n x: wallX,\n y: -wallY\n },\n {\n x: wallX,\n y: 0\n },\n {\n x: -wallX,\n y: 0\n },\n ]);\n \n // wall\n new Shape({\n path: wallPath,\n addTo: wallGroup,\n color: isSouth ? red : gold,\n });\n \n var windowColor = isSouth ? navy : red;\n var windowProperty = isSouth ? 'southWindows' : 'northWindows';\n handleWindows(options, windowProperty, wallGroup, windowColor);\n \n var wallProperty = isSouth ? 'southWall' : 'northWall';\n building[wallProperty] = wallGroup;\n \n });\n \n // east/west wall\n [true, false].forEach(function (isWest) {\n var wallGroup = new Group({\n addTo: options.addTo,\n translate: {\n x: isWest ? -wallX : wallX\n },\n rotate: {\n y: TAU / 4\n },\n });\n \n var wallPath = [{\n x: -wallZ,\n y: -wallY\n }];\n \n if (options.gable == 'ew') {\n wallPath.push({\n x: 0,\n y: -wallY - wallZ\n });\n }\n \n wallPath = wallPath.concat([{\n x: wallZ,\n y: -wallY\n },\n {\n x: wallZ,\n y: 0\n },\n {\n x: -wallZ,\n y: 0\n },\n ]);\n \n // wall\n new Shape({\n path: wallPath,\n addTo: wallGroup,\n color: isWest ? blue : white,\n });\n \n var windowColor = isWest ? navy : blue;\n var windowProperty = isWest ? 'westWindows' : 'eastWindows';\n handleWindows(options, windowProperty, wallGroup, windowColor);\n \n var wallProperty = isWest ? 'westWall' : 'eastWall';\n building[wallProperty] = wallGroup;\n });\n \n \n var roofMakers = {\n ns: function () {\n var y0 = -wallY - wallX;\n var roofPanel = new Shape({\n path: [{\n x: 0,\n y: y0,\n z: -wallZ\n },\n {\n x: 0,\n y: y0,\n z: wallZ\n },\n {\n x: wallX,\n y: -wallY,\n z: wallZ\n },\n {\n x: wallX,\n y: -wallY,\n z: -wallZ\n },\n ],\n addTo: options.addTo,\n color: gold,\n });\n roofPanel.copy({\n scale: {\n x: -1\n },\n color: navy,\n });\n },\n \n ew: function () {\n var y0 = -wallY - wallZ;\n var xA = options.isChurch ? -wallX + 8 : -wallX;\n var roofPanel = new Shape({\n path: [{\n z: 0,\n y: y0,\n x: xA\n },\n {\n z: 0,\n y: y0,\n x: wallX\n },\n {\n z: wallZ,\n y: -wallY,\n x: wallX\n },\n {\n z: wallZ,\n y: -wallY,\n x: xA\n },\n ],\n addTo: options.addTo,\n color: red,\n });\n roofPanel.copy({\n path: [{\n z: 0,\n y: y0,\n x: -wallX\n },\n {\n z: 0,\n y: y0,\n x: wallX\n },\n {\n z: wallZ,\n y: -wallY,\n x: wallX\n },\n {\n z: wallZ,\n y: -wallY,\n x: -wallX\n },\n ],\n scale: {\n z: -1\n },\n color: navy,\n });\n },\n };\n \n var roofMaker = roofMakers[options.gable];\n if (roofMaker) {\n roofMaker();\n }\n \n return building;\n }", "function createSystemWindow() {\n planets = [];\n createSystemBG();\n for (let i = 0; i < 8; i++) {\n planetGenerator();\n }\n}", "function createEnemeis() {\n for(let y of [160, 240, 330]) {\n let x = Math.random() * 200;\n allEnemies.push(new Enemy(x, y));\n }\n}", "function placedMonsterCreator(type, room) {\n var monster = new Location(-1, -1);\n monster.canMove = false;\n monster.terrainType = \"monster\";\n monster.searchable = false;\n monster.color = \"yellow\";\n monster.monsterType = \"\";\n\n if(type === \"golem\") {\n monster.description = \"A golem, much larger than any you've previously seen.\";\n monster.symbol = \"Ώ\";\n monster.monsterType = \"super golem\";\n } else if(type === \"dragon\") {\n monster.description = \"A massive scaled creature slumbers here. Its wings flap a little everytime it takes a breath. The air around the beast shimmers like the air around an intense fire.\"\n monster.symbol = \"♠\";\n monster.monsterType = \"dragon\";\n } else if(type === \"random\") {\n var randomMonster = getMonster();\n monster.description = \"A monster of indeterminate type.\";\n monster.monsterType = \"random\";\n monster.symbol = \"!\";\n }\n\n room.monsters.push(monster);\n}", "generateEnemies() {\n for (let i = 0; i < gameData.level.enemies.length; i++) {\n const enemy = gameData.level.enemies[i];\n enemy.spawnTime = gameData.level.spawnRate * (i + 1) + (enemy.wave * 600)\n enemy.gameObject = this.add.sprite(0, 0, enemy.type)\n enemy.gameObject.originalIndex = i\n enemy.gameObject.health = enemy.health\n enemy.gameObject.currencyValue = enemy.currencyValue\n enemy.gameObject.anchor.set(1, 1)\n gameState.spawnableEnemies.push(enemy)\n }\n }", "function generateDiamonds(){\n if (frameCount%50===0){\n // creating sprites of each diamond\n var diamond2= createSprite(1200,120,40,10);\n diamond2.x= Math.round(random(80,950));\n diamond2.addImage(diamondImage);\n diamond2.scale=0.5;\n diamond2.velocityY= 6;\n diamond2.lifetime=2000;\n diamondsGroup.add(diamond2);\n }\n}", "function itemPlacer(runCreator) {\n if(runCreator) {\n doorCreator(1, room);\n chestCreator(3, room);\n waterCreator(5, room);\n lavaCreator(4, room);\n spikeCreator(2, room);\n placedMonsterCreator(\"random\", room);\n }\n room.doors[0].y = 0;\n room.doors[0].x = 5;\n room.chests[0].y = 3;\n room.chests[0].x = 1;\n room.chests[1].y = 5;\n room.chests[1].x = 7;\n room.chests[2].y = 8;\n room.chests[2].x = 3;\n room.waters[0].y = 1;\n room.waters[0].x = 1;\n room.waters[1].y = 2;\n room.waters[1].x = 1;\n room.waters[2].y = 2;\n room.waters[2].x = 2;\n room.waters[3].y = 4;\n room.waters[3].x = 1;\n room.waters[4].y = 4;\n room.waters[4].x = 2;\n room.lavas[0].y = 7;\n room.lavas[0].x = 5;\n room.lavas[1].y = 7;\n room.lavas[1].x = 4;\n room.lavas[2].y = 8;\n room.lavas[2].x = 5;\n room.lavas[3].y = 8;\n room.lavas[3].x = 4;\n room.monsters[0].y = 1;\n room.monsters[0].x = 5;\n room.spikes[0].y = 2;\n room.spikes[0].x = 4;\n room.spikes[1].y = 2;\n room.spikes[1].x = 6;\n\n mapArrays[room.doors[0].y][room.doors[0].x] = room.doors[0];\n mapArrays[room.chests[0].y][room.chests[0].x] = room.chests[0];\n mapArrays[room.chests[1].y][room.chests[1].x] = room.chests[1];\n mapArrays[room.chests[2].y][room.chests[2].x] = room.chests[2];\n mapArrays[room.waters[0].y][room.waters[0].x] = room.waters[0];\n mapArrays[room.waters[1].y][room.waters[1].x] = room.waters[1];\n mapArrays[room.waters[2].y][room.waters[2].x] = room.waters[2];\n mapArrays[room.waters[3].y][room.waters[3].x] = room.waters[3];\n mapArrays[room.waters[4].y][room.waters[4].x] = room.waters[4];\n mapArrays[room.lavas[0].y][room.lavas[0].x] = room.lavas[0];\n mapArrays[room.lavas[1].y][room.lavas[1].x] = room.lavas[1];\n mapArrays[room.lavas[2].y][room.lavas[2].x] = room.lavas[2];\n mapArrays[room.lavas[3].y][room.lavas[3].x] = room.lavas[3];\n mapArrays[room.monsters[0].y][room.monsters[0].x] = room.monsters[0];\n mapArrays[room.spikes[0].y][room.spikes[0].x] = room.spikes[0];\n mapArrays[room.spikes[1].y][room.spikes[1].x] = room.spikes[1];\n\n miniWallMaker(1,4);\n miniWallMaker(1,6);\n }", "function template(){\n canvas = document.getElementById('tiles');\n ctx = canvas.getContext('2d');\n createTile(ctx,'dirt',0,0);\n createTile(ctx,'grass',85,0);\n createTile(ctx,'water',170,0);\n}", "function renderMonsters(arr) {\n if (arr.length === 0){\n alert('There are no more mosnters to load')\n pageNum -= 1\n loadMonsters()\n }\n monsterContainer.innerHTML = \"\"\n arr.forEach((monster) => {\n monsterContainer.innerHTML += makeMonster(monster)\n })\n }", "function createJwellery() {\n if (World.frameCount % 80 == 0) {\n var jwellery = createSprite(Math.round(random(50, 350),40, 10, 10)); \n jwellery.addImage(jwelleryImg);\n jwellery.scale=0.13;\n jwellery.velocityY = 3;\n jwellery.lifetime = 150;\n jwelleryG.add(jwellery);\n }\n}", "function createSword(){\n if (World.frameCount % 150 == 0) {\n var sword = createSprite(Math.round(random(50, 350),40, 10, 10));\n sword.addImage(swordImg);\n sword.scale=0.1;\n sword.velocityY = 3;\n sword.lifetime = 150;\n swordGroup.add(sword);\n }\n}", "function create(type) \n{\n if(type == \"wall\")\n {\n var a = randomInRange(canvas.height/2,canvas.height*0.75);\n var wall = {\n x : canvas.width,\n height : a,\n y : existence(0.5) * (canvas.height - a),\n type : \"wall\"\n }\n\n obstacle.push(wall);\n }\n\n else if(type==\"rock\")\n {\n var rock={\n x : canvas.width - wallWidth - 10, //so rock appears behind wall\n y : randomInRange(0.1, 0.9) * canvas.height,\n height : 100,\n type : \"rock\",\n speed : 2 * gameSpeed,\n update : function(){\n this.x -= this.speed;\n }\n }\n obstaclerock.push(rock);\n }\n\n else if (type == \"mario\")\n {\n var a = (1 + randomInRange(0, 0.5)) * canvas.width;\n var b = canvas.height - 100;\n var mar = {\n x : a,\n y : b,\n height : 100,\n type : \"mario\",\n status : 1,\n speed : gameSpeed,\n bullet : {\n c : a + rockWidth / 2,\n d : b,\n bx : gameSpeed,\n by : Math.sqrt(canvas.height) / 2.5,\n radius : 10\n },\n update:function()\n {\n this.x -= this.speed;\n },\n updateBullet:function()\n {\n this.bullet.c -= this.bullet.bx;\n this.bullet.d -= this.bullet.by;\n this.bullet.by -= 0.1;\n var dis = Math.sqrt((this.bullet.c - deep.x) * (this.bullet.c - deep.x) + (this.bullet.d - deep.y) * (this.bullet.d - deep.y))\n if(dis < deep.radius + this.bullet.radius) //kill by bullet hit\n {\n anime = 0;\n gameover = 1;\n }\n },\n }\n mario.push(mar);\n}\n\n }", "function init() {\n MyCanvas.init();\n hero.init();\n MyScore.score = 0;\n MyHeart.heart = 3;\n MyProgressBar.init();\n\n isPause = false;\n isWin = false;\n isGameOver = false;\n\n\n while (mons_array.length > 0) {\n mons_array.pop();\n }\n\n while (mons_array.length < monster_number) {\n generate_mons.add();\n }\n\n console.log('init');\n}", "function debugCreate(){\n\t\n\tvar testMissile\n\ttestMissile = new EnemySpawner(['enemyMissiles'], [new SpawnPoint(10,6)], player);\n\ttestMissile.spawn();\n\tvar rifle = new Weapon(game, room_width/2, room_height/2, 'rifleSprite', 'RIFLE', player);\n var shotgun = new Weapon(game, room_width/2 + 100, room_height/2, 'shotgunSprite', 'SHOTGUN', player);\n var smg = new Weapon(game, room_width/2 + 200, room_height/2, 'smgSprite', 'SMG', player);\n\t\n\n}" ]
[ "0.7602432", "0.75176483", "0.75172555", "0.71170855", "0.71164656", "0.7082114", "0.7081697", "0.6843119", "0.6697015", "0.667763", "0.6616454", "0.66113347", "0.6593418", "0.6581595", "0.6573578", "0.6559495", "0.65104944", "0.6466898", "0.64501756", "0.64403915", "0.64358336", "0.64292705", "0.6426448", "0.6394065", "0.6384591", "0.6384296", "0.63808215", "0.6378552", "0.63720953", "0.6369263", "0.6369036", "0.6365287", "0.63641596", "0.6356171", "0.63486075", "0.6343154", "0.6327785", "0.63276553", "0.6314655", "0.63086265", "0.63071704", "0.63067484", "0.6295206", "0.6285689", "0.6278116", "0.6277597", "0.6271399", "0.62647426", "0.62632895", "0.6241861", "0.6235271", "0.62311465", "0.6203059", "0.61876404", "0.61853516", "0.6174716", "0.6173762", "0.61729395", "0.6172632", "0.61709106", "0.61700004", "0.61547893", "0.61468303", "0.61439955", "0.6139839", "0.6133149", "0.6106411", "0.6103049", "0.6100964", "0.6100812", "0.6099562", "0.6097952", "0.60970813", "0.60802037", "0.6079094", "0.60775924", "0.60755277", "0.60730904", "0.6067643", "0.6062118", "0.6052621", "0.6047177", "0.60469586", "0.6041993", "0.60415787", "0.6041215", "0.6038451", "0.60381484", "0.6033198", "0.60238945", "0.6021529", "0.6018817", "0.60170585", "0.60099703", "0.60037285", "0.60027087", "0.5996987", "0.598871", "0.5985367", "0.59831876", "0.5973289" ]
0.0
-1
This function shoots a bullet from the player
function shootBullet() { // Disable shooting for a short period of time canShoot = false; setTimeout("canShoot = true", SHOOT_INTERVAL); // Create the bullet using the use node var bullet = document.createElementNS("http://www.w3.org/2000/svg", "use"); bullet.setAttribute("x", player.position.x + PLAYER_SIZE.w / 2 - BULLET_SIZE.w / 2); bullet.setAttribute("y", player.position.y + PLAYER_SIZE.h / 2 - BULLET_SIZE.h / 2); bullet.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#bullet"); document.getElementById("bullets").appendChild(bullet); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shootBullet() {\n if (!cheatMode) {\n --bulletsLeft;\n }\n\n updateBulletsNumber();\n\n // Disable shooting for a short period of time\n player.readyToShoot = false;\n setTimeout(\"player.readyToShoot = true\", PLAYER_SHOOT_INTERVAL);\n\n // Create the bullet using the use node\n var bullet = document.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n\n if (player.facing == facingType.RIGHT) {\n x = player.position.x + PLAYER_SIZE.w / 2 - BULLET_SIZE.w / 2;\n } else {\n x = player.position.x + BULLET_SIZE.w / 2;\n }\n\n bullet.setAttribute(\"direction\", player.facing)\n bullet.setAttribute(\"x\", x);\n bullet.setAttribute(\"y\", player.position.y + PLAYER_SIZE.h / 2 - BULLET_SIZE.h / 2);\n bullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bullet\");\n document.getElementById(\"bullets\").appendChild(bullet);\n playSound(SOUND_SHOOT);\n}", "shoot() {\n let newBullet = new Bullet(this.x, this.y, 6, color(0, 0, 0), 15, bulletImage, bulletList.length);\n newBullet.direction();\n bulletList.push(newBullet);\n audioShoot.play();\n }", "function shoot() {\n\tif (bulletDelay < 0) {\n\t\tprojectiles.push({\n\t\t\tx: player.x + (player.width / 2) - scrollDistance,\n\t\t\ty: player.y + (player.height / 2) - (coinSize / 2)\n\t\t})\n\t\tbulletDelay = 30;\n\t}\n}", "function shootBullet() {\n\t// Disable shooting for a short period of time\n\tcanShoot = false;\n setTimeout(\"canShoot = true\", SHOOT_INTERVAL);\n\tbullet_number += 1;\n\t\n // Create the bullet by createing a use node\n var bullet = svgdoc.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n\n // Calculate and set the position of the bullet\n bullet.setAttribute(\"x\", player.position.x + PLAYER_SIZE.w / 2 - BULLET_SIZE.w / 2);\n bullet.setAttribute(\"y\", player.position.y + PLAYER_SIZE.h / 2 - BULLET_SIZE.h / 2);\n\tif(!PLAYER_FACE_RIGHT) {\n\t\tbullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#lbullet\");\n\t} else {\n\t\tbullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bullet\");\n\t}\n // Set the href of the use node to the bullet defined in the defs node\n \n\n // Append the bullet to the bullet group\n\tif(PLAYER_FACE_RIGHT == true) {\n\t\tsvgdoc.getElementById(\"rightBullets\").appendChild(bullet);\n\t} else {\n\t\tsvgdoc.getElementById(\"leftBullets\").appendChild(bullet);\n\t}\t\n}", "function fireBullet() {\n\n if (game.time.now > bulletTime) {\n bullet = bullets.getFirstExists(false);\n\n if (bullet) {\n bullet.reset(player.x+50, player.y+15);\n bullet.body.velocity.x = 500;\n //This code determines how fast you can fire bullets.\n bulletTime = game.time.now + shootRate;\n enemybulletTime = game.time.now + 100;\n }\n }\n}", "function bulletsShoot() {\n if (ship.fireGun && ship.bullets.length < maxBullets) {\n ship.bullets.push({\n x: ship.x + 4/3 + ship.r * Math.cos(ship.a),\n y: ship.y - 4/3 * ship.r * Math.sin(ship.a),\n xv: bulletSpeed * Math.cos(ship.a),\n yv: -bulletSpeed * Math.sin(ship.a),\n r: 2,\n }); \n }\n // ship.fireGun = false;\n}", "function fireBullet(){\n if(game.time.now>bulletTime){\n bullet=bullets.getFirstExists(false);\n if(bullet){\n bullet.reset(player.x + 14,player.y);\n bullet.body.velocity.y = -400;\n bulletTime = game.time.now + 200;\n }\n }\n }", "shoot() {\n this.game.addBody(new Bullet(\n this.game,\n {x: this.position.x + this.size.width / 2, y: this.position.y - 5},\n 'up'\n ));\n\n this.game.playSound('shoot');\n\n this.isFiring = true;\n\n setTimeout(function() {\n this.isFiring = false;\n }.bind(this), this.fireDelay);\n }", "function shootBullet() {\r\n // Disable shooting for a short period of time\r\n if (BULLET_COUNT > 0){\r\n \tcanShoot = false;\r\n \tvar audio = new Audio('player_shoot.mp3');\r\n\t\taudio.play();\r\n \tsetTimeout(\"canShoot = true\", SHOOT_INTERVAL);\r\n \tvar bullet = new Bullet(player.facing);\r\n\t\tbulletarray[bulletarray.length] = bullet;\r\n \t// Create the bullet using the use node\r\n \tsvgdoc.getElementById(\"bullets\").appendChild(bullet.node);\r\n \tBULLET_COUNT --;\r\n\t}\r\n}", "function fireBullet() {\r\n // We need to slow down the fire rate.\r\n let cTime = Date.now(); // Get the current date.\r\n if ((cTime - player.pTime) / 1000 > fire_per_second) {\r\n // IF current and previous time's difference is less then fire_per_second\r\n player.pTime = cTime;\r\n // Push a Bullet.\r\n let x = player.x + player.width / 2,\r\n y = player.y - 20,\r\n color = player.color,\r\n velocity = 20;\r\n bullets.push(new Bullet(x, y, color, velocity));\r\n }\r\n}", "function shootBullet () {\nrigidbody.velocity.x = 0;\nshooting = true;\nvar shotPos:float = 0.0;\nvar bulletAngle:float = 0.0;\nvar bulletVelocity:float = 0.0;\n//here we check the direction the shooter is facing, then apply numbers to the bullet accordingly so it fires in the right direction.\nif(direction == true){\nrenderer.material.mainTexture = shootRight;\nshotPos = 0.5;\nbulletAngle = 0.0;\nbulletVelocity = 16;\n}\nif(direction == false){\nrenderer.material.mainTexture = shootLeft;\nshotPos = -0.5;\nbulletAngle = 180.0;\nbulletVelocity = -35;\n}\n//we wait for a bit before the shot fires so that the player can see he's about to do it\nyield WaitForSeconds(0.5);\n//play the shot sound\naudio.PlayOneShot(shootSound);\n//spawn the bullet\nvar bullet = Instantiate(enemyBullet, transform.position + Vector3(shotPos,0,0),Quaternion.Euler(0,180,bulletAngle));\nvar bullet2 = Instantiate(enemyBullet, transform.position + Vector3(shotPos,3,0),Quaternion.Euler(0,180,bulletAngle));\nvar bullet3 = Instantiate(enemyBullet, transform.position + Vector3(shotPos,6,0),Quaternion.Euler(0,180, bulletAngle));\nvar bullet4 = Instantiate(enemyBullet, transform.position + Vector3(shotPos,9,0),Quaternion.Euler(0,180,bulletAngle));\nvar bullet5 = Instantiate(enemyBullet, transform.position + Vector3(shotPos,12,0),Quaternion.Euler(0,180,bulletAngle));\n//set velocity to the bullet\nbullet.rigidbody.velocity.x = bulletVelocity;\nbullet2.rigidbody.velocity.x = bulletVelocity;\nbullet3.rigidbody.velocity.x = bulletVelocity;\nbullet4.rigidbody.velocity.x = bulletVelocity;\nbullet5.rigidbody.velocity.x = bulletVelocity;\n//then pause again before the enemy is ready to fire again.\n//yield WaitForSeconds(0.5);\nshooting = false;\n}//end of shootBullet", "function fireBullet() {\n if (game.time.now > bulletTime) {\n bullet = bullets.getFirstExists(false);\n if (bullet) {\n bullet.reset(ship.x, ship.y);\n bullet.body.velocity.y = -400;\n bulletTime = game.time.now + 200;\n }\n }\n}", "shoot() {\n this.audio = game.audio.playAudio(\"assets/music/sounds/enemyLaser.mp3\");\n let bullet, bulletInitialCoords = [this.centerX, this.centerY];\n if (game.gameState === \"spaceInvaders\") {\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(\n this.x, this.y + this.height - game.bulletSize[1]), this.x, this.y + this.height - game.bulletSize[1]);\n bullet.move([0, 1]);\n } else {\n let direction;\n switch (this.type) {\n case 0:\n direction = this.normalizeVector([player.x - this.x, player.y - this.y]);\n bullet = game.enemiesBulletsPool.getNewObject(() => \n new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), \n bulletInitialCoords[0], \n bulletInitialCoords[1]);\n bullet.move(direction);\n break;\n case 1:\n if (Math.random() > 0.5) { //horizontal\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), bulletInitialCoords[0], bulletInitialCoords[1]);\n bullet.move([1, 0]);\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), bulletInitialCoords[0], bulletInitialCoords[1]);\n bullet.move([-1, 0]);\n } else { //vertical\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), bulletInitialCoords[0], bulletInitialCoords[1]);\n bullet.move([0, 1]);\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), bulletInitialCoords[0], bulletInitialCoords[1]);\n bullet.move([0, -1]);\n }\n break;\n case 2:\n direction = [0, 1];\n for (let i = 0; i < 4; i++) {\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), bulletInitialCoords[0], bulletInitialCoords[1]);\n bullet.move(direction);\n direction = [direction[1], -direction[0]];\n }\n break;\n }\n }\n }", "shoot () {\n\t\tnew Bullet (this.containerElement, this.mapInstance, this.position, this.direction);\n\t}", "shoot(\n shooter, angle, x, y, container, bulletSpeed, bulletArray, bulletSprite\n ) {\n\n //Make a new sprite using the user-supplied `bulletSprite` function\n let bullet = bulletSprite();\n\n //Set the bullet's anchor point to its center\n bullet.anchor.set(0.5, 0.5);\n\n //Temporarily add the bullet to the shooter\n //so that we can position it relative to the\n //shooter's position\n shooter.addChild(bullet);\n bullet.x = x;\n bullet.y = y;\n\n //Find the bullet's global coordinates so that we can use\n //them to position the bullet on the new parent container\n let tempGx = bullet.getGlobalPosition().x,\n tempGy = bullet.getGlobalPosition().y;\n\n //Add the bullet to the new parent container using\n //the new global coordinates\n container.addChild(bullet);\n bullet.x = tempGx;\n bullet.y = tempGy;\n\n //Set the bullet's velocity\n bullet.vx = Math.cos(angle) * bulletSpeed;\n bullet.vy = Math.sin(angle) * bulletSpeed;\n\n //Push the bullet into the `bulletArray`\n bulletArray.push(bullet);\n }", "function fireBullet () {\n\t//\n if (game.time.now > bulletTime)\n {\n // Grab the first bullet we can from the pool\n lazer = lazers.getFirstDead(true, player.x + 24 * player.scale.x, player.y + 8, 'lazer');\n }\n}", "Shoot(posX, posY){\n //Shooting if the bullets is less than maximum bullets\n if(this.bullets.length <= this.maxBullets)\n {\n //Creating the new bullet and starting it, playing shooting sound\n this.s.Play();\n this.bullets.push(new Bullet(this.size, this.size, this.imgPath, this.dmg, this.type));\n this.bullets[this.bullets.length -1].Start(posX, posY - this.hDiff, this.bulletAcc, this.dirX, this.dirY);\n }\n }", "shoot () {\n\t\tif (this.mag == 0) return; // Mag empty cannot shoot\n\n\t\t// The player's position. \n\t\t// This is the starting point for the bullets.\n\t\tvar pos = new Pair(this.player.position.x+50, this.player.position.y+25);\n\n\t\t/**\n\t\t * The M16 has a three-round burst.\n\t\t */\n\t\tif (this.sprite == 'm16') {\n\t\t\tfor (var i = 0; i < 3; i ++) {\n\t\t\t\tvar newPos = new Pair(pos.x+10*i, pos.y);\n\t\t\t\tthis.player.stage.addActor(new Bullet(this.player.stage, newPos, new Pair(25, 0), null, null));\n\t\t\t\tif (this.mag == 0) return;\n\t\t\t} this.mag -= 3;\n\t\t} \n\t\t\n\t\t/**\n\t\t * The Shotgun & the 1887 have a wide spread.\n\t\t */\n\t\telse if (this.sprite == 'shotgun') {\n\t\t\tfor (var i = 0; i < 5; i ++) {\n\t\t\t\tvar newPos = new Pair(pos.x, pos.y+10*i);\n\t\t\t\tthis.player.stage.addActor(new Bullet(this.player.stage, newPos, new Pair(20, 0), null, null));\n\t\t\t}\n\t\t\tthis.mag -= 1;\n\t\t} else if (this.sprite == '1887') {\n\t\t\tfor (var i = 0; i < 4; i ++) {\n\t\t\t\tvar newPos = new Pair(pos.x, pos.y+10*i);\n\t\t\t\tthis.player.stage.addActor(new Bullet(this.player.stage, newPos, new Pair(40, 0), null, null));\n\t\t\t}\n\t\t\tthis.mag -= 1;\n\t\t} \n\t\t\n\t\t/**\n\t\t * The Sniper has high damage and high bullet speed.\n\t\t */\n\t\telse if (this.sprite == 'sniper') {\n\t\t\tthis.player.stage.addActor(new Bullet(this.player.stage, pos, new Pair(75, 0), null, null));\n\t\t\tthis.mag -= 1;\n\t\t} \n\t\t\n\t\t/**\n\t\t * The Ray Gun has very high damage but low bullet speed.\n\t\t */\n\t\telse if (this.sprite == 'ray_gun') {\n\t\t\tfor (var i = 0; i < 3; i ++) {\n\t\t\t\tvar newPos = new Pair(pos.x+5*i, pos.y+5*i);\n\t\t\t\tthis.player.stage.addActor(new Laser(this.player.stage, newPos, new Pair(10, 0), null, null));\n\t\t\t}\n\t\t\tthis.mag -= 1;\n\t\t} \n\t\t\n\t\t/**\n\t\t * The TMP shoots very fast\n\t\t */\n\t\telse if (this.sprite == 'tmp') {\n\t\t\tthis.player.stage.addActor(new Bullet(this.player.stage, pos, new Pair(50, 0), null, null));\n\t\t\tthis.mag -= 1;\n\t\t} \n\t\t\n\t\t/**\n\t\t * The M60 has lots of ammunition but low damage\n\t\t */\n\t\telse if (this.sprite == 'm60e4') {\n\t\t\tfor (var i = 0; i < 2; i ++) {\n\t\t\t\tvar newPos = new Pair(pos.x+2*i, pos.y+2*i);\n\t\t\t\tthis.player.stage.addActor(new Bullet(this.player.stage, newPos, new Pair(50, 0), null, null));\n\t\t\t}\n\t\t\tthis.mag -= 1;\n\t\t}\n\t\t\n\t\t/**\n\t\t * The default behaviour for other weapons.\n\t\t */\n\t\telse {\n\t\t\tthis.player.stage.addActor(new Bullet(this.player.stage, pos, new Pair(20, 0), null, null));\n\t\t\tthis.mag -= 1;\n\t\t}\n\t}", "function shoot(bullets) {\n if (hwReady === false)\n return;\n\n function fire() {\n gunServo.sweep({interval: servoInterval});\n setTimeout(() => {\n console.log(\"turning off gun\");\n gunServo.stop();\n gunServo.min(); //reset to min position\n gunMotor.low();\n }, bullets * interval * 2);\n }\n\n console.log(\"Turning on gun. Ready to fire \" + bullets + \" bullets\");\n gunMotor.high();\n setTimeout(() => {\n fire()\n }, spinUpTime); //The motors need about 2.5 seconds to spin up to speed before firing\n}", "bulletPlayer(player, bullet) \r\n {\r\n bullet.enemyCollide(player);\r\n }", "function drawAlienShoot() {\n graphics.drawImage(bullet, bulletX, bulletY + 35, 50, 50);\n }", "handleShooting() {\n //check if laser collides with enemy bullet when at a certain distance (technically size)\n let dBullet = dist(this.bullet.x, this.bullet.y, enemyBullet.x, enemyBullet.y)\n if ((dBullet < enemyBullet.size / 2) && this.bulletIsActive === true && this.bulletSize <= 4) {\n //remove one plot point from the enemy, reset bullet, and play sound effect\n enemy.plotPoints -= 1;\n //Additionally, set a location to the bullet to explode, as well as set it's alpha to full\n enemyBullet.explosionX = this.x;\n enemyBullet.explosionY = this.y;\n enemyBullet.explosionSelf = 255;\n //then, reset bullet and play sound\n audEnemyExplosion.play();\n enemyBullet.reset();\n }\n }", "function Update_Player_Bullet (bullet, id, player) {\r\n if (bullet) {\r\n bullet.identifier = id;\r\n if (bullet.posX < 1200) {\r\n bullet.posX += 5;\r\n //Obtener carril de la bala \r\n var carril = bullet.zindex;\r\n //Segun el carril, pintarlo en una capa u otra\r\n switch (carril) {\r\n case 0: capa0ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 1: capa1ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 2: capa2ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n }\r\n } else {\r\n player.DeleteShot(parseInt(bullet.identifier));\r\n }\r\n }\r\n }", "fire(target_x, target_y){\n\t\tif (this.type == \"player\"){\n\t\t\t// the player fires\n\t\t\t// check if the player has enough bullets\n\t\t\tif (this.bullets <= 0){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.bullets -= 1;\n\t\t\tvar actual_x = this.stage.canvas_width / 2 + this.length / 2; // the x-coordinate of the crosshair in the game\n\t\t\tvar actual_y = this.stage.canvas_height / 2 + this.length / 2; // the y-coordinate of the crosshair in the game\n\t\t}\n\t\telse{\n\t\t\tvar actual_x = this.position.x; // the x-coordinate of the shooter (enemy)\n\t\t\tvar actual_y = this.position.y; // the y-coordinate of the shooter (enemy)\n\t\t}\n\t\tvar velocity = new Pair(-(actual_x - target_x) / 10, -(actual_y - target_y) / 10); // calculate the velocity of the bullets\n\t\tvar obstacles_around = this.check_beside()[0]; // check how many obstacles the dog is next to\n\t\tif (obstacles_around > 0){\n\t\t\t// the dog is currently next to some obstacles, so increase the size and damage of the bullet\n\t\t\tvar length = 5 + 5 * obstacles_around;\n\t\t\tvar damage = 10 + 10 * obstacles_around;\n\t\t} else{\n\t\t\t// the dog is not next to an obstacle, so normal bullet would be fired\n\t\t\tvar length = 5;\n\t\t\tvar damage = 10;\n\t\t}\n\t\tvar health = 10;\n\t\tvar position = new Pair(this.position.x + this.length / 2, this.position.y + this.length / 2);\n\t\tif (this.type == \"player\"){\n\t\t\tvar bullet = new Bullet(this.stage, position, velocity, this.colour, length, health, this.type, this.id, damage); // create a new bullet\n\t\t} else if (this.type == \"enemy\"){\n\t\t\tvar bullet = new Bullet(this.stage, position, velocity, this.colour, length, health, this.type, -1, damage); // create a new bullet\n\t\t}\n\t\tthis.stage.addSquare(bullet);\n\t}", "function createBullet(){\n if (game.time.now > bulletTime)\n {\n var bullet = bullets.getFirstExists(false);\n\n if (bullet)\n {\n // And fire it\n bullet.reset(player.x-6, player.y-10);\n bullet.body.velocity.y = -400;\n bulletTime = game.time.now + 200; \n }\n}}", "function shoot()\r\n\t{ if(shotoffset<timer)\r\n\t\t{switch (stype) {\r\n case 0:\r\n\t\t\t\tmysound.play();\r\n\t\t\t\tproj.changeproj(\"laser\");\r\n proj.laser();\r\n break;\r\n case 1:\r\n\t\t\t\tproj.fireball();\r\n\t\t\t\tproj.changeproj(\"fireball\");\r\n break;\r\n case 2:\r\n\t\t\t\telec.play();\r\n\t\t\t\tproj.lightning();\r\n\t\t\t\tproj.changeproj(\"lightning\");\r\n break;\r\n }\r\n\r\n\t\t}\r\n\t}", "shoot(){\n //random up to every 10 seconds\n if (frameCount % 90 == 0) {\n var selectedEnemy = selectRandomEnemy(this.enemies);\n //logic for choosing enemy to shoort with from colony\n this.bullets.push(\n new Bullet(dimensionObject(selectedEnemy.position.x+(selectedEnemy.size.x/2), selectedEnemy.position.y), dimensionObject(10,10))\n );\n selectedEnemy.bulletSound.play();\n } \n }", "addBullet(x, y, angle) {\n var bullet = this.bullets.get();\n if (bullet){\n bullet.fire(x, y, angle);\n }\n }", "function fireBullet(){\n bullets.push({\n x: bullet.x + killa.width/2 - bullet.width/2,\n y: bullet.y + killa.height/2 - bullet.height/2\n\n })\n}", "function fire_bullet(){\r\n\tif(parseInt(num_bullets.innerHTML) > 0){\r\n\t\tbullet_coords.push(new vec4(0.004, -0.005, 0, 1));\r\n\t\tbullet_directions.push(new vec4(-0.04 + (Math.random() * 0.08), -0.04 * (Math.random() * 0.08), -1, 1));\r\n\t\tbullet_timeouts.push(0);\r\n\t\tnum_bullets.innerHTML = parseInt(num_bullets.innerHTML) - 1;\r\n\t}\r\n}", "function startShooting() {\n\tvar bullet, phBullet, xDiff = -1,\n\t\texcessBullet;\n\n\tsetInterval(function() {\n\t\txDiff = xDiff * -1;\n\t\tphBullet = new jigLib.JSphere(null, 10);\n\t\tphBullet.set_mass(6000);\n\t\tphBullet.moveTo([0, 100, 1000, 0]);\n\t\tphBullet.set_friction(1);\n\t\tphBullet.set_restitution(0);\n\t\tphBullet.setVelocity([Math.floor(Math.random()*60) * xDiff, 90 + (Math.floor(Math.random()*40) * xDiff), -1000 - (Math.floor(Math.random()*200)), 0]);\n\t\tbullet = new THREE.Mesh(\n\t\t\tnew THREE.SphereGeometry(10, 36),\n\t\t\tnew THREE.MeshLambertMaterial({color: 0x666666})\n\t\t);\n\t\tbullet.matrixAutoUpdate = false;\n\t\tbullet.castShadow = true;\n\n\t\tbullets.push({\n\t\t\tb: bullet,\n\t\t\tp: phBullet\n\t\t});\n\t\tsystem.addBody(phBullet);\n\t\tscene.add(bullet);\n\n\t\tif (bullets.length > MAX_BULLETS) {\n\t\t\texcessBullet = bullets.shift();\n\t\t\tsystem.removeBody(excessBullet.p);\n\t\t\tscene.remove(excessBullet.b);\n\t\t}\n\t}, 750);\n}", "attackBase(enemyBase) {\n let d = dist(this.x, this.y, this.enemyBaseX, this.enemyBaseY);\n let dx = this.enemyBaseX - this.x;\n let dy = this.enemyBaseY - this.y;\n let angle = atan2(dy, dx);\n if (enemyBase.health>0){\n // move to it\n if (d >= 100) {\n this.x += this.speed * cos(angle);\n this.y += this.speed * sin(angle);\n }\n // if in range, FIRE\n if (d < 200 && !this.bulletFired && !this.dead) {\n // create and store a Bullet object\n this.bullet = new Bullet(this.x, this.y, enemyBase.x, enemyBase.y, this.playerId, this.uniqueId);\n this.bulletFired = true;\n Fire.play(); // sound\n // enemy base is under attack\n enemyBase.underAttack = true;\n this.theEnemyBase = enemyBase;\n }\n // make the bullet fly towards the target\n if (this.bulletFired && !this.dead) {\n this.bullet.moveTo(enemyBase);\n if (this.bullet.dead) {\n this.bulletFired = false;\n this.bullet = null;\n }\n }\n }\n this.handleWrapping();\n }", "function bulletsPlayerCollision(player, bullet) {\n bullet.destroy();\n player.hp -= bullet.damage;\n playerHit.play();\n game.camera.shake(0.016, 100);\n\n //knock back the player based on the bullet's trajectory\n player.knockedBack = true;\n knockback(player, 300, bullet.rotation - Math.PI);\n console.log('Player HP: ' + player.hp);\n}", "function shoot (event) {\n\t\tlet laserId = null;\n\t\tlet currentLaserIndex = currentShooterIndex;\n\n\t\tfunction moveLaser () {\n\t\t\tsquares[currentLaserIndex].classList.remove('laser');\n\t\t\tcurrentLaserIndex -= width;\n\t\t\tsquares[currentLaserIndex].classList.add('laser');\n\t\t\tif (squares[currentLaserIndex].classList.contains('invader')) {\n\t\t\t\tsquares[currentLaserIndex].classList.remove('laser');\n\t\t\t\tsquares[currentLaserIndex].classList.remove('invader');\n\t\t\t\tsquares[currentLaserIndex].classList.add('boom');\n\t\t\t\tclearInterval(laserId);\n\t\t\t\tsetTimeout(() => squares[currentLaserIndex].classList.remove('boom'), 200);\n\n\t\t\t\tconst alienTakenDown = invaderArray.indexOf(currentLaserIndex);\n\t\t\t\talienInvadersTakenDown.push(alienTakenDown);\n\t\t\t\tresult++;\n\t\t\t\tresultToDisplay.textContent = result;\n\t\t\t}\n\n\t\t\tif (currentLaserIndex < width) {\n\t\t\t\tclearInterval(laserId);\n\t\t\t\tsetTimeout(() => squares[currentLaserIndex].classList.remove('laser'), 100);\n\t\t\t}\n\t\t}\n\n\t\t// to move laser after shoot\n\t\tif (event.keyCode === 32) laserId = setInterval(moveLaser, 100);\n\t}", "[PrivateActions.shoot](action) {\n\t\tlet x = -1;\n\t\tlet y = -1;\n\t\tswitch(this.orientation){\n\t\t\tcase Orientation.UP:\n\t\t\t\tx = Math.floor(Size.width / 2);\n\t\t\t\ty = 0;\n\t\t\t\tbreak;\n\t\t\tcase Orientation.DOWN:\n\t\t\t\tx = Math.floor(Size.width / 2);\n\t\t\t\ty = Size.height;\n\t\t\t\tbreak;\n\t\t\tcase Orientation.LEFT:\n\t\t\t\tx = 0;\n\t\t\t\ty = Math.floor(Size.height / 2);\n\t\t\t\tbreak;\n\t\t\tcase Orientation.RIGHT:\n\t\t\t\tx = Size.width;\n\t\t\t\ty = Math.floor(Size.height / 2);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis[CooldownSetter](PrivateActions.shoot);\n\n\t\treturn (new Bullet(this.term)).setup({\n\t\t\tid: action.bulletID,\n\t\t\ttankID: this.id,\n\t\t\torientation: this.orientation,\n\t\t\tx: this.x + x,\n\t\t\ty: this.y + y\n\t\t}).move(1);\n\t}", "function shoot()\r\n{\r\n\t// this takes on from the moment when the shoot button is pressed\r\n\t// the display system needs to be configured\r\n\tdisplay_interval = setInterval(display,frame_refresh_time);\r\n\tcalculate_trajectory_basic_straight_interval = setInterval(calculate_trajectory_basic_straight,frame_refresh_time);\r\n\tgame_on = true; // we need to declare that the game has begun\r\n}", "function monsterShootBullet(monster) {\n\t//console.log(\"Monster Shoot Bullet!\");\n\t//Disable shooting for a short period of time\n\tmonster_BULLET_COUNT += 1;\n\t\n // Create the bullet by createing a use node\n var bullet = svgdoc.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n\n // Calculate and set the position of the bullet\n bullet.setAttribute(\"x\", monster.position.x + PLAYER_SIZE.w / 2 - monster_BULLET_SIZE.w / 2);\n bullet.setAttribute(\"y\", monster.position.y + PLAYER_SIZE.h / 2 - monster_BULLET_SIZE.h / 2);\n\tbullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#monsterbullet\");\n\t\n\t//console.log(bullet.getAttribute(\"x\") + \" \" + bullet.getAttribute(\"y\"));\n\t//console.log(monster.direction);\n\tif(monster.direction == motionType.RIGHT) {\n\t\tsvgdoc.getElementById(\"monsterRightBullets\").appendChild(bullet);\n\t} else {\n\t\tsvgdoc.getElementById(\"monsterLeftBullets\").appendChild(bullet);\n\t}\t\n}", "function bullet(xBullet, yBullet, dirBullet, velBullet)\n{\n this.xBullet = xBullet;\n this.yBullet = yBullet;\n this.dirBullet = dirBullet;\n this.velBullet = velBullet;\n this.collided = false;\n}", "shoot() {\n\n const pos = this.mesh.position\n const y = 40\n const zOffset = 10\n\n let geo = new THREE.SphereBufferGeometry(9, 6, 5)\n let mat = new THREE.MeshToonMaterial({ color: environment.COLORS.ice })\n let mesh = new THREE.Mesh(geo, mat)\n\n mesh.castShadow = true\n mesh.position.set(pos.x, y, pos.z - zOffset)\n\n let bullet = {\n mesh,\n speed: 15.0,\n damage: 10.0\n }\n\n scene.add(bullet.mesh)\n this.bullets.push(bullet)\n\n }", "enemyBulletHitsPlayer(player, bullet) {\n\n }", "function Bullet() {\n this.srcX = 331;\n this.srcY = 500;\n this.drawX = -20;\n this.drawY = 0;\n this.width = 16;\n this.height = 14;\n this.explosion = new Explosion();\n}", "function Bullet() {\n _super.call(this, \"bullet\");\n this.name = \"bullet\";\n // set the small insect to start at a random y value\n this.y = Math.floor(Math.random() * constants.SCREEN_HEIGHT);\n this.x = 0;\n // add drift to the cloud \n this._dx = 5;\n }", "function shootBullet() {\r\n //if all bullets used\r\n if(bulletremain==0) return;\r\n var shoot = svgdoc.getElementById(\"shoot\");\r\n shoot.play();\r\n bulletremain--;\r\n if(cheat) bulletremain++;\r\n svgdoc.getElementById(\"bulletLeft\").innerHTML = \"Bullet Left: \"+bulletremain;\r\n // Disable shooting for a short period of time\r\n canShoot = false;\r\n setTimeout(\"canShoot = true\", SHOOT_INTERVAL);\r\n // Create the bullet using the use node\r\n var bullet = svgdoc.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\r\n if(!playFaceLeft){\r\n svgdoc.getElementById(\"bullets\").appendChild(bullet);\r\n var bullet_x = player.position.x + (PLAYER_SIZE / 2) - (BULLET_SIZE.w / 2);\r\n var bullet_y = player.position.y + (PLAYER_SIZE / 2) - (BULLET_SIZE.h / 2);\r\n bullet.setAttribute(\"x\", player.position.x);\r\n bullet.setAttribute(\"y\", player.position.y);\r\n bullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bullet\");\r\n svgdoc.getElementById(\"bullet\").setAttribute(\"transform\", \"translate(\" +BULLET_SIZE.w + \", 0) scale(1,1)\");\r\n }else {\r\n svgdoc.getElementById(\"bulletsToLeft\").appendChild(bullet);\r\n var bullet_x = player.position.x + (PLAYER_SIZE / 2) - (BULLET_SIZE.w / 2);\r\n var bullet_y = player.position.y + (PLAYER_SIZE / 2) - (BULLET_SIZE.h / 2);\r\n bullet.setAttribute(\"x\", player.position.x);\r\n bullet.setAttribute(\"y\", player.position.y);\r\n bullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bulletleft\");\r\n svgdoc.getElementById(\"bulletleft\").setAttribute(\"transform\", \"translate(\" +BULLET_SIZE.w + \", 0) scale(-1,1)\");\r\n }\r\n\r\n}", "function Bullet() {\n this.x = -1;\n this.y = -1;\n this.velX = 0;\n this.velY = 0;\n this.elem = 'fire';\n }", "function cowboyShoot() {\n\n var bullet = bullets.getFirstExists(false);\n //update the cowboy's array before shooting to make sure dead men don't shoot\n livingcowboys.length = 0;\n livingcowboys = [];\n cowboys.forEachAlive(function (cowboy) {\n // put every living enemy in an array\n livingcowboys.push(cowboy);\n });\n if (bullet && livingcowboys.length > 0) {\n\n var randomcowboy = game.rnd.integerInRange(0, livingcowboys.length - 1);\n var shooter = livingcowboys[randomcowboy];\n // And fire the bullet from this enemy\n bullet.reset(shooter.x , shooter.y);\n bullet.angle = shooter.angle;\n bullet.setHealth(1);\n //game.physics.arcade.velocityFromAngle(bullet.angle, 250, bullet.body.velocity);\\\n\n game.physics.arcade.moveToObject(bullet, player, 265);\n cowboyShootTimer = game.time.now + 1500;\n }\n }", "function fire(e){\n if(!gameOver){\n // First update the crosshair;\n updateCrosshair(e);\n\n // Next figure out the players position\n // This is where the bullet will go.\n var playerposx = $(\"#player\").x() + (PLAYER_WIDTH - BULLET_SIZE)/2;\n var playerposy = $(\"#player\").y() + (PLAYER_HEIGHT - BULLET_SIZE)/2;\n\n // Increment the bullet count and the current bullet index\n bulletCount = (bulletCount + 1);\n CURRENT_BULLET = Number(CURRENT_BULLET+1) % Number(MAX_BULLETS);\n\n // If a bullet has been out for longer than it should\n // take to cross the screen, reload it. It's buggy.\n var live_bullet = Number(BULLETS[CURRENT_BULLET][0].bullet.age()) < EXPIRATION;\n if(live_bullet == false){\n BULLETS[CURRENT_BULLET][0].bullet.fired = false;\n }\n\n if(BULLETS[CURRENT_BULLET][0].bullet.fired == false){\n var fired_bullet = BULLETS[CURRENT_BULLET];\n $(fired_bullet)[0].bullet.index = CURRENT_BULLET;\n $(fired_bullet)[0].bullet.fired = true;\n $(fired_bullet)[0].bullet.birth = Date.now();\n $(fired_bullet).x(playerposx);\n $(fired_bullet).y(playerposy);\n $(fired_bullet)[0].bullet.direction = CROSSHAIR_DIRECTION;\n $(fired_bullet).fadeIn(0);\n }\n }\n}", "function shoot(e) {\n let laserId;\n let currentLaserIndex = currentShooterIndex;\n\n // move the laser from the player ship up the screen\n function moveLaser() {\n squares[currentLaserIndex].classList.remove(\"laser\");\n currentLaserIndex -= width;\n squares[currentLaserIndex].classList.add(\"laser\");\n // laser hits and kills alien\n if (squares[currentLaserIndex].classList.contains(\"invader\")) {\n squares[currentLaserIndex].classList.remove(\"laser\");\n squares[currentLaserIndex].classList.remove(\"invader\");\n squares[currentLaserIndex].classList.add(\"boom\");\n\n setTimeout( () => squares[currentLaserIndex].classList.remove(\"boom\"), 100);\n clearInterval(laserId);\n\n const alienTakenDown = alienInvaders.indexOf(currentLaserIndex);\n alienInvadersTakenDown.push(alienTakenDown);\n result++;\n resultDisplay.textContent = result;\n }\n // laser reaches top of screen\n if (currentLaserIndex < width) {\n clearInterval(laserId)\n setTimeout( () => squares[currentLaserIndex].classList.remove(\"laser\"), 100);\n }\n }\n\n switch(e.code) {\n case \"Space\":\n laserId = setInterval(moveLaser, 100);\n break;\n default:\n break;\n }\n }", "function Update_Enemy_Bullet(bullet, id) {\r\n if (bullet) {\r\n bullet.identifier = id; \r\n if (bullet.posX >= 0) {\r\n bullet.posX -= bullet.speed;\r\n //Obtener carril de la bala \r\n var carril = bullet.zindex; \r\n //Segun el carril, pintarlo en una capa u otra\r\n switch (carril) {\r\n case 0: capa0ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 1: capa1ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 2: capa2ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n }\r\n } else {\r\n enemy_1.DeleteShot(parseInt(bullet.identifier));\r\n } \r\n }\r\n }", "function bulletHit(data) {\n explosions[nextExplosionId] = components.Explosion(data, nextExplosionId++);\n\n //\n // When we receive a hit notification, go ahead and remove the\n // associated bullet from the client model.\n delete bullets[data.bulletId];\n }", "function shootProjectile (player) {\n if(player == undefined) {\n return\n }\n var projectile1 = new Projectile(player.id, player.x, player.y, -player.direction - 3*Math.PI/4);\n var projectile2 = new Projectile(player.id, player.x, player.y, -player.direction - Math.PI/4);\n projectile1.updateProjectile(0.4);\n projectile2.updateProjectile(0.4);\n\n projectiles.push(projectile1)\n projectiles.push(projectile2)\n\n // Broadcast projectiles to the room\n io.in('default_room').emit('gamestate', {\n type: 'new_projectiles',\n data: [projectile1, projectile2]\n });\n\n // Handles some weird case where server and client have\n // a different sense of direction\n projectile1.direction+=Math.PI;\n projectile2.direction+=Math.PI;\n}", "function Bullet(options) {\n MovingObject.call(this, options);\n}", "function spawnBullet(p){\n add([rect(6,18), \n pos(p), \n origin('center'), \n color(0.5, 0.5, 1),\n 'bullet'\n ])\n }", "function mousePressed() {\n\n //create bullet\n var bullet = createSprite(pac.position.x, pac.position.y, BULLET_WIDTH, BULLET_HEIGHT);\n\n //velocity\n bullet.velocity.x = random(-5, 5);\n bullet.velocity.y = random(-5, 5);\n\n}", "function bullet(){\n var b = false;\n for(i = 1; i < bulletTrav.length; i++){\n rect(bulletTrav[i].x, bulletTrav[i].y + bulletTrav[i].speed, 10, 10);\n bulletTrav[i].y = bulletTrav[i].y + bulletTrav[i].speed;\n if(dist(bulletTrav[i].x, bulletTrav[i].y, targetRem[0].circX, targetRem[0].circY) < 50){\n console.log(\"hit\");\n //a = 9000;\n b = true;\n explosion();\n circSetup();\n crash();\n victory();\n \n }else{\n b = false;\n }\n }\n circReset.push(b);\n}", "playBulletSound() {\n this.bulletAudio.play();\n }", "function myShootingEffects() {\n\tmyGunshot.play();\n\tgameFrame.classList.add(\"playerShooting\");\n\tsetTimeout(function() {\n\t\tgameFrame.classList.remove(\"playerShooting\");\n\t}, 150);\n}", "function bulletsBasicShooterCollision(enemy, bullet) {\n makeBloodParticles(bullet, enemy);\n bullet.destroy();\n enemy.hp -= bullet.damage;\n damage += bullet.damage*100;\n hitMarker.play();\n bulletsHit++;\n\n //knock back the enemy\n if(!enemy.knockedBack) {\n enemy.knockedBack = true;\n knockback(enemy, bullet.knockbackValue, enemy.rotation);\n enemy.body.drag.x = 1000;\n enemy.body.drag.y = 1000;\n }\n}", "function Bullet(descr) {\n // Common inherited setup logic from Entity\n this.setup(descr);\n\n // TODO: bind in JSON.\n // audioManager.play(g_url.bulletFire);\n if (this.type === 'beam') {\n audioManager.play(g_url.audio.beamFire);\n } else {\n audioManager.play(g_url.audio.gunsound1);\n }\n}", "function iShoot(enemy) {\n\n\t/* Consequences on the enemies */\n\tenemy.classList.remove(\"shooting\");\n\tenemy.classList.remove(\"showing\");\n\tenemy.classList.add(\"dead\");\n\tif([\"level1\", \"level2\"].indexOf(document.querySelector(\".level.current\").id) > -1) {\n\t\tsetTimeout(function() {\n\t\t\tenemyFalling.play();\n\t\t}, 300);\n\t}\n\n\tassessVictory();\n}", "function shoot(){\n shot1();\n shot2();\n shot3();\n\n }", "function bulletThing(elem, ele) {\n\t\tif (elem.type == 'player') {\n\t\t\tplayerList.forEach(function(element) {\n\t\t\t\tif (element.id == elem.id) {\n\t\t\t\t\telement.HP -= ele.dmg;\n\t\t\t\t\tconsole.log(`hit ${element.id}, ${element.HP}`);\n\t\t\t\t\tlet data = {\n\t\t\t\t\t\tid: element.id,\n\t\t\t\t\t\tdmg: ele.dmg,\n\t\t\t\t\t}\n\t\t\t\t\tsocket.emit('bulletHit', data);\n\t\t\t\t}\n\t\t\t});\n\t\t\tentities = ArrayRemove(entities, ele);\n\t\t} else if (elem.type == 'wall') {\n\t\t\tentities = ArrayRemove(entities, ele);\n\t\t} else if (elem.type == 'NPC' || elem.type == 'enemy') {\n\t\t\telem.HP -= ele.dmg;\n\t\t\tif (elem.HP <= 0) {\n\t\t\t\tentities.forEach(function(eleme) {\n\t\t\t\t\tif (eleme.id == elem.id) {\n\t\t\t\t\t\tentities = ArrayRemove(entities, eleme);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif (elem.type == 'enemy') {\n\t\t\t\t\tcurrentStage.enemies.forEach(function(eleme) {\n\t\t\t\t\t\tif (eleme.id == elem.id) {\n\t\t\t\t\t\t\tcurrentStage.enemies = ArrayRemove(currentStage.enemies, eleme);\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\tif (elem.type == 'enemy') {\n\t\t\t\tcurrentStage.enemies.forEach(function(eleme) {\n\t\t\t\t\tif (eleme.id == elem.id) {\n\t\t\t\t\t\teleme.HP -= ele.dmg;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tconsole.log(`hit dummy ${elem.HP}`);\n\t\t\tentities = ArrayRemove(entities, ele);\n\t\t} else if ((ele.pos.x == 7 || ele.pos.x == 6) && (ele.pos.y == 7 || ele.pos.y == 6)) {\n\t\t\tplayer.HP -= ele.dmg;\n\t\t\tentities = ArrayRemove(entities, ele);\n\t\t\tif (player.HP <= 0) {\n\t\t\t\tmenu = 'dead';\n\t\t\t}\n\t\t}\n\t}", "attack(enemy) {\n let d = dist(this.x, this.y, enemy.x, enemy.y);\n // if within range, no target acquired, not dead, and the enemy is alive\n // TARGET THE ENEMY\n if (d < 300 && this.targetId < 0 && !this.dead && !enemy.dead) {\n this.targetId = enemy.uniqueId;\n this.obtainedTarget = true;\n }\n let dx = enemy.x - this.x;\n let dy = enemy.y - this.y;\n let angle = atan2(dy, dx);\n\n if (this.targetId === enemy.uniqueId) {\n // get closer to the enemy\n if (d >= 150) {\n this.x += this.speed * cos(angle);\n this.y += this.speed * sin(angle);\n // also keep a distance from the enemy\n } else {\n this.x -= this.speed * cos(angle);\n this.y -= this.speed * sin(angle);\n }\n // if within range, FIRE\n if (d < 200 && !this.bulletFired && !this.dead) {\n this.bullet = new Bullet(this.x, this.y, enemy.x, enemy.y, this.playerId, this.uniqueId);\n this.bulletFired = true;\n this.attacking = true;\n Fire.play();\n } else {\n this.attacking = false;\n }\n if (this.bulletFired && !this.dead) {\n this.attacking = true;\n // if the enemy is not attacking, it will fight back\n if (!enemy.attacking) {\n enemy.targetId = this.uniqueId;\n }\n this.bullet.moveTo(enemy);\n if (this.bullet.dead) {\n this.bulletFired = false;\n this.bullet = null;\n }\n }\n if (enemy.dead) {\n // if the targeted enemy is tank / square XL\n // if the tank gets destroyed and this unit is close to it\n // the explosion kills this unit\n if (enemy.uniqueId === 100 && enemy.uniqueId === this.targetId && d < 100){\n this.health -= enemy.damage;\n }\n this.targetId = -1;\n this.obtainedTarget = false;\n this.attacking = false;\n }\n }\n // variation to the movement\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -0.05, 0.05);\n this.vy = map(noise(this.ty), 0, 1, -0.05, 0.05);\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.0001;\n this.ty += 0.0001;\n\n this.handleWrapping();\n }", "function shoot(){\r\n cannon.style.visibility = \"visible\";\r\n cannon.style.left = cannon_left + \"px\";\r\n cannon_left = cannon_left - 10;\r\n tank.style.left = tank_left + 10 + \"px\"; // First part of recoil action of the tank\r\n }", "function shoot() {\n // Add a new projectile to the projectiles array\n data.world.projectiles.push(\n // Projectile object\n {\n // Separate strength and health?\n \"strength\": random(2000, 2500),\n \"velocity\": {\n \"x\": (((data.input.mouse.x + data.settings.offset.x) / data.settings.zoom) - data.world.player.location.x) * random(10, 10),\n \"y\": (((data.input.mouse.y + data.settings.offset.y) / data.settings.zoom) - data.world.player.location.y) * random(10, 10)\n },\n \"location\": {\n \"x\": data.world.player.location.x,\n \"y\": data.world.player.location.y\n },\n \"getPoints\": function() {\n var x = this.location.x;\n var y = this.location.y;\n var points = [\n {\n \"x\": x - 0.2,\n \"y\": y - 0.2,\n },\n {\n \"x\": x + 0.2,\n \"y\": y - 0.2\n },\n {\n \"x\": x + 0.2,\n \"y\": y + 0.2\n },\n {\n \"x\": x - 0.2,\n \"y\": y + 0.2\n }\n ];\n\n return points;\n }\n }\n );\n}", "update() {\n //If the bullet is not currently being fired, set it to the same location as the player\n if (this.bulletIsActive === false) {\n this.bullet.x = this.x;\n this.bullet.y = this.y;\n }\n\n //Add velocity to player\n this.x += this.vx;\n this.y += this.vy;\n //Add inverted velocity to target\n this.targetX -= this.vx;\n this.targetY -= this.vy;\n //Set velocity to max values\n this.vx = constrain(this.vx, -8, 8);\n this.vy = constrain(this.vy, -8, 8);\n //Keep player within a reasonable playing field\n this.constrainToMap();\n //run all functions within the bullet\n this.handleBullet();\n\n }", "function Bullet(params) {\n if (!params) return;\n\n FlyObject.apply(this, arguments);\n if (params.type) {\n this.type = params.type;\n }\n if (params.damage) {\n this.damage = params.damage;\n }\n this.parent = null;\n }", "handleBullet() {\n //if the bullet is active, run the code\n if (this.bulletIsActive === true) {\n //create variable for finding distance to target\n let bulletToTarget = dist(this.bullet.x, this.bullet.y, this.targetX, this.targetY);\n //If the bullet is close enough to the target, reset it as inactive\n if (bulletToTarget < 10) {\n this.bulletIsActive = false;\n this.bullet.x = this.x;\n this.bullet.y = this.y;\n this.bulletSize = 10;\n } else {\n //We use three vectors to find distance, angle and speed\n //and then display the bullet there\n\n //Create a variable for the distance from ship to reticle\n let d = dist(this.x, this.y, this.targetX, this.targetY);\n //Create vectors for bullet, target, and the velocity we want\n let vecBullet = createVector(this.bullet.x, this.bullet.y);\n let vecTarget = createVector(this.targetX, this.targetY);\n let vecDesiredVel = vecTarget.sub(vecBullet);\n //Create velocity for the bullet based on the desired velocity vector\n //limited by the distance between ship and target, to achieve\n //the effect of the bullet traveling at the same speed no matter angle\n let frameVel = vecDesiredVel.limit(d / 10);\n //actually update position of bullet\n this.bullet.x += frameVel.x;\n this.bullet.y += frameVel.y;\n\n //display the bullet\n push();\n ellipseMode(CENTER);\n strokeWeight(1);\n stroke(255);\n fill(255, 28, 51);\n ellipse(this.bullet.x, this.bullet.y, this.bulletSize, this.bulletSize);\n pop();\n\n //Shrink bullet to make it seem like it's going further away\n this.bulletSize -= 1;\n }\n }\n this.handleOverheating();\n }", "function spellBomb () {\n\n for (var i = 0; i < 21; i++) { newBullet(i * 18, mouse.X, mouse.Y); }\n\n playerList[0].MP -= playerList[0].special_MP_cost;\n playerList[0].specialCooldown = playerList[0].MAX_SPECIAL_COOLDOWN;\n}", "function createBullet(bulletType, fromCenter, toCenter)\n{\n let bullet = new NodeObject(BLOCK/5, BLOCK/5);\n\n //fromCenter.y+player.height/2\n let angle = Math.atan((toCenter.y-fromCenter.y)/(toCenter.x-fromCenter.x)); \n let sign = Math.sign(toCenter.x-fromCenter.x);\n let velocityX = BULSPEED * Math.cos(angle); \n let velocityY = BULSPEED * Math.sin(angle); \n //bullet.setColor(\"green\");\n //bullet.setRound(\"100%\");\n //bullet.preload(\"resources/ballAv.png\", \"auto\");\n //bullet.mirrorImage(dir); \n //bullet.setImage(\"resources/ballAv.png\");\n bullet.setPos(fromCenter.x - BLOCK/5, fromCenter.y - BLOCK/5); //check and change this, AGAIN\n\n if(bulletType == \"player\")\n {\n bullet.preload(resources[\"playerBullet\"]);\n player.setImage(\"resources/attackAv.png\"); \n shoot = false;\n shootAnim = 0; \n }\n else if(bulletType == \"enemy\")\n {\n bullet.preload(resources[\"enemyBullet\"]);\n }\n pBullets.push([bullet, {VX: velocityX*sign, VY: velocityY*sign}, angle, sign, true, bulletType]); \n physics.addBody(bullet, \"bullet\" + (pBullets.length-1), BLOCK/5, BLOCK/5); \n \n //shootAux = true; \n}", "function drawBullet(){\n if(playerBullet.firing){\n playerBullet.x+=playerBullet.direction*5;\n }\n //console.log(playerBullet.firing);\n for(var i = 0; i<platforms.length; i++){\n if(playerBullet.x+playerBullet.width>platforms[i].x && playerBullet.x<platforms[i].x+platforms[i].width &&\n playerBullet.y+playerBullet.height>platforms[i].y && playerBullet.y<platforms[i].y+platforms[i].height){\n console.log(platforms[i]);\n playerBullet.firing = false;\n playerBullet.x = levelDimensions.right+500;\n playerBullet.y = levelDimensions.right+500;\n }\n }\n ctx.beginPath();\n ctx.rect(playerBullet.x-cameraX,playerBullet.y-cameraY,playerBullet.width,playerBullet.height);\n ctx.fillStyle = \"#FF00FF\";\n ctx.fill();\n ctx.closePath(); \n}", "step(stage) {\n\t\tlet destinationX = this.x + this.dx;\n let destinationY = this.y + this.dy;\n\n\t\t// Remove the bullet from the stage if it has exceeded its maximum range\n\t\tif (distanceBetweenTwoPoints(this.originalPosition.x, this.originalPosition.y, this.x, this.y) > this.range) {\n\t\t\tstage.removeActor(this);\n\t\t}\n\t\t// Remove the bullet from the stage if it will hit the border\n\t\telse if (destinationX < 0 || destinationX > stage.stageWidth || destinationY < 0 || destinationY > stage.stageHeight) {\n\t\t\tstage.removeActor(this);\n\t\t}\n\t\telse {\n\t\t\t// Check if the bullet will collide with other players\n\t\t\tlet collidesPlayer = CollisionEngine.checkBulletToPlayerCollision(destinationX, destinationY, stage.getPlayerActors(), this.radius, this.owner, this.bulletDamage);\n\t\t\tif (collidesPlayer) {\n\t\t\t\tstage.removeActor(this);\n\t\t\t} \n\t\t\t\n\t\t\t// Check if the bullet will collide with a crate\n\t\t\telse {\n\t\t\t\tlet collidesCrate = CollisionEngine.checkBulletToCrateCollision(destinationX, destinationY, stage.getCrateActors(), this.radius);\n\t\t\t\tif (collidesCrate) {\n\t\t\t\t\tstage.removeActor(this);\n\t\t\t\t} \n\t\t\t\t\n\t\t\t\t// No collisions -- move the bullet\n\t\t\t\telse {\n\t\t\t\t\tthis.x = destinationX;\n\t\t\t\t\tthis.y = destinationY;\n\t\t\t\t\t// console.log(`Coordinates of bullet: (${this.x}, ${this.y})`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function bullet_shot(e_plane) {\n\tvar bullets = battle_ground.getElementsByClassName(\"myBullet\");\n\tfor(var i = 0; i < bullets.length; i++) {\n\t\tfor(var j = 0; j < e_plane.length; j++) {\n\t\t\tif(!bullets[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar bullet_left = parseInt(bullets[i].style.left);\n\t\t\tvar bullet_top = parseInt(bullets[i].style.top);\n\t\t\tvar _left = parseInt(e_plane[j].style.left);\n\t\t\tvar _top = parseInt(e_plane[j].style.top);\n\t\t\tvar bHeight = parseInt(bullets[i].offsetHeight);\n\t\t\tvar bWidth = parseInt(bullets[i].offsetWidth);\n\t\t\tvar _height = parseInt(e_plane[j].offsetHeight);\n\t\t\tvar _width = parseInt(e_plane[j].offsetWidth);\n\t\t\tif(e_plane[j].HP > 0 && bullet_left > _left - bWidth && bullet_left < _left + _width && bullet_top < _top + _height - bHeight && bullet_top > _top - bHeight) {\n\t\t\t\tbattle_ground.removeChild(bullets[i]);\n\t\t\t\te_plane[j].HP--;\n\t\t\t\tif(e_plane[j].HP <= 0) {\n\t\t\t\t\tscores = scores + e_plane[j].score;\n\t\t\t\t\tscore_init(scores, score_view); \n\t\t\t\t\texplosion(e_plane[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function addBullet(top,left,_d,_s, BT) {\n var is_en = tank.attr('isEnemy')=='true'?false:true;\n var by_whom = tank.attr('title');\n \t\tvar $bullet = $('<span title=\"'+ tank.attr('id') +'\" class=\"'+ tank.attr('isEnemy') +'\" style=\"position:absolute;width:18px;height:18px;top:' + top + 'px;left:' + left + 'px;z-index: 3;\"></span>');\n $bullet.css('background','url(images/bullet/bullet.png) no-repeat');\n $('div#container').append($bullet);\n isHit($bullet, top, left, _d, _s, is_en, by_whom, BT);\n }", "function enemyBulletShooting() {\r\n\r\n if (shootingDelay <= Math.floor(Math.random() * 20) + 10) {\r\n shootingDelay = shootingDelay + 0.1;\r\n } else {\r\n drawEnemyBullet();\r\n shootingDelay = 0;\r\n }\r\n}", "function newBullet(data){\n\t//creates a new bullet\n\twindow.bullets.push(new Bullet(data.id, data.x, data.y, data.bulletSize, data.pierce));\n\t//play the fire bullet sound\n\tbulletshotsound.play();\n}", "function Bullet(body, player) {\n\tEntity.call(this, body, BULLET_TYPE);\n\t\n\tthis.player = player;\n\t\n\t//set a timeout where we will destroy ourselves (whoa..you can do that?)\n\tsetTimeout(function () {\n\t\tbody.GetWorld().DestroyBody(body);\n\t}, 500);\n}", "add( bullet ){\r\n\r\n this.bullets[this.bullets.length] = bullet;\r\n }", "function Player() {\n this.x = 50;\n this.y = 50;\n this.move = 0;\n this.jump = 0;\n this.hasJumped = false;\n this.bullets = new Array(numBullets);\n this.fireBullet = function() {\n for (var i = 0; i < numBullets; i++) {\n var bullet = player.bullets[i];\n if (bullet.x < 0 || bullet.y < 0 || bullet.x > particles.length || bullet.y > particles[0].length) {\n var x = curX/particleSize;\n var y = curY/particleSize;\n var magnitude = Math.sqrt(Math.pow(x - player.x, 2) + Math.pow(y - player.y, 2));\n if (magnitude>maxBulletSpeed)\n magnitude /= maxBulletSpeed;\n else\n magnitude = 1;\n bullet.velX = (x - player.x)/magnitude;\n bullet.velY = (y - player.y)/magnitude;\n bullet.x = player.x;\n bullet.y = player.y;\n bullet.elem = elemType;\n return;\n }\n }\n };\n }", "createBullets() {\n\n if (this.bullets.length < 2) {\n let blt = new Bullet()\n blt.pos.x = this.pos.x + (this.size.w / 2) // Centers the bullet starting point\n blt.pos.y = this.pos.y + (this.size.h / 2) // to the players body\n blt.color = '#00ff00'\n blt.damage = this.bulletDamage\n\n blt.vector.dx = this.bulletDirection.dx // Sets the vector of the bullet \n blt.vector.dy = this.bulletDirection.dy // to the mouse pos\n this.bullets.push(blt) // Push the bullet object to bullets array\n\n HelperFunctions.playAudio(this.gunVolume, \"https://raw.githubusercontent.com/JoshMatthew/PeewPeew/master/assets/sfx/enemy-gun.mp3\")\n }\n }", "drawBullet(bullet) {\n const { x, y, size, color } = bullet;\n this.context.beginPath();\n this.context.strokeStyle = \"#000000\";\n this.context.arc(x, y, size, 0, 2 * Math.PI, false);\n this.context.fillStyle = color;\n this.context.fill();\n }", "function bulletHitEnemy() {\n\t// Tracks if the bullet's x coordinate and enemy's x coordinates touched\n\tif (bullet.x > virus.virusX) {\n\t\ttextTemplate.score += 100; // Increment the scoreboard by 100\n\t\tbullet.x = megaman.megamanX; // Resets the position of the bullet to megaman's x coordinate\n\t\tbullet.speed = 0; // Set's the bullet speed to 0 so the bullet doesn't continue to shoot\n\t\timgVirus = loadImage(virus.virusDeathSprite); // Load's the sprite of what happens when the virus dies\n\t\tvirus.virusX = virus.virusSpawn; // Virus changes the virus's x coordinates to respawn point coordinates\n\t\tvirus.virusSpeed = 0; // Makes virus stop moving\n\t\ttextTemplate.displayStageClear(); // Displays stage clear when enemy is dead\n\t\tmySoundClear.play(); // Plays audio\n\t}\n}", "processBulletCollision(ship, bullet){\n\t var emitter = this.game.add.emitter(bullet.x, bullet.y, 100);\n emitter.makeParticles('asteroid-flake-3');\n emitter.minParticleScale = .5;\n emitter.maxParticleScale = 1;\n emitter.gravity = 0;\n emitter.explode(200, 1);\n this.game.time.events.add(500, this.destroyEmitter, emitter);\n \n bullet.kill();\n return false; // Never collides, just dies.\n }", "processBulletCollision(ship, bullet){\n\t var emitter = this.game.add.emitter(bullet.x, bullet.y, 100);\n emitter.makeParticles('asteroid-flake-3');\n emitter.minParticleScale = .5;\n emitter.maxParticleScale = 1;\n emitter.gravity = 0;\n emitter.explode(200, 1);\n this.game.time.events.add(500, this.destroyEmitter, emitter);\n \n bullet.kill();\n return false; // Never collides, just dies.\n }", "shoot(x) {\n this.x = x;\n this.isShot = true;\n playSound(this.throwSound);\n }", "function Bullet() {\n\tSprite.call(this, BULLET_IMG_SRC, BULLET_WIDTH, BULLET_HEIGHT)\n}", "function shoot (position) {\n\tif (socket != null && userid != null) {\n\t\tsocket.emit('shoot', userid, position);\n\t}\n}", "function draw() {\n // Update\n cooldown++;\n if (keys[LEFT_ARROW]) {\n shipX = shipX - shipSpeed;\n }\n if (keys[RIGHT_ARROW]) {\n shipX = shipX + shipSpeed;\n }\n if (keys[UP_ARROW]) {\n shipY = shipY - shipSpeed;\n }\n if (keys[DOWN_ARROW]) {\n shipY = shipY + shipSpeed;\n }\n if (keys[SPACE] && cooldown >= bulletCoolDown) {\n shipBulletsX.push(shipX);\n shipBulletsY.push(shipY);\n cooldown = 0;\n }\n\n for (let i = 0 ; i < shipBulletsY.length; i++) {\n shipBulletsY[i] -= bulletSpeed;\n }\n\n // Render\n background(0, 0, 0)\n fill(0, 255, 0);\n for (let i = 0; i < shipBulletsX.length; i++) {\n ellipse(shipBulletsX[i], shipBulletsY[i], 5, 5);\n }\n imageMode(CENTER);\n image(shipSprite, shipX, shipY, 50, 50);\n}", "function fireGun(x,y){\n\tvar bullet = new Particle( new ColorMaterial(0xffffff, 1) );\n\tbullet.size = 5;\n\tbullet.position.x = gunMesh.position.x;\n\tbullet.position.y = gunMesh.position.y;\n\tbullet.position.z = gunMesh.position.z;\n\tbullet.trajectoryX = mouseX/15;\n\tbullet.trajectoryY = -mouseY/20;\n\tbullet.updateMatrix();\n\tscene.add(bullet);\n\tbullets.push(bullet);\n}", "shootAt(x, y, target) {\n\t\tthis.body.reset(x, y);\n\t\tthis.setActive(true);\n\t\tthis.setVisible(true);\n\t\tthis.moveToObject(target);\n this.rotation = this.body.velocity.angle();\n\t}", "function loadBullet() {\n\n for (let i = 0; i < weapons.length; i++) {\n\n // compare the input string and the plant name\n const isMatched = weapons[i].compare(ingame_input_field.value.toLowerCase().replace(/^\\s+|\\s+$/g, ''));\n\n // if they match\n if (isMatched) {\n\n // create new bullet instance at the same position as the weapon's\n let bullet = new Bullets(weapons[i].x, weapons[i].y, 10);\n bullets.push(bullet);\n\n // set the styling to default\n ingame_input_field.style.border = '1px solid black';\n\n // reset the input field to empty\n ingame_input_field.value = '';\n }\n }\n\n // play the sound effects\n playSound('shoot');\n}", "function AddNewBullet(){\n\n bullet_array[index_bullet] = $.extend( {}, bullet ); //Añado ias al array mediante un Swallow Copy del \"Objeto\" Bullet\n snd.play(); //Reproduzco el sonido\n\n //Establezco los vectores directores x e y, así como la magnitud de la nueva bala\n bullet_array[index_bullet].vector_director_x = input.mouse.x + (camera.position.x) - player.position.x;\n bullet_array[index_bullet].vector_director_y = input.mouse.y + (camera.position.y) - player.position.y;\n bullet_array[index_bullet].magnitud = Math.sqrt(bullet_array[index_bullet].vector_director_x * bullet_array[index_bullet].vector_director_x + bullet_array[index_bullet].vector_director_y * bullet_array[index_bullet].vector_director_y);\n\n //Calculo y normalizo el vector impulso\n bullet_array[index_bullet].impulse = {\n x: (bullet_array[index_bullet].vector_director_x / bullet_array[index_bullet].magnitud) * 0.2,\n y: -(bullet_array[index_bullet].vector_director_y / bullet_array[index_bullet].magnitud) * 0.2,\n },\n\n //Creo el objeto Box2D\n bullet_array[index_bullet].body = CreateBall(world, player.position.x/100 + bullet_array[index_bullet].impulse.x*3.5 , (7.20 - player.position.y/100 + bullet_array[index_bullet].impulse.y*3.5), .05, 1);\n \n //Aplico el impulso al objeto\n bullet_array[index_bullet].Applyimpulse(bullet_array[index_bullet].impulse);\n\n //Inicializo la bala\n bullet_array[index_bullet].Start();\n\n //Aumento el indice\n index_bullet++;\n}", "function Shoot()\n{\n\t//go through projectiles and find one that isn't in play\n\tfor (var i = 0; i < projectiles.length; i++)\n\t{\n\t\tif (!projectiles[i].GetComponent(W2BossProjectileController).OnScreen)\n\t\t{\n\t\t\t//pull into play\n\t\t\tprojectiles[i].GetComponent(W2BossProjectileController).move = this.transform.forward * ProjectileSpeed * -1;\n\t\t\tprojectiles[i].transform.position = this.transform.position + (projectiles[i].GetComponent(W2BossProjectileController).move);\n//\t\t\tprojectiles[i].tag = \"Untagged\";\n\t\t\treturn; //break out of the loop\n\t\t}\n\t}\n}", "function Bullet(game, spritesheet) {\n this.sprite = new Sprite(spritesheet, 0, 0, 640, 320, 1, 0, 0.04, false);\n this.game = game;\n this.speed = 500;\n this.angleLeftX1 = 690;\n this.angleLeftX2 = 690;\n this.angleRightX1 = 690;\n this.angleRightX2 = 690;\n this.ctx = game.ctx;\n this.spawned = false;\n this.repeated = false;\n this.craneshot = false;\n this.planeshot = false;\n Entity.call(this, game, -50, -50); //start off screen\n //685, 580 = right in front of plane.\n}", "function emit_attack() {\n var dir;\n dir = get_my_direction();\n dir.setLength(CONFIG.BULLET_VELOCITY);\n\n game.bullets.push(new TYPE.Bullet(game,\n dir,\n new THREE.Mesh(WORLD.bullet_geometry,\n WORLD.bullet_material))\n );\n\n game.bullets[game.bullets.length-1].mesh.position.copy(WORLD.player.mesh.position);\n WORLD.scene.add(game.bullets[game.bullets.length-1].mesh);\n\n // tell the other plays i fired\n socket.emit(\"new_bullet\", {\"pos\": game.bullets[game.bullets.length-1].mesh.position, \"dir\": dir});\n}", "function Bullet(object)\n{\n\tthis.alive = false; // Is true if the bullet is currently in use\n var self = object;\n\t/*\n\t * Sets the bullet values\n\t */\n\tthis.spawn = function(x, y, speed)\n {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.speed = speed;\n\t\tthis.alive = true;\n\t};\n\t/*\n\t * Returns true if the bullet moved off the screen, indicating that\n\t * the bullet is ready to be cleared by the pool, otherwise draws\n\t * the bullet.\n\t */\n\tthis.draw = function()\n {\n this.context.clearRect(this.x-1, this.y-1, this.width+2, this.height+2);\n\t\tthis.y -= this.speed;\n\t\tif (this.isColliding)\n {\n\t\t\treturn true;\n\t\t}\n\t\telse if (self === \"bullet\" && this.y <= 0 - this.height)\n {\n\t\t\treturn true;\n\t\t}\n\t\telse if (self === \"enemyBullet\" && this.y >= this.canvasHeight)\n {\n\t\t\treturn true;\n\t\t}\n\t\telse if (self === \"eliteBullet\" && this.y >= this.canvasHeight)\n {\n\t\t\treturn true;\n\t\t}\n\t\telse if (self === \"titanBullet\" && this.y >= this.canvasHeight)\n {\n\t\t\treturn true;\n\t\t}\n\t\telse if (self === \"titanBigBullet\" && this.y >= this.canvasHeight)\n {\n\t\t\treturn true;\n\t\t}\n\t\telse if (self === \"goliathBullet\" && this.y >= this.canvasHeight)\n {\n\t\t\treturn true;\n\t\t}\n\t\telse if (self === \"goliathSecondaryBullet\" && this.y >= this.canvasHeight)\n {\n\t\t\treturn true;\n\t\t}\n\t\telse if (self === \"goliathBigBullet\" && this.y >= this.canvasHeight)\n {\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (self === \"bullet\")\n\t\t\t{\n\t\t\t\t\tthis.context.drawImage(imageRepository.bullet, this.x, this.y);\n\t\t\t}\n\t\t\telse if (self === \"enemyBullet\")\n {\n\t\t\t\tthis.context.drawImage(imageRepository.enemyBullet, this.x, this.y);\n\t\t\t}\n\t\t\telse if (self === \"eliteBullet\")\n {\n\t\t\t\tthis.context.drawImage(imageRepository.eliteBullet, this.x, this.y);\n\t\t\t}\n\t\t\telse if (self === \"titanBullet\")\n {\n\t\t\t\tthis.context.drawImage(imageRepository.titanBullet, this.x, this.y);\n\t\t\t}\n\t\t\telse if (self === \"titanBigBullet\")\n {\n\t\t\t\tthis.context.drawImage(imageRepository.titanBigBullet, this.x, this.y);\n\t\t\t}\n\t\t\telse if (self === \"goliathBullet\")\n {\n\t\t\t\tthis.context.drawImage(imageRepository.goliathBullet, this.x, this.y);\n\t\t\t}\n\t\t\tif (self === \"goliathSecondaryBullet\")\n {\n\t\t\t\tthis.context.drawImage(imageRepository.goliathSecondaryBullet, this.x, this.y);\n\t\t\t}\n\t\t\telse if (self === \"goliathBigBullet\")\n {\n\t\t\t\tthis.context.drawImage(imageRepository.goliathBigBullet, this.x, this.y);\n\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t};\n\t/*\n\t * Resets the bullet values\n\t */\n\tthis.clear = function()\n {\n\t\tthis.x = 0;\n\t\tthis.y = 0;\n\t\tthis.speed = 0;\n\t\tthis.alive = false;\n this.isColliding = false;\n\t};\n}", "function removeBullet(data){\n\t//finds the bullet in the array\n\tvar removedBullet = bulletById(data.id);\n\tif(!removedBullet){//if the bullet isnt found\n\t\tconsole.log(\"bullet was requested to be removed, but couldn't be found\");\n\t\treturn;\n\t};\n\t//remove the bullet from the game\n\tbullets.splice(bullets.indexOf(removedBullet),1);\n}", "function Bullet(descr) {\n\n\t// Common inherited setup logic from Entity\n\tthis.setup(descr);\n\n\t// Make a noise when I am created (i.e. fired) if this.playSound is true so we dont get an error for playing 3 sounds at once when using the multigun powerup.\n\tif(this.playSound && !this.big[3]){\n\t\tthis.fireSound.pause();\n\t\tthis.fireSound.currentTime = 0;\n\t\tthis.fireSound.play();\n\t}\n\n\t//play this sound if the bullet is of type big4\n\tif (this.big[3] && this.playSound) {\n\t\tthis.bigBulletSound.pause();\n\t\tthis.bigBulletSound.currentTime = 0;\n\t\tthis.bigBulletSound.play();\n\t}\n\n\t/*\n\t\t\t// Diagnostics to check inheritance stuff\n\t\t\tthis._bulletProperty = true;\n\t\t\tconsole.dir(this);\n\t*/\n\n}", "function playerClick(event){\n player.staffUp = true;\n\n if (player.dir == \"l\") {\n playerImg.src = \"img/staffL-legL.png\"\n } else if (player.dir == \"r\") {\n playerImg.src = \"img/staffR-legL.png\"\n }\n\n // after some time, stop the staff going up\n setTimeout( () => {\n player.staffUp = false;\n\n if (player.dir == \"l\") {\n playerImg.src = \"img/GiantOwlL.png\"\n } if (player.dir == \"r\") { \n playerImg.src = \"img/GiantOwlR.png\"\n }\n }, 1000); // 1/4 a millasec\n\n //check if bits change;\n changeBits();\n\n\n\n // create bullets\n console.log(\"X: \" + event.clientX + \", and Y: \" + event.clientY);\n player.lastMClickX = event.clientX;\n player.lastMClickY = event.clientY;\n // create bullet bases on direction owl is facing\n if (player.dir == \"l\") {\n var bullet = new Bullet(player.x, player.y, player.lastMClickX, player.lastMClickY);\n } else if (player.dir == \"r\") {\n var bullet = new Bullet(player.x+259, player.y, player.lastMClickX, player.lastMClickY);\n }\n\n //Bullets being checked on collision\n collision.push(bullet);\n //Bullets being pushed to the draw function.\n drawBullets.push(bullet);\n\n console.log(drawBullets);\n \n}", "function Bullet(j){\n\tthis.jet=j;\n\tthis.srcX=100;\n\tthis.srcY=500;\n\tthis.drawX=-20;\n\tthis.drawY=0\n\tthis.width=7;\n\tthis.height=7;\n\tthis.speed=5;//10;\n\tthis.gravity=.01;\n\tthis.angle=25;\n\tthis.explosion=new Explosion();\n\tthis.sound= new Audio('sounds/BANG.mp3');\n\tthis.sound.volume =0.06;\n}", "function Bullet(X, Y, toX,toY) {\n this.x = X;\n this.y = Y;\n this.tox = toX;\n this.toy = toY;\n}" ]
[ "0.81954247", "0.8124464", "0.8049461", "0.80111843", "0.7779824", "0.77730066", "0.77631354", "0.7726897", "0.7637813", "0.7588914", "0.7583506", "0.7573156", "0.75551826", "0.75333387", "0.74282426", "0.74223644", "0.7418206", "0.7388679", "0.72680455", "0.7232402", "0.7195671", "0.71399444", "0.7118757", "0.70956874", "0.7076824", "0.70662546", "0.70558125", "0.7014105", "0.70096266", "0.69947684", "0.6988508", "0.6974462", "0.6969853", "0.6921691", "0.69204664", "0.69177514", "0.68716145", "0.6865514", "0.6863906", "0.6828237", "0.6820816", "0.68202835", "0.68161833", "0.6810782", "0.68020636", "0.6755972", "0.6739162", "0.6729668", "0.6697615", "0.66797507", "0.6670785", "0.66686124", "0.666731", "0.6659961", "0.6634569", "0.6599572", "0.6571103", "0.6532911", "0.6528464", "0.65187925", "0.6512194", "0.6490681", "0.6470345", "0.6458852", "0.64563173", "0.64435065", "0.64417267", "0.6434928", "0.6423549", "0.64098674", "0.6398954", "0.6398639", "0.6398013", "0.6386392", "0.6384391", "0.6383642", "0.6374751", "0.6339658", "0.6329843", "0.63175905", "0.6314578", "0.62950885", "0.62950885", "0.6292756", "0.62922835", "0.6287", "0.62700194", "0.62659925", "0.6257949", "0.62446177", "0.6229475", "0.6228203", "0.6218893", "0.62075186", "0.62022024", "0.61750823", "0.6173871", "0.61575156", "0.6151362", "0.6151074" ]
0.7098799
23
This function updates the position of the bullets
function moveBullets() { // Go through all bullets var bullets = document.getElementById("bullets"); for (var i = 0; i < bullets.childNodes.length; i++) { var node = bullets.childNodes.item(i); // Update the position of the bullet var x = parseInt(node.getAttribute("x")); node.setAttribute("x", x + BULLET_SPEED); // If the bullet is not inside the screen delete it from the group if (x > SCREEN_SIZE.w) { bullets.removeChild(node); i--; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setBulletPosition() {\n\t\tthis.x = Math.round(this.originalPosition.x);\n\t\tthis.y = Math.round(this.originalPosition.y);\n\t}", "function draw_bullets(){\n bullets.forEach(function(element){\n element.y -= 10;\n element.update()\n })\n}", "updateBullets() {\n for (var i = 0; i < this.bullets.length; i++) {\n var bullet = this.bullets[i];\n\n // Update the bullet\n bullet.update();\n\n // Deleting the bullet\n if (bullet.delete) {\n // Destroy any bullet assets\n bullet.destroyAssets();\n\n // Remove it from the list\n this.bullets.splice(i, 1);\n }\n }\n }", "function updateBullets() {\n if (allEnemyBullets.length > 0) {\n for (var bullet = 0 ; bullet < allEnemyBullets.length; bullet++) {\n allEnemyBullets[bullet].travel();\n\n }\n }\n}", "function fireBullet(){\n bullets.push({\n x: bullet.x + killa.width/2 - bullet.width/2,\n y: bullet.y + killa.height/2 - bullet.height/2\n\n })\n}", "update(){\r\n\r\n var i = 0;\r\n while ( i < this.bullets.length )\r\n if ( !this.bullets[i].update() )\r\n this.bullets.splice( i, 1 );\r\n else\r\n i++;\r\n }", "function moveBullets() {\n var bullets = document.getElementById(\"bullets\");\n for (var i = 0; i < bullets.childNodes.length; ++i) {\n var node = bullets.childNodes.item(i);\n\n var x = parseInt(node.getAttribute(\"x\"));\n var velocity = (node.getAttribute(\"direction\") == facingType.RIGHT) ? BULLET_SPEED : -BULLET_SPEED;\n\n node.setAttribute(\"x\", x + velocity);\n\n if ((x > SCREEN_SIZE.w) || (x < 0)) {\n if (bullets.contains(node)) {\n bullets.removeChild(node);\n --i;\n }\n }\n }\n}", "function updateBullets (lazer) {\n\n // if (game.time.now > frameTime)\n // {\n // frameTime = game.time.now + 500;\n // }\n // else\n // {\n // return;\n // }\n\n // Adjust for camera scrolling\n var camDelta = game.camera.x - prevCamX;\n lazer.x += camDelta;\n\n if (lazer.animations.frameName !== 'frame30')\n {\n lazer.animations.next();\n }\n else\n {\n if (lazer.scale.x === 1)\n {\n lazer.x += 16;\n\n if (lazer.x > (game.camera.view.right - 224))\n {\n lazer.kill();\n }\n }\n else\n {\n lazer.x -= 16;\n\n if (lazer.x < (game.camera.view.left - 224))\n {\n lazer.kill();\n }\n }\n }\n\n}", "function draw_enemy_bullets(){\n enemy_bullets.forEach(function(element){\n element.y += 10;\n element.update()\n })\n}", "function updateBullets(){\n // THEN CALCULATE NEW POSITIONS FOR BULLETS\n for(var i = 0; i < bulletListDev.length; i++){\n bulletDev = bulletListDev[i];\n // kill the bullet\n var underCell = getGridCellDev(renderPlayerGridDev, bulletDev.yBullet, bulletDev.xBullet);\n if(underCell === BULLET_CELL_DEV){\n setGridCellDev(renderPlayerGridDev, bulletDev.yBullet, bulletDev.xBullet, DEAD_CELL_DEV);\n setGridCellDev(updatePlayerGridDev, bulletDev.yBullet, bulletDev.xBullet, DEAD_CELL_DEV);\n }\n // CHECK IF THE BULLET IS OUT OF BOUNDS\n if(bulletDev.xBullet > gridWidthDev || bulletDev.xBullet < 0 || bulletDev.yBullet > gridHeightDev || bulletDev.yBullet < 0){\n bulletListDev.splice(i, 1);\n } else if(bulletDev.collided === true) {\n killBulletExplosion(bulletDev);\n bulletListDev.splice(i, 1);\n } else {\n if (bulletDev.dirBullet === \"up\") {\n bulletDev.yBullet -= bulletDev.velBullet;\n } else if (bulletDev.dirBullet === \"right\") {\n bulletDev.xBullet += bulletDev.velBullet;\n } else if (bulletDev.dirBullet === \"down\") {\n bulletDev.yBullet += bulletDev.velBullet;\n } else if (bulletDev.dirBullet === \"left\") {\n bulletDev.xBullet -= bulletDev.velBullet;\n }\n bulletListDev[i] = bulletDev;\n detectBulletCollision(bulletDev);\n // DO NOT REPLACE POWERUPS UNLESS THERE IS AN EXPLOSION\n underCell = getGridCellDev(renderPlayerGridDev, bulletDev.yBullet, bulletDev.xBullet);\n if(underCell === DEAD_CELL_DEV){\n setGridCellDev(renderPlayerGridDev, bulletDev.yBullet, bulletDev.xBullet, BULLET_CELL_DEV);\n setGridCellDev(updatePlayerGridDev, bulletDev.yBullet, bulletDev.xBullet, BULLET_CELL_DEV);\n }\n }\n }\n}", "function moveBullets() {\n // Go through all bullets\n\tvar bullets = svgdoc.getElementById(\"rightBullets\");\n for (var i = 0; i < bullets.childNodes.length; i++) {\n var node = bullets.childNodes.item(i);\n \n // Update the position of the bullet\n\t\tvar x = parseInt(node.getAttribute(\"x\"));\n\t\tnode.setAttribute(\"x\", x + BULLET_SPEED);\t\n \t\n // If the bullet is not inside the screen delete it from the group\n if (x < 0) {\n bullets.removeChild(node);\n i--;\n }\n }\n\t\n\tbullets = svgdoc.getElementById(\"leftBullets\");\n for (var i = 0; i < bullets.childNodes.length; i++) {\n var node = bullets.childNodes.item(i);\n \n // Update the position of the bullet\n\t\tvar x = parseInt(node.getAttribute(\"x\"));\n\t\tnode.setAttribute(\"x\", x - BULLET_SPEED);\t\n \t\n // If the bullet is not inside the screen delete it from the group\n if (x > SCREEN_SIZE.w) {\n bullets.removeChild(node);\n i--;\n }\n }\n\t\n\tbullets = svgdoc.getElementById(\"monsterLeftBullets\");\n for (var i = 0; i < bullets.childNodes.length; i++) {\n var node = bullets.childNodes.item(i);\n \n // Update the position of the bullet\n\t\tvar x = parseInt(node.getAttribute(\"x\"));\n\t\tnode.setAttribute(\"x\", x - monster_BULLET_SPEED);\t\n \t\n // If the bullet is not inside the screen delete it from the group\n if (x < 0) {\n bullets.removeChild(node);\n i--;\n\t\t\tmonster_BULLET_COUNT = 0;\n }\n }\n\t\n\tbullets = svgdoc.getElementById(\"monsterRightBullets\");\n for (var i = 0; i < bullets.childNodes.length; i++) {\n var node = bullets.childNodes.item(i);\n \n // Update the position of the bullet\n\t\tvar x = parseInt(node.getAttribute(\"x\"));\n\t\tnode.setAttribute(\"x\", x + monster_BULLET_SPEED);\t\n \t\n // If the bullet is not inside the screen delete it from the group\n if (x > SCREEN_SIZE.w) {\n bullets.removeChild(node);\n i--;\n\t\t\tmonster_BULLET_COUNT = 0;\n }\n }\n}", "setupBullets() {\n gameState.bullets = this.physics.add.group();\n // Give it a small hitbox, too.\n // gameState.bullets.create(132, 194, 'bullet').setSize(2, 2).setOffset(7, 7);\n }", "function moveBullets() {\r\n // Go through all bullets\r\n var bullets = svgdoc.getElementById(\"bullets\");\r\n for (var i = 0; i < bullets.childNodes.length; i++) {\r\n var node = bullets.childNodes.item(i);\r\n\r\n // Update the position of the bullet\r\n var x = parseInt(node.getAttribute(\"x\"));\r\n node.setAttribute(\"x\", x + BULLET_SPEED);\r\n\r\n // If the bullet is not inside the screen delete it from the group\r\n if (x > SCREEN_SIZE.w) {\r\n bullets.removeChild(node);\r\n i--;\r\n }\r\n }\r\n\r\n //move to LEFT\r\n var bullets = svgdoc.getElementById(\"bulletsToLeft\");\r\n for (var i = 0; i < bullets.childNodes.length; i++) {\r\n var node = bullets.childNodes.item(i);\r\n\r\n // Update the position of the bullet\r\n var x = parseInt(node.getAttribute(\"x\"));\r\n node.setAttribute(\"x\", x - BULLET_SPEED);\r\n\r\n // If the bullet is not inside the screen delete it from the group\r\n if (x < 0) {\r\n bullets.removeChild(node);\r\n i--;\r\n }\r\n }\r\n\r\n if(ifmonsterShoot && !ifdead){\r\n var bullets = svgdoc.getElementById(\"monsterbullets\");\r\n if(bullets.childNodes.length>0){\r\n var node = bullets.childNodes.item(0);\r\n var x = parseInt(node.getAttribute(\"x\"));\r\n node.setAttribute(\"x\", x + BULLET_SPEED);\r\n if (x > SCREEN_SIZE.w) {\r\n bullets.removeChild(node);\r\n ifmonsterShoot = false;\r\n monsterShoot();\r\n }\r\n }\r\n\r\n var bullets = svgdoc.getElementById(\"monsterbulletsToLeft\");\r\n if(bullets.childNodes.length>0){\r\n var node = bullets.childNodes.item(0);\r\n var x = parseInt(node.getAttribute(\"x\"));\r\n node.setAttribute(\"x\", x - BULLET_SPEED);\r\n if (x < 0) {\r\n bullets.removeChild(node);\r\n ifmonsterShoot = false;\r\n monsterShoot();\r\n }\r\n }\r\n\r\n }\r\n}", "update() {\n //If the bullet is not currently being fired, set it to the same location as the player\n if (this.bulletIsActive === false) {\n this.bullet.x = this.x;\n this.bullet.y = this.y;\n }\n\n //Add velocity to player\n this.x += this.vx;\n this.y += this.vy;\n //Add inverted velocity to target\n this.targetX -= this.vx;\n this.targetY -= this.vy;\n //Set velocity to max values\n this.vx = constrain(this.vx, -8, 8);\n this.vy = constrain(this.vy, -8, 8);\n //Keep player within a reasonable playing field\n this.constrainToMap();\n //run all functions within the bullet\n this.handleBullet();\n\n }", "function updateBulletMovement(){\n $(\".playerBullet\").each(function(){\n // Get current position\n var posx = $(this).x();\n var posy = $(this).y();\n\n\n // Check if out of bounds or collided with wall\n var collided_with_wall = $(this).collision(\".obstacleBody,.\"+$.gQ.groupCssClass);\n if(isOutOfBounds(posx, posy) || (collided_with_wall.length > 0)){\n $(this)[0].bullet.fired = false;\n $(this).fadeOut(0,0);\n return;\n }\n\n // Not out of bounds, or hitting a wall.\n // Check if there was a collision.\n var collided = $(this).collision(\".enemy,.\"+$.gQ.groupCssClass);\n var collider = $(this);\n\n // Handle any damage inflicted upon the enemy by the bullet\n handleEnemyDamage(collided, \"enemy\", collider, \"playerBullet\");\n\n // Figure out the next position\n var nextX = Math.round(Math.cos($(this)[0].bullet.direction) * BULLET_SPEED + posx);\n var nextY = Math.round(Math.sin($(this)[0].bullet.direction) * BULLET_SPEED + posy);\n\n // Move the bullet\n $(this).x(nextX);\n $(this).y(nextY);\n\n });\n}", "function bulletsShoot() {\n if (ship.fireGun && ship.bullets.length < maxBullets) {\n ship.bullets.push({\n x: ship.x + 4/3 + ship.r * Math.cos(ship.a),\n y: ship.y - 4/3 * ship.r * Math.sin(ship.a),\n xv: bulletSpeed * Math.cos(ship.a),\n yv: -bulletSpeed * Math.sin(ship.a),\n r: 2,\n }); \n }\n // ship.fireGun = false;\n}", "function _recreateBullets(oldReferenceLayer,targetElement){if(this._options.showBullets){var existing=document.querySelector(\".introjs-bullets\");existing.parentNode.replaceChild(_createBullets.call(this,targetElement),existing);}}", "update_bullet_pos( ){\n for (let i=0; i<this.bullet_pos.length; i++){\n const radius = this.bullet_pos[i][0];\n const angle = this.bullet_pos[i][1];\n \n //check collision here\n if(radius < 2.0){\n //remove bullet\n this.bullet_pos.splice(i,1);\n i--;\n this.player_got_hit();\n //player gets hit\n } else if(radius < 4 && radius > 3 && this.shieldUp){\n //check if shield blocks\n const shield_ang = this.camera_angle + Math.PI/2;\n const anglediff = (shield_ang%(2*Math.PI) - angle%(2*Math.PI) + Math.PI + 2*Math.PI) % (2*Math.PI) - Math.PI;\n\n if (anglediff <= Math.PI/4 && anglediff >= -Math.PI/4){\n this.bullet_pos.splice(i,1);\n i--;\n //play block sound\n const newAudio = this.sound.splat.cloneNode()\n newAudio.play();\n } \n else // not blocked, move as normal\n this.bullet_pos[i][0] -= 0.08;\n\n } \n else\n this.bullet_pos[i][0] -= 0.08;\n }\n }", "function DrawBullets () {\r\n for (var j = 0; j < player_1.bullets.length; j++) {\r\n var disparoBueno = player_1.bullets[j];\r\n Update_Player_Bullet(disparoBueno, j, player_1);\r\n }\r\n\r\n if (Jugadores == 2) {\r\n for (var j = 0; j < player_2.bullets.length; j++) {\r\n var disparoBueno = player_2.bullets[j];\r\n Update_Player_Bullet(disparoBueno, j, player_2);\r\n }\r\n }\r\n\r\n if (enemy_1.life > 0) {\r\n for (var i = 0; i < enemy_1.bullets.length; i++) {\r\n var disparoMalo = enemy_1.bullets[i];\r\n Update_Enemy_Bullet(disparoMalo, i);\r\n }\r\n }\r\n }", "function bullet(xBullet, yBullet, dirBullet, velBullet)\n{\n this.xBullet = xBullet;\n this.yBullet = yBullet;\n this.dirBullet = dirBullet;\n this.velBullet = velBullet;\n this.collided = false;\n}", "function moveBullets() {\r\n // Go through all bullets\r\n var bullets = svgdoc.getElementById(\"bullets\");\r\n for (var i = 0; i < bullets.childNodes.length; i++) {\r\n var node = bullets.childNodes.item(i);\r\n\r\n // Update the position of the bullet\r\n var x = parseInt(node.getAttribute(\"x\"));\r\n\r\n if( bulletarray[i].facing == facingDir.RIGHT)node.setAttribute(\"x\", x + BULLET_SPEED);\r\n\t\telse node.setAttribute(\"x\", x - BULLET_SPEED);\r\n // If the bullet is not inside the screen delete it from the group\r\n if (x > SCREEN_SIZE.w) {\r\n bullets.removeChild(node);\r\n bulletarray.splice(i,1);\r\n i--;\r\n }\r\n else if (x <0){\r\n\t\t\tbullets.removeChild(node);\r\n\t\t\tbulletarray.splice(i,1);\r\n i--;\r\n\t\t}\r\n }\r\n\r\n\r\n var mbullets = svgdoc.getElementById(\"monsterbullets\");\r\n\t for (var i = 0; i < mbullets.childNodes.length; i++) {\r\n\t var node = mbullets.childNodes.item(i);\r\n\r\n\t // Update the position of the bullet\r\n\t var x = parseInt(node.getAttribute(\"x\"));\r\n\r\n\t if( monsterbulletarray[i].facing == facingDir.RIGHT)node.setAttribute(\"x\", x + BULLET_SPEED);\r\n\t\t\telse node.setAttribute(\"x\", x - BULLET_SPEED);\r\n\t // If the bullet is not inside the screen delete it from the group\r\n\t if (x > SCREEN_SIZE.w) {\r\n\t mbullets.removeChild(node);\r\n\t monsterbulletarray.splice(i,1);\r\n\t i--;\r\n\t }\r\n\t else if (x <0){\r\n\t\t\t\tmbullets.removeChild(node);\r\n\t\t\t\tmonsterbulletarray.splice(i,1);\r\n\t i--;\r\n\t\t\t}\r\n }\r\n}", "add( bullet ){\r\n\r\n this.bullets[this.bullets.length] = bullet;\r\n }", "drawExistingBullets() {\n const bullets = this.bulletManager.entitiesDisplayed;\n\n for (let index = 0; index < bullets.length; index++) {\n bullets[index].draw(this.ctx);\n }\n }", "static update() {\r\n\r\n // Bouncing the bubbles from the bubbles\r\n bubbles.bounce(bubbles);\r\n\r\n // removing the bullets and the bubbles if the bullet touches the bubble\r\n bullets.overlap(bubbles, (e, f) => {\r\n e.remove();\r\n f.remove();\r\n // Increasing the score by 1\r\n score++;\r\n });\r\n\r\n for (let i = bubbles.length; i > 0; i--) {\r\n let s = bubbles.get(i - 1);\r\n\r\n // Changing the position of the bubble if it is out of the play area\r\n if (s.x < -80)\r\n s.x = width + 80;\r\n if (s.x > width + 80)\r\n s.x = -80;\r\n if (s.y < -80)\r\n s.y = height + 80;\r\n if (s.y > height + 80)\r\n s.y = -80;\r\n }\r\n }", "function Bullet() {\n _super.call(this, \"bullet\");\n this.name = \"bullet\";\n // set the small insect to start at a random y value\n this.y = Math.floor(Math.random() * constants.SCREEN_HEIGHT);\n this.x = 0;\n // add drift to the cloud \n this._dx = 5;\n }", "function _changeBulletPosition(number) {\n $(\"#arena_bullets li\").removeClass('active');\n $(SELECTORS.bullet+number).addClass('active');\n}", "function drawBullets() {\n\t\n\t// Retire todos los proyectiles que han pasado fuera de la pantalla.\n\tfor (var b = 0; b < bullets.length; b++) {\n\t\tif (bullets[b].defunct == true || bullets[b].y <= 0) {\n\t\t\tbullets.splice(b, 1);\n\t\t\tb--;\n\t\t}\n\t}\n\t\n\t// pinta todas las balas que aún quedan.\n\tfor (var b = 0; b < bullets.length; b++) {\n\t\t\n\t\t// Mueva la bala un poco.\n\t\tbullets[b].y -= DELTA_BULLET;\n\t\t\n\t\t// Si la bala ha afectado a alguna de las naves espaciales!\n\t\tvar hit = false;\n\t\tfor (var s = 0; s < spaceships.length && hit == false; s++) {\n\t\t\t\n\t\t\t// Es un éxito de la prueba para ver si la bala ha afectado esta nave espacial.\n\t\t\tif ((Math.abs(spaceships[s].x - bullets[b].x) < HIT_PROXIMITY) &&\n\t\t\t\t(Math.abs(spaceships[s].y - bullets[b].y) < HIT_PROXIMITY)) {\n\t\t\t\t\n\t\t\t\t// Es un éxito! Así que marquen la nave espacial y la bala como \"defunct\".\n\n ctx.drawImage(explosion, spaceships[s].x, spaceships[s].y);\n\n\n\n\t\t\t\tspaceships[s].defunct = true;\n\t\t\t\tbullets[b].defunct = true;\n\t\t\t\thit = true;\n\n\t\t\tpunto++;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Si la bala no alcanzó ninguna de las naves espaciales, a continuación, dibuje la bala.\n\t\tif (!hit) {\n\t\t\tctx.drawImage(bullet, bullets[b].x, bullets[b].y);\n\t\t}\n\t}\n}", "function Update_Player_Bullet (bullet, id, player) {\r\n if (bullet) {\r\n bullet.identifier = id;\r\n if (bullet.posX < 1200) {\r\n bullet.posX += 5;\r\n //Obtener carril de la bala \r\n var carril = bullet.zindex;\r\n //Segun el carril, pintarlo en una capa u otra\r\n switch (carril) {\r\n case 0: capa0ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 1: capa1ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 2: capa2ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n }\r\n } else {\r\n player.DeleteShot(parseInt(bullet.identifier));\r\n }\r\n }\r\n }", "function newBullet(e) {\n \tbulletX = 35;\n bulletY = shipY + 10;\n \n bullet.push(bulletX);\n \n }", "function Bullet() {\n this.srcX = 331;\n this.srcY = 500;\n this.drawX = -20;\n this.drawY = 0;\n this.width = 16;\n this.height = 14;\n this.explosion = new Explosion();\n}", "handleBullet() {\n //if the bullet is active, run the code\n if (this.bulletIsActive === true) {\n //create variable for finding distance to target\n let bulletToTarget = dist(this.bullet.x, this.bullet.y, this.targetX, this.targetY);\n //If the bullet is close enough to the target, reset it as inactive\n if (bulletToTarget < 10) {\n this.bulletIsActive = false;\n this.bullet.x = this.x;\n this.bullet.y = this.y;\n this.bulletSize = 10;\n } else {\n //We use three vectors to find distance, angle and speed\n //and then display the bullet there\n\n //Create a variable for the distance from ship to reticle\n let d = dist(this.x, this.y, this.targetX, this.targetY);\n //Create vectors for bullet, target, and the velocity we want\n let vecBullet = createVector(this.bullet.x, this.bullet.y);\n let vecTarget = createVector(this.targetX, this.targetY);\n let vecDesiredVel = vecTarget.sub(vecBullet);\n //Create velocity for the bullet based on the desired velocity vector\n //limited by the distance between ship and target, to achieve\n //the effect of the bullet traveling at the same speed no matter angle\n let frameVel = vecDesiredVel.limit(d / 10);\n //actually update position of bullet\n this.bullet.x += frameVel.x;\n this.bullet.y += frameVel.y;\n\n //display the bullet\n push();\n ellipseMode(CENTER);\n strokeWeight(1);\n stroke(255);\n fill(255, 28, 51);\n ellipse(this.bullet.x, this.bullet.y, this.bulletSize, this.bulletSize);\n pop();\n\n //Shrink bullet to make it seem like it's going further away\n this.bulletSize -= 1;\n }\n }\n this.handleOverheating();\n }", "function createBullet(x,y,direction){\n\tthis.positions =[]\n\tthis.positions = {x:x,y:y,direction:direction}\n}", "function fireBullet(){\n if(game.time.now>bulletTime){\n bullet=bullets.getFirstExists(false);\n if(bullet){\n bullet.reset(player.x + 14,player.y);\n bullet.body.velocity.y = -400;\n bulletTime = game.time.now + 200;\n }\n }\n }", "function movePos (bullet, drop) {\n const tmpB = listItems[bullet]\n const tmpD = delBtns[bullet]\n\n /* delete old bullet then put it in new spot in array */\n listItems.splice(bullet, 1)\n delBtns.splice(bullet, 1)\n if (drop === 0) {\n listItems.splice(drop, 0, tmpB)\n delBtns.splice(drop, 0, tmpD)\n } else {\n listItems.splice(drop - 1, 0, tmpB)\n delBtns.splice(drop - 1, 0, tmpD)\n }\n}", "function shootBullet() {\n if (!cheatMode) {\n --bulletsLeft;\n }\n\n updateBulletsNumber();\n\n // Disable shooting for a short period of time\n player.readyToShoot = false;\n setTimeout(\"player.readyToShoot = true\", PLAYER_SHOOT_INTERVAL);\n\n // Create the bullet using the use node\n var bullet = document.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n\n if (player.facing == facingType.RIGHT) {\n x = player.position.x + PLAYER_SIZE.w / 2 - BULLET_SIZE.w / 2;\n } else {\n x = player.position.x + BULLET_SIZE.w / 2;\n }\n\n bullet.setAttribute(\"direction\", player.facing)\n bullet.setAttribute(\"x\", x);\n bullet.setAttribute(\"y\", player.position.y + PLAYER_SIZE.h / 2 - BULLET_SIZE.h / 2);\n bullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bullet\");\n document.getElementById(\"bullets\").appendChild(bullet);\n playSound(SOUND_SHOOT);\n}", "function createBullet(bulletType, fromCenter, toCenter)\n{\n let bullet = new NodeObject(BLOCK/5, BLOCK/5);\n\n //fromCenter.y+player.height/2\n let angle = Math.atan((toCenter.y-fromCenter.y)/(toCenter.x-fromCenter.x)); \n let sign = Math.sign(toCenter.x-fromCenter.x);\n let velocityX = BULSPEED * Math.cos(angle); \n let velocityY = BULSPEED * Math.sin(angle); \n //bullet.setColor(\"green\");\n //bullet.setRound(\"100%\");\n //bullet.preload(\"resources/ballAv.png\", \"auto\");\n //bullet.mirrorImage(dir); \n //bullet.setImage(\"resources/ballAv.png\");\n bullet.setPos(fromCenter.x - BLOCK/5, fromCenter.y - BLOCK/5); //check and change this, AGAIN\n\n if(bulletType == \"player\")\n {\n bullet.preload(resources[\"playerBullet\"]);\n player.setImage(\"resources/attackAv.png\"); \n shoot = false;\n shootAnim = 0; \n }\n else if(bulletType == \"enemy\")\n {\n bullet.preload(resources[\"enemyBullet\"]);\n }\n pBullets.push([bullet, {VX: velocityX*sign, VY: velocityY*sign}, angle, sign, true, bulletType]); \n physics.addBody(bullet, \"bullet\" + (pBullets.length-1), BLOCK/5, BLOCK/5); \n \n //shootAux = true; \n}", "function fire_bullet(){\r\n\tif(parseInt(num_bullets.innerHTML) > 0){\r\n\t\tbullet_coords.push(new vec4(0.004, -0.005, 0, 1));\r\n\t\tbullet_directions.push(new vec4(-0.04 + (Math.random() * 0.08), -0.04 * (Math.random() * 0.08), -1, 1));\r\n\t\tbullet_timeouts.push(0);\r\n\t\tnum_bullets.innerHTML = parseInt(num_bullets.innerHTML) - 1;\r\n\t}\r\n}", "setBulletStyle() {\n const style_fontColor = `color: ${this.fontColor};`;\n const style_fontSize = `font-size: ${this.fontSize.toString()}px;`;\n const style_top = `top: ${this.top.toString()}px;`;\n const style_left = `left: ${this.left.toString()}px;`;\n this.bullet.style.cssText += style_fontColor + style_fontSize + style_top + style_left + \"position: absolute;\" + `z-index: ${this.z_index.toString()}`;\n }", "function Bullet(options) {\n MovingObject.call(this, options);\n}", "addBullet(x, y, angle) {\n var bullet = this.bullets.get();\n if (bullet){\n bullet.fire(x, y, angle);\n }\n }", "bulletsDraw(bullets) {\n var translateX = -(this.perspective.x - global.screenWidth/2);\n var translateY = -(this.perspective.y - global.screenHeight/2);\n this.context2D.translate(translateX, translateY);\n\n for(var i = 0; i < bullets.length; i++){\n var bullet = bullets[i];\n\n //draw circle in the center to represent bullet\n this.context2D.beginPath();\n this.context2D.fillStyle = 'black';\n this.context2D.arc(bullet.x, bullet.y, 4, 0, 2 * Math.PI);\n this.context2D.fill();\n }\n\n this.context2D.translate(-translateX, -translateY);\n\n }", "shoot() {\n this.audio = game.audio.playAudio(\"assets/music/sounds/enemyLaser.mp3\");\n let bullet, bulletInitialCoords = [this.centerX, this.centerY];\n if (game.gameState === \"spaceInvaders\") {\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(\n this.x, this.y + this.height - game.bulletSize[1]), this.x, this.y + this.height - game.bulletSize[1]);\n bullet.move([0, 1]);\n } else {\n let direction;\n switch (this.type) {\n case 0:\n direction = this.normalizeVector([player.x - this.x, player.y - this.y]);\n bullet = game.enemiesBulletsPool.getNewObject(() => \n new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), \n bulletInitialCoords[0], \n bulletInitialCoords[1]);\n bullet.move(direction);\n break;\n case 1:\n if (Math.random() > 0.5) { //horizontal\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), bulletInitialCoords[0], bulletInitialCoords[1]);\n bullet.move([1, 0]);\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), bulletInitialCoords[0], bulletInitialCoords[1]);\n bullet.move([-1, 0]);\n } else { //vertical\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), bulletInitialCoords[0], bulletInitialCoords[1]);\n bullet.move([0, 1]);\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), bulletInitialCoords[0], bulletInitialCoords[1]);\n bullet.move([0, -1]);\n }\n break;\n case 2:\n direction = [0, 1];\n for (let i = 0; i < 4; i++) {\n bullet = game.enemiesBulletsPool.getNewObject(() => new EnemyBullet(bulletInitialCoords[0], bulletInitialCoords[1]), bulletInitialCoords[0], bulletInitialCoords[1]);\n bullet.move(direction);\n direction = [direction[1], -direction[0]];\n }\n break;\n }\n }\n }", "shoot() {\n let newBullet = new Bullet(this.x, this.y, 6, color(0, 0, 0), 15, bulletImage, bulletList.length);\n newBullet.direction();\n bulletList.push(newBullet);\n audioShoot.play();\n }", "setBulletVector(dx, dy, bulletSpeed) {\n\t\tif (dx != 0) { this.dx = dx * bulletSpeed; }\n\t\tif (dy != 0) { this.dy = dy * bulletSpeed; }\n\t}", "createBullets() {\n\n if (this.bullets.length < 2) {\n let blt = new Bullet()\n blt.pos.x = this.pos.x + (this.size.w / 2) // Centers the bullet starting point\n blt.pos.y = this.pos.y + (this.size.h / 2) // to the players body\n blt.color = '#00ff00'\n blt.damage = this.bulletDamage\n\n blt.vector.dx = this.bulletDirection.dx // Sets the vector of the bullet \n blt.vector.dy = this.bulletDirection.dy // to the mouse pos\n this.bullets.push(blt) // Push the bullet object to bullets array\n\n HelperFunctions.playAudio(this.gunVolume, \"https://raw.githubusercontent.com/JoshMatthew/PeewPeew/master/assets/sfx/enemy-gun.mp3\")\n }\n }", "function shootBullet() {\n\t// Disable shooting for a short period of time\n\tcanShoot = false;\n setTimeout(\"canShoot = true\", SHOOT_INTERVAL);\n\tbullet_number += 1;\n\t\n // Create the bullet by createing a use node\n var bullet = svgdoc.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n\n // Calculate and set the position of the bullet\n bullet.setAttribute(\"x\", player.position.x + PLAYER_SIZE.w / 2 - BULLET_SIZE.w / 2);\n bullet.setAttribute(\"y\", player.position.y + PLAYER_SIZE.h / 2 - BULLET_SIZE.h / 2);\n\tif(!PLAYER_FACE_RIGHT) {\n\t\tbullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#lbullet\");\n\t} else {\n\t\tbullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bullet\");\n\t}\n // Set the href of the use node to the bullet defined in the defs node\n \n\n // Append the bullet to the bullet group\n\tif(PLAYER_FACE_RIGHT == true) {\n\t\tsvgdoc.getElementById(\"rightBullets\").appendChild(bullet);\n\t} else {\n\t\tsvgdoc.getElementById(\"leftBullets\").appendChild(bullet);\n\t}\t\n}", "function updateBulletTimeouts(){\r\n\tvar new_bullet_coords = [];\r\n\tvar new_bullet_directions = [];\r\n\tvar new_bullet_timouts = [];\r\n\tfor(var i=0; i<bullet_coords.length; i++){\r\n\t\t++bullet_timeouts[i];\r\n\t\tif(bullet_timeouts[i] < btimeout){\r\n\t\t\tnew_bullet_coords.push(bullet_coords[i]);\r\n\t\t\tnew_bullet_directions.push(bullet_directions[i]);\r\n\t\t\tnew_bullet_timouts.push(bullet_timeouts[i]);\r\n\t\t}\r\n\t}\r\n\tbullet_coords = new_bullet_coords;\r\n\tbullet_directions = new_bullet_directions;\r\n\tbullet_timeouts = new_bullet_timouts;\r\n}", "function Bullet(X, Y, toX,toY) {\n this.x = X;\n this.y = Y;\n this.tox = toX;\n this.toy = toY;\n}", "function Bullet() {\n this.x = -1;\n this.y = -1;\n this.velX = 0;\n this.velY = 0;\n this.elem = 'fire';\n }", "function shootBullet() {\r\n //if all bullets used\r\n if(bulletremain==0) return;\r\n var shoot = svgdoc.getElementById(\"shoot\");\r\n shoot.play();\r\n bulletremain--;\r\n if(cheat) bulletremain++;\r\n svgdoc.getElementById(\"bulletLeft\").innerHTML = \"Bullet Left: \"+bulletremain;\r\n // Disable shooting for a short period of time\r\n canShoot = false;\r\n setTimeout(\"canShoot = true\", SHOOT_INTERVAL);\r\n // Create the bullet using the use node\r\n var bullet = svgdoc.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\r\n if(!playFaceLeft){\r\n svgdoc.getElementById(\"bullets\").appendChild(bullet);\r\n var bullet_x = player.position.x + (PLAYER_SIZE / 2) - (BULLET_SIZE.w / 2);\r\n var bullet_y = player.position.y + (PLAYER_SIZE / 2) - (BULLET_SIZE.h / 2);\r\n bullet.setAttribute(\"x\", player.position.x);\r\n bullet.setAttribute(\"y\", player.position.y);\r\n bullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bullet\");\r\n svgdoc.getElementById(\"bullet\").setAttribute(\"transform\", \"translate(\" +BULLET_SIZE.w + \", 0) scale(1,1)\");\r\n }else {\r\n svgdoc.getElementById(\"bulletsToLeft\").appendChild(bullet);\r\n var bullet_x = player.position.x + (PLAYER_SIZE / 2) - (BULLET_SIZE.w / 2);\r\n var bullet_y = player.position.y + (PLAYER_SIZE / 2) - (BULLET_SIZE.h / 2);\r\n bullet.setAttribute(\"x\", player.position.x);\r\n bullet.setAttribute(\"y\", player.position.y);\r\n bullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bulletleft\");\r\n svgdoc.getElementById(\"bulletleft\").setAttribute(\"transform\", \"translate(\" +BULLET_SIZE.w + \", 0) scale(-1,1)\");\r\n }\r\n\r\n}", "function bulletUpdate(timeDifference) {\r\n\t\tfor (let i = bullets.length - 1; i >= 0; i--) {\r\n\t\t\tbullets[i].update(timeDifference);\r\n\t\t\t\r\n\t\t\t//\r\n\t\t\t// Check bullet hit detections with walls and checks lifetime\r\n\t\t\tif (bullets[i].info.lifetime <= 0 || bullets[i].center.x >= 1.0 || bullets[i].center.x <= 0 || bullets[i].center.y >= 1.0 || bullets[i].center.y <= 0) {\r\n\t\t\t\tremoveBullet(i);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\t// Check bullet hit detection with enemies\r\n\t\t\tlet bulletBoundaries = getBoundariesFor(bullets[i]);\r\n\t\t\tif (bullets[i].spriteInfo.sheet === 'animated-energy-ball') {\r\n\t\t\t\tfor (let j = rooms[currentRoom.y][currentRoom.x].enemies.length - 1; j >= 0; j--) {\r\n\t\t\t\t\tlet enemyBoundaries = getBoundariesFor(rooms[currentRoom.y][currentRoom.x].enemies[j]);\r\n\t\t\t\t\tif (haveCollided(bulletBoundaries, enemyBoundaries)) {\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// Update and check enemy creature life\r\n\t\t\t\t\t\trooms[currentRoom.y][currentRoom.x].enemies[j].creatureInfo.health -= bullets[i].info.power;\r\n\t\t\t\t\t\tif (rooms[currentRoom.y][currentRoom.x].enemies[j].creatureInfo.health <= 0) {\r\n\t\t\t\t\t\t\tremoveEnemy(j);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tremoveBullet(i);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else { // Check enemy bullets with player character\r\n\t\t\t\tlet playerBoundaries = getBoundariesFor(playerCharacter);\r\n\t\t\t\tif (haveCollided(playerBoundaries, bulletBoundaries)) {\r\n\t\t\t\t\tif (playerCharacterInvincibilityFrames <= 0) {\r\n\t\t\t\t\t\thealthCount = Math.max(0, healthCount - bullets[i].info.power);\r\n\t\t\t\t\t\tplayerCharacterInvincibilityFrames = 1000;\r\n\t\t\t\t\t\tMain.assets['player-damage-sound'].play();\r\n\t\t\t\t\t\t//\r\n\t\t\t\t\t\t// Check for player death\r\n\t\t\t\t\t\tif (healthCount <= 0) {\r\n\t\t\t\t\t\t\t// @TODO: Game over, reset game\r\n\t\t\t\t\t\t\tthat.restartGame();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tremoveBullet(i);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function moveMonsterBullets() {\n var monsterbullets = document.getElementById(\"monsterbullets\");\n\n for (var i = 0; i < monsterbullets.childNodes.length; ++i) {\n var node = monsterbullets.childNodes.item(i);\n var x = parseInt(node.getAttribute(\"x\"));\n var velocity = (node.getAttribute(\"direction\") == facingType.RIGHT) ? BULLET_SPEED : -BULLET_SPEED;\n\n node.setAttribute(\"x\", x + velocity);\n\n if ((x > SCREEN_SIZE.w) || (x < 0)) {\n monsterbullets.removeChild(node);\n --i;\n }\n }\n}", "function fireDemonBullet(){\n for (let i = 0; i < demonArray.length; i++){\n if (demonArray[i].alive){\n demonBullets.push({\n x: demonArray[i].x + demonArray[i].width/2 - demonBullet.width/2,\n y: demonArray[i].y + demonArray[i].height/2 - demonBullet.height/2\n })\n }\n } \n}", "function checkBullets() {\n //\"clearar\" canvasen så inte det gamla finns kvar\n Game.bulletCanvas.clearRect(0, 0, 800, 500);\n //loopar igenom alla kulor\n for (var p = 0; p < Game.players.length; p++) {\n for (var i = 0; i < Game.players[p].bullets.length; i++) {\n //om kulan finns på spelytan renderas den ut\n if (Game.players[p].bullets[i].drawY <= 500 && Game.players[p].bullets[i].drawY >= 0) {\n Game.players[p].bullets[i].render();\n }\n //om kulan är över spelytan anropas funktionen resetBullet\n else if (Game.players[p].bullets[i].drawY <= 0) {\n Game.players[p].bullets[i].resetBullet(Game.players[p].bullets[i]);\n }\n }\n }\n}", "function createBullets() {\n addEventListener(\"click\", (event) => {\n const angle = Math.atan2(\n event.clientY - ROCKET_SHIP.y,\n event.clientX - ROCKET_SHIP.x,\n );\n const velocity = {\n x: Math.cos(angle) * 5,\n y: Math.sin(angle) * 5,\n };\n bullets.push(\n new Bullet(\n ROCKET_SHIP.x + ROCKET_SHIP.width / 2,\n ROCKET_SHIP.y + ROCKET_SHIP.height / 2,\n 6,\n velocity,\n ),\n );\n });\n }", "function updateScreen() {\r\n if (isGameOver) return ;\r\n\r\n updateGhostPosition()\r\n updateBulletPosition()\r\n updateVerticalPlatformPosition()\r\n\r\n // Transform the player\r\n if (flipPlayer==motionType.LEFT){\r\n player.node.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\" + \"translate(\" + PLAYER_SIZE.w + \", 0) scale(-1, 1)\");\r\n }\r\n else\r\n player.node.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\");\r\n \r\n // ghost\r\n for (var i=0; i<ghost_count; i++){\r\n if (ghost[i]){\r\n if (ghost[i].motion == motionType.LEFT){\r\n ghost[i].svgObject.setAttribute(\"transform\", \"translate(\" + ghost[i].position.x + \",\" + ghost[i].position.y + \")\" + \"translate(\" + GHOST_SIZE.w + \", 0) scale(-1, 1)\"); \r\n }\r\n else\r\n ghost[i].svgObject.setAttribute(\"transform\", \"translate(\" + ghost[i].position.x + \",\" + ghost[i].position.y + \")\"); \r\n }\r\n }\r\n\r\n //bullet\r\n for (var i=0; i<8-bullet_count; i++){\r\n if (bullet[i]){\r\n if (bullet[i].motion==motionType.RIGHT)\r\n bullet[i].svgObject.setAttribute(\"transform\", \"translate(\" + bullet[i].position.x + \",\" + bullet[i].position.y + \")\" + \"translate(\" + 10 + \", 0) scale(-1, 1)\"); \r\n else\r\n bullet[i].svgObject.setAttribute(\"transform\", \"translate(\" + bullet[i].position.x + \",\" + bullet[i].position.y + \")\"); \r\n } \r\n }\r\n // Calculate the scaling and translation factors\t\r\n \r\n // Add your code here\r\n \r\n}", "function bulletNew(data) {\n bullets[data.id] = components.Bullet(data);\n }", "function Start() {\r\n // Bullets = MaxBullets;\r\n Cursor.visible = false;\r\n Screen.lockCursor = true;\r\n Bullets = MaxBullets;\r\n timeBetweenPunch = 0;\r\n}", "function drawBulletEnemies(t_bullet)\n{\n t_bullet.x_pos -= t_bullet.speed; // Decreases x_pos to make Bullet fly across the word.\n \n if (t_bullet.x_pos <= -1300) //Resets Bullet Positioning if has reached the defined boundries.\n {\n t_bullet.x_pos = 3500;\n }\n \n \n x = t_bullet.x_pos;\n y = t_bullet.y_pos;\n size = t_bullet.size;\n push();\n \n if (t_bullet.deadly)\n { \n fill(170, 13, 0);\n }\n else\n { \n fill(0); \n }\n \n \n first_part = {\n x: x,\n y: y,\n width: 25 * size,\n height: 25 * size\n };\n rect(first_part.x, first_part.y, first_part.width, first_part.height, 360, 0, 0, 360);\n\n \n fill(10); \n second_part = {\n x: x + (25 * size),\n y: y + (2.5 * size),\n width: 4 * size,\n height: 20 * size\n };\n rect(second_part.x, second_part.y, second_part.width, second_part.height);\n \n \n fill(0);\n third_part = {\n x: (x + (25 * size) + 4 * size),\n y: y,\n width: 2 * size,\n height: 25 * size\n };\n rect(third_part.x, third_part.y, third_part.width, third_part.height);\n\n \n fill(255);\n eyes_blank = {\n x_pos: x + (8.5 * size),\n y_pos: y + (6.5 * size),\n width: 8 * size,\n height: 9 * size\n }; \n arc(eyes_blank.x_pos, eyes_blank.y_pos, eyes_blank.width,\n eyes_blank.height, -HALF_PI + QUARTER_PI, PI + -QUARTER_PI, CHORD);\n\n eyes_pupil = {\n x_pos: x + (8.5 * size),\n y_pos: y + (6.5 * size),\n width: 3 * size,\n height: 4.5 * size\n };\n \n //Eyes\n fill(0);\n arc(eyes_pupil.x_pos, eyes_pupil.y_pos, eyes_pupil.width,\n eyes_pupil.height, -HALF_PI + QUARTER_PI, PI + -QUARTER_PI, CHORD);\n\n \n //Mouth\n fill(255, 0, 0);\n mouth = {\n x_pos: x * 3,\n y_pos: y * 2.6\n };\n\n beginShape();\n vertex(x + (2.5 * size), y + (20 * size));\n bezierVertex( x + (10 * size), y + (10 * size),\n x + (13 * size), y + (22 * size),\n x + (6 * size), y + (23 * size));\n endShape();\n pop();\n\n //Sets the center x and y properties of bullet object based on full width and height of shapes\n t_bullet.center_x = x + ( (first_part.width + second_part.width + third_part.width) / 2); \n t_bullet.center_y = y + ( first_part.height / 2); \n \n checkBulletEnemies(t_bullet); //Check bullet object collision.\n}", "update() {\n if (!this.active) {\n // this was previously a check to this.exists\n return;\n }\n\n const bulletManager = this.getData('bulletManager');\n\n if (this.getData('killType') > _consts__WEBPACK_IMPORTED_MODULE_0__[\"KillType\"].KILL_LIFESPAN) {\n if (this.getData('killType') === _consts__WEBPACK_IMPORTED_MODULE_0__[\"KillType\"].KILL_DISTANCE) {\n if (new Phaser.Math.Vector2(this.getData('fromX'), this.getData('fromY')).distance(this) > this.getData('killDistance')) {\n this.kill();\n }\n } else if (!Phaser.Geom.Intersects.RectangleToRectangle(bulletManager.bulletBounds, this.body.getBounds(this.getData('bodyBounds')))) {\n this.kill();\n }\n }\n\n if (this.getData('rotateToVelocity')) {\n this.rotation = Math.atan2(this.body.velocity.y, this.body.velocity.x);\n }\n\n if (bulletManager.bulletWorldWrap) {\n this.scene.physics.world.wrap(this, bulletManager.bulletWorldWrapPadding);\n }\n }", "init(x,y)\n\t{\n\t\tthis.bulletX = x; //bullet position\n\t\tthis.bulletY = y;\t//bullet position\n\t\tthis.isUsed = 1; //used or not \n\t}", "init(x,y)\n\t{\n\t\tthis.bulletX = x; //bullet position\n\t\tthis.bulletY = y;\t//bullet position\n\t\tthis.isUsed = 1; //used or not \n\t}", "function AddNewBullet(){\n\n bullet_array[index_bullet] = $.extend( {}, bullet ); //Añado ias al array mediante un Swallow Copy del \"Objeto\" Bullet\n snd.play(); //Reproduzco el sonido\n\n //Establezco los vectores directores x e y, así como la magnitud de la nueva bala\n bullet_array[index_bullet].vector_director_x = input.mouse.x + (camera.position.x) - player.position.x;\n bullet_array[index_bullet].vector_director_y = input.mouse.y + (camera.position.y) - player.position.y;\n bullet_array[index_bullet].magnitud = Math.sqrt(bullet_array[index_bullet].vector_director_x * bullet_array[index_bullet].vector_director_x + bullet_array[index_bullet].vector_director_y * bullet_array[index_bullet].vector_director_y);\n\n //Calculo y normalizo el vector impulso\n bullet_array[index_bullet].impulse = {\n x: (bullet_array[index_bullet].vector_director_x / bullet_array[index_bullet].magnitud) * 0.2,\n y: -(bullet_array[index_bullet].vector_director_y / bullet_array[index_bullet].magnitud) * 0.2,\n },\n\n //Creo el objeto Box2D\n bullet_array[index_bullet].body = CreateBall(world, player.position.x/100 + bullet_array[index_bullet].impulse.x*3.5 , (7.20 - player.position.y/100 + bullet_array[index_bullet].impulse.y*3.5), .05, 1);\n \n //Aplico el impulso al objeto\n bullet_array[index_bullet].Applyimpulse(bullet_array[index_bullet].impulse);\n\n //Inicializo la bala\n bullet_array[index_bullet].Start();\n\n //Aumento el indice\n index_bullet++;\n}", "function createBullet(){\n if (game.time.now > bulletTime)\n {\n var bullet = bullets.getFirstExists(false);\n\n if (bullet)\n {\n // And fire it\n bullet.reset(player.x-6, player.y-10);\n bullet.body.velocity.y = -400;\n bulletTime = game.time.now + 200; \n }\n}}", "function Update_Enemy_Bullet(bullet, id) {\r\n if (bullet) {\r\n bullet.identifier = id; \r\n if (bullet.posX >= 0) {\r\n bullet.posX -= bullet.speed;\r\n //Obtener carril de la bala \r\n var carril = bullet.zindex; \r\n //Segun el carril, pintarlo en una capa u otra\r\n switch (carril) {\r\n case 0: capa0ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 1: capa1ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 2: capa2ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n }\r\n } else {\r\n enemy_1.DeleteShot(parseInt(bullet.identifier));\r\n } \r\n }\r\n }", "New(x,y,dir) {\n\t\tlet vx = dir.x * BULLET_SPEED + player._sprite.body.velocity.x * 0.5;\n\t\tlet vy = dir.y * BULLET_SPEED + player._sprite.body.velocity.y * 0.5;\n\n\t\tlet bullet = this.game.matter.add.sprite( x + dir.x * BULLET_SPAWN_DISTANCE, y + dir.y * BULLET_SPAWN_DISTANCE + BULLET_SPAWN_Y_OFFSET, 'bullet' );\n\t\t// let bullet = this.game.bullets.create( x + dir.x * BULLET_SPAWN_DISTANCE, y + dir.y * BULLET_SPAWN_DISTANCE + BULLET_SPAWN_Y_OFFSET, 'bullet')\n\t\t// \t.setVelocity(vx, vy);\n\t\t\n\t\t// bullet.rotation = utils.GetAngle(dir.x,dir.y);\n\t\t// bullet.body.setCircle(30);\n\t\tbullet.setCircle( 20, this.physicsOptions);\n\t\tbullet.setVelocity(vx,vy);\n\t\tbullet.setFixedRotation();\n\t\tbullet.setRotation( utils.GetAngle(dir.x,dir.y) );\n\t\tbullet.setCollisionCategory(this.physicsCategory);\n\t\t// bullet.setCollidesWith([this.physicsCategory,this.game.bubble.levelGenerator.physicsCategory, bullets.physicsCategory]);\n\t\t// bullet.body.setOffset(-ZOBLIN_RADIUS*0.5 + bullet.originX * bullet.width,-ZOBLIN_RADIUS*0.5+ bullet.originY * bullet.height);\n\t\tbullet.depth = bullet.y;\n\t\tbullet.isDead = false;\n\t\tbullet.isBullet = true;\n\n\t\tthis._.push(bullet);\n\t\t// console.log(dir);\n\t\t// bullet.setVelocityX(dir.x);\n\t\t// bullet.setVelocityY(dir.y);\n\t\t// bullet.update = function() {\n\t\t// \tconsole.log(\"Bullet\");\n\t\t// };\n\t\t// tree.s = 1 + this.noise.noise(x,y)*0.5;\n\n\n\t // tree.setScale(3 * tree.s);\n\t // tree.setOrigin(0.5,0.6);\n\t // tree.body.setCircle(50 * tree.s);\n\t // tree.body.setOffset(-25 * tree.s + tree.originX * tree.width,-25 * tree.s + tree.originY * tree.height);\n\t // tree.depth = tree.y;\n\t}", "function updateRandomBullet(){\n\t\tnextBullet.play(); \n\t\tvar length = bulletQueueValues.length;\n\t\tvar x = Math.floor((Math.random() * 11) - 5);\n\t\tbulletQueueValues.shift();\n\t\tbulletQueueValues.push(x);\n\t\tfor(i = 0; i < length; i++){\n\t\t\tdocument.getElementById(\"insideQueue\" + i).innerHTML = bulletQueueValues[i];\n\t\t}\n\t\tcurrentBullet = bulletQueueValues[0];\n\t}", "function roll() {\n\titems.forEach((item, i) => {\n\t\titem.style = `transform: translateX(${(i + index) * 101}%);`;\n\t});\n\tconst currentBullet = document.querySelector('.bullets > *:nth-child('+ ((index * -1) + 1) + ')');\n\tconst prevBullet = document.querySelector('.bullet.active');\n\tprevBullet.classList.remove('active');\n\tcurrentBullet.classList.add('active');\n}", "update_enemy_pos( ){\n for (let i=0; i<this.enemy_pos.length; i++){\n if(this.enemy_pos[i][2]>3)\n {\n this.enemy_pos[i][2]-=this.fallRate;\n }\n //check collision here\n else if(this.enemy_pos[i][0] < 2.0)\n {\n \n this.player_got_hit();\n \n //dont move\n this.enemy_pos.splice(i,1);\n i--;\n } \n else\n {\n // random chance to shoot bullet\n if(this.enemy_pos[i][0] > 5.0 && Math.random()>0.9995){\n var new_pos = [this.enemy_pos[i][0], this.enemy_pos[i][1],this.enemy_pos[i][3]];\n this.bullet_pos.push(new_pos);\n const newAudio = this.sound.spit.cloneNode();\n newAudio.play();\n }\n this.enemy_pos[i][0] -= this.enemySpeed;\n }\n \n }\n }", "function drawAlienShoot() {\n graphics.drawImage(bullet, bulletX, bulletY + 35, 50, 50);\n }", "function spawnBullet(p){\n add([rect(6,18), \n pos(p), \n origin('center'), \n color(0.5, 0.5, 1),\n 'bullet'\n ])\n }", "function drawBullet(){\n if(playerBullet.firing){\n playerBullet.x+=playerBullet.direction*5;\n }\n //console.log(playerBullet.firing);\n for(var i = 0; i<platforms.length; i++){\n if(playerBullet.x+playerBullet.width>platforms[i].x && playerBullet.x<platforms[i].x+platforms[i].width &&\n playerBullet.y+playerBullet.height>platforms[i].y && playerBullet.y<platforms[i].y+platforms[i].height){\n console.log(platforms[i]);\n playerBullet.firing = false;\n playerBullet.x = levelDimensions.right+500;\n playerBullet.y = levelDimensions.right+500;\n }\n }\n ctx.beginPath();\n ctx.rect(playerBullet.x-cameraX,playerBullet.y-cameraY,playerBullet.width,playerBullet.height);\n ctx.fillStyle = \"#FF00FF\";\n ctx.fill();\n ctx.closePath(); \n}", "step(){\n\t\t// Move the bullets\n\t\tthis.position.x=this.position.x+this.velocity.x; \n\t\tthis.position.y=this.position.y+this.velocity.y;\n\n\t\t// Check if the bullets hit anything\n\t\tfor(var i=0;i<this.stage.squares.length;i++){\n\t\t\tif (this.stage.squares[i] != this){ // the bullets cannot hit thenselves\n\t\t\t\t// Check if the bullets coincide with another square (obstacles, player, enemies)\n\t\t\t\t// The following expression is left || right || above || below. If all of them are false, the bullet hits something.\n\t\t\t\tif (!( this.position.x + this.length <= this.stage.squares[i].x || this.position.x >= this.stage.squares[i].x + this.stage.squares[i].length || \n\t\t\t\t\t\tthis.position.y >= this.stage.squares[i].y + this.stage.squares[i].length || this.position.y + this.length <= this.stage.squares[i].y )){\n\t\t\t\t\tif (this.source == \"player\" && this.stage.squares[i].type == \"player\" && this.source_id == this.stage.squares[i].id){ // bullet from a player hits the same player\n\t\t\t\t\t} else if (this.source == \"enemy\" && this.stage.squares[i].type == \"enemy\"){ // bullet from an enemy hits an enemy\n\t\t\t\t\t} else if (this.stage.squares[i].type == \"bullet\" && this.source == this.stage.squares[i].source){ // two bullets from same team\n\t\t\t\t\t} else{\n\t\t\t\t\t\tthis.stage.squares[i].health -= this.damage; // decrease the health of the other square since it's not friendly fire\n\t\t\t\t\t\tif (this.stage.squares[i].health <= 0){ // the dog is killed so record the killer\n\t\t\t\t\t\t\tthis.stage.squares[i].killer = this.source_id;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.health = 0; // the bullet would disappear since it has already hit something\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// decrease the bullets health (to make them disappear after a certain amount of time)\n\t\tthis.health -= 0.5;\n\t\tsuper.step(); // make the bullets bounce off wall\n\t}", "get bulletAngleOffset() {\n return this._bulletAngleOffset;\n }", "function fireBullet() {\n if (game.time.now > bulletTime) {\n bullet = bullets.getFirstExists(false);\n if (bullet) {\n bullet.reset(ship.x, ship.y);\n bullet.body.velocity.y = -400;\n bulletTime = game.time.now + 200;\n }\n }\n}", "function draw() {\r\n background(0);\r\n fill(255);\r\n textAlign(CENTER);\r\n //writes text on canvas\r\n text('Controls: Arrow Keys + space', width/2, 20);\r\n text('Lives = ' + lives , 50, 20);\r\n text('Score = ' + score, 200, 20);\r\n//when the ship live = 0 it ends the game\r\n if(lives === 0){\r\n\t textSize(70);\r\n\ttext('GAME OVER' , width/2, height/2);\r\n\t\r\n\tbullet.remove();\r\n }\r\n//sets postions for all sprites\r\n for(var i=0; i<allSprites.length; i++) { //margins called here\r\n var s = allSprites[i];\r\n if(s.position.x<-MARGIN) s.position.x = width+MARGIN;\r\n if(s.position.x>width+MARGIN) s.position.x = -MARGIN;\r\n if(s.position.y<-MARGIN) s.position.y = height+MARGIN;\r\n if(s.position.y>height+MARGIN) s.position.y = -MARGIN;\r\n }\r\n\r\n// when meteor gets hit by the bullet it calls the meteorHit function\r\n meteor.overlap(bullets, meteorHit);\r\n \r\n// when meteor hits ship it calls shipHit function\r\n ship.overlap(meteor, shipHit); \r\n \r\n// when ship hits medkit it calls medkitHit function\r\n ship.overlap(medkit, medkitHit);\r\n \r\n// makes ship bounce when meteor hits it \r\n ship.bounce(meteor);\r\n\r\n if(keyDown(LEFT_ARROW))\r\n ship.rotation -= 4;\r\n if(keyDown(RIGHT_ARROW))\r\n ship.rotation += 4;\r\n if(keyDown(UP_ARROW))\r\n {\r\n ship.addSpeed(100, ship.rotation-90);\r\n }\r\n\r\n if(keyWentDown(' '))\r\n {\r\n var bullet = createSprite(ship.position.x, ship.position.y);\r\n bullet.addImage(bulletImage);\r\n\tbullet.rotation = ship.rotation;\r\n bullet.setSpeed(10, ship.rotation-90);\r\n bullet.life = 30;\r\n bullets.add(bullet);\r\n }\r\n\r\n drawSprites();\r\n\r\n}", "shoot(\n shooter, angle, x, y, container, bulletSpeed, bulletArray, bulletSprite\n ) {\n\n //Make a new sprite using the user-supplied `bulletSprite` function\n let bullet = bulletSprite();\n\n //Set the bullet's anchor point to its center\n bullet.anchor.set(0.5, 0.5);\n\n //Temporarily add the bullet to the shooter\n //so that we can position it relative to the\n //shooter's position\n shooter.addChild(bullet);\n bullet.x = x;\n bullet.y = y;\n\n //Find the bullet's global coordinates so that we can use\n //them to position the bullet on the new parent container\n let tempGx = bullet.getGlobalPosition().x,\n tempGy = bullet.getGlobalPosition().y;\n\n //Add the bullet to the new parent container using\n //the new global coordinates\n container.addChild(bullet);\n bullet.x = tempGx;\n bullet.y = tempGy;\n\n //Set the bullet's velocity\n bullet.vx = Math.cos(angle) * bulletSpeed;\n bullet.vy = Math.sin(angle) * bulletSpeed;\n\n //Push the bullet into the `bulletArray`\n bulletArray.push(bullet);\n }", "shoot () {\n\t\tnew Bullet (this.containerElement, this.mapInstance, this.position, this.direction);\n\t}", "function shootBullet () {\nrigidbody.velocity.x = 0;\nshooting = true;\nvar shotPos:float = 0.0;\nvar bulletAngle:float = 0.0;\nvar bulletVelocity:float = 0.0;\n//here we check the direction the shooter is facing, then apply numbers to the bullet accordingly so it fires in the right direction.\nif(direction == true){\nrenderer.material.mainTexture = shootRight;\nshotPos = 0.5;\nbulletAngle = 0.0;\nbulletVelocity = 16;\n}\nif(direction == false){\nrenderer.material.mainTexture = shootLeft;\nshotPos = -0.5;\nbulletAngle = 180.0;\nbulletVelocity = -35;\n}\n//we wait for a bit before the shot fires so that the player can see he's about to do it\nyield WaitForSeconds(0.5);\n//play the shot sound\naudio.PlayOneShot(shootSound);\n//spawn the bullet\nvar bullet = Instantiate(enemyBullet, transform.position + Vector3(shotPos,0,0),Quaternion.Euler(0,180,bulletAngle));\nvar bullet2 = Instantiate(enemyBullet, transform.position + Vector3(shotPos,3,0),Quaternion.Euler(0,180,bulletAngle));\nvar bullet3 = Instantiate(enemyBullet, transform.position + Vector3(shotPos,6,0),Quaternion.Euler(0,180, bulletAngle));\nvar bullet4 = Instantiate(enemyBullet, transform.position + Vector3(shotPos,9,0),Quaternion.Euler(0,180,bulletAngle));\nvar bullet5 = Instantiate(enemyBullet, transform.position + Vector3(shotPos,12,0),Quaternion.Euler(0,180,bulletAngle));\n//set velocity to the bullet\nbullet.rigidbody.velocity.x = bulletVelocity;\nbullet2.rigidbody.velocity.x = bulletVelocity;\nbullet3.rigidbody.velocity.x = bulletVelocity;\nbullet4.rigidbody.velocity.x = bulletVelocity;\nbullet5.rigidbody.velocity.x = bulletVelocity;\n//then pause again before the enemy is ready to fire again.\n//yield WaitForSeconds(0.5);\nshooting = false;\n}//end of shootBullet", "function addBullet(top,left,_d,_s, BT) {\n var is_en = tank.attr('isEnemy')=='true'?false:true;\n var by_whom = tank.attr('title');\n \t\tvar $bullet = $('<span title=\"'+ tank.attr('id') +'\" class=\"'+ tank.attr('isEnemy') +'\" style=\"position:absolute;width:18px;height:18px;top:' + top + 'px;left:' + left + 'px;z-index: 3;\"></span>');\n $bullet.css('background','url(images/bullet/bullet.png) no-repeat');\n $('div#container').append($bullet);\n isHit($bullet, top, left, _d, _s, is_en, by_whom, BT);\n }", "get bulletFrame() {\n return this._bulletFrame;\n }", "function shootBullet() {\r\n // Disable shooting for a short period of time\r\n if (BULLET_COUNT > 0){\r\n \tcanShoot = false;\r\n \tvar audio = new Audio('player_shoot.mp3');\r\n\t\taudio.play();\r\n \tsetTimeout(\"canShoot = true\", SHOOT_INTERVAL);\r\n \tvar bullet = new Bullet(player.facing);\r\n\t\tbulletarray[bulletarray.length] = bullet;\r\n \t// Create the bullet using the use node\r\n \tsvgdoc.getElementById(\"bullets\").appendChild(bullet.node);\r\n \tBULLET_COUNT --;\r\n\t}\r\n}", "function Bullet (e){\n e.active = true;\n e.xVelocity = e.speed;\n e.yVelocity = 0;\n e.width = 3;\n e.height = 3;\n e.color = \"red\";\n //set boundaries for bullets\n e.inBounds = function(){\n return e.x >= 0 && e.x <= 6656\n && e.y >= 0 && e.y <= 468;\n };\n e.draw = function (){\n ctx.fillStyle = this.color;\n ctx.fillRect(this.x, this.y, this.width, this.height);\n };\n e.update = function(){\n e.x += e.xVelocity;\n e.y += e.yVelocity;\n \n e.active = e.active && e.inBounds();\n }\n return e;\n }", "function updateEntities(dt) {\n // Update the player sprite animation\n player.sprite.update(dt);\n // Update all the bullets\n for(var i=0; i<bullets.length; i++) {\n var bullet = bullets[i];\n\n switch(bullet.dir) {\n case 'up': bullet.pos[1] -= bulletSpeed * dt; break;\n case 'down': bullet.pos[1] += bulletSpeed * dt; break;\n default:\n bullet.pos[0] += bulletSpeed * dt;\n }\n\n // Remove the bullet if it goes offscreen\n if(bullet.pos[1] < 0 || bullet.pos[1] > canvas.height ||\n bullet.pos[0] > canvas.width) {\n bullets.splice(i, 1); //What is Splice again?\n i--;\n }\n }\n\n // Update all the enemies\n for(var i=0; i<enemies.length; i++) {\n enemies[i].pos[0] -= enemySpeed * dt;\n if ((Math.floor(dt)/2) % 0) {\n enemies[i].pos[1] -= enemySpeed * dt;\n }// NOT A SINGLE BUBBLE GOES UP OR DOWN?\n enemies[i].sprite.update(dt);\n\n // Remove if offscreen\n if(enemies[i].pos[0] + enemies[i].sprite.size[0] < 0) {\n enemies.splice(i, 1);\n i--;\n }\n }\n\n // Update all the explosions\n for(var i=0; i<explosions.length; i++) {\n explosions[i].sprite.update(dt);\n\n // Remove if animation is done\n if(explosions[i].sprite.done) {\n explosions.splice(i, 1);\n i--;\n }\n }\n}", "function Bullet() {\n\tSprite.call(this, BULLET_IMG_SRC, BULLET_WIDTH, BULLET_HEIGHT)\n}", "move()\n {\n let slope = this.yDist / this.xDist;\n //y is negative, x is positive\n if (this.yDist < 0 && this.xDist > 0)\n {\n slope = this.xDist / this.yDist;\n console.log(\"-Y, X\");\n //FINALLY WORKING\n this.bulletXSpeed -= slope;\n this.bulletYSpeed -= 1;\n }\n //y is positive, x is positive\n if (this.yDist > 0 && this.xDist > 0)\n {\n console.log(\"Y, X\");\n //GOOD, WORKING\n this.bulletXSpeed += 1;\n this.bulletYSpeed += slope;\n }\n //y is negative, x is negative\n if (this.yDist < 0 && this.xDist < 0)\n {\n console.log(\"-Y, -X\");\n\n //GOOD, WORKING\n this.bulletXSpeed -= 1;\n this.bulletYSpeed -= slope;\n }\n //y is positive, x is negative\n if (this.yDist > 0 && this.xDist < 0)\n {\n slope = this.xDist / this.yDist;\n //GOOD, WORKING\n console.log(\"Y, -X\");\n this.bulletXSpeed += slope;\n this.bulletYSpeed += 1;\n }\n\n //then just move regularly\n this.bulletX += this.bulletXSpeed;\n this.bulletY += this.bulletYSpeed;\n }", "function draw() {\n // Update\n cooldown++;\n if (keys[LEFT_ARROW]) {\n shipX = shipX - shipSpeed;\n }\n if (keys[RIGHT_ARROW]) {\n shipX = shipX + shipSpeed;\n }\n if (keys[UP_ARROW]) {\n shipY = shipY - shipSpeed;\n }\n if (keys[DOWN_ARROW]) {\n shipY = shipY + shipSpeed;\n }\n if (keys[SPACE] && cooldown >= bulletCoolDown) {\n shipBulletsX.push(shipX);\n shipBulletsY.push(shipY);\n cooldown = 0;\n }\n\n for (let i = 0 ; i < shipBulletsY.length; i++) {\n shipBulletsY[i] -= bulletSpeed;\n }\n\n // Render\n background(0, 0, 0)\n fill(0, 255, 0);\n for (let i = 0; i < shipBulletsX.length; i++) {\n ellipse(shipBulletsX[i], shipBulletsY[i], 5, 5);\n }\n imageMode(CENTER);\n image(shipSprite, shipX, shipY, 50, 50);\n}", "function Player() {\n this.x = 50;\n this.y = 50;\n this.move = 0;\n this.jump = 0;\n this.hasJumped = false;\n this.bullets = new Array(numBullets);\n this.fireBullet = function() {\n for (var i = 0; i < numBullets; i++) {\n var bullet = player.bullets[i];\n if (bullet.x < 0 || bullet.y < 0 || bullet.x > particles.length || bullet.y > particles[0].length) {\n var x = curX/particleSize;\n var y = curY/particleSize;\n var magnitude = Math.sqrt(Math.pow(x - player.x, 2) + Math.pow(y - player.y, 2));\n if (magnitude>maxBulletSpeed)\n magnitude /= maxBulletSpeed;\n else\n magnitude = 1;\n bullet.velX = (x - player.x)/magnitude;\n bullet.velY = (y - player.y)/magnitude;\n bullet.x = player.x;\n bullet.y = player.y;\n bullet.elem = elemType;\n return;\n }\n }\n };\n }", "function bulletCount(){\n let xPos = width - width/25;\n let yPos = height - height/25;\n for(let i = 0; i < reload; i++){\n fill('rgba(255, 0, 0, 0.5)');\n noStroke();\n ellipse(xPos, yPos, width/100, width/100);\n xPos -= width/50;\n }\n}", "get bulletBounds() {\n return this._bulletBounds;\n }", "function bullets_borders(){\n for (var x = 0; x < bullets.length; x++){\n console.log(\"Recorcholis\");\n if(bullets[x] !== undefined){\n console.log(\"y mas Recorcholis\");\n if ((bullets[x].x) >1000){\n console.log(bullets[x].x);\n bullets.splice(x,1);\n }\n if ((bullets[x].x) < 0){\n bullets.splice(x,1);\n }\n if((bullets[x].y)<-50){\n bullets.splice(x,1);\n }\n if((bullets[x].y) >500){\n bullets.splice(x,1);\n }\n }\n }\n}", "function create_enemy_bullet(bullet_left, bullet_top, enemy_bullet) { //coordinates\n\tvar enemy_bullets = document.createElement(\"img\");\n\tenemy_bullets.className = \"enemy_bullets\";\n\tenemy_bullets.style.width = enemy_bullet[0].width + \"px\";\n\tenemy_bullets.style.height = enemy_bullet[0].height + \"px\";\n\tenemy_bullets.ATK = enemy_bullet[0].ATK;\n\tenemy_bullets.style.position = \"absolute\";\n\tenemy_bullets.style.top = bullet_top + \"px\";\n\tenemy_bullets.style.left = bullet_left + \"px\";\n\tenemy_bullets.index = 0;\n\tenemy_bullets.src = enemy_bullet[1][0];\n\tclearInterval(enemy_bullets.times);\n\tenemy_bullets.times = setInterval(function(){\n\t\tif (!pause_clicked) {\n\t\t\tenemy_bullets.index++;\n\t\t\tif (enemy_bullets.index > 3) {\n\t\t\t\tenemy_bullets.index = 0;\n\t\t\t}\n\t\t\tenemy_bullets.src = enemy_bullet[1][enemy_bullets.index];\n\t\t\tif (parseInt(enemy_bullets.style.top) >= 950 || \n\t\t\t\tparseInt(enemy_bullets.style.left) <= -parseInt(enemy_bullets.style.width) || \n\t\t\t\tparseInt(enemy_bullets.style.left) >= 750) {\n\t\t\t\tclearInterval(enemy_bullets.times);\n\t\t\t}\n\t\t}\n\t},200);\n\tbattle_ground.appendChild(enemy_bullets);\n\treturn enemy_bullets;\n}", "RemoveBullet(){\n\n for(this.i = 0; this.i < this.bulRemove.length; this.i++)\n {\n this.bullets.splice(this.bulRemove[this.i], 1);\n }\n this.bulRemove.splice(0, this.bulRemove.length);\n }", "explode() {\n\t\tthis.bulletSpecial = 0;\n\t\tsetTimeout(() => {\n\t\t\tthis.size = 150;\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.delete;\n\t\t\t}, 0.5 * 1000)\n\t\t}, 0.8 * 1000);\n\t}", "function draw(){\n background(0);\n moveBullet();\n drawGame();\n ellipse(x, y, 50, 50);\n if (keyIsDown(LEFT_ARROW)) {\n if(x>25){\n x -=5;\n }\n \n }\n \n if (keyIsDown(RIGHT_ARROW)) {\n \n if(x+30 <600){\n x +=5;\n }\n\n }\n if (keyIsDown(UP_ARROW)){\n bullets.push([x, y]);\n }\n for(let i=0; i<14;i++){\n e[i].drawEnemy();\n e[i].moveEnemy(); \n }\n}", "function fireBullet() {\r\n // We need to slow down the fire rate.\r\n let cTime = Date.now(); // Get the current date.\r\n if ((cTime - player.pTime) / 1000 > fire_per_second) {\r\n // IF current and previous time's difference is less then fire_per_second\r\n player.pTime = cTime;\r\n // Push a Bullet.\r\n let x = player.x + player.width / 2,\r\n y = player.y - 20,\r\n color = player.color,\r\n velocity = 20;\r\n bullets.push(new Bullet(x, y, color, velocity));\r\n }\r\n}", "createBullet () {\n let startingPoint = new Phaser.Point(this.canon.x, this.canon.y - this.canon.height)\n startingPoint.rotate(this.canon.x, this.canon.y, this.canon.angle, true)\n let bullet = new Bullet(this.game,\n startingPoint.x,\n startingPoint.y,\n this.canon.angle\n )\n this.bulletGroup.add(bullet)\n }", "function loadBullet() {\n\n for (let i = 0; i < weapons.length; i++) {\n\n // compare the input string and the plant name\n const isMatched = weapons[i].compare(ingame_input_field.value.toLowerCase().replace(/^\\s+|\\s+$/g, ''));\n\n // if they match\n if (isMatched) {\n\n // create new bullet instance at the same position as the weapon's\n let bullet = new Bullets(weapons[i].x, weapons[i].y, 10);\n bullets.push(bullet);\n\n // set the styling to default\n ingame_input_field.style.border = '1px solid black';\n\n // reset the input field to empty\n ingame_input_field.value = '';\n }\n }\n\n // play the sound effects\n playSound('shoot');\n}", "function Bullet(j) {\n this.jet = j;\n this.srcX = 100;\n this.srcY = 500;\n this.drawX = -20;\n this.drawY = 0;\n this.width = 30;\n this.height = 10;\n this.explosion = new Explosion();\n}", "update(dt) {\n // console.log(`this.x: ${this.x}`);\n this.x += dt * this.speed;\n //this.y -= 0;//dt * this.speed * this.direction;\n \n // Update score\n for (let i=0; i<this.claimedFloors.length; i++) {\n for (let j=0; j<this.claimedFloors[i].mainframeList.length; j++) {\n this.score += this.claimedFloors[i].mainframeList[j].incomePerSecond;\n }\n }\n\n // Make sure the player stays in bounds\n this.x = Math.max(0, Math.min(Constants.MAP_SIZE, this.x));\n this.y = Math.max(0, Math.min(Constants.MAP_SIZE, this.y));\n\n // Fire a bullet, if needed\n this.fireCooldown -= dt;\n if (this.fireCooldown <= 0) {\n this.fireCooldown += Constants.PLAYER_FIRE_COOLDOWN;\n // return new Bullet(this.id, this.x, this.y, this.direction);\n }\n }" ]
[ "0.8091789", "0.80157334", "0.7560784", "0.7291882", "0.72227675", "0.7140583", "0.7088589", "0.70883656", "0.7086638", "0.7082433", "0.7073099", "0.6998997", "0.69621515", "0.69461787", "0.69151276", "0.68710095", "0.68699235", "0.68177396", "0.680836", "0.6769661", "0.6760181", "0.67442966", "0.6744165", "0.67345047", "0.6677691", "0.6668166", "0.66528964", "0.664305", "0.6642839", "0.6625393", "0.66171825", "0.6610835", "0.66063607", "0.66033155", "0.656971", "0.6562041", "0.6537361", "0.6522578", "0.6517654", "0.6506238", "0.6489356", "0.6485089", "0.6473233", "0.6465395", "0.6461203", "0.6441413", "0.6436965", "0.6434383", "0.6430912", "0.64157796", "0.6404896", "0.63867617", "0.6374511", "0.63632685", "0.63594943", "0.6342857", "0.6341972", "0.6335966", "0.6334873", "0.63193655", "0.6316654", "0.6316654", "0.631316", "0.63125247", "0.6309105", "0.62888545", "0.62877584", "0.62827504", "0.62807244", "0.62802476", "0.62712806", "0.6270515", "0.62442225", "0.6221695", "0.62040323", "0.6198933", "0.61982596", "0.6194094", "0.61827654", "0.6180882", "0.61707485", "0.6167418", "0.6160112", "0.6146021", "0.61453485", "0.61419725", "0.61296403", "0.61269987", "0.61208785", "0.6082762", "0.6078158", "0.60532886", "0.6051536", "0.6050762", "0.6050476", "0.60364664", "0.6026475", "0.60243493", "0.60191536", "0.6014077" ]
0.7340638
3
This is the keydown handling function for the SVG document
function keydown(evt) { var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode(); switch (keyCode) { case "N".charCodeAt(0): player.motion = motionType.LEFT; break; case "M".charCodeAt(0): player.motion = motionType.RIGHT; break; // Add your code here case "Z".charCodeAt(0): if (player.isOnPlatform()) { player.verticalSpeed = JUMP_SPEED; } break; case 32: // spacebar = shoot if (canShoot) shootBullet(); break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "svgKeyDown() {\n\t\tlet {internalFlags, constants} = this;\n\t\t// make sure repeated key presses don't register for each keydown\n\t\tif (internalFlags.lastKeyDown !== -1) return;\n\n\t\tinternalFlags.lastKeyDown = d3.event.keyCode;\n\t\tvar selectedEdge = internalFlags.selectedEdge;\n\t\t// var selectedNode = internalFlags.selectedNode;\n\n\t\tswitch (d3.event.keyCode) {\n\t\t\tcase constants.BACKSPACE_KEY:\n\t\t\tcase constants.DELETE_KEY:\n\t\t\t\td3.event.preventDefault();\n\t\t\t\tif (selectedEdge) {\n\t\t\t\t\tthis.deleteEdge(selectedEdge);\n\t\t\t\t// } else if (selectedNode){\n\t\t\t\t// \tthis.deleteNode(selectedNode);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}", "function svgKeyDown() {\n var thisGraph = this,\n state = thisGraph.state,\n consts = thisGraph.consts;\n\n state.lastKeyDown = d3.event.keyCode;\n var selectedNode = state.selectedNode,\n selectedEdge = state.selectedEdge;\n\n switch(d3.event.keyCode) {\n case consts.BACKSPACE_KEY:\n case consts.DELETE_KEY:\n d3.event.preventDefault();\n if (selectedNode){\n thisGraph.nodes.splice(thisGraph.nodes.indexOf(selectedNode), 1);\n thisGraph.spliceLinksForNode(selectedNode);\n state.selectedNode = null;\n thisGraph.updateGraph();\n } else if (selectedEdge){\n thisGraph.edges.splice(thisGraph.edges.indexOf(selectedEdge), 1);\n state.selectedEdge = null;\n thisGraph.updateGraph();\n }\n break;\n }\n }", "function keydown() {\n switch (d3.event.keyCode) {\n case 8: // backspace\n {\n break;\n }\n case 46: { // delete\n delete_node = true;\n break;\n }\n case 16: { //shift\n should_modify = true;\n break;\n }\n case 17: { //control\n drawing_line = true;\n }\n\n }\n}", "function keydown() {\n if (d3.event.keyCode == 90) {\n if (d3.event.shiftKey) {\n scale = scale * 2;\n if (scale > 1) scale = 1;\n } else {\n scale = scale / 2;\n if (scale < 0.0625) scale = 0.0625;\n }\n update();\n }\n if (keyAlreadyDown) {\n return false;\n }\n keyAlreadyDown = true;\n if (d3.event.keyCode == 16) {\n // shift\n d3.event.preventDefault();\n deleteLine = true;\n } \n return svg;\n }", "function keydownResponse(event)\n{\n if (event.keyCode === 27)\n {\n // ESC button pressed\n highlightNodes.length = 0;\n highlightLinks.length = 0;\n }\n if (event.keyCode === 16 || event.keyCode === 17)\n {\n // Shift or Ctrl button pressed\n isMultiselect = true;\n }\n if (event.keyCode === 72)\n {\n // 'h' button pressed\n toggleHelpAboutPopUp(helpAboutDialog);\n }\n if (event.keyCode === 77)\n {\n // 'm' button pressed\n if (dagMode === null)\n {\n dagMode = 'radialin';\n }\n else if (dagMode === 'radialin')\n {\n dagMode = 'radialout';\n }\n else if (dagMode === 'radialout')\n {\n dagMode = null;\n }\n graph.dagMode(dagMode);\n }\n}", "function keydown(evt) {\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n player.motion = motionType.LEFT;\r\n if(!playFaceLeft){\r\n var player1 = svgdoc.getElementById(\"playerExceptname\");\r\n player1.setAttribute(\"transform\", \"translate(\" +PLAYER_SIZE.w + \", 0) scale(-1,1)\");\r\n\r\n }\r\n playFaceLeft = true;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n player.motion = motionType.RIGHT;\r\n if(playFaceLeft){\r\n var player1 = svgdoc.getElementById(\"playerExceptname\");\r\n player1.setAttribute(\"transform\", \"translate(0, 0) scale(1,1)\");\r\n }\r\n playFaceLeft = false;\r\n break;\r\n\r\n case \"W\".charCodeAt(0):\r\n if (cheat || player.isOnPlatform()) {\r\n player.verticalSpeed = JUMP_SPEED;\r\n }\r\n break;\r\n case 32:\r\n if(canShoot)\r\n shootBullet();\r\n break;\r\n case \"C\".charCodeAt(0):\r\n cheat = true;\r\n var player2 = svgdoc.getElementById(\"playerExceptname\");\r\n player2.setAttribute(\"style\", \"opacity:0.5\");\r\n break;\r\n case \"V\".charCodeAt(0):\r\n cheat = false;\r\n var player2 = svgdoc.getElementById(\"playerExceptname\");\r\n player2.setAttribute(\"style\", \"opacity:1\");\r\n break;\r\n\r\n }\r\n}", "function handleSvgMapKeypress(e) {\n if (e.key.toLowerCase() === \"enter\") {\n e.preventDefault();\n loadMapText(this);\n }\n }", "function d3_keydown() {\n\n var event = d3.event;\n lastKeyDown = event.keyCode;\n\n if (event.ctrlKey) {\n switch (lastKeyDown) {\n // Ctrl - drag nodes\n case 17:\n {\n rect.call(force.drag);\n svg.classed('ctrl', true);\n break;\n }\n // Ctrl+Z - undo\n case 90:\n {\n undo();\n break;\n }\n // Ctrl+Y - redo\n case 89:\n {\n redo();\n break;\n }\n // Ctrl+S - save\n case 83:\n {\n saveChanges(plantaID);\n break;\n }\n // Ctrl+O - open\n case 79:\n {\n loadInterface();\n break;\n }\n }\n } else {\n // Delete - delete node\n if (lastKeyDown == 46) {\n // nothing selected\n if (!selected_node && !selected_link)\n return;\n // delete node\n if (selected_node) {\n deleteNode(selected_node);\n removeInfoBox();\n }\n // delete link\n else if (selected_link) {\n deleteLink();\n removeInfoBox();\n }\n selected_node = null;\n restart();\n }\n }\n}", "keydown(e){\n let cursorPosition = {row:this.paper.cursor.row, col:this.paper.cursor.col}\n switch( e.key ) {\n case 'ArrowUp':\n this.cursorMove({row: cursorPosition.row - 1, col: cursorPosition.col})\n break;\n case 'ArrowDown':\n this.cursorMove({row: cursorPosition.row + 1, col: cursorPosition.col})\n break;\n case 'ArrowRight':\n this.cursorMove({row: cursorPosition.row, col: cursorPosition.col + 1})\n break;\n case 'ArrowLeft':\n this.cursorMove({row: cursorPosition.row, col: cursorPosition.col - 1})\n break;\n case 'Escape':\n this.cancel()\n break;\n case ' ':\n case 'Enter':\n e.row = cursorPosition.row\n e.col = cursorPosition.col\n if( !this.drawing ) {\n this.cursorDown(e)\n } else {\n this.cursorUp(e)\n }\n this.cursorClick(e)\n break;\n default:\n if( e.altKey && e.key.length == 1) {\n this.paper.toolbox.selectTool(e.key)\n }\n }\n }", "function d3_keyup() {\n\n lastKeyDown = -1;\n // ctrl\n if (!d3.event.ctrlKey) {\n rect.on('mousedown.drag', null)\n .on('touchstart.drag', null);\n svg.classed('ctrl', false);\n }\n}", "onElementKeyPress(event) {}", "onElementKeyPress(event) {}", "keyPress(ev) {\n if (!Notey.mouseEvent) return;\n ev.stopPropagation();\n if ((this._keyX != Notey.mouseEvent.offsetX) || (this._keyY != Notey.mouseEvent.offsetY)) {\n this._keyX = Notey.mouseEvent.offsetX;\n this._keyY = Notey.mouseEvent.offsetY;\n this._keyText = '';\n if (ev.keyCode > 31) this._keyText = ev.key;\n } else if ((ev.keyCode > 31) && (this._keyText != undefined)) {\n this._keyText += ev.key;\n } else if ((ev.keyCode == 8) && (this._keyText.length > 0)) {\n this._keyText = this._keyText.substring(0, this._keyText.length - 1);\n } else {\n return;\n }\n if (this._keyText == undefined) return;\n//console.log('%d (%d,%d) %s', ev.keyCode, this._keyX, this._keyY, this._keyText);\n var tid = 'text-' + this._keyX + '-' + this._keyY;\n var tel = this.svg.getElementById(tid);\n if (!tel) {\n tel = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n tel.id = tid;\n tel.setAttribute('class', 'notey-svg-text');\n tel.setAttribute('fill', (this.strokeColorId ? Notey.colorChoices[this.strokeColorId] : '#000'));\n tel.setAttribute('x', this._keyX);\n tel.setAttribute('y', this._keyY);\n this.svg.appendChild(tel);\n }\n Notey._needTextSave = this;\n tel.innerHTML = this._keyText;\n }", "function _keydownHandler(e) {\n if(!e) {\n let e = window.event;\n }\n\n if (!running||!shape){\n return;\n }\n\n switch(e.keyCode){\n case 37: {\n shape.goLeft(matrix);\n _draw();\n }\n break;\n\n case 39: {\n shape.goRight(matrix);\n _draw();\n }\n break;\n\n case 38: {\n shape.rotate(matrix);\n _draw();\n }\n break;\n\n case 40: {\n shape.goDown(matrix);\n _draw();\n }\n break;\n\n case 32: {\n shape.goBottom(matrix);\n _update();\n }\n break;\n }\n}", "function canvasHandleKeyDown(e){\r\n\tvar key = e.keyCode;\r\n\t//println(key);\r\n\tif(useStates){\r\n\t\tStates.current().input.handleKeyDown(e);\r\n\t}\r\n\tgInput.handleKeyDown(e);\r\n}", "function keydown() {\r\n switch (d3.event.keyCode) {\r\n case 8: // backspace\r\n case 46: { // delete\r\n if (selected_node) { // deal with nodes\r\n var i = nodes.indexOf(selected_node);\r\n nodes.splice(i, 1);\r\n // find links to/from this node, and delete them too\r\n var new_links = [];\r\n links.forEach(function(l) {\r\n if (l.source !== selected_node && l.target !== selected_node) {\r\n\t\t\tl.value = 1;\r\n new_links.push(l);\r\n }\r\n });\r\n links = new_links;\r\n selected_node = nodes.length ? nodes[i > 0 ? i - 1 : 0] : null;\r\n } else if (selected_link) { // deal with links\r\n var i = links.indexOf(selected_link);\r\n links.splice(i, 1);\r\n selected_link = links.length ? links[i > 0 ? i - 1 : 0] : null;\r\n }\r\n update();\r\n break;\r\n }\r\n case 16: { // shift\r\n should_drag = true;\r\n break;\r\n }\r\n }\r\n}", "function onkey(event) {\n\n if (!(event.metaKey || event.altKey || event.ctrlKey)) {\n event.preventDefault();\n }\n\n if (event.charCode == 'z'.charCodeAt(0)) { // z\n controls.zeroSensor();\n } else if (event.charCode == 'f'.charCodeAt(0)) { // f\n effect.setFullScreen( true );\n } else if (event.charCode == 'w'.charCodeAt(0)) { // w - move a row up\n animator.changeRow( -1 );\n currentRow -= 1;\n } else if (event.charCode == 's'.charCodeAt(0)) { // s - move a row down\n animator.changeRow( 1 );\n currentRow += 1;\n } else if (event.charCode == 'a'.charCodeAt(0)) { // a - spin row left\n animator.spinRow( -1 );\n } else if (event.charCode == 'd'.charCodeAt(0)) { // d - spin row right\n animator.spinRow( 1 );\n }\n}", "function onDocumentKeyDown(event){\n\tvar comand = event.which; //return a number corresponding to the button pressed on the keyboard\n\tif(comand == 37){\t//left\n\t\tif(models[character].position.x != -37){\n\t\t\tmodels[character].position.x -= 37; //move to left if pressed th left arrow\n\t\t\t\n\t\t}\n\t}else if(comand == 39){ //right\n\t\tif(models[character].position.x != 37){\n\t\t\tmodels[character].position.x += 37;\n\t\t\t\n \t\t}\n\t}\n}", "function keystroke(event) \n{\n 'use strict';\n\n // Left arrow?\n if (event.which == 37) {\n pfView.moveLeft();\n }\n\n // Right arrow?\n else if (event.which == 39) {\n pfView.moveRight();\n }\n}", "HandleKeyDown(event) {}", "handleInput(key) {\n if (this.x > 0 && key === 'left') {\n this.x -= 101;\n }\n\n if (this.x < 404 && key === 'right') {\n this.x += 101;\n }\n\n if (this.y > 0 && key === 'up') {\n this.y -= 83;\n }\n\n if (this.y < 395 && key === 'down') {\n this.y += 83;\n }\n }", "function handleKeyDown(event) {\n wgl.listOfPressedKeys[event.keyCode] = true;\n // console.log(\"keydown - keyCode=%d, charCode=%d\", event.keyCode, event.charCode);\n }", "keyDown(_keycode) {}", "function onKeyDown(event){\n\tif(event.key=='space'){\n\t\tnode = new Path.Circle(new Point(mousePosition.point), 50);\n\t\tnode.fillColor='black';\n\t}\n}", "function handleKey(event) {\n if (event.key.includes('Arrow')) {\n event.preventDefault();\n draw({ key: event.key });\n // console.log(event.key);\n // console.log('handling key');\n }\n}", "function keyboardEvent(event){\n var key = event.keyCode;\n \n switch( key ) {\n case 119:\n case 87:\n // w key\n // translate in a positive direction along Y axis of window\n vertical(true);\n break;\n case 115:\n case 83:\n // s key\n // translate in a negative direction along Y axis of window\n vertical(false);\n\n break;\n case 97:\n case 65:\n // a key\n // translate in a negative direction along X axis of window\n horizontal(true);\n\n break;\n case 100:\n case 68:\n // d key\n // translate in a positive direction along X axis of window\n horizontal(false);\n\n break;\n case 113:\n case 81:\n // q key\n // move counter clockwise direction\n\n turn(false);\n\n break;\n case 101:\n case 69:\n // e key\n // move clockwise direction\n\n turn(true);\n\n break;\n case 120:\n case 88:\n // x key\n // translate polygon centre to window [0,0]\n\n home();\n\n break;\n case 27:\n // escape key\n console.log(\"Esc\");\n clearCanvas();\n break;\n };\n}", "function handleKey(event) {\r\n\tvar i = gGamerPos.i;\r\n\tvar j = gGamerPos.j;\r\n\tvar key = event.key;\r\n\r\n\tswitch (key) {\r\n\t\tcase 'ArrowLeft':\r\n\t\t\tif (!gisGlued) {\r\n\t\t\t\tif (gGamerPos.i === 5 && gGamerPos.j === 0) {\r\n\t\t\t\t\trenderCell(gGamerPos, '');\r\n\t\t\t\t\tgGamerPos = { i: 5, j: 11 }\r\n\t\t\t\t\trenderCell(gGamerPos, GAMER_IMG);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tmoveTo(i, j - 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowRight':\r\n\t\t\tif (!gisGlued) {\r\n\t\t\t\tif (gGamerPos.i === 5 && gGamerPos.j === 11) {\r\n\t\t\t\t\trenderCell(gGamerPos, '');\r\n\t\t\t\t\tgGamerPos = { i: 5, j: 0 }\r\n\t\t\t\t\trenderCell(gGamerPos, GAMER_IMG);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tmoveTo(i, j + 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowUp':\r\n\t\t\tif (!gisGlued) {\r\n\t\t\t\tif (gGamerPos.i === 0 && gGamerPos.j === 5) {\r\n\t\t\t\t\trenderCell(gGamerPos, '');\r\n\t\t\t\t\tgGamerPos = { i: 9, j: 5 }\r\n\t\t\t\t\trenderCell(gGamerPos, GAMER_IMG);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tmoveTo(i - 1, j);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowDown':\r\n\t\t\tif (!gisGlued) {\r\n\t\t\t\tif (gGamerPos.i === 9 && gGamerPos.j === 5) {\r\n\t\t\t\t\trenderCell(gGamerPos, '');\r\n\t\t\t\t\tgGamerPos = { i: 0, j: 5 }\r\n\t\t\t\t\trenderCell(gGamerPos, GAMER_IMG);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tmoveTo(i + 1, j);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n}", "function keyPressed(){\n if (key == 'S' || key == 's') {\n save(\"masterpiece.png\")\n }\n if (key == 'R' || key == 'r') {\n rect_toggle = !rect_toggle; \n if(rect_toggle) {\n console.log('rect mode on!')\n } else if (!rect_toggle){\n console.log('rect mode off!')\n }\n \n }\n if (key == 'T' || key == 't') {\n tri_toggle = !tri_toggle; \n if(tri_toggle) {\n console.log('tri mode on!')\n } else if (!tri_toggle){\n console.log('tri mode off!')\n }\n \n }\n if (key == 'L' || key == 'l') {\n line_toggle = !line_toggle; \n if(line_toggle) {\n console.log('line mode on!')\n } else if (!line_toggle){\n console.log('line mode off!')\n }\n }\n if (key == 'C' || key == 'c') {\n console.log(counter,'counter number!')\n console.log(coords_rect,'looped thru array!');\n }\n}", "handleInput(keyCode) {\n\n switch (keyCode) {\n case 'left':\n if (this.x - 100 >= 0) {\n this.x -= 100;\n }\n break;\n case 'right':\n if (this.x + 100 <= 400) {\n this.x += 100;\n }\n break;\n case 'up':\n if (this.y - 80 >= -80) {\n this.y -= 80;\n }\n break;\n case 'down':\n if (this.y + 80 <= 440) {\n this.y += 80;\n }\n break;\n }\n }", "function keyPressed() {\n if (key === 'S') {\n savePaintData();\n }\n if (key === 'L') {\n loadPaintData();\n }\n}", "function handleKey(e) {\n if (e.key.includes(\"Arrow\")) {\n e.preventDefault();\n draw({ key: e.key }); // Here the key object is being deconstructing that its value is the key that the event had\n console.log(e.key);\n console.log(\"HANDLE KEYY!!\")\n };\n}", "svgMouseDown() {\n\t\tthis.internalFlags.graphMouseDown = true;\n\t}", "function onKeyDown(event) {\n}", "catchHandle() {\n\t\tdocument.addEventListener('keydown', (e) => {\n\t\t\tif (e.which == 37 && this.dx == 0) {\n\t\t\t\tthis.dx = -this.grid;\n\t\t\t\tthis.dy = 0;\n\t\t\t}\n\n\t\t\telse if (e.which == 38 && this.dy == 0) {\n\t\t\t\tthis.dx = 0;\n\t\t\t\tthis.dy = -this.grid;\n\t\t\t}\n\n\t\t\telse if (e.which == 39 && this.dx == 0) {\n\t\t\t\tthis.dx = this.grid;\n\t\t\t\tthis.dy = 0;\n\t\t\t}\n\n\t\t\telse if (e.which == 40 && this.dy == 0) {\n\t\t\t\tthis.dx = 0;\n\t\t\t\tthis.dy = this.grid;\n\t\t\t}\n\t\t});\n\n\t}", "handleInput(key) {\n if (key === 'right' && this.x < 404) {\n this.x += 101;\n } else if (key === 'left' && this.x > 0) {\n this.x -= 101;\n } else if (key === 'up' && this.y > 0) {\n this.y -= 83;\n } else if (key === 'down' && this.y < 315) {\n this.y += 83;\n }\n }", "function onDocumentKeyDown(event){\n // Get the key code of the pressed key\n var keyCode = event.which;\n\n if(keyCode == 38){\n console.log(\"cursor up\");\n scope.currentMesh.rotation.x += 0.05;\n // Cursor down\n } else if(keyCode == 40){\n console.log(\"cursor down\");\n scope.currentMesh.rotation.x += -0.05;\n // Cursor left\n } else if(keyCode == 37){\n console.log(\"cursor left\");\n scope.currentMesh.rotation.y += 0.05;\n // Cursor right\n } else if(keyCode == 39){\n console.log(\"cursor right\");\n scope.currentMesh.rotation.y += -0.05;\n\t\t\t\t// Robot\n\t\t\t\t// LEGS\n\t\t\t\t// key \"1\" animate Right Front Leg\n } else if(keyCode == 49) {\n\t\t\t\t\tconsole.log(\"key 1\");\n\t var nodeHead = scope.scene.getObjectByName(\"jointMidRightFront\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z +=0.05;\n\t // key \"2\" animate Right Center Leg \t\n } else if(keyCode == 50) {\n\t\t\t\t\tconsole.log(\"key 2\");\n\t var nodeHead = scope.scene.getObjectByName(\"jointMidRightCenter\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z +=0.05;\n\t // key \"3\" animate Right Back Leg\n } else if(keyCode == 51) {\n\t\t\t\t\tconsole.log(\"key 3\");\n\t var nodeHead = scope.scene.getObjectByName(\"jointMidRightBack\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z +=0.05;\n \t// key \"4\" animate Left Front Leg\n } else if(keyCode == 52) {\n\t\t\t\t\tconsole.log(\"key 4\");\n\t var nodeHead = scope.scene.getObjectByName(\"jointMidLeftFront\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z +=0.05;\n\t // key \"5\" animate Left Center Leg\n } else if(keyCode == 53) {\n\t\t\t\t\tconsole.log(\"key 5\");\n\t var nodeHead = scope.scene.getObjectByName(\"jointMidLeftCenter\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z +=0.05;\n \t// key \"6\" animate Left Back Leg\n } else if(keyCode == 54) {\n\t\t\t\t\tconsole.log(\"key 6\");\n\t var nodeHead = scope.scene.getObjectByName(\"jointMidLeftBack\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z +=0.05;\n\t // TAIL\n\t\t\t\t// key \"Q\" animate TailJoint0\n } else if(keyCode == 81) {\n\t\t\t\t\tconsole.log(\"key Q\");\n\t var nodeHead = scope.scene.getObjectByName(\"tailJoint\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z -=0.05;\n\t \tconsole.log(nodeHead.rotation.z);\n\t // key \"W\" animate TailJoint1\n } else if(keyCode == 87) {\n\t\t\t\t\tconsole.log(\"key W\");\n\t var nodeHead = scope.scene.getObjectByName(\"tailMidJoint\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z +=0.05;\n\t \tconsole.log(nodeHead.rotation.z);\n\t // key \"E\" animate TailJoint2\n } else if(keyCode == 69) {\n\t\t\t\t\tconsole.log(\"key E\");\n\t var nodeHead = scope.scene.getObjectByName(\"tailMidJoint2\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z +=0.05;\n\t \tconsole.log(nodeHead.rotation.z);\n\t // key \"R\" animate TailJoint3\n } else if(keyCode == 82) {\n\t\t\t\t\tconsole.log(\"key R\");\n\t var nodeHead = scope.scene.getObjectByName(\"tailMidJoint3\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z -=0.05;\n\t \tconsole.log(nodeHead.rotation.z);\n\t // key \"T\" animate TailJoint4 \t\n } else if(keyCode == 84) {\n\t\t\t\t\tconsole.log(\"key T\");\n\t var nodeHead = scope.scene.getObjectByName(\"tailMidJoint4\",true);\n\t if (nodeHead) \n\t \tnodeHead.rotation.z -=0.05;\n\t \tconsole.log(nodeHead.rotation.z);\n\t // CLAWS\n\t // key \"Z\" animate Right Claw \t\n } else if(keyCode == 90) {\n\t\t\t\t\tconsole.log(\"key Z\");\n\t var nodeHead = scope.scene.getObjectByName(\"clawJointMidRight\",true);\n\t if (nodeHead) {\n\t \tif (rotateClawLeft){ \n\t \t\t\tnodeHead.rotation.x +=0.05;\n\t\t\t\t\t\t\tif (nodeHead.rotation.x >= Math.PI/2){\n\t\t\t\t\t\t\t\trotateClawLeft = false;}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t nodeHead.rotation.x -=0.05\n\t\t\t\t\t\t\tif (nodeHead.rotation.x <= -Math.PI/2) \n\t\t\t\t\t\t\t\trotateClawLeft = true; \n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t // key \"U\" animate Left Claw \n } else if(keyCode == 85) {\n\t\t\t\t\tconsole.log(\"key U\");\n\t var nodeHead = scope.scene.getObjectByName(\"clawJointMidLeft\",true);\n\t if (nodeHead) {\n\t \tif (rotateClawRight){ \n\t \t\t\tnodeHead.rotation.x +=0.05;\n\t\t\t\t\t\t\tif (nodeHead.rotation.x >= Math.PI/2){\n\t\t\t\t\t\t\t\trotateClawRight = false;}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t nodeHead.rotation.x -=0.05\n\t\t\t\t\t\t\tif (nodeHead.rotation.x <= -Math.PI/2) \n\t\t\t\t\t\t\t\trotateClawRight = true; \n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\t\n } // test key 0 else if(keyCode == 48) {} \t\n }", "function handleKey(e){\n if(e.key.includes('Arrow')){\n e.preventDefault();\n console.log(e.key);\n draw({key: e.key});\n console.log('HANDLING KEY');\n }\n}", "function keyPressed() { \n //when \"C\" is pressed, it erases everything the animation has drawn (basically draws\n //a black rectangle filling the entire document)\n if (keyCode == 67) { \n fill(30);\n rect(0,0,width, height);\n }; \n //when \"F\" is pressed, it freezes the frame (actually moves the location of the \n //y-coordinate outside the frame for the animation, and therefore cant be seen anymore)\n if (keyCode == 70) {\n y = y + 650;\n };\n}", "function handleKeyDown(event) {\n currentlyPressedKeys[event.keyCode] = true;\n console.log(\"xPos: \" + xPos + \" yPos: \" + yPos);\n}", "function onkey(event) {\r\n event.preventDefault();\r\n\r\n if (vr) {\r\n if (event.keyCode == 90) // z\r\n controls.resetSensor(); //zero rotation\r\n else if (event.keyCode == 70 ) //f or enter\r\n effect.setFullScreen(true) //fullscreen\r\n else if (event.key == 'Enter') {\r\n\r\n console.log('ugh');\r\n onMouseDown();\r\n }\r\n }\r\n\r\n // some controls\r\n if(event.keyCode == 87) // w\r\n camera.position.z -= 0.8;\r\n else if(event.keyCode == 83) // s\r\n camera.position.z += 0.8;\r\n else if(event.keyCode == 65) // a\r\n camera.position.x -= 0.8;\r\n else if(event.keyCode == 68) // d\r\n camera.position.x += 0.8;\r\n}", "function keyReleased() {\n\n}", "function keyPressed() {\n\t\n if( key === 's' || key === 'S' ) {\n\n save();\n \n }else if( key === 'z' || key === 'Z' ) {\n toggleGrid();\n }else if( key === 'x' || key === 'X' ) {\n toggleQuarterLine();\n }\n\n}", "function keyDownHandler (e){\r\n\tif (!box.close){\r\n\t\tif (e.keyCode === 32){\r\n\t\t\tcounter++;\r\n\t\t\tdrawBox();\r\n\t\t}\r\n\t} \r\n}", "function inputKeyDown(KeyID, axis) {\r\n\t\tif (KeyID == 38 || KeyID == 40) {\r\n\t\t\tif (axis == \"x\" && KeyID == 38) {\r\n\t\t\t\toffsetCurrent.x--\r\n\t\t\t}\r\n\t\t\tif (axis == \"x\" && KeyID == 40) {\r\n\t\t\t\toffsetCurrent.x++\r\n\t\t\t}\r\n\t\t\tif (axis == \"y\" && KeyID == 38) {\r\n\t\t\t\toffsetCurrent.y--\r\n\t\t\t}\r\n\t\t\tif (axis == \"y\" && KeyID == 40) {\r\n\t\t\t\toffsetCurrent.y++\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (axis == \"x\") {\r\n\t\t\t\tmeasurement.xInput.value = offsetCurrent.x - originalPosition.x\r\n\t\t\t}\r\n\t\t\tif (axis == \"y\") {\r\n\t\t\t\tmeasurement.yInput.value = offsetCurrent.y - originalPosition.y\r\n\t\t\t}\r\n\t\t\tmoveDesignImage()\r\n\t\t}\r\n\t}", "function keyDown(evt) {\n var c = (evt.keyCode) ? evt.keyCode : evt.charCode;\n switch(c) {\n case 37: // left\n case 63234:\n dx = 1; break;\n case 39: // right\n case 63235:\n dx = -1; break;\n case 40: // down\n case 63233:\n dy = -1; break;\n case 38: // up\n case 63232:\n dy = 1; break;\n case 32: // fire\n if (Torpedo.x) {\n playSound('notAvail');\n message('Not loaded new torpedo yet!');\n mainPanel(\"#779\");\n } else Torpedo.fire();\n break;\n case 16: // shift\n withShift = 1; break;\n case 27: // esc\n gameRunning = score = 0;\n IntroOutro.endAnimDest(0 , 1, 1);\n }\n}", "function inputHandler()\r\n{\r\n window.onkeydown = event => {\r\n switch (event.keyCode)\r\n {\r\n // if user pressed the left arrow key\r\n case 37:\r\n line.rotateAntiClockwise();\r\n break;\r\n\r\n // if user presses the right arrow key\r\n case 39:\r\n line.rotateClockwise();\r\n break;\r\n\r\n // if user presses the space bar\r\n case 32:\r\n wBall.shootBall();\r\n line.clear();\r\n break;\r\n }\r\n }\r\n}", "handleKeyDown (event) {\n }", "function keydownhandler (event) {\n if (event.keyCode == 37) {\n leftkeydown = true;\n }\n if (event.keyCode == 39) {\n rightkeydown = true;\n\n } \n if (event.keyCode == 32) {\n spacekeydown = true;\n } \n}", "_evtKeydown(event) {\n // Check for escape key\n switch (event.keyCode) {\n case 27: // Escape.\n event.stopPropagation();\n event.preventDefault();\n this.hideAndReset();\n break;\n default:\n break;\n }\n }", "function keydownEventHandler(e) {\n if (e.keyCode == 87 && blockMov.position.y >0) { //w key\n if(blockMov.position.y < 50){\n createjs.Tween.get(blockMov.position).to({y: 0},200);\n }\n createjs.Tween.get(blockMov.position).to({y: (blockMov.position.y - 50)}, 200);\n }\n\n if (e.keyCode == 83) { //s key\n if(blockMov.position.y > 400){\n createjs.Tween.get(blockMov.position).to({y:450},200);\n }\n else{\n createjs.Tween.get(blockMov.position).to({y:(blockMov.position.y + 50)},200);\n }\n }\n\n if (e.keyCode == 65 && blockMov.position.x >0) { //a key\n if(blockMov.position.x < 50){\n createjs.Tween.get(blockMov.position).to({x: 0},200);\n }\n createjs.Tween.get(blockMov.position).to({x: (blockMov.position.x - 50)}, 200);\n }\n\n if(e.keyCode == 68) { //d key\n if(blockMov.position.x > 400){\n createjs.Tween.get(blockMov.position).to({x:450},200);\n }\n else{\n createjs.Tween.get(blockMov.position).to({x: (blockMov.position.x + 50)}, 200);\n }\n }\n beep.play();\n checkHelp();\n win();\n }", "function handleKeydown(evt) {\n if (evt.keyCode == 37 || evt.keyCode == 39) {\n viewNextImg(evt);\n\n } else if (evt.keyCode == 27) {\n closeModal(evt);\n }\n}", "function handleKey(e) {\n if (e.key.includes('Arrow')) {\n draw({ key: e.key });\n e.preventDefault();\n // console.log('Handling keys: ', e.key);\n }\n}", "handleInput(keyCode) {\n switch (keyCode) {\n case 'up':\n if (this.y > 0) {\n this.y -= 83;\n }\n break;\n case 'down':\n if (this.y < 373.5) {\n this.y += 83;\n }\n break;\n case 'left':\n if (this.x > 0) {\n this.x -= 101;\n }\n break;\n case 'right':\n if (this.x < 404) {\n this.x += 101;\n }\n break;\n }\n }", "sliderKeyControl(){\r\n\t\tdocument.addEventListener('keydown', e =>{\r\n switch(event.key){\r\n \tcase 'ArrowLeft': \r\n\t\t clearInterval(this.slideInterval);\r\n this.previousImage();\r\n\t\t\tthis.sliderAnimation();\r\n\t\t\tbreak;\r\n\t\t\tcase '4':// numpad 4 = arrow left\r\n\t\t\tclearInterval(this.slideInterval);\r\n this.previousImage();\r\n\t\t\tthis.sliderAnimation();\r\n\t\t\tbreak;\r\n case 'ArrowRight': // > right\r\n clearInterval(this.slideInterval);\r\n this.nextImage();\r\n\t\t\tthis.sliderAnimation();\r\n break;\r\n\t\t\tcase '6':// numpad 6 = arrow right\r\n\t\t\tclearInterval(this.slideInterval);\r\n this.previousImage();\r\n\t\t\tthis.sliderAnimation();\r\n\t\t\tbreak;\r\n\t\t\t\t\r\n\t\tdefault: // Do nothing\r\n }\r\n\t\t});\r\n\t}", "function handleKey(e) {\n if(e.key.includes('Arrow')) {\n e.preventDefault();\n draw({ key : e.key }); \n }\n}", "function keyPressed() {\n}", "onElementKeyDown(event) {\n const me = this;\n\n if (me.find && me.find !== '') {\n if (event.key === 'F3' || event.key.toLowerCase() === 'g' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n\n if (event.shiftKey) {\n me.gotoPrevHit();\n } else {\n me.gotoNextHit();\n }\n }\n }\n }", "function keyPressed() {\n switch (keyCode) {\n case LEFT_ARROW:\n cenX -= (0.1 * 1) / scale;\n redraw = true;\n break;\n case RIGHT_ARROW:\n cenX += (0.1 * 1) / scale;\n redraw = true;\n break;\n case UP_ARROW:\n cenY -= (0.1 * 1) / scale;\n redraw = true;\n break;\n case DOWN_ARROW:\n cenY += (0.1 * 1) / scale;\n redraw = true;\n break;\n }\n}", "function keyDownhandler(event) {\n if ( event.keyCode == 39 ) {\n //NOTE keyCode MUST!!! have Capitcal C in key C ode\n //keycode 39 = right arrow button\n rightPressed = true;\n } else if ( event.keyCode == 37 ){\n //keycode 37 = left arrow button\n leftPressed = true;\n }\n}", "function load(evt) {\r\n\r\n background_music = document.getElementById(\"background\")\r\n // Set the root node to the global variable\r\n svgdoc = evt.target.ownerDocument;\r\n\r\n // Attach keyboard events\r\n svgdoc.documentElement.addEventListener(\"keydown\", keydown, false);\r\n svgdoc.documentElement.addEventListener(\"keyup\", keyup, false);\r\n svgdoc.getElementById(\"start_button\").addEventListener(\"click\", startGame)\r\n}", "handleKeyPress(e) {\n\t\tconsole.log(e.keyCode);\n\n\t\tlet axis; // 0: x-axis, 1: y-axis, 2: z-axis\n\t\tlet direction; // Direction depends if number is positive or negative (ex: left or right, up or down, in or out)\n\n\t\t//This will ensure that one of the viewpoint releated to keyboard navigation is active, when a key is pressed \n\t\tif(document.getElementById('x3d_context').runtime.viewpoint()._DEF == \"over\"){\n\n\t\t}else if (e.keyCode === 87 || e.keyCode === 83 || e.keyCode === 65 ||\n\t\t\te.keyCode === 68 || e.keyCode === 81 || e.keyCode === 69) {\n\t\t\t\n\t\t\tlet currentIndex = this.state.rotationIndex-1;\n\t\t\tif(currentIndex==0){\n\t\t\t\tcurrentIndex = 4;\n\t\t\t}\n\t\t\tlet currentViewpoint = \"on\" + currentIndex;\n\t\t\t\n\t\t\tdocument.getElementById(currentViewpoint).setAttribute('set_bind','true');\n\t\t//This will reset the camera to the starting point\n\t\t}else if(e.keyCode === 82){\n\t\t\tlet initialPos = [-50.00000, -310.00000, -100.00000];\n\t\t\tthis.setState({pos: initialPos, rotationIndex: 2, in: 87, out: 83, left: 65, right: 68});\n\t\t\tdocument.getElementById(\"on1\").setAttribute('set_bind','true');\n\t\t}\n \t\n\t\t//Move in towards the screen\n\t\tif (e.keyCode === this.state.in) {\n\t\t\taxis = 1;\n\t\t\tdirection = 10;\n\t\t\tthis.moveDirection(axis, direction);\n\t\t\n\t\t//Move out from the screen\n\t\t} else if (e.keyCode === this.state.out) {\n\t\t\taxis = 1;\n\t\t\tdirection = -10;\n\t\t\tthis.moveDirection(axis, direction);\n\t\t\n\t\t// Move Left\n\t\t} else if (e.keyCode === this.state.left) {\n\t\t\taxis = 0;\n\t\t\tdirection = -10;\n\t\t\tthis.moveDirection(axis, direction);\n\t\t\n\t\t// Move Right\n\t\t} else if (e.keyCode === this.state.right) {\n\t\t\taxis = 0;\n\t\t\tdirection = 10;\n\t\t\tthis.moveDirection(axis, direction);\n\t\t\n\t\t// Move Down\n\t\t} else if (e.keyCode === 81) {\n\t\t\taxis = 2;\n\t\t\tdirection = -10;\n\t\t\tthis.moveDirection(axis, direction);\n\t\t\n\t\t// Move Up\n\t\t} else if (e.keyCode === 69) {\n\t\t\taxis = 2;\n\t\t\tdirection = 10;\n\t\t\tthis.moveDirection(axis, direction);\n\n\t\t// Rotate camera 90 degree around y-axis\n\t\t} else if ((e.keyCode === 16) && !(this.state.isButtonDisabled)) {\n\t\t\tthis.rotateCamera();\n\t\t\tthis.setState({ isButtonDisabled: true, });\n\t\t\tsetTimeout(() => this.setState({ isButtonDisabled: false }), 1200);\t\n\t\t}\n\t}", "function processKeyPress(event){\n if (!validKeys.includes(event.keyCode)) {\n return;\n }\n // prevent default browser mapping of keys\n event.preventDefault();\n\n let isShifted = event.shiftKey;\n let element = undefined;\n \n if (isShifted) {\n let shiftedKey = shiftedKeys[event.keyCode];\n element = document.querySelector(`[data-key=\"${shiftedKey}\"]`);\n } else {\n element = document.querySelector(`[data-key=\"${event.keyCode}\"]`);\n }\n let mouseDown = new Event('mousedown');\n element.dispatchEvent(mouseDown);\n // init mouse up and delay 100 ms, keyup seems to fire faster than mouseup so when using keyboard you can barely see calculator key animations\n setTimeout(() => {\n let mouseUp = new Event('mouseup');\n element.dispatchEvent(mouseUp);\n }, 100);\n }", "function handleKeyDown(event) {\n console.log(\"Key down \", event.key, \" code \", event.code);\n if (event.key == \"ArrowDown\" || event.key == \"ArrowUp\" || event.key == \"ArrowLeft\" || event.key == \"ArrowRight\") {\n event.preventDefault();\n }\n \n currentlyPressedKeys[event.key] = true;\n\n //if key = o, add one particle\n if (currentlyPressedKeys[\"o\"]) {\n particleNum = particleNum + 1;\n }\n //if key = p, add five particles\n if (currentlyPressedKeys[\"p\"]) {\n particleNum = particleNum + 5;\n }\n //if key = r, remove all particles\n if (currentlyPressedKeys[\"r\"]) {\n particles = [];\n particleNum = 0;\n }\n //if key = n, reset particles on screen to 1\n if (currentlyPressedKeys[\"n\"]) {\n particles = [];\n particleNum = 1; \n }\n}", "onElementKeyDown(event) {\n const me = this;\n\n if (me.find && me.find !== '') {\n if (event.key === 'F3' || (event.key.toLowerCase() === 'g' && (event.ctrlKey || event.metaKey))) {\n event.preventDefault();\n\n if (event.shiftKey) {\n me.gotoPrevHit();\n } else {\n me.gotoNextHit();\n }\n }\n }\n }", "function doKeyDown(evt) {\n var keyCode = evt.keyCode; // code for the key that was pressed\n \n if (keyCode >=34 && keyCode <= 40) {\n evt.preventDefault(); // Stop page from scrolling for arrow keys, home, end, pageup, pagedown.\n }\n if (evt.shiftKey) \n shiftBeingHeld = true;\n \n switch( keyCode ) {\n case 37: eyeX -= 10; break; // left arrow\n case 38: eyeY += 10;\n break; // up arrow\n case 39: eyeX += 10; break; // right arrow\n case 40: eyeY -= 10; break; // down arrow\n case 36: atX = origAtX;\n atY = origAtY;\n atZ = origAtZ;\n eyeX = origEyeX;\n eyeY = origEyeY;\n eyeZ = origEyeZ; break; // home\n case 82:\n case 114: rotationTurnedOn = !rotationTurnedOn; // the letter R\n }\n \n display(); \n}", "function key_press_observer() {\n var key_pressed_flag = false; //if key was pressed\n document.onkeydown = function(e){\n if(!key_pressed_flag) {\n if(e.which == \"37\" || e.which == \"65\") {\n if(s[0].d != 'x') {\n s[0].d = '-x';\n }\n }\n\n if(e.which == \"39\" || e.which == \"68\") {\n if(s[0].d != '-x') {\n s[0].d = 'x';\n }\n }\n\n if(e.which == \"38\" || e.which == \"87\") {\n if(s[0].d != 'y') {\n s[0].d = '-y';\n }\n }\n\n if(e.which == \"40\" || e.which == \"83\") {\n if(s[0].d != '-y') {\n s[0].d = 'y';\n }\n }\n key_pressed_flag = true;\n }\n //alert(e.which);\n\n }\n document.onkeyup = function(e){\n key_pressed_flag = false;\n } \n}", "function handleKey(event) {\n\tvar i = gGamerPos.i;\n\tvar j = gGamerPos.j;\n\n\tvar leftWindow = gWindowsPos[0].pos;\n\tvar rightWindow = gWindowsPos[1].pos;\n\tvar upWindow = gWindowsPos[2].pos;\n\tvar downWindow = gWindowsPos[3].pos;\n\n\t//arrowLeft\n\tif (event.key === 'ArrowLeft') {\n\t\tif (leftWindow.i === i && leftWindow.j === j) {\n\t\t\tmoveTo(leftWindow.matchI,leftWindow.matchJ);\n\t\t} else {\n\t\t\tmoveTo(i, j - 1);\n\t\t}\n\t}\n\n\t//arrowRight\n\tif (event.key === 'ArrowRight') {\n\t\tif (rightWindow.i === i && rightWindow.j === j) {\n\t\t\tmoveTo(rightWindow.matchI,rightWindow.matchJ);\n\t\t} else {\n\t\t\t\tmoveTo(i, j + 1);\n\t\t}\n\t}\n\t\n\t//arrowUp\n\tif (event.key === 'ArrowUp') {\n\t\tif (upWindow.i === i && upWindow.j === j) {\n\t\t\tmoveTo(upWindow.matchI,upWindow.matchJ);\n\t\t} else {\t\n\t\t\tmoveTo(i - 1, j);\n\t\t}\n\t}\n\n\t//arrowDown\n\tif (event.key === 'ArrowDown') {\n\t\tif (downWindow.i === i && downWindow.j === j) {\n\t\t\tmoveTo(downWindow.matchI,downWindow.matchJ);\n\t\t} else {\n\t\t\tmoveTo(i + 1, j);\n\t\t}\n\t}\n}", "canvasSpaceKey(event) {\n\t\tswitch (event.key) {\n\t\t\tcase ' ':\n\t\t\t\tthis.bird.jumpBird();\n\t\t\t\tbreak;\n\t\t}\n\t}", "function keydown(ev){\n\tswitch(ev.keyCode){\n\t\tcase 87: // 'w' key\n\t\t\tcamera_z -= 0.5;\n\t\t\tbreak;\n\t\tcase 65: // 'a' key\n\t\t\tcamera_x -= 0.5;\n\t\t\tbreak;\n\t\tcase 83: // 's' key\n\t\t\tcamera_z += 0.5;\n\t\t\tbreak;\n\t\tcase 68: // 'd' key\n\t\t\tcamera_x += 0.5;\n\t\t\tbreak;\n\t\tcase 37: // left arrow key\n\t\t\tcamera_rotate -= 0.01;\n\t\t\tbreak;\n\t\tcase 39: // right arrow key\n\t\t\tcamera_rotate += 0.01;\n\t\t\tbreak;\n\t\tcase 82: // 'r' key (reset camera)\n\t\t\tcamera_x = 0.0;\n\t\t\tcamera_y = 2.5;\n\t\t\tcamera_z = 25.0;\n\t\t\tcamera_rotate = 4.71239;\n\t\t\tchairs_moving = false;\n\t\t\tchair_move_amount = 0;\n\t\t\ttable_rotate = 0;\n\t\t\tsky_channel = true;\n\t\t\tbreak;\n\t\tcase 32: // space key\n\t\t\tsky_channel = !sky_channel\n\t\t\tbreak;\n\t\tcase 74: // 'j' key\n\t\t\ttable_rotate -= 0.4;\n\t\t\tbreak;\n\t\tcase 76: // 'l' key\n\t\t\ttable_rotate += 0.4;\n\t\t\tbreak;\n\t\tcase 17: // Left control\n\t\t\tchairs_moving = !chairs_moving;\n\t\t\tif(!chairs_moving){\n\t\t\t\tchair_move_amount = 0;\n\t\t\t}\n\t\t\tbreak;\n\t}\n}", "function keyHandler(e){\n\tvar keyCode = String(e.keyCode);\n\tupdateScore(keyCode);\n\tvar p1 = d.getElementById(\"keypressed\");\n\t//p1.innerHTML = e.keyCode;\n\tvar track = map_key_track[keyCode];\n \tstaticCircles.playedNote(track, new Date().getTime());\n \tplaySound(track);\n\t\n}", "function onKeyDown(event) { \n\t\tif (keyData[event.key]) {\n\t\t\tvar maxPoint = new Point(view.size.width, view.size.height);\n\t\t\tvar randomPoint = Point.random();\n\t\t\tvar point = maxPoint * randomPoint;\n\t\t\tvar newCircle = new Path.Circle(point, 500)\n\t\t\tnewCircle.fillColor = keyData[event.key].color;\n\t\t\tkeyData[event.key].sound.play();\n\t\t\tcirArr.push(newCircle);\n\t\t} \n\n\t\tif ($(\"#msg\")) {\n\t\t\t$(\"#msg\").css(\"display\", \"none\");\n\t\t\t$(\"#msg\").remove();\n\t\t} \n\t}", "function documentKeyUp (e) {\n // console.log(e.keyCode);\n\n // This is a callback method that is triggered when a keyDown event occurs.\n if (!status.focusOnTextField) {\n if ('tracker' in svl) {\n svl.tracker.push('KeyUp', {'keyCode': e.keyCode});\n }\n switch (e.keyCode) {\n case 16:\n // \"Shift\"\n status.shiftDown = false;\n break;\n case 27:\n // \"Escape\"\n if (svl.canvas.getStatus('drawing')) {\n svl.canvas.cancelDrawing();\n } else {\n svl.ribbon.backToWalk();\n }\n break;\n case 49:\n // \"1\"\n svl.ribbon.modeSwitchClick(\"CurbRamp\");\n break;\n case 50:\n // \"2\"\n svl.ribbon.modeSwitchClick(\"NoCurbRamp\");\n break;\n case 51:\n // \"3\"\n svl.ribbon.modeSwitchClick(\"Obstacle\");\n break;\n case 52:\n // \"4\"\n svl.ribbon.modeSwitchClick(\"SurfaceProblem\");\n break;\n case 67:\n // \"c\" for CurbRamp. Switch the mode to the CurbRamp labeling mode.\n svl.ribbon.modeSwitchClick(\"CurbRamp\");\n break\n case 69:\n // \"e\" for Explore. Switch the mode to Walk (camera) mode.\n svl.ribbon.modeSwitchClick(\"Walk\");\n break;\n case 77:\n // \"m\" for MissingCurbRamp. Switch the mode to the MissingCurbRamp labeling mode.\n svl.ribbon.modeSwitchClick(\"NoCurbRamp\");\n break;\n case 79:\n // \"o\" for Obstacle\n svl.ribbon.modeSwitchClick(\"Obstacle\");\n break;\n case 83:\n svl.ribbon.modeSwitchClick(\"SurfaceProblem\");\n break;\n case 90:\n // \"z\" for zoom. By default, it will zoom in. If \"shift\" is down, it will zoom out.\n if (status.shiftDown) {\n // Zoom out\n if (\"zoomControl\" in svl) {\n svl.zoomControl.zoomOut();\n }\n } else {\n // Zoom in\n if (\"zoomControl\" in svl)\n svl.zoomControl.zoomIn();\n }\n }\n }\n }", "function onSvgMousedown(e) {\n if (state.appMode === 'editing') {\n if (e.target.parentNode.tagName === 'g') {\n info.unload();\n state.selectedArea = e.target.parentNode.obj;\n \n app.deselectAll();\n state.selectedArea.select();\n state.selectedArea.delta = {\n 'x' : e.pageX,\n 'y' : e.pageY\n };\n \n if (e.target.classList.contains('helper')) {\n var helper = e.target;\n state.editType = helper.action;\n \n if (helper.n >= 0) { // if typeof selected_area == polygon\n state.selectedArea.selected_point = helper.n;\n }\n \n app.addEvent(domElements.container, 'mousemove', state.selectedArea.onEdit)\n .addEvent(domElements.container, 'mouseup', state.selectedArea.onEditStop);\n } else if (e.target.tagName === 'rect' || e.target.tagName === 'circle' || e.target.tagName === 'polygon') {\n state.editType = 'move';\n \n app.addEvent(domElements.container, 'mousemove', state.selectedArea.onEdit)\n .addEvent(domElements.container, 'mouseup', state.selectedArea.onEditStop);\n }\n } else {\n app.deselectAll();\n info.unload();\n }\n }\n }", "initGlobalEvents(element = window){\n const self = this\n const { id } = this.options\n\n d3.select(element)\n .on('keydown.' + id, _ => {\n const { useZoom } = self.options\n const keyCode = d3.event.keyCode\n\n // horizontal (H) or vertical (V) zooming\n if ([72, 86].indexOf(keyCode) > -1 && self.keyPressed !== keyCode) {\n self.keyPressed = keyCode\n if (useZoom) self.updateZoom()\n return\n }\n\n // remove selected points (Backspace / Delete)\n if ([8, 46].indexOf(keyCode) > -1 && self.selectedIndices.length) {\n self.removeSelectedPoints()\n self.saveRender()\n return\n }\n\n // clear selection (Esc)\n if (keyCode === 27 && self.selectedIndices.length) {\n self.clearSelection()\n self.saveRender()\n return\n }\n })\n .on('keyup.' + id, _ => {\n const { useZoom } = self.options\n\n // horizontal (H) or vertical (V) zooming\n if ([72, 86].indexOf(d3.event.keyCode) > -1) {\n self.keyPressed = null\n if (useZoom) self.updateZoom()\n }\n })\n }", "function onDocumentKeyDown(e) {\n var ctrlDown = e.ctrlKey || e.metaKey; // PC || Mac\n \n switch (e.keyCode) {\n case KEYS.F1:\n help.show();\n e.preventDefault();\n \n break;\n \n case KEYS.ESC:\n help.hide();\n if (state.isDraw) {\n state.isDraw = false;\n state.newArea.remove();\n state.areas.pop();\n app.removeAllEvents();\n } else if (state.appMode === 'editing') {\n state.selectedArea.redraw();\n app.removeAllEvents();\n }\n \n break;\n \n case KEYS.TOP:\n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(0, -1))\n );\n e.preventDefault();\n }\n \n break;\n \n case KEYS.BOTTOM:\n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(0, 1))\n );\n e.preventDefault();\n }\n break;\n \n case KEYS.LEFT: \n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(-1, 0))\n );\n e.preventDefault();\n }\n \n break;\n \n case KEYS.RIGHT:\n if (state.appMode === 'editing' && state.selectedArea) {\n state.selectedArea.setParams(\n state.selectedArea.dynamicEdit(state.selectedArea.move(1, 0))\n );\n e.preventDefault();\n }\n \n break;\n \n case KEYS.DELETE:\n if (state.appMode === 'editing' && state.selectedArea) {\n app.removeObject(state.selectedArea);\n state.selectedArea = null;\n info.unload();\n }\n \n break;\n \n case KEYS.I:\n if (state.appMode === 'editing' && state.selectedArea) {\n var params = state.selectedArea.params,\n x = params.x || params.cx || params[0],\n y = params.y || params.cy || params[1];\n \n info.load(state.selectedArea, x + app.getOffset('x'), y + app.getOffset('y'));\n }\n \n break;\n \n case KEYS.S:\n app.saveInLocalStorage();\n \n break;\n \n case KEYS.C:\n if (state.appMode === 'editing' && state.selectedArea && ctrlDown) {\n var Constructor = AREAS_CONSTRUCTORS[area_params.type],\n area_params = state.selectedArea.toJSON();\n \n if (Constructor) {\n Constructor.createFromSaved(area_params);\n state.selectedArea.setParams(state.selectedArea.move(10, 10));\n state.selectedArea.redraw();\n }\n }\n \n break;\n }\n }", "function keydown(event){switch(event.keyCode){case $mdConstant.KEY_CODE.LEFT_ARROW:event.preventDefault();incrementIndex(-1,true);break;case $mdConstant.KEY_CODE.RIGHT_ARROW:event.preventDefault();incrementIndex(1,true);break;case $mdConstant.KEY_CODE.SPACE:case $mdConstant.KEY_CODE.ENTER:event.preventDefault();if(!locked)select(ctrl.focusIndex);break;}ctrl.lastClick=false;}", "onElementKeyDown(event) {\n super.onElementKeyDown(event);\n }", "onElementKeyDown(event) {\n super.onElementKeyDown(event);\n }", "static keydown_on_xy_square_action(event){\n //ebugger;\n let [key, sign] = this.convert_key_and_sign(event.key)\n //out(key + \" \" + sign)\n let dui_instance = dui2.dui_instance_under_mouse()\n if (!dui_instance) {\n warning(\"To use the keyboard to control the Dexter User Inferface,<br/>\" +\n \"the mouse must be in the dialog box.\")\n return\n }\n else if((key === \"Shift\") && (sign === null)) { return } // a no-op. don't even print warning\n let x = dui_instance.xyz[0]\n let y = dui_instance.xyz[1]\n let z = dui_instance.xyz[2]\n let xyz = [x,y,z]\n let j_angles\n //out(\"got key \" + key, undefined, true)\n //this.xyz_key_increment = 0.001\n //this set of if..else sets j_angles to new values, OR returns from fn because a\n //key was pressed that does nothing\n if (typeof(key) === \"number\") { //got joint key\n let joint_number = key\n if (dui_instance.should_point_down && ((joint_number == 4) || joint_number == 5)) {\n warning(\"You can't change Joint 4 or 5 when you have 'Point Down' checked.\")\n return\n }\n this.set_new_joint_increment()\n //out(\"new joint increment: \" + this.joint_key_increment, undefined, true)\n //let is_shift = event.shiftKey\n j_angles = dui_instance.maj_angles\n let old_joint_degrees = j_angles[joint_number - 1]\n if(Number.isNaN(old_joint_degrees)) { old_joint_degrees = 0 } //shouldn't be necessary but makes it more robust\n let j_inc = this.joint_key_increment * sign\n let new_joint_degrees = old_joint_degrees + j_inc\n j_angles[joint_number - 1] = new_joint_degrees\n try {\n Kin.J_angles_to_xyz(j_angles) //returns just 5 angles\n }\n catch(err){\n warning(\"Sorry, Dexter can't go to Joint \" + joint_number + \" angle: \" + new_joint_degrees +\n \" given the other joint angles.\")\n return\n }\n }\n else if((key === \"r\") || (key === \"v\")) { //roll\n j_angles = dui_instance.maj_angles\n this.set_new_joint_increment()\n let old_j6 = j_angles[5]\n let old_roll = Kin.J6_to_roll(xyz, old_j6)\n let roll_inc = this.joint_key_increment * sign\n let new_roll = old_roll + roll_inc\n let new_J6 = Kin.roll_to_J6(xyz, new_roll)\n j_angles[5] = new_J6\n }\n else {\n this.set_new_xyz_increment()\n if((key === \"ArrowRight\") || (key === \"d\")){\n x += this.xyz_key_increment\n }\n else if((key === \"ArrowLeft\") || (key === \"a\")) {\n x -= this.xyz_key_increment\n }\n else if((key === \"ArrowUp\") || (key === \"w\")){\n y += this.xyz_key_increment\n }\n else if((key === \"ArrowDown\") || (key === \"s\")){\n y -= this.xyz_key_increment\n }\n else if((key === \".\") || (key === \"e\")){ //z up\n z += this.xyz_key_increment\n }\n else if((key === \",\") || (key === \"c\")){\n z -= this.xyz_key_increment\n }\n else {\n warning(\"The key: \" + key + \" does nothing while the x-y square is selected.\")\n return\n } //ignore the key\n xyz = [x,y,z] //grab the new value for x, y, or z\n try {\n j_angles = Kin.xyz_to_J_angles(xyz, dui_instance.direction) //returns just 5 angles\n }\n catch(err) { //with the above test for new_xy_radius, this catch should never hit.\n if((key === \",\") || (key === \".\")){\n warning(\"Sorry, Dexter can't go to Z position: \" + z +\n \" given X position: \" + x +\n \" and Y position: \" + y)\n }\n else {\n warning(\"Sorry, Dexter can't go to X position: \" + x +\n \" and/or Y position: \" + y +\n \" given Z position: \" + z)\n }\n return\n }\n }\n //now j_angles is set, at least to 5 elts.\n //don't do set_maj_angles until we're sure that Kin.xyz_to_J_angles didn't error\n if(j_angles.length === 5) { j_angles.push(dui_instance.maj_angles[5]) } //joint 6 vals.j6_angle_num)\n if(j_angles.length === 6) { j_angles.push(dui_instance.maj_angles[6]) } //joint 7 vals.j7_angle_num) }\n dui_instance.set_maj_angles(j_angles)\n dui_instance.update_all(dui_instance.should_point_down) // do update_all before move_all_joints because update_all may modify ui2_instance.maj_angles if the direction_checkbox is checked\n let instr = dui_instance.make_move_instruction(dui_instance.maj_angles)\n //Job.insert_instruction(instr, {job: dui_instance.job_name, offset: \"end\"}) //todo overwrite\n Job[dui_instance.job_name].insert_last_instruction_overwrite(instr)\n }", "function handleKey(e) {\n if (e.key.includes(\"Arrow\")) {\n e.preventDefault(); // Prevent default only on Arrow keys\n draw({ key: e.key }); // Passing key is equal to key pressed\n }\n}", "function handleKeyDown(event) {\n \n // const modelEnum = {TRIANGLES: \"triangles\", ELLIPSOID: \"ellipsoid\"}; // enumerated model type\n const dirEnum = {NEGATIVE: -1, POSITIVE: 1}; // enumerated rotation direction\n const modelEnum = {TRIANGLES: \"triangles\"};\n \n // set up needed view params\n var lookAt = vec3.create(), viewRight = vec3.create(), temp = vec3.create(); // lookat, right & temp vectors\n lookAt = vec3.normalize(lookAt,vec3.subtract(temp,Center,Eye)); // get lookat vector\n viewRight = vec3.normalize(viewRight,vec3.cross(temp,lookAt,Up)); // get view right vector\n \n // highlight static variables\n handleKeyDown.whichOn = handleKeyDown.whichOn == undefined ? -1 : handleKeyDown.whichOn; // nothing selected initially\n handleKeyDown.modelOn = handleKeyDown.modelOn == undefined ? null : handleKeyDown.modelOn; // nothing selected initially\n\n switch (event.code) {\n\n // interactivity\n case \"ArrowLeft\":\n if (done == false && ultimateDone == false) {\n moveLeft();\n }\n break;\n\n case \"ArrowRight\":\n if (done == false && ultimateDone == false) {\n moveRight();\n }\n break;\n\n case \"ArrowDown\":\n if (done == false && ultimateDone == false) {\n moveDown();\n }\n break;\n case \"Space\":\n if (done == false && ultimateDone == false) {\n skipDown();\n }\n break;\n \n // view change\n case \"KeyA\": // translate view left, rotate left with shift\n Center = vec3.add(Center,Center,vec3.scale(temp,viewRight,viewDelta));\n if (!event.getModifierState(\"Shift\"))\n Eye = vec3.add(Eye,Eye,vec3.scale(temp,viewRight,viewDelta));\n break;\n case \"KeyD\": // translate view right, rotate right with shift\n Center = vec3.add(Center,Center,vec3.scale(temp,viewRight,-viewDelta));\n if (!event.getModifierState(\"Shift\"))\n Eye = vec3.add(Eye,Eye,vec3.scale(temp,viewRight,-viewDelta));\n break;\n case \"KeyS\": // translate view backward, rotate up with shift\n if (event.getModifierState(\"Shift\")) {\n Center = vec3.add(Center,Center,vec3.scale(temp,Up,viewDelta));\n Up = vec3.cross(Up,viewRight,vec3.subtract(lookAt,Center,Eye)); /* global side effect */\n } else {\n Eye = vec3.add(Eye,Eye,vec3.scale(temp,lookAt,-viewDelta));\n Center = vec3.add(Center,Center,vec3.scale(temp,lookAt,-viewDelta));\n } // end if shift not pressed\n break;\n case \"KeyW\": // translate view forward, rotate down with shift\n if (event.getModifierState(\"Shift\")) {\n Center = vec3.add(Center,Center,vec3.scale(temp,Up,-viewDelta));\n Up = vec3.cross(Up,viewRight,vec3.subtract(lookAt,Center,Eye)); /* global side effect */\n } else {\n Eye = vec3.add(Eye,Eye,vec3.scale(temp,lookAt,viewDelta));\n Center = vec3.add(Center,Center,vec3.scale(temp,lookAt,viewDelta));\n } // end if shift not pressed\n break;\n case \"KeyQ\": // translate view up, rotate counterclockwise with shift\n if (event.getModifierState(\"Shift\"))\n Up = vec3.normalize(Up,vec3.add(Up,Up,vec3.scale(temp,viewRight,-viewDelta)));\n else {\n Eye = vec3.add(Eye,Eye,vec3.scale(temp,Up,viewDelta));\n Center = vec3.add(Center,Center,vec3.scale(temp,Up,viewDelta));\n } // end if shift not pressed\n break;\n case \"KeyE\": // translate view down, rotate clockwise with shift\n if (event.getModifierState(\"Shift\"))\n Up = vec3.normalize(Up,vec3.add(Up,Up,vec3.scale(temp,viewRight,viewDelta)));\n else {\n Eye = vec3.add(Eye,Eye,vec3.scale(temp,Up,-viewDelta));\n Center = vec3.add(Center,Center,vec3.scale(temp,Up,-viewDelta));\n } // end if shift not pressed\n break;\n case \"Escape\": // reset view to default\n Eye = vec3.copy(Eye,defaultEye);\n Center = vec3.copy(Center,defaultCenter);\n Up = vec3.copy(Up,defaultUp);\n break;\n \n } // end switchW\n} // end handleKeyDown", "function keyPressEvent(){\n document.addEventListener(\"keydown\", KeyHandler);\n document.addEventListener(\"keyup\", KeyHandler);\n\n const key_handler = {\n right: false,\n left: false,\n up: false,\n\n /** Do we need to move obstacles? */\n /** For moving obstacles */\n w: false, a: false, s: false, d: false,\n /**************************** */\n };\n\n function KeyHandler(event) {\n const state = event.type === \"keydown\"\n\n if (event.keyCode == 39) { // Right\n key_handler.right = state;\n } else if (event.keyCode == 37) { // Left\n key_handler.left = state;\n } else if (event.keyCode == 38) { // Up\n key_handler.up = state;\n }\n\n /** For moving obstacles */\n else if(event.keyCode == 87){ // w\n key_handler.w = state;\n } else if(event.keyCode == 65){ // a\n key_handler.a = state;\n } else if(event.keyCode == 83){ // s\n key_handler.s = state;\n } else if(event.keyCode == 68){ // d\n key_handler.d = state;\n } \n /**************************** */\n\n event.preventDefault(); // tells the program to ignore the default behavior of the keys\n }\n\n return key_handler;\n }", "_SVGElementDownHandler(event) {\n const that = this,\n oldContext = that.context;\n\n that.context = that;\n that._downHandler(event, true);\n that.context = oldContext;\n }", "function handleSVGClick(event) {\n // Figure out what was clicked\n var clickedNode = event.target;\n if (clickedNode.correspondingUseElement) {\n // If it's an instantiation of a <defs> item, let's target the <use> (aka the instance)\n // (TODO: option to target the node inside <defs> instead, via correspondingElement)\n clickedNode = clickedNode.correspondingUseElement;\n }\n \n // Generate ancestor chain of the clicked node\n var nodeChain = [];\n var svgRoot = event.currentTarget;\n var node = clickedNode;\n while (node && node !== svgRoot) {\n nodeChain.unshift(node);\n node = node.parentElement;\n }\n// console.log(\"CLICK on\", event.target);\n// console.log(\"nodeChain =\", nodeChain);\n \n // Generate nth-child lookup info\n var chain = [];\n nodeChain.forEach(function (node) {\n var childIndex = $(node).index();\n chain.push({ childIndex: childIndex, tagName: node.tagName });\n \n// console.log(node.tagName + \", child #\" + childIndex);\n });\n \n // Find that same tag in the code\n var startOfOpenTag = XMLPathFinder.findTag(currentEditor, chain);\n if (startOfOpenTag) {\n // Select it\n var lineNum = startOfOpenTag.pos.line;\n var token = startOfOpenTag.token;\n currentEditor.setSelection({line: lineNum, ch: token.start}, {line: lineNum, ch: token.end}, true);\n }\n }", "function keyPressed() {\r\n if (keyCode === LEFT_ARROW) {\r\n frequency--;\r\n } else if (keyCode === RIGHT_ARROW) {\r\n frequency++;\r\n }\r\n if (keyCode === UP_ARROW) {\r\n amplitude += 10;\r\n } else if (keyCode === DOWN_ARROW) {\r\n amplitude -= 10;\r\n }\r\n if (keyCode === 87) {\r\n number_of_lines++;\r\n } else if (keyCode === 83) {\r\n number_of_lines--;\r\n }\r\n if (keyCode === 65) {\r\n phase -= 10;\r\n } else if (keyCode === 68) {\r\n phase += 10;\r\n }\r\n if (keyCode === 32) {\r\n color = random(100, 360);\r\n figure_code = ++figure_code % 3;\r\n }\r\n if (keyCode === 82) {\r\n amplitude = 200, frequency = 10, number_of_lines = 20, figure_code = 0, phase = 20;\r\n setup();\r\n }\r\n}", "function handleKey(event) {\r\n\r\n\tvar i = gGamerPos.i;\r\n\tvar j = gGamerPos.j;\r\n\tconsole.log('ev', event);\r\n\r\n\tswitch (event.key) {\r\n\t\tcase 'ArrowLeft':\r\n\t\t\tif (i === 5 && j === 0) moveTo(5, 9)\r\n\t\t\telse moveTo(i, j - 1);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowRight':\r\n\t\t\tif (i === 5 && j === 11) moveTo(5, 0)\r\n\t\t\telse moveTo(i, j + 1);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowUp':\r\n\t\t\tif (i === 0 && j === 5) moveTo(9, 5)\r\n\t\t\telse moveTo(i - 1, j);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowDown':\r\n\t\t\tif (i === 9 && j === 5) moveTo(0, 5)\r\n\t\t\telse moveTo(i + 1, j);\r\n\t\t\tbreak;\r\n\t}\r\n\r\n}", "function handleKey(e) {\n const arrowKey = e.key\n if (arrowKey.includes('Arrow')) {\n e.preventDefault()\n draw({ key: arrowKey });\n }\n}", "_handleKeydown(event) {\n // We don't handle any key bindings with a modifier key.\n if (Object(_angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_14__[\"hasModifierKey\"])(event)) {\n return;\n }\n switch (event.keyCode) {\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_14__[\"ENTER\"]:\n case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_14__[\"SPACE\"]:\n if (this.focusIndex !== this.selectedIndex) {\n this.selectFocusedIndex.emit(this.focusIndex);\n this._itemSelected(event);\n }\n break;\n default:\n this._keyManager.onKeydown(event);\n }\n }", "function onKeyPress(event) {\n\t\n\tswitch (event.key) {\n\t\t\n\t\t// Light Keys\n\t\tcase \"ArrowDown\":\n\t\tcase \"ArrowUp\":\n\t\tcase \"ArrowRight\":\n\t\tcase \"ArrowLeft\":\n\t\tcase \"+\":\n\t\tcase \"-\":\n\t\t\tlightEventHandler(event);\n\t\t\tbreak;\n\n\t\t// Camera keys\n\t\tcase \"w\":\n\t\tcase \"s\":\n\t\tcase \"d\":\n\t\tcase \"a\":\n\t\tcase \"q\":\n\t\tcase \"e\":\n\t\t\tSC.keyPress(event); // pass the listener event to the camera (Required for SphericalCamera Module)\n\t\t\tupdateMVP(); // re-generate the MVP matrix and update it\n\t\t\tbreak;\n\t}\n\n\trender(); // draw with the new view\n}", "_setSvgClickHandler() {\n\t this.svg.addEventListener('click', (ev) => {\n\t if (\n\t !ev.target.closest('svg').matches('[or-readonly]') &&\n\t (ev.target.matches(SELECTORS) || ev.target.closest(SELECTORS))\n\t ) {\n\t const id = ev.target.id || ev.target.closest('g[id]').id;\n\t const input = this._getInput(id);\n\t if (input) {\n\t input.checked = !input.checked;\n\t input.dispatchEvent(events.Change());\n\t input.dispatchEvent(events.FakeFocus());\n\t }\n\t }\n\t });\n\t }", "attachKeyHandler(domElement) {\n var term = this;\n\n // character encodings for special characters (when no modifying \n // characters are pressed)\n const normalKeyMap = {\n Backspace : \"\\x7f\",\n Delete : \"\\x1b[3~\",\n Escape : \"\\x1b\",\n Tab : \"\\t\",\n Enter : \"\\r\",\n ArrowUp : \"\\x1b[A\",\n ArrowDown : \"\\x1b[B\",\n ArrowRight : \"\\x1b[C\",\n ArrowLeft : \"\\x1b[D\",\n PageUp : \"\\x1b[5~\",\n PageDown : \"\\x1b[6~\",\n Home : \"\\x1b[H\",\n End : \"\\x1b[F\",\n Insert : \"\\x1b[2~\",\n F1 : \"\\x1bOP\",\n F2 : \"\\x1bOQ\",\n F3 : \"\\x1bOR\",\n F4 : \"\\x1bOS\",\n F5 : \"\\x1b[15~\",\n F6 : \"\\x1b[17~\",\n F7 : \"\\x1b[18~\",\n F8 : \"\\x1b[19~\",\n F9 : \"\\x1b[20~\",\n F10 : \"\\x1b[21~\",\n F11 : \"\\x1b[23~\",\n F12 : \"\\x1b[24~\",\n };\n\n const handlerFunction = function(event) {\n event.preventDefault();\n var seq = \"\";\n\n if (event.key.length == 1 && !event.ctrlKey && !event.altKey) {\n // use the event key for non-special characters without modifier\n // keys\n seq = event.key;\n }\n else if (!event.ctrlKey && !event.altKey && !event.shiftKey) {\n // use the normal key map for special characters when no\n // modifier characters are down\n if (normalKeyMap[event.key]) {\n seq = normalKeyMap[event.key];\n }\n }\n else if (event.ctrlKey && !event.altKey) {\n if (event.key == '=') { // Zoom in handler\n term.redimension(\n terminal.fontSize * 1.2,\n terminal.pixWidth + 10,\n terminal.pixHeight + 10\n );\n return;\n }\n else if (event.key == '-') { // Zoom out handler\n term.redimension(\n terminal.fontSize / 1.2,\n terminal.pixWidth + 10,\n terminal.pixHeight + 10,\n );\n return;\n }\n else if (event.key == 'r' && event.ctrlKey) {\n // get rid of this if you want ctrl-r functionality\n // ctrl-shift-r still works\n }\n else if (event.key.length == 1) { // basic ASCII control codes\n var ascii = event.key.charCodeAt(0);\n\n if (ascii >= 0x40 && ascii <= 0x5F) {\n seq = String.fromCharCode(ascii - 0x40);\n }\n else if (ascii >= 0x61 && ascii <= 0x7A) {\n seq = String.fromCharCode(ascii - 0x60);\n }\n }\n }\n \n terminal.sendKeyboard(seq);\n }\n\n domElement.addEventListener('keydown', handlerFunction, true);\n }", "function keyDownHandler(e) {\n if(e.keyCode == 32){\n keyPressed = true;\n }\n else if (e.keyCode == 13 && lost) {\n points = 0;\n level = 1;\n lost = false;\n generateNewCircles(level);\n game_interval = setInterval(gameLoop, 16);\n }\n}", "function handleKey(event) {\r\n\r\n var i = gGamerPos.i;\r\n var j = gGamerPos.j;\r\n\r\n switch (event.key) {\r\n case \"ArrowLeft\":\r\n\t\tif(gBoard[5][0].gameElement === GAMER){\r\n\t\t\tmoveTo(5,11)\r\n\t\t}else{ \r\n moveTo(i, j - 1);}\r\n break;\r\n case \"ArrowRight\":\r\n\t\tif(gBoard[5][11].gameElement === GAMER){\r\n\t\t\tmoveTo(5,0);\r\n\t\t}else{ \r\n moveTo(i, j + 1);}\r\n break;\r\n case \"ArrowUp\":\r\n if (gBoard[0][5].gameElement === GAMER) {\r\n\t\t moveTo(9, 5);\r\n\t\t}else {\r\n\t\t\tmoveTo(i - 1, j);\r\n\t\t}\r\n break;\r\n case \"ArrowDown\":\r\n\t\tif (gBoard[9][5].gameElement === GAMER) {\r\n\t\t\tmoveTo(0, 5);\r\n\t\t }else {\r\n moveTo(i + 1, j);}\r\n break;\r\n }\r\n}", "function handleKeyDown(e) {\n\t\t//cross browser issues exist\n\t\tif(!e){ var e = window.event; }\n\t\tswitch(e.keyCode) {\n\t\t\tcase KEYCODE_SPACE:\tshootHeld = true; return false;\n\t\t\tcase KEYCODE_A:\n\t\t\tcase KEYCODE_LEFT:\tlfHeld = true; return false;\n\t\t\tcase KEYCODE_D:\n\t\t\tcase KEYCODE_RIGHT: rtHeld = true; return false;\n\t\t\tcase KEYCODE_W:\n\t\t\tcase KEYCODE_UP:\tfwdHeld = true; return false;\n\t\t\tcase KEYCODE_ENTER:\t if(canvas.onclick == handleClick){ handleClick(); }return false;\n\t\t}\n\t}", "function handleKeyDown(key) {\n if (key == 'W') {\n renderer3D.moveViewPortUp(10);\n }\n if (key == 'S') {\n renderer3D.moveViewPortUp(-10);\n }\n if (key == 'D') {\n renderer3D.moveViewPortRight(10);\n }\n if (key == 'A') {\n renderer3D.moveViewPortRight(-10);\n }\n }", "function onkey(event) {\n event.preventDefault();\n\n if (event.keyCode == 90) { // z\n controls.resetSensor(); //zero rotation\n } else if (event.keyCode == 70 || event.keyCode == 13) { //f or enter\n effect.setFullScreen(true) //fullscreen\n effect.setVRMode(true);\n }\n}", "function onKeyDownHandler(event) {\n //event.preventDefault();\n\n let key;\n if (window.event) {\n key = window.event.keyCode;\n } else {\n key = event.keyCode;\n }\n\n let object = canvas.getActiveObject();\n if(object) {\n let left = object.getLeft();\n let top = object.getTop();\n }\n\n console.warn(\"keyboard keypress event :\" + key );\n switch (key) {\n case 27: // Esc\n canvas.isDrawingMode = false;\n break;\n case 46: // Delete\n event.preventDefault();\n deleteObjects();\n break;\n // case 8: // Backspace\n // deleteObjects();\n // break;\n case 37: // left\n object.set('left', left - 1);\n break;\n case 39: // right\n object.set('left', left + 1);\n break;\n case 38: // up\n object.set('top', top-1);\n break;\n case 40: // down\n object.set('top', top+1);\n break;\n // Copy (Ctrl+C)\n case 67: // Ctrl+C\n if (event.ctrlKey) {\n event.preventDefault();\n copy();\n }\n break;\n // Paste (Ctrl+V)\n case 86: // Ctrl+V\n if (event.ctrlKey) {\n event.preventDefault();\n paste();\n }\n break;\n default:\n // TODO\n break;\n }\n\n canvas.renderAll();\n }", "function handleKeyDown(event) {\r\n // storing the pressed state for individual key\r\n currentlyPressedKeys[event.keyCode] = true;\r\n}", "function keydown(\n event,\n gl,\n cube,\n equator,\n latitudeCircle,\n camLine,\n axes,\n loc_MVP,\n loc_uToggle,\n LEFT_VIEWPORT_MVP,\n RIGHT_VIEWPORT_MVP,\n CamLineMVP,\n latitudeMVP,\n canvas\n) {\n if (event.keyCode == 39) {\n // The right arrow key was pressed\n if (g_eyeX < 360) g_eyeX += 1;\n } else if (event.keyCode == 37) {\n // The left arrow key was pressed\n if (g_eyeX > 0) g_eyeX -= 1;\n }\n\n //UP\n if (event.keyCode == 38) {\n if (g_eyeY < 90) g_eyeY += 1;\n }\n //DOWN\n else if (event.keyCode == 40) {\n if (g_eyeY > -90) g_eyeY -= 1;\n }\n\n // Get dom elemetns by id and modify it.\n let longitudeVal = document.getElementById(\"currentLongitude\");\n LongitudeSliderValue(g_eyeX);\n longitudeVal.innerHTML = g_eyeX;\n\n let latitudeVal = document.getElementById(\"currentLatitude\");\n LatitudeSliderValue(g_eyeY);\n latitudeVal.innerHTML = g_eyeY;\n\n // Redraw after modifying the values.\n draw(\n gl,\n cube,\n equator,\n latitudeCircle,\n camLine,\n axes,\n loc_MVP,\n loc_uToggle,\n LEFT_VIEWPORT_MVP,\n RIGHT_VIEWPORT_MVP,\n CamLineMVP,\n latitudeMVP,\n canvas\n );\n}", "function keyPressed() {\n if ((keyCode == 32) || (keyCode == ENTER)) {\n spaceBarPressed = true;\n }\n\n // 'bind' is needed so 'this' will be defined\n // ref: https://www.javascripttutorial.net/javascript-bind/\n //\n let doCellsCollide = GG.doCellsCollide.bind(GG);\n\n var b = GP.getBounds();\n var lx = b.x1; // left x\n var rx = b.x2; // right x\n if (keyCode == LEFT_ARROW) {\n if (lx > PIECE_W) {\n GP.moveWithColl(-PIECE_W, 0, doCellsCollide);\n }\n } else if (keyCode == RIGHT_ARROW) {\n if (rx < (width-PIECE_W)) {\n GP.moveWithColl(PIECE_W, 0, doCellsCollide);\n }\n } else if (keyCode == UP_ARROW) {\n GP.rotateCWWithColl(doCellsCollide);\n }\n\n return false; // prevent any default behaviour\n}", "function keydown(e){\n e= e || window.event\n var propagate= true\n var ele= e.target || e.srcElement\n if(ele.nodeType == 3) ele= ele.parentNode\n var code= e.keyCode || e.which\n var input= (ele.tagName == 'INPUT' || ele.tagName == 'TEXTAREA')\n if(code >= 112 && code <= 123){ // F1-12\n shortcut_call(code-112)\n propagate= false\n } else if(code == 32 && !input){ // space\n el('bar').select()\n propagate= false\n } else if(ele.id == 'bar'){ // up and down\n if(code == 38) backCmd()\n else if(code == 40) nextCmd()}\n if(!propagate){\n e.cancelBubble= true; e.returnValue= false\n if(e.stopPropagation)\n {e.stopPropagation(); e.preventDefault()}\n return false}}" ]
[ "0.7962954", "0.74845344", "0.74328256", "0.71410114", "0.6666935", "0.6641429", "0.6614348", "0.66029656", "0.6522238", "0.6509535", "0.6413506", "0.6413506", "0.6399048", "0.63777286", "0.6352311", "0.62734455", "0.6260855", "0.6236484", "0.6211403", "0.62006044", "0.61995023", "0.61718637", "0.616208", "0.6125638", "0.6112397", "0.61075205", "0.61013675", "0.60924035", "0.60910475", "0.60667115", "0.6061982", "0.6043805", "0.6034656", "0.60265803", "0.6021573", "0.60154134", "0.60089487", "0.6003371", "0.6000911", "0.597982", "0.59751725", "0.5967182", "0.59648305", "0.5962982", "0.5950497", "0.5950018", "0.5949863", "0.59434974", "0.59418947", "0.59368384", "0.59358853", "0.59142137", "0.59095454", "0.5909256", "0.59007144", "0.5883011", "0.58772415", "0.5874877", "0.5871615", "0.5863631", "0.58608484", "0.5848665", "0.5845084", "0.5842512", "0.5841833", "0.584176", "0.58389163", "0.58381087", "0.58362776", "0.58346254", "0.58336323", "0.5828355", "0.5823657", "0.5821635", "0.5820958", "0.58170444", "0.58120656", "0.58120656", "0.58044696", "0.5796226", "0.5794266", "0.57935375", "0.5790982", "0.5790455", "0.5790327", "0.5786664", "0.5783925", "0.57807416", "0.5764446", "0.5762486", "0.5760159", "0.57568854", "0.57536286", "0.57533276", "0.57508796", "0.57499653", "0.57409996", "0.5738727", "0.5736391", "0.5725756", "0.57221663" ]
0.0
-1
This is the keyup handling function for the SVG document
function keyup(evt) { // Get the key code var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode(); switch (keyCode) { case "N".charCodeAt(0): if (player.motion == motionType.LEFT) player.motion = motionType.NONE; break; case "M".charCodeAt(0): if (player.motion == motionType.RIGHT) player.motion = motionType.NONE; break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function d3_keyup() {\n\n lastKeyDown = -1;\n // ctrl\n if (!d3.event.ctrlKey) {\n rect.on('mousedown.drag', null)\n .on('touchstart.drag', null);\n svg.classed('ctrl', false);\n }\n}", "svgKeyDown() {\n\t\tlet {internalFlags, constants} = this;\n\t\t// make sure repeated key presses don't register for each keydown\n\t\tif (internalFlags.lastKeyDown !== -1) return;\n\n\t\tinternalFlags.lastKeyDown = d3.event.keyCode;\n\t\tvar selectedEdge = internalFlags.selectedEdge;\n\t\t// var selectedNode = internalFlags.selectedNode;\n\n\t\tswitch (d3.event.keyCode) {\n\t\t\tcase constants.BACKSPACE_KEY:\n\t\t\tcase constants.DELETE_KEY:\n\t\t\t\td3.event.preventDefault();\n\t\t\t\tif (selectedEdge) {\n\t\t\t\t\tthis.deleteEdge(selectedEdge);\n\t\t\t\t// } else if (selectedNode){\n\t\t\t\t// \tthis.deleteNode(selectedNode);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}", "function svgKeyDown() {\n var thisGraph = this,\n state = thisGraph.state,\n consts = thisGraph.consts;\n\n state.lastKeyDown = d3.event.keyCode;\n var selectedNode = state.selectedNode,\n selectedEdge = state.selectedEdge;\n\n switch(d3.event.keyCode) {\n case consts.BACKSPACE_KEY:\n case consts.DELETE_KEY:\n d3.event.preventDefault();\n if (selectedNode){\n thisGraph.nodes.splice(thisGraph.nodes.indexOf(selectedNode), 1);\n thisGraph.spliceLinksForNode(selectedNode);\n state.selectedNode = null;\n thisGraph.updateGraph();\n } else if (selectedEdge){\n thisGraph.edges.splice(thisGraph.edges.indexOf(selectedEdge), 1);\n state.selectedEdge = null;\n thisGraph.updateGraph();\n }\n break;\n }\n }", "function keydown() {\n if (d3.event.keyCode == 90) {\n if (d3.event.shiftKey) {\n scale = scale * 2;\n if (scale > 1) scale = 1;\n } else {\n scale = scale / 2;\n if (scale < 0.0625) scale = 0.0625;\n }\n update();\n }\n if (keyAlreadyDown) {\n return false;\n }\n keyAlreadyDown = true;\n if (d3.event.keyCode == 16) {\n // shift\n d3.event.preventDefault();\n deleteLine = true;\n } \n return svg;\n }", "function keydown() {\n switch (d3.event.keyCode) {\n case 8: // backspace\n {\n break;\n }\n case 46: { // delete\n delete_node = true;\n break;\n }\n case 16: { //shift\n should_modify = true;\n break;\n }\n case 17: { //control\n drawing_line = true;\n }\n\n }\n}", "function redraw() {\n if (mainSvg == null)\n return;\n let textfield = document.querySelector(\"#textfield\");\n let sentence = Parse.ParseSentence(textfield.value);\n Render.render(mainSvg, sentence);\n if (downloadButton != null)\n downloadButton.disabled = false;\n}", "function handleSvgMapKeypress(e) {\n if (e.key.toLowerCase() === \"enter\") {\n e.preventDefault();\n loadMapText(this);\n }\n }", "onElementKeyUp(event) {}", "onElementKeyUp(event) {}", "keyPress(ev) {\n if (!Notey.mouseEvent) return;\n ev.stopPropagation();\n if ((this._keyX != Notey.mouseEvent.offsetX) || (this._keyY != Notey.mouseEvent.offsetY)) {\n this._keyX = Notey.mouseEvent.offsetX;\n this._keyY = Notey.mouseEvent.offsetY;\n this._keyText = '';\n if (ev.keyCode > 31) this._keyText = ev.key;\n } else if ((ev.keyCode > 31) && (this._keyText != undefined)) {\n this._keyText += ev.key;\n } else if ((ev.keyCode == 8) && (this._keyText.length > 0)) {\n this._keyText = this._keyText.substring(0, this._keyText.length - 1);\n } else {\n return;\n }\n if (this._keyText == undefined) return;\n//console.log('%d (%d,%d) %s', ev.keyCode, this._keyX, this._keyY, this._keyText);\n var tid = 'text-' + this._keyX + '-' + this._keyY;\n var tel = this.svg.getElementById(tid);\n if (!tel) {\n tel = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n tel.id = tid;\n tel.setAttribute('class', 'notey-svg-text');\n tel.setAttribute('fill', (this.strokeColorId ? Notey.colorChoices[this.strokeColorId] : '#000'));\n tel.setAttribute('x', this._keyX);\n tel.setAttribute('y', this._keyY);\n this.svg.appendChild(tel);\n }\n Notey._needTextSave = this;\n tel.innerHTML = this._keyText;\n }", "function d3_svg_brushKeyup(e) {\n if (e.keyCode === 32 && d3_svg_brushDrag === 2) {\n d3_svg_brushOffset[0] += d3_svg_brushExtent[1][0];\n d3_svg_brushOffset[1] += d3_svg_brushExtent[1][1];\n d3_svg_brushDrag = 0;\n e.stopPropagation();\n }\n}", "onElementKeyPress(event) {}", "onElementKeyPress(event) {}", "function handleInput(e) {\n clearTimeout(timeoutID);\n svg.setAttribute('viewBox', '21 0 21 31');\n section.innerHTML = '';\n\n // after an arbitrary delay extract the value and pass it as the argument for the matching function\n timeoutID = setTimeout(() => {\n clearTimeout(timeoutID);\n const { value } = e.target;\n\n if (value) {\n handleValue(value);\n } else {\n section.innerHTML = '';\n }\n handleValue(value);\n }, 1000);\n}", "function onMouseUp(event) {\n if(currentColor !== \"#ffffff\"){\n path.simplify(30);\n }\n if(path.segments.length === 1) {\n path.add(event.point);\n }\n var svg = decodeURI(project.exportSVG({asString: true}));\n document.getElementById(\"output\").innerHTML = svg;\n}", "_keyupHandler() {\n\t\tthis._error.classList.remove('shown');\n\n\t\tthis.convertInputValue();\n\t}", "handleInput(key) {\n if (this.x > 0 && key === 'left') {\n this.x -= 101;\n }\n\n if (this.x < 404 && key === 'right') {\n this.x += 101;\n }\n\n if (this.y > 0 && key === 'up') {\n this.y -= 83;\n }\n\n if (this.y < 395 && key === 'down') {\n this.y += 83;\n }\n }", "function render( w ){\r\n\r\n \r\n // append the svg object to the body of the page\r\n var svg = d3.select(\"#screen\")\r\n .append(\"svg\")\r\n .attr(\"width\", BGWIDTH)\r\n .attr(\"height\", BGHEIGHT)\r\n .attr(\"fill\", \"#00ff00\")\r\n .attr(\"background\", \"#00ff00\");\r\n\r\n //takes in keyboard input\r\n d3.select(\"body\")\r\n .on(\"keyup\", function() {\r\n if(d3.event.key == \"Backspace\" && inputstring[typedTo] != \"\"){\r\n inputstring[typedTo] = inputstring[typedTo].substring(0,inputstring[typedTo].length-1)\r\n }else if(d3.event.key.length == 1){\r\n inputstring[typedTo] = inputstring[typedTo] + d3.event.key\r\n }\r\n if(editingPoly != -1){\r\n updateExpUI(svg);\r\n }\r\n });\r\n \r\n svg.append(\"rect\")\r\n .attr(\"width\", \"100%\")\r\n .attr(\"height\", \"100%\")\r\n .attr(\"fill\", \"brown\")\r\n .on(\"click\", function(d){ editingPic = -1;\r\n editingPoly = -1;\r\n update()});\r\n\r\n\r\n //images\r\n var imgs = svg.selectAll(\"image\")\r\n .data(pictureArray.filter(function(d){\r\n return d[3] == curentWindow\r\n }))\r\n .enter()\r\n .append(\"svg:image\")\r\n .attr(\"xlink:href\", d => d[4])\r\n .attr(\"x\", d => d[0])\r\n .attr(\"y\", d => d[1])\r\n .attr(\"width\", d => d[2])\r\n .on(\"click\", d => makeEditBoxes(d));\r\n\r\n\r\n //polygons\r\n var polys = svg.selectAll(\"dot\")\r\n .data(polygonArray.filter(function(d){\r\n return d[4] == curentWindow\r\n }))\r\n .enter()\r\n .append(\"polygon\")\r\n .attr(\"points\", d => d[0])\r\n .attr(\"fill-opacity\", d => d[2])\r\n .attr(\"fill\", d => d[3])\r\n .attr(\"stroke\", \"#112131\")\r\n .attr(\"stroke-width\", function(d){\r\n if(d[5] == editingPoly){\r\n return 10\r\n }else{\r\n return 0\r\n }\r\n })\r\n .attr(\"stroke-opacity\", function(d){\r\n if(d[2]<.75){\r\n return 1\r\n }else{\r\n return d[2]\r\n }\r\n })\r\n .on(\"click\", d => polyClicked(d))\r\n .on(\"dblclick\", d => polyDblClicked(d));\r\n\r\n\r\n renderEditBoxes(svg);\r\n\r\n\r\n \r\n\r\n makeUI(svg);\r\n\r\n //checks if it is scrolling\r\n window.addEventListener(\"scroll\", function(e) {scrolling(e, svg)})\r\n\r\n \r\n \r\n}", "_keyUpHandler(event) {\n const that = this,\n key = event.key;\n\n switch (key) {\n case 'ArrowLeft':\n case 'ArrowUp':\n case 'ArrowDown':\n that._handlePointerInEscapedSymbol();\n break;\n case 'ArrowRight':\n that._handlePointerInEscapedSymbol('next');\n break;\n }\n\n that._autoExpandUpdate();\n that._userValue = that.displayMode === 'escaped' ? that._toDefaultDisplayMode(that.$.input.value) : that.$.input.value;\n\n that._submitKeyUpHandler();\n }", "function create_key() {\n for (var x = 0; x < Math.sqrt(COLOR_LIST.length); x++){\n for (var y = 0; y < Math.sqrt(COLOR_LIST.length); y++) {\n keySvg.append(\"rect\")\n .attr(\"id\", \"Square\" + x + \"_\" + y)\n .attr(\"width\", SQUARE_SIZE)\n .attr(\"height\", SQUARE_SIZE)\n .attr(\"x\", BASE_X + SQUARE_SIZE * x + SPACE * x)\n .attr(\"y\", keySvg.node().getBoundingClientRect().height*.9 - TEXT_HEIGHT - SQUARE_SIZE * y - SPACE * y)\n .attr(\"fill\", color_matrix[x][y])\n }\n }\n keySvg.append(\"text\")\n .style(\"fill\", \"black\")\n .style(\"font-family\", FONT)\n .style(\"font-size\", \"15px\")\n .attr(\"y\", BASE_X - 10)\n .attr(\"x\", 0 - BASE_X * 1.2)\n .attr(\"text-anchor\", \"middle\")\n .attr(\"transform\", \"rotate(270)\")\n .text(\"Emissions\");\n keySvg.append(\"text\")\n .style(\"fill\", \"black\")\n .style(\"font-family\", FONT)\n .style(\"font-size\", \"15px\")\n .attr(\"x\", keySvg.node().getBoundingClientRect().width * .41)\n .attr(\"y\", keySvg.node().getBoundingClientRect().height * .87)\n .attr(\"text-anchor\", \"middle\")\n .text(\"Risk Index\");\n}", "handleInput(key) {\n if (key === 'right' && this.x < 404) {\n this.x += 101;\n } else if (key === 'left' && this.x > 0) {\n this.x -= 101;\n } else if (key === 'up' && this.y > 0) {\n this.y -= 83;\n } else if (key === 'down' && this.y < 315) {\n this.y += 83;\n }\n }", "function toChangePitchData(){\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n createSVGOutput();\n}", "_setSvgClickHandler() {\n\t this.svg.addEventListener('click', (ev) => {\n\t if (\n\t !ev.target.closest('svg').matches('[or-readonly]') &&\n\t (ev.target.matches(SELECTORS) || ev.target.closest(SELECTORS))\n\t ) {\n\t const id = ev.target.id || ev.target.closest('g[id]').id;\n\t const input = this._getInput(id);\n\t if (input) {\n\t input.checked = !input.checked;\n\t input.dispatchEvent(events.Change());\n\t input.dispatchEvent(events.FakeFocus());\n\t }\n\t }\n\t });\n\t }", "function handleSVGClick(event) {\n // Figure out what was clicked\n var clickedNode = event.target;\n if (clickedNode.correspondingUseElement) {\n // If it's an instantiation of a <defs> item, let's target the <use> (aka the instance)\n // (TODO: option to target the node inside <defs> instead, via correspondingElement)\n clickedNode = clickedNode.correspondingUseElement;\n }\n \n // Generate ancestor chain of the clicked node\n var nodeChain = [];\n var svgRoot = event.currentTarget;\n var node = clickedNode;\n while (node && node !== svgRoot) {\n nodeChain.unshift(node);\n node = node.parentElement;\n }\n// console.log(\"CLICK on\", event.target);\n// console.log(\"nodeChain =\", nodeChain);\n \n // Generate nth-child lookup info\n var chain = [];\n nodeChain.forEach(function (node) {\n var childIndex = $(node).index();\n chain.push({ childIndex: childIndex, tagName: node.tagName });\n \n// console.log(node.tagName + \", child #\" + childIndex);\n });\n \n // Find that same tag in the code\n var startOfOpenTag = XMLPathFinder.findTag(currentEditor, chain);\n if (startOfOpenTag) {\n // Select it\n var lineNum = startOfOpenTag.pos.line;\n var token = startOfOpenTag.token;\n currentEditor.setSelection({line: lineNum, ch: token.start}, {line: lineNum, ch: token.end}, true);\n }\n }", "function documentKeyUp (e) {\n // console.log(e.keyCode);\n\n // This is a callback method that is triggered when a keyDown event occurs.\n if (!status.focusOnTextField) {\n if ('tracker' in svl) {\n svl.tracker.push('KeyUp', {'keyCode': e.keyCode});\n }\n switch (e.keyCode) {\n case 16:\n // \"Shift\"\n status.shiftDown = false;\n break;\n case 27:\n // \"Escape\"\n if (svl.canvas.getStatus('drawing')) {\n svl.canvas.cancelDrawing();\n } else {\n svl.ribbon.backToWalk();\n }\n break;\n case 49:\n // \"1\"\n svl.ribbon.modeSwitchClick(\"CurbRamp\");\n break;\n case 50:\n // \"2\"\n svl.ribbon.modeSwitchClick(\"NoCurbRamp\");\n break;\n case 51:\n // \"3\"\n svl.ribbon.modeSwitchClick(\"Obstacle\");\n break;\n case 52:\n // \"4\"\n svl.ribbon.modeSwitchClick(\"SurfaceProblem\");\n break;\n case 67:\n // \"c\" for CurbRamp. Switch the mode to the CurbRamp labeling mode.\n svl.ribbon.modeSwitchClick(\"CurbRamp\");\n break\n case 69:\n // \"e\" for Explore. Switch the mode to Walk (camera) mode.\n svl.ribbon.modeSwitchClick(\"Walk\");\n break;\n case 77:\n // \"m\" for MissingCurbRamp. Switch the mode to the MissingCurbRamp labeling mode.\n svl.ribbon.modeSwitchClick(\"NoCurbRamp\");\n break;\n case 79:\n // \"o\" for Obstacle\n svl.ribbon.modeSwitchClick(\"Obstacle\");\n break;\n case 83:\n svl.ribbon.modeSwitchClick(\"SurfaceProblem\");\n break;\n case 90:\n // \"z\" for zoom. By default, it will zoom in. If \"shift\" is down, it will zoom out.\n if (status.shiftDown) {\n // Zoom out\n if (\"zoomControl\" in svl) {\n svl.zoomControl.zoomOut();\n }\n } else {\n // Zoom in\n if (\"zoomControl\" in svl)\n svl.zoomControl.zoomIn();\n }\n }\n }\n }", "function d3_keydown() {\n\n var event = d3.event;\n lastKeyDown = event.keyCode;\n\n if (event.ctrlKey) {\n switch (lastKeyDown) {\n // Ctrl - drag nodes\n case 17:\n {\n rect.call(force.drag);\n svg.classed('ctrl', true);\n break;\n }\n // Ctrl+Z - undo\n case 90:\n {\n undo();\n break;\n }\n // Ctrl+Y - redo\n case 89:\n {\n redo();\n break;\n }\n // Ctrl+S - save\n case 83:\n {\n saveChanges(plantaID);\n break;\n }\n // Ctrl+O - open\n case 79:\n {\n loadInterface();\n break;\n }\n }\n } else {\n // Delete - delete node\n if (lastKeyDown == 46) {\n // nothing selected\n if (!selected_node && !selected_link)\n return;\n // delete node\n if (selected_node) {\n deleteNode(selected_node);\n removeInfoBox();\n }\n // delete link\n else if (selected_link) {\n deleteLink();\n removeInfoBox();\n }\n selected_node = null;\n restart();\n }\n }\n}", "function keyupListener() {\n window.onkeyup = function (e) {\n if (e.keyCode === 27) {\n toggleMenuOff();\n selectedImg = null;\n }\n }\n }", "function inputKeyUp(e) {\n var content = getContentElement().value;\n qrcode.makeCode(content);\n }", "function readyStart(svg){\n\t\n\n svg.input.textArea(18, 10, \"It Takes Carbon Fiber and Kevlar to Make the Best Basketball Shoes in the World\", {width: '200', class: 'heading'});\n \n svg.input.textArea(18, 97, \"When you look at basketball shoes, what do you see? A big swoosh. Three stripes. Michael Jordan. A billboard molded to your feet. But do you see the technology? Though maybe not as blatant as an Intel sticker on your laptop, every shoe showcases its own advanced technology. Don't worry, you can't miss it on these, the best basketball shoes on the planet. Because they roll with carbon fiber and Kevlar.\", {width: '200'});\n\n svg.input.list(228, 10, 'Nullam eget purus enim, quis faucibus sapien. \\nVivamus semper nulla vel sapien fringilla ullamcorper. \\nIn hac habitasse platea dictumst. ',{width: '150'});\n svg.input.list(228, 100, 'Nullam eget purus enim, quis faucibus sapien. \\nVivamus semper nulla vel sapien fringilla ullamcorper. \\nIn hac habitasse platea dictumst. ',{width: '150'});\n\t\n\t\n\t$('.svg-container').transition({ x: '0', y: '20px', height: '400px'}, 1000, 'snap');\n\t\n\t$('.view .message').removeClass('loading');\n\n\t\n}", "static keydown_on_xy_square_action(event){\n //ebugger;\n let [key, sign] = this.convert_key_and_sign(event.key)\n //out(key + \" \" + sign)\n let dui_instance = dui2.dui_instance_under_mouse()\n if (!dui_instance) {\n warning(\"To use the keyboard to control the Dexter User Inferface,<br/>\" +\n \"the mouse must be in the dialog box.\")\n return\n }\n else if((key === \"Shift\") && (sign === null)) { return } // a no-op. don't even print warning\n let x = dui_instance.xyz[0]\n let y = dui_instance.xyz[1]\n let z = dui_instance.xyz[2]\n let xyz = [x,y,z]\n let j_angles\n //out(\"got key \" + key, undefined, true)\n //this.xyz_key_increment = 0.001\n //this set of if..else sets j_angles to new values, OR returns from fn because a\n //key was pressed that does nothing\n if (typeof(key) === \"number\") { //got joint key\n let joint_number = key\n if (dui_instance.should_point_down && ((joint_number == 4) || joint_number == 5)) {\n warning(\"You can't change Joint 4 or 5 when you have 'Point Down' checked.\")\n return\n }\n this.set_new_joint_increment()\n //out(\"new joint increment: \" + this.joint_key_increment, undefined, true)\n //let is_shift = event.shiftKey\n j_angles = dui_instance.maj_angles\n let old_joint_degrees = j_angles[joint_number - 1]\n if(Number.isNaN(old_joint_degrees)) { old_joint_degrees = 0 } //shouldn't be necessary but makes it more robust\n let j_inc = this.joint_key_increment * sign\n let new_joint_degrees = old_joint_degrees + j_inc\n j_angles[joint_number - 1] = new_joint_degrees\n try {\n Kin.J_angles_to_xyz(j_angles) //returns just 5 angles\n }\n catch(err){\n warning(\"Sorry, Dexter can't go to Joint \" + joint_number + \" angle: \" + new_joint_degrees +\n \" given the other joint angles.\")\n return\n }\n }\n else if((key === \"r\") || (key === \"v\")) { //roll\n j_angles = dui_instance.maj_angles\n this.set_new_joint_increment()\n let old_j6 = j_angles[5]\n let old_roll = Kin.J6_to_roll(xyz, old_j6)\n let roll_inc = this.joint_key_increment * sign\n let new_roll = old_roll + roll_inc\n let new_J6 = Kin.roll_to_J6(xyz, new_roll)\n j_angles[5] = new_J6\n }\n else {\n this.set_new_xyz_increment()\n if((key === \"ArrowRight\") || (key === \"d\")){\n x += this.xyz_key_increment\n }\n else if((key === \"ArrowLeft\") || (key === \"a\")) {\n x -= this.xyz_key_increment\n }\n else if((key === \"ArrowUp\") || (key === \"w\")){\n y += this.xyz_key_increment\n }\n else if((key === \"ArrowDown\") || (key === \"s\")){\n y -= this.xyz_key_increment\n }\n else if((key === \".\") || (key === \"e\")){ //z up\n z += this.xyz_key_increment\n }\n else if((key === \",\") || (key === \"c\")){\n z -= this.xyz_key_increment\n }\n else {\n warning(\"The key: \" + key + \" does nothing while the x-y square is selected.\")\n return\n } //ignore the key\n xyz = [x,y,z] //grab the new value for x, y, or z\n try {\n j_angles = Kin.xyz_to_J_angles(xyz, dui_instance.direction) //returns just 5 angles\n }\n catch(err) { //with the above test for new_xy_radius, this catch should never hit.\n if((key === \",\") || (key === \".\")){\n warning(\"Sorry, Dexter can't go to Z position: \" + z +\n \" given X position: \" + x +\n \" and Y position: \" + y)\n }\n else {\n warning(\"Sorry, Dexter can't go to X position: \" + x +\n \" and/or Y position: \" + y +\n \" given Z position: \" + z)\n }\n return\n }\n }\n //now j_angles is set, at least to 5 elts.\n //don't do set_maj_angles until we're sure that Kin.xyz_to_J_angles didn't error\n if(j_angles.length === 5) { j_angles.push(dui_instance.maj_angles[5]) } //joint 6 vals.j6_angle_num)\n if(j_angles.length === 6) { j_angles.push(dui_instance.maj_angles[6]) } //joint 7 vals.j7_angle_num) }\n dui_instance.set_maj_angles(j_angles)\n dui_instance.update_all(dui_instance.should_point_down) // do update_all before move_all_joints because update_all may modify ui2_instance.maj_angles if the direction_checkbox is checked\n let instr = dui_instance.make_move_instruction(dui_instance.maj_angles)\n //Job.insert_instruction(instr, {job: dui_instance.job_name, offset: \"end\"}) //todo overwrite\n Job[dui_instance.job_name].insert_last_instruction_overwrite(instr)\n }", "handleInput(keyCode) {\n switch (keyCode) {\n case 'up':\n if (this.y > 0) {\n this.y -= 83;\n }\n break;\n case 'down':\n if (this.y < 373.5) {\n this.y += 83;\n }\n break;\n case 'left':\n if (this.x > 0) {\n this.x -= 101;\n }\n break;\n case 'right':\n if (this.x < 404) {\n this.x += 101;\n }\n break;\n }\n }", "handleKeyUp(){\n\n }", "function key_up(){\n\n\tdrag_manager.active_key=null;\n\n}", "function UpAndDown(e){\n if (e.keyCode==38||e.keyCode==40){\n outline.OutlinerKeypressPanel(e); \n outline.UserInput.clearInputAndSave(); \n }\n }", "function KeyPressed(key) {\n if (document.getElementById('FormulaDisplay').getElementsByTagName('span')[0].innerHTML != \"Formula\") {\n document.getElementById('FormulaDisplay').getElementsByTagName('span')[0].innerHTML += key;\n } else {\n document.getElementById('FormulaDisplay').getElementsByTagName('span')[0].innerHTML = key\n }\n}", "function keydown(evt) {\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n player.motion = motionType.LEFT;\r\n if(!playFaceLeft){\r\n var player1 = svgdoc.getElementById(\"playerExceptname\");\r\n player1.setAttribute(\"transform\", \"translate(\" +PLAYER_SIZE.w + \", 0) scale(-1,1)\");\r\n\r\n }\r\n playFaceLeft = true;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n player.motion = motionType.RIGHT;\r\n if(playFaceLeft){\r\n var player1 = svgdoc.getElementById(\"playerExceptname\");\r\n player1.setAttribute(\"transform\", \"translate(0, 0) scale(1,1)\");\r\n }\r\n playFaceLeft = false;\r\n break;\r\n\r\n case \"W\".charCodeAt(0):\r\n if (cheat || player.isOnPlatform()) {\r\n player.verticalSpeed = JUMP_SPEED;\r\n }\r\n break;\r\n case 32:\r\n if(canShoot)\r\n shootBullet();\r\n break;\r\n case \"C\".charCodeAt(0):\r\n cheat = true;\r\n var player2 = svgdoc.getElementById(\"playerExceptname\");\r\n player2.setAttribute(\"style\", \"opacity:0.5\");\r\n break;\r\n case \"V\".charCodeAt(0):\r\n cheat = false;\r\n var player2 = svgdoc.getElementById(\"playerExceptname\");\r\n player2.setAttribute(\"style\", \"opacity:1\");\r\n break;\r\n\r\n }\r\n}", "function onKeyDown(event){\n\tif(event.key=='space'){\n\t\tnode = new Path.Circle(new Point(mousePosition.point), 50);\n\t\tnode.fillColor='black';\n\t}\n}", "handleInput(keypress){\n if (keypress === 'left') {\n this.x -= 100;\n }\n else if (keypress === 'up') {\n this.y -= 90;\n }\n else if (keypress === 'right') {\n this.x += 100;\n }\n else if (keypress === 'down') {\n this.y += 90;\n }\n }", "function keyup_handler(event)\n{\n\tgame.handle_key(event.code, false);\n}", "drawSvg() {\n \n\t}", "function whiteboard_mouseup() {\n\n // definir a dimensão da régua\n if (scaling) {\n\n scaling = false;\n\n // construir html\n var body =\n '<div class=\"input-group input-group-sm\">' +\n '<span class=\"input-group-addon\"><label for=\"nodeHeight\">Tamanho</label></span>' +\n '<input type=\"number\" class=\"form-control\" id=\"scalebar_dimension\" placeholder=\"Tamanho (cm)\">' +\n '<span class=\"input-group-addon\">cm</span>' +\n '</div>';\n\n var footer =\n '<button type=\"button\" class=\"btn btn-sm btn-default\" data-dismiss=\"modal\">Fechar</button>' +\n '<button type=\"button\" class=\"btn btn-sm btn-primary\" onclick=\"updateScale()\">Guardar</button>';\n\n var modalClass = 'modal-sm';\n\n buildModal('Tamanho a representar', body, footer, modalClass);\n }\n\n // posicionar nó\n if (draggingNode) {\n draggingNode = false;\n saveOperation();\n }\n else if (mousedown_node)\n drag_line.classed('hidden', true); // hide drag line\n\n // because :active only works in WebKit?\n svg.classed('active', false);\n\n // clear mouse event vars\n resetMouseVars();\n}", "keyUp(_keycode) {}", "function key_press_observer() {\n var key_pressed_flag = false; //if key was pressed\n document.onkeydown = function(e){\n if(!key_pressed_flag) {\n if(e.which == \"37\" || e.which == \"65\") {\n if(s[0].d != 'x') {\n s[0].d = '-x';\n }\n }\n\n if(e.which == \"39\" || e.which == \"68\") {\n if(s[0].d != '-x') {\n s[0].d = 'x';\n }\n }\n\n if(e.which == \"38\" || e.which == \"87\") {\n if(s[0].d != 'y') {\n s[0].d = '-y';\n }\n }\n\n if(e.which == \"40\" || e.which == \"83\") {\n if(s[0].d != '-y') {\n s[0].d = 'y';\n }\n }\n key_pressed_flag = true;\n }\n //alert(e.which);\n\n }\n document.onkeyup = function(e){\n key_pressed_flag = false;\n } \n}", "function onkey(event) {\n\n if (!(event.metaKey || event.altKey || event.ctrlKey)) {\n event.preventDefault();\n }\n\n if (event.charCode == 'z'.charCodeAt(0)) { // z\n controls.zeroSensor();\n } else if (event.charCode == 'f'.charCodeAt(0)) { // f\n effect.setFullScreen( true );\n } else if (event.charCode == 'w'.charCodeAt(0)) { // w - move a row up\n animator.changeRow( -1 );\n currentRow -= 1;\n } else if (event.charCode == 's'.charCodeAt(0)) { // s - move a row down\n animator.changeRow( 1 );\n currentRow += 1;\n } else if (event.charCode == 'a'.charCodeAt(0)) { // a - spin row left\n animator.spinRow( -1 );\n } else if (event.charCode == 'd'.charCodeAt(0)) { // d - spin row right\n animator.spinRow( 1 );\n }\n}", "function updateKey(e) {\n\n e = e || window.event;\n\n if (e.keyCode == '87') {\n // up (w)\n document.getElementById(\"upArrow\").style.color = \"green\";\n send_data(\"87\");\n }\n else if (e.keyCode == '83') {\n // down (s)\n document.getElementById(\"downArrow\").style.color = \"green\";\n send_data(\"83\");\n }\n else if (e.keyCode == '65') {\n // left (a)\n document.getElementById(\"leftArrow\").style.color = \"green\";\n send_data(\"65\");\n }\n else if (e.keyCode == '68') {\n // right (d)\n document.getElementById(\"rightArrow\").style.color = \"green\";\n send_data(\"68\");\n }\n else if (e.keyCode == '88') {\n // stop (x)\n document.getElementById(\"stopCircle\").style.color = \"green\";\n send_data(\"68\");\n }\n}", "function onKeyUpOnto(){\n d3.event.preventDefault();\n if(obj1Onto!=null){\n if(d3.event.keyCode==16){\n shiftOnto = false;\n }\n }\n}", "function onKeyUp(evt){\n if(evt.keyCode == 39) rightDown = false;\n if(evt.keyCode == 37) leftDown = false;\n if(evt.keyCode == 32) spacebarDown = false;\n if(evt.keyCode == 89) yDown = false;\n if(evt.keyCode == 78) nDown = false;\n }", "handleInput(keyCode) {\n\n switch (keyCode) {\n case 'left':\n if (this.x - 100 >= 0) {\n this.x -= 100;\n }\n break;\n case 'right':\n if (this.x + 100 <= 400) {\n this.x += 100;\n }\n break;\n case 'up':\n if (this.y - 80 >= -80) {\n this.y -= 80;\n }\n break;\n case 'down':\n if (this.y + 80 <= 440) {\n this.y += 80;\n }\n break;\n }\n }", "updateSVGSelf() {\n const text = this.svgElement;\n\n // set all of the font attributes, since we can't use the combined one\n if ( this.dirtyFont ) {\n text.setAttribute( 'font-family', this.node._font.getFamily() );\n text.setAttribute( 'font-size', this.node._font.getSize() );\n text.setAttribute( 'font-style', this.node._font.getStyle() );\n text.setAttribute( 'font-weight', this.node._font.getWeight() );\n text.setAttribute( 'font-stretch', this.node._font.getStretch() );\n }\n\n // update the text-node's value\n if ( this.dirtyText ) {\n text.lastChild.nodeValue = Utils.safariEmbeddingMarkWorkaround( this.node.renderedText );\n }\n\n // text length correction, tested with scenery/tests/text-quality-test.html to determine how to match Canvas/SVG rendering (and overall length)\n if ( this.dirtyBounds && useSVGTextLengthAdjustments ) {\n const useLengthAdjustment = this.node._boundsMethod !== 'accurate' && isFinite( this.node.selfBounds.width );\n\n if ( useLengthAdjustment ) {\n if ( !this.hasLength ) {\n this.hasLength = true;\n text.setAttribute( 'lengthAdjust', 'spacingAndGlyphs' );\n }\n text.setAttribute( 'textLength', this.node.selfBounds.width );\n }\n else if ( this.hasLength ) {\n this.hasLength = false;\n text.removeAttribute( 'lengthAdjust' );\n text.removeAttribute( 'textLength' );\n }\n }\n\n // Apply any fill/stroke changes to our element.\n this.updateFillStrokeStyle( text );\n }", "function onMouseup(){elements.input.focus();}", "initGlobalEvents(element = window){\n const self = this\n const { id } = this.options\n\n d3.select(element)\n .on('keydown.' + id, _ => {\n const { useZoom } = self.options\n const keyCode = d3.event.keyCode\n\n // horizontal (H) or vertical (V) zooming\n if ([72, 86].indexOf(keyCode) > -1 && self.keyPressed !== keyCode) {\n self.keyPressed = keyCode\n if (useZoom) self.updateZoom()\n return\n }\n\n // remove selected points (Backspace / Delete)\n if ([8, 46].indexOf(keyCode) > -1 && self.selectedIndices.length) {\n self.removeSelectedPoints()\n self.saveRender()\n return\n }\n\n // clear selection (Esc)\n if (keyCode === 27 && self.selectedIndices.length) {\n self.clearSelection()\n self.saveRender()\n return\n }\n })\n .on('keyup.' + id, _ => {\n const { useZoom } = self.options\n\n // horizontal (H) or vertical (V) zooming\n if ([72, 86].indexOf(d3.event.keyCode) > -1) {\n self.keyPressed = null\n if (useZoom) self.updateZoom()\n }\n })\n }", "function keyDown() {\n\t document.getElementById(\"firstname\").addEventListener(\"textInput\", green);\n\t document.getElementById(\"lastname\").addEventListener(\"textInput\", green2);\n\t document.getElementById(\"postcode\").addEventListener(\"textInput\", green3);\n\t document.getElementById(\"email\").addEventListener(\"textInput\", green4);\n\t document.getElementById(\"number\").addEventListener(\"textInput\", green5);\n\t document.getElementById(\"postcodeRequiredError\").style.display = \"none\";\n\t \n }", "onKeyup_document(event) {\n if(event.keyCode == 27) {\n this.onClick_cancel();\n }\n }", "function onSvgMousedown(e) {\n if (state.appMode === 'editing') {\n if (e.target.parentNode.tagName === 'g') {\n info.unload();\n state.selectedArea = e.target.parentNode.obj;\n \n app.deselectAll();\n state.selectedArea.select();\n state.selectedArea.delta = {\n 'x' : e.pageX,\n 'y' : e.pageY\n };\n \n if (e.target.classList.contains('helper')) {\n var helper = e.target;\n state.editType = helper.action;\n \n if (helper.n >= 0) { // if typeof selected_area == polygon\n state.selectedArea.selected_point = helper.n;\n }\n \n app.addEvent(domElements.container, 'mousemove', state.selectedArea.onEdit)\n .addEvent(domElements.container, 'mouseup', state.selectedArea.onEditStop);\n } else if (e.target.tagName === 'rect' || e.target.tagName === 'circle' || e.target.tagName === 'polygon') {\n state.editType = 'move';\n \n app.addEvent(domElements.container, 'mousemove', state.selectedArea.onEdit)\n .addEvent(domElements.container, 'mouseup', state.selectedArea.onEditStop);\n }\n } else {\n app.deselectAll();\n info.unload();\n }\n }\n }", "function d3_svg_brushKeydown(e) {\n if (e.keyCode === 32 && d3_svg_brushTarget && !d3_svg_brushDrag) {\n d3_svg_brushCenter = null;\n d3_svg_brushOffset[0] -= d3_svg_brushExtent[1][0];\n d3_svg_brushOffset[1] -= d3_svg_brushExtent[1][1];\n d3_svg_brushDrag = 2;\n e.stopPropagation();\n }\n}", "function userKeyup()\n{\n hasUserChanged = true;\n this.style.backgroundColor = \"rgb(63, 66, 69)\";\n}", "function onMouseup () {\n elements.input.focus();\n }", "function onMouseup () {\n elements.input.focus();\n }", "function onMouseup () {\n elements.input.focus();\n }", "function onMouseup () {\n elements.input.focus();\n }", "function keyPressed() { \n //when \"C\" is pressed, it erases everything the animation has drawn (basically draws\n //a black rectangle filling the entire document)\n if (keyCode == 67) { \n fill(30);\n rect(0,0,width, height);\n }; \n //when \"F\" is pressed, it freezes the frame (actually moves the location of the \n //y-coordinate outside the frame for the animation, and therefore cant be seen anymore)\n if (keyCode == 70) {\n y = y + 650;\n };\n}", "function mouseUp(event) {\n const key = keys[keyIndexById(this.id)].key;\n if (keyIsValid(key)) {\n removeActiveClasses(key);\n executeKey(key);\n }\n}", "attachKeyHandler(domElement) {\n var term = this;\n\n // character encodings for special characters (when no modifying \n // characters are pressed)\n const normalKeyMap = {\n Backspace : \"\\x7f\",\n Delete : \"\\x1b[3~\",\n Escape : \"\\x1b\",\n Tab : \"\\t\",\n Enter : \"\\r\",\n ArrowUp : \"\\x1b[A\",\n ArrowDown : \"\\x1b[B\",\n ArrowRight : \"\\x1b[C\",\n ArrowLeft : \"\\x1b[D\",\n PageUp : \"\\x1b[5~\",\n PageDown : \"\\x1b[6~\",\n Home : \"\\x1b[H\",\n End : \"\\x1b[F\",\n Insert : \"\\x1b[2~\",\n F1 : \"\\x1bOP\",\n F2 : \"\\x1bOQ\",\n F3 : \"\\x1bOR\",\n F4 : \"\\x1bOS\",\n F5 : \"\\x1b[15~\",\n F6 : \"\\x1b[17~\",\n F7 : \"\\x1b[18~\",\n F8 : \"\\x1b[19~\",\n F9 : \"\\x1b[20~\",\n F10 : \"\\x1b[21~\",\n F11 : \"\\x1b[23~\",\n F12 : \"\\x1b[24~\",\n };\n\n const handlerFunction = function(event) {\n event.preventDefault();\n var seq = \"\";\n\n if (event.key.length == 1 && !event.ctrlKey && !event.altKey) {\n // use the event key for non-special characters without modifier\n // keys\n seq = event.key;\n }\n else if (!event.ctrlKey && !event.altKey && !event.shiftKey) {\n // use the normal key map for special characters when no\n // modifier characters are down\n if (normalKeyMap[event.key]) {\n seq = normalKeyMap[event.key];\n }\n }\n else if (event.ctrlKey && !event.altKey) {\n if (event.key == '=') { // Zoom in handler\n term.redimension(\n terminal.fontSize * 1.2,\n terminal.pixWidth + 10,\n terminal.pixHeight + 10\n );\n return;\n }\n else if (event.key == '-') { // Zoom out handler\n term.redimension(\n terminal.fontSize / 1.2,\n terminal.pixWidth + 10,\n terminal.pixHeight + 10,\n );\n return;\n }\n else if (event.key == 'r' && event.ctrlKey) {\n // get rid of this if you want ctrl-r functionality\n // ctrl-shift-r still works\n }\n else if (event.key.length == 1) { // basic ASCII control codes\n var ascii = event.key.charCodeAt(0);\n\n if (ascii >= 0x40 && ascii <= 0x5F) {\n seq = String.fromCharCode(ascii - 0x40);\n }\n else if (ascii >= 0x61 && ascii <= 0x7A) {\n seq = String.fromCharCode(ascii - 0x60);\n }\n }\n }\n \n terminal.sendKeyboard(seq);\n }\n\n domElement.addEventListener('keydown', handlerFunction, true);\n }", "keyUpEventHandler() {\n if (this._containerElement.classList.contains(Input.FORM_GROUP_ERROR_CLASS)) {\n this.blurEventHandler();\n }\n }", "function drawKey() {\n var g = svg.append(\"g\")\n .attr(\"class\", \"key\")\n .attr(\"transform\", \"translate(40,50)\");\n\n g.selectAll(\"rect\")\n .data(color.range().map(function(d, i) {\n return {\n x0: i ? keyScale(color.domain()[i - 1]) : keyScale.range()[0],\n x1: i < color.domain().length ? keyScale(color.domain()[i]) : keyScale.range()[1],\n z: d\n };\n }))\n .enter().append(\"rect\")\n .attr(\"height\", 8)\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", 0.8)\n .attr(\"x\", function(d) {\n return d.x0;\n })\n .attr(\"width\", function(d) {\n return d.x1 - d.x0;\n })\n .style(\"fill\", function(d) {\n return d.z;\n });\n\n\n g.call(keyAxis).append(\"text\")\n .attr(\"class\", \"caption\")\n .attr(\"y\", 45)\n .attr(\"x\", -8)\n .attr(\"font-size\", 10)\n .text(\"Percentage of energy production from renewable sources\");\n}", "function keyUpHandler(e) {\n if (e.keyCode == 39) {\n rightPressed = false;\n } else if (e.keyCode == 37) {\n leftPressed = false;\n } else if (e.keyCode == 83) {\n sPressed = false;\n } else if (e.keyCode == 89) {\n drawBackstory();\n } else if (e.keyCode == 77){\n mutePressed = false;\n }\n }", "function mouseup(d) {\n if(mousedown_node) {\n // hide drag line\n drag_line\n .classed('hidden', true)\n .style('marker-end', '');\n }\n // because :active only works in WebKit?\n svg.classed('active', false);\n \n // clear mouse event vars\n resetMouseVars();\n }", "function checkKeyUp(ev) {\r\n switch (ev.keyCode) {\r\n case 40: g_UPkey = false; break; //Up Arrow Key\r\n case 38: g_DOWNkey = false; break; //Down Arrow Key\r\n case 39: g_RIGHTkey = false; break; //Right Arrow Key\r\n case 37: g_LEFTkey = false; break; //Left Arrow Key\r\n case 87: g_wKey = false; break; //W Key\r\n case 83: g_Skey = false; break; //S Key\r\n case 65: g_Akey = false; break; //A Key\r\n case 68: g_Dkey = false; break; //D Key\r\n case 32: g_SPACEkey = false; break; //Space Key\r\n case 67: g_Ckey = false; break; //C Key\r\n case 49: g_1Key = false; break; //1 Key\r\n case 50: g_2Key = false; break; //2 Key\r\n case 51: g_3Key = false; break; //3 Key\r\n case 52: g_4Key = false; break; //4 Key\r\n }\r\n}", "_textBoxKeyUpHandler() {\n const that = this;\n\n that.value = that._getValueWithTextMaskFormat({ start: 0, end: that._mask.length }, that.textMaskFormat);\n }", "function keydownResponse(event)\n{\n if (event.keyCode === 27)\n {\n // ESC button pressed\n highlightNodes.length = 0;\n highlightLinks.length = 0;\n }\n if (event.keyCode === 16 || event.keyCode === 17)\n {\n // Shift or Ctrl button pressed\n isMultiselect = true;\n }\n if (event.keyCode === 72)\n {\n // 'h' button pressed\n toggleHelpAboutPopUp(helpAboutDialog);\n }\n if (event.keyCode === 77)\n {\n // 'm' button pressed\n if (dagMode === null)\n {\n dagMode = 'radialin';\n }\n else if (dagMode === 'radialin')\n {\n dagMode = 'radialout';\n }\n else if (dagMode === 'radialout')\n {\n dagMode = null;\n }\n graph.dagMode(dagMode);\n }\n}", "function eventItemKeyUp(ui) {\n if (ui.object == \"grdData_Find\"){\n\t\tif (event.keyCode==17 || event.keyCode==13) {\n\t\t\tvar args = { bcode: gw_com_api.getValue( \"grdData_Find\", 1, \"incode\", true ) };\n\t\t\tprocessBarcode(args);\n\t\t}\n }\n}", "_documentMouseupHandler() {\n const that = this;\n\n that._up = true;\n that.$upButton.removeClass('jqx-numeric-text-box-pressed-component');\n that.$downButton.removeClass('jqx-numeric-text-box-pressed-component');\n }", "function keydown() {\r\n switch (d3.event.keyCode) {\r\n case 8: // backspace\r\n case 46: { // delete\r\n if (selected_node) { // deal with nodes\r\n var i = nodes.indexOf(selected_node);\r\n nodes.splice(i, 1);\r\n // find links to/from this node, and delete them too\r\n var new_links = [];\r\n links.forEach(function(l) {\r\n if (l.source !== selected_node && l.target !== selected_node) {\r\n\t\t\tl.value = 1;\r\n new_links.push(l);\r\n }\r\n });\r\n links = new_links;\r\n selected_node = nodes.length ? nodes[i > 0 ? i - 1 : 0] : null;\r\n } else if (selected_link) { // deal with links\r\n var i = links.indexOf(selected_link);\r\n links.splice(i, 1);\r\n selected_link = links.length ? links[i > 0 ? i - 1 : 0] : null;\r\n }\r\n update();\r\n break;\r\n }\r\n case 16: { // shift\r\n should_drag = true;\r\n break;\r\n }\r\n }\r\n}", "function mouseUp(ev) {\n startPoint = null;\n\n if (polygonGraphic != null) {\n updateActivePolygonText(polygonGraphic.geometry);\n }\n}", "handleInput(keyPress) {\n if (keyPress === 'left' && this.x > 100) {\n this.x -= 101;\n }\n else if (keyPress === 'right' && this.x < 400) {\n this.x += 101;\n }\n else if (keyPress === 'up' && this.y > 0) {\n this.y -= 83;\n }\n else if (keyPress === 'down' && this.y < 400) {\n this.y += 83;\n }\n }", "function keyPressed() {\n\t\n if( key === 's' || key === 'S' ) {\n\n save();\n \n }else if( key === 'z' || key === 'Z' ) {\n toggleGrid();\n }else if( key === 'x' || key === 'X' ) {\n toggleQuarterLine();\n }\n\n}", "function canvasHandleKeyUp(e){\r\n\tvar key = e.keyCode;\r\n\tif(useStates){\r\n\t\tStates.current().input.handleKeyUp(e);\r\n\t}\r\n\tgInput.handleKeyUp(e);\r\n}", "function keyupFunction() {\n var self = this;\n var selector = settings.inputs[self.id];\n searchConstraints[selector] = $(self).val().toLowerCase();\n toggle();\n }", "function up(event) {\r\n var points_array = $(\"#poly\").attr('points').split(' ');\r\n if (createRect) {\r\n if (points_array[0] == points_array[2]) {\r\n // if selected ROI is a point, not a rectangle, don't show anythings.\r\n $(\"#poly\").attr('points', '0,0 0,0 0,0 0,0')\r\n $('#first_poly_point').attr('r', '0')\r\n $('#second_poly_point').attr('r', '0')\r\n $('#third_poly_point').attr('r', '0')\r\n $('#fourth_poly_point').attr('r', '0')\r\n }\r\n else {\r\n // if selected ROI is rectangle, show the border of it.\r\n border($(\"#poly\"), 'add');\r\n }\r\n }\r\n \r\n if (createRect || moveEndPoint)\r\n {\r\n // set the selected ROI in submitting form when finish adjusting ROI\r\n normalized_points = normalizeResolution(points_array)\r\n $('#id_region_of_interest').val('{ \"first_point\":\"' + normalized_points[0] + '\", \"second_point\":\"' + normalized_points[1] + '\", \"third_point\":\"' + normalized_points[2] + '\", \"fourth_point\":\"' + normalized_points[3] + '\" }')\r\n }\r\n\r\n // disable every click events\r\n createRect = false;\r\n moveEndPoint = false;\r\n}", "function update_text_display(){\n svg_element = document.getElementById('svg_container')\n var new_text = document.getElementById('animation_text_input').value;\n\n svg_text_element = document.getElementById('animation_text');\n document.getElementById('text_group').innerHTML = \"\"; //clear the text\n num_colours = colours.length //fixing this number to recreate the example on codepen\n\n var selected_font = document.getElementById('font_select').value;\n console.log('here');\n\n for (var colour_num = 0; colour_num < num_colours; colour_num++){\n var svg_text_element = document.createElementNS(svgns, \"text\"); //create an svg text element that the user's text will be put into\n document.getElementById('text_group').append(svg_text_element); \n svg_text_element.innerHTML = new_text;\n svg_text_element.setAttribute(\"class\", \"text--line text-copy \" + selected_font); //add css class \n }\n}", "_inputKeyupHandler(event) {\n const that = this;\n\n if (event.keyCode === 13) {\n // when Enter is pressed, validation occurs\n that._suppressBlurEvent = true;\n\n if (that.$.input.value !== that._cachedInputValue) {\n that._triggerChangeEvent = true;\n that._validate();\n that._triggerChangeEvent = false;\n that.$.input.blur();\n }\n }\n else if (event.keyCode === 27) {\n // when Escape is pressed, changes are discarded\n that.$.input.value = that._editableValue;\n }\n else {\n const inputValue = that.$.input.value;\n\n if (inputValue !== '' && that._regex[that._radixNumber].test(inputValue)) {\n that.$.upButton.disabled = false;\n that.$.downButton.disabled = false;\n }\n else if (inputValue === '') {\n that.$.upButton.disabled = true;\n that.$.downButton.disabled = true;\n }\n\n if (that._keydownInfo &&\n that._keydownInfo.value !== inputValue &&\n !that._keydownInfo.specialKey &&\n !event.altKey && !event.ctrlKey && !event.shiftKey &&\n event.key !== 'Control') {\n that.$.fireEvent('changing', { 'currentValue': inputValue, 'validValue': that.value, 'radix': that._radixNumber });\n }\n }\n\n event.preventDefault();\n }", "function handlerUserInput() {\n\tdocument.addEventListener('keyup', function(event) {\n\t\tconsole.log(event);\n\t\tconsole.log(event.key); //k\n\t});\n}", "function doInitialization() {\n\t\tvar svg = \"\";\n\n\t\tif (typeof theSvgElement === \"undefined\") {\n\t\t\t// Add event to body: each time a key is hit -> launch function 'doUpdate'\n\t\t\tdocument.body.addEventListener(\"keyup\", doUpdate, false);\n\n\t\t\t// Open new window for drawing\n\t\t\tvar myWindow = window.open('', 'Drawing', \"width=\" + WINDOWS_WIDTH + \", height=450\", '');\n\t\t\tmyWindow.document.open();\n\t\t\tmyWindow.document.writeln('<h2>Drawing</h2>');\n\t\t\tmyWindow.document.writeln('<div id=\\\"drawing1\\\" style=\\\"width: 600px; height: 400px; border:1px solid black; \\\"></div>');\n\t\t\tmyDoc = myWindow.document;\n\t\t\tmyWindow.document.close();\n\n\n\t\t\tsvg = \"<svg style=\\\"display: inline; width: inherit; min-width: inherit; max-width: inherit; height: inherit; min-height: inherit; max-height: inherit;\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\" version=\\\"1.1\\\">\";\n\n\t\t\t// Add basic information about SVG drawing\n\t\t\tsvg += \"<title>\" + \"My drawing\" + \"</title>\";\n\t\t\tsvg += \"<desc>Write drawing description here...</desc>\";\n\n\t\t\tsvg += `<defs><style type=\"text/css\">\n\t\t\t\tpath.basicshape {\n\t\t\t\t\tstroke-width: 2;\n\t\t\t\t\tstroke: black;\n\t\t\t\t}\n\t\t\t\tline.dim {\n\t\t\t\t\tstroke-width: 1;\n\t\t\t\t}\n\t\t\t\tpath.squeleton {\n\t\t\t\t\tstroke: red;\n\t\t\t\t\tstroke-width: 1;\n\t\t\t\t\tfill: white;\n\t\t\t\t\tfill-opacity: 0.25;\n\t\t\t\t}\n\t\t\t\ttext.squeleton {\n\t\t\t\t\tfill: red;\n\t\t\t\t}\n\t\t\t\tcircle.centerfillet {\n\t\t\t\t\tfill: pink;\n\t\t\t\t\tstroke-width: 0;\n\t\t\t\t}\n\t\t\t\tcircle.origin {\n\t\t\t\t\tfill: blue;\n\t\t\t\t\tstroke-width: 0;\n\t\t\t\t}\n\t\t\t\tcircle.circleptsfilletg {\n\t\t\t\t\tfill: green;\n\t\t\t\t\tstroke-width: 0;\n\t\t\t\t}\n\t\t\t\tcircle.circleptsfillety {\n\t\t\t\t\tfill: yellow;\n\t\t\t\t\tstroke-width: 0;\n\t\t\t\t}\n\t\t\t\t</style></defs>\n\t\t\t\t`;\n\n\t\t\t// Add containers: dimension, origin and lines\n\t\t\tsvg += \"\\n<defs id=\\\"hatchpattern\\\" ></defs>\";\n\t\t\tsvg += \"\\n<g id=\\\"dimension\\\"></g>\";\n\t\t\tsvg += \"\\n<g id=\\\"origin\\\"></g>\";\n\t\t\tsvg += \"\\n</svg>\";\n\n\t\t\t// Draw SVG in MyDoc window\n\t\t\tmyDoc.getElementById(\"drawing1\").innerHTML = svg;\n\t\t\t// catch SVG in theSvgElement variable for further function\n\t\t\ttheSvgElement = myDoc.getElementsByTagName(\"svg\")[0];\n\n\t\t\t// Pattern for Arrow (marker) with default color value\n\t\t\tdoArrowpattern();\n\n\t\t}\n\n\t\t// Start function 'doUpdate' for the first time\n\t\tdoUpdate();\n\t}", "function keyupHandler() {\n\n var type;\n\n if (this.value !== valueKeyDown) {\n\n // Remove the placeholder\n this.className = this.className.replace(classNameRegExp, \"\");\n this.value = this.value.replace(this.getAttribute(\"placeholder\"), \"\");\n\n // Check if we need to switch the input type (this is the case if it's a password input)\n type = this.getAttribute(\"data-placeholdertype\");\n if (type) {\n this.type = type;\n }\n }\n if (this.value === \"\") {\n\n blurHandler.call(this);\n cursorToStart(this);\n }\n }", "draw() {\n this.canvas = SVG()\n .addTo('#roll-keyboard')\n .size(style.keyDisplay.width, editor.zoomY * editor.numKeys);\n this.svg = this.canvas\n for (let i = 0; i < editor.numKeys; i++) {\n let key = new PianoKey(i);\n key.draw(this.canvas);\n this.keys.push(key);\n }\n }", "function keyUp(event) {\n let key = event.key;\n key = standardizeKey(key);\n if (keyIsValid(key)) {\n removeActiveClasses(key);\n executeKey(key);\n }\n}", "function keyUpHandler(event) {\n //If the search text box has the focus\n var isSearchBoxFocus = false;\n\n isSearchBoxFocus = isFocusElement(idSearchBox);\n\n if (isSearchBoxFocus) {\n\n if (hasSearchBoxValueChanged())\n startTimer();\n }\n }", "updatex(){\n if (this.text == \"comp\" && this.x > 80)\n {\n this.x += -1;\n } \n if (this.text == \"form\" && this.x < 275)\n {\n this.x += +1;\n } \n\n if (this.text == \"comp\" && this.x == 80)\n {\n this.xallign = true;\n }\n\n if (this.text == \"comp\" && this.x == 275)\n {\n this.xallign = true;\n }\n}", "function documentKeyUpHandler(event) {\n switch(event.keyCode) {\n case game.char_space:\n // Space was pressed, start or pause/unpause the game\n if (!game.playing) {\n game.intro.hide();\n game.score.reset();\n game.playing = true;\n }\n else {\n if (!game.paused) {\n clearInterval(game.loopInterval);\n game.paused = true;\n }\n else {\n game.loopInterval = setInterval(loop, 1000 / game.framerate);\n game.paused = false;\n }\n }\n \n event.preventDefault();\n break;\n case game.char_p:\n // Toggle Particles\n game.particlesOn = !game.particlesOn;\n break;\n case game.char_s:\n // Toggle Self Play\n game.selfPlay = !game.selfPlay;\n break;\n }\n}", "function keyDownHandler (e){\r\n\tif (!box.close){\r\n\t\tif (e.keyCode === 32){\r\n\t\t\tcounter++;\r\n\t\t\tdrawBox();\r\n\t\t}\r\n\t} \r\n}", "handleInput(key) {\n //factor to move in x = 100\n //factor to move in y = 85\n if(this.live){ \n switch(key) {\n case 'left':\n (this.x - 100 >= 0) ? this.x -=100 : false;\n break;\n case 'right':\n (this.x + 100 < 500) ? this.x +=100 : false;\n break;\n case 'up':\n (this.y - 85 >= -15) ? this.y -=85 : false;\n break;\n case 'down':\n (this.y + 85 <= 410) ? this.y +=85 : false;\n break;\n default:\n false;\n }\n } else if(key == 'esc'){\n this.reset();\n }\n }", "function onKeyPress(ev) {\n if (ev.key === 'Enter') {\n // remove selection and current line\n gMeme.selectedLine.isSelected = false;\n gMeme.selectedLine = undefined;\n // get out of input\n var elInput = document.querySelector('.textInput');\n elInput.blur();\n // render text editor and meme\n renderMeme();\n renderTextEditor();\n }\n}", "async _evtKeyUp(event) {\n if (event.key == 'Enter') {\n const widget = this._shell.currentWidget;\n if (widget == null) {\n return;\n }\n const oldName = widget.title.label;\n const inputElement = this.inputElement;\n const newName = inputElement.value;\n inputElement.blur();\n if (newName !== oldName) {\n widget.title.label = newName;\n }\n else {\n inputElement.value = oldName;\n }\n }\n }", "function handleKeyDown(event) {\n if (!inputText) {\n return\n }\n switch (event.key) {\n case ' ':\n case ',':\n syncGeneArrayToInputText()\n setTimeout(() => {setInputText(' ')}, 0)\n }\n }", "function keyPressed() {\n // when the up arrow is pressed it increases the size\n if (keyCode === UP_ARROW) {\n size += 10;\n // when the down arrow is pressed it decreaces the size\n } else if (keyCode === DOWN_ARROW) {\n size -= 10;\n }\n // when the left arrow is pressed the type is set as a square\n if (keyCode === LEFT_ARROW) {\n type = 1;\n // when the right arrow is pressed the type is set as a circle\n } else if (keyCode === RIGHT_ARROW) {\n type = 2;\n }\n // when shift is pressed it clears the canvas\n else if (keyCode === SHIFT){\n clear();\n background(230);\n }\n}", "_onKeyPress(event) {\n\t\t$(\"#yearBox\").val('');\n\n\t\tif (event.charCode === 13) {\n\t\t\tthis._search();\n\t\t}\n\n\t\tthis.setState({useYear: false});\n\t}", "function keyReleased() {\n if (key != ' ') {\n granny.setDir(0);\n }\n}", "handleKey(ev) {\n if (['Backspace', 'Delete'].includes(ev.key)) {\n this.isBackspace = true;\n if (!this.value) {\n if (this.required) {\n this.isValid = false;\n this.element ?\n this.element.querySelector('textarea').setAttribute(ARIA_INVALID, 'true')\n :\n this.element.querySelector('textarea').setAttribute(ARIA_INVALID, 'true');\n }\n }\n }\n }", "function keyPressed() {\r\n if (keyCode === LEFT_ARROW) {\r\n frequency--;\r\n } else if (keyCode === RIGHT_ARROW) {\r\n frequency++;\r\n }\r\n if (keyCode === UP_ARROW) {\r\n amplitude += 10;\r\n } else if (keyCode === DOWN_ARROW) {\r\n amplitude -= 10;\r\n }\r\n if (keyCode === 87) {\r\n number_of_lines++;\r\n } else if (keyCode === 83) {\r\n number_of_lines--;\r\n }\r\n if (keyCode === 65) {\r\n phase -= 10;\r\n } else if (keyCode === 68) {\r\n phase += 10;\r\n }\r\n if (keyCode === 32) {\r\n color = random(100, 360);\r\n figure_code = ++figure_code % 3;\r\n }\r\n if (keyCode === 82) {\r\n amplitude = 200, frequency = 10, number_of_lines = 20, figure_code = 0, phase = 20;\r\n setup();\r\n }\r\n}", "keyupEventListener(event) {\n var key = event.keyCode;\n\n switch (key) {\n case this.keys.left:\n case this.keys.right:\n this.determineOrientation(event);\n break;\n };\n }", "keyupEventListener(event) {\n var key = event.keyCode;\n\n switch (key) {\n case this.keys.left:\n case this.keys.right:\n this.determineOrientation(event);\n break;\n };\n }" ]
[ "0.6739142", "0.6614581", "0.6191288", "0.6168498", "0.59431124", "0.5933358", "0.5899151", "0.5818731", "0.5818731", "0.5817197", "0.57678103", "0.5706828", "0.5706828", "0.57025915", "0.5670377", "0.566921", "0.5667128", "0.56633455", "0.56535095", "0.5624179", "0.5599112", "0.5589346", "0.55620575", "0.555338", "0.5516463", "0.5508676", "0.5505492", "0.5475519", "0.545721", "0.54164886", "0.54128104", "0.54124224", "0.54068416", "0.5406207", "0.54020905", "0.5399812", "0.539257", "0.53849566", "0.5378115", "0.53770167", "0.5369048", "0.53490037", "0.5345139", "0.5325205", "0.5303229", "0.5299677", "0.5291944", "0.52820015", "0.5276346", "0.52719265", "0.52665627", "0.5266075", "0.5264196", "0.52631295", "0.52566385", "0.52410966", "0.52343273", "0.52343273", "0.52343273", "0.52343273", "0.5231464", "0.5231321", "0.52245843", "0.5219065", "0.5218271", "0.52154136", "0.52060896", "0.5197058", "0.51944005", "0.5188963", "0.5186208", "0.5182845", "0.5164585", "0.5164363", "0.5164206", "0.5155975", "0.5153651", "0.5148845", "0.5148779", "0.5147305", "0.5144837", "0.514381", "0.5132448", "0.5127853", "0.51235247", "0.51197165", "0.51185215", "0.5118299", "0.51174176", "0.51085186", "0.50997216", "0.5097906", "0.5095466", "0.5092522", "0.50916475", "0.5087278", "0.5081775", "0.50801045", "0.50787765", "0.50773656", "0.50773656" ]
0.0
-1
This function checks collision
function collisionDetection() { // Check whether the player collides with a monster var monsters = document.getElementById("monsters"); for (var i = 0; i < monsters.childNodes.length; i++) { var monster = monsters.childNodes.item(i); var x = parseInt(monster.getAttribute("x")); var y = parseInt(monster.getAttribute("y")); if (intersect(new Point(x, y), MONSTER_SIZE, player.position, PLAYER_SIZE)) { alert("Game over!"); clearInterval(gameInterval); } } // Check whether a bullet hits a monster var bullets = document.getElementById("bullets"); for (var i = 0; i < bullets.childNodes.length; i++) { var bullet = bullets.childNodes.item(i); var x = parseInt(bullet.getAttribute("x")); var y = parseInt(bullet.getAttribute("y")); for (var j = 0; j < monsters.childNodes.length; j++) { var monster = monsters.childNodes.item(j); var mx = parseInt(monster.getAttribute("x")); var my = parseInt(monster.getAttribute("y")); if (intersect(new Point(x, y), BULLET_SIZE, new Point(mx, my), MONSTER_SIZE)) { monsters.removeChild(monster); j--; bullets.removeChild(bullet); i--; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function collision (px,py,pw,ph,ex,ey,ew,eh){\nreturn (Math.abs(px - ex) *2 < pw + ew) && (Math.abs(py - ey) * 2 < ph + eh);\n \n}", "function check_collision( objects_to_check )\n\t{\n\t\treturn false;\n\t}", "checkCollision() { \n return (player.x < this.x + 80 &&\n player.x + 80 > this.x &&\n player.y < this.y + 60 &&\n 60 + player.y > this.y)\n }", "checkCollisions() {\n // check for collisions with window boundaries\n if (this.pos.x > width || this.pos.x < 0 ||\n this.pos.y > height || this.pos.y < 0) {\n this.collision = true;\n }\n\n // check for collisions with all obstacles\n for (let ob of obstacles) {\n if (this.pos.x > ob.x && this.pos.x < ob.x + ob.width &&\n this.pos.y > ob.y && this.pos.y < ob.y + ob.height) {\n this.collision = true;\n break;\n }\n }\n }", "function collision_check(a,b) {\n let res = (Math.abs(a.x-b.x) * 2 < (16+8)) &&\n (Math.abs(a.y-b.y) * 2< (16+8))\n return res;\n}", "check_collision() {\n const rtx = this.x + 4;\n const rty = this.y + 59;\n const rpx = player.x + 31;\n const rpy = player.y + 57;\n if (rtx < rpx + player.width - 5 &&\n rpx < rtx + this.width - 5 &&\n rty < rpy + player.height - 15 &&\n rpy < rty + this.height - 15) {\n // Reset the game when collision happens\n allEnemies = [new Enemy(), new Enemy(), new Enemy()];\n player = new Player();\n }\n }", "function checkCollision (obj1,obj2){\n return obj1.y + obj1.height - 10 >= obj2.y\n && obj1.y <= obj2.y + obj2.height\n && obj1.x + obj1.width - 10 >= obj2.x\n && obj1.x <= obj2.x + obj2.width\n }", "collision() {\n return this.sprite.overlap(player.sprite) && this.colour == player.colour;\n }", "collision(ptl, pbr) {//player dimensions\n //add the x first\n if(this.taken){ return false;}\n if ((ptl.x <this.bottomRight.x && pbr.x > this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) {\n this.taken = true;\n return true;\n }\n return false;\n }", "function detectCollision(player1, player2){\n\treturn Math.abs(player1.x-player2.x) < 40 && Math.abs(player1.y-player2.y) < 40;\n}", "function collides(a, b) {\n if(a.x == b.x && a.y == b.y) return true;\n return false;\n }", "function collision(top_x, bottom_x, top_y, bottom_y) {\n\t\tfor (var i = 0; i < rows; i++) {\n\t\t\tfor (var j = 0; j < cols; j++) {\n\t\t\t\tvar b = bricks[j][i];\n\t\t\t\tif (b.exists == 1) {\n\t\t\t\t\tif (top_y < (b.y + block_height) && bottom_y > b.y && top_x < (b.x + block_width) && bottom_x > b.x) {\n\t\t\t\t\t\tb.exists = 0;\n\t\t\t\t\t\tball.y_speed = -ball.y_speed;\n\t\t\t\t\t\tplayer1Score += 1;\n\t\t\t\t\t\tbrickcount -= 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "collision() {\n const playerBox = {x: player.x, y: player.y, width: 76, height: 83};\n const enemyBox = {x: this.x, y: this.y, width: 76, height: 83};\n\n if (playerBox.x < enemyBox.x + enemyBox.width &&\n playerBox.x + playerBox.width > enemyBox.x &&\n playerBox.y < enemyBox.y + enemyBox.height &&\n playerBox.height + playerBox.y > enemyBox.y) {\n player.restart();\n hearts.pop();\n life--;\n if (life === 0) {\n lose();\n }\n }\n }", "function collision() {\r\n isObstacle_Clash_leftofWindow();\r\n isBullet_Clash_obstacle();\r\n isRocket_Clash_obstacle();\r\n if (lives <= 0) {\r\n endGame();\r\n }\r\n draw_Score_Lives();\r\n isRocket_Clash_Bomb();\r\n isBullet_Clash_Ship();\r\n }", "function checkCollision() {\n let objs = []\n globalRayCaster.set( camera.getWorldPosition(), camera.getWorldDirection() );\n currentObject.traverse(child => {\n if (child.isMesh) {\n objs.push(child)\n }\n })\n var intersections = globalRayCaster.intersectObjects( objs );\n if (intersections.length > 0) {\n if (intersections[0].distance <= 3.5)\n if (currentObject === lightSwitch)\n createLight();\n else if (currentObject === note)\n openNote();\n else if (currentObject === usb)\n grabUSB();\n else if (currentObject === gun)\n grabGun();\n else if (currentObject === key)\n gameOver();\n\n }\n}", "function is_collision()\n{\n\tif (frog.lane > 6 && frog.lane < 12) {\n\t\tvar lane = frog.lane - 7;\n\t\tfor (car in cars[lane].x) {\n\t\t\tif (frog.x + frog.w >= cars[lane].x[car] &&\n\t\t\t\tfrog.x <= cars[lane].x[car] + cars[lane].w) {\n\t\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}", "checkCollisions() {\n let xPos = Math.round(this.x);\n let yPos = Math.round(this.y);\n let approxXpos = xPos + 20;\n let approxYpos = yPos + 20;\n if ((player.x >= xPos && player.x <= approxXpos) && (player.y >= yPos && player.y <= approxYpos)) {\n player.x = 200;\n player.y = 420;\n player.lives--;\n player.livesText.textContent = player.lives;\n\n }\n }", "function CheckCollisions()\n{\n /* Right wall collision = player 1 wins */\n if(ball_x + ball_velo_x >= COLS)\n {\n player1_win = true;\n return false;\n }\n /* Left wall collision = player 2 wins */\n else if(ball_x + ball_velo_x <= 0)\n {\n player2_win = true;\n return false;\n }\n /* Ball-Player collision = invert the x coord of velocity */\n else if((ball_x + ball_velo_x == player1_x && \n Math.abs(ball_y + ball_velo_y - player1_y) <= half_player_size) ||\n (ball_x + ball_velo_x == player2_x && \n Math.abs(ball_y +ball_velo_y - player2_y) <= half_player_size))\n {\n ball_velo_x = -ball_velo_x;\n document.getElementById( 'pong_sound' ).play();\n return false;\n }\n /* Horizontal Wall Collision = invert the y coord of velocity */\n else if(ball_y + ball_velo_y >= ROWS || ball_y + ball_velo_y < 0)\n {\n ball_velo_y = -ball_velo_y;\n return false; \n }\n /* No collisions */\n else\n {\n return true;\n }\n}", "function checkCollision( spriteA, spriteB )\n{\n var a = spriteA.getBounds();\n var b = spriteB.getBounds();\n return a.x + a.width > b.x && a.x < b.x + b.width && a.y + a.height > b.y && a.y < b.y + b.height;\n}", "checkCollisionAt(x, y) {\n return this.gameEngine.checkCollisions(this.collider.createTheoriticalBoundingBox(x, y))\n }", "function checkCollisions (object1, object2) {\n if(object1.x+object1.width>object2.x && object2.x+object2.width>object1.x && \n object1.y+object1.height>object2.y && object2.y+object2.height>object1.y){\n \n lives--;\n \n noCollisions=false;\n\n if(!noCollisions && lives>0){\n setTimeout(function(){\n noCollisions=true;\n player.x=200;\n player.y=borderDown;\n },2000)\n }\n \n return true;\n } else {\n return false;\n }\n }", "function collides(a, b) {\n \treturn \ta.getx() < b.getx() + b.getwidth() &&\n \ta.getx() + a.getwidth() > b.getx() &&\n \ta.gety() < b.gety() + b.getheight() &&\n \ta.gety() + a.getheight() > b.gety();\n }", "function checkCollision(x, y, w, h) {\n\t// rectangle 1 is to the left of rectangle #2\n\tif (x + w < myCarX) {\n\t\tconsole.log(\"LEFT\");\n\t\treturn false;\n\t}\n\t// rectangle 1 is to the right of rectangle #2\n\tif (x > myCarX + myCarWidth) {\n\t\tconsole.log(\"RIGHT\");\n\t\treturn false;\n\t}\n\t// rectangle 1 is above rectangle #2\n\tif (y + h < myCarY) {\n\t\tconsole.log(\"ABOVE\");\n\t\treturn false;\n\t}\n\t// rectangle 1 is below rectangle #2\n\tif (y > myCarY + myCarHeight) {\n\t\tconsole.log(\"BELOW\");\n\t\treturn false;\n\t}\n\n\t// collision occurred\n\treturn true;\n}", "onCollision(response, other) {\n // Make all other objects solid\n return true;\n }", "onCollision(response, other) {\n // Make all other objects solid\n return true;\n }", "function collidesWith( a, b )\n{\n return a.bottom > b.top && a.top < b.bottom;\n}", "collision(item) {\n let itemWidth;\n let itemHeight;\n\n // Gets the width and height of the collectible\n Object.keys(collectibleSprites).forEach((key) => {\n if (collectibleSprites[key].src == item.src) {\n itemWidth = collectibleSprites[key].width;\n itemHeight = collectibleSprites[key].height;\n }\n });\n\n if (this.x == item.x && this.y == item.y) return true;\n\n // Contains all sides (from top left to bottom right) of the avatar\n const avatarSides = {\n left: {\n x: this.x,\n y: this.y,\n },\n right: {\n x: this.x + playerSprites.width,\n y: this.y + playerSprites.height,\n },\n };\n\n // Contains all sides (from top left to bottom right) of the collectible sprite\n const itemSides = {\n left: {\n x: item.x,\n y: item.y,\n },\n right: {\n x: item.x + itemWidth,\n y: item.y + itemHeight,\n },\n };\n\n // Checks if the player sprite intersected with the item\n if (\n avatarSides.left.x < itemSides.right.x &&\n itemSides.left.x < avatarSides.right.x &&\n avatarSides.right.y > itemSides.left.y &&\n itemSides.right.y > avatarSides.left.y\n ) {\n return true;\n }\n\n return false;\n }", "function collisionCheck() {\n for(var i=0; i<brickList.length; i++) {\n if (chopperX < (brickList[i].x + brickWidth) && (chopperX + chopperWidth) > brickList[i].x\n && chopperY < (brickList[i].y + brickHeight) && (chopperY + chopperHeight) > brickList[i].y ) {\n gameOver();\n }\n }\n}", "function check_collision(obj1, obj2) {\n let hit = false;\n obj1 = obj1.getBounds();\n obj2 = obj2.getBounds();\n if(obj1.bottom > obj2.top\n && obj1.top < obj2.bottom\n && obj1.left < obj2.right\n && obj1.right > obj2.left) {\n hit = true;\n }\n return hit;\n }", "function checkCollision(x1, y1, h1, w1, x2, y2, h2, w2) {\n\n if (x1 < x2 + w2 && x1 + w1 > x2 && y1 < y2 + h2 && y1 + h1 > y2) {\n return true;\n }\n else {\n return false;\n }\n}", "function collision (first, second){\n const w = (first.width + second.width) / 2;\n const h = (first.height + second.height) / 2;\n const dx = Math.abs(first.x - second.x);\n const dy = Math.abs(first.y - second.y);\n if (dx <= w && dy <= h){\n const wy = w * (first.y - second.y);\n const hx = h * (first.x - second.x);\n if (wy > hx){\n if (wy > -hx){\n stopUp = true;\n // console.log('collision: up');\n return true;\n } else {\n stopRight = true;\n // console.log('collision: right');\n return true;\n }\n }else{\n if (wy > -hx){\n stopLeft = true;\n // console.log('collision: left');\n return true;\n } else {\n stopDown = true;\n // console.log('collision: down');\n return true;\n };\n };\n }else{\n stopUp = false;\n stopRight = false;\n stopDown = false;\n stopLeft = false;\n return false;\n };\n}", "checkCollisions(position) {\n\n // AABB collision\n function checkCollision(obj1, obj2) {\n // TODO: remove these magic numbers\n // obj1 is the player and obj2 are the blocks\n let w1 = 32;\n let h1 = 40;\n let w2 = 32;\n let h2 = 32;\n let collideX = obj1.x < obj2.x + w2 && obj1.x + w1 > obj2.x;\n let collideY = obj1.y < obj2.y + h2 && obj1.y + h1 > obj2.y;\n return collideX && collideY;\n }\n\n // some fancy ES6 to get the objects that aren't the player\n let notPlayer = objects.filter(o => o.sprite !== \"player\");\n for(let o of notPlayer) {\n if(checkCollision(position, o.location)) {\n // if we collide return what we collided with\n return o;\n }\n }\n\n // otherwise return null\n return null;\n }", "collision() {\n if (this.y === (player.y - 12) && this.x > player.x - 75 && this.x < player.x + 70) {\n player.collide();\n }\n }", "function checkCollision() {\n var conds = [false, false, false, false];\n if (rectA.right >= rectB.left)\n conds[0] = true;\n if (rectB.right >= rectA.left)\n conds[1] = true;\n if (rectA.bottom >= rectB.top)\n conds[2] = true;\n if (rectB.bottom >= rectA.top)\n conds[3] = true;\n return conds;\n}", "checkForCollision(ps) {\n if( ps !== null ) { \n for(let i = 0; i < this.collisionSX.length; i++ ) {\n if( ps.position.x >= this.collisionSX[i] && ps.position.x <= this.collisionEX[i] ) {\n if( ps.position.y >= this.collisionSY[i] && ps.position.y <= this.collisionEY[i] ) {\n //print(\"collsion at shape \" + i);\n return true;\n }\n }\n }\n }\n\n return false; \n }", "checkCollision(rocket, ship){\n //simple AABB checking\n if (rocket.x < ship.x + ship.width && rocket.x + rocket.width > ship.x && rocket.y < ship.y + ship.height && rocket.height + rocket.y > ship.y){\n return true;\n } else {\n return false;\n }\n }", "hasCollision(c) {\n return this.manager.hasCollision(c);\n }", "collision () {\n }", "function collisionDetection(body1, body2){\n if(body1.x+body1.width > body2.x-cameraX && body1.x < body2.x+body2.width-cameraX && \n body1.y+body1.height > body2.y-cameraY && body1.y < body2.y+body2.height-cameraY){\n return true;\n }else{\n return false;\n }\n}", "function collides(a, b) {\n\n\treturn a.x < b.x + b.width &&\n\t\t\t\t a.x + a.width > b.x &&\n\t\t\t\t a.y < b.y + b.height &&\n\t\t\t\t a.y + a.height > b.y;\n\n}", "function checkCollision(x, y, xMole, yMole) {\n if (x <= xMole + 25 && x >= xMole - 25) {\n if (y <= yMole + 25 || y >= yMole - 25) {\n score += 1\n scoreKeeper.innerHTML = `Score: ${score}`\n }\n }\n }", "hasCollision() {\n const players = window.gameEngine.playerManager.players\n for(let i=0;i<players.length;i++) {\n if(players[i].id!=this.playerId&&Utils.distance(this.position,players[i].position) < 50) return true\n }\n return false\n }", "function checkCollisions() {\n if (player.isCollidedWithAnyIn(allEnemies)) {\n // Lost\n if (isPlaying) {\n Sound.bump.play();\n }\n isPlaying = false;\n }\n }", "isCollision(driverX, driverY) {\n let collission = false;\n this.barries.forEach((bar) => {\n if (\n driverX < bar.x + bar.img.width &&\n driverX + this.driverW > bar.x &&\n driverY + 50 < bar.y + bar.img.height &&\n driverY + this.driverH > bar.y + 20\n ) {\n collission = true;\n }\n });\n return collission;\n }", "function checkCollision(obj1, obj2)\n{\n\t\n\tif (Math.sqrt(Math.pow(obj1.getOriginX()-obj2.getOriginX(), 2) + Math.pow(obj1.getOriginY() - obj2.getOriginY(), 2)) >= obj1.getRadius() + obj2.getRadius())\n\t{\n\t\treturn false;\n\t}\n\telse\n\t{\n\t\treturn true;\n\t}\n}", "function checkCollisions() {\n\n var d1 = dist(playerX, playerY, width / 2, height / 2);\n\n if (d1 > borderDiameter / 2) {\n\n showGameOver();\n noLoop();\n\n }\n\n var i = 0;\n\n for (i = 0; i < numberOfEnemies; i++) {\n var d2 = dist(playerX, playerY, enemyX[i], enemyY[i]);\n\n // Check if it's an overlap\n if (d2 < playerRadius + enemyRadius) {\n // Increase the player health\n showGameOver();\n noLoop();\n\n }\n\n }\n\n var d3 = dist(playerX, playerY, preyX, preyY);\n\n if (d3 < playerRadius + enemyRadius) {\n bark.play();\n setup();\n }\n\n\n}", "function collision(player,blocker) {\n var x1 = player.offset().left;\n var y1 = player.offset().top;\n var h1 = player.outerHeight(true);\n var w1 = player.outerWidth(true);\n var b1 = y1 + h1;\n var r1 = x1 + w1;\n var x2 = blocker.offset().left;\n var y2 = blocker.offset().top;\n var h2 = blocker.outerHeight(true);\n var w2 = blocker.outerWidth(true);\n var b2 = y2 + h2;\n var r2 = x2 + w2;\n \n // if (b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2) {\n // console.log(\"false\");\n // } else {\n // console.log(\"true\");\n // } \n \n if (b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2) {\n return false;\n } else { \n return true;\n }\n\n }", "function checkCollision(entA, entB)\n{\n var colBoxA = entA.colBox;\n var colBoxB = entB.colBox;\n return !(colBoxB.left > colBoxA.right ||\n colBoxB.right < colBoxA.left ||\n colBoxB.top > colBoxA.bottom ||\n colBoxB.bottom < colBoxA.top);\n}", "function collision(obj1, obj2){\n\tif (obj1.x > obj2.x + obj2.width || obj1.x + obj1.width < obj2.x || obj1.y+obj1.height > obj2.y + obj2.height || obj1.y + obj1.height < obj2.y){\n\t\t\n\t} else {\n\t\tif (!collidesArr.includes(obj2.value)){\n\t\t\tcollidesArr.push(obj2.value)\n\t\t\tif (collidesArr.length === 2)\n\t\t\t\tcheckOrderForTwo(collidesArr)\n\t\t\tif (collidesArr.length === 3)\n\t\t\t\tcheckOrder(collidesArr)\n\t\t\t}\n\t\t}\n\t\t// console.log(`collides with ${obj2.name}`)\n\t\tconsole.log(collidesArr)\n\t}", "collision(inObject) {\n\n // Abort if the player isn't visible (i.e., when they are 'splodin).\n if (!this.player.isVisible || !inObject.isVisible) { return false; }\n\n // Bounding boxes.\n const left1 = this.player.xLoc;\n const left2 = inObject.xLoc;\n const right1 = left1 + this.player.pixWidth;\n const right2 = left2 + inObject.pixWidth;\n const top1 = this.player.yLoc;\n const top2 = inObject.yLoc;\n const bottom1 = top1 + this.player.pixHeight;\n const bottom2 = top2 + inObject.pixHeight;\n\n // Bounding box checks. It isn't perfect collision detection, but it's good\n // enough for government work.\n if (bottom1 < top2) {\n return false;\n }\n if (top1 > bottom2) {\n return false;\n }\n if (right1 < left2) {\n return false;\n }\n return left1 <= right2;\n\n }", "checkForCollision(x, y) {\n return (this.level.getTile(x, y) === \"wall\" ||\n !!this.level.getMarker(x, y));\n }", "function checkCollision(obj1, obj2) {\n if (obj1.x > obj2.x) {\n if (obj1.y > obj2.y) {\n if (obj1.x - obj2.x < obj2.width && obj1.y - obj2.y < obj2.height) {\n if (obj1.x - obj2.x > obj1.y - obj2.y) { return 1; }\n return 2;\n }\n } else {\n if (obj1.x - obj2.x < obj2.width && obj2.y - obj1.y < obj1.height) {\n if (obj1.x - obj2.x > obj2.y - obj1.y) { return 1; }\n return 3;\n }\n }\n } else {\n if (obj1.y > obj2.y) {\n if (obj2.x - obj1.x < obj1.width && obj1.y - obj2.y < obj2.height) {\n if (obj2.x - obj1.x > obj1.y - obj2.y) { return 0; }\n return 2;\n }\n } else {\n if (obj2.x - obj1.x < obj1.width && obj2.y - obj1.y < obj1.height) {\n if (obj2.x - obj1.x > obj2.y - obj1.y) { return 0; }\n return 3;\n }\n }\n }\n return -1;\n}", "function hasCollisions() {\n\tfor (let y = 0; y < activeTetro.shape.length; y++) {\n\t\tfor (let x = 0; x < activeTetro.shape[y].length; x++) {\n\t\t\tif (activeTetro.shape[y][x] === 1 && (playField[activeTetro.y + y] === undefined || playField[activeTetro.y + y][activeTetro.x + x] === undefined || playField[activeTetro.y + y][activeTetro.x + x] === 2)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "function CheckCollision() {\n\tfor (var i = 0; i < 3; i++) { // loop through diploma positions\n\t\tvar diplomaPosition = diplomaPositions[i];\n\t\tvar spriteX = xPosition + CHAR_WIDTH - 40;\n\t\tvar collisionX = spriteX >= diplomaPosition.x && spriteX <= diplomaPosition.x + DIPLOMA_WIDTH;\n\t\tvar freeY = yPosition + 25 > diplomaPosition.y + 192 || yPosition + 75 < diplomaPosition.y;\n\t\tif (collisionX && !freeY) {\n\t\t\tthis.GameOver();\n\t\t}\n\t}\n}", "function checkCollision() {\n snake1.checkCollision();\n if(snake2) {\n snake2.checkCollision();\n if(snake1.collidesWith(snake2)) {\n $('#ouch_girl').trigger('play');\n }\n if(snake2.collidesWith(snake1)) {\n $('#ouch_boy').trigger('play');\n }\n }\n }", "function collision(x, y , array){\n\t\t\n\t\tfor(var i = 0; i < array.length; i++){\n\t\t\t\n\t\t\tif(array[i].x == x && array[i].y == y){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t\n\t\t}\n\t\treturn false;\n\t}", "function collision(playerX, playerY, playerWidth, playerHeight, enemyX, enemyY, enemyWidth, enemyHeight) {\n return (Math.abs(playerX - enemyX) * 2 < playerWidth + enemyWidth) && (Math.abs(playerY - enemyY) * 2 < playerHeight + enemyHeight)\n}", "checkCollisions() {\n // Get actual player position\n let playerPosition = {\n x: player.x,\n y: player.y,\n width: box.width,\n height: box.height\n }\n // Get actual enemy position\n let enemyPosition = {\n x: this.x,\n y: this.y,\n width: box.width +10,\n height: box.height\n }\n // If collision happened:\n if (playerPosition.x < enemyPosition.x + enemyPosition.width && playerPosition.x + playerPosition.width > enemyPosition.x && playerPosition.y < enemyPosition.y + enemyPosition.height && playerPosition.y + playerPosition.height > enemyPosition.y) {\n audioFiles.collision.play();// Play sound\n player.resetPlayer();// Reset player initial position\n player.remainAlive--;// Decrese player lives\n lives.pop();// remove life object from lives array\n //If Player has less than 3 lives, display life key bonus\n (player.remainAlive < 3 && player.remainAlive >0) && keyLife.display();\n }\n\n }", "function checkCollisions() {\n\n allEnemies.forEach(function(enemy) {\n // From https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection\n var player_circle = {radius: enemy.radius, pos: enemy.getCenter()};\n var enemy_circle = {radius: player.radius, pos: player.getCenter()};\n\n var dx = player_circle.pos.x - enemy_circle.pos.x;\n var dy = player_circle.pos.y - enemy_circle.pos.y;\n var distance = Math.sqrt(dx * dx + dy * dy);\n\n if (distance < player_circle.radius + enemy_circle.radius) {\n Map.collided = true;\n Map.gameRunning = false;\n }\n });\n // Update score if you jump into the water.\n if (!Map.collided && player.pos.y <= Map.SPRITE_BEGINNING_Y_POS - Map.BLOCKHEIGHT * (Map.rows -1)) {\n Map.score += 1;\n reset();\n }\n }", "_detectCollision () {\n let doContinue = true\n app.needleSelection.getNeedles().each(d => {\n if (d.passed) return\n const mm = app.getMmByLevel(app.ctx.level)\n const fromY = d.y + constant.NEEDLE_HOLE_DY\n const toY = fromY + mm\n const thread = app.threadDS\n if (thread.cx >= d.x) {\n if (fromY <= thread.cy - thread.r && thread.cy + thread.r <= toY) { // Passed\n app.statusTextScore++\n app.ctx.level = this._calcLevelByScore(app.statusTextScore) // May Lv. Up\n d.passed = true\n } else { // Failed\n doContinue = false\n }\n }\n })\n return doContinue\n }", "function collisionCheck(x, y, array) {\n for(var i = 0; i < array.length; i++)\n {\n if(array[i].x == x && array[i].y == y)\n return true;\n }\n return false;\n }", "function checkCollision(){\r\n\t//check se la macchina esce dalla pista\r\n\tif(center_carr[2]<-408)vz=0;\r\n\tif(center_carr[2]>109)vz=0;\r\n\t\r\n\tif(center_carr[0]<track_dimension[1])vz=0;\r\n\tif(center_carr[0]>track_dimension[0])vz=0;\r\n\t\r\n\t//check collisione con i booster\r\n\tif((center_carr[0]<2.3 && center_carr[0]>0) && (center_carr[2]>-10 && center_carr[2]<-6)) vz=vz*1.12;\r\n\tif((center_carr[0]<0 && center_carr[0]>-2.3) && (center_carr[2]>-35 && center_carr[2]<-31)) vz=vz*1.12;\r\n\tif((center_carr[0]<0 && center_carr[0]>-2.3) && (center_carr[2]>-48 && center_carr[2]<-44)) vz=vz*1.12;\r\n\tif((center_carr[0]<6 && center_carr[0]>4) && (center_carr[2]>-161 && center_carr[2]<-157)) vz=vz*1.12;\r\n\tif((center_carr[0]<3 && center_carr[0]>0.7) && (center_carr[2]>-184 && center_carr[2]<-180)) vz=vz*1.12;\r\n\tif((center_carr[0]<5.60 && center_carr[0]>3.18) && (center_carr[2]>-240 && center_carr[2]<-236)) vz=vz*1.12;\r\n\tif((center_carr[0]<5.60 && center_carr[0]>3.18) && (center_carr[2]>-251 && center_carr[2]<-247)) vz=vz*1.12;\r\n\tif((center_carr[0]<5.60 && center_carr[0]>3.18) && (center_carr[2]>-257 && center_carr[2]<-253)) vz=vz*1.12;\r\n\tif((center_carr[0]<7 && center_carr[0]>5) && (center_carr[2]>-290 && center_carr[2]<-286)) vz=vz*1.12;\r\n\tif((center_carr[0]<6&& center_carr[0]>3.8) && (center_carr[2]>-310 && center_carr[2]<-306)) vz=vz*1.15;\r\n\tif((center_carr[0]<3.6&& center_carr[0]>1.3) && (center_carr[2]>-331 && center_carr[2]<-327)) vz=vz*1.12;\r\n\t\r\n\t//check collisione con i debooster\r\n\tif((center_carr[0]<1.15 && center_carr[0]>-0.8) && (center_carr[2]>-113 && center_carr[2]<-109)) vz=vz*0.9;\r\n\tif((center_carr[0]<6 && center_carr[0]>3.6) && (center_carr[2]>-144 && center_carr[2]<-140)) vz=vz*0.9;\r\n\tif((center_carr[0]<3.25 && center_carr[0]>0.85) && (center_carr[2]>-170 && center_carr[2]<-166)) vz=vz*0.9;\r\n\tif((center_carr[0]<6.66 && center_carr[0]>4.6) && (center_carr[2]>-203 && center_carr[2]<-199)) vz=vz*0.9;\r\n\tif((center_carr[0]<2.81 && center_carr[0]>0.93) && (center_carr[2]>-222 && center_carr[2]<-218)) vz=vz*0.9;\r\n\tif((center_carr[0]<3.25 && center_carr[0]>1) && (center_carr[2]>-277 && center_carr[2]<-281)) vz=vz*0.9;\r\n\tif((center_carr[0]<7 && center_carr[0]>5) && (center_carr[2]>-300 && center_carr[2]<-296)) vz=vz*0.9;\r\n\t\r\n}", "checkCollisions() {\n allEnemies.forEach(function(enemy) {\n if ( Math.abs(player.x - enemy.x) <= 80 &&\n Math.abs(player.y - enemy.y) <= 30 ) {\n player.x=200;\n player.y=405;\n }\n });\n }", "function collisionCheck() {\n for (var count = 0; count < BUSH_NUM; count++) {\n elfAndBush(bushes[count]);\n }\n\n for (var count = 0; count < BUNNY_NUM; count++) {\n elfAndBunny(bunnies[count]);\n }\n\n for (var count = 0; count < BUNNY_NUM; count++) {\n arrowAndBunny(bunnies[count], arrows[0]);\n arrowAndBunny(bunnies[count], arrows[1]);\n arrowAndBunny(bunnies[count], arrows[2]);\n arrowAndBunny(bunnies[count], arrows[3]);\n arrowAndBunny(bunnies[count], arrows[4]);\n }\n\n for (var count = 0; count < APPLE_NUM; count++) {\n elfAndApple(apples[count]);\n }\n}", "checkCollision() {\n var playerBox = {x: player.x, y: player.y, width: 50, height: 40};\n var enemyBox = {x: this.x, y: this.y, width: 60, height: 70};\n // Check for collisions, if playerBox intersects enemyBox, score decrease by 1\n // and the setset the player and enemies\n if (playerBox.x < enemyBox.x + enemyBox.width &&\n playerBox.x + playerBox.width > enemyBox.x &&\n playerBox.y < enemyBox.y + enemyBox.height &&\n playerBox.height + playerBox.y > enemyBox.y) {\n this.resetGame();\n canvas.decreaseScore();\n }\n }", "checkCollisions(){\n \tlet coll = false;\n \tconst R = .7;\n \tfor(const ENEMY of allEnemies){\n \t\tif(ENEMY.y === this.y && Math.abs(this.x - ENEMY.x)< R){\n \t\t\tcoll=true;\n \t\t\tRESET();\n \t\t}\n \t}\n \treturn coll;\n }", "collide(oth) {\n return this.right > oth.left && this.left < oth.right && this.top < oth.bottom && this.bottom > oth.top\n }", "function CheckCollision(box1, box2) {\n\n\tvar box1_info = box1.GetInfo();\n\tvar box2_info = box2.GetInfo();\n\t\n\treturn \t(box1_info.xMin <= box2_info.xMax && box1_info.xMax >= box2_info.xMin) &&\n\t\t\t(box1_info.yMin <= box2_info.yMax && box1_info.yMax >= box2_info.yMin) &&\n\t\t\t(box1_info.zMin <= box2_info.zMax && box1_info.zMax >= box2_info.zMin);\n}", "checkCollision(that) {\n\t\tif (that.state == \"LIVE\") {\n\t\t\tthat.parts.forEach( part => {\n\t\t\t\tconst dis = dist(part.x, part.y, this.x, this.y)\n\t\t\t\t// console.log(dis)\n\t\t\t\tif (dis < 20) {\n\t\t\t\t\tthis.state = 'DEAD'\n\t\t\t\t\treturn true\n\t\t\t\t} \n\t\t\t})\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\n\t\t\n\t}", "function collision(object1, object2) {\n if (object1.x <= object2.x && object1.y <= object2.y && object1.x + object1.w >= object2.x && object1.y + object1.h >= object2.y) {\n return true;\n }\n if (object1.x <= object2.x && object1.y >= object2.y && object1.x + object1.w >= object2.x && object2.y + object2.h >= object1.y) {\n return true;\n }\n if (object1.x >= object2.x && object1.y <= object2.y && object2.x + object2.w >= object1.x && object1.y + object1.h >= object2.y) {\n return true;\n }\n return object1.x >= object2.x && object1.y >= object2.y && object2.x + object2.w >= object1.x && object2.y + object2.h >= object1.y;\n}", "collidesWith(player) {\n //this function returns true if the the rectangles overlap\n // console.log('this.collidesWith')\n const _overlap = (platform, object) => {\n // console.log('_overlap')\n // check that they don't overlap in the x axis\n const objLeftOnPlat = object.left <= platform.right && object.left >= platform.left;\n const objRightOnPlat = object.right <= platform.right && object.right >= platform.left;\n const objBotOnPlatTop = Math.abs(platform.top - object.bottom) === 0;\n \n // console.log(\"OBJECT BOTTOM: \", object.bottom/);\n // console.log(\"PLATFORM TOP: \", platform.top);\n // console.log('objectBotOnPlat: ', !objBotOnPlatTop)\n // console.log('OBJECT RIGHT: ', object.right)\n // console.log('PLATFORM RIGHT: ', platform.right)\n // console.log(\"OBJECT LEFT: \", object.left);\n // console.log(\"PLATFORM LEFT: \", platform.left);\n // console.log('objectLeftOnPlat', !objLeftOnPlat);\n // console.log('objRightOnPlat', !objRightOnPlat);\n\n if (!objLeftOnPlat && !objRightOnPlat) {\n // if (player.y < 400) { \n // debugger\n // }\n return false;\n // if (objBotOnPlatTop) return true;\n // return false;\n }\n \n if (objLeftOnPlat || objRightOnPlat) {\n // debugger\n // console.log('PLATFORM:::::', platform.top)\n // console.log('PLAYER:::::::', object.bottom)\n // console.log('objBotOnPlat:::::::::', objBotOnPlatTop)\n\n if (objBotOnPlatTop) {\n debugger\n }\n }\n //check that they don't overlap in the y axis\n const objTopAbovePlatBot = object.top > platform.bottom;\n if (!objBotOnPlatTop) {\n // console.log()\n // if (player.y < 400) { \n // debugger\n // }\n return false;\n }\n\n return true;\n };\n\n let collision = false;\n this.eachPlatform(platform => {\n //check if the bird is overlapping (colliding) with either platform\n if (_overlap(platform, player.bounds())) {\n // console.log('WE ARE HERE IN THE OVERLAP')\n // console.log(platform)\n collision = true;\n // debugger\n // console.log(player)\n player.y = platform.top;\n // console.log('PLATFORM: ', platform)\n // console.log(collision)\n // player.movePlayer(\"up\")\n }\n // _overlap(platform.bottomPlatform, player)\n });\n\n // console.log('collision:')\n // console.log(collision)\n return collision;\n }", "checkCollision (obj) {\n if (this.x < obj.x + obj.width\n && this.x + this.width > obj.x\n && this.y < obj.y + obj.height\n && this.y + this.height > obj.y) {\n obj.resetPosition();\n }\n }", "function checkCollisionPoint( s, x, y ) {\n return ( s.x - s.img.width/2 < x && s.x + s.img.width/2 > x && s.y - s.img.height/2 < y && s.y + s.img.height/2 > y );\n}", "checkCollision(){\n\n if(this.radius > 0){\n if(this.x + this.radius > game.getWidth() || this.x - this.radius < 0){\n this.xVel *= -1;\n }\n\n if(this.y + this.radius > game.getHeight() || this.y - this.radius < 0){\n this.yVel *= -1;\n }\n } \n \n }", "checkCollision(object){\n // Verifica se houve colisão no eixo X\n if(object.position_x <= this.position_x +variables.unityWidth()*3 && object.position_x >= this.position_x - variables.unityWidth()){\n // Verifica se houve colisão no eixo Y\n if(object.position_y + object.height >= this.position_y &&\n object.position_y <= this.position_y + variables.unityHeight()*3.6){\n this.destroy(object);\n }\n } \n }", "function collisionDetection(x, y) {\r\n if (\r\n // The range of the detection is 35 each side enabling high incrimentation sprite values to be caught\r\n x - getShipLocation(angle)[0] <= 35 &&\r\n x - getShipLocation(angle)[0] >= -35 &&\r\n y - getShipLocation(angle)[1] <= 35 &&\r\n y - getShipLocation(angle)[1] >= -35\r\n ) {\r\n // Calls crash screen when a collision is detected\r\n crashScreen();\r\n }\r\n}", "function checkCollision() {\n // enemies with layout\n game.activeEnemies.forEach(function(enemy) {\n enemy.x = enemy.x>game.canvas[0].width?enemy.cleanUp():enemy.x;\n enemy.x = enemy.x<-75?enemy.cleanUp():enemy.x;\n // enemies with hero\n if ((enemy.x>=hero.x-20&&enemy.x<hero.x+40)&&(enemy.y>=hero.y-50&&enemy.y<hero.y+50)) {\n hero.reset(190,500);\n game.tries++;\n }\n });\n // hero with layout\n hero.x = hero.x>(game.canvas[0].width-100)?(game.canvas[0].width-100):hero.x;\n hero.x = hero.x<0?0:hero.x;\n hero.y = hero.y>game.canvas[0].height-150?(game.canvas[0].height-150):hero.y;\n hero.y = hero.y<150?150:hero.y;\n if (hero.x>=hero2.x&&hero.y<=hero2.y) {\n game.medal = true;\n game.stop();\n end();\n }\n }", "function collision(rec1, rec2)\n{\n if (rec1.x < rec2.x + rec2.width &&\n rec1.x + rec1.width > rec2.x &&\n rec1.y < rec1.y + rec2.height &&\n rec1.y + rec1.height > rec2.y) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}", "function collision(rec1, rec2)\n{\n if (rec1.x < rec2.x + rec2.width &&\n rec1.x + rec1.width > rec2.x &&\n rec1.y < rec1.y + rec2.height &&\n rec1.y + rec1.height > rec2.y) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}", "function collisionDetection(x, y) {\n if (\n // The range of the detection is 35 each side enabling high incrimentation sprite values to be caught\n x - getShipLocation(angle)[0] <= 35 &&\n x - getShipLocation(angle)[0] >= -35 &&\n y - getShipLocation(angle)[1] <= 35 &&\n y - getShipLocation(angle)[1] >= -35\n ) {\n // Calls crash screen when a collision is detected\n crashScreen();\n }\n}", "function collision(head, tabSnake){\n for(let i = 0; i < tabSnake.length; i++){\n if(head.x == tabSnake[i].x && head.y == tabSnake[i].y){ \n return true;\n }\n \n }return false\n}", "function checkCollision(obj1,obj2){\n if(obj1 != ball){\n if(obj1.y >= obj2.y &&\n obj1.y <= obj2.y+obj2.h &&\n obj1.x >= obj2.x &&\n obj1.x <= obj2.x+obj2.w){\n return true\n }\n }else{\n if(obj1.y+obj1.radius >= obj2.y &&\n obj1.y-obj1.radius <= obj2.y+obj2.h &&\n obj1.x-obj1.radius >= obj2.x &&\n obj1.x+obj1.radius <= obj2.x+obj2.w){\n return true\n }\n }\n }", "function checkCollision(a, b) {\n if (a !== undefined && b !== undefined) {\n var aRad = (a.a + a.b + a.c) / 3;\n var bRad = (b.a + b.b + b.c) / 3;\n var aPos = vec3.create();\n\n vec3.add(aPos, a.center, a.translation);\n var bPos = vec3.create();\n vec3.add(bPos, b.center, b.translation);\n var dist = vec3.distance(aPos, bPos);\n\n if (dist < aRad + bRad) {\n //spawn explosion and destroy asteroid, doesn't matter what asteroid collided with, always explodes\n generateExplosion(vec3.add(vec3.create(), vec3.fromValues(a.x, a.y, a.z),\n vec3.fromValues(a.translation[0], a.translation[1], a.translation[2])), false);\n deleteModel(a);\n //handle collision\n if (b.tag == 'shot') {\n // destroy asteroid and shot, give player points\n //test *******apocalypse = true;\n //test *******gameOver(b);\n deleteModel(b);\n score += 10;\n document.getElementById(\"score\").innerHTML = \"Score: \" + score;\n } else if (b.tag == 'station') {\n // destroy asteroid, damage station and destroy if life < 0 then weaken shield\n // if last station destroyed, destroy shield as wells\n b.health -= 5;\n if (b.css == 'station1') {\n document.getElementById(\"station1\").innerHTML = \"Station Alpha: \" + b.health;\n } else if (b.css == 'station2') {\n document.getElementById(\"station2\").innerHTML = \"Station Bravo: \" + b.health;\n } else {\n document.getElementById(\"station3\").innerHTML = \"Station Charlie: \" + b.health;\n }\n if (b.health == 0) {\n var change = false;\n base_limit--;\n // reduce shield alpha by one to signify weakening\n for (var o in inputEllipsoids) {\n if (inputEllipsoids[o].tag == 'shield') {\n inputEllipsoids[o].alpha -= 0.2;\n }\n }\n // if the destroyed center is highlighted, switch to next\n if (b.id == current_center) {\n for (var s in stations) {\n if (stations[s].id > b.id) {\n stations[s].id--;\n }\n }\n change = true;\n }\n // remove the destroyed station\n station_centers.splice(b.id, 1);\n deleteModel(b);\n // has to be after splice/delete or else will access out of date station_centers\n if (change) {\n current_center++;\n changeStation();\n }\n shield_level--;\n document.getElementById(\"shield\").innerHTML = \"Shield: \" + shield_level;\n // destroy shield if no more stations\n if (shield_level == 0) {\n for (var o in inputEllipsoids) {\n if (inputEllipsoids[o].tag == 'shield') {\n deleteModel(inputEllipsoids[o]);\n break;\n }\n }\n deleteModel(highlight);\n }\n if (b.css == 'station1') {\n document.getElementById(\"station1charge\").innerHTML = \"Destroyed!\";\n document.getElementById(\"station1\").innerHTML = \"Station Alpha:\"\n } else if (b.css == 'station2') {\n document.getElementById(\"station2charge\").innerHTML = \"Destroyed!\";\n document.getElementById(\"station2\").innerHTML = \"Station Bravo:\"\n } else {\n document.getElementById(\"station3charge\").innerHTML = \"Destroyed!\";\n document.getElementById(\"station3\").innerHTML = \"Station Charlie:\"\n }\n }\n } else if (b.tag == 'shield') {\n // destroy asteroid, damage earth based on shield strength\n earth_health -= 15 / shield_level;\n document.getElementById(\"earth\").innerHTML = \"Earth: \" + earth_health;\n if (earth_health <= 0) {\n for (var o in inputEllipsoids) {\n if (inputEllipsoids[o].tag == 'earth') {\n // handle game over\n gameOver(inputEllipsoids[o]);\n break;\n }\n }\n }\n } else if (b.tag == 'earth') {\n // destroy asteroid, damage earth and destroy if life < 0\n earth_health -= 15;\n document.getElementById(\"earth\").innerHTML = \"Earth: \" + earth_health;\n if (earth_health <= 0) {\n // handle game over\n gameOver(b);\n }\n } else if (b.tag == 'moon') {\n b.health -= 5;\n if (b.health <= 0) {\n generateExplosion(vec3.add(vec3.create(), vec3.fromValues(b.x, b.y, b.z),\n vec3.fromValues(b.translation[0], b.translation[1], b.translation[2])), true);\n deleteModel(b);\n }\n }\n }\n }\n}", "function collision_detector(first, second) {\r\n var x1 = first.get(\"X\");\r\n var y1 = first.get(\"Y\");\r\n var width1 = first.get(\"width\");\r\n var height1 = first.get(\"height\");\r\n var x2 = second.get(\"X\");\r\n var y2 = second.get(\"Y\");\r\n var width2 = second.get(\"width\");\r\n var height2 = second.get(\"height\");\r\n\r\n if (x2 > x1 && x2 < x1 + width1 || x1 > x2 && x1 < x2 + width2) {\r\n if (y2 > y1 && y2 < y1 + height1 || y1 > y2 && y1 < y2 + height2) {\r\n return true;\r\n }\r\n } else {\r\n return false;\r\n }\r\n}", "function collision(target1, target2) {\n return (target1.x > target2.x - 20 && target1.x < target2.x + 20) &&\n (target1.y > target2.y - 20 && target1.y < target2.y + 20);\n}", "function collide(o1T, o1B, o1L, o1R, o2T, o2B, o2L, o2R) {\n\tif ((o1L <= o2R && o1L >= o2L) || (o1R >= o2L && o1R <= o2R)) {\n\t\tif ((o1T >= o2T && o1T <= o2B) || (o1B >= o2T && o1B <= o2B)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}", "function collision(array){\n for(let i = 1; i < array.length; i++){\n if(array[0].x == array[i].x && array[0].y == array[i].y){\n return true;\n }\n }\n return false;\n}", "function areCollide(r1, r2) {\n //Define the variables we'll need to calculate\n var hit, combinedHalfWidths, combinedHalfHeights, vx, vy;\n\n //hit will determine whether there's a collision\n hit = false;\n\n //Find the center points of each sprite\n r1.centerX = r1.x + r1.width / 2;\n r1.centerY = r1.y + r1.height / 2;\n r2.centerX = r2.x + r2.width / 2;\n r2.centerY = r2.y + r2.height / 2;\n\n //Find the half-widths and half-heights of each sprite\n r1.halfWidth = r1.width / 2;\n r1.halfHeight = r1.height / 2;\n r2.halfWidth = r2.width / 2;\n r2.halfHeight = r2.height / 2;\n\n //Calculate the distance vector between the sprites\n vx = r1.centerX - r2.centerX;\n vy = r1.centerY - r2.centerY;\n\n //Figure out the combined half-widths and half-heights\n combinedHalfWidths = r1.halfWidth + r2.halfWidth;\n combinedHalfHeights = r1.halfHeight + r2.halfHeight;\n\n //Check for a collision on the x axis\n if (Math.abs(vx) < combinedHalfWidths) {\n\n //A collision might be occuring. Check for a collision on the y axis\n if (Math.abs(vy) < combinedHalfHeights) {\n\n //There's definitely a collision happening\n hit = true;\n } else {\n\n //There's no collision on the y axis\n hit = false;\n }\n } else {\n\n //There's no collision on the x axis\n hit = false;\n }\n\n //`hit` will be either `true` or `false`\n return hit;\n}", "function checkCollision(zombie) {\nif (zombie.getBoundingClientRect().top <= 0) {\nlives--;\nreturn true;\n}\nreturn false;\n}", "function checkCollisionsPlayerOne() {\n if (pongball.x - 15 < playerOne.x + playerOne.sizeX && pongball.y < playerOne.y + playerOne.sizeY && pongball.y + pongball.sizeY > playerOne.y) {\n\n if (pongball.x > playerOne.x) {\n\n return true;\n }\n }\n}", "colisionCheck(object, player) {\n if ((player.x-10)+ player.width < object.x ||(object.x-10) + object.width < player.x){\n return false;\n }\n if ((player.y+20) > object.y + object.height || object.y+30 > player.y + player.height) {\n return false;\n }\n return true; \n }", "function collision(first, second) {\n\treturn !(first.x > second.x + second.width ||\n\t\tfirst.x + first.width < second.x ||\n\t\tfirst.y > second.y + second.height ||\n\t\tfirst.y + first.height < second.y);\n}", "function collide(A, B) {\n if ( A.x < B.x + CAR_WIDTH && A.x + CAR_WIDTH > B.x &&\n A.y < B.y + CAR_HEIGHT && A.y + CAR_HEIGHT > B.y ) {\n if ( DEBUG ) {\n console.log(\"Colision entre deux véhicules\");\n }\n return true;\n }\n return false;\n}", "function checkCollision(obj1, obj2) {\n var vx = obj1.position.x - obj2.position.x;\n var vy = obj1.position.y - obj2.position.y;\n var length = Math.sqrt(vx * vx + vy * vy);\n if (length < obj1.radius + obj2.radius) {\n return true;\n }\n return false;\n}", "function collision(rect1, rect2) {\n if (rect1.x < rect2.x + rect2.width &&\n rect1.x + rect1.width > rect2.x &&\n rect1.y < rect2.y + rect2.height &&\n rect1.y + rect1.height > rect2.y) {\n return true;\n }\n}", "function checkCollisions(playerX, playerY, playerW, playerH, enemyX, enemyY, enemyW, enemyH) {\n // Minimize the edges of the objects\n const minTop = 3;\n const minBottom = 15;\n // Player Corner Points\n const pointA = [playerX + minTop, playerY + minTop];\n const pointB = [playerX + playerW - minTop, playerY + minTop];\n const pointC = [playerX + minTop, playerY + playerH - minBottom];\n const pointD = [playerX + playerW - minTop, playerY - minBottom + playerH];\n\n // Enemy Corner Points\n const pointE = [enemyX , enemyY ];\n const pointF = [enemyX + enemyW , enemyY ];\n const pointG = [enemyX , enemyY + enemyH ];\n const pointH = [enemyX + enemyW, enemyY + enemyH];\n\n /*\n * check each point if its position (x,y) found in the other object.\n * CASE #1\n * if A(x) is between E(x)-F(x) AND A(y) between E(y)-G(y)\n \n E__________F\n | |\n | (A)___|____B\n | | | |\n |_____|____| |\n G | H |\n |_________|\n C D\n */\n if ((pointE[0] <= pointA[0] && pointF[0] >= pointA[0]) && (pointE[1] <= pointA[1] && pointG[1] >= pointA[1])) {\n return true;\n }\n /* \n * CASE #2\n * if B(x) is between E(x)-F(x) AND B(y) between E(y)-G(y)\n\n E__________F\n | |\n A____|____(B) |\n | | | |\n | |_____|____|\n | G | H\n |_____ ____| \n C D \n */\n if ((pointE[0] <= pointB[0] && pointF[0] >= pointB[0]) && (pointE[1] <= pointB[1] && pointG[1] >= pointB[1])) {\n return true;\n }\n /* \n * CASE #3\n * if C(x) is between E(x)-F(x) AND C(y) between E(y)-G(y)\n\n A__________B\n | |\n E____|_____F |\n | | | |\n | |_____|____|\n | (C) | D\n |_____ ____| \n G H \n \n */\n if ((pointE[0] <= pointC[0] && pointF[0] >= pointC[0]) && (pointE[1] <= pointC[1] && pointG[1] >= pointC[1])) {\n return true;\n }\n /*\n * CASE #4\n * if D(x) is between E(x)-F(x) AND D(y) between E(y)-G(y)\n\n A__________B\n | |\n | E____|____F\n | | | |\n |_____|____| |\n C | (D) |\n |_________|\n D H\n */\n if ((pointE[0] <= pointD[0] && pointF[0] >= pointD[0]) && (pointE[1] <= pointD[1] && pointG[1] >= pointD[1])) {\n return true;\n }\n /* \n * CASE #5\n * if E(x) is between A(x)-B(x) AND E(y) between A(y)-B(y)\n \n A__________B\n | |\n | (E)___|____F\n | | | |\n |_____|____| |\n C | D |\n |_________|\n G H\n \n */\n if ((pointA[0] <= pointE[0] && pointB[0] >= pointE[0]) && (pointA[1] <= pointE[1] && pointC[1] >= pointE[1])) {\n return true;\n }\n /* \n * CASE #6\n * if F(x) is between A(x)-B(x) AND F(y) between A(y)-B(y)\n\n A__________B\n | |\n E____|____(F) |\n | | | |\n | |_____|____|\n | C | D\n |_____ ____| \n G H \n */\n if ((pointA[0] <= pointF[0] && pointB[0] >= pointF[0]) && (pointA[1] <= pointF[1] && pointC[1] >= pointF[1])) {\n return true;\n }\n /* \n * CASE #7\n * if G(x) is between A(x)-B(x) AND G(y) between A(y)-B(y)\n\n E__________F\n | |\n A____|_____B |\n | | | |\n | |_____|____|\n | (G) | H\n |__________| \n C D \n */\n if ((pointA[0] <= pointG[0] && pointB[0] >= pointG[0]) && (pointA[1] <= pointG[1] && pointC[1] >= pointG[1])) {\n return true;\n }\n /*\n * CASE #8\n * if H(x) is between A(x)-B(x) AND H(y) between A(y)-B(y)\n\n E__________F\n | |\n | A____|____B\n | | | |\n |_____|____| |\n G | (H) |\n |_________|\n C D\n */\n if ((pointA[0] <= pointH[0] && pointB[0] >= pointH[0]) && (pointA[1] <= pointH[1] && pointC[1] >= pointH[1])) {\n return true;\n }\n return false;\n }", "function collisionCheck(b, o) {\n // If the player goes hits the screen edges, it's game over.\n if (b.y < 0 || b.y + b.size > canvasHeight)\n gameOver();\n // If the player hits an obstacle, it's game over.\n if (b.x + b.size >= o.x && b.x <= o.x + o.width) {\n if (b.y <= o.gapStart || b.y + b.size >= o.gapEnd)\n gameOver();\n }\n // If the player passes an obstacle, player earns a point.\n else if (b.scored == false && b.x > o.x + o.width) {\n b.score++;\n b.scored = true;\n }\n}", "function bodyCollision() {\n\tvar headID = segments[segments.length - 1].ID;\n\tvar headTop = $(headID).position().top;\n\tvar headLeft = $(headID).position().left;\n\tvar segmentID;\n\tvar segmentTop;\n\tvar segmentLeft;\n\n\tfor (i = 0; i < segments.length - 2; i++) {\n\t\tsegmentID = segments[i].ID;\n\t\tsegmentTop = $(segmentID).position().top;\n\t\tsegmentLeft = $(segmentID).position().left;\n\t\tif ((headTop === segmentTop) && (headLeft === segmentLeft)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "function blockCollision(rectOne, rectTwo) {\n \n // Check whether there is a collision on the x and y\n return Math.abs((rectOne.x + rectOne.width / 2) - (rectTwo.x + rectTwo.width / 2)) < rectOne.width / 2 + rectTwo.width / 2 && Math.abs((rectOne.y + rectOne.height / 2) - (rectTwo.y + rectTwo.height / 2)) < rectOne.height / 2 + rectTwo.height / 2;\n \n}", "handleCollision(climber) {\n\n // distance\n //\n // to calculate the distance between the avalanche and climber\n let d = dist(this.x, this.y, climber.x, climber.y);\n\n // dist()\n //\n // To keep track of the avalanche and the avatar are in contact\n if (d < this.width / 2 + climber.width / 2) {\n // this is to push the climber down\n climber.vy += 2;\n\n }\n }", "checkCollisions() {\n // Get actual player position\n let playerPosition = {\n x: player.x,\n y: player.y,\n width: box.width,// Get its box width\n height: box.height// Get its box height\n }\n // Get actual gem position\n let gemPosition = {\n x: this.x,\n y: this.y,\n width: box.width +10,// Get its box width\n height: box.height// Get its box height\n }\n // If collision happened:\n if (playerPosition.x < gemPosition.x + gemPosition.width && playerPosition.x + playerPosition.width > gemPosition.x && playerPosition.y < gemPosition.y + gemPosition.height && playerPosition.y + playerPosition.height > gemPosition.y) {\n audioFiles.collect.play();// Play collect sound effect\n // If th gem collect is orange the score will be incremented by 100\n // If th gem collect is blue the score will be incremented by 200\n // If th gem collect is green the score will be incremented by 300\n player.score += (this.gemSelected+1)*100;\n this.x = -100;// hide the gem by moving it offscreen\n this.gemCollected++;// increment player gem collected\n }\n }" ]
[ "0.8242537", "0.81642884", "0.7972531", "0.7969144", "0.79020214", "0.7889868", "0.7889128", "0.7847722", "0.78150135", "0.77911234", "0.77808726", "0.7743704", "0.77410895", "0.77223575", "0.77132636", "0.7702885", "0.76842475", "0.7679602", "0.76764977", "0.7670293", "0.76613003", "0.764147", "0.7635881", "0.7634854", "0.7634854", "0.7633825", "0.76304084", "0.76284325", "0.7628122", "0.76214856", "0.76180404", "0.76115537", "0.76111597", "0.761038", "0.7605124", "0.7605018", "0.7599926", "0.75985914", "0.7594844", "0.75781035", "0.75671124", "0.7563981", "0.75551605", "0.7553103", "0.7550477", "0.75443214", "0.7543752", "0.7536898", "0.7529346", "0.7522191", "0.7520752", "0.751574", "0.75141305", "0.75094825", "0.75065136", "0.7506455", "0.750238", "0.7500889", "0.7500028", "0.74958533", "0.74917096", "0.749139", "0.7484972", "0.7481174", "0.74807715", "0.74705255", "0.7468791", "0.74637187", "0.74609596", "0.7458547", "0.74548304", "0.74512583", "0.744498", "0.74346787", "0.74338734", "0.7430243", "0.7427622", "0.74274313", "0.74274313", "0.74270594", "0.74253935", "0.7416872", "0.7409247", "0.7409092", "0.7408446", "0.7406605", "0.7403569", "0.7401851", "0.73992395", "0.7399028", "0.7397066", "0.73942095", "0.739175", "0.7365335", "0.7364289", "0.73622596", "0.7360933", "0.7357489", "0.7356032", "0.7355779", "0.7355133" ]
0.0
-1
This function updates the position and motion of the player in the system
function gamePlay() { // Check collisions collisionDetection(); // Check whether the player is on a platform var isOnPlatform = player.isOnPlatform(); // Update player position var displacement = new Point(); // Move left or right if (player.motion == motionType.LEFT) displacement.x = -MOVE_DISPLACEMENT; if (player.motion == motionType.RIGHT) displacement.x = MOVE_DISPLACEMENT; // Fall if (!isOnPlatform && player.verticalSpeed <= 0) { displacement.y = -player.verticalSpeed; player.verticalSpeed -= VERTICAL_DISPLACEMENT; } // Jump if (player.verticalSpeed > 0) { displacement.y = -player.verticalSpeed; player.verticalSpeed -= VERTICAL_DISPLACEMENT; if (player.verticalSpeed <= 0) player.verticalSpeed = 0; } // Get the new position of the player var position = new Point(); position.x = player.position.x + displacement.x; position.y = player.position.y + displacement.y; // Check collision with platforms and screen player.collidePlatform(position); player.collideScreen(position); // Set the location back to the player object (before update the screen) player.position = position; moveBullets(); updateScreen(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n\n \n this.movePlayerManager();\n\n\n \n\n }", "function update() {\n playerMove();\n cooldowns.call(this);\n moveEnemies();\n // this.cameras.main.centerOn(player.x, player.y);\n}", "updatePos() {\n if (this.x != this.player.x || this.y != this.player.y) {\n this.x = this.player.x;\n this.y = this.player.y;\n }\n }", "update() {\n // initialize next move\n let nextPosition = this.getNextPosition();\n // if next position is not blocked by an object\n if (this.isPositionFree(nextPosition)) {\n this.position.x = nextPosition.x;\n this.position.y = nextPosition.y;\n\n // if successful, send movement to server\n this.game.broadcastPosition({id: this.id, x: this.position.x, y: this.position.y, direction: this.direction});\n }\n\n }", "function update() {\n if (cursors.left.isDown) {\n player.setVelocityX(-160);\n\n player.anims.play(\"left\", true);\n } else if (cursors.right.isDown) {\n player.setVelocityX(160);\n\n player.anims.play(\"right\", true);\n } else {\n player.setVelocityX(0);\n player.anims.play(\"turn\");\n }\n\n if (cursors.up.isDown && player.body.touching.down) {\n player.setVelocityY(-550);\n }\n\n // this.tweens.add({\n // targets: joeB,\n // y: 450,\n // duration: 2000,\n // ease: \"Power2\",\n // yoyo: true,\n // loop: -1,\n // });\n}", "update()\n {\n if(this.player.y > 175 && this.playerCanMove)\n {\n this.player.y+=-this.stroming;\n }\n // MOVE PLAYER\n if(this.playerCanMove)\n {\n if( this.cursorKeys.left.isDown || this.leftButPressed)\n {\n this.LeftButtonDown();\n }\n else if( this.cursorKeys.right.isDown || this.rightButPressed)\n {\n this.RightButtonDown();\n }\n else if( this.cursorKeys.down.isDown || this.downButPressed)\n {\n this.DownButtonDown();\n }\n else if( this.cursorKeys.up.isDown || this.upButPressed)\n {\n this.UpButtonDown();\n }\n else\n {\n this.player.body.setVelocity(0);\n this.player.setAngle(0);\n this.player.anims.play('player-idle',false);\n }\n }\n else\n {\n if(!this.playerIsDead)\n {\n this.player.anims.play('player-idle',false);\n }\n this.player.body.setVelocity(0);\n }\n \n if(this.playerCanMove)\n {\n this.timer += 1;\n while (this.timer > this.spawndelay) {\n this.SpawnObject();\n this.timer = 0;\n }\n this.CheckOutOfBoundsObjects();\n }\n }", "function update_position() {\r\n if (!error_state) {\r\n if (prev_time + 50 < Date.now()) {\r\n prev_time = Date.now();\r\n //50 ms + 5ms to account for drift, measured to be around 5ms per update cycle.\r\n local_track.position += 55;\r\n update_controls_UI();\r\n }\r\n }\r\n }", "update() {\n // Check if the player has reached the goal\n if (this.isReady && this.y === -25) {\n this.isReady = false;\n this.updateScore(); // Increment score by 1\n setTimeout(() => {\n // Reposition the player at the starting spot after brief delay\n [this.x, this.y] = this.startPos;\n this.isReady = true;\n }, 500);\n } else if (this.isReady && this.wantsToMove) {\n this.move(this.direction); // Move the player\n this.wantsToMove = false;\n }\n }", "function update() {\n // Only send position when it's updated\n var playerUpdate = JSON.stringify(Global.player.properties());\n if (playerUpdate !== lastPlayerUpdate) {\n lastPlayerUpdate = playerUpdate;\n socket.emit('update player', Global.player.properties());\n }\n }", "function update() {\n\t/**\n\t * Flickers player when he's invincible\n\t */\n\tif (invincible && new Date().getTime() - gracePeriodFlickerTime > 250) {\n\t\tif (gracePeriodAlpha) {\n\t\t\tplayer.alpha = 0.1;\n\t\t\tgracePeriodAlpha = false;\n\t\t\tgracePeriodFlickerTime = new Date().getTime();\n\t\t} else {\n\t\t\tplayer.alpha = 1;\n\t\t\tgracePeriodAlpha = true;\n\t\t\tgracePeriodFlickerTime = new Date().getTime();\n\t\t}\n\t}\n\n\t/**\n\t * Moves all penguins\n\t */\n\tif (started) {\n\t\tpenguinsLEFT.forEach((el, i) => {\n\t\t\tel.body.velocity.x = boundingWidth * modus.penguinConfig.speed * -1;\n\t\t});\n\t\tpenguinsRIGHT.forEach((el, i) => {\n\t\t\tel.body.velocity.x = boundingWidth * modus.penguinConfig.speed;\n\t\t});\n\t}\n\n\t/**\n\t * Debug code which enables cursors for testing\n\t */\n\tif (!gyroscope && alive) {\n\t\t/**\n\t\t * When pressing left button\n\t\t */\n\t\tif (cursors.left.isDown && !cursors.right.isDown) {\n\t\t\t//set velocity\n\t\t\tplayer.body.velocity.x = boundingWidth * -0.3;\n\n\t\t\t//play the correct animation\n\t\t\tplayer.anims.play('left' + avatars.indexOf(avatar));\n\t\t\t//crop if avatar needs it\n\t\t\tif (avatar.crop) {\n\t\t\t\tplayer.height = 286.752;\n\t\t\t\tplayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t}\n\n\t\t\t//if multiplayer send player data to other users\n\t\t\tif (connectedCloud) {\n\t\t\t\tlet newPlayerData = {\n\t\t\t\t\tclientId: clientId,\n\t\t\t\t\tisRunning: true,\n\t\t\t\t\tdirection: -1\n\t\t\t\t};\n\t\t\t\t//check if player data is not a duplicate\n\t\t\t\tif (beforePlayerData.isRunning !== newPlayerData.isRunning || beforePlayerData.direction !== newPlayerData.direction) {\n\t\t\t\t\t//Make x,y positions relative for other resolutions and aspect ratios\n\t\t\t\t\tlet [x, y] = getNormalizedPositions(player.body.x, player.body.y);\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tisRunning: true,\n\t\t\t\t\t\t\tdirection: -1,\n\t\t\t\t\t\t\tstatus: 'movement',\n\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tbeforePlayerData = newPlayerData;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * When pressing right button\n\t\t\t */\n\t\t} else if (cursors.right.isDown) {\n\t\t\t//set velocity\n\t\t\tplayer.body.velocity.x = boundingWidth * 0.3;\n\n\t\t\t//play the correct animation\n\t\t\tplayer.anims.play('right' + avatars.indexOf(avatar));\n\t\t\t//crop if avatar needs it\n\t\t\tif (avatar.crop) {\n\t\t\t\tplayer.height = 286.752;\n\t\t\t\tplayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t}\n\n\t\t\t//if multiplayer send player data to other users\n\t\t\tif (connectedCloud) {\n\t\t\t\tlet newPlayerData = {\n\t\t\t\t\tclientId: clientId,\n\t\t\t\t\tisRunning: true,\n\t\t\t\t\tdirection: 1\n\t\t\t\t};\n\t\t\t\t//check if player data is not a duplicate\n\t\t\t\tif (beforePlayerData.isRunning !== newPlayerData.isRunning || beforePlayerData.direction !== newPlayerData.direction) {\n\t\t\t\t\t//Make x,y positions relative for other resolutions and aspect ratios\n\t\t\t\t\tlet [x, y] = getNormalizedPositions(player.body.x, player.body.y);\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tisRunning: true,\n\t\t\t\t\t\t\tdirection: 1,\n\t\t\t\t\t\t\tstatus: 'movement',\n\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tbeforePlayerData = newPlayerData;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// player.anims.play('right', true);\n\t\t} else {\n\t\t\t//set velocity\n\t\t\tplayer.body.velocity.x = 0;\n\n\t\t\t//play the correct animation\n\t\t\tplayer.anims.play('turn' + avatars.indexOf(avatar));\n\t\t\t//crop if avatar needs it\n\t\t\tif (avatar.crop) {\n\t\t\t\tplayer.height = 286.752;\n\t\t\t\tplayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t}\n\n\t\t\t//if multiplayer send player data to other users\n\t\t\tif (connectedCloud) {\n\t\t\t\tlet newPlayerData = {\n\t\t\t\t\tclientId: clientId,\n\t\t\t\t\tisRunning: false,\n\t\t\t\t\tdirection: 0\n\t\t\t\t};\n\t\t\t\t//check if player data is not a duplicate\n\t\t\t\tif (beforePlayerData.isRunning !== newPlayerData.isRunning) {\n\t\t\t\t\t//Make x,y positions relative for other resolutions and aspect ratios\n\t\t\t\t\tlet [x, y] = getNormalizedPositions(player.body.x, player.body.y);\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tisRunning: false,\n\t\t\t\t\t\t\tdirection: 0,\n\t\t\t\t\t\t\tstatus: 'movement',\n\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tbeforePlayerData = newPlayerData;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// player.anims.play('turn');\n\t\t}\n\n\t\t/**\n\t\t * When player is not touching the floor\n\t\t */\n\t\tif (!player.body.touching.down) {\n\t\t\t//Disable crop for normal state\n\t\t\tplayer.isCropped = false;\n\t\t\tplayer.height = 359;\n\n\t\t\t//Play correct animation\n\t\t\tif (player.body.velocity.x === 0) {\n\t\t\t\tplayer.anims.play('turnJump' + avatars.indexOf(avatar));\n\t\t\t} else {\n\t\t\t\tif (player.body.velocity.x > 0) player.anims.play('rightJump' + avatars.indexOf(avatar));\n\t\t\t\tif (player.body.velocity.x < 0) player.anims.play('leftJump' + avatars.indexOf(avatar));\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * When the up button is being pressed -> jump\n\t\t */\n\t\tif (cursors.up.isDown && player.body.touching.down) {\n\t\t\t//Set velocity\n\t\t\tplayer.body.velocity.y = (boundingHeight / 2) * 1.5 * -1;\n\n\t\t\t//if multiplayer send player data to other users\n\t\t\tif (connectedCloud) {\n\t\t\t\tlet newPlayerData = {\n\t\t\t\t\tclientId: clientId,\n\t\t\t\t\tisJumping: true\n\t\t\t\t};\n\t\t\t\t//check if player data is not a duplicate\n\t\t\t\tif (beforePlayerData.isJumping !== newPlayerData.isJumping) {\n\t\t\t\t\t//Make x,y positions relative for other resolutions and aspect ratios\n\t\t\t\t\tlet [x, y] = getNormalizedPositions(player.body.x, player.body.y);\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tisJumping: true,\n\t\t\t\t\t\t\tstatus: 'movement',\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tbeforePlayerData = newPlayerData;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\t/**\n\t\t * When player is not touching the floor\n\t\t */\n\t\tif (!player.body.touching.down) {\n\t\t\t//Disable crop for normal state\n\t\t\tplayer.isCropped = false;\n\t\t\tplayer.height = 359;\n\n\t\t\t//Play correct animation\n\t\t\tif (player.body.velocity.x === 0) {\n\t\t\t\tplayer.anims.play('turnJump' + avatars.indexOf(avatar));\n\t\t\t} else {\n\t\t\t\tif (player.body.velocity.x > 0) player.anims.play('rightJump' + avatars.indexOf(avatar));\n\t\t\t\tif (player.body.velocity.x < 0) player.anims.play('leftJump' + avatars.indexOf(avatar));\n\t\t\t}\n\t\t} else {\n\t\t\t//Player is touching the floor -> send update if multiplayer\n\t\t\tif (connectedCloud) {\n\t\t\t\tlet newPlayerData = {\n\t\t\t\t\tclientId: clientId,\n\t\t\t\t\tisJumping: false\n\t\t\t\t};\n\t\t\t\t//Check if not duplicate\n\t\t\t\tif (beforePlayerData.isJumping !== newPlayerData.isJumping) {\n\t\t\t\t\t//Make x,y positions relative for other resolutions and aspect ratios\n\t\t\t\t\tlet [x, y] = getNormalizedPositions(player.body.x, player.body.y);\n\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tisJumping: false,\n\t\t\t\t\t\t\tstatus: 'movement',\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tbeforePlayerData = newPlayerData;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * If client is host and game has started -> spawn new objects\n\t */\n\tif ((host || !multiplayer) && started) {\n\t\t/**\n\t\t * Randomize when an object is being spawned\n\t\t */\n\t\tlet random = Math.random() * (modus.maxSpawnTime - modus.minSpawnTime) + modus.minSpawnTime;\n\t\tif (new Date().getTime() - lastTimeSpawn > random) {\n\t\t\t/**\n\t\t\t * 80% chance for icicle\n\t\t\t * 20% chance for penguin\n\t\t\t */\n\t\t\tlet spawnChance = Math.random();\n\t\t\tif (spawnChance <= modus.icicleChance) {\n\t\t\t\t/**\n\t\t\t\t * Spawn icicle\n\t\t\t\t */\n\n\t\t\t\t//Randomize spawn location\n\t\t\t\tlet x =\n\t\t\t\t\tMath.random() *\n\t\t\t\t\t\t(((width - boundingWidth * 0.85) / 2 + boundingWidth * 0.85) * modus.icicleConfig.maxSpawnOffset - ((width - boundingWidth * 0.85) / 2) * modus.icicleConfig.minSpawnOffset) +\n\t\t\t\t\t((width - boundingWidth * 0.85) / 2) * modus.icicleConfig.minSpawnOffset;\n\n\t\t\t\t//Add sprite to the canvas\n\t\t\t\tice = this.physics.add.sprite(x, -1 * (boundingHeight * 0.4), 'icicle');\n\t\t\t\tice.scaleY = ice.scaleX = boundingWidth / 6000;\n\n\t\t\t\t//Set custom gravity (Icicle speed)\n\t\t\t\tice.setGravityY(gravity * modus.icicleConfig.gravity);\n\n\t\t\t\t//Icicle should always be on top of player\n\t\t\t\tice.setDepth(1000);\n\t\t\t\tice.setOrigin(0.5, 0);\n\n\t\t\t\t//Add the Icicle to the enemies list\n\t\t\t\tenemies.push(ice);\n\n\t\t\t\t//If alive addScore\n\t\t\t\tif (alive) addScore();\n\n\t\t\t\t//Make x,y positions relative so other players with different resolution or aspect ratio get the correct position\n\t\t\t\tlet [xb, yb] = getNormalizedPositions(x, -1 * (boundingHeight * 0.4));\n\t\t\t\tif (connectedCloud) {\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tstatus: 'newEnemy',\n\t\t\t\t\t\t\ttype: 'icicle',\n\t\t\t\t\t\t\tx: xb,\n\t\t\t\t\t\t\ty: yb\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (spawnChance <= modus.penguinChance + modus.icicleChance) {\n\t\t\t\t/**\n\t\t\t\t * Spawn penguin\n\t\t\t\t */\n\t\t\t\tlet x;\n\t\t\t\tlet list;\n\t\t\t\tlet flip = true;\n\n\t\t\t\t//Randomize left/right\n\t\t\t\tif (Math.random() <= 0.5) {\n\t\t\t\t\tx = (width - boundingWidth * 0.85) / 2 + boundingWidth * 0.85;\n\t\t\t\t\tlist = penguinsLEFT;\n\t\t\t\t\tflip = false;\n\t\t\t\t} else {\n\t\t\t\t\tx = (width - boundingWidth * 0.85) / 2;\n\t\t\t\t\tlist = penguinsRIGHT;\n\t\t\t\t}\n\n\t\t\t\t//Add penguin to the canvas\n\t\t\t\tlet penguin = this.physics.add.sprite(x, height - height * 0.2, 'penguin');\n\n\t\t\t\t//Scaling\n\t\t\t\tpenguin.scaleY = penguin.scaleX = boundingWidth / 16500;\n\n\t\t\t\t//Penguin should be flipped when going to the left\n\t\t\t\tpenguin.flipX = flip;\n\t\t\t\tpenguin.setOrigin(0.5, 0);\n\n\t\t\t\t//Set gravity\n\t\t\t\tpenguin.setGravityY(gravity);\n\n\t\t\t\tpenguin.setDepth(1000);\n\n\t\t\t\tpenguin.body.bounce.x = 0.5;\n\t\t\t\tpenguin.body.bounce.y = 0.5;\n\n\t\t\t\t//Penguins should be able to stand on the platform not fall through it\n\t\t\t\tthis.physics.add.collider(penguin, platforms);\n\n\t\t\t\t//Add penguin to enemy list\n\t\t\t\tenemies.push(penguin);\n\n\t\t\t\t//Add penguin to the list if it should go right or left\n\t\t\t\tlist.push(penguin);\n\n\t\t\t\t//Add score if still alive\n\t\t\t\tif (alive) addScore();\n\n\t\t\t\t//Make x,y positions relative so other players with different resolution or aspect ratio get the correct position\n\t\t\t\tlet [xb, yb] = getNormalizedPositions(x, height - height * 0.2);\n\t\t\t\tif (connectedCloud) {\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tstatus: 'newEnemy',\n\t\t\t\t\t\t\ttype: 'penguin',\n\t\t\t\t\t\t\tflip: flip,\n\t\t\t\t\t\t\tx: xb,\n\t\t\t\t\t\t\ty: yb\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * Spawn healthPowerup\n\t\t\t\t */\n\n\t\t\t\t//Randomize spawn location\n\t\t\t\tlet x =\n\t\t\t\t\tMath.random() *\n\t\t\t\t\t\t(((width - boundingWidth * 0.85) / 2 + boundingWidth * 0.85) * modus.icicleConfig.maxSpawnOffset - ((width - boundingWidth * 0.85) / 2) * modus.icicleConfig.minSpawnOffset) +\n\t\t\t\t\t((width - boundingWidth * 0.85) / 2) * modus.icicleConfig.minSpawnOffset;\n\n\t\t\t\t//Add sprite to the canvas\n\t\t\t\tlet health = this.physics.add.sprite(x, -1 * (boundingHeight * 0.4), 'heart');\n\t\t\t\thealth.scaleY = health.scaleX = boundingWidth / 22000;\n\n\t\t\t\t//Set gravity\n\t\t\t\thealth.setGravityY(gravity);\n\n\t\t\t\t//HealthPowerup should always be on top of player\n\t\t\t\thealth.setDepth(1000);\n\t\t\t\thealth.setOrigin(0.5, 0);\n\t\t\t\thealth.name = ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));\n\n\t\t\t\t//HealthPowerup should stand on the platform, not fall through\n\t\t\t\tthis.physics.add.collider(health, platforms);\n\n\t\t\t\t//Add the HealthPowerup to the powerup list\n\t\t\t\thealthPowerups.push(health);\n\n\t\t\t\t//Make x,y positions relative so other players with different resolution or aspect ratio get the correct position\n\t\t\t\tlet [xb, yb] = getNormalizedPositions(x, -1 * (boundingHeight * 0.4));\n\t\t\t\tif (connectedCloud) {\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tstatus: 'newPowerup',\n\t\t\t\t\t\t\ttype: 'health',\n\t\t\t\t\t\t\tid: health.name,\n\t\t\t\t\t\t\tx: xb,\n\t\t\t\t\t\t\ty: yb\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\t//Update when an enemy has spawned\n\t\t\tlastTimeSpawn = new Date().getTime();\n\t\t}\n\t}\n\n\t/**\n\t * When multiplayer -> update player position\n\t */\n\tif (multiplayer && otherPlayerData.alive && otherPlayer !== undefined) {\n\t\t/**\n\t\t * If running to the left\n\t\t */\n\t\tif (otherPlayerData.isRunning && otherPlayerData.direction == -1) {\n\t\t\t//Set velocity\n\t\t\totherPlayer.body.velocity.x = boundingWidth * -0.3;\n\t\t\t//Play animation\n\t\t\totherPlayer.anims.play('left' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayerData.avatar.crop) {\n\t\t\t\totherPlayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t\totherPlayer.height = 286.752;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * If running to the right\n\t\t\t */\n\t\t} else if (otherPlayerData.isRunning && otherPlayerData.direction == 1) {\n\t\t\t//Set velocity\n\t\t\totherPlayer.body.velocity.x = boundingWidth * 0.3;\n\t\t\t//Play animation\n\t\t\totherPlayer.anims.play('right' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayerData.avatar.crop) {\n\t\t\t\totherPlayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t\totherPlayer.height = 286.752;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * If standing still\n\t\t\t */\n\t\t} else {\n\t\t\t//Set velocity\n\t\t\totherPlayer.body.velocity.x = 0;\n\t\t\t//Play animation\n\t\t\totherPlayer.anims.play('turn' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayerData.avatar.crop) {\n\t\t\t\totherPlayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t\totherPlayer.height = 286.752;\n\t\t\t}\n\t\t}\n\t\t/**\n\t\t * If other player is jumping\n\t\t */\n\t\tif (!otherPlayer.body.touching.down) {\n\t\t\t//Play animation\n\t\t\tif (otherPlayer.body.velocity.x === 0) otherPlayer.anims.play('turnJump' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayer.body.velocity.x > 0) otherPlayer.anims.play('rightJump' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayer.body.velocity.x < 0) otherPlayer.anims.play('leftJump' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayerData.avatar.crop) {\n\t\t\t\totherPlayer.isCropped = false;\n\t\t\t\totherPlayer.height = 359;\n\t\t\t}\n\t\t}\n\t\t/**\n\t\t * If the other player is about to jump\n\t\t */\n\t\tif (otherPlayerData.isJumping && otherPlayer.body.touching.down) {\n\t\t\t//Set velocity\n\t\t\totherPlayer.body.velocity.y = (boundingHeight / 2) * 1.5 * -1;\n\n\t\t\t//Set jumping to false so the player won't jump twice\n\t\t\totherPlayerData.isJumping = false;\n\t\t}\n\t}\n\n\t/**\n\t * If player fell of the platform -> hit\n\t */\n\tif (player.body.y > height) {\n\t\thit();\n\t}\n\n\t/**\n\t * Update highscore missions\n\t */\n\n\tif (leaderboard !== undefined) {\n\t\tif (leaderboard.length !== 0) {\n\t\t\tlet lowestScoreToBeat;\n\t\t\tlet position = 1;\n\t\t\tleaderboard.forEach((el, i) => {\n\t\t\t\tif ((el.score < lowestScoreToBeat && el.score > score) || lowestScoreToBeat === undefined) {\n\t\t\t\t\tlowestScoreToBeat = el.score;\n\t\t\t\t\tposition = i + 1;\n\t\t\t\t}\n\t\t\t});\n\t\t\thighscorePositionObject.innerHTML = `${position}e`;\n\t\t\thighscoreScoreObject.innerHTML = lowestScoreToBeat;\n\t\t} else {\n\t\t\thighscorePositionObject.innerHTML = `1e`;\n\t\t\thighscoreScoreObject.innerHTML = 0;\n\t\t}\n\t} else {\n\t\thighscorePositionObject.innerHTML = `1e`;\n\t\thighscoreScoreObject.innerHTML = 0;\n\t}\n}", "function onPlayerMove(id, position) {\n\taoi_st.update(id, position.x, position.y);\n}", "movePlayerManager() {\n if (this.cursorKeys.left.isDown) {\n this.player.setVelocityX(-gameSettings.playerSpeed);\n }\n else if (this.cursorKeys.right.isDown) {\n this.player.setVelocityX(gameSettings.playerSpeed);\n }\n\n if (this.cursorKeys.up.isDown) {\n this.player.setVelocityY(-gameSettings.playerSpeed);\n }\n else if (this.cursorKeys.down.isDown) {\n this.player.setVelocityY(gameSettings.playerSpeed);\n }\n }", "update() {\n super.update();\n let state = this.state;\n let entities = state.entities;\n entities.forEach(th => {\n th.data.repulse.set(0, 0);\n });\n entities.forEach(th => {\n this._processThinker(th)\n });\n // tous les sprites doivent etre relatifs à ce point de vue\n let p = state.player.data.position;\n entities.forEach(e => {\n e.sprite.position.set(e.data.position.sub(p));\n });\n ++this.state.time;\n state.player.sprite.position.set(0, 0);\n state.view.set(p);\n }", "update() {\r\n this.draw()\r\n this.angle = this.angle + this.angleX\r\n if(this.angle > 6) {\r\n this.angle = 0\r\n }\r\n if(this.angle < 0) {\r\n this.angle = 6\r\n }\r\n this.x = this.x + this.playerMov1.x\r\n this.y = this.y + this.playerMov1.y\r\n if(this.x > this.wc * 2 - this.pSize) this.x = this.wc * 2 - this.pSize\r\n if(this.x < 0) this.x = 0\r\n if(this.y < 0) this.y = 0\r\n if(this.y > this.sh - this.pSize) this.y = this.sh - this.pSize\r\n }", "function updatePlayer(map){\n if(map[16]){ //Shift\n self.terminal=5;\n }else{\n self.terminal=1;\n }\n setPlayerVelocity(map); // Set the player velocity based on key presses\n self.look=[Math.cos(theta)*Math.sin(phi),Math.cos(phi),Math.sin(theta)*Math.sin(phi)]; // 3D Polar coordinates\n self.lookXY=[Math.cos(theta),Math.sin(theta)]; // 2D polar coordinates, for horizontal velocity\n self.strafe=[Math.cos(theta+Math.PI/2),Math.sin(theta+Math.PI/2)]; // Perpendicular, for strafing\n self.position[1]+=self.velocity[1]; // Set the vertical velocity\n self.position[0]+=self.velocity[0]*self.lookXY[0] + self.velocity[2]*self.strafe[0]; // Set the horizontal velocities\n self.position[2]+=self.velocity[0]*self.lookXY[1] + self.velocity[2]*self.strafe[1]; // Set the horizontal velocities\n}", "function update() {\n if (localPlayer.update(keys)) {\n socket.emit('move player', {\n x: localPlayer.getX(),\n y: localPlayer.getY(),\n });\n }\n}", "function update(){\n winSong.pause();\n soundtrack.play();\n gameLoop = requestAnimationFrame(update);\n getInput();\n enemyMovement();\n physics();\n wrapPlayers();\n drawGame();\n}", "function update() { \n // Control the player with left or right keys\n //if the player goes left and the player is on the floor, \n //set the velocity, and indicate that the walking will happen\n //else if the player goes right and the player is on the floor,\n //set the velocity and indicatee that the walking will happen\n if (this.cursors.left.isDown) {\n this.player.setVelocityX(-200);\n if (this.player.body.onFloor()) {\n this.player.play('walk', true);\n }\n } else if (this.cursors.right.isDown) {\n this.player.setVelocityX(200);\n if (this.player.body.onFloor()) {\n this.player.play('walk', true);\n }\n } else {\n // If no keys are pressed, the player keeps still\n //Because the player is stationary, it will have no velocity\n this.player.setVelocityX(0);\n // Only show the idle animation if the player is footed\n // If this is not included, the player would look idle while jumping\n if (this.player.body.onFloor()) {\n this.player.play('idle', true);\n }\n }\n\n // Player can jump while walking any direction by pressing the space bar\n // or the 'UP' arrow\n if ((this.cursors.space.isDown || this.cursors.up.isDown) && this.player.body.onFloor()) {\n this.player.setVelocityY(-350);\n this.player.play('jump', true);\n }\n\n if (this.player.body.velocity.x > 0) {\n this.player.setFlipX(false);\n } else if (this.player.body.velocity.x < 0) {\n // otherwise, make them face the other side\n this.player.setFlipX(true);\n }\n}", "update() {\n super.update();\n this.move();\n }", "update() {\n this.player.update(this.cursors);\n }", "update() {\r\n this.draw()\r\n this.angle = this.angle + this.angleX\r\n if(this.angle > 6) {\r\n this.angle = 0\r\n }\r\n if(this.angle < 0) {\r\n this.angle = 6\r\n }\r\n this.x = this.x + this.playerMov2.x\r\n this.y = this.y + this.playerMov2.y\r\n if(this.x > this.wc * 2 - this.pSize) this.x = this.wc * 2 - this.pSize\r\n if(this.x < 0) this.x = 0\r\n if(this.y < 0) this.y = 0\r\n if(this.y > this.sh - this.pSize) this.y = this.sh - this.pSize\r\n }", "function updateScreen() {\n // Transform the player\n player.node.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\");\n \n // Calculate the scaling and translation factors\t\n \n // Add your code here\n\t\n}", "function updatePlayer (player) {\n if (player.inputs.up) player.y -= 5;\n if (player.inputs.down) player.y += 5;\n if (player.inputs.left) player.x -= 5;\n if (player.inputs.right) player.x += 5;\n}", "function gamePlay() {\r\n // Check collisions\r\n collisionDetection();\r\n\r\n // Check whether the player is on a platform\r\n var isOnPlatform = player.isOnPlatform();\r\n\r\n // Update player position\r\n var displacement = new Point();\r\n\r\n // Move left or right\r\n if (player.motion == motionType.LEFT)\r\n displacement.x = -MOVE_DISPLACEMENT;\r\n if (player.motion == motionType.RIGHT)\r\n displacement.x = MOVE_DISPLACEMENT;\r\n\r\n // Fall\r\n if (!isOnPlatform && player.verticalSpeed <= 0) {\r\n displacement.y = -player.verticalSpeed;\r\n player.verticalSpeed -= VERTICAL_DISPLACEMENT;\r\n }\r\n\r\n // Jump\r\n if (player.verticalSpeed > 0) {\r\n displacement.y = -player.verticalSpeed;\r\n player.verticalSpeed -= VERTICAL_DISPLACEMENT;\r\n if (player.verticalSpeed <= 0)\r\n player.verticalSpeed = 0;\r\n }\r\n\r\n // Get the new position of the player\r\n var position = new Point();\r\n position.x = player.position.x + displacement.x;\r\n position.y = player.position.y + displacement.y;\r\n\r\n // Check collision with platforms and screen\r\n player.collidePlatform(position);\r\n player.collideScreen(position);\r\n\r\n // Set the location back to the player object (before update the screen)\r\n player.position = position;\r\n\r\n // Move the bullets\r\n moveBullets();\r\n\tmonsterMove();\r\n updateScreen();\r\n}", "function movePlayer() {\n // Check whether the player is on a platform\n var isOnPlatform = player.isOnPlatform();\n\n // Update player position\n var displacement = new Point();\n\n // Move left or right\n if (player.motion == motionType.LEFT) {\n displacement.x = -PLAYER_X_SPEED;\n }\n if (player.motion == motionType.RIGHT) {\n displacement.x = PLAYER_X_SPEED;\n }\n\n // Fall\n if (!isOnPlatform && player.verticalSpeed <= 0) {\n displacement.y = -player.verticalSpeed;\n player.verticalSpeed -= PLAYER_Y_ACCELERATION;\n }\n\n // Jump\n if (player.verticalSpeed > 0) {\n displacement.y = -player.verticalSpeed;\n player.verticalSpeed -= PLAYER_Y_ACCELERATION;\n if (player.verticalSpeed <= 0) {\n player.verticalSpeed = 0;\n }\n }\n\n // Get the new position of the player\n var position = new Point();\n position.x = player.position.x + displacement.x;\n position.y = player.position.y + displacement.y;\n\n // Check collision with platforms and screen\n player.collidePlatform(position);\n player.collideScreen(position);\n\n // Set the location back to the player object (before update the screen)\n player.position = position;\n\n for (var i = 0; i < 3; ++i) {\n if (hasDisappearingPlatform[i]) {\n if (player.isOnDisappearingPlatform(i)) {\n if (!isOnDisappearingPlatform[i]) {\n isOnDisappearingPlatform[i] = true;\n disappearingTimeout[i] = setTimeout(\"removeDisappearingPlatform(\" + i + \")\", 500);\n }\n } else {\n if (isOnDisappearingPlatform[i]) {\n isOnDisappearingPlatform[i] = false;\n if (disappearingTimeout[i] != null) {\n clearTimeout(disappearingTimeout[i]);\n }\n }\n }\n }\n }\n}", "function update()\n\t\t{\n\t\t\tdocument.getElementById('songTime').innerHTML = millisToMins(player.currentTime);\n\t\t\tslider.value = player.currentTime;\n\t\t}", "playerMovement() {\n if (this.key.up.isDown && !this.movementDisabled) {\n this.setVelocityY(-this.speed);\n if (this.y < 64) {this.y = 64}\n } else if (this.key.down.isDown && !this.movementDisabled) {\n this.setVelocityY(this.speed);\n if (this.y > 3040) {this.y = 3040}\n } else {\n this.setVelocityY(0);\n }\n if (this.key.left.isDown && !this.movementDisabled) {\n this.setVelocityX(-this.speed);\n if (this.x < 32) {this.x = 32}\n this.flipX = false;\n } else if (this.key.right.isDown && !this.movementDisabled) {\n this.setVelocityX(this.speed);\n if (this.x > 5024) {this.x = 5024}\n this.flipX = true;\n } else {\n this.setVelocityX(0);\n }\n\n if (\n this.key.down.isDown ||\n this.key.up.isDown ||\n this.key.left.isDown ||\n this.key.right.isDown\n ) {\n if (!this.isWalking) {\n this.playerWalkAnimStart();\n }\n } else {\n this.playerWalkAnimStop();\n }\n\n this.updateNametagLocation();\n \n }", "function update() {\n // board movement.\n board.update();\n\n // arrow movement.\n updateArrow();\n}", "function UpdateLocalPlayerPos()\n{\n if (!map_ui) {return;}\n const pos = jcmp.localPlayer.position;\n UpdateMapPos(pos);\n}", "function updatePlayer(player) {\n playerDisplay.textContent = `${player}'s Move`;\n}", "newPos() {\n this.gravitySpeed += this.gravity;\n this.y += this.speedY - this.gravitySpeed;\n }", "function update() {\n world.Step(\n 1 / 60 //frame-rate\n , 10 //velocity iterations\n , 10 //position iterations\n );\n world.DrawDebugData();\n world.ClearForces();\n\n requestAnimFrame(update);\n }", "function updatePlayerPosition() {\n avatar.x = mouseX;\n avatar.y = mouseY;\n avatar.currentSize = avatar.currentSize - SHRINK;\n avatar.currentSize = constrain(avatar.currentSize,0,avatar.maxSize);\n if (avatar.currentSize === 0) {\n avatar.isPlayerAlive = false;\n }\n else {\n avatar.isPlayerAlive = true;\n }\n}", "update() {\n this.move();\n this.age();\n }", "refreshPos() {\n\t\tlet player = this;\n\t\tif (!this.idle) {\n\t\t\tswitch (this.last_direction) {\n\t\t\t\tcase DIRECTION.DOWN: //based on direction, the characters position in the matrix is updated\n\t\t\t\t\tthis.position.row += 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DIRECTION.UP:\n\t\t\t\t\tthis.position.row -= 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DIRECTION.RIGHT:\n\t\t\t\t\tthis.position.col += 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DIRECTION.LEFT:\n\t\t\t\t\tthis.position.col -= 1;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tboard.items.forEach(function (item, index, object) {\n\t\t\t\tif (item.position.row == player.position.row &&\n\t\t\t\t\titem.position.col == player.position.col) {\n\t\t\t\t\titem.updatePlayer(player, item); // trigger the effect on the player\n\t\t\t\t\taudioPickupItem.play();\n\t\t\t\t\tobject.splice(index, 1); // destroy the item\n\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}", "Update () {\n //keep a record of the old position so the goal::scored method\n //can utilize it for goal testing\n this.m_vOldPos = new Vector2D( this.m_vPosition );\n\n //Test for collisions\n this.TestCollisionWithWalls( this.m_PitchBoundary );\n\n //Simulate Prm.Friction. Make sure the speed is positive \n //first though\n if ( this.m_vVelocity.LengthSq() > Prm.Friction * Prm.Friction ) {\n this.m_vVelocity.add( Vector2D.mul( Vector2D.Vec2DNormalize( this.m_vVelocity ), Prm.Friction ) );\n this.m_vPosition.add( this.m_vVelocity );\n\n //update heading\n this.m_vHeading = Vector2D.Vec2DNormalize( this.m_vVelocity );\n };\n }", "movePlayer() {\r\n this.ctx.clearRect(0, 0, canvas.width, canvas.height);\r\n this.drawText();\r\n this.posY = this.posY + this.speed * this.inputY;\r\n this.posX = this.posX + this.speed * this.inputX;\r\n this.renderPlayer();\r\n }", "update (dt) {\n // You should multiply any movement by the dt parameter\n // which will ensure the game runs at the same speed for\n // all computers.\n const {x, y} = this.getCurrentPosition();\n let newX;\n if (x >= 500) {\n newX = -100;\n } else {\n newX = (x + dt * this.speed * 150) % (500)\n }\n\n this.setCurrentPosition(newX, y);\n }", "function updatePosition(e) {\n xRotation = adjustRotation(e.movementX, xRotation);\n yRotation = adjustRotation(e.movementY, yRotation);\n}", "update(){\n if(this.microphone){\n Howler.pos(this.pos.x, this.pos.y, this.pos.z);\n } \n if(this.positional){\n this.sound.pos(this.pos.x, this.pos.y, this.pos.z);\n } \n }", "update(){\n if(this.microphone){\n Howler.pos(this.pos.x, this.pos.y, this.pos.z);\n } \n if(this.positional){\n this.sound.pos(this.pos.x, this.pos.y, this.pos.z);\n } \n }", "update() {\n if (this.y > 380) { //if player attempts to go over the 380 limit, player will remain at the 380 position\n this.y = 380;\n } else if (this.y < 0) { //if player a reaches to the top of the canvas (where the water is), player will be relocated to the default location\n this.x = 202;\n this.y = 380;\n\n score++; //score increments by 1 when player gets in range of the water\n $('.num').text(score); //updated score then gets appended to .num span\n }\n\n if (this.x > 400) { //if player attempts to go over 400 on the right or 0 on the left, player's position with remain at the 400 or 0 position\n this.x = 400;\n } else if (this.x < 0) {\n this.x = 0;\n }\n }", "update() {\n this.location.add(this.velocity);\n\t}", "update() {\n this.moveNinja();\n }", "update() {\n // On every win\n win();\n // If player goes outside\n this.outsideCanvas();\n }", "function update() {\n player.update(gameInput.inputs);\n\n render();\n}", "_updatePositionWithVelocity() {\n this._x += this._dx;\n this._y += this._dy;\n }", "function movePlayer() {\n p1.render();\n p1.move();\n}", "update() {\n // if the player touches the top of the screen...\n if (this.player.y < 0) {\n // gmae over man, restart the game\n this.scene.start(\"PlayGame\");\n }\n }", "update() {\n let approxXpos = this.x + 20;\n let approxYpos = this.y + 20;\n if ((player.x >= this.x && player.x <= approxXpos) && (player.y >= this.y && player.y <= approxYpos)) {\n this.firstTime = false;\n this.conquer = true;\n }\n if (this.firstTime === false && this.count === 0) {\n player.lives++;\n player.livesText.textContent = player.lives;\n this.count++;\n }\n }", "function update(){\n\t$(\"#characters\").children().each(function(index) {\n\t\tif( !$(this).hasClass(\"character-removed\") )\n\t\t{\n\t\t\tvar srcPos = $(this).attr(\"srcPos\"), destPos = $(this).attr(\"destPos\");\n\t\t\tvar destX = getPosX(destPos), srcX = getPosX(srcPos);\n\t\t\tvar movDistance = (destX - srcX) / 32;\n\t\t\tvar curPos = $(this).css(\"left\");\n\t\t\tvar nPosGap = Math.abs(destPos-srcPos);\n\t\t\n\t\t\tif(nPosGap == 0 ) // stay\n\t\t\t{\n\t\t\t\t//if(Math.random() > 0.5)\n\t\t\t\t{\n\t\t\t\t\tjumpMario($(this));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(nPosGap <= 2) // walking\n\t\t\t{\n\t\t\t\twalkMario($(this));\n\t\t\t}\n\t\t\telse if(nPosGap <4) // jump\n\t\t\t{\n\t\t\t\tjumpMario($(this));\n\t\t\t}\n\t\t\telse // run\n\t\t\t{\n\t\t\t\trunMario($(this));\n\t\t\t}\n\t\t}\n\t});\n\t\n\tmarioGame.nFrame++;\n\tif(marioGame.nFrame > 31){\n\t\tmarioGame.nFrame = 0;\n\t\tmarioGame.nTurn++;\n\t}\n}", "function update() {\n ball.update();\n player.update();\n ai.update();\n}", "update() {\r\n this.x += this.xspeed;\r\n this.y += this.yspeed;\r\n }", "updatePos() {\n if (!this.isGrounded) { // see if player is able to jump\n\n if (this.y != this.jumpConfig.START_Y) { // buffer frames to make jump animate better\n this.jumpWait--;\n } else {\n this.jumpWait = 0;\n }\n\n if (this.jumpWait == 0) { // check if we land on a jump frame\n if (this.jumpDirection > 0) {\n this.y -= (this.jumpForce * 8) * this.jumpDirection;\n } else {\n this.y += (this.jumpConfig.INIT_JUMP_FORCE * 9) - (this.jumpForce * 8);\n }\n\n if (this.jumpForce > 0) {\n this.jumpForce--;\n }\n \n if (this.jumpForce == 0) {\n if (this.jumpDirection < 1) {\n this.isGrounded = true;\n } else {\n if (this.jumpHeightWait > 0) {\n this.jumpHeightWait--;\n } else {\n this.jumpHeightWait = this.jumpConfig.JUMP_ZERO_WAIT;\n }\n }\n if (this.jumpHeightWait <= 0) {\n this.jumpDirection = (-this.jumpDirection);\n this.jumpForce = this.jumpConfig.INIT_JUMP_FORCE;\n }\n }\n this.jumpWait = this.jumpConfig.JUMP_FRAME_WAIT;\n }\n }\n\n this.hitbox.updatePos(\n this.y + this.hitboxConfig.Y_MARGIN,\n this.y + this.hitboxConfig.HEIGHT + this.hitboxConfig.Y_MARGIN,\n this.x + this.hitboxConfig.X_MARGIN,\n this.x + this.hitboxConfig.WIDTH + this.hitboxConfig.X_MARGIN\n );\n \n this.updateInvincibility();\n this.draw();\n }", "update()\n\t{\n\t\tthis.x += this.xspeed;\n\t\tthis.y += this.yspeed;\n\t}", "function updatePlayer() {\n player.update();\n player.draw();\n\n // game over\n if (player.y + player.height >= canvas.height) {\n gameOver();\n }\n }", "function updateScreen() {\r\n if (isGameOver) return ;\r\n\r\n updateGhostPosition()\r\n updateBulletPosition()\r\n updateVerticalPlatformPosition()\r\n\r\n // Transform the player\r\n if (flipPlayer==motionType.LEFT){\r\n player.node.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\" + \"translate(\" + PLAYER_SIZE.w + \", 0) scale(-1, 1)\");\r\n }\r\n else\r\n player.node.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\");\r\n \r\n // ghost\r\n for (var i=0; i<ghost_count; i++){\r\n if (ghost[i]){\r\n if (ghost[i].motion == motionType.LEFT){\r\n ghost[i].svgObject.setAttribute(\"transform\", \"translate(\" + ghost[i].position.x + \",\" + ghost[i].position.y + \")\" + \"translate(\" + GHOST_SIZE.w + \", 0) scale(-1, 1)\"); \r\n }\r\n else\r\n ghost[i].svgObject.setAttribute(\"transform\", \"translate(\" + ghost[i].position.x + \",\" + ghost[i].position.y + \")\"); \r\n }\r\n }\r\n\r\n //bullet\r\n for (var i=0; i<8-bullet_count; i++){\r\n if (bullet[i]){\r\n if (bullet[i].motion==motionType.RIGHT)\r\n bullet[i].svgObject.setAttribute(\"transform\", \"translate(\" + bullet[i].position.x + \",\" + bullet[i].position.y + \")\" + \"translate(\" + 10 + \", 0) scale(-1, 1)\"); \r\n else\r\n bullet[i].svgObject.setAttribute(\"transform\", \"translate(\" + bullet[i].position.x + \",\" + bullet[i].position.y + \")\"); \r\n } \r\n }\r\n // Calculate the scaling and translation factors\t\r\n \r\n // Add your code here\r\n \r\n}", "function update()\n{\n\t// Ensure looping behaviour.\n\trequestAnimationFrame(update);\n\n\t// Whatever we want to happen in the loop.\n\tif(isplaying)\n\t{\n\t\t// Update the player\n\t\tP_Controller.Update();\n\t\t// Make the camera follow the player\n\t\tFollowPosition(P_Controller.gameobject.position, cameraOffset, camera);\n\t\tcamera.position.x = 0;\n\t\t// Make the floor follow the player\n\t\tFollowPosition(P_Controller.gameobject.position, floorOffset, plane);\n\t\tplane.position.x = 0;\n\t\t\n\n\t\t// Handle the obstacles\n\t\tfor(var i = 0; i < numberOfObstacles; i++)\n\t\t{\n\t\t\tobstacleArray[i].update(P_Controller.currentLane, player.position.z);\n\t\t}\n\t}else\n\t{\n\n\t}\n\t\t\n\t// Re-render the scene.\n\trenderer.render(scene,camera);\n}", "function updatePlayerPos(player) {\n c.beginPath();\n c.arc(player.coords.x, player.coords.y, player.\n radius, 0, Math.PI * 2, false);\n c.fillStyle = player.color;\n c.fill();\n}", "function movePlayer() {\n screenWarping(\"player\");\n playerX += playerVX;\n playerY += playerVY;\n}", "function updateHowlerPosition() {\n\tlet cameraPosition = (new THREE.Vector3(0, 1.6, 0)).add(document.querySelector(\"a-scene\").camera.position);\n\tHowler.pos(cameraPosition.x, cameraPosition.y, cameraPosition.z, radioPlayingSound);\n}", "function update() {\n text.text = \"SCORE: \" + currentScore;\n game.physics.arcade.collide(player, platforms);\n game.physics.arcade.overlap(player, items, itemHandler);\n player.body.velocity.x = 0;\n\n // is the left cursor key presssed?\n if (cursors.left.isDown) {\n player.animations.play('walk', 10, true);\n player.body.velocity.x = -300;\n player.scale.x = - 1;\n }\n // is the right cursor key pressed?\n else if (cursors.right.isDown) {\n player.animations.play('walk', 10, true);\n player.body.velocity.x = 300;\n player.scale.x = 1;\n }\n // player doesn't move\n else {\n player.animations.stop();\n }\n \n if (jumpButton.isDown && (player.body.onFloor() || player.body.touching.down)) {\n player.body.velocity.y = -400;\n }\n // when the player winw the game\n if (won) {\n winningMessage.text = \"YOU WIN!!!\";\n setTimeout(() => {\n $('#startConfetti').trigger('click');\n }, 1000);\n }\n }", "function playerMovement() {\n // Velocity\n if (player.velocityX > 20 * speedMultiplier) {\n player.velocityX = 20 * speedMultiplier;\n }\n if (player.velocityX < -15 * speedMultiplier) {\n player.velocityX = -15 * speedMultiplier;\n }\n\n // Actually moving\n if (keyDown(\"right\") && respawnTimer > maxRespawn) {\n player.velocityX = player.velocityX + 5.0*speedMultiplier;\n lastDirection = 0;\n if (currentGravity == 0) {\n player.setAnimation(\"Cube_right\");\n } else {\n player.setAnimation(\"U_Cube_right\");\n }\n }\n if (keyDown(\"left\") && respawnTimer > maxRespawn) {\n player.velocityX = player.velocityX - 5.0*speedMultiplier;\n lastDirection = 1;\n if (currentGravity == 0) {\n player.setAnimation(\"Cube_left\");\n } else {\n player.setAnimation(\"U_Cube_left\");\n }\n }\n \n // Slowing down\n if (!keyDown(\"right\") && player.velocityX > 0) {\n player.velocityX = player.velocityX - 5.0*speedMultiplier;\n }\n if (!keyDown(\"left\") && player.velocityX < 0) {\n player.velocityX = player.velocityX + 9.0*speedMultiplier;\n }\n if (!keyDown(\"right\") && player.velocityX > 0.00 && player.velocityX < 5.00) {\n player.velocityX = 0;\n }\n if (!keyDown(\"left\") && player.velocityX < 0.00 && player.velocityX > -5.00) {\n player.velocityX = 0;\n }\n // Stopping\n if (!keyDown(\"right\") && !keyDown(\"left\")) {\n if (currentGravity == 0) {\n player.setAnimation(\"Cube_idle\");\n } else {\n player.setAnimation(\"U_Cube_idle\");\n }\n }\n \n // Jumping\n if (currentGravity == 0) {\n if (player.collide(groundLine) || player.collide(block)) {\n \n if (keyDown(\"up_arrow\")) {\n if (respawnTimer > maxRespawn) {\n if (currentSize == 0) {\n player.velocityY = -50; //-50\n } else {\n player.velocityY = -80;\n }\n }\n }\n if (keyDown(\"space\")) {\n if (respawnTimer > maxRespawn) {\n if (currentSize == 0) {\n player.velocityY = -50; //-50\n } else {\n player.velocityY = -40;\n }\n }\n }\n \n }\n }\n if (currentGravity == 1) {\n if (player.collide(block)) {\n\n if (keyDown(\"up_arrow\")) {\n if (respawnTimer > maxRespawn) {\n if (currentSize == 0) {\n player.velocityY = 50; //-50\n } else {\n player.velocityY = 40;\n }\n }\n }\n \n }\n }\n}", "move() {\n // Handle movement with edge conditions\n if (upPressed) {\n if (player.y <= 0) {\n player.y += 1;\n } else {\n player.y -= player.speed;\n }\n }\n else if (downPressed) {\n if (player.y >= canvas.height) {\n player.y -= 1;\n } else {\n player.y += player.speed;\n }\n }\n if (rightPressed) {\n if (player.x >= canvas.width) {\n player.x -= 1;\n } else {\n player.x += player.speed;\n }\n }\n else if (leftPressed) {\n if (player.x <= 0) {\n player.x += 1;\n }\n else {\n player.x -= player.speed;\n }\n }\n }", "update() {\n this.pos[0] += this.accel * this.dir * 4.0;\n this.pos[0] = Math.max(0, Math.min(END, this.pos[0]));\n this.do_gravity();\n this.behavior();\n this.bhv_time += 1;\n }", "function update() { \n ball.update();\n player.update();\n ai.update();\n}", "update(){\n\t\tthis.position.add(this.velocity);\n\t\tthis.velocity.add(this.acceleration);\n\t\tthis.velocity.limit(this.maxSpeed);\n\t}", "update() {\n\n // Configura botao e altura do pulo\n if (this.pointer.isDown || this.cursors.space.isDown) {\n if (this.player.body.touching.down) {\n this.player.setVelocityY(this.gameOptions.playerJump * - 2);\n }\n }\n\n this.player.x = this.gameOptions.playerStartXY[0];\n\n // Removendo plataformas\n var minDistance = game.config.width;\n var rightmostPlatformHeight = 0;\n this.platformGroup.getChildren().forEach(function (platform) {\n var platformDistance = game.config.width - platform.x - platform.displayWidth / 3;\n if (platformDistance < minDistance) {\n minDistance = platformDistance;\n rightmostPlatformHeight = platform.y;\n }\n if (platform.x < - platform.displayWidth / 3) {\n this.platformGroup.killAndHide(platform);\n this.platformGroup.remove(platform);\n }\n }, this);\n\n // Adicionando plataformas\n if (minDistance > this.nextPlatformDistance) {\n this.addPlatform(this.gameOptions.platformWidth, this.gameOptions.platformX, this.gameOptions.platformY);\n }\n }", "update(){\n \n this.x+=this.xspeed;\n this.y+=this.gravity;\n \n }", "update(){\n // Prevent player from moving off canvas\n if(this.y > startY){\n this.y = startY;\n }\n if(this.x < 3){\n this.x = 3;\n }\n if(this.x > xPos[xPos.length - 1]){\n this.x = xPos[xPos.length - 1];\n }\n if(this.y < -50){\n this.y = -50;\n }\n\n // When the player reaches the top of the canvas, reset player positon\n if(this.y === -50 && this.x === goal.x){\n this.goalReached();\n }\n\n }", "function update() {\n //Update gameObjects\n for (const goID in sp.gameObjects) {\n let obj = sp.gameObjects[goID];\n\n //Update the object\n obj.update();\n //Apply collisions and all things that might keep the player in the air\n obj.applyPlatformCollision(sp.platforms);\n //If the player shoud get gravity, apply it. Collisions can disable gravity for a frame\n if (obj.shouldGetGravity) {\n obj.applyGravity(sp.gravity);\n }\n }\n }", "newPos() {\n this.x += this.speedX;\n this.y += this.speedY + this.gravity;\n this.hitBottom();\n this.update();\n }", "newPos() {\n this.x += this.speedX;\n this.y += this.speedY + this.gravity;\n this.hitBottom();\n this.update();\n }", "update() {\n var now = Date.now();\n var dt = (now - gameNs.game.prevTime);\n gameNs.game.dt = dt;\n gameNs.game.prevTime = now;\n gameNs.game.draw();\n //Update projectile manager\n gameNs.game.pm.update(dt, gameNs.game.mX, gameNs.game.mY);\n dt = 0;\n //Recursively call game.update here to create loop\n window.requestAnimationFrame(gameNs.game.update);\n }", "movement() {\n this.velocity = this.velocity + this.gravity; // updates velocity\n this.y = this.y + this.velocity // updates position with velocity\n }", "update() {\n let input = this.game.input;\n\n if (input.isLeftPressed() && this.position.x > 0) {\n this.position.x -= this.speed;\n }\n\n if (input.isRightPressed() && this.game.canvas.width > this.position.x + this.size.width) {\n this.position.x += this.speed;\n }\n\n if (input.isActionPressed() && !this.isFiring) {\n this.shoot();\n }\n }", "update() {\n this.velocity.add(this.acceleration);\n this.velocity.limit(p.topspeed2);\n this.location.add(this.velocity);\n this.acceleration.mult(0);\n }", "function onUpdatePosition() {\n gridDotUpper.position = position;\n gridDot.position = position;\n gridDotMiddle.position = position;\n\n if (guitarString) {\n guitarString.updateDotPosition(self);\n }\n }", "function update() \r\n{\r\n\tball.update();\r\n\tplayer1.update();\r\n\tplayer2.update();\r\n}", "update() {\n\n this.nextMoveX = this.x + this.nextDirectionX;\n this.nextMoveY = this.y + this.nextDirectionY;\n\n\n }", "function update() {\n player1.update();\n player2.update();\n ball.update();\n}", "update() {\r\n this.position.y += this.speed;\r\n if (this.position.y >= this.gameHeight - this.height) {\r\n // Parachutist touching bottom of screen\r\n this.touchedBottomOfScreen = true;\r\n this.view.sendEvent(VIEW_CFG.PARACHUTIST_EVENT_DROWNED);\r\n } else if (this.isParachutistTouchingBoat()) {\r\n // Parachutist touching the boat at parts which are logical\r\n this.touchedBoat = true;\r\n this.view.sendEvent(VIEW_CFG.PARACHUTIST_EVENT_SAVED);\r\n }\r\n }", "update () {\n this.position = [this.x, this.y];\n }", "function _update(){\n\t\t$scope.timing= SoundService.getPosition();\n\t\t$scope.timingpercent= SoundService.getPositionPercent();\n\t}", "function setPlayerPosition() {\n $('#player')\n .css('margin-top', player.top)\n .css('margin-left', player.left)\n}", "move() {\n if (this.isAvailable) {\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -this.speed, this.speed);\n this.vy = map(noise(this.ty), 0, 1, -this.speed, this.speed);\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.01;\n this.ty += 0.01;\n // Handle wrapping\n this.handleWrapping();\n }\n }", "function gamePlay() {\n collisionDetection();\n moveVerticalPlatform();\n movePlayer();\n updateScreen();\n moveBullets();\n moveMonsterBullets();\n moveMonsters();\n}", "localUpdate() {\n this.x = user.x + Math.round(Math.cos(user.angle) * user.speed);\n this.y = user.y + Math.round(Math.sin(user.angle) * user.speed);\n }", "function move() {\n movingPlayer = true;\n}", "function playerMove() {\n\t\n\t// Slow the player down if they are moving\n\tif (playerSpeed > 0) {\n\t\tplayerSpeed += deceleration;\n\t\t\n\t\t// Check whether they have come to a stop\n\t\tif (playerSpeed < 0) {\n\t\t\tplayerSpeed = 0;\n\t\t}\n\t}\n\t// Slow the player down in a negative magnitude if they are moving backwards\n\tif (playerSpeed < 0) {\n\t\tplayerSpeed -= deceleration;\n\t\t\n\t\t// Check whether they have come to a stop\n\t\tif (playerSpeed > 0) {\n\t\t\tplayerSpeed = 0;\n\t\t}\n\t}\n\t\n\t\n\t// Calculate the x and y components of movement\n\tplayer.tank.x += playerSpeed * Math.sin(player.tank.r * degToRad);\n\tplayer.tank.y -= playerSpeed * Math.cos(player.tank.r * degToRad);\n\tplayer.turret.x += playerSpeed * Math.sin(player.tank.r * degToRad);\n\tplayer.turret.y -= playerSpeed * Math.cos(player.tank.r * degToRad);\n}", "updatePlayerPosition(player, newPos) { //7-1\n const x = parseInt(newPos.charAt(0));\n const y = parseInt(newPos.charAt(newPos.length - 1));\n player.x = x;\n player.y = y;\n }", "function movePlayer() {\n\t//the location of the mouse click\n\tvar click : Vector3;\n\t//if the player has clicked somewhere\n\tif(Input.GetMouseButton(0)) {\n\t\t//save the location\n\t\tclick = Input.mousePosition;\n\t\t//offset the location to be relative to the center of the screen.\n\t\tvar clickX = click.x - Screen.width/2;\n\t\tvar clickY = click.y - Screen.height/2;\n\t\t//the location of the click\n\t\tvar clickVector : Vector3 = new Vector3(clickX, clickY, 0);\n\t\t//the vector from the player to the mouse\n\t\tvar moveVector : Vector3 = clickVector;\n\t\t//if the click is above the HUD and the player can move\n\t\tif(isAboveKanaBar(click.y) && this.moveEnabled){\n\t\t\t//move the player toards the clicked location\n\t\t\trigidbody2D.velocity = new Vector3(clickX, clickY, 0).normalized * (baseSpeed * bunnyModifier);\n\t\t}\n\t}\n\telse {\n\t\trigidbody2D.velocity = new Vector2(0, 0);\n\t}\n}", "update(time, delta) {\n // << DO UPDATE LOGIC HERE >>\n this.player.update(this.cursors, this.jumpSound);\n\n this.gun.update(time, this.player, this.cursors, this.fireLaser, this.laserSound);\n }", "update() {\n this.platforms.children.iterate((child) => {\n const platform = child;\n const scrolly = this.cameras.main.scrollY;\n if (platform.y >= scrollY) {\n }\n });\n\n const touchingDown = this.player.body.touching.down;\n if (touchingDown) {\n this.player.setVelocityY(-300);\n }\n }", "updatePositions(){\n this.api.get_positions(this.apiPositionListener)\n }", "update(spacePressed, players) {\n if (!spacePressed) return;\n players.forEach((player) => {\n this.teleport(player, this.positions[0], this.positions[1])\n this.teleport(player, this.positions[1], this.positions[0])\n })\n this.resetPositions();\n\n }", "function updateTimelinePosition() {\r\n\tupdatePosition('updateTimelinePosition', '#timeline > .video-container');\r\n}", "function positionUpdater(player, oldY, oldX) {\n mapArrays[player.y + oldY][player.x + oldX].playerHere = false;\n mapArrays[player.y][player.x].playerHere = true;\n}", "function update() {\n text.text = \"SCORE: \" + currentScore;\n game.physics.arcade.collide(player, platforms);\n game.physics.arcade.overlap(player, items, itemHandler);\n game.physics.arcade.overlap(player, badges, badgeHandler);\n player.body.velocity.x = 0;\n\n // is the left cursor key presssed?\n if (cursors.left.isDown) {\n player.animations.play('walk', 10, true);\n player.body.velocity.x = -300;\n player.scale.x = - 1;\n }\n // is the right cursor key pressed?\n else if (cursors.right.isDown) {\n player.animations.play('walk', 10, true);\n player.body.velocity.x = 300;\n player.scale.x = 1;\n }\n // player doesn't move\n else {\n player.animations.stop();\n }\n \n if (jumpButton.isDown && (player.body.onFloor() || player.body.touching.down)) {\n player.body.velocity.y = -400;\n }\n // when the player winw the game\n if (won) {\n winningMessage.text = \"YOU WIN!!!\";\n }\n }", "function gamePlay() {\r\n // Check whether the player is on a platform\r\n var isOnPlatform = player.isOnPlatform();\r\n \r\n // Update player position\r\n var displacement = new Point();\r\n\r\n // Move left or right\r\n if (player.motion == motionType.LEFT)\r\n displacement.x = -MOVE_DISPLACEMENT;\r\n if (player.motion == motionType.RIGHT)\r\n displacement.x = MOVE_DISPLACEMENT;\r\n\r\n // Fall\r\n if (!isOnPlatform && player.verticalSpeed <= 0) {\r\n displacement.y = -player.verticalSpeed;\r\n player.verticalSpeed -= VERTICAL_DISPLACEMENT;\r\n }\r\n\r\n // Jump\r\n if (player.verticalSpeed > 0) {\r\n displacement.y = -player.verticalSpeed;\r\n player.verticalSpeed -= VERTICAL_DISPLACEMENT;\r\n if (player.verticalSpeed <= 0)\r\n player.verticalSpeed = 0;\r\n }\r\n\r\n // Get the new position of the player\r\n var position = new Point();\r\n position.x = player.position.x + displacement.x;\r\n position.y = player.position.y + displacement.y;\r\n\r\n // Check collision with platforms and screen\r\n player.collidePlatform(position);\r\n player.collideScreen(position);\r\n\r\n // Set the location back to the player object (before update the screen)\r\n player.position = position;\r\n\r\n player.checkEnterPortal(position)\r\n updateScreen();\r\n\r\n processCoin(player.findCoin(player.position))\r\n if(!cheatMode && bumpIntoGhost(player.position)!=-1){\r\n gameOver()\r\n console.log(\"bumpIntoGhost\")\r\n }\r\n\r\n if (player.findExit(player.position)){\r\n proceedToNextRound()\r\n }\r\n}" ]
[ "0.7678881", "0.7461553", "0.74586976", "0.7404698", "0.7236142", "0.7215115", "0.7205637", "0.7200216", "0.7189333", "0.7148933", "0.71409374", "0.7139025", "0.71174455", "0.69798136", "0.6968483", "0.6965046", "0.69596887", "0.69544655", "0.6942745", "0.69264126", "0.69235164", "0.6914838", "0.6868532", "0.683506", "0.68171597", "0.6806618", "0.6796075", "0.6763692", "0.67068154", "0.67037344", "0.670157", "0.66975707", "0.66936696", "0.66764075", "0.66495013", "0.6643967", "0.66336405", "0.6629067", "0.6626937", "0.6619095", "0.6619095", "0.66144556", "0.66105974", "0.66041774", "0.65899456", "0.65774494", "0.65645546", "0.6560565", "0.6558246", "0.65416795", "0.6535328", "0.65334725", "0.65314466", "0.65310633", "0.6531", "0.6529713", "0.6521608", "0.6518608", "0.6518213", "0.6517623", "0.65165704", "0.6501993", "0.64966", "0.6488434", "0.64858204", "0.64787424", "0.6477364", "0.647469", "0.646652", "0.6462032", "0.6461045", "0.64592814", "0.64592814", "0.64538157", "0.64518666", "0.6445961", "0.6445442", "0.6444904", "0.6443737", "0.64424324", "0.64416903", "0.6440269", "0.6439262", "0.64359707", "0.6435353", "0.6424658", "0.6403549", "0.64001", "0.6394797", "0.6384159", "0.6383185", "0.6373777", "0.63702524", "0.63682055", "0.636062", "0.63565516", "0.63549536", "0.6353055", "0.63506484", "0.6347876" ]
0.67552507
28
This function updates the position of the player's SVG object and set the appropriate translation of the game screen relative to the the position of the player
function updateScreen() { // Transform the player player.node.setAttribute("transform", "translate(" + player.position.x + "," + player.position.y + ")"); // Calculate the scaling and translation factors // Add your code here }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScreen() {\r\n // Transform the player\r\n player.node.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\");\r\n\r\n // Calculate the scaling and translation factors\r\n var scale = new Point(zoom, zoom);\r\n var translate = new Point();\r\n\r\n translate.x = SCREEN_SIZE.w / 2.0 - (player.position.x + PLAYER_SIZE.w / 2) * scale.x;\r\n if (translate.x > 0)\r\n translate.x = 0;\r\n else if (translate.x < SCREEN_SIZE.w - SCREEN_SIZE.w * scale.x)\r\n translate.x = SCREEN_SIZE.w - SCREEN_SIZE.w * scale.x;\r\n\r\n translate.y = SCREEN_SIZE.h / 2.0 - (player.position.y + PLAYER_SIZE.h / 2) * scale.y;\r\n if (translate.y > 0)\r\n translate.y = 0;\r\n else if (translate.y < SCREEN_SIZE.h - SCREEN_SIZE.h * scale.y)\r\n translate.y = SCREEN_SIZE.h - SCREEN_SIZE.h * scale.y;\r\n\r\n // Transform the game area\r\n svgdoc.getElementById(\"gamearea\").setAttribute(\"transform\", \"translate(\" + translate.x + \",\" + translate.y + \") scale(\" + scale.x + \",\" + scale.y + \")\");\r\n}", "function updateScreen() {\n\t// Transform the player\n\tif(PLAYER_FACE_RIGHT) {\n\t\tplayer.node.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\");\n\t} else {\n player.node.setAttribute(\"transform\", \"translate(\"+ (parseFloat(player.position.x) + 40)+\",\"+player.position.y+\") \"+\"scale(\" + -1 + \",\" + 1 + \")\");\n\t}\n\t\n // Calculate the scaling and translation factors\t\n var scale = new Point(zoom, zoom);\n var translate = new Point();\n \n translate.x = SCREEN_SIZE.w / 2.0 - (player.position.x + PLAYER_SIZE.w / 2) * scale.x;\n if (translate.x > 0) \n translate.x = 0;\n else if (translate.x < SCREEN_SIZE.w - SCREEN_SIZE.w * scale.x)\n translate.x = SCREEN_SIZE.w - SCREEN_SIZE.w * scale.x;\n\n translate.y = SCREEN_SIZE.h / 2.0 - (player.position.y + PLAYER_SIZE.h / 2) * scale.y;\n if (translate.y > 0) \n translate.y = 0;\n else if (translate.y < SCREEN_SIZE.h - SCREEN_SIZE.h * scale.y)\n translate.y = SCREEN_SIZE.h - SCREEN_SIZE.h * scale.y;\n \n // Transform the game area\n svgdoc.getElementById(\"gamearea\").setAttribute(\"transform\", \"translate(\" + translate.x + \",\" + translate.y + \") scale(\" + scale.x + \",\" + scale.y + \")\");\t\n}", "function updateScreen() {\r\n if (isGameOver) return ;\r\n\r\n updateGhostPosition()\r\n updateBulletPosition()\r\n updateVerticalPlatformPosition()\r\n\r\n // Transform the player\r\n if (flipPlayer==motionType.LEFT){\r\n player.node.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\" + \"translate(\" + PLAYER_SIZE.w + \", 0) scale(-1, 1)\");\r\n }\r\n else\r\n player.node.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\");\r\n \r\n // ghost\r\n for (var i=0; i<ghost_count; i++){\r\n if (ghost[i]){\r\n if (ghost[i].motion == motionType.LEFT){\r\n ghost[i].svgObject.setAttribute(\"transform\", \"translate(\" + ghost[i].position.x + \",\" + ghost[i].position.y + \")\" + \"translate(\" + GHOST_SIZE.w + \", 0) scale(-1, 1)\"); \r\n }\r\n else\r\n ghost[i].svgObject.setAttribute(\"transform\", \"translate(\" + ghost[i].position.x + \",\" + ghost[i].position.y + \")\"); \r\n }\r\n }\r\n\r\n //bullet\r\n for (var i=0; i<8-bullet_count; i++){\r\n if (bullet[i]){\r\n if (bullet[i].motion==motionType.RIGHT)\r\n bullet[i].svgObject.setAttribute(\"transform\", \"translate(\" + bullet[i].position.x + \",\" + bullet[i].position.y + \")\" + \"translate(\" + 10 + \", 0) scale(-1, 1)\"); \r\n else\r\n bullet[i].svgObject.setAttribute(\"transform\", \"translate(\" + bullet[i].position.x + \",\" + bullet[i].position.y + \")\"); \r\n } \r\n }\r\n // Calculate the scaling and translation factors\t\r\n \r\n // Add your code here\r\n \r\n}", "function updateScreen() {\r\n\r\n\tif( TREASURE_COUNT == 0 ){\r\n\t\texitshown = true;\r\n\t\tsvgdoc.getElementById(\"exit_msg\").setAttribute(\"visibility\",\"visible\");\r\n\t\tsvgdoc.getElementById(\"exit\").setAttribute(\"visibility\",\"visible\");\r\n\t}\r\n\r\n\tMONSTER_SHOOT_INTERVAL = Math.floor(Math.random()*4)*1000 + 1000;\r\n\tif(BOSS_KILLED){ clearTimeout(monsterShootInterval);}\r\n\tif(time_left <= 0 || !alive || endgame) gameover();\r\n svgdoc.getElementById(\"timeblock\").setAttribute(\"width\", TIME_BLOCK_WIDTH*(time_left/TOTAL_TIME));\r\n // Transform the player\r\n if(player.facing == facingDir.LEFT){\r\n \tplayer.namenode.setAttribute(\"transform\",\r\n \t\t\"translate(\"+ player.position.x+\",\"+player.position.y +\")\");\r\n \tplayer.rolenode.setAttribute(\"transform\",\r\n \t\t\"translate(\"+ player.position.x+\",\"+player.position.y +\") translate(\" + PLAYER_SIZE.w + \", 0) scale(-1, 1) translate(0,0)\");\r\n\t}\r\n else{\r\n \tplayer.namenode.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\");\r\n \tplayer.rolenode.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\");\r\n\t}\r\n\r\n\r\n\tvar monsters = svgdoc.getElementById(\"monsters\");\r\n\tfor (var i = 0; i < monsters.childNodes.length; i++) {\r\n var monster = monsters.childNodes.item(i);\r\n\t\t//alert(monsterarray[i].position.x+\",\"+ monsterarray[i].position.y);\r\n\t\t//monster.setAttribute(\"x\",monsterarray[i].position.x);\r\n\t\t//monster.setAttribute(\"y\",monsterarray[i].position.y);\r\n\r\n\t\tif (monsterarray[i].facing == facingDir.LEFT){\r\n\t\t\tmonster.setAttribute(\"transform\",\r\n\t\t\t\t\t\"translate(\"+ monsterarray[i].position.x+\",\"+ monsterarray[i].position.y +\") translate(\" + MONSTER_SIZE.w + \", 0) scale(-1, 1) translate(0,0)\");\r\n\t\t}\r\n\t\telse monster.setAttribute(\"transform\",\"translate(\"+ monsterarray[i].position.x+\",\"+monsterarray[i].position.y +\")\");\r\n\t}\r\n // Calculate the scaling and translation factors\r\n var scale = new Point(zoom, zoom);\r\n var translate = new Point();\r\n\r\n translate.x = SCREEN_SIZE.w / 2.0 - (player.position.x + PLAYER_SIZE.w / 2) * scale.x;\r\n if (translate.x > 0)\r\n translate.x = 0;\r\n else if (translate.x < SCREEN_SIZE.w - SCREEN_SIZE.w * scale.x)\r\n translate.x = SCREEN_SIZE.w - SCREEN_SIZE.w * scale.x;\r\n\r\n translate.y = SCREEN_SIZE.h / 2.0 - (player.position.y + PLAYER_SIZE.h / 2) * scale.y;\r\n if (translate.y > 0)\r\n translate.y = 0;\r\n else if (translate.y < SCREEN_SIZE.h - SCREEN_SIZE.h * scale.y)\r\n translate.y = SCREEN_SIZE.h - SCREEN_SIZE.h * scale.y;\r\n\r\n svgdoc.getElementById(\"time\").firstChild.data = time_left + \"s\";\r\n svgdoc.getElementById(\"score\").firstChild.data = score;\r\n svgdoc.getElementById(\"mremaining\").firstChild.data = monsterarray.length ;\r\n svgdoc.getElementById(\"bremaining\").firstChild.data = BULLET_COUNT;\r\n svgdoc.getElementById(\"tremaining\").firstChild.data = TREASURE_COUNT;\r\n // Transform the game area\r\n svgdoc.getElementById(\"gamearea\").setAttribute(\"transform\", \"translate(\" + translate.x + \",\" + translate.y + \") scale(\" + scale.x + \",\" + scale.y + \")\");\r\n}", "function setPlayerPosition() {\n $('#player')\n .css('margin-top', player.top)\n .css('margin-left', player.left)\n}", "updatePos() {\n if (this.x != this.player.x || this.y != this.player.y) {\n this.x = this.player.x;\n this.y = this.player.y;\n }\n }", "function updatePlayerPosition() {\n avatar.x = mouseX;\n avatar.y = mouseY;\n avatar.currentSize = avatar.currentSize - SHRINK;\n avatar.currentSize = constrain(avatar.currentSize,0,avatar.maxSize);\n if (avatar.currentSize === 0) {\n avatar.isPlayerAlive = false;\n }\n else {\n avatar.isPlayerAlive = true;\n }\n}", "function set_player_loc(x, y) {\n player['x'] = x;\n player['newx'] = x;\n player['y'] = y;\n player['newy'] = y\n}", "function movePlayer() {\n screenWarping(\"player\");\n playerX += playerVX;\n playerY += playerVY;\n}", "updateGraphicPosition () {\n this.textGfx.setPosition(this.getPosition())\n this.textGfx.setMatrix(\n math.matrix.matmul(math.matrix.createTranslationMatrix(this.getX(), this.getY()),\n math.matrix.matmul(this.rotationMtx, math.matrix.createTranslationMatrix(-this.getX(), -this.getY()))))\n }", "function onUpdatePosition() {\n gridDotUpper.position = position;\n gridDot.position = position;\n gridDotMiddle.position = position;\n\n if (guitarString) {\n guitarString.updateDotPosition(self);\n }\n }", "update(viewX, viewY) {\n this.sprite.position.set(this.x - viewX, this.y - viewY);\n }", "function repositionGameItem(){\n //move the box to a new X position \n positionX += speedX; //update the x position \n$(\"#gameItem\").css(\"left\", positionX); //redraws according to y coordinategit push\n\n //move the box to a new Y position\n positionY += speedY; //update the y position\n $(\"#gameItem\").css(\"top\", positionY); //redraws according to y coordinate\n }", "function SetPosition(){\r\n\tvar ratio = window.innerWidth / window.innerHeight;\r\n\tleftAmt = ratio/0.005;\r\n\ttopAmt = parseInt(window.innerHeight*0.789);\r\n\tdocument.getElementById(\"player\").style.left=ratio/0.005 + \"px\";\r\n\tpositionY = topAmt-200;\r\n\t\r\n\t//if the game hasnt started move the starting block to match the players position\r\n\tif(started == false){\r\n\t\tif(document.getElementById(\"startBlock\") != null){\r\n\t\t\tdocument.getElementById(\"startBlock\").style.left=ratio/0.005 + \"px\";\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(ratio < 1.236){\r\n\t\tdocument.getElementById(\"tutorial\").innerHTML=\"Tap to start\";\r\n\t} else {\r\n\t\tdocument.getElementById(\"tutorial\").innerHTML=\"Click or space to start\";\r\n\t}\r\n}", "function updatePosition() {\r\n\t\t\tcircle.attr('transform', `translate(${point.x * graph.cell_size + graph.offset.x} ${point.y * graph.cell_size + graph.offset.y})`);\r\n\t\t}", "function playerPos()\r\n{\r\n\tposX = positionX + \"px\";\r\n\tposY = positionY + \"px\";\r\n\tPLAYER.style.top = posY;\r\n\tPLAYER.style.left = posX;\r\n}", "function updatePlayerPos(player) {\n c.beginPath();\n c.arc(player.coords.x, player.coords.y, player.\n radius, 0, Math.PI * 2, false);\n c.fillStyle = player.color;\n c.fill();\n}", "function e_updateCenter(){ //function to update center of player sprite.\n this.centerx = this.x + 16;\n this.centery = this.y + 16;\n}", "function setPlayerPosition(x,y){\n playerPosition={x,y};\n}", "function gamePlay() {\r\n// var bgm_music = svgdoc.getElementById(\"back\");\r\n bgm_music.play();\r\n // Check collisions, call the collisionDetection when you create the monsters and bullets\r\n collisionDetection();\r\n // Check whether the player is on a platform\r\n var isOnPlatform = player.isOnPlatform();\r\n\r\n // Update player position\r\n var displacement = new Point();\r\n\r\n // Move left or right\r\n if (player.motion == motionType.LEFT)\r\n displacement.x = -MOVE_DISPLACEMENT;\r\n if (player.motion == motionType.RIGHT)\r\n displacement.x = MOVE_DISPLACEMENT;\r\n\r\n // Fall\r\n if (!isOnPlatform && player.verticalSpeed <= 0) {\r\n displacement.y = -player.verticalSpeed;\r\n player.verticalSpeed -= VERTICAL_DISPLACEMENT;\r\n }\r\n\r\n // Jump\r\n if (player.verticalSpeed > 0) {\r\n displacement.y = -player.verticalSpeed;\r\n player.verticalSpeed -= VERTICAL_DISPLACEMENT;\r\n if (player.verticalSpeed <= 0)\r\n player.verticalSpeed = 0;\r\n }\r\n\r\n // Get the new position of the player\r\n var position = new Point();\r\n position.x = player.position.x + displacement.x;\r\n position.y = player.position.y + displacement.y;\r\n\r\n // Check collision with platforms and screen\r\n player.collidePlatform(position);\r\n player.collideScreen(position);\r\n\r\n // Set the location back to the player object (before update the screen)\r\n player.position = position;\r\n\r\n\r\n // Move the bullets, call the movebullets when you create the monsters and bullets\r\n moveBullets();\r\n updateScreen();\r\n}", "function updatePlayer (player) {\n if (player.inputs.up) player.y -= 5;\n if (player.inputs.down) player.y += 5;\n if (player.inputs.left) player.x -= 5;\n if (player.inputs.right) player.x += 5;\n}", "move() {\n\n // Don't move when not visible.\n if (!this.isVisible) { return; }\n\n // Determine how to move and rotate the player based on direction flags.\n const xMoveSpeed = 5;\n const yMoveSpeed = 5;\n let xAdj = 0;\n let yAdj = 0;\n let degrees = 0;\n if (this.dirUp && !this.dirDown && !this.dirLeft && !this.dirRight) {\n yAdj = -yMoveSpeed;\n degrees = 0;\n } else if (this.dirUp && !this.dirDown && !this.dirLeft && this.dirRight) {\n xAdj = xMoveSpeed;\n yAdj = -yMoveSpeed;\n degrees = 45;\n } else if (!this.dirUp && !this.dirDown && !this.dirLeft && this.dirRight) {\n xAdj = xMoveSpeed;\n degrees = 90\n } else if (!this.dirUp && this.dirDown && !this.dirLeft && this.dirRight) {\n xAdj = xMoveSpeed;\n yAdj = yMoveSpeed;\n degrees = 135;\n } else if (!this.dirUp && this.dirDown && !this.dirLeft && !this.dirRight) {\n yAdj = yMoveSpeed;\n degrees = 180;\n } else if (!this.dirUp && this.dirDown && this.dirLeft && !this.dirRight) {\n xAdj = -xMoveSpeed;\n yAdj = yMoveSpeed;\n degrees = 225;\n } else if (!this.dirUp && !this.dirDown && this.dirLeft && !this.dirRight) {\n xAdj = -xMoveSpeed;\n degrees = 270;\n } else if (this.dirUp && !this.dirDown && this.dirLeft && !this.dirRight) {\n xAdj = -xMoveSpeed;\n yAdj = -yMoveSpeed;\n degrees = 315;\n }\n // Now clear any current classes on the player node.\n for (let i = 0; i < 360; i = i + 45) {\n webix.html.removeCss(this[\"frame0\"], wxGame[`CSS_ROTATE_${i}`]);\n webix.html.removeCss(this[\"frame1\"], wxGame[`CSS_ROTATE_${i}`]);\n }\n // And now, add the new one.\n webix.html.addCss(this[\"frame0\"], wxGame[`CSS_ROTATE_${degrees}`]);\n webix.html.addCss(this[\"frame1\"], wxGame[`CSS_ROTATE_${degrees}`]);\n\n // Now physically move the player.\n const newX = this.xLoc + xAdj;\n if (newX > 2 && newX < 756) {\n this.xLoc = newX;\n }\n const newY = this.yLoc + yAdj;\n if (newY > 0 && newY < 516) {\n this.yLoc = newY;\n }\n this[\"frame0\"].style.left = `${this.xLoc}px`;\n this[\"frame1\"].style.left = `${this.xLoc}px`;\n this[\"frame0\"].style.top = `${this.yLoc}px`;\n this[\"frame1\"].style.top = `${this.yLoc}px`;\n\n }", "function p_updateCenter() { //function to update center of player sprite.\n this.centerx = this.x + 16;\n this.centery = this.y + 16;\n}", "update() {\r\n this.draw()\r\n this.angle = this.angle + this.angleX\r\n if(this.angle > 6) {\r\n this.angle = 0\r\n }\r\n if(this.angle < 0) {\r\n this.angle = 6\r\n }\r\n this.x = this.x + this.playerMov1.x\r\n this.y = this.y + this.playerMov1.y\r\n if(this.x > this.wc * 2 - this.pSize) this.x = this.wc * 2 - this.pSize\r\n if(this.x < 0) this.x = 0\r\n if(this.y < 0) this.y = 0\r\n if(this.y > this.sh - this.pSize) this.y = this.sh - this.pSize\r\n }", "function gamePlay() {\n\t//move moving platform\n\tvar moving = svgdoc.getElementById(\"moving\");\n\tvar y = parseFloat(moving.getAttribute(\"y\"));\n\t//console.log(\"moving platform is at: \" + y);\n\tif(movingPlatformGoingDown) {\n\t\tmoving.setAttribute(\"y\", y + 1);\n\t} else {\n\t\tmoving.setAttribute(\"y\", y - 1);\n\t}\n\t\n\tif(y > 750) {\n\t\tmovingPlatformGoingDown = false;\n\t}\n\t\n\tif(y < 600) {\n\t\tmovingPlatformGoingDown = true;\n\t}\n\t\n\t\n\t//check disappearing platoforms\n\tfor (var i = 0; i < 1; i++) {\n\t\tif(BOOLEAN_OF_DIS_PLATFORM[i]) {\n\t\t\tvar disappearing = svgdoc.getElementById(\"disappearing\"+i);\n\t\t\n\t\t\tif (disappearing.getAttribute(\"type\") == \"disappearing\") {\n\t\t\t\tvar platformOpacity = parseFloat(disappearing.getAttribute(\"opacity\"));\n\t\t\t\t//console.log(\"Opacity is: \" + platformOpacity);\n\t\t\t\t\n\t\t\t\tif(platformOpacity <= 0) {\n\t\t\t\t\t//if platform opacity is less than 0, remove platform\n\t\t\t\t\tBOOLEAN_OF_DIS_PLATFORM[i] = false;\n\t\t\t\t\tsvgdoc.getElementById(\"platforms\").removeChild(disappearing);\n\t\t\t\t} else {\n\t\t\t\t\tvar x = parseFloat(disappearing.getAttribute(\"x\"));\n\t\t\t\t\tvar y = parseFloat(disappearing.getAttribute(\"y\"));\n\t\t\t\t\tvar w = parseFloat(disappearing.getAttribute(\"width\"));\n\t\t\t\t\tvar h = parseFloat(disappearing.getAttribute(\"height\"));\n\t\t\t\t\t\n\t\t\t\t\t//console.log(x + \" \" + y + \" \" + w + \" \" + h);\n\t\t\t\t\t\n\t\t\t\t\tif (((player.position.x + PLAYER_SIZE.w > x && player.position.x < x + w) || ((player.position.x + PLAYER_SIZE.w) == x && player.motion == motionType.RIGHT) ||\n\t\t\t\t\t\t(player.position.x == (x + w) && player.motion == motionType.LEFT)) &&\tplayer.position.y + PLAYER_SIZE.h == y) {\n\t\t\t\t\t\t\t//if player touches the dissapearing platform\n\t\t\t\t\t\t\t//console.log(\"player is touching the disappearing platform\");\n\t\t\t\t\t\t\tdisappearing.setAttribute(\"opacity\", platformOpacity - 0.1);\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\t\n\t\n // Check whether the player is on a platform\n var isOnPlatform = player.isOnPlatform();\n\t\n // Update player position\n var displacement = new Point();\n\t\n // Move left or right\n if (player.motion == motionType.LEFT) {\t\t\n player.node.setAttribute(\"transform\", \"translate(\"+ (parseFloat(player.position.x) + 40)+\",\"+player.position.y+\") \"+\"scale(\" + -1 + \",\" + 1 + \")\");\n\t\t//console.log(\"player xy position: \" + player.position.x + \" \" + player.position.y);\n\t\tPLAYER_FACE_RIGHT = false;\n displacement.x = -MOVE_DISPLACEMENT;\n\t}\n if (player.motion == motionType.RIGHT) {\n player.node.setAttribute(\"transform\", \"translate(\" + player.position.x + \",\" + player.position.y + \")\");\n\t\tPLAYER_FACE_RIGHT = true;\n displacement.x = MOVE_DISPLACEMENT;\n\t}\n\t\n\t\n // Fall\n if (!isOnPlatform && player.verticalSpeed <= 0) {\n displacement.y = -player.verticalSpeed;\n player.verticalSpeed -= VERTICAL_DISPLACEMENT;\n }\n\t\t\n // Jump\n if (player.verticalSpeed > 0) {\n displacement.y = -player.verticalSpeed;\n player.verticalSpeed -= VERTICAL_DISPLACEMENT;\n if (player.verticalSpeed <= 0)\n player.verticalSpeed = 0;\n }\n\n // Get the new position of the player\n var position = new Point();\n position.x = player.position.x + displacement.x;\n position.y = player.position.y + displacement.y;\n\n // Check collision with platforms and screen\n player.collidePlatform(position);\n player.collideScreen(position);\n\n // Set the location back to the player object (before update the screen)\n player.position = position;\n\n\t//monsterFall\n\tfor(var i = 0; i<monsters.length;i++) {\n\t\tmonsterDisplacement[i] = new Point();\n\t\tMONSTER_ON_PLATFORM[i] = monsters[i].isOnPlatform();\n\t\t\t\t\n\t\t//if monster is not on Platform and its vertical is less then 0\n\t\tif(!MONSTER_ON_PLATFORM[i] && monsters[i].verticalSpeed <= 0) {\n\t\t\tmonsterDisplacement[i].y = -monsters[i].verticalSpeed;\n\t\t\tmonsters[i].verticalSpeed -= VERTICAL_DISPLACEMENT;\n\t\t}\n\t\t//console.log(\"Monster \" + i + \" is on platform: \" + MONSTER_ON_PLATFORM[i]);\n\t\t\n\t\t//move monster either left or right\n\t\tif(MOVE) {\n\t\t\t//moveMonsters();\n\t\t\tif(MONSTER_ON_PLATFORM[i]) {\n\t\t\t\tif(MONSTER_INIT_DIRECTION[i]) {\n\t\t\t\t\tmonsters[i].direction = motionType.LEFT;\n\t\t\t\t\tmonsterDisplacement[i].x = -monsters[i].horizontalSpeed;\n\t\t\t\t\tmonsters[i].node.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#monster\");\n\t\t\t\t} else {\n\t\t\t\t\tmonsters[i].direction = motionType.RIGHT;\n\t\t\t\t\tmonsterDisplacement[i].x = +monsters[i].horizontalSpeed;\n\t\t\t\t\tmonsters[i].node.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#lmonster\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\n\t\tvar monsterPosition = new Point();\n\t\t\n\t\tmonsterPosition.x = monsters[i].position.x + monsterDisplacement[i].x;\n\t\tmonsterPosition.y = monsters[i].position.y + monsterDisplacement[i].y;\n\t\t\n\t\tmonsters[i].collidePlatform(monsterPosition);\n\t\tmonsters[i].collideScreen(monsterPosition);\n\t\t\n\t\tmonsters[i].position = monsterPosition;\n\t\tvar node = monsters[i].node;\n \n // Update the position of the monster\n\t\tvar y = parseInt(node.getAttribute(\"y\"));\n\t\tvar x = parseInt(node.getAttribute(\"x\"));\n\t\t//console.log(\"Y Axis of monster \" + i + \" is \" + y);\n\t\tnode.setAttribute(\"y\", monsters[i].position.y);\t\n\t\tnode.setAttribute(\"x\", monsters[i].position.x);\t\n\t\t\n\t\tif(monsters[i].canShoot) {\n\t\t\tif(monster_BULLET_COUNT == 0) {\n\t\t\t\tmonsterShootBullet(monsters[i]);\n\t\t\t}\n\t\t}\n\t}\n\t\n // Move the bullets, call the movebullets when you create the monsters and bullets\n collisionDetection();\n\tmoveBullets();\n updateScreen();\n}", "set_drawing_position() {\n push()\n translate(this.module_x, this.module_y)\n }", "SetPlayerPosition(playerX, playerY) {\n const playerPosition = this.m_player.GetTransform().p;\n const currentPlayerX = [0];\n const currentPlayerY = [0];\n Fracker.WorldToTile(playerPosition, currentPlayerX, currentPlayerY);\n playerX = b2.Clamp(playerX, 0, FrackerSettings.k_worldWidthTiles - 1);\n playerY = b2.Clamp(playerY, 0, FrackerSettings.k_worldHeightTiles - 1);\n // Only update if the player has moved and isn't attempting to\n // move through the well.\n if (this.GetMaterial(playerX, playerY) !== Fracker_Material.WELL &&\n (currentPlayerX[0] !== playerX ||\n currentPlayerY[0] !== playerY)) {\n // Try to deploy any fracking fluid that was charging.\n this.DeployFrackingFluid();\n // Move the player.\n this.m_player.SetTransformVec(Fracker.TileToWorld(playerX, playerY), 0);\n }\n }", "update() {\r\n this.draw()\r\n this.angle = this.angle + this.angleX\r\n if(this.angle > 6) {\r\n this.angle = 0\r\n }\r\n if(this.angle < 0) {\r\n this.angle = 6\r\n }\r\n this.x = this.x + this.playerMov2.x\r\n this.y = this.y + this.playerMov2.y\r\n if(this.x > this.wc * 2 - this.pSize) this.x = this.wc * 2 - this.pSize\r\n if(this.x < 0) this.x = 0\r\n if(this.y < 0) this.y = 0\r\n if(this.y > this.sh - this.pSize) this.y = this.sh - this.pSize\r\n }", "function positionUpdater(player, oldY, oldX) {\n mapArrays[player.y + oldY][player.x + oldX].playerHere = false;\n mapArrays[player.y][player.x].playerHere = true;\n}", "function drawElements(){\r\n // console.log(\"drawElements CALLED\")\r\n // console.log(`player.x = ${player.x} - - - player Y = ${player.y}`)\r\n \r\n ctx.rect(player.x, player.y, 40, 40);\r\n ctx.stroke()\r\n}", "update () {\n this.position = [this.x, this.y];\n }", "update() {\n // if the player touches the top of the screen...\n if (this.player.y < 0) {\n // gmae over man, restart the game\n this.scene.start(\"PlayGame\");\n }\n }", "movePlayer() {\r\n const cellX = ~~$(this).get(0).dataset.x;\r\n const cellY = ~~$(this).get(0).dataset.y;\r\n const _map = this.map;\r\n _map.game.currentPlayer.moveTo(this, cellX, cellY);\r\n }", "update(){\n // Prevent player from moving off canvas\n if(this.y > startY){\n this.y = startY;\n }\n if(this.x < 3){\n this.x = 3;\n }\n if(this.x > xPos[xPos.length - 1]){\n this.x = xPos[xPos.length - 1];\n }\n if(this.y < -50){\n this.y = -50;\n }\n\n // When the player reaches the top of the canvas, reset player positon\n if(this.y === -50 && this.x === goal.x){\n this.goalReached();\n }\n\n }", "translateToBattleground(): void {\n const x = -this.canvasPosition.x + BATTLEGROUND_COORD_X;\n const y = -this.canvasPosition.y + BATTLEGROUND_COORD_Y;\n this.translate(x, y);\n this.canvasPosition = { x: BATTLEGROUND_COORD_X, y: BATTLEGROUND_COORD_Y };\n }", "function go_to_pos(current_pos) {\n\t\n if (current_pos < 0) current_pos = 0;\n if (current_pos > 2) current_pos = 2;\n // set player position\n player_pos = current_pos;\n\n position = {x: 0, y: 0, z: 0}\n if (player_pos == 0) position.x = POSITION_X_LEFT;\n else if (player_pos == 1) position.x = POSITION_X_CENTER;\n else position.x = POSITION_X_RIGHT;\n document.getElementById('player').setAttribute('position', position);\n}", "update() {\n super.update();\n let state = this.state;\n let entities = state.entities;\n entities.forEach(th => {\n th.data.repulse.set(0, 0);\n });\n entities.forEach(th => {\n this._processThinker(th)\n });\n // tous les sprites doivent etre relatifs à ce point de vue\n let p = state.player.data.position;\n entities.forEach(e => {\n e.sprite.position.set(e.data.position.sub(p));\n });\n ++this.state.time;\n state.player.sprite.position.set(0, 0);\n state.view.set(p);\n }", "updatePosition() {\n // set the new plane sizes and positions relative to document by triggering getBoundingClientRect()\n this._setDocumentSizes();\n\n // apply them\n this._applyWorldPositions();\n }", "function resetPlayer() {\n player.x = 210;\n player.y = 380;\n}", "resetPlayerPos () {\n player.x = 200;\n player.y = 400;\n this.gotGift = true;\n }", "function draw() {\n\n //paint it black\n background(0);\n\n //render the game state\n\n //iterate through the players\n for (var playerId in gameState.players) {\n\n var p = gameState.players[playerId];\n\n /*\n predict the position based on the last recorded velocity and the last time\n I got a server update, in most of the cases it will approximate the position\n I the prediction is incorrect no big deal, these values will be overwritten\n by the next server update\n */\n\n var now = Date.now();\n var timeSinceUpdate = (now - lastServerUpdate);\n\n //0-1 variable for lerping\n //0 the server update just happened\n //1 the next server update is about to happen \n var t = timeSinceUpdate / SERVER_UPDATE_TIME;\n\n //calculate what the position would be if the object maintained the same speed\n var predictedX = p.x + p.vX;\n var predictedY = p.y + p.vY;\n\n //interpolate the position between the last update and the predicted position\n //the closer to the next update, the closer the t to 1, the closer to predictedX\n var interX = lerp(p.x, predictedX, t);\n var interY = lerp(p.y, predictedY, t);\n\n //draw the sprite\n fill(255);\n //draw from center\n rectMode(CENTER);\n\n //in order to rotate I have to use the transformation matrix\n push();\n translate(interX, interY);\n rotate(radians(p.angle));\n\n rect(0, 0, 10, 20);\n pop();\n }\n\n\n //WASD keycodes for continuous input\n //https://keycode.info/\n socket.emit('clientUpdate', {\n left: keyIsDown(65),\n right: keyIsDown(68),\n up: keyIsDown(87),\n down: keyIsDown(83)\n });\n\n}", "update() {\n if (this.y > 380) { //if player attempts to go over the 380 limit, player will remain at the 380 position\n this.y = 380;\n } else if (this.y < 0) { //if player a reaches to the top of the canvas (where the water is), player will be relocated to the default location\n this.x = 202;\n this.y = 380;\n\n score++; //score increments by 1 when player gets in range of the water\n $('.num').text(score); //updated score then gets appended to .num span\n }\n\n if (this.x > 400) { //if player attempts to go over 400 on the right or 0 on the left, player's position with remain at the 400 or 0 position\n this.x = 400;\n } else if (this.x < 0) {\n this.x = 0;\n }\n }", "movePlayer() {\r\n this.ctx.clearRect(0, 0, canvas.width, canvas.height);\r\n this.drawText();\r\n this.posY = this.posY + this.speed * this.inputY;\r\n this.posX = this.posX + this.speed * this.inputX;\r\n this.renderPlayer();\r\n }", "setPosition(id, x, y) {\n var player = this.players.find((p) => p.id === id);\n player.x = x;\n player.y = y;\n }", "function MoveToSchreibtisch(){\n \n document.getElementById(\"kidposition\").style.left=positionAX;\n document.getElementById(\"kidposition\").style.top =positionAY;\n \n \n}", "updatePlayerPosition(player, newPos) { //7-1\n const x = parseInt(newPos.charAt(0));\n const y = parseInt(newPos.charAt(newPos.length - 1));\n player.x = x;\n player.y = y;\n }", "localUpdate() {\n this.x = user.x + Math.round(Math.cos(user.angle) * user.speed);\n this.y = user.y + Math.round(Math.sin(user.angle) * user.speed);\n }", "function UpdateLocalPlayerPos()\n{\n if (!map_ui) {return;}\n const pos = jcmp.localPlayer.position;\n UpdateMapPos(pos);\n}", "update() {\n\n \n this.movePlayerManager();\n\n\n \n\n }", "refresh() {\n this.viewDiv.node().style.top = this._position.y + \"px\";\n this.viewDiv.node().style.left = this._position.x + \"px\";\n }", "function drawPlayer() {\n //normalize the player position, meaning convert thhe pos from a 0-100 to a 0 - maxwidth and 0 - maxheight\n let player_pos = normalize_image_position(\n players_location[0],\n players_location[1],\n true\n );\n if (!shouldRedrawBoard) {\n //compute size of sprite\n let player_size = players_def_size * (current_height / current_width);\n //draw the player\n player_sprite_context.drawImage(\n this,\n player_pos[0] - player_size,\n player_pos[1],\n player_size,\n player_size\n );\n\n vignette.style.backgroundImage = `radial-gradient(\n ellipse at ${\n (player_pos[0] / getParentProp(\"width\", { float: true })) * 100\n }% ${(player_pos[1] / getParentProp(\"height\", { float: true })) * 100}%,\n transparent 0%,\n ${vignitte_color} ${vignitte_spread}\n )`;\n } else {\n shouldRedrawBoard = false;\n drawBoard(context);\n }\n }", "function update() {\n playerMove();\n cooldowns.call(this);\n moveEnemies();\n // this.cameras.main.centerOn(player.x, player.y);\n}", "display() {\n // draw our player at their current position with the correct graphic\n image(this.myGraphic, this.xPos, this.yPos);\n }", "function movePlayer() {\n p1.render();\n p1.move();\n}", "updatePosition() {\n this.position = Utils.convertToEntityPosition(this.bmp);\n }", "function reset() {\n player.x = 200;\n player.y = 380;\n}", "function moveUp(){\n\t\t\tplayerPosition.x += 1\n\t\t\tplayer.attr({\n\t\t\t\t'cx': playerPosition.x\n\t\t\t})\n\t\t}", "function updateGame() {\n if (game_play) {\n clearCanvas();\n enemy_check_collision();\n player_check_collision();\n let check = check_border();\n if (check === true) {\n direction *= -1;\n invaders.forEach(function (element) {\n element.y += 5\n })\n }\n draw_player();\n draw_bullets();\n draw_enemy_bullets();\n invaders.forEach(function (element) {\n element.x += direction;\n element.update()\n });\n }\n}", "function sync(dom, pos) {\r\n dom.style.left = `${pos.x}px`;\r\n dom.style.top = `${pos.y}px`;\r\n}", "function playerMoving() {\n console.log('playerMoving')\n $squares.removeClass('drake-player1')\n $squares.eq(playerPosition).addClass('drake-player1')\n }", "function update() {\n // quick and dirty way of some sine based movement\n var amplitude = 30;\n var timeFactor = 0.9;\n var sine = Math.sin(game.time.totalElapsedSeconds() * timeFactor);\n var displacement = sine * amplitude;\n logo.y = logoY + displacement;\n }", "function update() {\n moveShip();\n\n // Draw everything\n draw();\n\n requestAnimationFrame(update);\n}", "update() {\n // initialize next move\n let nextPosition = this.getNextPosition();\n // if next position is not blocked by an object\n if (this.isPositionFree(nextPosition)) {\n this.position.x = nextPosition.x;\n this.position.y = nextPosition.y;\n\n // if successful, send movement to server\n this.game.broadcastPosition({id: this.id, x: this.position.x, y: this.position.y, direction: this.direction});\n }\n\n }", "function playersMove(){\n\tfor(let player of Object.keys(players)){\n\t\tlet changed = false;\n\t\tif (keys[player].includes(87) && keys[player].includes(68)){\t//W D\n\t\t\tplayers[player].y -= Math.sqrt(2)*5;\n\t\t\tplayers[player].x += Math.sqrt(2)*5;\n\t\t\tchanged = true;\n\t\t}\n\t\telse if (keys[player].includes(83) && keys[player].includes(68)){\t//S D\n\t\t\tplayers[player].y += Math.sqrt(2)*5;\n\t\t\tplayers[player].x += Math.sqrt(2)*5;\n\t\t\tchanged = true;\n\t\t}\n\t\telse if (keys[player].includes(83) && keys[player].includes(65)){\t// A S\n\t\t\tplayers[player].y += Math.sqrt(2)*5;\n\t\t\tplayers[player].x -= Math.sqrt(2)*5;\n\t\t\tchanged = true;\n\t\t}\n\t\telse if (keys[player].includes(87) && keys[player].includes(65)){\t//W A\n\t\t\tplayers[player].y -= Math.sqrt(2)*5;\n\t\t\tplayers[player].x -= Math.sqrt(2)*5;\n\t\t\tchanged = true;\n\t\t}\n\t\telse if(keys[player].includes(87)){\t//W\n\t\t\tplayers[player].y -= 10;\n\t\t\tchanged = true;\n\t\t}\n\t\telse if(keys[player].includes(65)){\t//A\n\t\t\tplayers[player].x -= 10;\n\t\t\tchanged = true;\n\t\t}\n\t\telse if(keys[player].includes(83)){\t//S\n\t\t\tplayers[player].y += 10;\n\t\t\tchanged = true;\n\t\t}\n\t\telse if(keys[player].includes(68)){\t//D\n\t\t\tplayers[player].x += 10;\n\t\t\tchanged = true;\n\t\t}\n\t\tif(changed){\n\t\t\t//Screen wrap (PacMan style)\n\t\t\tscreenWrap(player);\n\t\t\tio.emit(\"updatePlayer\", {\n\t\t\t\tindex: player,\n\t\t\t\tdata: players[player]\n\t\t\t});\n\t\t}\n\t}\n}", "function updatePosition(e) {\n xRotation = adjustRotation(e.movementX, xRotation);\n yRotation = adjustRotation(e.movementY, yRotation);\n}", "function movePlayer(pixelAmount, playerChange) {\n if (!hit) {\n leftPos += pixelAmount;\n playerPos += playerChange;\n $(\".player\").css({\n \"left\": leftPos\n });\n if (playerPos === 1) {\n $(\".player\").css({\n \"transform\": \"rotate(45deg)\",\n \"transform-origin\": \"50% 50%\"\n });\n } else if (playerPos === 3) {\n $(\".player\").css({\n \"transform\": \"rotate(-45deg)\",\n \"transform-origin\": \"50% 50%\"\n });\n } else {\n $(\".player\").css({\n \"transform\": \"rotate(0deg)\",\n \"transform-origin\": \"50% 50%\"\n });\n }\n movement++;\n $(\".moves\").html(movement);\n }\n}", "sendToStartPos() {\n this.x = this.spawnX;\n this.y = this.spawnY;\n }", "function setupPlayer() {\n playerX = 4 * width / 5;\n playerY = height / 2;\n playerHealth = playerMaxHealth;\n playerStamina = playerMaxStamina;\n}", "refreshPos() {\n\t\tlet player = this;\n\t\tif (!this.idle) {\n\t\t\tswitch (this.last_direction) {\n\t\t\t\tcase DIRECTION.DOWN: //based on direction, the characters position in the matrix is updated\n\t\t\t\t\tthis.position.row += 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DIRECTION.UP:\n\t\t\t\t\tthis.position.row -= 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DIRECTION.RIGHT:\n\t\t\t\t\tthis.position.col += 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DIRECTION.LEFT:\n\t\t\t\t\tthis.position.col -= 1;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tboard.items.forEach(function (item, index, object) {\n\t\t\t\tif (item.position.row == player.position.row &&\n\t\t\t\t\titem.position.col == player.position.col) {\n\t\t\t\t\titem.updatePlayer(player, item); // trigger the effect on the player\n\t\t\t\t\taudioPickupItem.play();\n\t\t\t\t\tobject.splice(index, 1); // destroy the item\n\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}", "function repositionAndRedrawSnakeHead(){\n snakeHead.x += snakeHead.speedX;\n snakeHead.y += snakeHead.speedY;\n drawObject(snakeHead);\n }", "function moveGameItem(obj) {\n obj.x += obj.velocityX;\n obj.y += obj.velocityY;\n obj.$element.css('left', obj.x);\n obj.$element.css('top', obj.y);\n\n if (obj.y > BOARD_HEIGHT - obj.height) {\n obj.y = BOARD_HEIGHT - obj.height;\n\n }\n if (obj.y < 0) {\n obj.y = 0;\n }\n }", "update (dt) {\n // You should multiply any movement by the dt parameter\n // which will ensure the game runs at the same speed for\n // all computers.\n const {x, y} = this.getCurrentPosition();\n let newX;\n if (x >= 500) {\n newX = -100;\n } else {\n newX = (x + dt * this.speed * 150) % (500)\n }\n\n this.setCurrentPosition(newX, y);\n }", "update() {\n this.x -= TIMESTEP;\n\n this.topPillar.style.left = `${this.x}px`;\n this.bottomPillar.style.left = `${this.x}px`;\n }", "function update() {\n miRectangulo.update();\n}", "update() {\n super.update();\n this.move();\n }", "update() {\n this.moveNinja();\n }", "function setPos()\n {\n vm.moverStyle.left = vm.themeStyle.left;\n vm.moverStyle.top = vm.themeStyle.top;\n vm.moverStyle.display = vm.themeStyle.display;\n }", "update() {\n if (this.y > gameCanvas.canvasHeight * 2/3) {\n this.y = gameCanvas.canvasHeight * 2/3;\n }\n if (this.x > gameCanvas.canvasWidth * 4/5) {\n this.x = gameCanvas.canvasWidth * 4/5;\n }\n if (this.x < 0) {\n this.x = 0;\n }\n else if (this.y < 0) {\n this.x = (Math.floor(Math.random() * 5) *100);\n this.y = gameCanvas.canvasHeight * 4/5;\n }\n }", "function set_position(name, x, y) {\r\n let obj, objx, objy;\r\n obj = \"#\" + selected;\r\n\r\n x = parseFloat(x);\r\n y = parseFloat(y);\r\n\r\n x += xvb;\r\n y += yvb;\r\n\r\n\r\n\r\n if ($(name).attr(\"class\") != \"light\") {\r\n //getting the letiables\r\n obj = \"#\" + selected;\r\n objx = parseFloat($(obj).attr(\"x\"));\r\n objy = parseFloat($(obj).attr(\"y\"));\r\n\r\n x = parseFloat(x);\r\n y = parseFloat(y);\r\n\r\n xdif = fx - firstx;\r\n ydif = fy - firsty;\r\n\r\n x += xdif;\r\n y += ydif;\r\n\r\n //x -= parseFloat($(obj).attr(\"width\"));\r\n //y -= parseFloat($(obj).attr(\"height\"));\r\n if (snap) {\r\n x = Math.floor(x / 80) * 80;\r\n y = Math.floor(y / 80) * 80;\r\n }\r\n //setting the new positions\r\n $(obj).attr(\"x\", (x).toString());\r\n $(obj).attr(\"y\", (y).toString());\r\n } else {\r\n //for circles\r\n //getting the letiables\r\n obj = \"#\" + selected;\r\n objx = parseFloat($(obj).attr(\"cx\"));\r\n objy = parseFloat($(obj).attr(\"cy\"));\r\n\r\n x = parseFloat(x);\r\n y = parseFloat(y);\r\n\r\n xdif = fx - firstx;\r\n ydif = fy - firsty;\r\n\r\n x += xdif;\r\n y += ydif;\r\n\r\n //x -= parseFloat($(obj).attr(\"width\"));\r\n //y -= parseFloat($(obj).attr(\"height\"));\r\n if (snap) {\r\n x = Math.floor(x / 80) * 80 + 40;\r\n y = Math.floor(y / 80) * 80 + 40;\r\n }\r\n //setting the new positions\r\n $(obj).attr(\"cx\", (x).toString());\r\n $(obj).attr(\"cy\", (y).toString());\r\n }\r\n}", "function update() {\n if (cursors.left.isDown) {\n player.setVelocityX(-160);\n\n player.anims.play(\"left\", true);\n } else if (cursors.right.isDown) {\n player.setVelocityX(160);\n\n player.anims.play(\"right\", true);\n } else {\n player.setVelocityX(0);\n player.anims.play(\"turn\");\n }\n\n if (cursors.up.isDown && player.body.touching.down) {\n player.setVelocityY(-550);\n }\n\n // this.tweens.add({\n // targets: joeB,\n // y: 450,\n // duration: 2000,\n // ease: \"Power2\",\n // yoyo: true,\n // loop: -1,\n // });\n}", "update() {\n var now = Date.now();\n var dt = (now - gameNs.game.prevTime);\n gameNs.game.dt = dt;\n gameNs.game.prevTime = now;\n gameNs.game.draw();\n //Update projectile manager\n gameNs.game.pm.update(dt, gameNs.game.mX, gameNs.game.mY);\n dt = 0;\n //Recursively call game.update here to create loop\n window.requestAnimationFrame(gameNs.game.update);\n }", "function movePlayer(){\n document.getElementById('player').style.left = player.left + \"px\";\n}", "function updatePosition(){\n positionX += speedX;\n $('#box').css(\"left\", positionX);\n }", "updatePositionOfInGameButtons() {\n\t\tif (this.isFullScreen) {\n\t\t\tthis.buttons.mute.reposition(this.canvas);\n\n\t\t\tthis.buttons.up.reposition(this.canvas);\n\t\t\tthis.buttons.down.reposition(this.canvas);\n\t\t\tthis.buttons.left.reposition(this.canvas);\n\t\t\tthis.buttons.right.reposition(this.canvas);\n\n\t\t\tthis.buttons.a.reposition(this.canvas);\n\t\t\tthis.buttons.b.reposition(this.canvas);\n\t\t}\n\t\telse {\n\t\t\tthis.buttons.fullscreen.reposition(this.canvas);\n\t\t}\n\t}", "function setupPlayer() {\n playerX = 4 * width / 5;\n playerY = height / 2;\n playerHealth = playerMaxHealth;\n}", "function setupPlayer() {\n playerX = 4 * width / 5;\n playerY = height / 2;\n playerHealth = playerMaxHealth;\n}", "function setupPlayer() {\n playerX = 4 * width / 5;\n playerY = height / 2;\n playerHealth = playerMaxHealth;\n}", "function update() {\n if (localPlayer.update(keys)) {\n socket.emit('move player', {\n x: localPlayer.getX(),\n y: localPlayer.getY(),\n });\n }\n}", "setPosition(newPos) {\n let difference = p5.Vector.sub(newPos, this.pixelCenter);\n difference.rotate(-this.body.angle);\n\n this.x += difference.x;\n this.y += difference.y;\n this.setCenter();\n this.setShape();\n this.resetFixture();\n }", "function playGame(){\n if(gamePlay){\n updateDash();\n //Movement\n moveRoad();\n\n if(keys.ArrowUp){\n if(player.ele.y > 400) player.ele.y -= 1 ;\n player.speed = player.speed < 20 ? (player.speed+0.05) : 20;\n }\n if(keys.ArrowDown){\n if(player.ele.y < 500){player.ele.y += 1;}\n player.speed = player.speed > 0 ? (player.speed-0.2) : 0;\n }\n if(keys.ArrowRight){\n player.ele.x += (player.speed/4);\n }\n if(keys.ArrowLeft){\n player.ele.x -= (player.speed/4);\n }\n\n //move car\n player.ele.style.top = player.ele.y + 'px';\n player.ele.style.left = player.ele.x + 'px';\n\n\n\n }\n animationGame =requestAnimationFrame(playGame);\n}", "teleportToInitialPosition() {\n let coords = game.calculateCoordinatesByPosition(this.row, this.column);\n this.x = coords[0];\n this.y = coords[1];\n if (this.elem.style.display === \"none\") {\n this.elem.style.display = \"inline\";\n }\n if (!this.collisionable)\n this.collisionable = true;\n }", "function update(){\n\t$(\"#characters\").children().each(function(index) {\n\t\tif( !$(this).hasClass(\"character-removed\") )\n\t\t{\n\t\t\tvar srcPos = $(this).attr(\"srcPos\"), destPos = $(this).attr(\"destPos\");\n\t\t\tvar destX = getPosX(destPos), srcX = getPosX(srcPos);\n\t\t\tvar movDistance = (destX - srcX) / 32;\n\t\t\tvar curPos = $(this).css(\"left\");\n\t\t\tvar nPosGap = Math.abs(destPos-srcPos);\n\t\t\n\t\t\tif(nPosGap == 0 ) // stay\n\t\t\t{\n\t\t\t\t//if(Math.random() > 0.5)\n\t\t\t\t{\n\t\t\t\t\tjumpMario($(this));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(nPosGap <= 2) // walking\n\t\t\t{\n\t\t\t\twalkMario($(this));\n\t\t\t}\n\t\t\telse if(nPosGap <4) // jump\n\t\t\t{\n\t\t\t\tjumpMario($(this));\n\t\t\t}\n\t\t\telse // run\n\t\t\t{\n\t\t\t\trunMario($(this));\n\t\t\t}\n\t\t}\n\t});\n\t\n\tmarioGame.nFrame++;\n\tif(marioGame.nFrame > 31){\n\t\tmarioGame.nFrame = 0;\n\t\tmarioGame.nTurn++;\n\t}\n}", "updatePosition() {\n this.position = getPositionForPopup(this.mapFeature);\n this.draw();\n }", "setPosition(newPos) {\n let difference = p5.Vector.sub(newPos, this.pixelCenter);\n difference.rotate(-this.body.angle);\n\n for (var i = 0; i < this.pixelVectorPositions.length; i++) {\n this.pixelVectorPositions[i].x += difference.x;\n this.pixelVectorPositions[i].y += difference.y;\n }\n\n this.setCenter();\n this.setShape();\n this.resetFixture();\n }", "function update() {\n\t/**\n\t * Flickers player when he's invincible\n\t */\n\tif (invincible && new Date().getTime() - gracePeriodFlickerTime > 250) {\n\t\tif (gracePeriodAlpha) {\n\t\t\tplayer.alpha = 0.1;\n\t\t\tgracePeriodAlpha = false;\n\t\t\tgracePeriodFlickerTime = new Date().getTime();\n\t\t} else {\n\t\t\tplayer.alpha = 1;\n\t\t\tgracePeriodAlpha = true;\n\t\t\tgracePeriodFlickerTime = new Date().getTime();\n\t\t}\n\t}\n\n\t/**\n\t * Moves all penguins\n\t */\n\tif (started) {\n\t\tpenguinsLEFT.forEach((el, i) => {\n\t\t\tel.body.velocity.x = boundingWidth * modus.penguinConfig.speed * -1;\n\t\t});\n\t\tpenguinsRIGHT.forEach((el, i) => {\n\t\t\tel.body.velocity.x = boundingWidth * modus.penguinConfig.speed;\n\t\t});\n\t}\n\n\t/**\n\t * Debug code which enables cursors for testing\n\t */\n\tif (!gyroscope && alive) {\n\t\t/**\n\t\t * When pressing left button\n\t\t */\n\t\tif (cursors.left.isDown && !cursors.right.isDown) {\n\t\t\t//set velocity\n\t\t\tplayer.body.velocity.x = boundingWidth * -0.3;\n\n\t\t\t//play the correct animation\n\t\t\tplayer.anims.play('left' + avatars.indexOf(avatar));\n\t\t\t//crop if avatar needs it\n\t\t\tif (avatar.crop) {\n\t\t\t\tplayer.height = 286.752;\n\t\t\t\tplayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t}\n\n\t\t\t//if multiplayer send player data to other users\n\t\t\tif (connectedCloud) {\n\t\t\t\tlet newPlayerData = {\n\t\t\t\t\tclientId: clientId,\n\t\t\t\t\tisRunning: true,\n\t\t\t\t\tdirection: -1\n\t\t\t\t};\n\t\t\t\t//check if player data is not a duplicate\n\t\t\t\tif (beforePlayerData.isRunning !== newPlayerData.isRunning || beforePlayerData.direction !== newPlayerData.direction) {\n\t\t\t\t\t//Make x,y positions relative for other resolutions and aspect ratios\n\t\t\t\t\tlet [x, y] = getNormalizedPositions(player.body.x, player.body.y);\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tisRunning: true,\n\t\t\t\t\t\t\tdirection: -1,\n\t\t\t\t\t\t\tstatus: 'movement',\n\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tbeforePlayerData = newPlayerData;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * When pressing right button\n\t\t\t */\n\t\t} else if (cursors.right.isDown) {\n\t\t\t//set velocity\n\t\t\tplayer.body.velocity.x = boundingWidth * 0.3;\n\n\t\t\t//play the correct animation\n\t\t\tplayer.anims.play('right' + avatars.indexOf(avatar));\n\t\t\t//crop if avatar needs it\n\t\t\tif (avatar.crop) {\n\t\t\t\tplayer.height = 286.752;\n\t\t\t\tplayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t}\n\n\t\t\t//if multiplayer send player data to other users\n\t\t\tif (connectedCloud) {\n\t\t\t\tlet newPlayerData = {\n\t\t\t\t\tclientId: clientId,\n\t\t\t\t\tisRunning: true,\n\t\t\t\t\tdirection: 1\n\t\t\t\t};\n\t\t\t\t//check if player data is not a duplicate\n\t\t\t\tif (beforePlayerData.isRunning !== newPlayerData.isRunning || beforePlayerData.direction !== newPlayerData.direction) {\n\t\t\t\t\t//Make x,y positions relative for other resolutions and aspect ratios\n\t\t\t\t\tlet [x, y] = getNormalizedPositions(player.body.x, player.body.y);\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tisRunning: true,\n\t\t\t\t\t\t\tdirection: 1,\n\t\t\t\t\t\t\tstatus: 'movement',\n\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tbeforePlayerData = newPlayerData;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// player.anims.play('right', true);\n\t\t} else {\n\t\t\t//set velocity\n\t\t\tplayer.body.velocity.x = 0;\n\n\t\t\t//play the correct animation\n\t\t\tplayer.anims.play('turn' + avatars.indexOf(avatar));\n\t\t\t//crop if avatar needs it\n\t\t\tif (avatar.crop) {\n\t\t\t\tplayer.height = 286.752;\n\t\t\t\tplayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t}\n\n\t\t\t//if multiplayer send player data to other users\n\t\t\tif (connectedCloud) {\n\t\t\t\tlet newPlayerData = {\n\t\t\t\t\tclientId: clientId,\n\t\t\t\t\tisRunning: false,\n\t\t\t\t\tdirection: 0\n\t\t\t\t};\n\t\t\t\t//check if player data is not a duplicate\n\t\t\t\tif (beforePlayerData.isRunning !== newPlayerData.isRunning) {\n\t\t\t\t\t//Make x,y positions relative for other resolutions and aspect ratios\n\t\t\t\t\tlet [x, y] = getNormalizedPositions(player.body.x, player.body.y);\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tisRunning: false,\n\t\t\t\t\t\t\tdirection: 0,\n\t\t\t\t\t\t\tstatus: 'movement',\n\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tbeforePlayerData = newPlayerData;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// player.anims.play('turn');\n\t\t}\n\n\t\t/**\n\t\t * When player is not touching the floor\n\t\t */\n\t\tif (!player.body.touching.down) {\n\t\t\t//Disable crop for normal state\n\t\t\tplayer.isCropped = false;\n\t\t\tplayer.height = 359;\n\n\t\t\t//Play correct animation\n\t\t\tif (player.body.velocity.x === 0) {\n\t\t\t\tplayer.anims.play('turnJump' + avatars.indexOf(avatar));\n\t\t\t} else {\n\t\t\t\tif (player.body.velocity.x > 0) player.anims.play('rightJump' + avatars.indexOf(avatar));\n\t\t\t\tif (player.body.velocity.x < 0) player.anims.play('leftJump' + avatars.indexOf(avatar));\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * When the up button is being pressed -> jump\n\t\t */\n\t\tif (cursors.up.isDown && player.body.touching.down) {\n\t\t\t//Set velocity\n\t\t\tplayer.body.velocity.y = (boundingHeight / 2) * 1.5 * -1;\n\n\t\t\t//if multiplayer send player data to other users\n\t\t\tif (connectedCloud) {\n\t\t\t\tlet newPlayerData = {\n\t\t\t\t\tclientId: clientId,\n\t\t\t\t\tisJumping: true\n\t\t\t\t};\n\t\t\t\t//check if player data is not a duplicate\n\t\t\t\tif (beforePlayerData.isJumping !== newPlayerData.isJumping) {\n\t\t\t\t\t//Make x,y positions relative for other resolutions and aspect ratios\n\t\t\t\t\tlet [x, y] = getNormalizedPositions(player.body.x, player.body.y);\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tisJumping: true,\n\t\t\t\t\t\t\tstatus: 'movement',\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tbeforePlayerData = newPlayerData;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\t/**\n\t\t * When player is not touching the floor\n\t\t */\n\t\tif (!player.body.touching.down) {\n\t\t\t//Disable crop for normal state\n\t\t\tplayer.isCropped = false;\n\t\t\tplayer.height = 359;\n\n\t\t\t//Play correct animation\n\t\t\tif (player.body.velocity.x === 0) {\n\t\t\t\tplayer.anims.play('turnJump' + avatars.indexOf(avatar));\n\t\t\t} else {\n\t\t\t\tif (player.body.velocity.x > 0) player.anims.play('rightJump' + avatars.indexOf(avatar));\n\t\t\t\tif (player.body.velocity.x < 0) player.anims.play('leftJump' + avatars.indexOf(avatar));\n\t\t\t}\n\t\t} else {\n\t\t\t//Player is touching the floor -> send update if multiplayer\n\t\t\tif (connectedCloud) {\n\t\t\t\tlet newPlayerData = {\n\t\t\t\t\tclientId: clientId,\n\t\t\t\t\tisJumping: false\n\t\t\t\t};\n\t\t\t\t//Check if not duplicate\n\t\t\t\tif (beforePlayerData.isJumping !== newPlayerData.isJumping) {\n\t\t\t\t\t//Make x,y positions relative for other resolutions and aspect ratios\n\t\t\t\t\tlet [x, y] = getNormalizedPositions(player.body.x, player.body.y);\n\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tisJumping: false,\n\t\t\t\t\t\t\tstatus: 'movement',\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\tbeforePlayerData = newPlayerData;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * If client is host and game has started -> spawn new objects\n\t */\n\tif ((host || !multiplayer) && started) {\n\t\t/**\n\t\t * Randomize when an object is being spawned\n\t\t */\n\t\tlet random = Math.random() * (modus.maxSpawnTime - modus.minSpawnTime) + modus.minSpawnTime;\n\t\tif (new Date().getTime() - lastTimeSpawn > random) {\n\t\t\t/**\n\t\t\t * 80% chance for icicle\n\t\t\t * 20% chance for penguin\n\t\t\t */\n\t\t\tlet spawnChance = Math.random();\n\t\t\tif (spawnChance <= modus.icicleChance) {\n\t\t\t\t/**\n\t\t\t\t * Spawn icicle\n\t\t\t\t */\n\n\t\t\t\t//Randomize spawn location\n\t\t\t\tlet x =\n\t\t\t\t\tMath.random() *\n\t\t\t\t\t\t(((width - boundingWidth * 0.85) / 2 + boundingWidth * 0.85) * modus.icicleConfig.maxSpawnOffset - ((width - boundingWidth * 0.85) / 2) * modus.icicleConfig.minSpawnOffset) +\n\t\t\t\t\t((width - boundingWidth * 0.85) / 2) * modus.icicleConfig.minSpawnOffset;\n\n\t\t\t\t//Add sprite to the canvas\n\t\t\t\tice = this.physics.add.sprite(x, -1 * (boundingHeight * 0.4), 'icicle');\n\t\t\t\tice.scaleY = ice.scaleX = boundingWidth / 6000;\n\n\t\t\t\t//Set custom gravity (Icicle speed)\n\t\t\t\tice.setGravityY(gravity * modus.icicleConfig.gravity);\n\n\t\t\t\t//Icicle should always be on top of player\n\t\t\t\tice.setDepth(1000);\n\t\t\t\tice.setOrigin(0.5, 0);\n\n\t\t\t\t//Add the Icicle to the enemies list\n\t\t\t\tenemies.push(ice);\n\n\t\t\t\t//If alive addScore\n\t\t\t\tif (alive) addScore();\n\n\t\t\t\t//Make x,y positions relative so other players with different resolution or aspect ratio get the correct position\n\t\t\t\tlet [xb, yb] = getNormalizedPositions(x, -1 * (boundingHeight * 0.4));\n\t\t\t\tif (connectedCloud) {\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tstatus: 'newEnemy',\n\t\t\t\t\t\t\ttype: 'icicle',\n\t\t\t\t\t\t\tx: xb,\n\t\t\t\t\t\t\ty: yb\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (spawnChance <= modus.penguinChance + modus.icicleChance) {\n\t\t\t\t/**\n\t\t\t\t * Spawn penguin\n\t\t\t\t */\n\t\t\t\tlet x;\n\t\t\t\tlet list;\n\t\t\t\tlet flip = true;\n\n\t\t\t\t//Randomize left/right\n\t\t\t\tif (Math.random() <= 0.5) {\n\t\t\t\t\tx = (width - boundingWidth * 0.85) / 2 + boundingWidth * 0.85;\n\t\t\t\t\tlist = penguinsLEFT;\n\t\t\t\t\tflip = false;\n\t\t\t\t} else {\n\t\t\t\t\tx = (width - boundingWidth * 0.85) / 2;\n\t\t\t\t\tlist = penguinsRIGHT;\n\t\t\t\t}\n\n\t\t\t\t//Add penguin to the canvas\n\t\t\t\tlet penguin = this.physics.add.sprite(x, height - height * 0.2, 'penguin');\n\n\t\t\t\t//Scaling\n\t\t\t\tpenguin.scaleY = penguin.scaleX = boundingWidth / 16500;\n\n\t\t\t\t//Penguin should be flipped when going to the left\n\t\t\t\tpenguin.flipX = flip;\n\t\t\t\tpenguin.setOrigin(0.5, 0);\n\n\t\t\t\t//Set gravity\n\t\t\t\tpenguin.setGravityY(gravity);\n\n\t\t\t\tpenguin.setDepth(1000);\n\n\t\t\t\tpenguin.body.bounce.x = 0.5;\n\t\t\t\tpenguin.body.bounce.y = 0.5;\n\n\t\t\t\t//Penguins should be able to stand on the platform not fall through it\n\t\t\t\tthis.physics.add.collider(penguin, platforms);\n\n\t\t\t\t//Add penguin to enemy list\n\t\t\t\tenemies.push(penguin);\n\n\t\t\t\t//Add penguin to the list if it should go right or left\n\t\t\t\tlist.push(penguin);\n\n\t\t\t\t//Add score if still alive\n\t\t\t\tif (alive) addScore();\n\n\t\t\t\t//Make x,y positions relative so other players with different resolution or aspect ratio get the correct position\n\t\t\t\tlet [xb, yb] = getNormalizedPositions(x, height - height * 0.2);\n\t\t\t\tif (connectedCloud) {\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tstatus: 'newEnemy',\n\t\t\t\t\t\t\ttype: 'penguin',\n\t\t\t\t\t\t\tflip: flip,\n\t\t\t\t\t\t\tx: xb,\n\t\t\t\t\t\t\ty: yb\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * Spawn healthPowerup\n\t\t\t\t */\n\n\t\t\t\t//Randomize spawn location\n\t\t\t\tlet x =\n\t\t\t\t\tMath.random() *\n\t\t\t\t\t\t(((width - boundingWidth * 0.85) / 2 + boundingWidth * 0.85) * modus.icicleConfig.maxSpawnOffset - ((width - boundingWidth * 0.85) / 2) * modus.icicleConfig.minSpawnOffset) +\n\t\t\t\t\t((width - boundingWidth * 0.85) / 2) * modus.icicleConfig.minSpawnOffset;\n\n\t\t\t\t//Add sprite to the canvas\n\t\t\t\tlet health = this.physics.add.sprite(x, -1 * (boundingHeight * 0.4), 'heart');\n\t\t\t\thealth.scaleY = health.scaleX = boundingWidth / 22000;\n\n\t\t\t\t//Set gravity\n\t\t\t\thealth.setGravityY(gravity);\n\n\t\t\t\t//HealthPowerup should always be on top of player\n\t\t\t\thealth.setDepth(1000);\n\t\t\t\thealth.setOrigin(0.5, 0);\n\t\t\t\thealth.name = ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));\n\n\t\t\t\t//HealthPowerup should stand on the platform, not fall through\n\t\t\t\tthis.physics.add.collider(health, platforms);\n\n\t\t\t\t//Add the HealthPowerup to the powerup list\n\t\t\t\thealthPowerups.push(health);\n\n\t\t\t\t//Make x,y positions relative so other players with different resolution or aspect ratio get the correct position\n\t\t\t\tlet [xb, yb] = getNormalizedPositions(x, -1 * (boundingHeight * 0.4));\n\t\t\t\tif (connectedCloud) {\n\t\t\t\t\tmqttClient.publish(\n\t\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\t\tstatus: 'newPowerup',\n\t\t\t\t\t\t\ttype: 'health',\n\t\t\t\t\t\t\tid: health.name,\n\t\t\t\t\t\t\tx: xb,\n\t\t\t\t\t\t\ty: yb\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\t//Update when an enemy has spawned\n\t\t\tlastTimeSpawn = new Date().getTime();\n\t\t}\n\t}\n\n\t/**\n\t * When multiplayer -> update player position\n\t */\n\tif (multiplayer && otherPlayerData.alive && otherPlayer !== undefined) {\n\t\t/**\n\t\t * If running to the left\n\t\t */\n\t\tif (otherPlayerData.isRunning && otherPlayerData.direction == -1) {\n\t\t\t//Set velocity\n\t\t\totherPlayer.body.velocity.x = boundingWidth * -0.3;\n\t\t\t//Play animation\n\t\t\totherPlayer.anims.play('left' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayerData.avatar.crop) {\n\t\t\t\totherPlayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t\totherPlayer.height = 286.752;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * If running to the right\n\t\t\t */\n\t\t} else if (otherPlayerData.isRunning && otherPlayerData.direction == 1) {\n\t\t\t//Set velocity\n\t\t\totherPlayer.body.velocity.x = boundingWidth * 0.3;\n\t\t\t//Play animation\n\t\t\totherPlayer.anims.play('right' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayerData.avatar.crop) {\n\t\t\t\totherPlayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t\totherPlayer.height = 286.752;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * If standing still\n\t\t\t */\n\t\t} else {\n\t\t\t//Set velocity\n\t\t\totherPlayer.body.velocity.x = 0;\n\t\t\t//Play animation\n\t\t\totherPlayer.anims.play('turn' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayerData.avatar.crop) {\n\t\t\t\totherPlayer.setCrop(0, 72.248, player.width, 286.752);\n\t\t\t\totherPlayer.height = 286.752;\n\t\t\t}\n\t\t}\n\t\t/**\n\t\t * If other player is jumping\n\t\t */\n\t\tif (!otherPlayer.body.touching.down) {\n\t\t\t//Play animation\n\t\t\tif (otherPlayer.body.velocity.x === 0) otherPlayer.anims.play('turnJump' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayer.body.velocity.x > 0) otherPlayer.anims.play('rightJump' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayer.body.velocity.x < 0) otherPlayer.anims.play('leftJump' + avatars.indexOf(otherPlayerData.avatar));\n\t\t\tif (otherPlayerData.avatar.crop) {\n\t\t\t\totherPlayer.isCropped = false;\n\t\t\t\totherPlayer.height = 359;\n\t\t\t}\n\t\t}\n\t\t/**\n\t\t * If the other player is about to jump\n\t\t */\n\t\tif (otherPlayerData.isJumping && otherPlayer.body.touching.down) {\n\t\t\t//Set velocity\n\t\t\totherPlayer.body.velocity.y = (boundingHeight / 2) * 1.5 * -1;\n\n\t\t\t//Set jumping to false so the player won't jump twice\n\t\t\totherPlayerData.isJumping = false;\n\t\t}\n\t}\n\n\t/**\n\t * If player fell of the platform -> hit\n\t */\n\tif (player.body.y > height) {\n\t\thit();\n\t}\n\n\t/**\n\t * Update highscore missions\n\t */\n\n\tif (leaderboard !== undefined) {\n\t\tif (leaderboard.length !== 0) {\n\t\t\tlet lowestScoreToBeat;\n\t\t\tlet position = 1;\n\t\t\tleaderboard.forEach((el, i) => {\n\t\t\t\tif ((el.score < lowestScoreToBeat && el.score > score) || lowestScoreToBeat === undefined) {\n\t\t\t\t\tlowestScoreToBeat = el.score;\n\t\t\t\t\tposition = i + 1;\n\t\t\t\t}\n\t\t\t});\n\t\t\thighscorePositionObject.innerHTML = `${position}e`;\n\t\t\thighscoreScoreObject.innerHTML = lowestScoreToBeat;\n\t\t} else {\n\t\t\thighscorePositionObject.innerHTML = `1e`;\n\t\t\thighscoreScoreObject.innerHTML = 0;\n\t\t}\n\t} else {\n\t\thighscorePositionObject.innerHTML = `1e`;\n\t\thighscoreScoreObject.innerHTML = 0;\n\t}\n}", "function update(event) {\n const pt = new DOMPoint(event.clientX, event.clientY) // gives the same coordinates as pt\n const svgP = pt.matrixTransform(toValue(target).getScreenCTM().inverse());\n x.value = svgP.x\n y.value = svgP.y\n }", "function setupPlayer() {\n playerX = 4*width/5;\n playerY = height/2;\n playerHealth = playerMaxHealth;\n}", "function moveSprite() {\n\tconst position = getPosition();\n\tposition.appendChild(spriteImg);\n}", "setPlayers() {\n\n GameElements.players[0].xPos = 50;\n GameElements.players[0].yPos = 50;\n GameElements.players[0].position = 17;\n GameElements.players[0].state = Player.STATES.PLAYING;\n GameElements.players[0].color = Player.COLORS.WHITE;\n\n if (REQUIRED_PLAYERS > 1) {\n GameElements.players[1].xPos = 650;\n GameElements.players[1].yPos = 50;\n GameElements.players[1].position = 29;\n GameElements.players[1].state = Player.STATES.PLAYING;\n GameElements.players[1].color = Player.COLORS.BLACK;\n }\n if (REQUIRED_PLAYERS > 2) {\n GameElements.players[2].xPos = 50;\n GameElements.players[2].yPos = 550;\n GameElements.players[2].position = 167;\n GameElements.players[2].state = Player.STATES.PLAYING;\n GameElements.players[2].color = Player.COLORS.BLUE;\n }\n if (REQUIRED_PLAYERS > 3) {\n GameElements.players[3].xPos = 650;\n GameElements.players[3].yPos = 550;\n GameElements.players[3].position = 179;\n GameElements.players[3].state = Player.STATES.PLAYING;\n GameElements.players[3].color = Player.COLORS.YELLOW;\n }\n\n }", "move(x, y) {\n this.x = x;\n this.y = y;\n\n const player = document.getElementById(\"player2\");\n player.style.left = (this.x * widthCase) + \"px\";\n player.style.top = (this.y * widthCase) + \"px\";\n\n this.attributes.addLife(this.x,this.y);\n this.attributes.addBomb(this.x,this.y);\n this.attributes.addDamageBomb(this.x,this.y);\n this.attributes.removeLife(this.x,this.y)\n\n }" ]
[ "0.79604137", "0.7808896", "0.7473345", "0.68191874", "0.6784075", "0.6685899", "0.66411537", "0.6572363", "0.65064424", "0.65058273", "0.64343697", "0.6419902", "0.64089346", "0.6400639", "0.6349988", "0.63416183", "0.6277009", "0.6267692", "0.6261956", "0.6210306", "0.62013924", "0.6190118", "0.6179437", "0.6152888", "0.6145732", "0.6143469", "0.6109719", "0.610798", "0.60981995", "0.6089606", "0.6067312", "0.60667425", "0.6062726", "0.6061759", "0.60572803", "0.60522455", "0.6044106", "0.6037694", "0.60228103", "0.60159856", "0.5980333", "0.5970463", "0.59686005", "0.59647167", "0.59639204", "0.59636194", "0.59606344", "0.5954676", "0.59544045", "0.5942959", "0.5934867", "0.59218323", "0.59145457", "0.5914056", "0.5913723", "0.5905891", "0.5896126", "0.58855695", "0.58813864", "0.58738124", "0.5873801", "0.5864831", "0.5852777", "0.5828628", "0.5819013", "0.5817255", "0.5817002", "0.5815365", "0.5798435", "0.5793704", "0.5791604", "0.57904685", "0.5787844", "0.5783725", "0.577653", "0.57761586", "0.57759833", "0.577414", "0.5772754", "0.5771405", "0.5769355", "0.5766222", "0.5758881", "0.57580584", "0.5756297", "0.5756297", "0.5756297", "0.5752824", "0.5752037", "0.57486075", "0.5738889", "0.5738849", "0.5736479", "0.5736419", "0.5734693", "0.5733018", "0.5733003", "0.57303405", "0.5730238", "0.5726357" ]
0.7708287
2
With a function defined separately
function sayHi() { alert('Hello Mr. Universe! (3)'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function miFuncion (){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function fn() {}", "function fun() { }", "function fn() {\n\t\t }", "function Func_s() {\n}", "function a(fn) { fn()}", "function fm(){}", "function myFnCall(fn) {\n return new Function('return ' + fn)();\n }", "function getFunc() { return \"gate\"; }", "function fuction() {\n\n}", "function demothodize(f) {\n return function(x, y) {\n return f.call(x, y);\n };\n}", "function ea(){}", "function __func(){}", "function x(t){return\"function\"==typeof t?t:function(){return t}}", "function fuctionPanier(){\n\n}", "function foo3(f) { f(1, 2); }", "defineFn(name, words) {this.fnDefs[name] = words;}", "function TrackByFunction() {}", "function TrackByFunction() {}", "function TrackByFunction() {}", "function wrapfunction(fn,message){if(typeof fn!=='function'){throw new TypeError('argument fn must be a function');}return fn;}", "function FunctionUtils() {}", "function fun1 ( ) {}", "function F() {}", "function F() {}", "function F() {}", "function F() {}", "function F() {}", "function F() {}", "function F() {}", "function F() {}", "function F() {}", "function F() {}", "function F() {}", "function F() {}", "function c() {}", "function F() { }", "function f1() {}", "function func1() {}", "function fun1( /*parametros opcionais*/ ){ /*retorno opcional*/ }", "function fun1() {}", "function fun1() {}", "function miFuncion(){\n\n}", "function one(){\n \n}", "function fun1(){}", "function fun1(){}", "function Fn($1) { return function($2) { return Function_ ([$1, $2]); }; }", "function foo4(f) { f(1, 2, 3); }", "function justInvoke(fn){\n return fn()\n}//justInvoke", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function f() {}", "function TrackByFunction() { }", "function TrackByFunction() { }", "function run(func, params) { window[func](params); }", "function run(func, params) { window[func](params); }", "function fun1(){} //toda a função de js retorna alguma coisa", "function dummy(){}", "function dummy(){}", "function dummy(){}", "function applyOp(node, func) {\n node = $(node);\n node.trigger(\"fluid-\"+func);\n node[func]();\n }", "custom(fn) {\r\n\t\treturn this.push('fn', [...arguments]);\r\n\t}", "function funcionParametro(fn) {\n\tfn();\n}", "function F(){}", "function createFunction( query ) {\n\n // store link\n doQuery = query;\n\n // return the function\n return searchDatasetByConstraint;\n\n }", "function TrackByFunction(){}", "function dummy() {}", "function dummy() {}", "function dummy() {}", "\"function name\"(){\n //do thing\n }", "function Ha(){}", "function z(){// can be called as an API method\nD(),F()}", "function firstFunc(funcParam){\n funcParam();\n}", "function ba(){}", "function ba(){}", "function ba(){}", "function ba(){}", "function f(){}", "function makefunc(x) {\r\n// return function() { return x; }\r\n// return new Function($direct_func_xxx$);\r\n return new Function(\"return x;\")\r\n}", "function test() {}", "function doIt() {\n eval(func);\n }", "function func(){\r\n\r\n}", "function fun1() { }", "function fun1() { }", "function fun1() { }", "function fun1() { }", "function fun1() { }" ]
[ "0.6948482", "0.68829966", "0.68829966", "0.68829966", "0.6613614", "0.6588897", "0.64869076", "0.63582677", "0.63441885", "0.6329984", "0.62855595", "0.6278528", "0.6277645", "0.6273575", "0.6265701", "0.62605596", "0.6255746", "0.6248913", "0.6244802", "0.6219179", "0.6181166", "0.6181166", "0.6181166", "0.61729425", "0.6159961", "0.61431074", "0.6141955", "0.6141955", "0.6141955", "0.6141955", "0.6141955", "0.6141955", "0.6141955", "0.6141955", "0.6141955", "0.6141955", "0.6141955", "0.6141955", "0.6138532", "0.61325634", "0.61191434", "0.6115897", "0.6115284", "0.6108043", "0.6108043", "0.60903", "0.6087182", "0.608342", "0.608342", "0.60628307", "0.6061812", "0.6060205", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.60541856", "0.6048313", "0.6048313", "0.6027522", "0.6027522", "0.60175407", "0.60130787", "0.60130787", "0.60130787", "0.60093874", "0.60020494", "0.599501", "0.5991168", "0.5981322", "0.5977215", "0.5974358", "0.5974358", "0.5974358", "0.5970324", "0.59700036", "0.59694624", "0.5967568", "0.5960379", "0.5960379", "0.5960379", "0.5960379", "0.59533036", "0.5922243", "0.59204483", "0.59185284", "0.59171927", "0.59106094", "0.59106094", "0.59106094", "0.59106094", "0.59106094" ]
0.0
-1
Passing parameters to a setTimeout() function
function sayHi2(who) { alert('Hello ' + who + '! (4)'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setTimeout(callback, timeout) {return callback()} // TODO", "function setCustomTimeout(fn, delay){\n //wait\n var cur_d = new Date();\n var cur_ticks = cur_d.getTime();\n var ms_passed = 0;\n while(ms_passed < delay) {\n var d = new Date(); // Possible memory leak?\n var ticks = d.getTime();\n ms_passed = ticks - cur_ticks;\n d = null; // Prevent memory leak?\n }\n fn(); // PLAIN CALL\n}", "function setTimeout(func, when) {\n func();\n}", "static setTimeout(_callback, _milliseconds) {\n Setup.timeout = window.setTimeout(_callback, _milliseconds);\n }", "function actually_setTimeout() {\n data.id = setTimeout( function(){ data.fn(); }, delay );\n }", "function start()\n{\n\tmyVar = setTimeout(function(){alertfunction('first param', 'second param')}, 3000);\n\n}", "function setTimeout(f, time) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n if (time === 0) {\n f(args);\n return -1;\n }\n else {\n return window.setTimeout(f, time, args);\n }\n}", "function setTimeout(f,r) { return f(); }", "function delay(func, wait) {\r\n \r\n // setTimeout(func, wait);\r\n\r\n}", "function setTimeout(fn, timeout) {\n Utilities.sleep(timeout);\n fn();\n}", "function delay(func, wait) {\n\n}", "setTimeout(callback, delay){\n\t\tthis.game.time.events.add(delay, (function(){callback()}), this.game)\n\t}", "function waitAndRun(ms,func){\n setTimeout(func, ms)\n}", "function delay(timeout){\n return waitAndCall.bind(null, timeout); \n}", "function waitFor(milliseconds, callback) {\n setTimeout(callback(milliseconds), milliseconds)//the call back function required a parameter\n}", "function delay (/* time, fun, ... */) {\n var a = __slice.call(arguments)\n setTimeout(function () {\n a[1].apply(a[2], a.slice(3))\n }, a[0])\n}", "function delay(callback) {\n setTimeout(callback, 5000, 'Hello!Callback');\n}", "function setTime(time) {\n timeout = time;\n}", "function delay(callback) {\n //i want to return some data using timer after 5000ms\n setTimeout(callback, 5000, \"Hello\")\n}", "function runsetTimeout() {\n console.log(\"\\n--->> runsetTimeout\");\n (0, _setTimeout.setTimeout01)();\n (0, _setTimeout.setTimeout02)();\n}", "function delay(fn, millis){\n return function(){\n var args = [].slice.call(arguments);\n setTimeout.apply(this, [fn,millis].concat(args));\n }\n}", "function waitAndRun(func, ms) { // waitAndRun la 1 higher orders function \n setTimeout(func, ms);\n}", "function timeoutFunction() {\n\t\t\tif (timeouts.length) {\n\t\t\t\t(timeouts.shift())();\n\t\t\t}\n\t\t}", "function timeoutFunction() {\n\t\t\tif (timeouts.length) {\n\t\t\t\t(timeouts.shift())();\n\t\t\t}\n\t\t}", "function waitThenRun(arg) {\n setTimeout(arg, 1500);\n}", "setTimeout (name, fn, delay) {\n setTimeout(() => this._runFunction(name, fn), delay);\n }", "function quickSetTimeout( millis, func ) {\r\n if ( millis < 10 )\r\n _.defer( func );\r\n else\r\n setTimeout( func, millis );\r\n }", "delayed_callback () { \n \n // Loop through and execute the callbacks\n for (var i = 0; i < this.delayed_callbacks.length; i++) {\n this.delayed_callbacks[i]();\n }\n\n // kill the delay timeout id\n this.timeoutID = null;\n\n }", "set timeout(milliseconds) {\n this._timeout = milliseconds;\n }", "function waitAndCall(timeout, callback){\n setTimeout(callback, timeout);\n}", "function setTimeoutTimer(time) {\n\tvar sec_ten = Math.floor(time / 10);\n\tvar sec_one = time % 10;\n\n\tonLED('#timeout_tens', SMALL_NUMBERS[sec_ten]);\n\tonLED('#timeout_ones', SMALL_NUMBERS[sec_one]);\n}", "function delay(timeout, func) {\n if (func.timer) {\n clearTimeout(func.timer);\n }\n func.timer = setTimeout(func, timeout);\n}", "function runAfterDelay(delay, callback) {\nsetTimeout(callback, delay*1000)\n}", "function example9() {\n\n var sum = function sum(x, y) {\n console.log(x + y);\n };\n\n function delay(f, ms) {\n return function () {\n var _this2 = this,\n _arguments2 = arguments;\n\n setTimeout(function () {\n return f.apply(_this2, _arguments2);\n }, ms);\n };\n }\n\n var d = delay(sum, 5000);\n d(1, 2);\n}", "function Inspection (allowTime){\n myVar = setTimeout(alertMe, xsum); \n yourVar = setTimeout( goOn ,1); \n}", "function asyncCallback(msec, arg, callback) {\n\t\tsetTimeout(callback, msec, null, arg);\n\t}", "function printTimeout(str, n) {\n setTimeout(function () {\n console.log(str)\n }, n * 1000);\n}", "function time(func, delay) {\n let timeout;\n return function () {\n const context = this;\n const args = arguments;\n \n clearTimeout(timeout);\n \n timeout = setTimeout(function () {\n timeout = null;\n func.apply(context, args);\n }, delay);\n };\n }", "delay( name, seconds, callback ) {\n if ( !name || typeof callback !== 'function' ) return;\n if ( this._sto[ name ] ) clearTimeout( this._sto[ name ] );\n this._sto[ name ] = setTimeout( callback, 1000 * ( seconds | 0 ) );\n }", "static delay(f, duration = 0) {\n setTimeout(f, duration);\n }", "function setupTimeoutTimer() {\n updateTimeoutInfo(undefined);\n }", "function _setTimeout() {\n return window.setTimeout.apply( window, arguments );\n }", "function runAfterDelay(delay, callback){\n setTimeout(() => { \n callback();\n }, delay*1000); \n}", "function t(e,t,n){var r;return function(){var i=this,o=arguments,a=function(){r=null,n||e.apply(i,o)},s=n&&!r;clearTimeout(r),r=setTimeout(a,t),s&&e.apply(i,o)}}", "function setTimeOutHelper(container, draggable) {\n setTimeout(moveToComplete, TIME_OUT, container, draggable);\n }", "function delay(orig_cb, ctxt, ms){\n ctxt = ctxt || null;\n ms = ms || 100;\n return function(){\n var args = arguments;\n setTimeout(function(){ orig_cb.apply(ctxt, args); }, ms);\n };\n}", "onTimeout() {}", "timeout(name, fn, delay = 300) {\n if (name && fn && fn instanceof Function) {\n this.clearTimeout(name);\n this._timers[name] = setTimeout(() => {\n fn();\n this._timers[name] = null;\n }, delay);\n }\n else {\n throw new Error(name ? 'Cannot create named timeout without a name' : 'Cannot create a timeout without a callback');\n }\n }", "function defer(func, ms) {\n return function () {\n // eslint-disable-next-line prefer-rest-params\n setTimeout(() => func.apply(this, arguments), ms);\n };\n}", "function delay(func, n) {\n return function() {\n setTimeout(() => func.apply(this, arguments), n);\n };\n}", "function delay(callback, ms) {\r\n\tvar timer = 0;\r\n\treturn function() {\r\n\t var context = this, args = arguments;\r\n\t clearTimeout(timer);\r\n\t timer = setTimeout(function () {\r\n\t\tcallback.apply(context, args);\r\n\t }, ms || 0);\r\n\t};\r\n }", "set timeout(milliseconds) {\n this._timeout = milliseconds;\n }", "set timeout(milliseconds) {\n this._timeout = milliseconds;\n }", "function runAfterDelay(callback, delay) {\n setTimeout(callback, delay);\n}", "function SetDelay() {\r\n setTimeout(function(){CreateBadgeReqLinks();},3000); //3 seconds\r\n console.log(\"setting timout\");\r\n }", "function async(arg, callback) {\n console.log('do something with \\''+arg+'\\', return 1 sec later');\n setTimeout(function() { callback(arg * 2); }, 3000);\n}", "runDelay(type, cb) {\n this.clearDelay();\n const delay = parseInt(this[`${type}Delay`], 10);\n this[`${type}Timeout`] = setTimeout(cb || (() => {\n this.isActive = {\n open: true,\n close: false\n }[type];\n }), delay);\n }", "runDelay(type, cb) {\n this.clearDelay();\n const delay = parseInt(this[`${type}Delay`], 10);\n this[`${type}Timeout`] = setTimeout(cb || (() => {\n this.isActive = {\n open: true,\n close: false\n }[type];\n }), delay);\n }", "runDelay(type, cb) {\n this.clearDelay();\n const delay = parseInt(this[`${type}Delay`], 10);\n this[`${type}Timeout`] = setTimeout(cb || (() => {\n this.isActive = {\n open: true,\n close: false\n }[type];\n }), delay);\n }", "runDelay(type, cb) {\n this.clearDelay();\n const delay = parseInt(this[`${type}Delay`], 10);\n this[`${type}Timeout`] = setTimeout(cb || (() => {\n this.isActive = {\n open: true,\n close: false\n }[type];\n }), delay);\n }", "runDelay(type, cb) {\n this.clearDelay();\n const delay = parseInt(this[`${type}Delay`], 10);\n this[`${type}Timeout`] = setTimeout(cb || (() => {\n this.isActive = {\n open: true,\n close: false\n }[type];\n }), delay);\n }", "function sleep1(ms) {\n\t\tif (typeof ms !== 'number')\n\t\t\tthrow new TypeError('ms must be a number');\n\n\t\tvar args = slice.call(arguments, 1);\n\t\tvar cb = args.pop();\n\t\tif (typeof cb !== 'function')\n\t\t\tthrow new TypeError('cb must be a function');\n\n\t\tsetTimeout.apply(null, [cb, ms, null].concat(args));\n\t}", "function fixedDelay(callback, waitMS) {\n return function() {\n setTimeout(callback, waitMS)\n }\n}", "function wt(e,t){var a=Ce(e,t);if(a.length){var n,r=Array.prototype.slice.call(arguments,2);vi?n=vi.delayedCallbacks:wi?n=wi:(n=wi=[],setTimeout(xt,0));for(var f=0;f<a.length;++f)!function(e){n.push(function(){return a[e].apply(null,r)})}(f)}}", "function delay(func, time) {\n\n\treturn function() {\n\t\tsetTimeout(() => func.apply(this, arguments), time)\n\t}\n}", "function callItTwice(callback){\n setTimeout(callback,200);\n setTimeout(callback,300);\n setTimeout(callback,400);\n setTimeout(callback,500);\n}", "function setTimeout(func, delay) {\n var cb_func;\n var bind_args;\n var timer_id;\n var evloop = EventLoop;\n\n // Delay can be optional at least in some contexts, so tolerate that.\n // https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout\n if (typeof delay !== 'number') {\n if (typeof delay === 'undefined') {\n delay = 0;\n } else {\n throw new TypeError('invalid delay');\n }\n }\n delay = Math.max(evloop.minimumDelay, delay);\n\n if (typeof func === 'string') {\n // Legacy case: callback is a string.\n cb_func = eval.bind(this, func);\n } else if (typeof func !== 'function') {\n throw new TypeError('callback is not a function/string');\n } else if (arguments.length > 2) {\n // Special case: callback arguments are provided.\n bind_args = Array.prototype.slice.call(arguments, 2); // [ arg1, arg2, ... ]\n bind_args.unshift(this); // [ global(this), arg1, arg2, ... ]\n cb_func = func.bind.apply(func, bind_args);\n } else {\n // Normal case: callback given as a function without arguments.\n cb_func = func;\n }\n\n timer_id = evloop.nextTimerId++;\n\n evloop.insertTimer({\n id: timer_id,\n oneshot: true,\n cb: cb_func,\n delay: delay,\n target: Date.now() + delay\n });\n\n return timer_id;\n}", "function startTimeout(fail) {\r\n\t\ttimeout = setTimeout(function () {\r\n\t\t\tfail();\r\n\t\t}, 5000);\r\n\t}", "delay(callback) {\n setTimeout(() => callback());\n }", "function setTimer(doneMessage, n) {\n console.log(doneMessage);\n setTimeout(function () {\n alert(doneMessage);\n }, n);\n doneMessage = \"OUCH\";\n}", "function delay(callback, ms) {\n var timer = 0;\n return function () {\n var context = this,\n args = arguments;\n clearTimeout(timer);\n timer = setTimeout(function () {\n callback.apply(context, args);\n }, ms || 0);\n };\n }", "function runAfter(ms, cb) {\n\tsetTimeout function() {\n\n\t}(2000);\n}", "function hello(txt, callback){\n setTimeout(()=>{\n callback(txt)\n }, 3000)\n}", "function delay(func, wait) {\n\treturn function()\n {\n setTimeout(func,wait);\n }\n}", "function setTimeOut (code, millisec, lang) {\n\tif (isNaN(millisec))\n\t\tmillisec = 0;\n//\ttimeout.last.end = new Date();\n//\tvar duration = timeout.last.end - timeout.last.start;\n//\ttimeout.last.start = new Date();\n//\tvar overhead = duration - timeout.last.duration;\n//\tvar compensated = (millisec > overhead)? millisec - overhead : 0;\n\tif (debugLevel2)\n\t\tconsole.debug(\n\t\t\t'duration =',duration,'\\t',\n\t\t\t'expected =',timeout.last.duration,'\\t',\n\t\t\t'overhead =',overhead,'\\n',\n\t\t\t'millisec =',millisec,'\\t',\n\t\t\t'compensated =',compensated,'\\t',\n\t\t\t'compensation =',timeout.compensation,'\\n',\n\t\t\t'code =',code\n\t\t\t);\n//\tif (timeout.compensation = true)\n//\t\tmillisec = compensated;\n\ttimeout.last.duration = millisec;\n\treturn timeout.last.handle = setTimeout(code, millisec, lang);\n\t}", "function makeDelay(ms) {\n var timer = 0;\n return function(callback){\n clearTimeout (timer);\n timer = setTimeout(callback, ms);\n };\n}", "timeout(name, fn, delay = 300) {\n if (this.timers[name]) {\n clearTimeout(this.timers[name]);\n this.timers[name] = null;\n }\n this.timers[name] = setTimeout(() => {\n if (fn instanceof Function) {\n fn();\n }\n this.timers[name] = null;\n }, delay);\n }", "function r(){var e=setTimeout.apply(void 0,arguments);return e.unref&&e.unref(),e}", "function delay(callback, ms) {\n var timer = 0;\n return function () {\n var context = this, args = arguments;\n clearTimeout(timer);\n timer = setTimeout(function () {\n callback.apply(context, args);\n }, ms || 0);\n };\n }", "function timeoutDefer(fn) {\r\n \tvar time = +new Date(),\r\n \t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n \tlastTime = time + timeToCall;\r\n \treturn window.setTimeout(fn, timeToCall);\r\n }", "function delayed() {\n // if we're executing at the end of the detection period\n if (!execAsap)\n func.apply(obj, args); // execute now\n // clear timeout handle\n timeout = null;\n }", "function I(){return a.setTimeout(function(){eb=void 0}),eb=fa.now()}", "function setTimer() {\n var myVar = setTimeout(clearNumVisibility, 5000);\n var myVar2 = setTimeout(makeVisible, 5000);\n}", "ontimeout() {}", "function timeoutDefer(fn) {\n \tvar time = +new Date(),\n \t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n \tlastTime = time + timeToCall;\n \treturn window.setTimeout(fn, timeToCall);\n }", "function timeoutDefer(fn) {\n \tvar time = +new Date(),\n \t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n \tlastTime = time + timeToCall;\n \treturn window.setTimeout(fn, timeToCall);\n }", "function runAfterDelay(delay, callback) {\n setTimeout(callback, delay);\n}", "function timeOutWrapper(cb) {\n setTimeout(cb, getRandom());\n}", "function delay(callback, ms) {\n\tvar timer = 0;\n\treturn function() {\n\t\tvar context = this,\n\t\t\targs = arguments;\n\t\tclearTimeout(timer);\n\t\ttimer = setTimeout(function() {\n\t\t\tcallback.apply(context, args);\n\t\t}, ms || 0);\n\t};\n}", "function defer(f, ms) {\n\n return function () {\n setTimeout(() => f.apply(this, arguments), ms);\n }\n}", "function updateTimeout() {\n\ttimeout /= 1.043;\n}", "function timeoutDefer(fn) {\r\n \tvar time = +new Date(),\r\n \t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n \tlastTime = time + timeToCall;\r\n \treturn window.setTimeout(fn, timeToCall);\r\n }", "function timeoutDefer(fn) {\r\n \tvar time = +new Date(),\r\n \t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n \tlastTime = time + timeToCall;\r\n \treturn window.setTimeout(fn, timeToCall);\r\n }", "function myAsyncFunc(callback, timeoutSeconds=1) {\n setTimeout(callback, timeoutSeconds * 1000);\n}", "function timeoutForMsgCustom(date,hour,screen,msg){\n i++;\n setTimeout(function(){\n showMsgCustom(date,hour,screen,messagesArray)\n\n },msg.time*1000)\n}", "function timeoutShim(callback) {\n window.setTimeout(callback, 1000/(storm.animationInterval || 20));\n }", "function timeoutDefer(fn) {\r\n\t \tvar time = +new Date(),\r\n\t \t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n\t \tlastTime = time + timeToCall;\r\n\t \treturn window.setTimeout(fn, timeToCall);\r\n\t }", "function sayHelloAfterXSeconds2(x) {\n timeout = setTimeout(function () {\n console.log(\"hello\");\n }, x * 1000);\n}", "function shortDelay(callback) {\n setTimeout(callback, 0.1);\n }", "function delay(delay , stringToLog){\n setTimeout(() => {console.log(stringToLog)}, delay); \n}", "function timeoutDefer(fn) {\n\t\t\tvar time = +new Date(),\n\t\t\t timeToCall = Math.max(0, 16 - (time - lastTime));\n\t\n\t\t\tlastTime = time + timeToCall;\n\t\t\treturn window.setTimeout(fn, timeToCall);\n\t\t}" ]
[ "0.7155535", "0.7126834", "0.7075202", "0.7008221", "0.6809834", "0.67862034", "0.67361796", "0.6720738", "0.66620857", "0.6627461", "0.6617602", "0.6614258", "0.65808624", "0.6563656", "0.6552372", "0.65374076", "0.6523482", "0.65081596", "0.65048295", "0.6497928", "0.64129937", "0.6358439", "0.6318919", "0.6318919", "0.6282925", "0.62810475", "0.62280375", "0.62225664", "0.6216977", "0.6209637", "0.61842644", "0.6176496", "0.6173636", "0.6166107", "0.6154196", "0.6137076", "0.61240643", "0.6123493", "0.6121724", "0.6113131", "0.6112742", "0.61104697", "0.61100245", "0.6100212", "0.609509", "0.60921204", "0.6067297", "0.60453326", "0.6039668", "0.60348016", "0.6026509", "0.60196185", "0.60196185", "0.6010095", "0.5980735", "0.5974147", "0.59699786", "0.59699786", "0.59699786", "0.59699786", "0.59699786", "0.5969444", "0.5965918", "0.59608865", "0.59553057", "0.59534854", "0.5947188", "0.59424174", "0.5928881", "0.59184974", "0.59127975", "0.5911917", "0.5893408", "0.58894044", "0.58813846", "0.5874622", "0.5864347", "0.586088", "0.58592856", "0.58469784", "0.58433336", "0.5839539", "0.5836122", "0.5833645", "0.5823869", "0.5823869", "0.5819945", "0.5811704", "0.5811615", "0.5804756", "0.57961136", "0.5794266", "0.5794266", "0.57919824", "0.5784849", "0.57829326", "0.5770789", "0.5770442", "0.5769935", "0.5767979", "0.57639766" ]
0.0
-1
Action d'ajouter la valeur au titre de jour
function calendrierAction(event) { /* Référence à l'écran, le jour, la phrase de défaut */ var txtJour = document.querySelector("#textJour"), el = event.target, phraseDefaut = "Day Selected : "; /* Si on ne aucun jour choisi dernièrement */ if(jourChoisi == null) { jourChoisi = new Array(); } /* Cherche notre jour dans le tableau, si rien est trouvé, on l'ajoute*/ if(jourChoisi.indexOf(el.getAttribute("data-jour")) == -1) { /* Ajout du jour dans notre tableau */ jourChoisi.push(el.getAttribute("data-jour")); } /* Si le jour est déjà dans le tableau */ else if(jourChoisi.indexOf(el.getAttribute("data-jour")) != -1){ var posJour = jourChoisi.indexOf(el.getAttribute("data-jour")); jourChoisi.splice(posJour,1); } /* Joue l'animation de fade-in/fade-out */ el.emit("playFade"); /* Enregistrement de la variable jourChoisi dans la sessionStorage */ sessionStorage.setItem("jourChoisi", JSON.stringify(jourChoisi)); txtJour.setAttribute("value", phraseDefaut + jourChoisi.toString()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setTitle() {\n let niveau = getUrlParameter('level');\n $('#title').text(\"Niveau \" + niveau);\n}", "function setCVCategoryVaardighedenTitle() {\n $('#title').html('Cattegorie instellingen voor Vaardigheden')\n $('#subtitle').html('Stel hier de Categorie voor de vaardigheden die u heeft')\n}", "function setTitle() {\n dt = formatDate(myDateFormat, appstate.date);\n dtextra = (appstate.date2 === null) ? '' : ' to ' + formatDate(myDateFormat, appstate.date2);\n $('#maptitle').html(\"Viewing \" + vartitle[appstate.ltype] +\n \" for \" + dt + \" \" + dtextra);\n $('#variable_desc').html(vardesc[appstate.ltype]);\n}", "function replace_titre_page() {\r\n\tadd_log(3,\"replace_titre_page() > Début.\");\r\n\tvar nouv_titre = \"[\" + document.title.split(\" \")[1].toUpperCase() + \"] \" + var_divers['village_actif_nom'] + \" (\" + var_divers['village_actif_pos'][0] + \"|\" + var_divers['village_actif_pos'][1] + \")\";\r\n\tdocument.title = nouv_titre;\r\n\tadd_log(1,\"replace_titre_page() > Nouveau titre : \" + nouv_titre);\r\n\tadd_log(3,\"replace_titre_page() > Fin.\");\r\n\t}", "function titlePage(){\n\t\t$('.title-page').html('<h2 class=\"text-center\">'+objet_concours[last_concours]+'</h2>');\n\t}", "function updateTitle(text) {\n $('title').html(\"Blacksmith - \" + text);\n}", "function changeTitle(genere) {\r\n var titolo = $(\".titolo h1\");\r\n return titolo.text(genere);\r\n}", "function handleChangeTitle(event) {\n setTitle(event.target.value);\n }", "function changeTitle(title) {\n document.getElementById (\"quest_title\").innerHTML = title;\n}", "function setMovieTitle(){\n\tvar title = $('#title').attr('value');\n\t$('#headerText').text('Watching: ' + title);\n}", "function titleChangeOne(){\n pTag.textContent = \"1\"\n}", "_updateTitlePanelTitle() {\n let current = this.currentWidget;\n const inputElement = this._titleHandler.inputElement;\n inputElement.value = current ? current.title.label : '';\n inputElement.title = current ? current.title.caption : '';\n }", "function updateTitle(currentChapter) {\n var title = 'Breaking faith';\n if (currentChapter == 0) {\n title = 'Breaking faith';\n } else {\n title = 'Chapter ' + currentChapter ;\n }\n $(\".title\").html(title);\n }", "function updateTitle(newTitle) {\r\n $(\"#foodTitle\").text(newTitle.name);\r\n}", "function updateTitle() {\n if ($('#expr').val()) {\n document.title = \"xen-calc: \" + $('#expr').val();\n }\n else {\n document.title = \"xen-calc\";\n }\n}", "function setTitle() {\n var title = $('h1#nyroModalTitle', modal.contentWrapper);\n if (title.length)\n title.text(currentSettings.title);\n else\n modal.contentWrapper.prepend('<h1 id=\"nyroModalTitle\">'+currentSettings.title+'</h1>');\n }", "function title_view(title) {\n var titleInput = gId(\"title\");\n gId('story_title').innerHTML = title;\n gId('story_title').style.display = \"block\";\n titleInput.style.display = \"none\";\n gId('add_title').style.display = \"none\";\n}", "function changeTaxCollapsibleTitle($controlHolder, value){\n var dinamicID = $controlHolder.attr('rb-data-dinamic-title');\n var $title = $controlHolder.children('.rb-collapsible-title').find('.rb-title').first();\n if($title.length){\n if( value != '' )\n $title.text(value);\n else\n $title.text($controlHolder.attr('rb-data-base-title'));\n }\n }", "updateTitle() {\n let numReports = this.reports.length\n if(numReports >= 101) {\n this.title = 'Bestest Manager'\n } else if(numReports >= 51) {\n this.title = 'Manager Plus'\n } else if(numReports >= 11) {\n this.title = 'Manager'\n } else if(numReports >= 4) {\n this.title = 'Mostly Manager'\n } else if(numReports >= 1) {\n this.title = 'Barely Manager'\n } else {\n this.title = 'Not a Manager'\n }\n }", "function set_title(title){\n\t\t\tdocument.querySelector(\"#footertitle span\").innerText = title;\n\t\t}", "function HeadingChange(){\n cl(document.title = \"This is new title\")\n}", "function zmienAtrybut()\n{\n var tytul = document.getElementById(\"tytul\");\n tytul.setAttribute(\"title\", \"Kurs PHP akuku\"); // w nawiasie nazwa atrybutu i jego wartosc\n}", "function titleChanged(e) {\n var id = e.target.id;\n var val = e.target.value;\n var def;\n\n if (id === 'mainInput') {\n def = settings.main.title;\n } else {\n def = settings.other.title;\n }\n\n if (val === '') return e.target.value = def;\n\n if (val !== def) {\n if (id === 'mainInput') {\n settings.main.title = val\n setupTitles('main', val);\n } else {\n settings.other.title = val;\n setupTitles('other', val);\n }\n\n saveSettings();\n }\n }", "function setTitle() {\r\n\t\tvar title = $('h1#nyroModalTitle', modal.contentWrapper);\r\n\t\tif (title.length)\r\n\t\t\ttitle.text(currentSettings.title);\r\n\t\telse\r\n\t\t\tmodal.contentWrapper.prepend('<h1 id=\"nyroModalTitle\">'+currentSettings.title+'</h1>');\r\n\t}", "UpdateTitle() {\n var Key = this.TitleKey || this.Name;\n\n var self = this;\n tp.Res.GS(Key, function (Value, UserTag) {\n self.Title = Value;\n }, null, Key, this);\n\n }", "function changeTrainerTitle(message) {\r\n //document.getElementById(\"trainerTitle\").innerHTML = \"Ear Trainer - \" + message;\r\n}", "function addTitle(e) {\n var titleInput = gId(\"title\");\n gId('story_title').innerHTML = titleInput.value\n gId('story_title').style.display = \"block\"\n titleInput.style.display = \"none\"\n gId('add_title').style.display = \"none\"\n e.stopPropagation()\n savePage();\n}", "function upDateTexteGauche(){\n\t$(\"#descriptionGauche\").text($(\"#\"+dep1+\" .\"+annee).text());\n}", "function changeTitle() {\n let inputSelector = document.querySelector(\".inputSelector\");\n document.addEventListener(\"submit\", e => {\n e.preventDefault();\n document.title = inputSelector.value;\n document.querySelector(\".pageTitle\").innerHTML =\n \"Current page title is: \" +\n \"'\" +\n document.title +\n \"'\" +\n \" ,would you like to customize it?\";\n });\n}", "getTitle() {}", "function setTitle (g, d) {\n g.text(d.nom)\n}", "_updateTitle() {\n if (this._changeGuard || !this.content) {\n return;\n }\n this._changeGuard = true;\n const content = this.content;\n this.title.label = content.title.label;\n this.title.mnemonic = content.title.mnemonic;\n this.title.icon = content.title.icon;\n this.title.iconClass = content.title.iconClass;\n this.title.iconLabel = content.title.iconLabel;\n this.title.caption = content.title.caption;\n this.title.className = content.title.className;\n this.title.dataset = content.title.dataset;\n this._changeGuard = false;\n }", "function update_slider_title(e) {\n\t\tvar element = e;\n\t\tif ( this.timer ) {\n\t\t\tclearTimeout( element.timer );\n\t\t}\n\t\tthis.timer = setTimeout( function() {\n\t\t\t$(element).parent().prev().find('strong').text( element.value );\n\t\t}, 100);\n\t\treturn true;\n\t}", "setResultsTitile()\n {\n \t\n \t\tif(this.state.resultsTitle == \"home\")\n \t\t{\n \t\t\treturn (\n \t\t\t<div>\n \t\t\t\t\twhat's new\n \t\t\t </div>\n \t\t\t )\n \t\t}\n\t\t\telse if(this.state.resultsTitle == \"resultsSet\")\n\t\t\t{\n\t\t\t\treturn (\n \t\t\t<div>\n \t\t\t\t\tResults\n \t\t\t </div>\n \t\t\t )\n\t\t\t} \t\n }", "set title( val ) {\n this.title_bar_text.innerText = val;\n }", "function setTitle(){\n\tvar title = getMessage('title_abEditAction_list');\n\tView.panels.get('abEditAction_list').setTitle(title);\n}", "function setPageTitle() {\n\n let h1 = document.getElementById('title');\n h1.innerText = pageTitle;\n}", "function setInputTitle(text) {\n document.querySelector('input[name=\"title\"]').value = text;\n}", "function setupTitles(type, value) {\n if (type === 'main') {\n // Setup main schedule titles\n document.getElementById('mainTitle').innerHTML = value;\n document.getElementById('mainInput').value = value;\n } else {\n // Setup other schedule titles\n document.getElementById('otherTitle').innerHTML = value;\n document.getElementById('otherInput').value = value;\n }\n }", "function titleChangeTwo(){\n pTag.textContent = \"2\"\n}", "function oiPesquisa()\n{\n\t$('#nomeDrPesquisa').html('Prezado (a) <strong>Dr(a). '+nomeUser+'</strong>,');\n\t// '+nomeUser+'\n}", "function titleText(title) {\n pageTitle.textContent = title;\n}", "atualizaNome() //controler\r\n {\r\n this._elemento.textContent = `[${this._idade}] ${this._nome}`;\r\n }", "_updateContentTitle() {\n if (this._changeGuard || !this.content) {\n return;\n }\n this._changeGuard = true;\n const content = this.content;\n content.title.label = this.title.label;\n content.title.mnemonic = this.title.mnemonic;\n content.title.icon = this.title.icon;\n content.title.iconClass = this.title.iconClass;\n content.title.iconLabel = this.title.iconLabel;\n content.title.caption = this.title.caption;\n content.title.className = this.title.className;\n content.title.dataset = this.title.dataset;\n this._changeGuard = false;\n }", "function titulo() {\n var valor = $(\"#titulo\").val();\n $(\"#empresa\").text(valor);\n $(\"#t1\").text(valor);\n}", "function setTitle(title) {\n\t$( \"title\" ).html( title )\n}", "function getTitle() {\n const title = document.querySelector('#title');\n title.addEventListener('change', (e) => {\n if (title.value !== '') {\n searchBooksObj.partialTitle = e.target.value;\n }\n });\n}", "changeTitle( layout, newTitle ){\n\t\tif( layout.title.text ){\n\t\t\tlayout.title.text = newTitle;\n\t\t}\t\n\t}", "function headerTitleChange() {\n headerText.innerHTML = \"E-Notes - \" + notesTitle.value;\n pageTitle.innerHTML = \"E-NOTES - \" + notesTitle.value.toUpperCase();\n if (notesTitle.value == \"\") {\n headerText.innerHTML = \"E-Notes\";\n pageTitle.innerHTML = \"E-NOTES\";\n }\n}", "mostrar() {\n return `${this.nombre} tiene una urgencia de ${this.prioridad}`;\n }", "function setTitleValue(formName, inputName, val)\n{\n dml = document.forms[formName];\n len = dml.elements.length;\n var i = 0;\n for (i = 0; i < len; i++)\n {\n if (dml.elements[i].name == inputName)\n {\n dml.elements[i].title = val;\n }\n }\n}", "setTitle(newTitle) {\n this._doc.title = newTitle || '';\n }", "setTitle(newTitle) {\n this._doc.title = newTitle || '';\n }", "setTitle(newTitle) {\n this._doc.title = newTitle || '';\n }", "setTitle(newTitle) {\n this._doc.title = newTitle || '';\n }", "setTitle(newTitle) {\n this._doc.title = newTitle || '';\n }", "setTitle(newTitle) {\n this._doc.title = newTitle || '';\n }", "function setPageTitle() {\nconst title = document.querySelector('#title');\n\ntitle.innerText = pageTitle;\n\n}", "function changePlaceholder()\n {\n $('#chosenEdStatistic').val(labelContent);\n }", "setTitle(title) {\n this.get('headData').set('title', title);\n }", "function affiche(){\n let prenom=document.getElementById(\"nom\").value;\n document.getElementById(\"AfficherMessage\").innerHTML='Bonjour '+prenom + ' comment allez-vous aujourd\\'hui?';\n}", "function tampilkan() {\n document.getElementById(\"contohJawaban\").innerHTML = \"Aku Tampil\"\n }", "function setPageTitle() {\n const title = document.getElementById('title');\n title.innerText = pageTitle;\n}", "function setPageTitle() {\n const title = document.getElementById('title');\n title.innerText = pageTitle;\n}", "function title(writer, value) {\n return stringify(value).replace(/\\w\\S*/g, function (word) {\n return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase();\n });\n}", "updateTitle(){ \n let title = '';\n const { head, instance } = this.entry;\n\n if (head.hasOwnProperty('title')){\n let prop = head.title;\n\n title = head.title\n if (typeof prop === 'function'){\n title = head.title.apply(instance);\n }\n }\n\n if (title && title.length > 0){\n document.title = title;\n }\n }", "function set_title_count( title_count ){\n $(\"#pbheader_title_count\").text( title_count );\n $(\"#pbheader_title_count\").addClass('pb_report_header_result');\n}", "function job(){\n\tvar title= document.getElementById(\"jobTitle\").value;\n\n\tif(title.length>1)\n\t\tdocument.getElementById(\"jobTitleInsert\").innerHTML = title;\n\telse\n\t\tdocument.getElementById(\"jobTitleInsert\").innerHTML= \"ERROR: NO JOB TITLE!!\";\n}", "function getTitle() {\n t = document.getElementById('edtTitle');\n if(EDIT.title != t.innerHTML){\n EDIT.title = t.innerHTML;\n checklink(t.innerHTML);\n } \n}", "function updateTitle(chartText) {\n $('#default-chart-map-variable').html(chartText);\n }", "bindTitle(fieldnode) {\n fieldnode.addEventListener('field-value-changed', () => {\n this.title = fieldnode._value;\n this._setDocumentTitle();\n });\n }", "function changeHeadline ( title ) {\r\n __TITLE = title;\r\n document.getElementsByClassName('stroka')[0].innerHTML = '<div id=\"langv\"> <a href=\"http://reallifecam.com/\" title=\"English\"><img src=\"http://reallifecam.com/design/flag_eng.gif\" alt=\"English\" width=\"18\" height=\"12\" border=\"0\"></a> <a href=\"http://de.reallifecam.com/\" title=\"Deutsch\"><img src=\"http://reallifecam.com/design/flag_germ.gif\" alt=\"Deutsch\" width=\"18\" height=\"12\" border=\"0\"></a> <a href=\"http://it.reallifecam.com/\" title=\"Italiano\"><img src=\"http://reallifecam.com/design/flag_italy.gif\" alt=\"Italiano\" width=\"18\" height=\"12\" border=\"0\"></a> </div>' + __TITLE;\r\n}", "function empty_title() {\n $('#post_error').text(\"Musíte zadat titul!\");\n}", "function title(newtitle){\n\tdpost(\"set new title \" + newtitle + \" -> nodeid = \" + myNodeID + \"\\n\");\n\tmyExpandedMode = 0;\n\texpand();\n\tmyNodeTitle = newtitle;\n\tmyNodeOssiaModel = \"node/\" + newtitle;\n myNodeAddress = \"sparck:/\" + myNodeOssiaModel;\n\tstoreKeyValueInDB(myNodeName, \"_title\", newtitle);\n\tmyNodeVarName = newtitle;\n // the sequence of the following messages matter:\n // we first need to set the title\n // used by: vpl.node.property.logic\n messnamed(myNodeID + \"::props\", \"title\", myNodeTitle);\n messnamed(myNodeID + \"::props\", \"address\", myNodeAddress);\n messnamed(myNodeID + \"::pbody\", \"address\", myNodeTitle, myNodeAddress);\n\toutlet(OUTLET_DUMP, \"setmsgtitle\", newtitle);\n\toutlet(OUTLET_DUMP, \"title\", newtitle);\n\toutlet(OUTLET_DUMP, \"address\", myNodeAddress);\n}", "ngOnInit() {\n this.title = 'Ingresar la lectura del Medidor';\n }", "function changeSettingsTitle() {\n let t = $(\"title\").html()\n $(\"title\").html(`${t.startsWith(\"(\") ? `${t.split(\" \")[0]} ` : \"\"}${SCRIPT_NAME} / Twitter`)\n }", "function set_content_header_caption(value)\n{\n \n \n \n content_header_caption = value;\n \n \n \n \n \n}", "function fillTitle() {\n //document.all.title.value = document.all.name.value;\n get_Object(\"title\").value = get_Object(\"name\").value;\n}", "function update_title() {\n chrome.storage.sync.get(\"api_key\", function(data){\n var name = chrome.i18n.getMessage(\"wanikaninotify_name\");\n if (data.api_key) {\n chrome.storage.local.get(\"next_review\", function(data) {\n if (data.next_review > Date.now()) {\n var d = new Date(data.next_review);\n var new_title = name + \" - Next Review: \" + d.toString();\n chrome.browserAction.setTitle({\"title\": new_title});\n } else {\n chrome.browserAction.setTitle({\"title\": name + \" - Next Review: Now!\"});\n }\n });\n } else {\n chrome.browserAction.setTitle({\"title\": name + \" - Click to add your API key!\"});\n }\n });\n}", "function changeTitle(){\r\n\ta.textContent = 'Order North Georgia Coffee';//\truns the method \"textContent\" on variable a, setting the header to \"Order North Georgia Coffee\" \r\n\r\n}", "function updateTitle(page) {\n $('#page-title').html(titles[page]);\n}", "async cphTitleBuild()\n {\n //Logic.\n //----------------------\n try\n {\n this.cphTitle = SyncSystemNS.FunctionsGeneric.contentMaskRead(gSystemConfig.configSystemClientName, \"config-application\") + \n \" - \" + \n SyncSystemNS.FunctionsGeneric.appLabelsGet(gSystemConfig.configLanguageBackend.appLabels, \"backendFormsFieldsOptionsTitleEdit\");\n\n /*\n if(this.titleCurrent)\n {\n this.cphTitle += \" - \" + this.titleCurrent;\n }\n */\n }catch(asyncError){\n if(gSystemConfig.configDebug === true)\n {\n console.error(asyncError);\n } \n }finally{\n\n }\n //----------------------\n }", "function switchtext(){\n\t\t$(\"h2\").html(\"Christina\");\n\t}", "function updateHeading() {\n var mnTheme = $('input[field=\"theme\"]').val();\n $('h1#lmnopHeading').text('New ' + mnTheme);\n}", "function setPageTitle() {\n const titleElement = document.getElementById('title');\n titleElement.innerText = pageTitle;\n}", "function Move_value_to_modal(){\n $(\"#Titre_Tach\").val($(\"#Titre-de-la-tache\").val());\n $('#Ajout_tache').attr(\"onclick\",\"Form_elements()\");\n }", "function definirNomeJogador(nome) {\n document.getElementById('jogador-nome').innerHTML = nome;\n}", "function changeDescription(value){\n setDescription(value)\n }", "function giveTitle(name) {\n document.getElementsByTagName(\"title\")[0].innerHTML = name;\n}", "function setPageTitle() {\n document.getElementById('page-title').innerText = parameterUsername;\n document.title = parameterUsername + ' - User Page';\n}", "function editTitle() {\n\tvar article = $(this).closest('article');\n\t$('h2', article).replaceWith(`<textarea class=\"idea-title edit-title\">${$(this).text()}</textarea>`);\n\t$('.edit-title').focus();\n}", "function addTitles() {\n for (var t in titles) {\n var e = document.getElementById(t);\n e.setAttribute('title', titles[t]);\n }\n}", "function setPageTitle() {\n document.getElementById('page-title').innerText = parameterUsername;\n document.title = parameterUsername + ' - User Page';\n}", "function setPageTitle() {\n const page = document.getElementById('title');\n page.innerHTML = pageTitle;\n}", "getTitle() {\n return `Title is: ${this.title}`;\n }", "clearTitle() {\n this.inputValue = \"\";\n this.not_found = false;\n }", "function displayTitle (event) {\n $display.textContent = listoftitles[event.target.getAttribute('id')-1]\n }", "function set_current_header_label(label, title){\n\tjQuery('#hero_header_label').html(label.toUpperCase());\n\tjQuery('#hero_header_title').html(title.toUpperCase());\n}", "async cphTitleCurrentBuild()\n {\n //Logic.\n //----------------------\n try\n {\n this.cphTitleCurrent += SyncSystemNS.FunctionsGeneric.appLabelsGet(gSystemConfig.configLanguageBackend.appLabels, \"backendFormsFieldsOptionsTitleEdit\");\n //this.cphTitleCurrent += \" - \";\n /*\n if(this.titleCurrent)\n {\n this.cphTitleCurrent += \" - \" + this.titleCurrent;\n }\n */\n\n\n //Debug.\n //console.log(\"cphTitleCurrent=\", this.cphTitleCurrent);\n }catch(asyncError){\n if(gSystemConfig.configDebug === true)\n {\n console.error(asyncError);\n } \n }finally{\n\n }\n //----------------------\n }", "function changeHeaderTitle(newTitle){\n headerTitleDiv.innerHTML = newTitle;\n }", "function setTitle() {\n\t\ttitle.selectAll(\"*\").remove();\n\n\t\t// All the hustle for enabling italics ^^\n\t\tvar tmp = document.createElement(\"text\");\n\t\ttmp.innerHTML = \"Terrorist Attacks Divided into <tspan style='font-style: italic;'>K=\" + focusK + \"</tspan> Partitions\";\n\t\tvar nodes = Array.prototype.slice.call(tmp.childNodes);\n\t\tnodes.forEach(function(node) {\n\t\t\ttitle.append(\"tspan\")\n\t\t\t\t.attr(\"style\", node.getAttribute && node.getAttribute(\"style\"))\n\t\t\t\t.text(node.textContent);\n\t\t});\n\t}" ]
[ "0.7180184", "0.67406917", "0.67269534", "0.6580838", "0.6499202", "0.6490812", "0.64771056", "0.6417916", "0.6402747", "0.6374774", "0.6351741", "0.63261265", "0.6310749", "0.6280746", "0.62772447", "0.6276305", "0.62675136", "0.62562174", "0.6252349", "0.62413377", "0.6216155", "0.6188964", "0.61872596", "0.6176293", "0.61644924", "0.6141547", "0.6127883", "0.61159176", "0.6099838", "0.6081274", "0.60744214", "0.6074287", "0.60643494", "0.6064181", "0.60611767", "0.6056073", "0.60463923", "0.6033284", "0.6030102", "0.6012067", "0.59828246", "0.59820133", "0.59632456", "0.5962359", "0.59586567", "0.59550536", "0.5952196", "0.59478027", "0.5946834", "0.5932953", "0.5928346", "0.59247035", "0.59247035", "0.59247035", "0.59247035", "0.59247035", "0.59177023", "0.589867", "0.58678657", "0.58675754", "0.5855611", "0.5829069", "0.58235025", "0.58235025", "0.5816122", "0.58086544", "0.5802879", "0.58006084", "0.5799296", "0.57982373", "0.5798219", "0.57978857", "0.57976055", "0.5797223", "0.57967573", "0.57841414", "0.5783593", "0.5781769", "0.5781766", "0.5778935", "0.5776959", "0.57752603", "0.57725614", "0.5769929", "0.57688534", "0.5759253", "0.57569975", "0.5752758", "0.57525367", "0.5751454", "0.57498294", "0.5747369", "0.5746801", "0.5741129", "0.57401407", "0.5738524", "0.5731858", "0.57305807", "0.57279474", "0.5723365", "0.5722004" ]
0.0
-1
Create new Announcement button
function AddNewA(){ document.getElementById('newABlock').style.display ='block'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createButton(buttonName) {\n\n\t// button details\n\tvar newButton = $(\"<button>\");\n\t\tnewButton.addClass(\"subjectButton btn btn-primary\");\n\t\tnewButton.attr(\"data-subject\", buttonName);\n\t\tnewButton.text(buttonName);\n\n\t// add button to display\n\t$(\"#buttons\").append(newButton);\n\n}", "function createButton() {\n const parent = $('#my_indv_tab')\n\n const button = $('<div>').attr({\n id: 'get_cal',\n type: 'button',\n name: 'Download',\n style: 'padding:5px; margin:0px 10px 10px 0px; font-weight:600; font-size:115%; background-color:#F26A38; color:white; float:left; cursor:pointer;'\n })\n\n parent.prepend(button)\n\n $('#get_cal').html('Download Calendar')\n $('#get_cal').on('click', main)\n\n checkPeriod()\n}", "function addannouncement() {\n\n}", "static createButton(){\n let button = document.createElement('button');\n button.className = \"btn btn-warning viewBtn\";\n button.innerText = \"More Details\";\n return button;\n }", "function makeAddToCalendarButton() {\n // Make the button\n const addToCalendarButton = document.createElement(\"button\");\n addToCalendarButton.setAttribute(\"id\", \"submit-classes-button\");\n addToCalendarButton.innerHTML = `<i class=\"fa fa-external-link\" aria-hidden=\"true\"></i>Add to Google Calendar`;\n addToCalendarButton.classList.add(\"btn\", \"btn-default\", \"myu_fx-150ms\");\n addToCalendarButton.style.cssText = \"color: #fff; background-color: rgba(122,0,25,0.75);\";\n addToCalendarButton.onclick = onAddToCalendarButtonClick;\n // Add it to the page\n const buttonContainer = document.querySelector(\".myu_btn-group\");\n buttonContainer.append(addToCalendarButton);\n}", "function createButton() {\n\t\tvar termLink = document.getElementById(\"DERIVED_SSS_SCT_SSS_TERM_LINK\");\n\t\tif (!termLink)\n\t\t\treturn null;\n\n\t\tvar buttonSpan = document.createElement(\"span\");\n\t\tbuttonSpan.className = \"SSSBUTTON_ACTIONLINK\";\n\t\tbuttonSpan.setAttribute(\"title\", \"Download timetable in iCalendar format\");\n\n\t\tvar buttonLink = document.createElement(\"a\");\n\t\tbuttonLink.className = \"SSSBUTTON_ACTIONLINK\";\n\t\tbuttonLink.setAttribute(\"id\", \"--nucalendar-download-button\");\n\t\tbuttonLink.setAttribute(\"tabindex\", +(termLink.getAttribute(\"tabindex\") || 0) + 1);\n\t\tbuttonLink.textContent = \"download\";\n\n\t\tbuttonSpan.appendChild(buttonLink);\n\n\t\ttermLink.parentElement.parentElement.parentElement.appendChild(buttonSpan);\n\n\t\treturn buttonLink;\n\t}", "function addCannedResponseButton() {\n var spacer = document.createElement('div'),\n button = document.createElement('button'),\n i = document.createElement('i');\n\n spacer.classList.add(\"d-editor-spacer\");\n button.classList.add(\"ember-view\", \"btn\", \"no-text\", \"canned-response\");\n button.setAttribute(\"id\", \"canned-response-button\");\n button.setAttribute(\"title\", \"Canned responses\");\n button.setAttribute(\"aria-label\", \"Canned responses\");\n i.classList.add(\"fa\", \"fa-pencil-square-o\");\n\n ebb.appendChild(spacer);\n button.appendChild(i);\n ebb.appendChild(button);\n }", "function addAddEventButton() {\n\t$('#add_event_span').html('' + '<button ' +\n\t\t'id=\"add_event_button\" ' +\n\t\t'class=\"btn btn-large btn-block btn-primary\"' +\n\t\t' type=\"button\">Add event</button><br/>');\n}", "function generate_button(href, type, text) {\n var button = '<a class=\"btn btn-' + type + '\" ';\n button += 'href=\"' + href + '\" ';\n button += 'data-remote=\"true\" data-method=\"patch\">';\n button += text + '</a>';\n return button;\n }", "createAddButton() {\n let addSourceButton = document.createElement('button')\n addSourceButton.innerText = 'Add ' + this.capitalize(this.type)\n addSourceButton.addEventListener('click', () => this.toggleFormVisibility())\n this.div.appendChild(addSourceButton)\n }", "function addNewIssueButton() {\n var newIssueUrl = 'https://github.com/' + ownerName + '/' + repositoryName + '/issues/new';\n $('.heading-column:last-child').append(\n '<a class=\"add-issue-button pull-right\" target=\"_blank\" href=\"'+ newIssueUrl +'\">' +\n '<i class=\"fa fa-plus fa-sm\"></i>' +\n '</a>'\n );\n}", "function addNewButton(formElement) {\n formElement.append('<button type=\"submit\" id=\"new-contact-button\"> Create New Contact </button>');\n $('#new-contact-button').click(function (e) {\n e.preventDefault(); // Prevent querystring from showing up in address bar\n createContact();\n });\n }", "function createButton (action, name) {\n var button = document.createElement('button');\n button.innerHTML = name;\n button.setAttribute('id', action);\n document.getElementById('visualizer').appendChild(button);\n}", "function createButton(linktext, attachE, actionFunc, classN){\n\tvar currentView = document.getElementById('frontend_view_selector').className;\n\tvar hreflink;\t\n\tvar morelink = document.createElement(\"a\");\n\tmorelink.style.display = 'inline';\n\tvar text = document.createTextNode(linktext);\n\tmorelink.className=classN;\t\n\tif(currentView == 'upcoming'){\n\t\threflink = \tdocument.getElementById('todayview').childNodes[0].href;\n\t} else {\n\t\threflink = '#';\t\n\t\tmorelink.onclick = actionFunc;\n\t}\t\n\tmorelink.href = hreflink;\n\tmorelink.appendChild(text);\n\tattachE.appendChild(morelink);\n}", "function postButton() {\n const post = document.createElement('button');\n post.id = 'post-button';\n post.className = 'button button-secondary';\n post.innerText = 'Post';\n return post;\n}", "function buttonCreate() {\n // Delete previous buttons to avoid duplicates\n $(\"#buttons-view\").empty();\n $(\"#game-input\").val(\"\");\n\n // Looping through the array of games\n for (var i = 0; i < topics.length; i++) {\n\n // Create a button for each item in the array\n var a = $(\"<button>\");\n // Adding the class 'game' to the button\n a.addClass(\"game\");\n // Adding a data-attribute (this is how the data is passed from the button to the queryURL)\n a.attr(\"data-name\", topics[i]);\n // Providing the button text\n a.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n\n }\n }", "function addButton(input) {\n var newButton = $(\"<input>\")\n .attr(\"type\",\"button\")\n .attr(\"value\", input)\n .attr(\"class\", \"topic-button\")\n .text(input);\n $(\"#topics-view\").append(newButton);\n}", "function createButton () {\n animal = animal.toUpperCase ();\n $(\"#animalButtons\").append(\"<button type='button' class='btn btn-primary starterGif' id='\" + animal.toLowerCase() +\"'>\" + \"See \" + animal + \" gifs</button>\");\n animals.push(animal);\n }", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('<a id=\"status-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Status</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = 'aktiv';\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Status der Geschichte angeben; Möglichkeiten:\\naktiv, inaktiv, abgeschlossen, pause, neu\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function createBtns() {\n for (var i = 0; i < topics.length; i++) {\n var btn = $(\"<button>\");\n btn.addClass(\"btn btn-outline-light\")\n btn.attr(\"value\", topics[i]);\n btn.text(topics[i]);\n $(\"#gif-btns\").append(btn);\n }\n }", "function addButtonClick(){\n\t\tvar note = Note();\n\t\tstorage.push(note);\n\t\tdisplayNotes();\n\n\t}", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"descr-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Beschreibung</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"Hier die Beschreibung\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Beschreibung angeben\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function createButton() {\n var newButton = new HmiObject();\n newButton.uid = Date.now();\n newButton.typeId = 'button';\n newButton.type = 'button';\n return newButton;\n }", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"tw-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">TW</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"http://twitter.com/MeerUndMehrWiki\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Twitter-Link angeben\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "fCreateBtn( className, idName, counter, appendedTo, label ) {\n\t\t\t\tlet divName = document.createElement( \"BUTTON\" );\n\t\t\t\tdivName.id = idName + \"Id_\" + counter; //set id\n\t\t\t\tdivName.className = className; //title + \"Class\";\n\t\t\t\t//divName.href = \"#modalCarousel\";\n\t\t\t\t//let divNameId = $ (\"#\" + title + \"Id_\" + counter); //get id\n\t\t\t\t$( divName ).appendTo( appendedTo );\n\t\t\t\tlet buttonLabel = document.createTextNode( label );\n\t\t\t\t$( buttonLabel ).appendTo( divName );\n\t\t\t}", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"autor1-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Autor1</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"FSK\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Ersten Autor der Geschichte angeben\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "createOpenDialogBtn(text, appendTo)\n {\n let btn = $('<button class=\"element_toggler btn btn-primary\" style=\"float: left; margin-right: 5px;\" aria-controls=\"'+this.id+'\" aria-label=\"Toggle '+this.id+' modal\">' + text + '</button>');\n btn.appendTo(appendTo);\n }", "function insertButton() {\n\t\tconst button = paymentsClient.createButton({\n\t\t\tbuttonColor: window.gpay_button_color,\n\t\t\tbuttonSizeMode: 'fill',\n\t\t\tonClick: handleClick\n\t\t});\n\t\tbutton.id = 'checkoutcom-google-pay';\n\n\t\tif($selectedPaymentMethodId === $ckoPaymentMethodId) {\n\t\t\t$buttonArea.append(button);\n\t\t} else {\n\t\t\t$buttonArea.remove(button);\n\t\t}\n\t}", "function ApplicantPublications_GenerateButton(){\n\tvar clickEvent = function (e) {\n\t\tApplicantPublications_FillForm();\n\t}\n\n\tvar inputBootstrap = createBootstrapButtonElement('GM Fill Form', 'NEWPortal_ApplicantExperience_FillButton');\n\tinputBootstrap.onclick = clickEvent;\n\n\tinsertAfter(document.getElementById('save'), inputBootstrap);\n}", "function addButton(data){\n\t\tif (data.length>0){\n\t\t\t\tnewbutton=\"<button class='stream' id=\"+data[0]+\">\"+data[0]+\" \"+data[1]+\"</button>\";\n\t\t\t\t$(newbutton).insertBefore($(\"#NEW\")).click(function(){actionButton(this);});\n\t\t\t};\n\t}", "function createTaskButton (text, dataAction) {\n const $taskButton = document.createElement('button');\n $taskButton.className = 'button task_button';\n $taskButton.setAttribute('data-action', dataAction);\n $taskButton.textContent = text;\n\n return $taskButton;\n}", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"thema-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Thema</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"One Piece\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Thema der Geschichte angeben\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function buttonCreation (){\n $('#buttonDiv').empty();\n for(var i=0; i<topics.length; i++){\n var gifButton = $('<button>');\n gifButton.attr('class', 'btn btn-light gifButton');\n gifButton.attr(\"data-name\", topics[i]);\n gifButton.text(topics[i]);\n $('#buttonDiv').append(gifButton).append(' ');\n }\n}", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"fsk-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Autor3</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"FSK\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Dritten Autor der Geschichte angeben\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function topicBtn() {\n\n //Deleate activites prior to adding new activities\n $(\"#buttonBox\").empty();\n\n //loop through the array of activities\n for (var i = 0; i < topics.length; i++){\n\n var btn = $(\"<button class='btn btn-primary'>\");\n btn.addClass(\"activity-btn\");\n btn.attr(\"activity-name\", topics[i]);\n btn.text(topics[i]);\n $(\"#buttonBox\").append(btn);\n }\n}", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"fsk-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Autor2</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"FSK\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Zweiten Autor der Geschichte angeben\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function CreateButton(id, text){\n this.button = document.createElement('button');\n this.button.id = id;\n this.button.innerHTML = text;\n document.getElementById('buttons').appendChild(this.button);\n}", "function postButton() {\n // Created a button that is disabled\n let $postButton = $(\"#postButton\");\n $postButton.button();\n $postButton.button('disable');\n // Publish the caption when clicked\n $postButton.on(\"click\", publishCaption);\n}", "function createButton(container,type, classHere,idHere,onclick, textContent){ // Form maker\n try {\n const button = document.createElement('button');\n button.type = type;\n button.classList = classHere;\n button.id = idHere;\n button.onclick = onclick;\n button.textContent = textContent;\n container.appendChild(button);\n return button;\n } catch (e) {\n return \"createButton didnt work\";\n }\n}", "function appendNewButtons(newTopic) {\n var topicButton = createButtonHTML(newTopic);\n $(\"#btn-container\").prepend(topicButton);\n}", "function makeBtn() {\n // Deleting the gifs prior to adding new gifs\n // (this is necessary otherwise we will have repeat buttons)\n $(\"#btnDump\").empty();\n // Looping through the array of movies\n for (var i = 0; i < topics.length; i++) {\n var b = $(\"<button>\");\n b.addClass(\"gifButton\");\n // Adding a data-attribute\n b.attr(\"data-subject\", topics[i]);\n // Providing the initial button text\n b.text(topics[i]);\n // Adding the button to the HTML\n $(\"#btnDump\").append(b);\n }\n }", "function createButtons () {\n // first we need to empty the current giphs if any...\n $(\"#button-view\").empty();\n\n // now loop through 'topics' array and make a button for each\n for (i =0; i < topics.length; i++) {\n //now create a new button element, assign it a css class, and label it with the array value\n var newButton = $(\"<button>\");\n newButton = newButton.addClass(\"get-superhero btn btn-danger\").text(topics[i]);\n $(\"#button-view\").append(newButton);\n }\n }", "function btnCreate() {\n\n // number counter, used to give each topic a unique identifier\n num++;\n\n // creation of the dynamic buttons\n userBtn = $(\"<button>\")\n userBtn\n .addClass(\"btn search-term-btn dynamicElement\")\n .appendTo($(\".btn-holder\"))\n .text(topics)\n .attr(\"data-name\", topics);\n\n // pushes the topic out of the array, into a new \"used\" array, this is used as a flag.\n usedTopics.push(topics + num);\n topics = [];\n console.log(num);\n\n\n // create space between buttons ___ Ying\n space = $(\"<span>\")\n\n space\n .text(\"\\xa0\\xa0\")\n .appendTo($(\".btn-holder\"));\n\n\n }", "function createButton (text) {\n //console.log(\"Creating a button\");\n var element = document.createElement(\"BUTTON\");\n var textNode = document.createTextNode(text);\n element.appendChild(textNode);\n return element;\n }", "function CreateLink(editor) {\r\n\tthis.editor = editor;\r\n\tvar cfg = editor.config;\r\n\tvar self = this;\r\n\r\n editor.config.btnList.createlink[3] = function() { self.show(self._getSelectedAnchor()); }\r\n}", "function createButtons()\r\n{\r\n if (!button)\r\n {\r\n button = document.createElement(\"div\");\r\n button.innerHTML = \"<center><div id='remove_activity_buttons'> \\\r\n\t\t<span id=\\\"expand_all_older_posts_button\\\" style='margin-bottom: 10px; margin-left:10px; padding:3px 8px' class='uiButton uiButtonDefault uiButtonMedium'>Wall Auto Expander</span>\";\r\n var a;\r\n\t\ta = $('#profile_stream_blankstate');\r\n\t\tif (a.length)\r\n\t\t\t$(button).insertBefore($('#profile_stream_blankstate'));\r\n\t\ta = $('#pagelet_event_wall');\r\n\t\tif (a.length)\r\n\t\t\t$(button).insertBefore($('#pagelet_event_wall'));\r\n\t\ta = $('#MessagingMainContent');\r\n\t\tif (a.length)\r\n\t\t\t$(button).insertBefore($('#MessagingMainContent'));\r\n\t\t// Third button\r\n $('#expand_all_older_posts_button').click(function()\r\n {\r\n expandOlderPosts(true);\r\n });\r\n }\r\n}", "function addSpeakButton() {\n const excersice = document.querySelector(excersiceSelector)\n const speakerButton = document.createElement('button');\n speakerButton.setAttribute('class', 'speaker-button');\n excersice.insertAdjacentElement('afterend', speakerButton);\n speakerButton.addEventListener('click', speakExcersie);\n}", "create($parent) {\n $(`<button id=\"${this.idDOM}\" class=\"${this.cssClass}\" type=\"button\">${this.active ? this.activeText : this.inactiveText}</button>`)\n .appendTo($parent)\n .click(() => this.onClick());\n }", "function createButton(clsName,btntype,btnid,btnparrent,slug){\n const button = document.createElement(\"button\")\n //button.className = \"close\"\n button.className = clsName\n button.type = btntype\n button.id = btnid\n button.innerHTML = btnid\n button.addEventListener(\"click\",(e) => {\n e.preventDefault()\n let country = slug\n let status = btnid\n let url = \"https://api.covid19api.com/dayone/country/\" + country + \"/status/\" + status\n console.log(url)\n getval(url).then(values => {renderChart(values,\"canvas2\")})\n })\n btnparrent.appendChild(button)\n}", "function buildNewJournalButton(){\n\tvar button = document.createElement(\"button\");\n\tvar buttonLabel = document.createTextNode(\"Add Journal\");\n\tbutton.appendChild(buttonLabel);\n\n\tbutton.addEventListener('click', function(event){\t\n\t\tvar journalData = new JournalData ();\n\t\tvar journalsRelation = user.relation(\"userJournals\");\n\t\tvar newJournalTitle = prompt(\"Enter the new journal's title.\");\n\n\t\tif(newJournalTitle != null){\n\t\t\tcurrentJournalIndex = 0;\n\t\t\tcurrentEntryIndex = 0;\n\n\t\t\tjournalData.save({\n\t\t\t\tjournalTitle: newJournalTitle,\n\t\t\t}, \n\t\t\t{\n\t\t\t\tsuccess: function(results){\n\t\t\t\t\tconsole.log(\"Created new journal\");\n\t\t\t\t\tjournalsRelation.add(journalData);\n\t\t\t\t\tuser.save(null, {\n\t\t\t\t\t\tsuccess: function (results){\n\t\t\t\t\t\t\trefreshJournalsSection();\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror:function(error){\n\t\t\t\t\t\t\talert(\"Something went wrong: error is \" + error.message);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\terror: function(error){\n\t\t\t\t\tconsole.log(\"Error creating new journal. Error: \" + error);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\tnewJournalButton.appendChild(button);\n}", "function create(idButton, aliasName) {\n if (aliasName == \"\")\n throw \"Alias Name is required\";\n if (idButton == \"\")\n throw \"idButton is required\";\n return Utils_1.default.OSExecute(`apx-onewire-ibutton create ${idButton} ${aliasName}`);\n}", "function newButton() {\n\n event.preventDefault();\n\n var newSeries = $('#submit-form').val().trim();\n if (newSeries==\"\"){\n return null;\n }\n $newButton = $('<button>');\n $newButton.attr('type', 'button');\n $newButton.addClass('btn btn-dark btn-sm m-1 gif-button');\n $newButton.text(newSeries);\n topics.push(newSeries);\n\n$('.button-wrapper').append($newButton);\n$('#submit-form').val('');\n}", "renderNewEventBtn() {\n eventContainer.innerHTML += eventHtml.makeNewEventBtn();\n }", "function createSubmitButton(){\r\n var submitButton = document.createElement(\"button\");\r\n submitButton.setAttribute(\"id\", \"handIN\");\r\n submitButton.onclick = function(){\r\n submitChoice();\r\n closeModalWrapper();\r\n };\r\n submitButton.innerHTML = \"save\";\r\n document.getElementById(\"newTuple\").appendChild(submitButton);\r\n}", "function createButton() {\n\n //Clear the div we are adding buttons to so no multiples are added\n $(\"#addButton\").empty();\n\n //Generate buttons for each sport in the array\n for (var i = 0; i < topics.length; i++) {\n\n var sportButton = $(\"<button>\");\n sportButton.addClass('sport-button');\n sportButton.addClass('btn btn-success');\n sportButton.attr('data-name', topics[i]);\n sportButton.text(topics[i]);\n var emptySpace = \" \";\n $('#addButton').append(sportButton);\n $('#addButton').append(emptySpace);\n }\n}", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"fb-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">FB</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"http://facebook.com/meerundmehr\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Facebook-Fanpage-Link angeben\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function createNewNoteButton() {\n noteButton = document.createElement(\"div\");\n noteButton.className = \"menuIcon\";\n document.body.appendChild(noteButton);\n let span = document.createElement(\"span\");\n noteButton.appendChild(span);\n let icon = document.createElement(\"img\");\n icon.src = \"/media/plus-circle.svg\";\n icon.width = \"50\";\n icon.height = \"50\";\n span.appendChild(icon);\n noteButton.addEventListener(\"click\", function () {\n let menu = document.querySelector(\".menuIcon\");\n menu.classList.toggle(\"active\");\n });\n}", "function createSubmitButton() {\n var submitInstance = document.createElement(\"input\");\n var formEl = document.getElementById(\"form\");\n submitInstance.id = \"submitInstance\";\n submitInstance.type = \"button\";\n submitInstance.value = \"Preview Widget\";\n submitInstance.classList.add(\"submitInstance\");\n formEl.appendChild(submitInstance);\n}", "function buildBtn () {\n $(\"#button-container\").empty();\n for (let i = 0; i < topics.length; i++) {\n let topicBtn = $(\"<button>\");\n topicBtn.addClass(\"api-button\");\n topicBtn.attr(\"data-animal\", topics[i]);\n topicBtn.text(topics[i]);\n $(\"#button-container\").append(topicBtn);\n }\n }", "function __add_button_create_event() {\n\t\tvar $element = $('.has-button-create-event');\n\n\t\t$(window).load(function() {\n\t\t\tvar $button = $('');\n\t\t\t$button.appendTo($element.find('.fc-header-right'));\n\t\t});\n\t}", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"gbl-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Geschichtenbalken: normal</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"<!-- INFORMATIONEN ZUR ANPASSUNG IST UNTEN\\n-->{{Geschichten-Info 2013\\n<!-- unter dieser Linie nichts verändern -->\\n|LastUpdateHack={{{LastUpdateHack|{{REVISIONDAY2}}.{{REVISIONMONTH}}.{{REVISIONYEAR}}}}}\\n|Portal={{{Portal|}}}\\n|Name=\"+ wgPageNameRegexedSplit +\"\\n}}<noinclude>{{Geschichten-Info/Autoren-Werkzeugkasten}}[[Kategorie:Angepasste Geschichtenbalken]]</noinclude>\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Sollte alles mit 'OK' funktionieren. ###### ACHTUNG ##### geht nur in Geschichtenübersicht.\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function newTopicButton(topic, arrayPosition) {\n $('#topics-card-body').append('<button type=\"button\" class=\"topics-button btn btn-dark m-1\" id=\"button' + arrayPosition + '\">' + topic + '</button>');\n $('#button' + arrayPosition).css({\n 'background-color': colors[currentColorIndex],\n 'color': '#333333'\n });\n\n if (currentColorIndex === colors.length - 1) {\n currentColorIndex = 0;\n\n } else {\n currentColorIndex++;\n }\n}", "clickOnCreateAccountLink(){\n let createAccountLink = utils.byLocator(jobsPageLocator.jobsPage.CreateAccountLink);\n utils.clickOn(createAccountLink);\n }", "function buildButtonMessage(recipientId, text, buttons) {\n var messageData = {\n attachment: {\n \"type\": \"template\",\n \"payload\": {\n \"template_type\": \"button\",\n \"text\": text,\n \"buttons\": buttons\n }\n }\n }\n}", "function generateButton() {\n $(\"#buttonsDiv\").empty();\n for (var i = 0; i < topics.length; i++) {\n var buttonsDiv = $(\"<button>\")\n buttonsDiv.addClass(\"topic-button btn waves-effect waves-light\");\n buttonsDiv.attr(\"data-type\", topics[i]);\n buttonsDiv.html(topics[i]);\n $(\"#buttonsDiv\").append(buttonsDiv);\n };\n}", "function initialBtn(topics,classToAdd,areaToAddTo){\n\t// Must empty area everytime we add a new button (otherwise there will be duplicates)\n\t$(areaToAddTo).empty();\n\tfor(var i=0; i < topics.length; i++){\n\t\tvar a = $('<button>');\n\t\ta.addClass(classToAdd);\n\t\ta.attr('data-type',topics[i]);\n\t\ta.text(topics[i]);\n\t\t$(areaToAddTo).append(a);\n\t}\n}", "function createBtn() {\n for (i = 0; i < topics.length; i++) {\n buttonsDiv.append(\"<button tvShow='\" + topics[i] + \"'>\" + topics[i] + \"</button>\");\n }\n}", "function createButtons() {\n $(\".buttonsDiv\").empty(); \n for (let i = 0; i < topics.length; i++) {\n var btn = $(\"<button>\")\n btn.addClass(\"travelBtn\")\n //jquery custom attributes for buttons\n btn.attr(\"data-type\", topics[i])\n btn.text(topics[i])\n $(\".buttonsDiv\").append(btn)\n }\n}", "function addButtons() {\n\t$ans.append('<button class=\"toInfo\">' + 'Click here to learn more!' + '</button>');\n\t$ans.append('<button class=\"tryAgain\">' + 'Click here to try again!' + '</button>');\t\n\t}", "function createChannel() {\n // Remove button \n createChannelButton.setAttribute(\"style\", \"display: none;\");\n channelCreatedNotif.setAttribute(\"style\", \"display: none;\");\n channelCreatedNotif.innerHTML = \"\";\n // Show form.\n channelNameInput.removeAttribute(\"style\"); \n newChannelValue.focus();\n}", "function addButton(text, onclick, cssObj, id) {\n cssObj = cssObj || {bottom: '7%', left: '4%', 'z-index': 3}\n let button = document.createElement('button'), btnStyle = button.style\n button.id = id\n button.setAttribute(\"data-toggle\", \"modal\")\n button.setAttribute(\"data-target\", \"#exampleModal\")\n button.setAttribute(\"class\", \"btn btn-outline-info\")\n if (document.getElementById(id)) {\n return\n }\n document.body.appendChild(button)\n button.innerHTML = text\n button.onclick = onclick\n Object.keys(cssObj).forEach(key => btnStyle[key] = cssObj[key])\n $(button).after(`<div class='loader'></div>`)\n $(button).next().hide()\n return button\n }", "function createButtons() {\n\t\tvar buttonHTML = '<input id=\"CustomNextButton\" class=\"FakeButton Button\" title=\"→\" ' \n\t\t+ 'type=\"button\" name=\"CustomNextButton\" value=\"→\" aria-label=\"Next\">'\n\t\t+ '<input id=\"ShowAnswerButton\" style = \"display:none\" class=\"FakeButton Button\" title=\"Show Answer\" ' \n\t\t+ 'type=\"button\" name=\"ShowAnswerButton\" value=\"Show Answer\" aria-label=\"Show Answer\">'\n\t\t+ '<style>.Total {display: none !important;}</style>';\n\t\tjQuery('#showbuttons').append(buttonHTML);\n\t}", "function addBtn(url, btnNAme) {\n\t$('#add-btn').empty().html(\n\t\t'<a href=\"'+url+'\">\\\n\t\t\t<button type=\"button\" class=\"btn btn-block btn-sm btn-primary\"><i class=\"fa fa-plus-circle\"></i> '+btnNAme+' </button>\\\n\t\t</a>'\n\t);\n}", "function createBtnConfirm() {\n let btnConfirm = document.createElement(\"button\");\n btnConfirm.className = \"note-button note-button-bottom\";\n btnConfirm.addEventListener(\"click\", function () {\n saveNotesToLocalStorage();\n });\n btnConfirm.appendChild(createImgConfirm());\n return btnConfirm;\n}", "function generateButtons() {\n //empties gif-display div\n $('#button-display').empty()\n //loops through array of submitted anime\n for (var x = 0; x < animes.length; x++) {\n var a = $('<button>')\n a.addClass('anime-button');\n a.attr('data-name', animes[x]);\n a.text(animes[x]);\n $('#button-display').append(a)\n\n }\n}", "function addButton(){ \n text = document.createTextNode(\"Delete Task\");\n buttn = document.createElement(\"Button\");\n buttn.className = classNames[\"TODO_DELETE\"];\n buttn.setAttribute(\"onClick\",\"deleteTask(event)\")\n buttn.appendChild(text);\n return buttn;\n}", "function buttonGenerate(topics) {\n $('#buttonReceiver').empty();\n for (var i = 0; i < topics.length; i++) {\n var button = $(\"<button>\");\n button.attr('id', 'reactButton');\n button.attr('data-name', topics[i]);\n button.text(topics[i]);\n $('#buttonReceiver').append(button);\n //console.log('buttons created');\n }\n}", "function DisciplinaButtonCreator(discId, discNome) {\n let button = document.createElement(\"button\");\n button.id = discId;\n button.innerText = (discId + \" - \" + capitalize(discNome));\n button.onclick = () => {\n if (loggedInCheck()) return;\n perfilModController(discId);\n }\n button.className = \"discBt\";\n\n document.querySelector(\".disciplinas-container\").appendChild(button);\n}", "function createButton(buttonId, buttonClass, buttonOnclickFunction,text){\n\tvar b = document.createElement(\"button\");\n\tb.setAttribute(\"id\", buttonId);\n\tb.setAttribute(\"class\", buttonClass);\n\tb.setAttribute(\"onclick\", buttonOnclickFunction);\n\tvar txt = document.createTextNode(text);\n\tb.appendChild(txt);\n\treturn b;\n}", "click(){\n\t\t\t\tcreateAddWindow();\n\t\t\t}", "function mkButtons(){\n $('#buttons').empty();\n for (i = 0; i < topics.length; i++){\n var buttonText = topics[i];\n var button = $('<button>').text(buttonText);\n $(button).appendTo('#buttons');\n button.attr('id', 'giph-button'); \n button.attr('topic', buttonText);\n \n };\n}", "function createSubmitButton(){\n let submitButton = document.createElement('button');\n submitButton.innerHTML = 'Submit';\n submitButton.id = 'submit-button';\n submitButton.onclick = submit;\n return submitButton;\n}", "function iMakeButtons() {\n $(\"#button-field\").empty();\n for (i = 0; i < topics.length; i++) {\n var but = $(\"<button>\")\n but.attr(\"data-name\", topics[i]);\n but.text(topics[i]);\n but.attr(\"class\", \"getGiphies\");\n but.appendTo(\"#button-field\");\n }\n }", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"gbl-kg-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Kurzgeschichte</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"<!-- INFORMATIONEN ZUR ANPASSUNG IST UNTEN\\n-->{{Geschichten-Info 2013/Kurzgeschichte\\n<!-- unter dieser Linie nichts verändern -->\\n|LastUpdateHack={{{LastUpdateHack|{{REVISIONDAY2}}.{{REVISIONMONTH}}.{{REVISIONYEAR}}}}}\\n|Portal={{{Portal|}}}\\n|Name=\"+ wgPageNameRegexedSplit +\"\\n}}<noinclude>{{Geschichten-Info/Autoren-Werkzeugkasten}}[[Kategorie:Angepasste Geschichtenbalken]]</noinclude>\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Sollte alles mit 'OK' funktionieren. ###### ACHTUNG ##### geht nur in Geschichtenübersicht.\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function createAcceptButton() {\n\n let notAccept = document.createElement('a');\n notAccept.classList.add('col', 'px-0', 'col-sm-1');\n\n let notAcceptImg = document.createElement('img');\n notAcceptImg.src = \"/icons/check.svg\";\n notAcceptImg.classList.add('img-fluid', 'notify-action-button', 'check');\n notAcceptImg.alt = \"Accept Notification\";\n notAccept.appendChild(notAcceptImg);\n\n return notAccept;\n}", "function createEditDisplayNameButton() {\n var editButton = document.createElement('a');\n editButton.className = 'displayname';\n UIUtil.setTooltip(editButton,\n \"videothumbnail.editnickname\",\n \"top\");\n editButton.innerHTML = '<i class=\"fa fa-pencil\"></i>';\n\n return editButton;\n}", "function createEditDisplayNameButton() {\n var editButton = document.createElement('a');\n editButton.className = 'displayname';\n UIUtil.setTooltip(editButton,\n \"videothumbnail.editnickname\",\n \"top\");\n editButton.innerHTML = '<i class=\"fa fa-pencil\"></i>';\n\n return editButton;\n}", "function buildNewEntryButton(journalSelf, entrySelf){\n\tvar button = document.createElement(\"button\");\n\tvar buttonLabel = document.createTextNode(\"Add Entry\");\n\tbutton.appendChild(buttonLabel);\n\n\tbutton.addEventListener('click', function(event){\t\n\t\tvar entriesData = new EntriesData ();\n\t\tvar entriesRelation = currentJournal.data.relation(\"userEntries\");\n\t\tparseInt(currentNumEntries, 10);\n\t\tcurrentNumEntries++;\n\t\tvar newEntryTitle = \"Entry\" + currentNumEntries;\n\t\tnewEntryTitle.toString();\n\t\t\n\t\tentriesData.save({\n\t\t\tentryTitle: newEntryTitle,\n\t\t\tentryText: \"\"\n\t\t}, \n\t\t{\n\t\t\tsuccess: function(results){\n\t\t\t\tconsole.log(\"Created new entry\");\n\t\t\t\tentriesRelation.add(entriesData);\n\t\t\t\tcurrentEntry = entrySelf;\n\t\t\t\tcurrentEntryIndex = 0;\n\t\t\t\tcurrentJournal.data.save(null, {\n\t\t\t\t\tsuccess: function (results){\n\t\t\t\t\t\trefreshEntriesSection(journalSelf, entrySelf);\n\t\t\t\t\t},\n\t\t\t\t\terror:function(error){\n\t\t\t\t\t\talert(\"Something went wrong: error is \" + error.message);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\terror: function(error){\n\t\t\t\tconsole.log(\"Error creating new entry. Error: \" + error);\n\t\t\t}\n\t\t});\n\n\t});\n\tnewEntryButton.appendChild(button);\n}", "function addNotification (title, author, authorAvatar, date, url) {\n const divBlocNotif = document.createElement('div')\n divBlocNotif.id = 'blocNotif'\n const divDate = document.createElement('div')\n divDate.id = 'date'\n divDate.innerText = date\n const divPseudo = document.createElement('div')\n divPseudo.id = 'pseudo'\n divPseudo.innerText = author\n const divTitle = document.createElement('div')\n divTitle.id = 'title'\n divTitle.innerText = title\n const imgAvatar = document.createElement('img')\n imgAvatar.src = authorAvatar\n const divNotif = document.createElement('div')\n divNotif.id = 'notification'\n const a = document.createElement('a')\n a.href = url\n a.target = '_blank' // Open the notification in a new window\n\n divBlocNotif.appendChild(divDate)\n divBlocNotif.appendChild(divPseudo)\n divBlocNotif.appendChild(divTitle)\n divNotif.appendChild(imgAvatar)\n divNotif.appendChild(divBlocNotif)\n a.appendChild(divNotif)\n contentDiv.appendChild(a)\n}", "function makeButton() {\n const btn = document.createElement(\"BUTTON\");\n btn.innerHTML = \"View Results\";\n const att = document.createAttribute(\"onclick\");\n att.value = \"handleSubmit()\";\n btn.setAttributeNode(att);\n // console.log(btn);\n buttonAdd.appendChild(btn);\n}", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"fsk-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Kategorie3</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"FSK\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Dritte Kategorie der Geschichte angeben\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function createButton(classType, textString) {\n let newButton = document.createElement(\"button\");\n newButton.type = \"button\";\n newButton.className = classType;\n newButton.innerText = textString;\n return newButton;\n}", "function createButtons (){\n\n $(\"#btnHolder\").empty();\n\n \t// Looping through the GIF topics\n \tfor (var i=0; i<topics.length; i++) {\n\n \t\t// Using jQuery to create a button for string in the \"topics\" array\n \t\tvar $gifBtn = $('<button>');\n \t\t// Adding class \"topic\" to each button\n \t\t$gifBtn.attr(\"class\", \"topic btn btn-primary\");\n \t\t// Adding attribute to distinguish one button from another\n \t\t$gifBtn.attr(\"topic-name\", topics[i])\n \t\t// Putting \"topic[i]\" text inside the generated button\n \t\t$gifBtn.text(topics[i])\n \t\t// Add the button to the page within the \"btnHolder\"\n \t\t$(\"#btnHolder\").append($gifBtn);\n\n \t\t// Debugging\n \t\tconsole.log($gifBtn, \"gif button\");\n\n \t};\n }", "function displayStatusChangeButton(){\n var statusChangeButton = '<button type=\"button\" class=\"btn btn-danger\" id=\"statusChangeButton\" onclick=\"statusChangeClicked()\"> Start Game </button>';\n $(\"#statusChangeDiv\").append(statusChangeButton);\n}", "function btnGenerator(){\n $('#buttonSec').empty();\n \n for (let i=0; i < topics.length; i++){\n var btn = $('<button>').addClass('btn-topic');\n btn.attr('value', topics[i]).text(topics[i]);\n $('#buttonSec').append(btn);\n \n }\n }", "function aDashboardActionCreatePerson( p, el ) {\n\tlet windowTitle = `New Person...`;\n\n\tlet values = { name: 'Please, provide a name', descr: 'Please, provide a description...', position: 'Please, provide a position', icon:null };\n\t\n\tlet keyProperties = { descr: { height:'200px' } };\n\tlet rightPaneHTML = `<h1 align=center>Creating a New Person</h1>`;\n\n\tlet keys = [ 'name', 'position', 'descr', 'icon' ];\n\n\taDisplayDashboardDataArrayEditWindow( windowTitle, keys, values, \n\t\t{ rightPaneHTML:rightPaneHTML, keyProperties:keyProperties, saveURL:'/a_persons_new' } );\n}", "function createEnterButton()\n{\n\tvar buttonCreated = document.createElement('button');\n\tvar buttonText = document.createTextNode(\"Show me the mad lib!\");\n\n\tbuttonCreated.setAttribute('type','submit');\n\tbuttonCreated.setAttribute('onclick','enterButtonClicked()');\n\tbuttonCreated.setAttribute('id', 'submit-button');\n\n\tbuttonCreated.appendChild(buttonText);\n\n\tdocument.getElementById('madlibs-entry').appendChild(buttonCreated);\n}", "function createButtons() {\n\tfor (var i = 0; i < topics.length; i++){\n\t\tconsole.log(topics[i]);\n\t\n\tvar newBtn = $(\"<button>\");\n\t// $(`<button ${topics[i].newBtn}></button>`);\n\t\n\t\n\tnewBtn.data(\"data-scifimovie\",topics[i]);\n\tnewBtn.addClass(\"button\");\n\tnewBtn.text(topics[i]);\n\n\t$(\"#createshowButtons\").append(newBtn);\n\n}\ntopics=[];\n}", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"fsk-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Kategorie2</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"FSK\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Zweite Kategorie der Geschichte angeben\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function initDeleteNoticeButton() {\n\t\t\tvar $button, toolbar, $mytoolsLI, $customizeLI;\n\t\t\t\n\t\t\t// don't create duplicate buttons\n\t\t\tif (document.getElementById(\"mark-for-deletion-link\") !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// create button\n\t\t\t$button = $('&nbsp;<a id=\"fsk-aendern-link\" class=\"mum-organizational\" style=\"cursor: pointer;\">Kategorie1</a>');\n\t\t\t$button.click(function deleteNoticeButtonClickHandler() {\n\t\t\t\tvar promptedDeleteReason = \"FSK\";\n\t\t\t\tif (typeof window.MarkForDeletion === \"object\" && window.MarkForDeletion !== null && typeof window.MarkForDeletion.promptedDeleteReason === \"string\") {\n\t\t\t\t\tpromptedDeleteReason = window.MarkForDeletion.promptedDeleteReason;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar deleteReason = window.prompt(\"Erste Kategorie der Geschichte angeben\", promptedDeleteReason);\n\t\t\t\t\n\t\t\t\tif (typeof deleteReason === \"string\" && deleteReason.length > 0) {\n\t\t\t\t\tsetDeleteNotice(deleteReason);\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t// add button to toolbar\n$($button).appendTo('#organisationsbox');\n\t\t}", "function create_html_button(htmls_id , opt_id , on_click_fn){\n\n htmls_id = document.getElementById(htmls_id);\n tmp_div = document.createElement('button');\n tmp_div.setAttribute(\"type\", \"button\");\n tmp_div.setAttribute(\"id\", opt_id);\n tmp_div.setAttribute(\"name\", opt_id);\n tmp_div.setAttribute(\"class\", opt_id);\n tmp_div.setAttribute(\"onClick\", on_click_fn);\n\n //tmp_div.innerHTML = text;\n htmls_id.appendChild(tmp_div);\n}" ]
[ "0.665023", "0.6606383", "0.65983284", "0.64718515", "0.63893795", "0.62772244", "0.6237929", "0.6225992", "0.6219636", "0.6174366", "0.6162061", "0.6141454", "0.6138052", "0.61230254", "0.61071116", "0.6099886", "0.60956156", "0.60926545", "0.6083262", "0.60730255", "0.60415196", "0.6031436", "0.60251725", "0.60244", "0.60008556", "0.59972566", "0.5986998", "0.59858274", "0.59755915", "0.59680086", "0.5966534", "0.5964667", "0.59357786", "0.5926325", "0.5920628", "0.5919896", "0.59131515", "0.59086025", "0.5902287", "0.5895204", "0.5882721", "0.58820444", "0.5872182", "0.5868955", "0.5849672", "0.58493286", "0.58312654", "0.582232", "0.58214754", "0.5819026", "0.58146983", "0.58116287", "0.58040506", "0.57931864", "0.5766293", "0.57549", "0.5747393", "0.57447207", "0.574193", "0.5739648", "0.5735689", "0.573536", "0.57324624", "0.5730437", "0.5726696", "0.5724855", "0.5716275", "0.571329", "0.5706626", "0.5705949", "0.57048655", "0.57029885", "0.56930155", "0.5691645", "0.56910676", "0.5690345", "0.5683306", "0.5680652", "0.5678206", "0.56763506", "0.5671307", "0.56681615", "0.5662189", "0.56598616", "0.5651565", "0.5642868", "0.5642868", "0.5637809", "0.56365764", "0.5630951", "0.56275386", "0.5625391", "0.5625316", "0.56222296", "0.5620943", "0.5620391", "0.5614634", "0.56096184", "0.56091374", "0.5605624", "0.56034696" ]
0.0
-1
get mail template by "id"
function mailTemplatePost(req, res, next) { MailTemplateService.getMailTemplate(req.body.mailTemplate, function(error, result) { if (result.sessionId) { let snapshot = sessionBuilderSnapshotValidationService.getMailTemplateSnapshot(result); res.send({error: error, template: result, snapshot: snapshot}); } else { res.send({error: error, template: result}); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function $getMailTemplate(_log, _insDB, _gID){\n return new Promise((_rl, _rj)=> {\n _log.debug(\"The parameters is [%s]\", typeof({\"group_id\": _gID}));\n\n _insDB.any(`select ec.mail_template\n from em_group_2_mail g2m\n inner join em_group eg\n on g2m.group_id = eg.id\n and g2m.group_id = $(group_id)\n inner join em_tpl_content ec\n on g2m.em_tpl_id = ec.id`, {\"group_id\": _gID})\n .then(_tpl_mail => { _tpl_mail[0]?_rl(_tpl_mail[0].mail_template):_rl(\"No template found\");})\n .catch(_err => {_log.error(\"The erro info is \", util.inspect(_err)); _rj(_err);});\n });\n}", "function getTemplate(template_id) {\n return $(`#${template_id}`).html()\n}", "function getTemplateByID(req, res) {\n\tqueryTemplateID(req.swagger.params.ID.value, function(doc){\n\t\tres.json(doc[0]);\n\t})\n}", "getTemplate(id) {\n return axios.get(`${API_URL}/${id}`)\n }", "static getExtensionTemplateItem(templateCollection, id) {\n switch (Application.getCurrentBrowser()) {\n case Browser.CHROME:\n return templateCollection.getElementById(id).content.cloneNode(true);\n }\n }", "_getTemplate (type, templateId, callback) {\n this._fetch((items) => {\n const templates = items[type]\n\n if (callback && templates && templates.hasOwnProperty(templateId)) {\n callback(templates[templateId])\n }\n })\n }", "function activeTemplate(id){\n\t\tvar t = document.querySelector(id);\n\t\treturn document.importNode(t.content, true);\n\t}", "function getTemplate(templates,name) {\n for (let i=0 ; i<templates.length; i++){\n if (templates[i].templateId === name){\n return templates[i];\n }\n }\n throw new Error(`can't find template ${name}`);\n }", "findTemplate(templateId) {\n const template = this.templateMap[templateId] || this.theme.findTemplate(templateId);\n if (template) return template;\n console.warn(`findTemplate(${templateId}): template not found.`);\n }", "async function getTemplate(templateType) {\n const template = await SmsTemplate.findOne({messageType: templateType});\n return template;\n}", "function selectTemplate(templateId) {\n var selectedTemplate = $(alltemplates).filter(\"script#\" + templateId);\n return selectedTemplate;\n }", "getById(id) {\r\n return new MailFolder(this, id);\r\n }", "static getTemplate(req, res) {\n let type = req.params.type;\n let id = req.params.id;\n\n ConnectionHelper.getTemplateProvider(req.project, req.environment)\n .then((connection) => {\n if(!connection) { return Promise.reject(new Error('No template provider found')); }\n \n return connection.getTemplateById(type, id);\n })\n .then((template) => {\n res.status(200).send(template);\n })\n .catch((e) => {\n res.status(404).send(ApiController.printError(e, false));\n }); \n }", "function getTemplate(templateName) {\n return document.getElementById(templateName + '-template').innerHTML;\n}", "function loadTemplate(templateID) {\n var allElements = document.getElementsByTagName('*');\n for (var i = 0; i < allElements.length; i++) {\n var id = allElements[i].getAttribute(\"data-templateid\");\n if ((id != undefined) && (id != null) && (id == templateID)) {\n if (allElements[i].nodeName.toUpperCase() == \"TEXTAREA\")\n return allElements[i].value;\n else\n return allElements[i].innerHTML;\n }\n }\n return '';\n }", "static getHtmlTemplate(url, id, callback) {\n console.log(id);\n $.ajax({\n type: 'GET',\n url: url,\n dataType: 'text',\n }).done((res) => {\n document.getElementById(id).innerHTML = res;\n });\n }", "get id () {\n return this.constructor.name.replace(/(\\w+)Template/, '$1').toLowerCase()\n }", "function smtpGetEmailInfoById(callback, id) {\n if ((id === undefined) || (!id.length)) {\n return callback(returnError('Empty id'));\n }\n sendRequest('smtp/emails/' + id, 'GET', {}, true, callback);\n}", "getById(id) {\r\n return new WebPartDefinition(this, `getbyid('${id}')`);\r\n }", "_loadTemplate(template) {\n if (!this._templates[template]) {\n return this._ajaxService.get({\n url: template\n }).then((response) => {\n const TEMPLATE = response.responseText;\n this._templates[template] = TEMPLATE;\n return TEMPLATE;\n }).catch((err) => {\n console.log('error');\n console.log(err);\n });\n }\n return this._templates[name];\n }", "function templateByIdFromFile(id, filename){\n\t$(document).ready(function(){\n\t $(id).load(filename);\n\t});\n}", "findMessageById(id){\n return this.messages.get(parseInt(id));\n }", "function getTemplate() {\n\t\t\tvar deferred = $.Deferred();\n\t\t\t// get RPC results\n\t\t\tRactiveRPC.tab2templateAsync({\n\t\t\t\tonsuccess: function(results) {\n\t\t\t\t\tdeferred.resolve(results);\n\t\t\t\t},\n\t\t\t\tonerror: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\tontimeout: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\ttimeout: 2000,\n\t\t\t\tparams: [1,2]\n\t\t\t});\t\n\t\t\t\n\t\t\treturn deferred.promise();\n\t\t}", "function getTemplate() {\n\t\t\tvar deferred = $.Deferred();\n\t\t\t// get RPC results\n\t\t\tRactiveRPC.testTemplateAsync({\n\t\t\t\tonsuccess: function(results) {\n\t\t\t\t\tdeferred.resolve(results);\n\t\t\t\t},\n\t\t\t\tonerror: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\tontimeout: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\ttimeout: 2000,\n\t\t\t\tparams: [1,2]\n\t\t\t});\t\n\t\t\t\n\t\t\treturn deferred.promise();\n\t\t}", "getById(id) {\r\n return new Attachment(this, id);\r\n }", "getOriginal (templateId, callback) {\n this._getTemplate('ORIGINAL', templateId, callback)\n }", "function get(id) {\n return $.ajax({\n url: wvy.url.resolve(\"/notifications/\" + id),\n method: \"GET\",\n contentType: \"application/json\"\n });\n }", "getById(id) {\r\n const ct = new ContentType(this);\r\n ct.concat(`('${id}')`);\r\n return ct;\r\n }", "function getTemplateData(templateId, templateType) {\r\n var response = htmlData.JSONData['' + templateId]\r\n templatesCache[templateId] = response;\r\n return response;\r\n \r\n }", "getById(id) {\r\n return new Message(this, id);\r\n }", "static async get(id) {\n const result = await db.query(`SELECT * FROM messages WHERE id = $1`, [id]);\n\n return result.rows[0];\n }", "function getTemplateID(name, value, template) {\n\tif(template && template.length > 0) {\n\t\tfor(var i=0; i<template.length; i++) {\n\t\t\tif(name == template[i]['id']) {\n\t\t\t\tvar result = checkValueType(value, template[i]);\n\t\t\t\tif(result) {\n\t\t\t\t\treturn template[i]['id'];\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\n\t} else {\n\t\twriteLog('Template is not existed');\n\t}\n\n\treturn null;\n}", "getById(id) {\r\n return new Conversation(this, id);\r\n }", "function getTemplate(name) {\n return new Promise(function(resolve, reject) {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', \"scripts/templates/\"+ name +\".html\");\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) return;\n if (xhr.status != 200) {\n reject(Error(xhr.status + ': ' + xhr.statusText));\n return;\n }\n resolve(xhr.responseText);\n }\n xhr.send();\n });\n}", "function findMessage(id, type) {\n return $http.get(restApi + '/message/' + id + '/' + type).then(function success(response) {\n return response.data;\n },\n function error(error) {\n return error;\n });\n }", "function getTranslationForTemplate(message,subTemplateIndex){if(typeof subTemplateIndex!=='number'){// We want the root template message, ignore all sub-templates\nreturn removeInnerTemplateTranslation(message);}else{// We want a specific sub-template\nvar start=message.indexOf(\":\"+subTemplateIndex+MARKER)+2+subTemplateIndex.toString().length;var end=message.search(new RegExp(MARKER+\"\\\\/\\\\*\\\\d+:\"+subTemplateIndex+MARKER));return removeInnerTemplateTranslation(message.substring(start,end));}}", "function getItem(template) { // -> Gets item from <input: _tpl>\n for (let itm in items.data) {\n if (items.data[itm]._id && items.data[itm]._id === template) {\n let item = items.data[itm];\n return [true, item];\n }\n }\n \n return [false, {}];\n}", "getMessageByID(id) {\n for(let i = 0; i < this.props.messages.length; ++i) {\n if(this.props.messages[i].id === id) {\n return this.props.messages[i];\n }\n }\n }", "function fetchEmailTemplate() {\n fetch(apiCommonSettingsUrl + '/stock_email_distribution_template').then(function (response) {\n if (response.status === 200) {\n response.json()\n .then(emailTemplate => $('#editTemplateSummernote').summernote('code', emailTemplate.textValue))\n }\n })\n}", "function get_template(interfaceName,dashboardID)\n {\n var groupID = (new Date()).getTime();\n group_application_map.set(groupID,{});\n\tif (file_list.hasOwnProperty(\"cgcsv\") && file_list[\"cgcsv\"]) {\n if (file_list.hasOwnProperty(\"aet\") && file_list[\"aet\"]) {\n var template = {\n\t \"title\": interfaceName,\n \"intfId\": dashboardID,\n \t \"structure\": \"4-8\",\n \t \"rows\": [{\n \t\t \"columns\": [{\n \t\t\t\t \"styleClass\": \"col-md-4\",\n \t\t\t\t \"widgets\": [{\n \t\t\t\t\t\t \"type\": \"trace_file\",\n \t\t\t\t\t\t \"group\": groupID,\n \t\t\t\t\t },\n \t\t\t\t\t {\n \t\t\t\t\t\t \"type\": \"NEXA_Source_Browser\",\n \t\t\t\t\t\t \"group\": groupID,\n \t\t\t\t\t }\n \t\t\t\t ]\n \t\t\t },\n \t\t\t {\n \t\t\t\t \"styleClass\": \"col-md-8\",\n \t\t\t\t \"widgets\": [{\n \t\t\t\t\t\t \"type\": \"mantis_FE\",\n \t\t\t\t\t\t \"group\": groupID,\n \t\t\t\t\t },\n \t\t\t\t\t {\n \t\t\t\t\t\t \"type\": \"nexa_csv_viewer\",\n \t\t\t\t\t\t \"group\": groupID,\n \t\t\t\t\t }\n \t\t\t\t ]\n \t\t\t }\n \t\t ]\n \t }],\n }\n //get template should create a template on the fly and hence be aware\n create_applications(groupID,['mantis_FE','NEXA_Source_Browser','trace_file','nexa_csv_viewer']);\n } else {\n var template = {\n\t \"title\": interfaceName,\n\t \"intfId\": dashboardID,\n\t \"structure\": \"4-8\",\n\t \"rows\": [{\n \t\t \"columns\": [{\n \t\t\t\t \"styleClass\": \"col-md-6\",\n \t\t\t\t \"widgets\": [{\n \t\t\t\t\t\t \"type\": \"trace_file\",\n \t\t\t\t\t\t \"group\": groupID,\n \t\t\t\t\t }\n \t\t\t\t ]\n \t\t\t },\n \t\t\t {\n \t\t\t\t \"styleClass\": \"col-md-6\",\n \t\t\t\t \"widgets\": [{\n \"type\": \"NEXA_Source_Browser\",\n \"group\": groupID,\n }\n \t\t\t\t ]\n \t\t\t },\n \t\t\t {\n \t\t\t\t \"styleClass\": \"col-md-6\",\n \t\t\t\t \"widgets\": [{\n \"type\": \"nexa_csv_viewer\",\n \"group\": groupID,\n }\n \t\t\t\t ]\n \t\t\t }\n \t\t ]\n \t }],\n }\n }\n\treturn template;\n }\n else{\n if (file_list.hasOwnProperty(\"aet\") && file_list[\"aet\"]) {\n var template = {\n\t \"title\": interfaceName,\n \"intfId\": dashboardID,\n \t \"structure\": \"4-8\",\n \t \"rows\": [{\n \t\t \"columns\": [{\n \t\t\t\t \"styleClass\": \"col-md-4\",\n \t\t\t\t \"widgets\": [{\n \t\t\t\t\t\t \"type\": \"trace_file\",\n \t\t\t\t\t\t \"group\": groupID,\n \t\t\t\t\t },\n \t\t\t\t\t {\n \t\t\t\t\t\t \"type\": \"NEXA_Source_Browser\",\n \t\t\t\t\t\t \"group\": groupID,\n \t\t\t\t\t }\n \t\t\t\t ]\n \t\t\t },\n \t\t\t {\n \t\t\t\t \"styleClass\": \"col-md-8\",\n \t\t\t\t \"widgets\": [{\n \t\t\t\t\t\t \"type\": \"mantis_FE\",\n \t\t\t\t\t\t \"group\": groupID,\n \t\t\t\t\t }\n \t\t\t\t ]\n \t\t\t }\n \t\t ]\n \t }],\n }\n //get template should create a template on the fly and hence be aware\n //of the widgets it should launch\n create_applications(groupID,['mantis_FE','NEXA_Source_Browser','trace_file','nexa_csv_viewer']);\n } else {\n var template = {\n\t \"title\": interfaceName,\n \"intfId\": dashboardID,\n \t \"structure\": \"4-8\",\n \t \"rows\": [{\n \t\t \"columns\": [{\n \t\t\t\t \"styleClass\": \"col-md-6\",\n \t\t\t\t \"widgets\": [{\n \t\t\t\t\t\t \"type\": \"trace_file\",\n \t\t\t\t\t\t \"group\": groupID,\n \t\t\t\t\t }\n \t\t\t\t ]\n \t\t\t },\n \t\t\t {\n \t\t\t\t \"styleClass\": \"col-md-6\",\n \t\t\t\t \"widgets\": [{\n \"type\": \"NEXA_Source_Browser\",\n \"group\": groupID,\n }\n \t\t\t\t ]\n \t\t\t }\n \t\t ]\n \t }],\n }\n }\n return template;\n }\n }//end of get_template", "function selectTemplate() {\n\thideError();\n\tvar prj = getProject($( \"span#siteName\" ).text());\n\tvar checked;\n\tvar choices = document.getElementsByName(\"templateSeletion\");\n\tfor (var i = 0; i < choices.length; i++) {\n\t\tif (choices[i].checked) {\n\t\t\tchecked = choices[i];\n\t\t\tbreak;\n\t\t}\n\t}\n\tcopyFile('DefaultTemplate.html', 'template.html', prj.folderid, function(htmlFileID) {\n\t\tcopyFile('DefaultTemplate.css', 'style.css', prj.folderid, function(cssFileID) {\n\t\t\tvar kcms = getKCMS();\n\t\t\tkcms.templates.push({ \"title\": \"default\", \"htmlID\": htmlFileID, \"cssID\": cssFileID });\n\t\t\tsetKCMS(kcms);\n\t\t\t$( \"div#selectTemplate\" ).css('display', 'none');\n\t\t\tupdateKCMS(function () {\n\t\t\t\tloadProject(prj.folderid);\n\t\t\t});\t\n\t\t});\n\t});\n}", "async function getTemplate(userId) {\n try {\n const templates = await Template.find({ userId: userId})\n return templates\n } catch (error) {\n\n return false\n }\n}", "get(id, data) {\n const item = this._items.get(id);\n if (item == null) return null;\n\n const fragment = document.createDocumentFragment();\n\n for (let d of data) {\n const element = item.template.content.cloneNode(true);\n this.inflate(id, element.children[0], d, item.inflate);\n fragment.appendChild(element);\n }\n\n fragment.querySelectorAll('[remove=\"true\"]').forEach(element => element.parentElement.removeChild(element));\n return fragment;\n }", "item(id) {\n const list = this.get('list') || [];\n return list.find((i) => i.id === id || i.email === id);\n }", "function getContact(id) {\n return contacts[id];\n }", "function getPagetIdFromTemplate(XHRstatus, percPageServiceData)\n {\n var querystring = $.deparam.querystring();\n // Add the last element needed in the memento and redirect\n memento.pageId = percPageServiceData.firstItemId;\n $.PercNavigationManager.goToLocation(\n $.PercNavigationManager.VIEW_EDIT_TEMPLATE,\n querystring.site,\n null,\n null,\n null,\n querystring.path,\n null,\n memento\n );\n }", "function getTemplateDenialMessage(id, email, message) {\n\n return new Promise(function (resolve, reject) {\n let body = `\n <div align=\"center\" class=\"button-container center \" style=\"padding-right: 10px; padding-left: 10px; padding-top:10px; padding-bottom:10px;\">\n <!--[if mso]><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;\"><tr><td style=\"padding-right: 10px; padding-left: 10px; padding-top:10px; padding-bottom:10px;\" align=\"center\"><v:roundrect xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w=\"urn:schemas-microsoft-com:office:word\" href=\"http://138.68.19.227:7000/verification/${id + '/' }\" style=\"height:31pt; v-text-anchor:middle; width:150pt;\" arcsize=\"10%\" strokecolor=\"#D61A1A\" fillcolor=\"#D61A1A\"><w:anchorlock/><v:textbox inset=\"0,0,0,0\"><center style=\"color:#ffffff; font-family:Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size:16px;\"><![endif]-->\n ${message}\n <!--[if mso]></center></v:textbox></v:roundrect></td></tr></table><![endif]-->\n </div>\n <!--[if (!mso)&(!IE)]><!--></div><!--<![endif]-->\n </div>\n </div>\n <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->\n </div>\n </div>\n </div> <div style=\"background-color:transparent;\">\n <div style=\"Margin: 0 auto;min-width: 320px;max-width: 500px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;\" class=\"block-grid \">\n <div style=\"border-collapse: collapse;display: table;width: 100%;background-color:transparent;\">\n <!--[if (mso)|(IE)]><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td style=\"background-color:transparent;\" align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width: 500px;\"><tr class=\"layout-full-width\" style=\"background-color:transparent;\"><![endif]-->\n\n <!--[if (mso)|(IE)]><td align=\"center\" width=\"500\" style=\" width:500px; padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;\" valign=\"top\"><![endif]-->\n <div class=\"col num12\" style=\"min-width: 320px;max-width: 500px;display: table-cell;vertical-align: top;\">\n <div style=\"background-color: transparent; width: 100% !important;\">\n <!--[if (!mso)&(!IE)]><!--><div style=\"border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;\"><!--<![endif]-->\n\n \n <div class=\"\">\n <!--[if mso]><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td style=\"padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px;\"><![endif]-->\n <div style=\"color:#555555;line-height:150%;font-family:Arial, 'Helvetica Neue', Helvetica, sans-serif; padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px;\">\t\n <div style=\"font-size:12px;line-height:18px;color:#555555;font-family:Arial, 'Helvetica Neue', Helvetica, sans-serif;text-align:left;\"><p style=\"margin: 0;font-size: 14px;line-height: 21px\"><span style=\"font-size: 15px; line-height: 22px;\">If there are any problems with the button, just copy and paste this link in your browser address bar:</span></p><p style=\"margin: 0;font-size: 14px;line-height: 21px\"><span style=\"font-size: 15px; line-height: 22px; color: rgb(0, 0, 255);\">https://platform.senorcoders.com/verification/${id + '/' }</span></p></div>\t\n </div>\n `;\n fs.readFile(\"./template_emails/verification_code_part1.html\", \"utf8\", function (err, data) {\n if (err) { return reject(err); }\n fs.readFile(\"./template_emails/verification_code_part2.html\", \"utf8\", function (err, data2) {\n if (err) { return reject(err); }\n resolve(data + body + data2);\n });\n });\n });\n}", "function getTemplateXML(templateID) {\n\t\n\tvar params = [{\n\t\t'name': 'template_id',\n\t\t'value': templateID\n\t}];\n\t\n\treturn executeRESTCall(restMessageTemplateGetName, 'get', params);\n\t\n}", "function getTemplate(templateObject, templateFilter){\n var tmp = '';\n tmp = $(templateObject).filter(templateFilter).html();\n return tmp;\n}", "loadTemplates() {\n return mailTemplates.cacheTemplates();\n }", "function byId(id) {\n return document.getElementById(id);\n }", "fetchTemplates() {\n\t\treturn fetch(\"http://127.0.0.1:4130/v0/notify/templates\", {\n\t\t\tmethod: \"GET\",\n\t\t})\n\t\t\t.then(response => {\n\t\t\t\treturn response.json();\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tconsole.error(err);\n\t\t\t});\n\t}", "function template(name) {\n return TEMPLATES[name];\n}", "function tmpl(tmpl_id,data){\n\ttry {\n\t\tif ( typeof tmpl.cache == 'undefined' ) {\n\t\t\ttmpl.cache = new Array();\n\t }\n\t\tif( tmpl.cache[tmpl_id]!=null ){\n\t\t\tvar fn = tmpl.cache[tmpl_id];\n\t\t\treturn fn(data);\t\t\n\t\t}\n\t\tstr = document.getElementById(tmpl_id).innerHTML;\n\t\tstr = str.replace(/\\\\/g, \"@SPC@\");\n\t\tstr = str.replace(/'/g, \"&apos;\");\n\t\tfnStr = \"var p=[],print=function(){p.push.apply(p,arguments);};\" +\n\t \n\t // Introduce the data as local variables using with(){}\n\t \"with(obj){p.push('\" +\n\t \n\t // Convert the template into pure JavaScript\n\t str\n\t .replace(/[\\r\\t\\n]/g, \" \")\n\t .split(\"<%\").join(\"\\t\")\n\t .replace(/((^|%>)[^\\t]*)'/g, \"$1\\r\")\n\t .replace(/\\t=(.*?)%>/g, \"',$1,'\")\n\t .split(\"\\t\").join(\"');\")\n\t .split(\"%>\").join(\"p.push('\")\n\t .split(\"\\r\").join(\"\\\\'\")\n\t + \"');}return p.join('');\";\n\t\tfnStr = fnStr.replace(/@SPC@/g, \"\\\\\");\n\t\tvar fn = new Function(\"obj\", fnStr);\n\t\ttmpl.cache[tmpl_id] = fn;\n\t\treturn fn(data);\n\t} catch (e) {\n\t\tlog(e, 'rendering');\n\t}\n}", "function openEmailTemplate( filename ) {\n try {\n return fs.readFileSync( filename, \"utf8\" );\n } catch ( e ) {\n console.error( \"Error opening \\\"\" + filename + \"\\\": \" + e.message );\n return undefined;\n }\n}", "function apiurltemplatejob(Id,IdT){\n return `${apiurljobgrouptemplate}/${Id}/TemplateJobs/${IdT}`;\n}", "getById(id) {\r\n return this._byId[id]\r\n }", "function byId(id) {\r\n return document.getElementById(id);\r\n }", "function getMeetingByMeetingID()\r{\r\taa.print(\"--------------this getMeetingByMeetingID method-------------\");\r\t//var calendarID = \"1106\" ;\r\t//var meetingID = \"22449\" ;\r var calendarID = \"1706\" ;\r\tvar meetingID = \"29494\" ;\r\tvar result = aa.meeting.getMeetingByMeetingID(calendarID,meetingID);\r\taa.print(\"Meeting Name:\" + result.output.getMeetingName());\r\r\tvar template =result.output.getTemplate();\r\r getTemplateForSimple(template);\r\t\r}", "function getTemplate(id, title, cover){\n var template = '<li><div style=\"text-align: center\">'\n template += '<img src='+cover+' onclick=\"openLink('+id+')\" />'\n template += '<span class=\"title\">'+title+'</span>'\n template += '</div></li>'\n\n return template\n}", "function getTemplate (path) {\n return fetch(_browser.extension.getURL(path))\n .then(response => response.text())\n .then(data => {\n let $div = document.createElement(\"div\");\n $div.innerHTML = data;\n return $div;\n })\n .catch(error => {\n console.error(error);\n });\n }", "static get template() {\n return template;\n }", "find(id){\n\t\tvar $views = this.$views\n\t\tif(id.constructor === RegExp){\n\t\t\tfor(let key in $views)\t{\n\t\t\t\tif(key.match(id)) return $views[key]\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tfor(let key in $views)\t{\n\t\t\t\tif(key === id) return $views[key]\n\t\t\t}\n\t\t}\n\t\tfor(let key in $views)\t{\n\t\t\tlet res = $views[key].find(id)\n\t\t\tif(res) return res\n\t\t}\n\t}", "function tswTabbedContentGetForId(id)\n{\n\tvar tc = tswTabbedContentMap[id];\n\tif(tc == null)\n\t{\n\t\ttc = new TSWTabbedContent(id);\n\t\ttswTabbedContentMap[id] = tc;\n\t}\n\treturn tc;\n}", "async myTemplates(parent, args, ctx, info) {\n // check if the user has permission to see all users\n if (!ctx.request.userId) {\n throw new Error(\"You must be logged in\");\n }\n\n // query parameters where author is the current user\n return ctx.db.query.templates(\n {\n where: {\n author: {\n id: ctx.request.userId,\n },\n },\n },\n info\n );\n }", "function getTemplate (template, templateUrl) {\n\t\t\t\t\tvar deferred = $q.defer();\n\t\t\t\t\tif(template) {\n\t\t\t\t\t\tdeferred.resolve(template);\n\t\t\t\t\t} else if(templateUrl) {\n\t\t\t\t\t\t$http({method: 'GET', url: templateUrl, cache: true})\n\t\t\t\t\t\t\t.then( function (result) {\n\t\t\t\t\t\t\t\tdeferred.resolve(result.data);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.catch( function (error) {\n\t\t\t\t\t\t\t\tdeferred.reject(error);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdeferred.reject(\"No template or templateUrl has been specified\");\n\t\t\t\t\t}\n\t\t\t\t\treturn deferred.promise;\n\t\t\t\t}", "function getNoteElementById(id) {\n try {\n var noteElms = document.getElementsByTagName(\"icnote\");\n\n for (var i = 0, len = noteElms.length; i < len; i++) {\n var noteElm = noteElms[i];\n\n var noteId = noteElm.getAttribute(\"id\");\n if (noteId == id) {\n return noteElm;\n }\n }\n } catch (e) {\n window.TextSelection.jsError(\"getNoteElementById\\n\" + e);\n }\n}", "function getById(id) {\n return document.getElementById(id);\n }", "getById(id) {\n return View(this).concat(`('${id}')`);\n }", "function getMessageById(messageId){\n\t\treturn Restangular.all('message').get(messageId);\n\t}// end of get message by id function", "getById(id) {\r\n const sg = new SiteGroup(this);\r\n sg.concat(`(${id})`);\r\n return sg;\r\n }", "function id (id){\r\n\t\treturn document.getElementById(id);\r\n\t}", "function getMessage(userId, gmailId, gmailToken, id)\n{\n\tconsole.log(\"----------------Message Id: \" + id + \" Content-------------------\");\n var sync = true;\n var data = null;\n \n \n var options = {\n url: urlRoot + \"/\" + gmailId + '/messages/' + id,\n method: 'GET',\n headers: {\n \"content-type\": \"application/json\",\n\t\t\t\"Authorization\": \"Bearer \"+ gmailToken\n\t\t}\n };\n request(options, function (error, response, body)\n {\n //console.log(\"HTTP response headers are the following:\\n\" + \"Response: \" + JSON.stringify(response) + \"\\nError:\" + error + \"\\nBody\" + JSON.stringify(body) + \"\\n\");\n if (error)\n data = error;\n else{\n\t\t\tdata = JSON.parse(body);\n\t\t\t\n\t\t \n\t\t}\n sync = false;\n });\n while(sync) {require('deasync').sleep(100);}\n return data;\n\n}", "function getMsgBody(mailid) {\r\n\t\t$(mailid).innerHTML = '<img src=\"/images/loading.gif\" width=\"43\" height=\"11\" alt=\"\" title=\"Loading\" />';\r\n\t\tif (interceptCall('getMsgBody', mailid)) return;\r\n\t\tvar url = '/nile.php?what=showMailBody&updateelem='+mailid+'';\r\n\t\tvar ajax = new Ajax.Request(url,{ onComplete: display });\r\n\t\tfunction display(REQ){\r\n\t\t\tREQ = runHooks('getMsgBody', REQ, mailid);\r\n\t\t\t$(mailid).innerHTML = REQ.responseText;\r\n\t\t}\r\n\t}", "get(id) {\n\n }", "function get(id) {\r\n\tvar element = getEle(id);\r\n\treturn element;\r\n}", "async getReportById(id) {\n\t\tconst connection = await this.db.connect();\n\t\ttry {\n\t\t\tconst { rows } = await connection.query(\n\t\t\t\t\"select * from tbldocuments where id = $1\",\n\t\t\t\t[id]\n\t\t\t);\n\t\t\tif (rows.length === 0) {\n\t\t\t\treturn { isFound: false };\n\t\t\t}\n\t\t\treturn rows[0];\n\t\t} catch (err) {\n\t\t} finally {\n\t\t\tconnection.release();\n\t\t}\n\t}", "function getView(id){\n var result = undefined;\n var searchId = parseInt(id);\n for (i =0; i < views.length && result === undefined; ++i){\n var view = views[i];\n if (view['_id'] === searchId) result = view;\n };\n return result;\n}", "function g_link(template, id) {\r\n return \"/\" + template.id + \"/\" + id;\r\n}", "function getTemplate(name, selector) {\n let link = document.querySelector('link[name=\"'+ name + '\"]');\n let template = link.import.querySelector(selector);\n let clone = $(document.importNode(template.content, true));\n\n return clone;\n}", "function getObj(id) {\n\treturn $(id);\n}", "function get(id) {\n return document.getElementById(id);\n }", "function getPopupObject(myId) {\n if (document.getElementById(myId)) {\n return document.getElementById(myId);\n }\n else {\n return window.document[myId];\n }\n }", "function templateShow(req){\n Sunstone.runAction(\"Template.show\",req.request.data[0][0]);\n}", "function getpollbyid(id, req, res, next){\n polls.find({_id: id}, function(err, poll){\n if(err) {\n res.redirect('/404');\n }\n else{\n res.locals.poll = poll;\n next();\n }\n })\n}", "findTaskById(id) {\n return this.addTask.filter(task => task.id === id)[0]\n }", "get template() { return this._template; }", "function byId( id ){ return document.getElementById( id ); }", "function loadTemplate (templateName, contexts) {\n let template = new EmailTemplate(path.join(__dirname, 'templates', templateName));\n return Promise.all(contexts.map((context) => {\n return new Promise((resolve, reject) => {\n template.render(context, (err, result) => {\n if (err) reject(err);\n else resolve({\n email: result,\n context\n });\n });\n });\n }));\n}", "get(id)\n {\n return this._fetch(this._url + '/' + id);\n }", "function getId(id) {\n\treturn \"tasks.\"+id;\n}", "function compileTemplate(templateId)\n\t{\n\t\treturn _.template($(\"#\" + templateId).html());\n\t}", "function renderTemplate(template, id) {\r\n \r\n var data;\r\n\r\n if (data = PPA.templateAssociations[id])\r\n template = Mustache.to_html(template, data);\r\n\r\n x$(stage).inner(template);\r\n \r\n\t//console.log('stage: '+stage); \t\r\n\t\r\n \tif(stage == '#mainStage') {\r\n\t \tif(PPA.scrollers !== undefined) {\r\n\t \t if( PPA.scrollers.main !== undefined) {\r\n\t \t\t//console.log('destroy PPA.scrollers.main1');\r\n\t \t\tPPA.scrollers.main.destroy();\r\n\t \t }\r\n\t \t}\r\n\t \telse if( PPA.scrollers == undefined) {\r\n\t \t\t//console.log('new PPA.scrollers');\r\n\t \t PPA.scrollers = {};\r\n\t \t}\r\n\t PPA.scrollers.main = new iScroll('mainContent');\r\n\t} else {\r\n\t \tif(PPA.scrollers.modal!=undefined) PPA.scrollers.modal.destroy();\r\n\t PPA.scrollers.modal = new iScroll('modalStage');\r\n\t}\r\n\r\n // handle context-specific rendering; i.e. title for modal view\r\n PPA.stageHandlers.attempt(stage, [template]);\r\n\r\n // bindings - forms, buttons, whatever\r\n if( PPA.bindings != null ) {\r\n PPA.bindings.global();\r\n PPA.bindings.attempt(id);\r\n }\r\n\r\n // save current state in memory\r\n PPA.templates.current = id;\r\n\r\n\t//console.log('main stage: '+PPA.scrollers.main); \t\r\n window.scrollTo(0,0);\r\n\t setTimeout(function() {\r\n\t \t//PPA.scrollers.main.refresh();\r\n\t \t//PPA.scrollers.modal.refresh();\r\n\t }, 100);\r\n\t \t \r\n\t x$('select, input[type=\"submit\"]').on('touchstart', function(e){\r\n\t \te.stopPropagation();\r\n\t }, false);\r\n }", "function fetchModalTemplate(name){\n var url = modalsPath + name;\n return $http.get(url, {cache: $templateCache});\n }", "function my_getbyid(id)\n{\n\titm = null;\n\t\n\tif (document.getElementById)\n\t\titm = document.getElementById(id);\n\n\telse if (document.all)\n\t\titm = document.all[id];\n\n\telse if (document.layers)\n\t\titm = document.layers[id];\n\n\t\n\treturn itm;\n}", "function deleteMail(id) {\n \tgetHtmlGet(\"http://www.as-admin.net/cgi-bin/live/mail/ajaxDeleteMail.pl?id=\" + id,markMailDeleted);\n\tlogInfo(\"deleteMail fired\");\n}", "function composeMail(to,id) {\r\n\t\tvar url = '/nile.php?what=composeMail&toid='+to+'&id='+id+'';\r\n\t\tvar ajax = new Ajax.Request(url,{ onComplete: display });\r\n\t\tfunction display(REQ){\r\n\t\t\tREQ = runHooks('composeMail', REQ, to, id);\r\n\t\t\tEffect.Appear('scrollsbox',{duration:0.3});\r\n\t\t\t$('scrollsbox').innerHTML = REQ.responseText;\r\n\t\t}\r\n\t}", "find(id) {\n return this._list.getValue().find((space) => space.id === id || space.email === id);\n }", "Get(id) {\n\t\treturn this.obj.filter(function(o){return o.id == id;})[0];\n\t}", "function EmailTemplate( template, data ) {\n this.temp = openEmailTemplate( template );\n this.data = data;\n}" ]
[ "0.71664476", "0.7139999", "0.6730952", "0.67190117", "0.66259825", "0.655211", "0.6486017", "0.64785486", "0.63310623", "0.6265699", "0.6206418", "0.60506135", "0.6019164", "0.58744156", "0.57988477", "0.5760448", "0.57513577", "0.57502556", "0.5726073", "0.57047874", "0.5679725", "0.5653669", "0.5645065", "0.5631454", "0.5615704", "0.5603751", "0.5590394", "0.5575083", "0.55470616", "0.55399257", "0.55081224", "0.54819185", "0.54789346", "0.5474087", "0.545966", "0.5448432", "0.5447135", "0.5434669", "0.54284513", "0.5411758", "0.54059905", "0.5395339", "0.5395203", "0.5387748", "0.5355495", "0.5354369", "0.5327458", "0.5321523", "0.5298415", "0.5289309", "0.52880776", "0.52816474", "0.5275585", "0.52644444", "0.52602845", "0.5259255", "0.525218", "0.52373683", "0.52172", "0.52102315", "0.52082556", "0.52042335", "0.51987135", "0.51901436", "0.51900613", "0.51755506", "0.5172105", "0.5166766", "0.5153534", "0.512937", "0.5126675", "0.5121554", "0.51103586", "0.51098394", "0.5105474", "0.51042795", "0.5103781", "0.5102407", "0.51004446", "0.50984156", "0.5095073", "0.5091402", "0.50896597", "0.50781757", "0.507789", "0.50766295", "0.5067299", "0.50653577", "0.50603354", "0.5059366", "0.5056323", "0.50518745", "0.5047186", "0.50442296", "0.504398", "0.504156", "0.50376743", "0.503308", "0.50278217", "0.50262344" ]
0.5065423
87
accepts template object from client in case if user tests unsaved HTML fills template with preset data for preview purposes
function previewMailTemplatePost(req, res, next) { MailTemplateService.composePreviewMailTemplate(req.body.mailTemplate, req.body.sessionId, function(result) { if (!result.error) { res.send({error: null, template: result}); } else { res.send({error: result.error, template: null}); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadTemplate() {\n if ($.isEmptyObject(oTemplate) === true) {\n oTemplate = $('.template').clone();\n }\n }", "get template() { return this._template; }", "setTemplate(template) {\n this.template = template;\n }", "function singleStorageTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"singleStorageTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var stoktakeRestrictionGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var stocktakingContainer = document.getElementById(\"singleStorageContainer\");\n stocktakingContainer.innerHTML = stoktakeRestrictionGeneratedHTML;\n}", "get template() {\n return this._template;\n }", "function chooseStorageTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"chooseStorageTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var transferRestrictionGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var transferContainer = document.getElementById(\"chooseStorageContainer\");\n transferContainer.innerHTML = transferRestrictionGeneratedHTML;\n}", "setPageStateFromTemplate(template) {\n if (!this.state.globalContextObj.editing) return\n if (window.confirm(`Are you sure you want to apply \"${template.title}\" as a template? The current state of the page will be lost.`)) {\n this.setState((state, props) => {\n state.pages[state.globalContextObj.editing][\"sections\"] = template.template.sections || []\n state.pages[state.globalContextObj.editing][\"style\"] = template.template.style || {}\n state.pages[state.globalContextObj.editing][\"className\"] = template.template.className || \"\"\n return {\n pages: state.pages,\n }\n })\n }\n }", "_validateTemplate(template) {\n const that = this;\n let templateContent = '',\n hasBindings = false,\n regex = /{{\\w+}}/g;\n\n if (typeof template === 'function') {\n templateContent = template();\n }\n\n if (!('content' in document.createElement('template'))) {\n that.error(that.localize('htmlTemplateNotSuported', { elementType: that.nodeName.toLowerCase() }));\n that.itemTemplate = null;\n return;\n }\n\n if (template instanceof HTMLElement) {\n templateContent = template.innerHTML;\n }\n else {\n template = document.getElementById(template);\n templateContent = template ? template.innerHTML : '';\n }\n\n if (regex.exec(templateContent)) {\n hasBindings = true;\n }\n\n return { content: templateContent, hasBindings: hasBindings };\n }", "function stocktakingTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"stocktakingTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var stocktakingStorageGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"stocktakingContainer\");\n storageContainer.innerHTML = stocktakingStorageGeneratedHTML;\n}", "get template() {\n if (this._template === undefined) {\n this._template = JSON.parse(fs.readFileSync(this.templateFullPath, 'utf-8'));\n }\n return this._template;\n }", "function TemplateInput() {}", "function stocktakingTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"stocktakingTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var stocktakingStorageGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"stocktakingContainer\");\n storageContainer.innerHTML = stocktakingStorageGeneratedHTML;\n}", "function getHTMLTemplate() {\n\t\tvar template = require('text!assets/templates/template.html');\n\t\tEditorManager.getCurrentFullEditor()._codeMirror.setValue(template);\n\t}", "function setUserTemplate() {\n // Get handlebars template\n // And compile it (populate data)\n var userData = JSON.parse(sessionStorage.getItem('behanceUser'));\n var getTemplate = $('#profile-template').html();\n var template = Handlebars.compile(getTemplate);\n var result = template(userData);\n $('#about').html(result);\n $('#about .loading-img').remove();\n }", "function storageRestrictionTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"storageRestrictionTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var userRestrictionGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var userContainer = document.getElementById(\"storageRestrictionContainer\");\n userContainer.innerHTML = userRestrictionGeneratedHTML;\n}", "function chooseStorageStocktakTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"chooseStorageStocktakTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var stoktakeRestrictionGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var stocktakingContainer = document.getElementById(\"chooseStorageStocktakContainer\");\n stocktakingContainer.innerHTML = stoktakeRestrictionGeneratedHTML;\n}", "_handleItemTemplate() {\n const that = this;\n let template = that.itemTemplate;\n\n if (!('content' in document.createElement('template'))) {\n that.error(that.localize('htmlTemplateNotSuported', { elementType: that.nodeName.toLowerCase() }));\n return;\n }\n\n if (!template) {\n return that._defaultItemTemplate(that.value);\n }\n\n template = document.getElementById(template);\n\n if (template === null || !('content' in template)) {\n that.error(that.localize('invalidTemplate', { elementType: that.nodeName.toLowerCase(), property: 'template' }));\n return;\n }\n\n const content = template.innerHTML,\n regex = /{{\\w+}}/g;\n\n return content.replace(regex, that.value);\n }", "static get template() {\n return template;\n }", "function storageRestrictionTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"storageRestrictionTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var storageRestrictionGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"storageRestrictionContainer\");\n storageContainer.innerHTML = storageRestrictionGeneratedHTML;\n}", "_tpl ( name, data ) {\n data = data || {};\n data.$base_url = this._config.base_url;\n\n return {\n html: this._templates[ name ].html( data ),\n text: this._templates[ name ].text( data )\n };\n }", "function getFormTemplate(slice) {\n\t\tconsole.log(\"getting form template for slice: \" + slice);\n\t\tvar template = false;\n\n\t\t// If we're given a slice see what template it has\n\t\tif(slice !== null) {\n\t\t\tconsole.log(\"slice is not null, so looking in slice data\");\n\t\t\tconsole.log(slice.template);\n\t\t\ttemplate = slice.template || false;\n\t\t\tconsole.log(\"slice template is: \" + template);\n\t\t}\n\n\t\t// If not, see if there are stored header settings\n\t\tif(!template) {\n\t\t\tconsole.log(\"loading template from header instead\");\n\t\t\tvar header = localStorage.getItem(\"header\") || false;\n\t\t\tif(header) {\n\t\t\t\theader = JSON.parse(header);\n\t\t\t\ttemplate = header.template || false;\n\t\t\t\tconsole.log(\"header template loaded\");\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(\"header is set? \" + header);\n\t\tconsole.log(\"loaded template: \" + template);\n\n\t\treturn template;\n\t}", "function editStorageTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"editStorageTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var editStorageGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"editStorageContainer\");\n storageContainer.innerHTML = editStorageGeneratedHTML;\n}", "function stocktakingResultTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"stocktakingResultTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var stocktakingStorageGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"stocktakingResultContainer\");\n storageContainer.innerHTML = stocktakingStorageGeneratedHTML;\n}", "function chosenStorageTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"chosenStorageTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var transferProductGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var transferContainer = document.getElementById(\"chosenStorageContainer\");\n transferContainer.innerHTML = transferProductGeneratedHTML;\n}", "function stocktakingResultTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"stocktakingResultTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var stocktakingStorageGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"stocktakingResultContainer\");\n storageContainer.innerHTML = stocktakingStorageGeneratedHTML;\n}", "static getTemplate() {\n return {\n location: null,\n language: null,\n timezone: null,\n locale: null,\n radar: null\n };\n }", "function Template(style, fields) {\n if (!~STYLES.indexOf(style))\n throw new Error(\"Unsupported passbook style \" + style);\n this.style = style;\n this.fields = cloneObject(fields);\n this.keysPath = \"keys\";\n}", "function editUserTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"editUserTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var editUserGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var userContainer = document.getElementById(\"editUserContainer\");\n userContainer.innerHTML = editUserGeneratedHTML;\n}", "function templateShow(req){\n Sunstone.runAction(\"Template.show\",req.request.data[0][0]);\n}", "function parseRestaurantTemplate(template) {\n return RestaurantView.restoPageTemplate(template);\n}", "function showTemplate(template, data){\n\tvar html = template(data);\n\t$('#content').html(html);\n}", "function showTemplate(template, data){\n\tvar html = template(data);\n\t$('#content').html(html);\n}", "function StorageInformationTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"storageInformationTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var storageInformationGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"storageInformationContainer\");\n storageContainer.innerHTML = storageInformationGeneratedHTML;\n}", "function renderedTemplate( date) {\n var app = document.\n}", "function selectStorageTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"selectStorageTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var selectStorageGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"selectStorageContainer\");\n storageContainer.innerHTML = selectStorageGeneratedHTML;\n}", "_validateTemplate(propertyName, template) {\n if (template === null || !template) {\n return;\n }\n\n if (typeof (template) === 'function') {\n return;\n }\n\n const that = this;\n\n if (!('content' in document.createElement('template'))) {\n that.error(that.localize('htmlTemplateNotSuported', { elementType: that.nodeName.toLowerCase() }));\n return;\n }\n\n if (typeof (template) === 'string') {\n template = document.getElementById(template);\n }\n\n\n if (template === null || !('content' in template)) {\n that.error(that.localize('invalidTemplate', { elementType: that.nodeName.toLowerCase(), property: propertyName }));\n return;\n }\n\n return template;\n }", "function userRestrictionTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"userRestrictionTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var UserRestrictionGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var userContainer = document.getElementById(\"userRestrictionContainer\");\n userContainer.innerHTML = UserRestrictionGeneratedHTML;\n}", "function showTemplate(template, data) {\n\tvar html = template(data);\n\t$('#content').html(html);\n}", "function displayTemplate(){\n\t//var glueFrame = Mustache.render(tplContent,data);// alternative version with just one template\n\tvar glueFrame = Mustache.render(tplFrame,data,partials);//ADD for template\n\ttarget.html(glueFrame);// ADD for template\n}", "function loadTemplate(template_url) {\n hideNavMenu();\n resetCompartment();\n $.ajax({\n cache: false,\n type: 'get',\n url: 'template/load',\n dataType: 'text', // Response Type\n contentType: 'application/json', // Sent Message Type\n data: {\n template_file: template_url\n }, // Query Arguments\n success: function(resp) {\n // okitJsonModel = new OkitJson(resp);\n newModel(resp)\n newCompartmentView();\n displayOkitJson();\n displayCompartmentView();\n displayTreeView();\n slideLeftPanel('icons_palette')\n // Display Documentation\n slideRightPanel('documentation_panel')\n },\n error: function(xhr, status, error) {\n console.error('Status : '+ status);\n console.error('Error : '+ error);\n }\n });\n}", "function showTemplate(template, data){\n\tvar html = template(data);\n\t$('#content').html(html);\n}", "function showTemplate(template, data) {\n\tvar html = template(data);\n\t$(\"#content\").html(html);\n}", "function userInformationTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"userInformationTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var UserInformationGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var userContainer = document.getElementById(\"userInformationContainer\");\n userContainer.innerHTML = UserInformationGeneratedHTML;\n}", "function fromTemplate(template_name,data) {\n template_name = template_name.match(/[^\\/].+[^\\/]/)[0].replace(/\\//g,\"-\");\n riot.compile(\n uR.static(\"templates/\"+template_name+\".html\"),\n function(html) { uR.mountElement(template_name,data); }\n );\n }", "function pShowTemplate(template, data){\n var html = template(data);\n $('#content').html(html);\n }", "get template () {\n return DutyTemplateProxy.createFromFirestoreObject(this.object[dutyKeys.template])\n }", "render()\n {\n return template;\n }", "constructor(templateInfo){\n\t\tthis.templateInfo = templateInfo;\n\t}", "function loadPageTemplate(page){\n //if( page.sent==0 ){\n page.output = fs.readFileSync('app.templates/page.template.html');\n updateSection(page,\"%%TITLE%%\",\"Final Project by Martin2018\");\n //}\n}", "function window_new(){\r\n fromTemplate('sure');\r\n}", "_handleTemplate(state, oldValue) {\n const that = this;\n let template, templateTarget, value;\n\n\n if (state === true) {\n template = that.trueTemplate;\n templateTarget = that.$.trueContentContainer;\n value = that.trueContent;\n }\n else if (state === false) {\n template = that.falseTemplate;\n templateTarget = that.$.falseContentContainer;\n value = that.falseContent;\n }\n else {\n template = that.indeterminateTemplate;\n templateTarget = that.$.indeterminateContentContainer;\n value = that.indeterminateContent;\n }\n\n if (oldValue) {\n templateTarget.innerHTML = value ? value : '';\n }\n\n if (template === null || !template) {\n return;\n }\n\n if (typeof template === 'function') {\n template(templateTarget, { value: value });\n return;\n }\n\n if (!('content' in document.createElement('template'))) {\n that.error(that.localize('htmlTemplateNotSuported', { elementType: that.nodeName.toLowerCase() }));\n return;\n }\n\n template = document.getElementById(template);\n if (template === null || !('content' in template)) {\n that.error(that.localize('invalidTemplate', { elementType: that.nodeName.toLowerCase(), property: 'template' }));\n return;\n }\n\n const content = template.content,\n childrenCount = content.childNodes.length,\n regex = /{{\\w+}}/g;\n let bindingString,\n bindingDetails = [];\n\n for (let i = 0; i < childrenCount; i++) {\n bindingString = regex.exec(content.childNodes[i].innerHTML);\n while (bindingString) {\n bindingDetails.push({ childNodeIndex: i, bindingString: bindingString[0] });\n bindingString = regex.exec(content.childNodes[i].innerHTML);\n }\n }\n\n const bindingsCount = bindingDetails.length;\n let clone = document.importNode(template.content, true),\n bindingHolderElement,\n bindingStringsCount;\n\n for (let b = 0; b < bindingsCount; b++) {\n bindingHolderElement = clone.childNodes[bindingDetails[b].childNodeIndex];\n bindingStringsCount = bindingDetails.length;\n for (let i = 0; i < bindingStringsCount; i++) {\n bindingHolderElement.innerHTML = bindingHolderElement.innerHTML.replace(bindingDetails[b].bindingString, value);\n }\n }\n\n templateTarget.innerHTML = '';\n for (let i = 0; i < clone.childNodes.length; i++) {\n if (clone.childNodes[i].outerHTML) {\n templateTarget.innerHTML += clone.childNodes[i].outerHTML;\n }\n }\n }", "function createTemplate (data) {\n var htmlTemplate = `\n <!DOCTYPE html>\n <html>\n <head>\n <title>Authors</title>\n </head>\n <body>\n ${data}\n </body>\n </html>\n `;\n return htmlTemplate;\n}", "_validateTemplate(template) {\n const that = this;\n\n if (!template) {\n return;\n }\n\n if (typeof template === 'function') {\n return;\n }\n\n if (!('content' in document.createElement('template'))) {\n that.error(that.localize('htmlTemplateNotSuported', { elementType: that.nodeName.toLowerCase() }));\n return;\n }\n\n if (!(template instanceof HTMLTemplateElement)) {\n template = document.getElementById(template);\n }\n\n if (template === null || !('content' in template)) {\n that.error(that.localize('invalidTemplate', { elementType: that.nodeName.toLowerCase(), property: 'tokenTemplate' }));\n return;\n }\n\n return template;\n }", "async _getTemplate() {\n if (this._templateSetup === true) return;\n\n const template = this.template();\n const isUrl = template.match(/.html$/);\n\n if (isUrl) {\n // template from built template file\n if (window._templates && (window._templates[template] || window._templates[template.replace(/^\\/+/, '')])) {\n try {\n this._templateMethod = new Function(`return \\`${window._templates[template] || window._templates[template.replace(/^\\/+/, '')]}\\`;`);\n } catch (e) {\n console.error(`Error in html template file ${window._templates[template] || window._templates[template.replace(/^\\/+/, '')]}`);\n throw e;\n }\n // load template url\n } else {\n // this._filePath is generated in the constructor\n const response = await fetch(template);\n const str = await response.text();\n // allow javascript template string syntax in external html file ( ${things} )\n this._templateMethod = new Function(`return \\`${str}\\`;`);\n }\n } else {\n this._templateMethod = this.template;\n }\n\n this._templateSetup = true;\n }", "function loadTemplate() {\n\t\t\tvar $tpl = /^</.test(settings.template)\n\t\t\t\t? settings.template\n\t\t\t\t: $(\"#\" + settings.template).html();\n\n\t\t\t$el.html(us.template($tpl, settings));\n\t\t}", "function groupRestrictionTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"groupRestrictionTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var storageRestrictionGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"groupRestrictionContainer\");\n storageContainer.innerHTML = storageRestrictionGeneratedHTML;\n}", "get template() {\n if (!this.options.template) {\n throw new Error('Not implemented');\n }\n return this.options.template;\n }", "function SaveCustomTemplate( ) {\n\t\t\t\t//get short-codes for current elements\n\t\t\t\tvar content = oxoParser.parseColumnOptions();\n\t\t\t\t//prepare data\n\t\t\t\tvar data = {\n\t\t\t\t\t\taction\t : 'oxo_custom_tabs',\n\t\t\t\t\t\tpost_action : 'save_custom_template',\n\t\t\t\t\t\tmodel\t : content,\n\t\t\t\t\t\tname\t\t: window.customTemplate\n\t\t\t\t\t};\n\t\t\t\t\n\t\t\t\t//way to go\n\t\t\t\t$.post(ajaxurl, data ,function( response ) {\n\t\t\t\t\t\n\t\t\t\t\tif ( response.hasOwnProperty ( 'message' ) ) { //if data updated successfully\n\t\t\t\t\t\tDdHelper.showHideLoader( 'hide' );\n\t\t\t\t\t\tif ( response.hasOwnProperty ( 'custom_templates' ) ) { //if we got data\n\t\t\t\t\t\t\t$('#custom_templates_div').html(response.custom_templates);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\tDdHelper.showHideLoader( 'hide' );\n\t\t\t\t\t\talert ( response.error.text ); // i feel bad.\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t});\n\t\t\t}", "function showProductMacTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"showProductMacTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var storageRestrictionGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"showProductMacContainer\");\n storageContainer.innerHTML = storageRestrictionGeneratedHTML;\n}", "function EmailTemplate( template, data ) {\n this.temp = openEmailTemplate( template );\n this.data = data;\n}", "function updateTemplate () {\n $('#replaceTemplate .spin').show();\n // Take a screenshot form the template for the icon\n var screenshot = document.getElementById('templateGeneratorMain');\n html2canvas(screenshot, {\n 'onrendered': function (canvas) {\n // Getting the cleaning HTML\n var gridster = angular.toJson($scope.elementList);\n var icon = canvas.toDataURL();\n var html = cleanHTML();\n var html_edit = $('#templateGeneratorMain').html();\n // Getting template data\n var templateData = {\n 'id': $scope.id,\n 'icon': icon,\n 'html': html,\n 'html_edit': html_edit,\n 'gridster': gridster\n };\n // Parsing js object to string\n templateData = JSON.stringify(templateData);\n // Ajax request to sabe new template\n $http.post('updateTemplate', {\n 'template': templateData\n }).then(function (response) {\n // If ajax call success but it returns a fail state\n if (response.data.status === 'fail') {\n swal({\n 'title': 'error!',\n 'text': 'server could not validate your data!',\n 'type': 'error',\n 'confirmButtomText': 'close'\n });\n }\n // If ajax call success and it return a success state\n else {\n swal({\n 'title': 'success!',\n 'text': 'Your template have been updated!',\n 'type': 'success',\n 'confirmButtomText': 'cool'\n }, function () {\n // This returns to sendEmail page (previous lines should be removed if this functionality is finally implemented)\n $window.location.href = '#/mailGenerator';\n });\n // Hide the modal\n $('#replaceTemplate').modal('hide');\n $('#replaceTemplate .spin').hide();\n // This removes the has-error class added when the input data was removed setting the form state to pristine\n $scope.saveTemplateForm.$setPristine();\n }\n }, function () {\n // If ajax call does not success\n swal({\n 'title': 'error!',\n 'text': 'Something is wrong with the server, please try again latter',\n 'type': 'error',\n 'confirmButtomText': 'close'\n });\n });\n }});\n }", "_handleItemTemplate(template) {\n\n if (template === null || !template) {\n return;\n }\n\n if (typeof template === 'function') {\n return template;\n }\n\n const that = this;\n\n if (!('content' in document.createElement('template'))) {\n that.error(that.localize('htmlTemplateNotSuported', { elementType: that.nodeName.toLowerCase() }));\n that.itemTemplate = null;\n return;\n }\n\n template = document.getElementById(template);\n if (template === null || !('content' in template)) {\n that.error(that.localize('invalidTemplate', { elementType: that.nodeName.toLowerCase(), property: 'itemTemplate' }));\n that.itemTemplate = null;\n return;\n }\n\n const templateContent = template.content,\n childrenCount = templateContent.childNodes.length,\n regex = /{{\\w+}}/g;\n let bindingString,\n bindingsFound;\n\n that._bindingDetails = [];\n that._template = template;\n for (let i = 0; i < childrenCount; i++) {\n bindingsFound = [];\n while ((bindingString = regex.exec(templateContent.childNodes[i].innerHTML))) {\n bindingsFound.push(bindingString[0]);\n }\n\n if (bindingsFound.length > 0) {\n that._bindingDetails.push({ childNodeIndex: i, bindingString: bindingsFound });\n }\n }\n\n return true;\n }", "function updateTemplate () {\n $('#replaceTemplate .spin').show();\n // Take a screenshot form the template for the icon\n var screenshot = document.getElementById('templateGeneratorMain');\n html2canvas(screenshot, {\n 'onrendered': function (canvas) {\n // Getting the cleaning HTML\n var gridster = angular.toJson($scope.elementList);\n var icon = canvas.toDataURL();\n var html = cleanHTML();\n var html_edit = $('#templateGeneratorMain').html();\n // Getting template data\n var templateData = {\n 'id': $scope.id,\n 'icon': icon,\n 'html': html,\n 'html_edit': html_edit,\n 'gridster': gridster\n };\n // Parsing js object to string\n templateData = JSON.stringify(templateData);\n // Ajax request to sabe new template\n $http.post('updateTemplate', {\n 'template': templateData\n }).then(function (response) {\n // If ajax call success but it returns a fail state\n if (response.data.status === 'fail') {\n swal({\n 'title': 'error!',\n 'text': 'server could not validate your data!',\n 'type': 'error',\n 'confirmButtomText': 'close'\n });\n }\n // If ajax call success and it return a success state\n else {\n swal({\n 'title': 'success!',\n 'text': 'Your template have been updated!',\n 'type': 'success',\n 'confirmButtomText': 'cool'\n }, function () {\n // This returns to sendEmail page (previous lines should be removed if this functionality is finally implemented)\n $window.location.href = 'http://mailtemplate.app:8000/#/mailGenerator';\n });\n // Hide the modal\n $('#replaceTemplate').modal('hide');\n $('#replaceTemplate .spin').hide();\n // This removes the has-error class added when the input data was removed setting the form state to pristine\n $scope.saveTemplateForm.$setPristine();\n }\n }, function () {\n // If ajax call does not success\n swal({\n 'title': 'error!',\n 'text': 'Something is wrong with the server, please try again latter',\n 'type': 'error',\n 'confirmButtomText': 'close'\n });\n });\n }});\n }", "_loadTemplate(template) {\n if (!this._templates[template]) {\n return this._ajaxService.get({\n url: template\n }).then((response) => {\n const TEMPLATE = response.responseText;\n this._templates[template] = TEMPLATE;\n return TEMPLATE;\n }).catch((err) => {\n console.log('error');\n console.log(err);\n });\n }\n return this._templates[name];\n }", "function _requestTemplate() {\n var type = attrs.type || 'html';\n\n if (isFirst && type === 'html' || type === 'angular') {\n _processContent(elem);\n } \n\n if (isFirst) {\n isFirst = false;\n } else {\n\n // broadcast event\n scope.$broadcast(\"foswiki.requestTemplate\");\n //$log.log(\"requestingTemplate \"+attrs.name);\n\n // animate page out only if there is a page in effect as well\n if (pageIn) {\n pageOut = _animate(attrs.pageOutEffect);\n }\n\n // use service api\n foswikiService.requestTemplate(attrs.name, attrs.reload).then(function(data) {\n\n if (typeof(data) !== 'undefined') {\n if (attrs.delay) {\n $timeout(function() {\n _processContent(_insertTemplate(data));\n }, attrs.delay);\n } else {\n if (pageOut) {\n pageOut.then(function() {\n _processContent(_insertTemplate(data));\n });\n } else {\n _processContent(_insertTemplate(data));\n if (pageIn) {\n pageIn.then(function() {\n _clearAnimation();\n });\n }\n }\n }\n }\n });\n }\n }", "templateValues() {\n // create an object w/ the props that were caught by the earlier getters\n const caughtValues = {\n label: this.label,\n left: this.left,\n right: this.right,\n };\n\n // replace mainContainer html w/ the templated string.\n this.mainContainer.innerHTML = this.replace(this.mainContainer.innerHTML, caughtValues);\n }", "get makeupTemplate () {\n return PuntMakeupTemplateProxy.createFromFirestoreObject(this.object[puntMakeupKeys.template])\n }", "function fillTemplate(product) {\n // get template\n const template = document.querySelector(\"#template\")\n // clone template\n const clone = document.importNode(template.content, true)\n // fill template\n const urlTemplate = \"./html/produit.html?id=\"\n clone.querySelector(\".card img\").src = product.imageUrl\n clone.querySelector(\".card img\").alt = product.name\n clone.querySelector(\".card .card-body h2\").textContent = product.name\n clone.querySelector(\".card .card-body a\").href = urlTemplate + product._id\n // send filled template\n document.querySelector(\".templateContainer\").appendChild(clone)\n}", "function stockDeliveryTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"stockDeliveryTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var deliverytGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var deliveryContainer = document.getElementById(\"stockDeliveryContainer\");\n deliveryContainer.innerHTML = deliverytGeneratedHTML;\n}", "visitTemplate(template) { }", "function storageTableTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"displayStorageTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var storageTableGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var storageContainer = document.getElementById(\"displayStorageContainer\");\n storageContainer.innerHTML = storageTableGeneratedHTML;\n}", "render(data, template) {\n var html = template.innerHTML;\n\n // Attempts\n // to compile the tmplate.\n for (var key in data) {\n var placeholder = '{{' + key +'}}';\n\n if (html.search(placeholder) !== -1) {\n html = html.replace(placeholder, data[key]);\n }\n }\n\n this.el.innerHTML = html;\n }", "function opinion2html(opinion) {\r\n //in the case of Mustache, we must prepare data beforehand:\r\n opinion.createdDate = new Date(opinion.created).toDateString();\r\n\r\n //get the template:\r\n const template = document.getElementById(\"mTmplOneOpinion\").innerHTML;\r\n //use the Mustache:\r\n //const htmlWOp = Mustache.render(template,opinion);\r\n const htmlWOp = render(template, opinion);\r\n\r\n //delete the createdDate item as we created it only for the template rendering:\r\n delete opinion.createdDate;\r\n\r\n //return the rendered HTML:\r\n return htmlWOp;\r\n}", "function addNewTemplate() {\n\n\tvar templateHtml = $(\"#template\").html();\n\tvar template = new Template();\n\ttemplate.makeHtml(\"templateContent\", templateHtml, function(templateName) {\n\t\tconsole.log('template call back!!..');\n\n\t\t// jquery日付の呼び出す初期化\n\t\t$(\".datepicker\").datepicker();\n\n\t\t// 連動呼び出す\n\t\titemAreaHide(templateName + 'item');\n\t});\n}", "function testApplyTemplate_display() {\r\n var jsonData =\r\n {\"Main\": {\r\n \"image\": [{\"src\":\"http://images/complex.jpg\", \"alt\":\"ALT1\"},\r\n {\"src\":\"http://images/simple.jpg\", \"alt\":\"ALT2\"}],\r\n \"maindiv\":[{\"text\":\"This is the first one\"},\r\n {}]\r\n }\r\n };\r\n\r\n templateManager.applyTemplate(jsonData, false, templateOps);\r\n\r\n var mainElement = document.getElementById(\"MainT\");\r\n assertTrue(isVisible(mainElement));\r\n}", "function stockDeliveryTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"stockDeliveryTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var deliverytGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag \n var deliveryContainer = document.getElementById(\"stockDeliveryContainer\");\n deliveryContainer.innerHTML = deliverytGeneratedHTML;\n}", "function template(index,templateFn,consts,vars,tagName,attrs,localRefs,localRefExtractor){var lView=getLView();var tView=lView[TVIEW];// TODO: consider a separate node type for templates\nvar tNode=containerInternal(index,tagName||null,attrs||null);if(getFirstTemplatePass()){tNode.tViews=createTView(-1,templateFn,consts,vars,tView.directiveRegistry,tView.pipeRegistry,null);}createDirectivesAndLocals(tView,lView,localRefs,localRefExtractor);var currentQueries=lView[QUERIES];var previousOrParentTNode=getPreviousOrParentTNode();var _native18=getNativeByTNode(previousOrParentTNode,lView);attachPatchData(_native18,lView);if(currentQueries){lView[QUERIES]=currentQueries.addNode(previousOrParentTNode);}queueLifecycleHooks(tView,tNode);setIsParent(false);}", "applyWebTemplate(template) {\r\n const q = this.clone(Web_1, \"applywebtemplate\");\r\n q.concat(`(@t)`);\r\n q.query.set(\"@t\", template);\r\n return q.postCore();\r\n }", "template() { }", "function selectTemplate() {\n\thideError();\n\tvar prj = getProject($( \"span#siteName\" ).text());\n\tvar checked;\n\tvar choices = document.getElementsByName(\"templateSeletion\");\n\tfor (var i = 0; i < choices.length; i++) {\n\t\tif (choices[i].checked) {\n\t\t\tchecked = choices[i];\n\t\t\tbreak;\n\t\t}\n\t}\n\tcopyFile('DefaultTemplate.html', 'template.html', prj.folderid, function(htmlFileID) {\n\t\tcopyFile('DefaultTemplate.css', 'style.css', prj.folderid, function(cssFileID) {\n\t\t\tvar kcms = getKCMS();\n\t\t\tkcms.templates.push({ \"title\": \"default\", \"htmlID\": htmlFileID, \"cssID\": cssFileID });\n\t\t\tsetKCMS(kcms);\n\t\t\t$( \"div#selectTemplate\" ).css('display', 'none');\n\t\t\tupdateKCMS(function () {\n\t\t\t\tloadProject(prj.folderid);\n\t\t\t});\t\n\t\t});\n\t});\n}", "function createFormTemplate( itcb ) {\n // if no form to look up then we can skip this step\n\n formOptions.callback = onFormTemplateCreated;\n Y.dcforms.createTemplate( formOptions );\n\n function onFormTemplateCreated( err, newFormTemplate ) {\n if ( !err && !newFormTemplate ) { err = 'Could not create form template'; }\n if ( err ) { return itcb( err ); }\n\n template = newFormTemplate;\n template.highlightEditable = false;\n template.fromDict( editTemplate.toDict() );\n template.mode = 'locked';\n itcb( null );\n }\n }", "function makeTemplate() {\n return html`\n\n <div class=\"display-div\"> </div>\n\n `;\n}", "function fillTemplate(state, template) {\n if (template instanceof Array) {\n return template.map(v => fillTemplate(state, v));\n }\n if ({}.constructor === template.constructor) {\n return Object.entries(template).reduce((p, [k, v]) => ({\n ...p,\n [k]: fillTemplate(state, v),\n }));\n }\n return template.replace(\n /{{([a-z_-]+)}}/g,\n (_, name) => state[name].submitValue || state[name],\n );\n}", "function openRootTemplate(tmp) {\n\n // Create an \"empty\" template\n var template = {\n raw: undefined,\n pre: undefined,\n dom: undefined,\n root: undefined,\n parent: undefined,\n view: undefined\n }\n\n // Set the root \"root\"\n template.root = template;\n\n // Establish the pattern thhat identifies \"id\" from \"raw\" temlate\n var pattern = /^[a-z0-9]+$/i;\n\n // Establish the \"raw\" template - \"id\" may be a reference to a \"template\" located in the DOM or raw HTML template text \n if (pattern.test(tmp) == true)\n template.raw = loadTemplate(tmp);\n else\n template.raw = tmp;\n\n // Pre-Proccess the template\n template = preProcessTemplate(template);\n\n // Set the \"dom\"\n template.dom = parseTemplateHTML(template.pre);\n\n // Return \n return template;\n\n }", "constructor() {\n super(template);\n }", "createdCallback () {\n this._template = document.createElement('template');\n this._template.innerHTML = tmpl;\n }", "template() {\n return '';\n }", "template() {\n return '';\n }", "template() {\n return '';\n }", "template() {\n return '';\n }", "static get template() {\n if (!!!_PROPERTIES_.get(this).template)\n _PROPERTIES_.get(this).template = getTemplate.call(this);\n return _PROPERTIES_.get(this).template\n }", "getTemplate() {\n if (this.state.route === '/add') {\n return addTemplate;\n }\n if (this.state.route === '/ad') {\n return displayTemplate;\n }\n if (this.state.route === '/edit') {\n return editTemplate;\n }\n if (this.state.route === '/report') {\n return reportTemplate;\n }\n // Fallback\n return template;\n }", "InitializeFromTemplate() {\n\n }", "function test_dynamic_dialog_fields_ansible_tower_templates() {}", "function testInstantiateTemplate_nameValues() {\r\n var template = ShadowTemplates[\"MainT\"];\r\n var dictionaryContext =\r\n [{\"Main\": {\"id\":\"1234\",\r\n \"caption\":\"<b>Caption</b>\",\r\n \"src\":\"http://images/simple.jpg\"}\r\n }];\r\n var instance = template.instantiateDom(dictionaryContext, '');\r\n document.body.insertBefore(instance, document.body.childNodes[0]);\r\n var anchorElement = document.getElementById(\"anchor\");\r\n assertEquals(\"http://servlet/#id=1234\", anchorElement.href);\r\n assertEquals(\"this is the <b>Caption</b>\", anchorElement.innerHTML);\r\n}", "function clearProfileContentInTemplate() {\n\t// For now, we re-load the blank template from the service rather\n\t// than clearing values on the client side.\n\tvar templateId = $('input[name=componentname]').val();\n\tdisplayTemplate(templateId, 'REFRESH');\n}", "function getCustomTemplateContent ( templateName ) {\n\t\t\t\n\t\t\t\t//show loader\n\t\t\t\tDdHelper.showHideLoader('show','');\n\t\t\t\t//setup data\n\t\t\t\tvar data = {\n\t\t\t\t\t\t\t\taction\t\t: 'oxo_custom_tabs',\n\t\t\t\t\t\t\t\tpost_action : 'load_custom_template',\n\t\t\t\t\t\t\t\tname\t\t: templateName\n\t\t\t\t};\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t$.post(ajaxurl, data ,function( response ) {\n\t\t\t\t\t\n\t\t\t\t\tvar data = {\n\t\t\t\t\t\t\t\t\taction\t\t : 'oxo_content_to_elements',\n\t\t\t\t\t\t\t\t\tcontent\t\t : response\n\t\t\t\t\t};\n\t\t\t\t\t\n\t\t\t\t\t$.post(ajaxurl, data ,function( response ) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t//turn off tracking first, so these actions are not captured\n\t\t\t\t\t\toxoHistoryManager.turnOffTracking();\n\t\t\t\t\t\t//remove all current editor elements first\n\t\t\t\t\t\tEditor.deleteAllElements();\n\t\t\t\t\t\t//reset models with new elements\n\t\t\t\t\t\tapp.editor.selectedElements.reset( response );\n\t\t\t\t\t\t//turn on tracking\n\t\t\t\t\t\toxoHistoryManager.turnOnTracking();\n\t\t\t\t\t\t//capture editor\n\t\t\t\t\t\toxoHistoryManager.captureEditor();\n\t\t\t\t\t\t//hide loads\n\t\t\t\t\t\tDdHelper.showHideLoader('hide');\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}", "function saveTemplate () {\n $('#saveTemplate .spin').show();\n // Take a screenshot form the template for the icon\n var screenshot = document.getElementById('templateGeneratorMain');\n html2canvas(screenshot, {\n 'onrendered': function (canvas) {\n // Getting the cleaning HTML\n var gridster = angular.toJson($scope.elementList);\n var icon = canvas.toDataURL();\n var html = cleanHTML();\n var html_edit = $('#templateGeneratorMain').html();\n // Getting template data\n var templateData = {\n 'name_template': $scope.name_template,\n 'icon': icon,\n 'html': html,\n 'html_edit': html_edit,\n 'gridster': gridster\n };\n // Parsing js object to string\n templateData = JSON.stringify(templateData);\n // Ajax request to sabe new template\n $http.post('saveTemplate', {\n 'template': templateData\n }).then(function (response) {\n // If ajax call success but it returns a fail state\n if (response.data.status === 'fail') {\n swal({\n 'title': 'error!',\n 'text': 'server could not validate your data!',\n 'type': 'error',\n 'confirmButtomText': 'close'\n });\n }\n // If ajax call success and it return a success state\n else {\n swal({\n 'title': 'success!',\n 'text': 'Your template is save!',\n 'type': 'success',\n 'confirmButtomText': 'cool'\n }, function () {\n // This returns to sendEmail page (previous lines should be removed if this functionality is finally implemented)\n $window.location.href = '#/mailGenerator';\n });\n // Hide the modal\n $('#saveTemplate').modal('hide');\n $('saveTemplate .spin').show();\n // Clear the modal data\n $scope.name_template = '';\n $scope.icon_template = '';\n // This removes the has-error class added when the input data was removed setting the form state to pristine\n $scope.saveTemplateForm.$setPristine();\n }\n }, function () {\n // If ajax call does not success\n swal({\n 'title': 'error!',\n 'text': 'Something is wrong with the server, please try again latter',\n 'type': 'error',\n 'confirmButtomText': 'close'\n });\n });\n }});\n }", "function saveTemplate () {\n $('#saveTemplate .spin').show();\n // Take a screenshot form the template for the icon\n var screenshot = document.getElementById('templateGeneratorMain');\n html2canvas(screenshot, {\n 'onrendered': function (canvas) {\n // Getting the cleaning HTML\n var gridster = angular.toJson($scope.elementList);\n var icon = canvas.toDataURL();\n var html = cleanHTML();\n var html_edit = $('#templateGeneratorMain').html();\n // Getting template data\n var templateData = {\n 'name_template': $scope.name_template,\n 'icon': icon,\n 'html': html,\n 'html_edit': html_edit,\n 'gridster': gridster\n };\n // Parsing js object to string\n templateData = JSON.stringify(templateData);\n // Ajax request to sabe new template\n $http.post('saveTemplate', {\n 'template': templateData\n }).then(function (response) {\n // If ajax call success but it returns a fail state\n if (response.data.status === 'fail') {\n swal({\n 'title': 'error!',\n 'text': 'server could not validate your data!',\n 'type': 'error',\n 'confirmButtomText': 'close'\n });\n }\n // If ajax call success and it return a success state\n else {\n swal({\n 'title': 'success!',\n 'text': 'Your template is save!',\n 'type': 'success',\n 'confirmButtomText': 'cool'\n }, function () {\n // This returns to sendEmail page (previous lines should be removed if this functionality is finally implemented)\n $window.location.href = 'http://mailtemplate.app:8000/#/mailGenerator';\n });\n // Hide the modal\n $('#saveTemplate').modal('hide');\n $('saveTemplate .spin').show();\n // Clear the modal data\n $scope.name_template = '';\n $scope.icon_template = '';\n // This removes the has-error class added when the input data was removed setting the form state to pristine\n $scope.saveTemplateForm.$setPristine();\n }\n }, function () {\n // If ajax call does not success\n swal({\n 'title': 'error!',\n 'text': 'Something is wrong with the server, please try again latter',\n 'type': 'error',\n 'confirmButtomText': 'close'\n });\n });\n }});\n }", "function groupRestrictionTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"groupRestrictionTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTemplate);\n var userGroupRestrictionGeneratedHTML = compiledTemplate(data);\n // display template in choosen ID tag\n var userContainer = document.getElementById(\"groupRestrictionContainer\");\n userContainer.innerHTML = userGroupRestrictionGeneratedHTML;\n}", "function fillTemplate(template, data){\r\n var result = template;\r\n\r\n for(var el in data){\r\n var mark = \"{{ \" + el + \" }}\";\r\n result = result.replace(mark, data[el]);\r\n }\r\n\r\n return result;\r\n }" ]
[ "0.6777535", "0.64942014", "0.6331239", "0.63252074", "0.6237417", "0.62366366", "0.62323594", "0.62054545", "0.61904323", "0.6188724", "0.6177985", "0.6174321", "0.6169499", "0.6157663", "0.6141326", "0.6125919", "0.61192334", "0.611431", "0.6111113", "0.61024475", "0.60998464", "0.60702485", "0.605168", "0.6047477", "0.6036157", "0.60295266", "0.5997934", "0.5988252", "0.5975153", "0.59694225", "0.5962743", "0.5962743", "0.59599215", "0.59493685", "0.5948335", "0.59464717", "0.59402126", "0.592256", "0.5913257", "0.5902443", "0.5893147", "0.5892214", "0.58850294", "0.58821714", "0.58785903", "0.58772355", "0.58581287", "0.58502895", "0.584591", "0.5822789", "0.58140063", "0.5813331", "0.5797885", "0.57968676", "0.5793701", "0.57857347", "0.57556975", "0.5753271", "0.57499486", "0.5739931", "0.57383704", "0.5733604", "0.571933", "0.5718893", "0.5716422", "0.57152003", "0.57037085", "0.56973827", "0.5695632", "0.56940055", "0.5690829", "0.5687989", "0.56685483", "0.56666595", "0.56663084", "0.5665162", "0.56645316", "0.56644803", "0.5651532", "0.56452733", "0.56386393", "0.56305", "0.56285125", "0.5624195", "0.5617371", "0.56140053", "0.5610567", "0.5610567", "0.5610567", "0.5610567", "0.5605925", "0.5598973", "0.55904734", "0.5583469", "0.55730176", "0.5572227", "0.5565374", "0.55627805", "0.5562529", "0.55598277", "0.55398303" ]
0.0
-1
Making a POST request
function addCharacter () { // Create object with new character's info var newCharacter = { name: $('.Swname').val(), occupation: $('.Swocc').val(), weapon: $('.Swweapon').val() }; // Make a POST request to the API with the info var request = $.post('https://ironhack-characters.herokuapp.com/characters', newCharacter); function onSaveSuccess (response) { console.debug('BOOM', response); } function onSaveFailure (err) { // Print out the error response console.error(err.responseJSON); } request.done(onSaveSuccess); request.fail(onSaveFailure); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function postRequest() {\n // TODO\n}", "post(url, body, options = {}) {\n return this.request('POST', url, addBody(options, body));\n }", "post(url, data, opt = {}) {\n opt.method = 'POST';\n opt.data = data;\n return this.sendRequest(url, opt);\n }", "function http_post(req_url){\n request.post(\n req_url,\n function(error, response, body) {\n console.log(\"Clickatell POST:\")\n console.log(req_url);\n console.log(body);\n if (!error && response.statusCode == 200) {\n node.send({topic:\"Clickatell POST:\",payload:body});\n } else {\n console.log(error);\n node.send({topic:\"Clickatell ERROR:\",payload:error});\n\t\t\t\t}\n }\n );\n }", "makePOSTRequest(url, headers, body) {\n return this.makeRequest(url, 'POST', headers, body);\n }", "post(url, body, options = {}) {\n return this.request('POST', url, addBody(options, body));\n }", "post(url, body, options = {}) {\n return this.request('POST', url, addBody(options, body));\n }", "post(url, body, options = {}) {\n return this.request('POST', url, addBody(options, body));\n }", "post(url, body, options = {}) {\n return this.request('POST', url, addBody(options, body));\n }", "post(url, body, options = {}) {\n return this.request('POST', url, addBody(options, body));\n }", "post(url, options) {\n return this.request(url, this._addTypeToOptionsFor(options, 'POST'));\n }", "function createPostRequest( url, query, reqMode )\n{\n // reqMode = Request Mode (true = Asynchronous, false = Synchronous)\n req.open( \"POST\", url, reqMode )\n req.setRequestHeader( \"Content-Type\", \"application/x-www-form-urlencoded\" )\n req.send( query )\n}", "function generic_post_request() {\n var request = new XMLHttpRequest();\n\n request.open('POST', url_to_post_to);\n\n // headers if necessary\n request.setRequestHeader(\"dictionary\", \"format\");\n\n // once all data has been transmitted\n request.onreadystatechange = function () {\n if (this.readyState === 4) {\n // do something\n // console.log for debug\n // send data somewhere else maybe\n }\n };\n request.send();\n}", "function post(body) {\n\tif (body)\n\t\trequest(body.url, (res, err) => {\n\t\t\tif (err) return err\n\t\t\treturn console.log(res)\n\t\t})\n}", "function post(url, body) {\n const httpRequest = request(app).post(url);\n httpRequest.send(body);\n httpRequest.set('Accept', 'application/json');\n httpRequest.set('Origin', 'http://localhost:8080');\n return httpRequest;\n}", "function _sendPOSTRequest (url, data) {\n var request = new XMLHttpRequest();\n request.open('POST', url, true);\n request.setRequestHeader('Content-Type', 'application/json');\n request.send(data);\n }", "function post (url, body, done) {\n req('POST', url, null, body, done);\n}", "function post(url, body) {\n return Request\n .post(url)\n .send(body)\n .set('Accept', 'application/json')\n .timeout(TIMEOUT)\n .set('Authorization', 'Bearer ' + jwt())\n .set('X-CSRF-Token', csrfToken());\n}", "post(url, data = {}, succCb = null, errCb = null) {\n return this.request('POST', url, data, succCb, errCb);\n }", "_post (urlPath, obj, portalOpts) {\n const options = {\n method: 'POST',\n data: obj\n };\n return this.request(urlPath, options, portalOpts);\n }", "function POST(){\n \n}", "function makePostRequest(payload, url, res) {\n var options = {\n body: payload\n , json: true\n , url: url\n };\n request.post(options, function (err, response) {\n if (err) {\n return res.json(err);\n }\n else {\n return res.json(response.body);\n }\n });\n}", "function post(url, body) {\n fetch(url, {\n method: 'POST',\n body: JSON.stringify(body),\n })\n .then(response => wappalyzer.log(`POST ${url}: ${response.status}`, 'driver'))\n .catch(error => wappalyzer.log(`POST ${url}: ${error}`, 'driver', 'error'));\n}", "post(url, options) {\n return this.request(url, this._addTypeToOptionsFor(options, 'POST'));\n }", "post(opts) {\n opts.method = \"post\";\n\t\treturn this.request(opts);\n\t}", "function post_to_judobase(data) {\n querystring = require('querystring');\n\n var options = {\n host: config.judobase.url,\n port: 80,\n path: config.judobase.path,\n method: 'GET',\n path: config.judobase.path + '?' + querystring.stringify(data)\n };\n\n var http = require('http');\n var req = http.request(options, function (res) {\n\n });\n req.end();\n}", "function postRESTlet(datain) {\n\n}", "function makePostRequest(req, url, xmlRoot, data, callback) {\n makePostOrPutRequest(req, url, xmlRoot, data, callback, false);\n}", "function post(url, data, callback) {\n request.post({uri:url, body:data, method:'POST', headers:{'Content-type':'application/x-www-form-urlencoded'}}, function (error, response, body) {\n callback(response.statusCode, body);\n });\n}", "function post(url, body) {\n return fetch(url, {\n method: 'POST',\n headers: {'Content-Type': 'application/json; charset=utf-8'},\n body: JSON.stringify(body),\n })\n}", "postData(url, body) {\n var headers = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n };\n fetch(url, {\n method: 'POST',\n headers: headers,\n body: body,\n });\n }", "function post(url) {\n request({\n url: url,\n method: \"GET\"\n })\n}", "function post_request(url, body) {\n return new Promise(function(resolve, reject) {\n const jsonRequest = new XMLHttpRequest();\n jsonRequest.open('POST', url);\n // Only accept 200 success.\n jsonRequest.onload = function() {\n if (this.status == 200) {\n resolve(JSON.parse(jsonRequest.response));\n } else {\n reject({status: this.status, statusText: jsonRequest.statusText});\n }\n };\n\n // Reject all errors.\n jsonRequest.onerror = function() {\n reject({status: this.status, statusText: jsonRequest.statusText});\n };\n jsonRequest.send(body);\n })\n .catch();\n}", "function postName() {\n logPadded(\"/GET \" + AUT_HOSTNAME);\n let post_api = new AUT.POST_API();\n let req = rb.setAPI(post_api)\n .replaceInURL('{{post}}', 'post')\n .replaceInJSONBody('{{name}}','Gabriel')\n .addHeader('Content-Type', 'application/json')\n .replaceInHeaders('{{Bearer}}','MyToken')\n\n let res = req.send();\n let pass = check(res, {\n 'Request returns HTTP 200 OK': (r) => res.status === 200,\n });\n\n logPadded(JSON.stringify(rb.toString(), null, 2));\n logResponseDetails(res);\n return res;\n}", "function postdata(url, data) {\n return httpService(url, data, 'POST');\n }", "function performPostRequest (url, queryParams, onSuccess, onFailure, user, password) {\n var request = new XMLHttpRequest();\n request.onreadystatechange = function() {\n internal.onReady(request, onSuccess, onFailure, \"POST\");\n }\n\n var content = internal.createPostBody(queryParams);\n\n if (user) {\n request.open(\"POST\", url, true, user, password);\n }\n else {\n request.open(\"POST\", url, true);\n }\n\n request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n request.setRequestHeader('Content-Length', content.length);\n request.send(content);\n}", "function makeRequest(url, form) {\n xhr.onreadystatechange = responseMethod\n xhr.open('POST', url)\n xhr.setRequestHeader(\"Content-Type\", \"application/json;charset=UTF-8\")\n xhr.send(form)\n }", "function post(path, data, headers, callback) {\r\n \trequest(path, \"POST\", data, headers, callback);\r\n }", "async post(url, data, addl_headers = {}) {\r\n var headers = HTTPRequest.prototype.build_headers({ 'Content-type': 'application/json' }, addl_headers);\r\n const response = await fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(data) });\r\n return response;\r\n }", "function sendDataByPost (formData) {\n var xmlhttp = new XMLHttpRequest()\n xmlhttp.open('POST', BASE_URL, true)\n xmlhttp.setRequestHeader('Content-Type', 'application/json')\n xmlhttp.send(JSON.stringify(formData))\n}", "sendData(requestMethod, postURL, dataToSubmit) {\n let request = new XMLHttpRequest();\n\n request.open(requestMethod, postURL, true);\n request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n request.send(dataToSubmit);\n }", "sendData(requestMethod, postURL, dataToSubmit) {\n let request = new XMLHttpRequest();\n\n request.open(requestMethod, postURL, true);\n request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n request.send(dataToSubmit);\n }", "function Post(yourUrl, postArticle) {\n var xhr = new XMLHttpRequest(); \n xhr.open(\"POST\", yourUrl, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/json\")\n xhr.setRequestHeader(\"Accept\", \"application/json\")\n xhr.send(postArticle);\n}", "function post(url, body, callback, contentType) {\n var reqUrl = mkUrl(url);\n\n if (contentType === 'application/x-www-form-urlencoded') {\n Request.post(reqUrl)\n .type('form')\n .withCredentials()\n .send(encodeValues(body))\n .end(callback);\n } else {\n Request.post(reqUrl)\n .withCredentials()\n .send(body) // default is JSON\n .end(callback);\n }\n}", "function makePostRequest(url, data) {\n return fetch(url, {\n method: 'POST', // *GET, POST, PUT, DELETE, etc.\n body: data // body data type must match \"Content-Type\" header\n }).then(response => response.json());\n}", "function post(specs) {\n\tvar deferred = Q.defer();\n\trequest.post(specs, function (error, response, body) {\n\t\tif (error) {\n\t\t\tdeferred.reject(new Error(error));\n\t\t} else {\n\t\t\tdeferred.resolve(response)\n\t\t}\n\t});\n\treturn deferred.promise;\n}", "function post(url, data, options) {\n sendRequest(url, \"POST\", data, options);\n }", "function storeData(postBody) { \n // console.log(postBody);\n var xhr = new XMLHttpRequest();\n xhr.open('POST', POST_URL);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.onreadystatechange = function() {console.log(xhr.statusText);}\n xhr.send(JSON.stringify(postBody));\n} // storeData", "function formPost(url, args, cb) {\n const data = stringify(args)\n logger.debug(`formPost: Data ${data}`)\n\n const req = request(\n url,\n {\n method: 'POST',\n headers: {\n 'Content-Length': Buffer.byteLength(data),\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Accept': 'application/json'\n }\n },\n (res) => { fetchResult(res, url, cb) }\n )\n\n req.on('error', (e) => {\n logger.error(`Request error for ${url}: ${e}`)\n cb(e, null, null)\n })\n req.write(data)\n req.end()\n}", "async function submitPOSTRequest(requestBody = {}) {\n\t\treturn fetch(serverEndpointPOSTurl, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tbody: JSON.stringify(requestBody)\n\t\t});\n\t}", "function httpPost(url, data)\r\n{\r\n var http = new XMLHttpRequest();\r\n\thttp.open(\"POST\", url, false);\r\n\t//Send the proper header information along with the request\r\n\thttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\r\n\thttp.send(data);\r\n\treturn http.responseText;\r\n}", "function post_request(url, callback, data){\n $.ajax({\n url : url,\n success : callback,\n type : \"POST\",\n data : data\n });\n }", "function post_request(url, callback, data){\n $.ajax({\n url : url,\n success : callback,\n type : \"POST\",\n data : data\n });\n }", "sendPostRequest(data, url) {\n return this.httpClient.post(url, data, httpOptions).subscribe((result) => result);\n }", "function submitPOST(\n/** @type {{url: string, progress: string, result: string, callback: function, messageBody: string}}*/\n inputObject\n) {\n var theAddress = inputObject.url;\n var progress = inputObject.progress;\n var result = inputObject.result;\n var callback = inputObject.callback;\n var xhr = new XMLHttpRequest();\n var progressMessage = `${theAddress} POST ${inputObject.messageBody}`;\n recordProgressStarted(progress, progressMessage, (new Date()).getTime(), true);\n\n xhr.open(\"POST\", theAddress, true);\n xhr.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n\n xhr.onload = function () {\n recordProgressDone(progress);\n if (callback !== undefined && callback !== null) {\n callback(xhr.responseText, result);\n } else { \n recordResult(xhr.responseText, result);\n }\n };\n xhr.send(inputObject.messageBody);\n}", "post(url, data) {\n return fetch(this.baseURL + url, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(data),\n })\n .then((response) => response.json());\n }", "static async post(url, data = {}) {\n const headers = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded'\n };\n const options = {\n method: 'POST',\n mode: 'cors',\n headers: new Headers(headers),\n cache: 'default',\n body: this.CreateQueryString(data)\n };\n const request = new Request(url, options);\n\n try {\n const response = await fetch(request, options);\n return response.json();\n } catch (error) {\n return error;\n }\n }", "function doRequest(content_type, url, post_data, cb) {\n var req = http.request({\n hostname: '127.0.0.1', \n port: PORT,\n path: url,\n headers: {\"Content-Type\": content_type},\n method: \"POST\"\n }, function (res) {\n \n if (res.statusCode !== 200) {\n return cb(new Error(\"Got non-200 status code: \" + res.statusCode));\n }\n \n var data = \"\";\n \n res.on('data', function (chunk) {\n data += chunk;\n });\n \n res.on('end', function () {\n cb(null, data);\n });\n });\n \n req.on('error', cb);\n req.write(post_data);\n req.end();\n}", "function POST(path) {\n var body = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var headers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return fetch(path, {\n method: 'POST',\n credentials: 'same-origin',\n headers: (0, _ramda.merge)({\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'X-CSRFToken': _cookie2.default.parse(document.cookie)._csrf_token\n }, headers),\n body: body ? JSON.stringify(body) : null\n });\n}", "post(url, data) {\n return fetch(this.getBaseURL() + url, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(data),\n })\n .then((response) => response.json());\n }", "postData(location, body) {\n return this.http.createRequest(location).asPost().withHeader(\"content-type\", \"application/json\").withContent(body).send();\n }", "POST(path, body = {}, opts = {}) {\n if(__DEV__) {\n body.should.be.an.Object;\n opts.should.be.an.Object;\n }\n /* eslint-disable new-cap */\n return Request.POST(this._resolve(path), body, opts);\n /* eslint-enable new-cap */\n }", "function doPost(url, data, callback) {\n\tmakeCall(\"POST\", url, data, callback);\n}", "request(url, form, data) {\n\n const options = {\n url: this.api + url,\n json: true\n };\n\n if (this.proxy) options.proxy = this.proxy;\n\n if (form) {\n options.form = form;\n } else {\n for (let item in data) {\n const type = typeof data[item];\n if (type == 'string' || type == 'object') continue;\n data[item] = JSON.stringify(data[item]);\n }\n options.formData = data;\n }\n\n return new Promise((resolve, reject) => {\n request.post(options, (error, response, body) => {\n if (error || !body || !body.ok || response.statusCode == 404) {\n return reject(error || body || 404);\n }\n return resolve(body);\n });\n });\n\n }", "function xmlpost() {\r\n var x = new XMLHttpRequest(), finished = false;\r\n x.open(method, endpoint + (method == \"GET\" ? (__sco.type(data) == \"string\" ? data : JSON.stringify(data)) : \"\"), true);\r\n __sco.each(headers, function (ix, val) {\r\n if (__sco.type(val) == \"object\" && __sco.type(val.key) == \"string\" && __sco.type(val.value) == \"string\")\r\n x.setRequestHeader(val.key, val.value);\r\n });\r\n if (__sco.type(timeout) == \"number\" && timeout > 0) {\r\n if (\"ontimeout\" in x) {\r\n x.timeout = __sco.type(timeout) != \"number\" ? 0 : timeout;\r\n x.ontimeout = timeouthandler;\r\n } else {\r\n // fallback\r\n x.onabort = timeouthandler;\r\n setTimeout(function () {\r\n x.abort();\r\n }, timeout + 10); // Add 10ms to allow for request setup and connection start\r\n }\r\n }\r\n if (__sco.type(callback) === \"function\") {\r\n if ('onload' in x)\r\n x.onload = callback;\r\n else\r\n x.onreadystatechange = function (e) {\r\n if (!finished && x.readyState == 4) {\r\n finished = true;\r\n callback.call(window, e);\r\n }\r\n }\r\n }\r\n x.send((method == \"GET\" || !__sco.noru(data) ? \"\" : __sco.type(data) !== \"string\" ? SCJSON.stringify(data) : data));\r\n }", "function POST(host, path, form, cbk) {\n var f = urlencode(form)\n var h = baseHeader()\n var r = new Buffer('')\n h['Content-Type'] = 'application/x-www-form-urlencoded'\n h['Content-Length'] = f.length\n var req = http.request({\n \tmethod: 'POST',\n \thostname: host,\n \tpath: path,\n \theaders: h\n }, function(res){\n \tres.on('data', function(d){ r=Buffer.concat([r, d]) })\n \tres.on('end', function() { cbk(null, r, res) })\n \tres.on('error', function(e){ process.stderr.write(e); cbk(null, r, res) })\n })\n req.on('error', function(e){ process.stderr.write(e); cbk(e, undefined, res) })\n req.write(f)\n req.end()\n}", "post(url, data) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\t// note the way that we create the object to pass along with our fetch for a POST\n\t\t\tfetch(url, {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: {\n\t\t\t\t\t'Content-type': 'application/json'\n\t\t\t\t},\n\t\t\t\tbody: JSON.stringify(data)\n\t\t\t})\n\t\t\t\t.then(res => res.json())\n\t\t\t\t.then(data => resolve(data))\n\t\t\t\t.catch(err => reject(err));\n\t\t});\n\t}", "function postRequest(messageText, messageType, placeName){\n var date = new Date();\n var newDate = date.toString();\n const data = JSON.stringify({\n messageText:messageText,\n postTime: newDate,\n messageType: messageType,\n placeName: placeName\n })\n\n const options = {\n hostname: 'cassandra-api.bottlemessage-299107.uc.r.appspot.com',\n port: 443,\n path: '/api/postStuff',\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': data.length\n }\n }\n\n const req = https.request(options, res => {\n console.log(`statusCode: ${res.statusCode}`)\n\n res.on('data', d => {\n process.stdout.write(d)\n })\n })\n\n req.on('error', error => {\n console.error(error)\n })\n\n req.write(data)\n req.end()\n}", "function post(targetUrl, successFunc, errorFunc, data) {\n let req = makeRequest('POST', targetUrl, successFunc, errorFunc);\n req.data = data;\n return $.ajax(req);\n }", "function sendPostRequest( url, data ) {\n if (mockPost) {\n var deferred;\n deferred = $q.defer();\n deferred.resolve({ data: data });\n return deferred.promise;\n } else {\n return $http.post( url, data );\n }\n }", "async function POST(url = '', data = {}) {\n const response = await fetch(url, {\n method: 'POST',\n mode: 'cors',\n cache: 'no-cache',\n credentials: 'same-origin',\n headers: {\n 'Content-Type': 'application/json'\n },\n redirect: 'follow',\n referrerPolicy: 'no-referrer',\n body: JSON.stringify(data)\n });\n return response.json();\n}", "function postToURL( requestURL, next ){\n\n const options = url.parse( requestURL );\n\n options.method = 'post';\n\n http.request( options, ( res )=>{\n\n let statusMessage;\n \n try{\n \n statusMessage = JSON.parse( res.statusMessage );\n\n }catch( err ){\n\n return next( err );\n\n }\n\n next( statusMessage );\n \n } ).end();\n}", "function postRequest(url, data)\n{\n var xmlhttp = new XMLHttpRequest();\n xmlhttp.open(\"post\", url, false);\n xmlhttp.onreadystatechange = function () {\n/*\n if (xmlhttp.readyState !== 4) {\n return -1;\n }\n */\n if ((xmlhttp.status == 200) || (xmlhttp.status == 304)) \n {\n return true;\n }\n return false;\n}\n//xmlhttp.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\");\nxmlhttp.send(data);\n}", "function post_request(host, path, port, data, callback) {\n\tlet post_data = querystring.stringify(data);\n let options = {\n host: host,\n port: port,\n path: path,\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n \"Content-Length\": Buffer.byteLength(post_data)\n }\n };\n\n // Set up the request\n let req = http.request(options, function(res) {\n\t\t\tlet body = \"\";\n\t\t\n res.setEncoding(\"utf8\");\n\t\t\t\n\t\t\t// Incoming data trigger\n res.on(\"data\", function(data) {\n\t\t\t\t\tbody += data;\n });\n\t\t\t\n\t\t\t// End of data trgger\n\t\t\tres.on(\"end\", function() {\n\t\t\t\t\tcallback(JSON.parse(body));\n\t\t\t});\n });\n\t\n // post the data to location\n req.write(post_data);\n req.end();\n\t\n\t// Request error trigger\n\treq.on(\"error\", function(e) {\n\t\tcallback({success: false, status: \"Error\", error: e});\n\t});\n}", "function post(url, data, ctype) {\n var options = {\n body: data,\n headers: {\n \"Content-Type\": ctype,\n Accept: 'application/json'\n }\n };\n var resp = http.requestAuth('POST', url, options);\n if ( resp.statusCode !== 200 ) {\n throw new Error('Entity not created: ' + (resp.body.errorResponse\n ? resp.body.errorResponse.message : resp.body));\n }\n console.log('Success!');\n console.log(resp.body.toString());\n}", "function submitData(data) {\n fetch(url, {\n method: \"POST\",\n body: JSON.stringify(data),\n headers: { \"Content-Type\": \"application/json\", Accept: \"application/json\" }\n });\n}", "function post_function(url, data) {\n return fetch(\n url,\n {\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n method: \"POST\",\n body: JSON.stringify(data)\n });\n}", "post(apiPath, parameters, options, callback) {\n let send = callback ? result.send : result.sendPromised\n return send(apiPath, parameters, 'POST', options, callback)\n }", "function post(path, params, method='post') \n{\n\n const form = document.createElement('form');\n form.method = method;\n form.action = path;\n \n for (const key in params) \n {\n if (params.hasOwnProperty(key)) \n {\n const hiddenField = document.createElement('input');\n hiddenField.type = 'hidden';\n hiddenField.name = key;\n hiddenField.value = params[key];\n \n form.appendChild(hiddenField);\n }\n }\n \n document.body.appendChild(form);\n form.submit();\n}", "function _post(path, body, params = {}) {\n const url = makeUrl(path, params);\n const token = getToken();\n if (getToken()) {\n return request.post(url).send(body).set('Accept', 'application/json').set('Content-Type', 'application/json')\n .set('Authorization', token);\n }\n return request.post(url).send(body).set('Accept', 'application/json').set('Content-Type', 'application/json');\n}", "function Post() {}", "async function postData(url = '', data = {}) {\n\n\tconst response = await fetch(url, {\n\t\tmethod: 'POST',\n\t\tmode: 'cors',\n\t\theaders: {\n\t\t\t// 'Content-Type': 'application/json'\n\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n\t\t\t\"User-Agent\": \"AndroidTranslate/5.3.0.RC02.130475354-53000263 5.1 phone TRANSLATE_OPM5_TEST_1\"\n\t\t},\n\t\tbody: new URLSearchParams(data).toString() // body data type must match \"Content-Type\" header\n\t});\n\treturn await response.json(); // parses JSON response into native JavaScript objects\n}", "function post_action(obj){\r\n$.ajax({\r\n type:\"post\",\r\n url:\"https://5ef88b09ae8ccb0016fd725b.mockapi.io/data_to_do\",\r\n data:obj\r\n})\r\n}", "function generalPOST ( genHost, genPath, post_data, err, res )\n{\n\t// check if arg param err does not exist\n\tif (typeof(err) != \"function\")\n\t{\n\t\terr = function(e) \n\t\t{\n\t\t\tif(debug) debugLog(\"Lost connection to \" + genHost + \"removing from ring\");\n\n\t\t\ttokenRing.removeRingMember(genHost);\n\n\t\t\tprocessApproval(genHost);\n\n\t\t\tif(debug) debugLog(\"generalPOST err called \"+ e);\n\t\t};\n\t}\n\n\t// check if arg param res does not exist\n\tif (typeof(res) != \"function\")\n\t{\n\t\tres = function(r) {} ;\n\t}\n\n\tvar dataString = JSON.stringify( post_data );\n\n\tvar headers = {\n\t\t'Content-Type': 'application/json',\n\t\t'Content-Length': dataString.length\n\t};\n\n\tvar post_options = {\n\t\thost: genHost,\n\t\tport: '3000',\n\t\tpath: genPath,\n\t\tmethod: 'POST',\n\t\theaders: headers\n\t};\n\n\tvar post_request = http.request(post_options, function(res){\n\t\tres.setEncoding('utf-8');\n\t\t\n\t\tvar responseString = '';\n\n\t\tres.on('data', function(data){\n\t\t\tresponseString += data;\n\t\t});\n\n\t\tres.on('end', function(){\n\t\t\t//var resultObject = JSON.parse(responseString);\n\t\t});\n\t});\n\t\n\tpost_request.on('error', err );\n\tpost_request.write(dataString);\n\tpost_request.end();\n}", "async post(url, post) {\n const res = await fetch(url, {\n method: 'POST',\n headers: {\n 'Content-type': 'application/json'\n },\n body: JSON.stringify(post)\n });\n const data = await res.json();\n return data;\n }", "function post_data() {\n $.post('http://hinckley.cs.northwestern.edu/~rbi054/post.php/', \n { data: request_data }, \n function(data, status, xhr) {\n \n $('p').append('status: ' + status + ', data: ' + data);\n\n }).done(function() { console.log('Request done!'); })\n .fail(function(jqxhr, settings, ex) { console.log('failed, ' + ex); });\n }", "post(uri, argsOrCallback, callback) {\n this.request(\"POST\", uri, argsOrCallback, callback);\n }", "function send_request(req_type, req_body) {\n const http_method = 'POST';\n const server_path = 'main.py';\n let xhr = new XMLHttpRequest();\n xhr.open(http_method, server_path, true);\n xhr.setRequestHeader('Content-Type', 'application/json');\n xhr.setRequestHeader(\"req_type\", req_type);\n xhr.setRequestHeader(\"Authorization\", auth_token);\n xhr.send(JSON.stringify(req_body));\n return xhr;\n}", "function send_post(url, data, successfun) {\r\n wx.request({\r\n url: BASE_Server + url, //仅为示例,并非真实的接口地址\r\n method: \"POST\",\r\n header: {\r\n 'content-type': 'application/x-www-form-urlencoded'\r\n },\r\n data: data,\r\n success(res) {\r\n // console.log(res)\r\n successfun(res)\r\n }\r\n })\r\n}", "function postData (data){\n return fetch('https://api.sjonbin.io/b', {\n method: \"POST\",\n headers: {\n 'Content-type': 'aplication/json',\n 'secret-key': SECRET_KEY,\n private: 'true',\n name: 'todo',\n }, \n body: JSON.stringify(data)\n })\n}", "function post(url, query, body, json = true) {\n if(isServerRequest(url)) {\n return serverRequest('post', url, query, body);\n }\n\n const params = getParams(query, encodeQuery);\n const target = url.match(/http/) ? `${url}${params}` : `${API}${url}${params}`;\n\n const req = request.post(target).send(body);\n\n if(!json) {\n req\n .set('Accept', 'application/x-www-form-urlencoded')\n .set('Content-Type', 'application/x-www-form-urlencoded');\n }\n\n const defer = q.defer();\n\n req.end((err, res) => {\n if(res) {\n defer.resolve(res.body);\n } else {\n defer.reject();\n }\n })\n\n return defer.promise;\n}", "static async post(path, body = {}, headers = {}) {\n let fullHeaders = Object.assign(headers, await this._defaultHeaders());\n fullHeaders.Accept = 'application/json';\n fullHeaders['Content-Type'] = 'application/json';\n\n let request = {\n method: 'POST',\n path: path,\n headers: fullHeaders,\n body: JSON.stringify(body),\n };\n return this._call(request);\n }", "function httpPostRequest(theUrl, data, callback) {\n var xmlHttp = new XMLHttpRequest();\n xmlHttp.onreadystatechange = function () {\n if (xmlHttp.readyState == 4 && xmlHttp.status == 200)\n callback(xmlHttp.responseText);\n };\n xmlHttp.open(\"POST\", theUrl, true);\n xmlHttp.send(data);\n}", "function makePost (endpoint, params) {\n return new Promise((resolve, reject) => {\n client.post(endpoint, params, (error, data, response) => {\n if (error) {\n reject(error);\n } else {\n resolve(data);\n }\n });\n });\n }", "function post(url, params) {\n // The rest of this code assumes you are not using a library.\n // It can be made less wordy if you use one.\n var form = document.createElement(\"form\");\n form.setAttribute('method', 'POST');\n form.setAttribute('action', url);\n\n for(var key in params) {\n if(params.hasOwnProperty(key)) {\n var hiddenField = document.createElement('input');\n hiddenField.setAttribute('type', 'hidden');\n hiddenField.setAttribute('name', key);\n hiddenField.setAttribute('value', params[key]);\n\n form.appendChild(hiddenField);\n }\n }\n\n document.body.appendChild(form);\n form.submit();\n}", "function httpPost(address, headers, data, callback, errorCallback) {\n\t\tvar httx = http;\n\n\t\t\tif (address.indexOf('https://') == 0) {\n\t\t\t\thttx = https;\n\t\t\t}\n\n\t\t\tif (address.indexOf('http://') != 0 && address.indexOf('https://') != 0) {\n\t\t\t\tif (errorCallback) {\n\t\t\t\t\terrorCallback(null, null, \"invalid url\");\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar options = url.parse(address);\n\t\t\toptions.method = 'POST';\n\t\t\toptions.headers = headers || {};\n\n\t\t\tvar req = httx.request(options, function(res) {\n\t\t\t\tres.on(\"end\", function () { callback(res.statusCode, res.headers); });\n\t\t\t\tres.on('error', function (error) {\n\t\t\t\t\tif (errorCallback) {\n\t\t\t\t\t\terrorCallback(null, null, error);\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log('error: ');\n\t\t\t\t\tconsole.log(error);\n\t\t\t\t});\n\t\t\t\tres.on('timeout', function (error) {\n\t\t\t\t\tif (errorCallback) {\n\t\t\t\t\t\terrorCallback(null, null, \"timeout\");\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log('error: ');\n\t\t\t\t\tconsole.log(\"res timeout\");\n\t\t\t\t});\n\t\t\t});\n\t\t\treq.setTimeout(20000, function (error) {\n\t\t\t\treq.end();\n\t\t\t\tif (errorCallback) {\n\t\t\t\t\terrorCallback(null, null, \"timeout\");\n\t\t\t\t}\n\t\t\t\tconsole.log('error: ');\n\t\t\t\tconsole.log(\"req timeout\");\n\t\t\t});\n\n\t\t\tif (typeof data !== \"string\") {\n\t\t\t\tdata = JSON.stringify(data);\n\t\t\t}\n\t\t\t\n\t\t\treq.write(data);\n\t\t\treq.end();\n\t}", "async function MakePostRequest() {\n const review = {\n Name: Name,\n Email: Email,\n Date: DateTime,\n Review: Review\n };\n\n const response = await fetch(\"http://localhost:3212/feedbacks\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(review)\n });\n return alert(\"Successful\");\n }", "function postRequest() {\n\n // var formData = new FormData(document.getElementById('myForm'));\n // 'https://jsonplaceholder.typicode.com/todos'\n // JSON.stringify({name:name,msg:msg})\n // `name=${name}&message=${msg}`\n let name = document.getElementById('name').value;\n let msg = document.getElementById('msg').value;\n\n axios({\n method: 'post',\n url: 'https://jsonplaceholder.typicode.com/posts',\n data: `name=${name}&message=${msg}`\n }).then(logResult).catch(logError);\n\n }", "function makeRequest(options, cb, postdata) {\n const req = https.request(options, function(res) {\n var data = '';\n\n res.on('data', function(d) {\n data += d;\n });\n res.on('end', function(d) {\n cb(data);\n });\n });\n req.on('error', function(e) {\n console.error(e);\n cb({error: e});\n });\n if((options.method === 'POST') || (options.method === 'PUT')) req.write(postdata);\n req.end();\n}", "post(url, data) {\n return new Promise((resolve, reject) => {\n fetch(url, {\n method: 'POST', // here we specify what kind of method do me use\n headers: {\n 'Content-type': 'application/json'\n },\n body: JSON.stringify(data) \n })\n .then(res => res.json())\n .then(data => resolve(data)).catch(err => reject(err));\n });\n }", "function processData(postString) {\r\n\tclient = new XMLHttpRequest();\r\n\tclient.open('POST','http://developer.cege.ucl.ac.uk:30266/submitAnswer',true);\r\n \r\n\tclient.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\r\n\t// Code adapted from https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/onreadystatechange\r\n\tclient.onreadystatechange = function () {\r\n\t\tif(client.readyState === 4 && client.status === 200) {\r\n\t\t\tconsole.log(\"Answer submitted successfully\");\r\n\t\t}\r\n\t};\r\n client.send(postString);\r\n}" ]
[ "0.75870794", "0.74879646", "0.744904", "0.7392511", "0.7313302", "0.73070514", "0.73070514", "0.73070514", "0.73070514", "0.73070514", "0.70975596", "0.70383614", "0.698324", "0.6968119", "0.6946639", "0.6946104", "0.694458", "0.6944179", "0.69398004", "0.69073707", "0.6896961", "0.6884116", "0.68633676", "0.68332297", "0.68294114", "0.6821478", "0.6768827", "0.6752965", "0.6747321", "0.6737913", "0.6732862", "0.67319316", "0.6715296", "0.66758215", "0.6657373", "0.66306114", "0.6617545", "0.6604816", "0.6598037", "0.65945196", "0.6590429", "0.6590429", "0.65848136", "0.65843844", "0.65667224", "0.65610474", "0.65454817", "0.65453315", "0.6541613", "0.65040696", "0.64963466", "0.6446277", "0.6446277", "0.6430394", "0.64275163", "0.6420351", "0.6376127", "0.63740236", "0.6373352", "0.63607645", "0.63565576", "0.63559514", "0.6344215", "0.63280076", "0.6319044", "0.631631", "0.63145316", "0.6304877", "0.6302469", "0.6302269", "0.6291532", "0.6286805", "0.62806857", "0.6273508", "0.62516195", "0.62412184", "0.6241029", "0.62290883", "0.6226857", "0.6201088", "0.6200148", "0.6197941", "0.61943567", "0.61937106", "0.6191769", "0.6178329", "0.6175369", "0.617502", "0.61708057", "0.61706066", "0.61671036", "0.61650395", "0.6154435", "0.61456555", "0.6145566", "0.61413985", "0.61250895", "0.6121402", "0.6120448", "0.6113888", "0.6111859" ]
0.0
-1
get the y axis title of the chart
function getGraphTitleFtn() { return obj.selected; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function appendYAxisTitle(svg, plot) {\n svg.append('text')\n .attr('id', 'yTitle')\n .attr('transform', 'translate(' + (plot.padding.left/3) + ','\n + (plot.padding.top + plot.range.y/2) + ') rotate(-90)')\n .text('Concentration %');\n }", "function nameYAxisTitle(axis_shortname){\n\n let axis_name = axis_shortname;\n // console.log(\"Given Axis: \", axis_shortname);\n\n metrics_chosen.map( (metric) => {\n \n // console.log(\"Metric Axis: \", metrics_info[metric].yaxis);\n \n if(metrics_info[metric].yaxis === axis_shortname && metrics_info[metric].name !== axis_shortname){\n axis_name = axis_name + \" (\" + metrics_info[metric].name + \")\";\n }\n });\n\n // if there are no metrics using the y1 axis, set the name to be blank\n if(axis_name === \"y1\"){\n axis_name = \"\";\n }\n\n return axis_name;\n}", "function setYAxisTitleFtn(chart, index, labels) {\n $log.info('setting the Y Axis title: ' + labels[index]);\n chart.options.vAxis.title = labels[index];\n }", "function setYAxisTitleFtn(chart, index, labels) {\n $log.info('setting the Y Axis title: ' + labels[index]);\n chart.options.vAxis.title = labels[index];\n }", "function drawYAxis() {\n paper.leonardo.vLine(plotArea.x, plotArea.y, plotArea.height);\n\n // TODO: Get rid of magic number. Base text on font size instead.\n var valueX = plotArea.x - opts.tickSize,\n valueTextX = plotArea.x - (3 * opts.tickSize);\n\n plot(scaleValues, function (x, y, value) {\n paper.leonardo.hLine(valueX, y, opts.tickSize);\n paper.text(valueTextX, y, value);\n });\n }", "_defineAxisTitle(yAxisTag) {\n // title should be the same for all trends of the axis\n let axisTitle = \"\";\n let axisTitleSet = false;\n\n for (let trend of yAxisTag.trends) {\n let curTitle = trend.getAxisTitle();\n\n if (axisTitleSet) {\n if (axisTitle !== curTitle) {\n axisTitle = \"\";\n break;\n }\n } else {\n axisTitle = curTitle;\n axisTitleSet = true;\n }\n }\n\n yAxisTag.title = axisTitle;\n }", "function createYAxis() {\n return d3.svg.axis().scale(that.y).orient('left').ticks(chart.yAxis.tickCount);\n }", "function createYAxis() {\n return d3.svg.axis().scale(that.y).orient('left').ticks(chart.yAxis.tickCount);\n }", "function customYAxis( g ) {\n\t\t// move axis to align properly with the bottom left corner including tick values\n\t\tg.attr( \"transform\", \"translate(\" + ( -chart_margins.left / 2 ) + \", 0)\" )\n\t\tg.call( yAxis );\n\t\tg.select( \".domain\" );\n\t\tg.attr( \"text-anchor\", \"end\" );\n\t\tg.selectAll( \".tick:not(:first-of-type) line\" ).attr( \"stroke\", \"#777\" ).attr( \"stroke-dasharray\", \"2,2\" );\n\t\tg.selectAll( \".tick text\" ).attr( \"x\", -4 ).attr( \"dy\", 0 );\n\t}", "function customYAxis( g ) {\n\t\t// move axis to align properly with the bottom left corner including tick values\n\t\tchart.attr( \"transform\", \"translate(\" + ( -chart_margins.left / 2 ) + \", 0)\" )\n\t\tchart.call( yAxis );\n\t\tchart.select( \".domain\" );\n\t\tchart.attr( \"text-anchor\", \"end\" );\n\t\tchart.selectAll( \".tick:not(:first-of-type) line\" ).attr( \"stroke\", \"#777\" ).attr( \"stroke-dasharray\", \"2,2\" );\n\t\tchart.selectAll( \".tick text\" ).attr( \"x\", -4 ).attr( \"dy\", 0 );\n\t} // appends y-axis to chart group", "formatYAxis(tickItem) {\n\treturn tickItem.toLocaleString();\n }", "function getAxisLabel(axis) {\n return axis.userOptions && axis.userOptions.description || axis.axisTitle && axis.axisTitle.textStr ||\n axis.options.id || axis.categories && 'categories' || 'Undeclared';\n }", "function yAxis() {\t\t\n return d3.axisLeft(y)\n .tickSize(-width)\n .tickFormat(\"\")\n}", "function modifyYaxisName(z){\n var notation =[];\n for (var i= 0; i<z.length; i++){\n notation.push(`OTU ${z[i]}`)\n }\n return notation;}", "function getAxisLabel(axis) {\n\t\t\treturn axis.userOptions && axis.userOptions.description || axis.axisTitle && axis.axisTitle.textStr ||\n\t\t\t\t\taxis.options.id || axis.categories && 'categories' || 'Undeclared';\n\t\t}", "get title() { return this.Nls(\"Legend_Title\") }", "function createSubtitle(targetData){\n\t//define chart constants\n\tlet svg = d3.select(\".chart\");\n\n\tlet subtitle = svg.append(\"g\")\n\t\t.attr(\"class\", \"chart-subtitle\");\n\tsubtitle.append(\"text\")\n\t\t.attr(\"x\", 70)\n\t\t.attr(\"y\", 50)\n\t\t.attr(\"text-anchor\", \"center\")\n\t\t.style(\"font\", \"15px Archivo\")\n\t\t.style(\"font-style\", \"italic\")\n\t\t.text(targetData.yaxis);\n}", "function _yValue(d) {\n return _.get(d, labelField);\n }", "function Y(d) {\n return yScale(d[1]);\n }", "function getXAxisTitle() {\n\tif(viewerVars.binSize <= 0 || viewerVars.currentBinningOperator == \"raw\") {\n\t\treturn \"<span>\" + \"Raw Data\" + \"</span><span>[\" + 0 + \"(s)]</span>\";\n\t} else {\n\t\treturn \"<span>\" + viewerVars.currentBinningOperator + \"</span><span>[\" + viewerVars.binSize + \"(s)]</span>\";\n\t}\n}", "function Y(d) {\n return yScale(d[1]);\n }", "function Y(d) {\n return yScale(d[1]);\n }", "function Y(d) {\n return yScale(d[1]);\n }", "_drawYGrid(yAxisTag) {\n let layout = this._chartLayout;\n let yAxisConfig = yAxisTag.axisConfig;\n let yAxisLayout = yAxisTag.axisLayout;\n let yAxisRect = yAxisLayout.areaRect;\n\n this._context.textBaseline = \"middle\";\n this._context.font = yAxisConfig.fontSize + \"px \" + this.displayOptions.chartArea.fontName;\n\n let labelMarginT = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 0);\n let labelMarginR = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 1);\n let labelMarginB = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 2);\n let labelMarginL = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 3);\n let prevLblY = NaN;\n let tickL, tickR, minorTickL, minorTickR, axisX, lblX;\n\n if (yAxisConfig.position === scada.chart.AreaPosition.LEFT) {\n this._context.textAlign = \"right\";\n tickR = yAxisRect.right - 1;\n tickL = tickR - yAxisConfig.majorTickSize;\n minorTickR = tickR;\n minorTickL = minorTickR - yAxisConfig.minorTickSize;\n axisX = yAxisRect.right - 1;\n lblX = tickL - labelMarginR;\n } else {\n this._context.textAlign = \"left\";\n tickL = yAxisRect.left;\n tickR = tickL + yAxisConfig.majorTickSize;\n minorTickL = tickL;\n minorTickR = minorTickL + yAxisConfig.minorTickSize;\n axisX = yAxisRect.left;\n lblX = tickR + labelMarginL;\n }\n\n let gridL = layout.plotAreaRect.left + layout.canvasXOffset;\n let gridR = gridL + layout.plotAreaRect.width - 1;\n let axisT = yAxisRect.top + layout.canvasYOffset;\n let axisB = axisT + yAxisRect.height - 1;\n\n for (let y = yAxisLayout.gridStart; y < yAxisTag.max; y += yAxisLayout.gridStep) {\n let ptY = this._trendYToCanvasY(y, yAxisTag);\n\n // horizontal grid line\n if (yAxisConfig.showGridLines) {\n this._setColor(this.displayOptions.plotArea.gridColor);\n this._drawLine(gridL, ptY, gridR, ptY);\n }\n\n // major tick and axis line\n this._setColor(yAxisConfig.lineColor);\n this._drawLine(tickL, ptY, tickR, ptY);\n this._drawLine(axisX, axisT, axisX, axisB);\n\n // minor ticks\n if (yAxisConfig.minorTickCount > 0) {\n for (let minorTickY = y + yAxisLayout.minorTickStep, maxMinorTickY = y + yAxisLayout.gridStep;\n minorTickY < maxMinorTickY && maxMinorTickY < yAxisTag.max; minorTickY += yAxisLayout.minorTickStep) {\n\n let minorTickCnvY = this._trendYToCanvasY(minorTickY, yAxisTag);\n this._drawLine(minorTickL, minorTickCnvY, minorTickR, minorTickCnvY);\n }\n }\n\n // label\n this._setColor(yAxisConfig.textColor);\n let lblY = ptY;\n\n if (isNaN(prevLblY) || prevLblY - lblY > yAxisConfig.fontSize) {\n this._context.fillText(y.toFixed(yAxisLayout.gridDigits), lblX, lblY);\n prevLblY = lblY;\n }\n }\n\n // axis title\n if (yAxisConfig.showTitle && yAxisTag.title) {\n this._context.textAlign = \"center\";\n this._context.save();\n this._context.translate(yAxisRect.left + layout.canvasXOffset, yAxisRect.bottom + layout.canvasYOffset);\n this._context.rotate(-Math.PI / 2);\n let titleY;\n\n if (yAxisConfig.position === scada.chart.AreaPosition.LEFT) {\n this._context.textBaseline = \"top\";\n titleY = labelMarginT;\n } else {\n this._context.textBaseline = \"bottom\";\n titleY = yAxisRect.width - labelMarginB;\n }\n\n this._context.fillText(yAxisTag.title, yAxisRect.height / 2, titleY, yAxisRect.height);\n this._context.restore();\n }\n }", "get yAxisAnnotationTextColor() {\r\n return brushToString(this.i.pi);\r\n }", "function displayAxisTitles (options) {\n var xTitle = $(\"<h3></h3\").attr( {\"id\": \"xtitle\",\n \"class\": \"axistitle\"});\n xTitle.text(options.xaxistitle);\n var yTitle = $(\"<h3></h3\").attr( {\"id\": \"ytitle\",\n \"class\": \"axistitle\"});\n yTitle.text(options.yaxistitle);\n $(\"#chartarea\").append(xTitle,yTitle);\n\n $(\"#xtitle\").css({\n \"align-self\": \"center\",\n \"margin\": \"2px\",\n \"padding\": \"5px\",\n \"position\": \"absolute\",\n \"top\": \"105%\",\n \"font-size\": \"medium\"\n });\n\n$(\"#ytitle\").css( {\n \"left\": \"-20%\",\n \"margin\": \"2px\",\n \"padding\": \"2px\",\n \"position\": \"absolute\",\n \"top\":\"50%\",\n \"transform\": \"rotate(-90deg)\",\n \"font-size\": \"medium\"\n });\n\n}", "function format_y_tooltip_ph(dataPoint) {\n return \" pH: \" + dataPoint.ph;\n }", "function getTitleMarg() {\r\n return (y.domain()[1] < 1000) ? -40 : \r\n (y.domain()[1] < 10000) ? -45 :\r\n (y.domain()[1] < 100000) ? -50 :\r\n (y.domain()[1] < 1000000) ? -55 : -60;\r\n }", "renderYAxis(column: Array, maxYValue: any) {\n return (\n <div className=\"y-axis-wrapper\">\n <div className=\"y-axis\">\n {column.map((item, i) => (\n <div className=\"y-caption\" key={i}>\n {i % 2 === 0 ? maxYValue - item.y_value : null}\n </div>\n ))}\n </div>\n </div>\n );\n }", "function Y(d) {\n return yScale(d[1]);\n }", "function drawYlabels(data, chartHeight, element) {\n\n // extracts scale from data\n var scale = data.scale;\n\n // determines the maximum value to be displayed on the Y axis of the chart\n var maxY = findMaxY(data.values, scale);\n\n // creates the label area that the labels are rendered to\n var labelArea = $(\"<div>\").attr(\"id\", \"yArea\");\n $(labelArea).css({height: chartHeight + \"px\"});\n $(element).append(labelArea);\n\n var labelHeight;\n var i;\n\n for (i = 0; i <= maxY / scale; i++) {\n // creates a label for each multiple of scale less than or equal to maxY\n var label = $(\"<div>\").addClass(\"yLabel\");\n\n // determines the label height\n labelHeight = ((i * scale) / maxY) * chartHeight;\n\n // updates the position and text displayed for the label\n $(label).css({marginBottom: (labelHeight - 13) + \"px\"});\n $(label).text((i * scale) + \" -\");\n\n // appends the label to the label area\n $(labelArea).append(label);\n }\n}", "function barChartOptions() {\n return {\n axisY: {\n labelInterpolationFnc: function(value) {\n return `${value} mi`;\n },\n },\n };\n}", "function drawYAxis() {\n // draw tick marks and labels\n var domain = y1Domain,\n styles = vis.__styles,\n ticks = vis.getYTicks(scales.y, c.h, extendRange, useLogScale);\n\n if (!extendRange && ticks[ticks.length-1] != domain[1]) ticks.push(domain[1]);\n\n if ($('body').hasClass('fullscreen')) {\n theme.horizontalGrid['stroke-width'] = 2;\n }\n\n _.each(ticks, function(val, t) {\n var y = scales.y(val), x = c.lpad;\n if (val >= domain[0] && val <= domain[1] || extendRange) {\n // c.paper.text(x, y, val).attr(styles.labels).attr({ 'text-anchor': 'end' });\n\n // axis label\n vis.label(x+2, y-10, formatter.y1(val, t == ticks.length-1), { align: 'left', cl: 'axis' });\n // axis ticks\n if (theme.yTicks) {\n vis.path([['M', c.lpad-25, y], ['L', c.lpad-20,y]], 'tick');\n }\n // grid line\n if (theme.horizontalGrid) {\n vis.path([['M', c.lpad, y], ['L', c.w - c.rpad,y]], 'grid')\n .attr(theme.horizontalGrid);\n }\n }\n });\n\n // draw axis line\n if (domain[0] <= 0 && domain[1] >= 0) {\n y = scales.y(0);\n vis.path([['M', c.lpad, y], ['L', c.w - c.rpad,y]], 'axis')\n .attr(theme.xAxis);\n }\n }", "function addXYTitles(svg,xTitle,yTitle,xAxis,yAxis,width,height){\n\tvar ticks = svg .append(\"g\")\n\t.attr(\"class\", \"x axis\")\n\t.attr(\"transform\", \"translate(0,\" + height + \")\")\n\t.call(xAxis)\n\t.selectAll('.tick');\n\n\tfor (var j = 0; j < ticks[0].length; j++) {\n\t\tvar c = ticks[0][j],\n\t\t n = ticks[0][j+1];\n\t\tif (!c || !n || !c.getBoundingClientRect || !n.getBoundingClientRect)\n\t\tcontinue;\n\t\twhile (c.getBoundingClientRect().right > n.getBoundingClientRect().left) {\n\t\td3.select(n).remove();\n\t\tj++;\n\t\tn = ticks[0][j+1];\n\t\tif (!n)\n\t\t break;\n\t\t}\n\t}\n\t\n\t/*if(data.length > 7) {\n\t//rotate the x axis labels\n\tsvg.selectAll(\".x text\") // select all the text elements for the xaxis\n\t\t .attr(\"transform\", function(d) {\n\t\t return \"translate(\" + this.getBBox().height*-2 + \",\" + this.getBBox().height + \")rotate(-45)\";\n\t\t });\n\t}*/\n\t\n\tsvg .append(\"g\").append(\"text\")\n\t.attr(\"transform\", \"translate(0,\" + height + \")\")\n\t.attr(\"x\", width / 2)\n\t.attr(\"y\", 25)\n\t.attr(\"dy\", \".71em\")\n\t.style(\"text-anchor\",\"end\")\n\t.text(xtitle)\n\t.attr(\"class\", \"xTitle\");\n\t\n\tsvg\t.append(\"g\")\n\t\t.attr(\"class\", \"y axis\")\n\t\t.call(yAxis).append(\"text\")\n\t\t.attr(\"transform\", \"rotate(-90)\")\n\t\t.attr(\"y\", 6)\n\t\t.attr(\"dy\", \".71em\")\n\t\t.style(\"text-anchor\", \"end\")\n\t\t.text(yaxisname)\n\t\t.attr(\"class\",\"yTitle\");\n}", "setTextValues() {\n const dataset = this.settings?.dataset;\n if (!dataset || (dataset && dataset.constructor !== Array)) {\n return;\n }\n const elems = this.element[0].querySelectorAll('.bar-chart .axis.y .tick text');\n const brief = {};\n if (this.ellipsis.use) {\n brief.maxWidth = this.element.width();\n brief.transX = this.svg?.node()?.transform?.baseVal?.consolidate()?.matrix?.e || 1;\n brief.customCss = () => ({\n tooltip: { maxWidth: `${brief.maxWidth}px` },\n arrow: { left: this.isRTL ? 'calc(100% - 20px)' : '20px' }\n });\n }\n const getText = (d, i) => {\n let r;\n if (this.ellipsis.use) {\n r = charts.trimText(d.name, this.ellipsis.threshold);\n if (r.substr(-3) === '...') {\n const textWidth = charts.calculateTextRenderWidth(d.name);\n const truncatedWidth = charts.calculateTextRenderWidth(r);\n const parentNode = elems[i].parentNode;\n const calculatePos = (rect) => {\n const numOfLines = Math.ceil(textWidth / brief.maxWidth);\n let x = brief.transX - truncatedWidth;\n let y = rect.top;\n x = (x < 0 ? 30 : x) + 20;\n y = (y < 0 ? 30 : y) - 36;\n if (numOfLines > 1) {\n y -= (33 * ((numOfLines - 1) * 0.5));\n }\n if (this.isRTL) {\n x = rect.left - textWidth + brief.transX;\n }\n return { x, y };\n };\n\n if (!env.browser.isIE11()) {\n r = d.name;\n elems[i].classList.add('hidden');\n d3.select(parentNode).append('foreignObject')\n .attr('overflow', 'visible')\n .attr('width', `${brief.transX}`)\n .attr('height', '16')\n .attr('class', `foreign-object tick-y${i}`)\n .attr('x', `-${brief.transX}`)\n .attr('y', '-1em')\n .attr('requiredFeatures', 'http://www.w3.org/TR/SVG11/feature#Extensibility')\n .html('<div class=\"text ellipsis\" resizeable=\"false\" xmlns=\"http://www.w3.org/1999/xhtml\"></div>');\n const ellipsisEl = parentNode.querySelector('.text.ellipsis');\n if (ellipsisEl) {\n const textContent = document.createTextNode(d.name);\n ellipsisEl.appendChild(textContent);\n }\n }\n\n d3.select(parentNode)\n .on(`mouseover.${this.namespace}`, () => {\n const pos = calculatePos(parentNode.getBoundingClientRect());\n charts.showTooltip(pos.x, pos.y, d.name, 'top', brief.customCss());\n })\n .on(`mouseout.${this.namespace}`, () => charts.hideTooltip());\n }\n } else {\n r = charts.getLabel(d, this.viewport);\n }\n return r;\n };\n\n if (!this.settings.selectable) {\n this.element.find('.bar').css('cursor', 'inherit');\n }\n\n if (this.settings.isGrouped) {\n dataset.forEach((d, i) => {\n elems[i].textContent = getText(d, i);\n });\n } else {\n dataset.forEach((d) => {\n const keys = Object.keys(d).map(key => key);\n const values = Object.keys(d).map(key => d[key]);\n values.forEach((key, i) => {\n if (key && key.constructor === Array) {\n key.forEach((k, i2) => {\n if (keys[i] !== 'attributes') {\n elems[i2].textContent = getText(k, i2);\n }\n });\n }\n });\n });\n }\n }", "function getYScaleFn(data, axisHeight) {\n return yScale({\n chartHeight: axisHeight,\n domainData: data,\n getDomainDataFn: d => {\n return d.frequency;\n },\n });\n }", "function plot_set_yLabel(plot_id, text) {\n\tif (! (plot_id in plots)) {\n\t\tconsole.log('Broken plot_set_yLabel');\n\t\treturn;\n\t}\n\tplot_options(plot_id).scales.yAxes[0].scaleLabel.labelString = text;\n}", "function rawLabel(displayAxis) {\n return displayAxis.domain()[0];\n }", "function make_y_axis() {\n return d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .ticks(10)\n }", "labelTextAxis(xAxis, yAxis){\n this.xAxis = xAxis;\n this.yAxis = yAxis;\n }", "yAxisScale(d) {\n const vis = this;\n\n const yAxisName = d3\n .scaleOrdinal()\n .domain(vis.listOfHabits)\n .range(vis.yAxisData);\n\n return yAxisName(d);\n }", "function renderyaxis(yscale, yaxis) {\n var leftAxis = d3.axisLeft(yscale);\n yaxis.transition()\n .duration(1000)\n .call(leftAxis);\n return yaxis;\n }", "function Y(d) {\n return yScale(d.value);\n }", "function updateYlabel() {\n if (options.ylabel && ylabel) {\n ylabel.text(options.ylabel);\n } else {\n ylabel.style(\"display\", \"none\");\n }\n }", "function build_y_axis(y_axis_scale, y_axis_label) {\n var y_axis_elem = d3.svg.axis()\n .scale(y_axis_scale)\n .orient('left')\n .ticks(5);\n\n return d3.select('#yAxis')\n .transition()\n .call(y_axis_elem)\n .select('#xLabel')\n .text(y_axis_label);\n }", "function labelY() {\n const l = d3.select(this.parentNode).select('line');\n return parseInt(l.attr('y1')) - 20;\n}", "function buildYAxis(yScaleFn) {\n return axisLeft(yScaleFn).ticks(10, \"%\");\n }", "function make_y_axis() {\n return d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .ticks(5)\n }", "function tVert(y){\n\t\t\treturn plotHeight - (y - yaxis.min) * vertScale;\n\t\t}", "function Y(d) {\n return yscale(d[1]);\n }", "function getConfig(valueAxesTitle){\n\t\treturn {\n\t\t\t\"type\": \"serial\",\n\t\t\t\"categoryField\": \"category\",\n\t\t\t\"startDuration\": 1,\n\t\t\t\"categoryAxis\": {\n\t\t\t\t\"gridPosition\": \"start\"\n\t\t\t},\n\t\t\t\"trendLines\": [],\n\t\t\t\"graphs\": [\n\t\t\t\t{\n\t\t\t\t\t\"balloonText\": \"[[title]] on [[category]]:[[value]]\",\n\t\t\t\t\t\"fillAlphas\": 1,\n\t\t\t\t\t\"id\": \"AmGraph-1\",\n\t\t\t\t\t\"title\": \"lowest value\",\n\t\t\t\t\t\"type\": \"column\",\n\t\t\t\t\t\"valueField\": \"column-1\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"balloonText\": \"[[title]] on [[category]]:[[value]]\",\n\t\t\t\t\t\"fillAlphas\": 1,\n\t\t\t\t\t\"id\": \"AmGraph-2\",\n\t\t\t\t\t\"title\": \"difference\",\n\t\t\t\t\t\"type\": \"column\",\n\t\t\t\t\t\"valueField\": \"column-2\"\n\t\t\t\t}\n\t\t\t],\n\t\t\t\"guides\": [],\n\t\t\t\"valueAxes\": [\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"ValueAxis-1\",\n\t\t\t\t\t\"stackType\": \"regular\",\n\t\t\t\t\t\"title\": valueAxesTitle\n\t\t\t\t}\n\t\t\t],\n\t\t\t\"allLabels\": [],\n\t\t\t\"balloon\": {},\n\t\t\t\"legend\": {\n\t\t\t\t\"enabled\": true,\n\t\t\t\t\"useGraphSettings\": true\n\t\t\t},\n\t\t\t\"dataProvider\": []\n\t\t}\n\t}", "function addBarAxis () {\n\t\t\textraChartGroup.append(\"g\")\n\t\t\t .attr(\"class\", \"barYAxis\")\n\t\t\t .style(\"font-size\", 13 * screenRatio + \"px\")\n\t\t\t .call(leftAxis_extraChart);\n\t\t}", "function GraphLabel(){\n return <div>\n <h3 className=\"y-axis\">Value</h3>\n <h3 className=\"x-axis\">Date</h3>\n </div>\n}", "get yAxisAnnotationPaddingLeft() {\r\n return this.i.nm;\r\n }", "function get_text_y(c) {\n\treturn 119 + 75 * c;\n}", "function renderYAxis(newYScale, yAxis2) {\n var leftAxis = d3.axisLeft(newYScale);\n yAxis2.transition()\n .duration(1000)\n .call(leftAxis);\n return yAxis2;\n }", "function highChart(xAxisArr,yAxisArray,subTitle,yTitle){\n var chart = Highcharts.chart('container', {\n title: {\n text: 'IPL Match'\n },\n subtitle: {\n text: subTitle\n },\n xAxis: {\n categories: xAxisArr\n },\n yAxis: {\n title:{\n text:yTitle,\n align:'middle'\n }\n },\n series: [{\n type: 'column',\n colorByPoint: true,\n data: yAxisArray,\n showInLegend: false\n }] \n });\n}", "get yAxisAnnotationOutline() {\r\n return brushToString(this.i.ph);\r\n }", "get yAxisAnnotationPaddingTop() {\r\n return this.i.no;\r\n }", "function make_y_axis() {\n return d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .ticks(5)\n}", "function renderAxesY(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis}", "function renderAxesY(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n return yAxis;\n }", "get yAxisAnnotationPaddingBottom() {\r\n return this.i.nl;\r\n }", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n \n yAxis.transition()\n .duration(300).call(leftAxis);\n\n return yAxis;\n }", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n // use a transition to shift the axis\n yAxis.transition()\n .duration(svgTransitionDuration)\n .call(leftAxis);\n //\n return yAxis;\n}", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n }", "function yA(data){\n\t\treturn d3.svg.axis()\n\t\t\t.scale(yScales(data))\n\t\t\t.orient(\"left\")\n\t\t\t.ticks(10)\n\t\t\t.tickSize(5,0); //the second argumnet takes the first and last tick off\n\t}", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n }", "function updateBertinMatrixYaxisLabel(collectionHeight) {\n\tvar labelWidth = 90;\n\tvar label = \"\";\n\tif (universityVisObj.currentCollIndex == 0) {\n\t\tlabel = \"Universities\";\n\t} else if (universityVisObj.currentCollIndex == 1) {\n\t\tlabel = \"Colleges\";\n\t} else if (universityVisObj.currentCollIndex == 2) {\n\t\tlabel = \"Courses\";\n\t}\n\tvar x;\n\tif (collectionHeight > 120) {\n\t\tx = -(collectionHeight + labelWidth) / 2;\n\t} else {\n\t\tx = -100;\n\t}\n\n\tuniversityVisObj.svg.select(\".yaxisLabelMatrix\")\n\t\t.transition()\n\t\t.duration(1000)\n\t\t.attr(\"y\", 20)\n\t\t.attr(\"x\", x)\n\t\t.attr(\"transform\", \"rotate(-90)\")\n\t\t.text(label);\n}", "function renderLabelsVertical() {\n var i, origin;\n\n // Y Labels\n for (i = 0; i < this.range.max - this.range.min + 1; i++) {\n origin = getInnerChartPoint([\n 0,\n 100 - (i * 100) / (this.range.max - this.range.min)\n ]);\n\n origin[0] -= LABEL_MARGIN;\n\n this.svg.add('text', origin, String(i + this.range.min), { class: 'chart-label chart-label-y' });\n }\n}", "function bar_y(d, i, roll) {\n var val = roll[1][i], chart_height = hist.chart_height();\n if(val === 0) return chart_height;\n val = y_scale(val);\n return val;\n return Math.min(val, chart_height-min_bar_height);\n }", "get Axis() {\n let sampleData = this.chart.data[0];\n let size = sampleData.length;\n\n return d3.svg\n .axis()\n .scale(this.chart.xScale)\n .orient('bottom')\n .tickFormat(getDate().long)\n .tickValues(getBestTickValues(sampleData));\n }", "function renderTextY(textGroup, newYScale, chosenYAxis){\n textGroup.transition()\n .duration(1000)\n .attr(\"y\",function(d){\n return newYScale(d[chosenYAxis]);\n });\n \n return textGroup;\n}", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n // use a transition to shift the axis\n yAxis.transition()\n .duration(svgTransitionDuration)\n .call(leftAxis);\n return yAxis;\n}", "function getMaxYAxis(data) {\n var max = 0;\n data.forEach(function(item) {\n max = Math.max(max, d3.max(item.values, function(d) {\n return d.value;\n }));\n\n });\n\n return Math.ceil(max / 500) * 500;\n }", "function renderAxesY(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n return yAxis;\n}", "function grid_y_axis()\r\n\t{\r\n\t\treturn d3.svg.axis()\r\n\t\t\t.scale(yScale)\r\n\t\t\t.orient(\"left\")\r\n\t\t\t.ticks(y_ticks);\r\n\t}", "function renderYAxis(newYScale, yAxis) {\n let leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition().duration(2000).call(leftAxis);\n\n return yAxis;\n}", "function readTitle(dtxData, value){\n dtxData.chartInfo.title = value;\n }", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n \n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n \n return yAxis;\n}", "y() {\n\t\t\treturn this.data.y;\n\t\t}", "function getLeagueSubtitle() {\n return \"Fall 2016\";\n }", "function gen_yaxis(percentile, yx, y, minValue, maxValue, metricName){\n\n //set normalize the y-scale\n if (percentile) {\n y.domain([minValue/maxValue, maxValue/maxValue]);\n var yAxis = d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .tickFormat(d3.format(\"%\"));\n\n yx.selectAll(\".axis_label\").remove();\n yx\n .attr(\"class\", \"y_axis\")\n .call(yAxis)\n .append(\"text\")\n .attr('id','yAxisLabel')\n //.attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", -28)\n .attr(\"x\",28)\n .attr(\"dy\", \".71em\")\n .style(\"text-anchor\", \"end\")\n .attr(\"class\", \"axis_label\")\n .text(\"Percentile\"); // label at the side of the y-axis\n\n //set raw value y-scale\n } else {\n y.domain([minValue, maxValue]);\n var yAxis = d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .tickFormat(d3.format(\"d\"));\n\n yx\n .attr(\"class\", \"y_axis\")\n .call(yAxis)\n .append(\"text\")\n .attr('id','yAxisLabel')\n //.attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", -28)\n .attr(\"x\",28)\n .attr(\"dy\", \".71em\")\n .style(\"text-anchor\", \"end\")\n .text(metricName); // label at the side of the y-axis\n }\n\n}", "function renderY(yLinearScale, yAxis) {\n var leftAxis = d3.axisLeft(yLinearScale);\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n return yAxis;\n}", "function yScale(barData, chosenYAxis, height) {\n // create scales\n let yScale = d3.scaleLinear()\n .domain([0, d3.max(barData, d => d[chosenYAxis])])\n .range([height, 0]);\n \n return yScale;\n \n}", "get yAxisAnnotationBackground() {\r\n return brushToString(this.i.pg);\r\n }", "function renderYAxis(newLinearYScale, yAxis) {\n\n // Call the axisLeft function to update the axis values\n var leftAxis = d3.axisLeft(newLinearYScale);\n\n // Transition to the newly chosen y-axis\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n}", "function getYAxisTickCount(areaWidth) {\n //set tick count to 10\n let tickCount = 10,\n maxValueRatio = getMaxYValue();\n\n //set max value ratio\n if (diagram.maxMeasureValue)\n maxValueRatio = diagram.maxMeasureValue;\n\n //attach text\n tempTextSVG = diagramG.append('text')\n .style('font-size', diagram.yAxis.labelFontSize + 'px')\n .style('color', diagram.yAxis.labelFontColor)\n .style('font-family', diagram.yAxis.labelFontFamily + ', Arial, Helvetica, Ubuntu')\n .style('font-style', diagram.yAxis.labelFontStyle == 'bold' ? 'normal' : diagram.yAxis.labelFontStyle)\n .style('font-weight', diagram.yAxis.labelFontStyle == 'bold' ? 'bold' : 'normal')\n .text(e.formatNumber(maxValueRatio, diagram.yAxis.labelFormat));\n\n //get offset for x axis value\n tempXAxisSVGOffset = tempTextSVG.node().getBoundingClientRect();\n\n //remove svg text for x axis\n tempTextSVG.remove();\n\n //check whether the axis tick count is auto\n if (diagram.yAxis.tickCount === 'auto') {\n //set tick count\n tickCount = Math.ceil(areaWidth / tempXAxisSVGOffset.width) - 1;\n } else {\n //set manuel tick count\n tickCount = parseInt(diagram.yAxis.tickCount);\n }\n\n if (tickCount > 10)\n tickCount = 10;\n\n //return updated tick count\n return 5;//e.closestPower(Math.ceil(tickCount));\n }", "function drawAxisY(svg, yAxis, graphXStart, axisPadding) {\n drawAxis(svg, yAxis, 'translate(' + (graphXStart + axisPadding) + ', 0)', {});\n}", "_getScaleY() {\n\t\t\t\treturn this.scale;\n\t\t\t}", "function renderyText(circles, yscale, yaxis) {\n\n circles.transition()\n .duration(1000)\n .attr(\"dy\", d => yscale(d[yaxis])+8);\n \n return circles;\n }", "function build_y_axis_scale(data, axis_label) {\n var scale_max = d3.max(data, function(d) {\n return d[axis_label];\n });\n\n var scale_min = d3.min(data, function(d) {\n return d[axis_label];\n });\n\n return d3.scale.linear()\n .range([height, margin])\n .domain([scale_min - 50, scale_max + 30]);\n }", "function getPanelSVGTextTitle()\n{\n var panelTitle = svgDocument.getElementById(\"panelTitle\");\n \n if(panelTitle != null)\n return panelTitle.firstChild.firstChild.nodeValue;\n \n return \"Untitled\";\n}", "function getDateFromY(value) {\n return yScale.invert(value);\n}", "function showAxis(xaxis, yaxis) {\n\t\n\tg.select('.x.axis')\n\t .call(xaxis)\n\t //.attr('transform', 'translate(0,' + height + ')')\n\t //.transition().duration(400)\n\t //.call(xaxis)\n\t //.selectAll('text')\n\t //.style('text-anchor','end')\n\t //.attr(\"dx\", \"-1em\")\n\t //.attr(\"dy\", \"-0.5em\")\n\t //.attr('transform', function(d){\n\t //\treturn \"rotate(-90)\";\n\t //})\n\t .style('opacity', 1.0)\n\t //.selectAll(\".tick text\")\n\t //.call(wrap, 10)\n\t;\n\t\n\n\tg.select('.y.axis')\n\t .call(yaxis)\n\t .style('opacity', 1.0);\n//\t .transition().duration(400)\n//\t .style('opacity', 1.0);\n\n\t\n//\tg.select('.x.axis')\n//\t .call(axis)\n//\t .transition().duration(500)\n//\t .style('opacity', 1);\n }", "function makeStandardChart(title, subtitle, units, utcData) {\r\n\twindow.utcData = utcData;\r\n\tdataVals = (document.getElementById(\"utcGraph\").checked) ? utcData : adjustDataToTZO(utcData);\r\n\tconsole.log($(\"#duration\").val(), dataVals.length );\r\n\tmarkerRadius = (utcData.length > 200) ? 1 : 2;\r\n\tunits = $.trim(units).toLowerCase();\r\n\tif (units.toLowerCase() in unitAlias) {\r\n\t console.log(units, unitAlias[units.toLowerCase()]); \r\n\t units = unitAlias[units.toLowerCase()]; \r\n\t}\r\n\tvar yAxisArr = [{\r\n title: { \r\n text: units,\n align: 'high',\n rotation:0,\n offset: 10,\n y: -10\n } \r\n }];\r\n //Have two y-axises if there is a conversion\r\n if (units in conversions) {\r\n yAxisArr.push({\r\n title: {\r\n text: conversions[units][0],\r\n align: 'high',\r\n rotation:0,\r\n offset: 20,\r\n y: -10\r\n },\r\n opposite: true,\r\n linkedTo:0,\r\n labels: {\n formatter: function() {\r\n // console.log(\"label converted:\", this.value, convert(this.value, units)[0]);\n return convert(this.value, units)[0];\n }\r\n } \r\n });\r\n }\r\n /// define the options\r\n\tvar options = {\r\n\t\tchart: \r\n\t\t\t{ \r\n\t\t\t\trenderTo: 'chart',\r\n\t\t\t\tevents: {\r\n\t\t\t\t\tload: function(event) {\r\n\t\t\t\t\t chartBusyDone(); \r\n\t\t\t\t\t}\r\n\t\t\t\t} \r\n\t\t\t},\r\n\t\ttitle: { text: title },\r\n\t\tsubtitle: { text: subtitle },\r\n\t\txAxis: { type: 'datetime' },\r\n yAxis: yAxisArr,\r\n\t\t// yAxis: [\n\t\t\t// { title: \n\t\t\t\t// { \n\t\t\t\t\t// text: unitStr,\n\t\t\t\t\t// align: 'high',\n\t\t\t\t\t// rotation:0,\n\t\t\t\t\t// offset: 10,\n\t\t\t\t\t// y: -10\n\t\t\t\t// } \n\t\t\t// }],\r\n\t\tlegend: { enabled: false },\r\n\t\ttooltip: {\r\n\t\t\tshared: true,\r\n\t\t\tcrosshairs: true,\r\n\t\t\tpointFormat: '{series.name}: <b>{point.y}</b> '+units,\r\n\t\t\tformatter: function () {\r\n\t\t\t thisDate = Highcharts.dateFormat('%a %b %e %Y %H:%M', this.x)+\"<br>\";\r\n\t\t\t var value = ((typeof this.y == 'number') && (this.y % 1 != 0))? this.y.toFixed(2) : this.y;\r\n if (units in conversions) {\r\n post = convert(this.y, units);\r\n // var post = parseFloat(this.y*conversions[units][1]).toFixed(1);\r\n // var postUnit = conversions[units][0];\r\n thisDate += title+\": <b>\"+value+units+\"</b>,<b>\"+post[0]+post[1]+\"</b>\";\r\n } else {\r\n thisDate += title+\": <b>\"+value+units+\"</b>\";\r\n } \r\n if (dataVals[0].length == 3) {\r\n thisDate += \"<br>Direction: <b>\"+this.points[0].key+\"\\u00B0</b>\"; //\\u00B0 is degree symbol\r\n }\r\n return thisDate;\r\n\t\t\t},\r\n\t\t\tdateTimeLabelFormats: {\r\n\t\t\t\tmillisecond: '%b %e %y %H:%M:%S.%L',\r\n\t\t\t\tsecond: '%b %e %y %H:%M:%S',\r\n\t\t\t\tminute: '%b %e %y %H:%M',\r\n\t\t\t\thour: '%b %e %y %H:%M',\r\n\t\t\t\tday: '%b %e %y %H:%M',\r\n\t\t\t\tmonth: '%b \\'%y',\r\n\t\t\t\tyear: '%Y'\r\n\t\t\t}\r\n\t\t},\r\n\t\tplotOptions: { \r\n\t\t\tline: {\r\n\t\t\t\tmarker: { radius: markerRadius}\r\n\t\t\t}\r\n\t\t},\r\n\t\tseries: [{ \r\n\t\t\t\t\tname: title,\r\n\t\t\t\t\t// data: dataVals\r\n\t\t\t\t\tdata:[] \r\n\t\t\t\t}]\r\n\t};\r\n\r\n //Direction\r\n if ((typeof dataVals[0] != 'undefined') && (dataVals[0].length == 3)) {\r\n for (i in dataVals){\r\n arr = dataVals[i];\r\n //only use marker symbol if less than 50 points\r\n if (dataVals.length > 100) { //50?!!!\r\n options.series[0].data.push({ x: arr[0], y: arr[1], name: arr[2].toFixed().toString() });\r\n } else {\r\n if(/wind/i.test(title) || /wind/i.test(subtitle)) {\r\n dirMarker = 'url(http://neocoweb.ucsd.edu/cgi-bin/asbs/barb.py?sp='+arr[1]+'&dir='+arr[2]+')'\r\n } else {\r\n //ocean current\r\n dirMarker = 'url(http://neocoweb.ucsd.edu/cgi-bin/asbs/arrow.py?dir='+arr[2]+')'\r\n }\r\n options.series[0].data.push({ x: arr[0], y: arr[1], marker: {symbol: dirMarker}, name: arr[2].toFixed().toString()}); \r\n }\r\n }\r\n } else {\r\n options.series[0].data = dataVals;\r\n // options.tooltip.formatter = function () {}\r\n }\r\n \r\n \r\n\tht = $(\"#chartWrapper\").height();\r\n\twd = $(\"#chartWrapper\").width();\r\n\tmyLayout.south.options.onresize_end = function () {setChartSize();}\r\n\t\r\n\t// if (myLayout.state.south.isVisible == false) {\n\t\t// myLayout.open('south', false);\n\t// }\r\n\r\n\tnoDataMsg = 'No data is available at the selected location and/or with in the \"Time Span\"';\r\n\tif (dataVals.length == 0) {\r\n\t\torig = $(\"#duration\").val();\r\n\t\tvar loop = ((typeof chart == 'undefined') || (loop == true)) ? true: false;\r\n\t\tif ((document.getElementById(\"now\").checked == true) && (orig != 31536000) && (typeof loop != 'undefined') && (loop)) {\r\n\t\t\t$(\"#duration option\").each(function(){\r\n\t\t\t\toptVal = parseInt($(this).val())\r\n\t\t\t\tif (optVal > orig) {\r\n\t\t\t\t\tvar step = function (optVal) {\r\n\t\t\t\t\t\tvar dfrd = $.Deferred();\r\n\t\t\t\t\t\t$(\"#duration\").val(optVal.toString());\r\n\t\t\t\t\t\tconsole.log(\"setting duration:\", optVal);\r\n\t\t\t\t\t\ttimeSpan();\r\n\t\t\t\t\t\tsetGraph();\r\n\t\t\t\t\t\tdfrd.resolve(); // use Deferred??\r\n\t\t\t\t\t\treturn dfrd.promise();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar callstep = step(optVal);\r\n\t\t\t\t\tstep.done(); //Doesn't work with callstep.done()??\r\n\t\t\t\t\t// step.done(function() {console.log(\"post setGraph\");}); //Not right console log\r\n\t\t\t\t} //else { console.log(\"ignore - smaller duration\");}\r\n\t\t\t});\r\n\t\t\tloop = false;\r\n\t\t} else {\r\n\t\t\tchartError(noDataMsg);\r\n\t\t}\r\n\t\tdelete loop;\r\n\t\t// chartError(noDataMsg);\r\n\t}\t\r\n\tchart = new Highcharts.Chart(options);\r\n\tsetChartSize();\r\n\t$(\"#chart\").val(\"usingChart\");\r\n\r\n}", "function getMaxYValue() {\n let maxVal = Number.MIN_VALUE;\n diagram.data.forEach(function (d) {\n for (var key in d) {\n if (key !== currentSerie.groupField) {\n if (+d[key] > maxVal)\n maxVal = +d[key];\n }\n }\n });\n return maxVal;\n }", "function objectBuildAxisY(colorGrid, colorTick) {\n var axisY = {\n gridColor : colorGrid,\n tickColor : colorTick,\n margin : 20\n };\n return axisY;\n}", "function yScale (data, yvalue) {\n var yLinearScale = d3.scaleLinear()\n .domain(d3.extent(data, data => data[yvalue]))\n .range([chartHeight, 0])\n return yLinearScale;\n }", "function updateXAxisTitle() {\n\tmyDiv.layout.xaxis.title = getXAxisTitle();\n}", "updatePlot (initialization) {\n const { weightedSumMax } = this.palmMath.getData()\n this.yscale.domain([0, weightedSumMax]).nice()\n this.yAxis.scale(this.yscale)\n\n const container = (initialization)\n ? this.axisContainer\n : this.axisContainer.transition().duration(this.duration)\n\n container\n .call(this.yAxis)\n .selectAll('.tick text')\n .style('font-size', this.fontSize + 'px')\n .style('font-family', this.fontFamily)\n .style('fill', this.fontColor)\n }" ]
[ "0.763321", "0.7325036", "0.69663244", "0.69663244", "0.6665529", "0.6622898", "0.63202524", "0.63202524", "0.6206746", "0.6196276", "0.618874", "0.6132986", "0.60834485", "0.6078867", "0.6063049", "0.6011214", "0.5997495", "0.59961075", "0.5975237", "0.5954416", "0.5948856", "0.5948856", "0.5948856", "0.59143364", "0.5908513", "0.58843255", "0.5879913", "0.58785325", "0.5877096", "0.58755183", "0.5869495", "0.58470464", "0.5845481", "0.58279264", "0.58111453", "0.58104753", "0.5809364", "0.5792533", "0.5737229", "0.57335305", "0.5721329", "0.57208246", "0.57145834", "0.57030696", "0.5688659", "0.56839395", "0.5681274", "0.56781596", "0.56551415", "0.56509244", "0.5644732", "0.5602387", "0.5584653", "0.55690765", "0.5564599", "0.5558112", "0.5552412", "0.5532655", "0.55199766", "0.55164963", "0.5514223", "0.5512045", "0.5484348", "0.5469931", "0.54686505", "0.54623896", "0.54620355", "0.5458971", "0.54487056", "0.54431415", "0.54420537", "0.5439934", "0.5439865", "0.54373056", "0.54267365", "0.54245937", "0.5424206", "0.5420676", "0.5419957", "0.5417319", "0.54158473", "0.5379426", "0.5379383", "0.53471506", "0.53365356", "0.5331887", "0.5331126", "0.5328278", "0.5325785", "0.5316608", "0.53146505", "0.53110844", "0.53100127", "0.53025556", "0.5283682", "0.5279229", "0.52747047", "0.52723587", "0.52688724", "0.52664804", "0.52649766" ]
0.0
-1
set the y axis title of the chart
function setYAxisTitleFtn(chart, index, labels) { $log.info('setting the Y Axis title: ' + labels[index]); chart.options.vAxis.title = labels[index]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function appendYAxisTitle(svg, plot) {\n svg.append('text')\n .attr('id', 'yTitle')\n .attr('transform', 'translate(' + (plot.padding.left/3) + ','\n + (plot.padding.top + plot.range.y/2) + ') rotate(-90)')\n .text('Concentration %');\n }", "function drawYAxis() {\n paper.leonardo.vLine(plotArea.x, plotArea.y, plotArea.height);\n\n // TODO: Get rid of magic number. Base text on font size instead.\n var valueX = plotArea.x - opts.tickSize,\n valueTextX = plotArea.x - (3 * opts.tickSize);\n\n plot(scaleValues, function (x, y, value) {\n paper.leonardo.hLine(valueX, y, opts.tickSize);\n paper.text(valueTextX, y, value);\n });\n }", "function updateYlabel() {\n if (options.ylabel && ylabel) {\n ylabel.text(options.ylabel);\n } else {\n ylabel.style(\"display\", \"none\");\n }\n }", "function plot_set_yLabel(plot_id, text) {\n\tif (! (plot_id in plots)) {\n\t\tconsole.log('Broken plot_set_yLabel');\n\t\treturn;\n\t}\n\tplot_options(plot_id).scales.yAxes[0].scaleLabel.labelString = text;\n}", "function nameYAxisTitle(axis_shortname){\n\n let axis_name = axis_shortname;\n // console.log(\"Given Axis: \", axis_shortname);\n\n metrics_chosen.map( (metric) => {\n \n // console.log(\"Metric Axis: \", metrics_info[metric].yaxis);\n \n if(metrics_info[metric].yaxis === axis_shortname && metrics_info[metric].name !== axis_shortname){\n axis_name = axis_name + \" (\" + metrics_info[metric].name + \")\";\n }\n });\n\n // if there are no metrics using the y1 axis, set the name to be blank\n if(axis_name === \"y1\"){\n axis_name = \"\";\n }\n\n return axis_name;\n}", "_defineAxisTitle(yAxisTag) {\n // title should be the same for all trends of the axis\n let axisTitle = \"\";\n let axisTitleSet = false;\n\n for (let trend of yAxisTag.trends) {\n let curTitle = trend.getAxisTitle();\n\n if (axisTitleSet) {\n if (axisTitle !== curTitle) {\n axisTitle = \"\";\n break;\n }\n } else {\n axisTitle = curTitle;\n axisTitleSet = true;\n }\n }\n\n yAxisTag.title = axisTitle;\n }", "function customYAxis( g ) {\n\t\t// move axis to align properly with the bottom left corner including tick values\n\t\tchart.attr( \"transform\", \"translate(\" + ( -chart_margins.left / 2 ) + \", 0)\" )\n\t\tchart.call( yAxis );\n\t\tchart.select( \".domain\" );\n\t\tchart.attr( \"text-anchor\", \"end\" );\n\t\tchart.selectAll( \".tick:not(:first-of-type) line\" ).attr( \"stroke\", \"#777\" ).attr( \"stroke-dasharray\", \"2,2\" );\n\t\tchart.selectAll( \".tick text\" ).attr( \"x\", -4 ).attr( \"dy\", 0 );\n\t} // appends y-axis to chart group", "function createYAxis() {\n return d3.svg.axis().scale(that.y).orient('left').ticks(chart.yAxis.tickCount);\n }", "function createYAxis() {\n return d3.svg.axis().scale(that.y).orient('left').ticks(chart.yAxis.tickCount);\n }", "function customYAxis( g ) {\n\t\t// move axis to align properly with the bottom left corner including tick values\n\t\tg.attr( \"transform\", \"translate(\" + ( -chart_margins.left / 2 ) + \", 0)\" )\n\t\tg.call( yAxis );\n\t\tg.select( \".domain\" );\n\t\tg.attr( \"text-anchor\", \"end\" );\n\t\tg.selectAll( \".tick:not(:first-of-type) line\" ).attr( \"stroke\", \"#777\" ).attr( \"stroke-dasharray\", \"2,2\" );\n\t\tg.selectAll( \".tick text\" ).attr( \"x\", -4 ).attr( \"dy\", 0 );\n\t}", "updatePlot (initialization) {\n const { weightedSumMax } = this.palmMath.getData()\n this.yscale.domain([0, weightedSumMax]).nice()\n this.yAxis.scale(this.yscale)\n\n const container = (initialization)\n ? this.axisContainer\n : this.axisContainer.transition().duration(this.duration)\n\n container\n .call(this.yAxis)\n .selectAll('.tick text')\n .style('font-size', this.fontSize + 'px')\n .style('font-family', this.fontFamily)\n .style('fill', this.fontColor)\n }", "function setYAxisColor(chart, color, yaxis) {\n yaxis = yaxis || 0;\n\n chart.yAxis[yaxis].update({\n title: { style: { color: color } },\n labels: { style: { color: color } }\n });\n }", "function drawYlabels(data, chartHeight, element) {\n\n // extracts scale from data\n var scale = data.scale;\n\n // determines the maximum value to be displayed on the Y axis of the chart\n var maxY = findMaxY(data.values, scale);\n\n // creates the label area that the labels are rendered to\n var labelArea = $(\"<div>\").attr(\"id\", \"yArea\");\n $(labelArea).css({height: chartHeight + \"px\"});\n $(element).append(labelArea);\n\n var labelHeight;\n var i;\n\n for (i = 0; i <= maxY / scale; i++) {\n // creates a label for each multiple of scale less than or equal to maxY\n var label = $(\"<div>\").addClass(\"yLabel\");\n\n // determines the label height\n labelHeight = ((i * scale) / maxY) * chartHeight;\n\n // updates the position and text displayed for the label\n $(label).css({marginBottom: (labelHeight - 13) + \"px\"});\n $(label).text((i * scale) + \" -\");\n\n // appends the label to the label area\n $(labelArea).append(label);\n }\n}", "function addXYTitles(svg,xTitle,yTitle,xAxis,yAxis,width,height){\n\tvar ticks = svg .append(\"g\")\n\t.attr(\"class\", \"x axis\")\n\t.attr(\"transform\", \"translate(0,\" + height + \")\")\n\t.call(xAxis)\n\t.selectAll('.tick');\n\n\tfor (var j = 0; j < ticks[0].length; j++) {\n\t\tvar c = ticks[0][j],\n\t\t n = ticks[0][j+1];\n\t\tif (!c || !n || !c.getBoundingClientRect || !n.getBoundingClientRect)\n\t\tcontinue;\n\t\twhile (c.getBoundingClientRect().right > n.getBoundingClientRect().left) {\n\t\td3.select(n).remove();\n\t\tj++;\n\t\tn = ticks[0][j+1];\n\t\tif (!n)\n\t\t break;\n\t\t}\n\t}\n\t\n\t/*if(data.length > 7) {\n\t//rotate the x axis labels\n\tsvg.selectAll(\".x text\") // select all the text elements for the xaxis\n\t\t .attr(\"transform\", function(d) {\n\t\t return \"translate(\" + this.getBBox().height*-2 + \",\" + this.getBBox().height + \")rotate(-45)\";\n\t\t });\n\t}*/\n\t\n\tsvg .append(\"g\").append(\"text\")\n\t.attr(\"transform\", \"translate(0,\" + height + \")\")\n\t.attr(\"x\", width / 2)\n\t.attr(\"y\", 25)\n\t.attr(\"dy\", \".71em\")\n\t.style(\"text-anchor\",\"end\")\n\t.text(xtitle)\n\t.attr(\"class\", \"xTitle\");\n\t\n\tsvg\t.append(\"g\")\n\t\t.attr(\"class\", \"y axis\")\n\t\t.call(yAxis).append(\"text\")\n\t\t.attr(\"transform\", \"rotate(-90)\")\n\t\t.attr(\"y\", 6)\n\t\t.attr(\"dy\", \".71em\")\n\t\t.style(\"text-anchor\", \"end\")\n\t\t.text(yaxisname)\n\t\t.attr(\"class\",\"yTitle\");\n}", "function drawYAxis() {\n // draw tick marks and labels\n var domain = y1Domain,\n styles = vis.__styles,\n ticks = vis.getYTicks(scales.y, c.h, extendRange, useLogScale);\n\n if (!extendRange && ticks[ticks.length-1] != domain[1]) ticks.push(domain[1]);\n\n if ($('body').hasClass('fullscreen')) {\n theme.horizontalGrid['stroke-width'] = 2;\n }\n\n _.each(ticks, function(val, t) {\n var y = scales.y(val), x = c.lpad;\n if (val >= domain[0] && val <= domain[1] || extendRange) {\n // c.paper.text(x, y, val).attr(styles.labels).attr({ 'text-anchor': 'end' });\n\n // axis label\n vis.label(x+2, y-10, formatter.y1(val, t == ticks.length-1), { align: 'left', cl: 'axis' });\n // axis ticks\n if (theme.yTicks) {\n vis.path([['M', c.lpad-25, y], ['L', c.lpad-20,y]], 'tick');\n }\n // grid line\n if (theme.horizontalGrid) {\n vis.path([['M', c.lpad, y], ['L', c.w - c.rpad,y]], 'grid')\n .attr(theme.horizontalGrid);\n }\n }\n });\n\n // draw axis line\n if (domain[0] <= 0 && domain[1] >= 0) {\n y = scales.y(0);\n vis.path([['M', c.lpad, y], ['L', c.w - c.rpad,y]], 'axis')\n .attr(theme.xAxis);\n }\n }", "function displayAxisTitles (options) {\n var xTitle = $(\"<h3></h3\").attr( {\"id\": \"xtitle\",\n \"class\": \"axistitle\"});\n xTitle.text(options.xaxistitle);\n var yTitle = $(\"<h3></h3\").attr( {\"id\": \"ytitle\",\n \"class\": \"axistitle\"});\n yTitle.text(options.yaxistitle);\n $(\"#chartarea\").append(xTitle,yTitle);\n\n $(\"#xtitle\").css({\n \"align-self\": \"center\",\n \"margin\": \"2px\",\n \"padding\": \"5px\",\n \"position\": \"absolute\",\n \"top\": \"105%\",\n \"font-size\": \"medium\"\n });\n\n$(\"#ytitle\").css( {\n \"left\": \"-20%\",\n \"margin\": \"2px\",\n \"padding\": \"2px\",\n \"position\": \"absolute\",\n \"top\":\"50%\",\n \"transform\": \"rotate(-90deg)\",\n \"font-size\": \"medium\"\n });\n\n}", "function addBarAxis () {\n\t\t\textraChartGroup.append(\"g\")\n\t\t\t .attr(\"class\", \"barYAxis\")\n\t\t\t .style(\"font-size\", 13 * screenRatio + \"px\")\n\t\t\t .call(leftAxis_extraChart);\n\t\t}", "function make_y_axis() {\n return d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .ticks(10)\n }", "function yAxis() {\t\t\n return d3.axisLeft(y)\n .tickSize(-width)\n .tickFormat(\"\")\n}", "function setupYScale() {\n var maxSales = d3.max(totalSales, function(d, i) {\n return d.sales;\n });\n y = d3.scaleLinear()\n .range([0, height])\n .domain([maxSales, 0]);\n}", "function createSubtitle(targetData){\n\t//define chart constants\n\tlet svg = d3.select(\".chart\");\n\n\tlet subtitle = svg.append(\"g\")\n\t\t.attr(\"class\", \"chart-subtitle\");\n\tsubtitle.append(\"text\")\n\t\t.attr(\"x\", 70)\n\t\t.attr(\"y\", 50)\n\t\t.attr(\"text-anchor\", \"center\")\n\t\t.style(\"font\", \"15px Archivo\")\n\t\t.style(\"font-style\", \"italic\")\n\t\t.text(targetData.yaxis);\n}", "function updateBertinMatrixYaxisLabel(collectionHeight) {\n\tvar labelWidth = 90;\n\tvar label = \"\";\n\tif (universityVisObj.currentCollIndex == 0) {\n\t\tlabel = \"Universities\";\n\t} else if (universityVisObj.currentCollIndex == 1) {\n\t\tlabel = \"Colleges\";\n\t} else if (universityVisObj.currentCollIndex == 2) {\n\t\tlabel = \"Courses\";\n\t}\n\tvar x;\n\tif (collectionHeight > 120) {\n\t\tx = -(collectionHeight + labelWidth) / 2;\n\t} else {\n\t\tx = -100;\n\t}\n\n\tuniversityVisObj.svg.select(\".yaxisLabelMatrix\")\n\t\t.transition()\n\t\t.duration(1000)\n\t\t.attr(\"y\", 20)\n\t\t.attr(\"x\", x)\n\t\t.attr(\"transform\", \"rotate(-90)\")\n\t\t.text(label);\n}", "function make_y_axis() {\n return d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .ticks(5)\n }", "labelTextAxis(xAxis, yAxis){\n this.xAxis = xAxis;\n this.yAxis = yAxis;\n }", "function highChart(xAxisArr,yAxisArray,subTitle,yTitle){\n var chart = Highcharts.chart('container', {\n title: {\n text: 'IPL Match'\n },\n subtitle: {\n text: subTitle\n },\n xAxis: {\n categories: xAxisArr\n },\n yAxis: {\n title:{\n text:yTitle,\n align:'middle'\n }\n },\n series: [{\n type: 'column',\n colorByPoint: true,\n data: yAxisArray,\n showInLegend: false\n }] \n });\n}", "function updateXAxisTitle() {\n\tmyDiv.layout.xaxis.title = getXAxisTitle();\n}", "function build_y_axis(y_axis_scale, y_axis_label) {\n var y_axis_elem = d3.svg.axis()\n .scale(y_axis_scale)\n .orient('left')\n .ticks(5);\n\n return d3.select('#yAxis')\n .transition()\n .call(y_axis_elem)\n .select('#xLabel')\n .text(y_axis_label);\n }", "function renderAxesY(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n return yAxis;\n }", "function renderTextY(textGroup, newYScale, chosenYAxis){\n textGroup.transition()\n .duration(1000)\n .attr(\"y\",function(d){\n return newYScale(d[chosenYAxis]);\n });\n \n return textGroup;\n}", "function renderAxesY(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n return yAxis;\n}", "function renderYAxis(newYScale, yAxis2) {\n var leftAxis = d3.axisLeft(newYScale);\n yAxis2.transition()\n .duration(1000)\n .call(leftAxis);\n return yAxis2;\n }", "function renderAxesY(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis}", "function make_y_axis() {\n return d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .ticks(5)\n}", "function grid_y_axis()\r\n\t{\r\n\t\treturn d3.svg.axis()\r\n\t\t\t.scale(yScale)\r\n\t\t\t.orient(\"left\")\r\n\t\t\t.ticks(y_ticks);\r\n\t}", "function buildYAxis(yScaleFn) {\n return axisLeft(yScaleFn).ticks(10, \"%\");\n }", "function setTitle(title) {\r\n d3.select(\".timelapse-chart-title\")\r\n .attr(\"x\", chartSettings.width / 2)\r\n .attr(\"y\", -chartSettings.padding / 2)\r\n .text(title);\r\n\r\n return this;\r\n }", "function yA(data){\n\t\treturn d3.svg.axis()\n\t\t\t.scale(yScales(data))\n\t\t\t.orient(\"left\")\n\t\t\t.ticks(10)\n\t\t\t.tickSize(5,0); //the second argumnet takes the first and last tick off\n\t}", "_drawYGrid(yAxisTag) {\n let layout = this._chartLayout;\n let yAxisConfig = yAxisTag.axisConfig;\n let yAxisLayout = yAxisTag.axisLayout;\n let yAxisRect = yAxisLayout.areaRect;\n\n this._context.textBaseline = \"middle\";\n this._context.font = yAxisConfig.fontSize + \"px \" + this.displayOptions.chartArea.fontName;\n\n let labelMarginT = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 0);\n let labelMarginR = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 1);\n let labelMarginB = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 2);\n let labelMarginL = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 3);\n let prevLblY = NaN;\n let tickL, tickR, minorTickL, minorTickR, axisX, lblX;\n\n if (yAxisConfig.position === scada.chart.AreaPosition.LEFT) {\n this._context.textAlign = \"right\";\n tickR = yAxisRect.right - 1;\n tickL = tickR - yAxisConfig.majorTickSize;\n minorTickR = tickR;\n minorTickL = minorTickR - yAxisConfig.minorTickSize;\n axisX = yAxisRect.right - 1;\n lblX = tickL - labelMarginR;\n } else {\n this._context.textAlign = \"left\";\n tickL = yAxisRect.left;\n tickR = tickL + yAxisConfig.majorTickSize;\n minorTickL = tickL;\n minorTickR = minorTickL + yAxisConfig.minorTickSize;\n axisX = yAxisRect.left;\n lblX = tickR + labelMarginL;\n }\n\n let gridL = layout.plotAreaRect.left + layout.canvasXOffset;\n let gridR = gridL + layout.plotAreaRect.width - 1;\n let axisT = yAxisRect.top + layout.canvasYOffset;\n let axisB = axisT + yAxisRect.height - 1;\n\n for (let y = yAxisLayout.gridStart; y < yAxisTag.max; y += yAxisLayout.gridStep) {\n let ptY = this._trendYToCanvasY(y, yAxisTag);\n\n // horizontal grid line\n if (yAxisConfig.showGridLines) {\n this._setColor(this.displayOptions.plotArea.gridColor);\n this._drawLine(gridL, ptY, gridR, ptY);\n }\n\n // major tick and axis line\n this._setColor(yAxisConfig.lineColor);\n this._drawLine(tickL, ptY, tickR, ptY);\n this._drawLine(axisX, axisT, axisX, axisB);\n\n // minor ticks\n if (yAxisConfig.minorTickCount > 0) {\n for (let minorTickY = y + yAxisLayout.minorTickStep, maxMinorTickY = y + yAxisLayout.gridStep;\n minorTickY < maxMinorTickY && maxMinorTickY < yAxisTag.max; minorTickY += yAxisLayout.minorTickStep) {\n\n let minorTickCnvY = this._trendYToCanvasY(minorTickY, yAxisTag);\n this._drawLine(minorTickL, minorTickCnvY, minorTickR, minorTickCnvY);\n }\n }\n\n // label\n this._setColor(yAxisConfig.textColor);\n let lblY = ptY;\n\n if (isNaN(prevLblY) || prevLblY - lblY > yAxisConfig.fontSize) {\n this._context.fillText(y.toFixed(yAxisLayout.gridDigits), lblX, lblY);\n prevLblY = lblY;\n }\n }\n\n // axis title\n if (yAxisConfig.showTitle && yAxisTag.title) {\n this._context.textAlign = \"center\";\n this._context.save();\n this._context.translate(yAxisRect.left + layout.canvasXOffset, yAxisRect.bottom + layout.canvasYOffset);\n this._context.rotate(-Math.PI / 2);\n let titleY;\n\n if (yAxisConfig.position === scada.chart.AreaPosition.LEFT) {\n this._context.textBaseline = \"top\";\n titleY = labelMarginT;\n } else {\n this._context.textBaseline = \"bottom\";\n titleY = yAxisRect.width - labelMarginB;\n }\n\n this._context.fillText(yAxisTag.title, yAxisRect.height / 2, titleY, yAxisRect.height);\n this._context.restore();\n }\n }", "function barChartOptions() {\n return {\n axisY: {\n labelInterpolationFnc: function(value) {\n return `${value} mi`;\n },\n },\n };\n}", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n \n yAxis.transition()\n .duration(300).call(leftAxis);\n\n return yAxis;\n }", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n \n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n \n return yAxis;\n}", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n }", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n }", "function assignYAxisToData(chart, data) {\n\t// console.log('I am assignYAxisToData(%O, %O)', chart, data);\n\tvar columns = data.columns,\n\t\tselectedMeasures = data.measuresSelected,\n\t\tfound, dataName;\n\tfor (var i = 1; i < columns.length; i++) {\n\t\tfound = false;\n\t\tdataName = columns[i][0];\n\t\tfor (var j = 0; j < selectedMeasures.length; j++) {\n\t\t\t// Per le misure selezionate\n\t\t\tif (dataName.includes(selectedMeasures[j].name)) {\n\t\t\t\tif (selectedMeasures[j].type == 0 || selectedMeasures[j].type == 2) {\n\t\t\t\t\tconsole.log(dataName + \" goes to Y\");\n\t\t\t\t\tchart.data.axes()[dataName] = 'y';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tconsole.log(dataName + \" goes to Y2\");\n\t\t\t\t\tchart.data.axes()[dataName] = 'y2';\n\t\t\t\t}\n\t\t\t\tfound = true; // trovata una misura che sicuramente e' portata\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Per altre misure\n\t\tif (!found) {\n\t\t\tif (dataName.toLowerCase().includes('[l/s]')) {\n\t\t\t\tconsole.log(dataName + \" goes to Y\");\n\t\t\t\tchart.data.axes()[dataName] = 'y';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log(dataName + \" goes to Y2\");\n\t\t\t\tchart.data.axes()[dataName] = 'y2';\n\t\t\t}\n\t\t}\n\t}\n\tchart.flush();\n}", "function gridYaxis() {\t\t\n return d3.axisLeft(y)\n .ticks(5)\n \n}", "function modifyYaxisName(z){\n var notation =[];\n for (var i= 0; i<z.length; i++){\n notation.push(`OTU ${z[i]}`)\n }\n return notation;}", "function drawAxisY(svg, yAxis, graphXStart, axisPadding) {\n drawAxis(svg, yAxis, 'translate(' + (graphXStart + axisPadding) + ', 0)', {});\n}", "function renderYAxis(newYScale, yAxis) {\n let leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition().duration(2000).call(leftAxis);\n\n return yAxis;\n}", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n // use a transition to shift the axis\n yAxis.transition()\n .duration(svgTransitionDuration)\n .call(leftAxis);\n //\n return yAxis;\n}", "function updateChart(chart, dataValues, title) {\n console.log(chart.id);\n console.log(\"data\",dataValues);\n chart.data.datasets[0].data = dataValues;\n console.log(\"universidad:\",title);\n if(chart.id == 0){\n chart.options.title.text = \"Estadísticas de estudiantes de la \"+\" \"+title+\" \"+\"año 2017\";\n }else{\n\n chart.options.title.text = \"Estadísticas de docentes de la \"+\" \"+title+\" \"+\"año 2017\";\n\n\n\n }\n //chart.options.title.text = title;\n //console.log(\"chart\", chart);\n chart.update();\n }", "function yAxis(g){\n g.attr(\"transform\", 'translate('+settings.margin.left+',0)')\n .attr('id','yAxis')\n .call(d3.axisLeft(y).tickSize(0))\n .call(g => g.select(\".domain\").remove())\n}", "function updateLineGraphTitle(data_option, year) {\n var title = lineGraphTitles[data_option] + \" in \" + year;\n d3.select(\"#lineGraphTitle\").text(title);\n}", "function updateTitle(chartText) {\n $('#default-chart-map-variable').html(chartText);\n }", "yAxisControl(y) {\n this.yAxis = y;\n this.referringToClass.style.top = `${this.yAxis}px`;\n }", "function renderyaxis(yscale, yaxis) {\n var leftAxis = d3.axisLeft(yscale);\n yaxis.transition()\n .duration(1000)\n .call(leftAxis);\n return yaxis;\n }", "function readTitle(dtxData, value){\n dtxData.chartInfo.title = value;\n }", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n // use a transition to shift the axis\n yAxis.transition()\n .duration(svgTransitionDuration)\n .call(leftAxis);\n return yAxis;\n}", "function styleYAxis(selection) {\n // Add classes for tests.\n selection.attr('class', 'chartYAxis');\n\n // These paths are added by d3.axis, but we don't need them.\n selection.selectAll('path')\n .remove();\n\n selection.selectAll('line')\n .attr('class', 'chartYAxisTick__mark');\n\n // Move the text to the left side of the SVG.\n selection.selectAll('text')\n .attr('class', 'chartYAxisTick__text')\n .attr('dx', -(width - marginRight));\n\n // Add small background boxes behind each tick's text.\n // Remove existing boxes first, to avoid duplicates.\n selection.selectAll('rect')\n .remove();\n selection.selectAll('.tick')\n .insert('rect', ':last-child')\n .attr('class', 'chartYAxisTick__background')\n .attr('x', -marginLeft)\n .attr('y', -8)\n .attr('width', marginLeft)\n .attr('height', 15)\n .attr('rx', 2) // Border-radius\n .attr('ry', 2); // Border-radius\n }", "homeYAxis(){\n this._updateYAxis(this.yMinHome, this.yMaxHome);\n }", "function make_y_gridlines() {\t\t\n \t \treturn d3.axisLeft(yo).ticks(5)\n \t }", "set title( val ) {\n this.title_bar_text.innerText = val;\n }", "function renderYaxes(newYScale, yAxis) {\n let leftAxis = d3.axisLeft(newYScale);\n \n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n \n return yAxis;\n}", "function renderYAxis(newLinearYScale, yAxis) {\n\n // Call the axisLeft function to update the axis values\n var leftAxis = d3.axisLeft(newLinearYScale);\n\n // Transition to the newly chosen y-axis\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n}", "function getTitleMarg() {\r\n return (y.domain()[1] < 1000) ? -40 : \r\n (y.domain()[1] < 10000) ? -45 :\r\n (y.domain()[1] < 100000) ? -50 :\r\n (y.domain()[1] < 1000000) ? -55 : -60;\r\n }", "function gen_yaxis(percentile, yx, y, minValue, maxValue, metricName){\n\n //set normalize the y-scale\n if (percentile) {\n y.domain([minValue/maxValue, maxValue/maxValue]);\n var yAxis = d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .tickFormat(d3.format(\"%\"));\n\n yx.selectAll(\".axis_label\").remove();\n yx\n .attr(\"class\", \"y_axis\")\n .call(yAxis)\n .append(\"text\")\n .attr('id','yAxisLabel')\n //.attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", -28)\n .attr(\"x\",28)\n .attr(\"dy\", \".71em\")\n .style(\"text-anchor\", \"end\")\n .attr(\"class\", \"axis_label\")\n .text(\"Percentile\"); // label at the side of the y-axis\n\n //set raw value y-scale\n } else {\n y.domain([minValue, maxValue]);\n var yAxis = d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .tickFormat(d3.format(\"d\"));\n\n yx\n .attr(\"class\", \"y_axis\")\n .call(yAxis)\n .append(\"text\")\n .attr('id','yAxisLabel')\n //.attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", -28)\n .attr(\"x\",28)\n .attr(\"dy\", \".71em\")\n .style(\"text-anchor\", \"end\")\n .text(metricName); // label at the side of the y-axis\n }\n\n}", "function yText(circlesGroup, yLinScale, paramY) {\n circlesGroup.transition()\n .duration(1000)\n .attr(\"dy\", d=> yUpdate(d[paramY]));\n return circlesGroup;\n }", "function makeStandardChart(title, subtitle, units, utcData) {\r\n\twindow.utcData = utcData;\r\n\tdataVals = (document.getElementById(\"utcGraph\").checked) ? utcData : adjustDataToTZO(utcData);\r\n\tconsole.log($(\"#duration\").val(), dataVals.length );\r\n\tmarkerRadius = (utcData.length > 200) ? 1 : 2;\r\n\tunits = $.trim(units).toLowerCase();\r\n\tif (units.toLowerCase() in unitAlias) {\r\n\t console.log(units, unitAlias[units.toLowerCase()]); \r\n\t units = unitAlias[units.toLowerCase()]; \r\n\t}\r\n\tvar yAxisArr = [{\r\n title: { \r\n text: units,\n align: 'high',\n rotation:0,\n offset: 10,\n y: -10\n } \r\n }];\r\n //Have two y-axises if there is a conversion\r\n if (units in conversions) {\r\n yAxisArr.push({\r\n title: {\r\n text: conversions[units][0],\r\n align: 'high',\r\n rotation:0,\r\n offset: 20,\r\n y: -10\r\n },\r\n opposite: true,\r\n linkedTo:0,\r\n labels: {\n formatter: function() {\r\n // console.log(\"label converted:\", this.value, convert(this.value, units)[0]);\n return convert(this.value, units)[0];\n }\r\n } \r\n });\r\n }\r\n /// define the options\r\n\tvar options = {\r\n\t\tchart: \r\n\t\t\t{ \r\n\t\t\t\trenderTo: 'chart',\r\n\t\t\t\tevents: {\r\n\t\t\t\t\tload: function(event) {\r\n\t\t\t\t\t chartBusyDone(); \r\n\t\t\t\t\t}\r\n\t\t\t\t} \r\n\t\t\t},\r\n\t\ttitle: { text: title },\r\n\t\tsubtitle: { text: subtitle },\r\n\t\txAxis: { type: 'datetime' },\r\n yAxis: yAxisArr,\r\n\t\t// yAxis: [\n\t\t\t// { title: \n\t\t\t\t// { \n\t\t\t\t\t// text: unitStr,\n\t\t\t\t\t// align: 'high',\n\t\t\t\t\t// rotation:0,\n\t\t\t\t\t// offset: 10,\n\t\t\t\t\t// y: -10\n\t\t\t\t// } \n\t\t\t// }],\r\n\t\tlegend: { enabled: false },\r\n\t\ttooltip: {\r\n\t\t\tshared: true,\r\n\t\t\tcrosshairs: true,\r\n\t\t\tpointFormat: '{series.name}: <b>{point.y}</b> '+units,\r\n\t\t\tformatter: function () {\r\n\t\t\t thisDate = Highcharts.dateFormat('%a %b %e %Y %H:%M', this.x)+\"<br>\";\r\n\t\t\t var value = ((typeof this.y == 'number') && (this.y % 1 != 0))? this.y.toFixed(2) : this.y;\r\n if (units in conversions) {\r\n post = convert(this.y, units);\r\n // var post = parseFloat(this.y*conversions[units][1]).toFixed(1);\r\n // var postUnit = conversions[units][0];\r\n thisDate += title+\": <b>\"+value+units+\"</b>,<b>\"+post[0]+post[1]+\"</b>\";\r\n } else {\r\n thisDate += title+\": <b>\"+value+units+\"</b>\";\r\n } \r\n if (dataVals[0].length == 3) {\r\n thisDate += \"<br>Direction: <b>\"+this.points[0].key+\"\\u00B0</b>\"; //\\u00B0 is degree symbol\r\n }\r\n return thisDate;\r\n\t\t\t},\r\n\t\t\tdateTimeLabelFormats: {\r\n\t\t\t\tmillisecond: '%b %e %y %H:%M:%S.%L',\r\n\t\t\t\tsecond: '%b %e %y %H:%M:%S',\r\n\t\t\t\tminute: '%b %e %y %H:%M',\r\n\t\t\t\thour: '%b %e %y %H:%M',\r\n\t\t\t\tday: '%b %e %y %H:%M',\r\n\t\t\t\tmonth: '%b \\'%y',\r\n\t\t\t\tyear: '%Y'\r\n\t\t\t}\r\n\t\t},\r\n\t\tplotOptions: { \r\n\t\t\tline: {\r\n\t\t\t\tmarker: { radius: markerRadius}\r\n\t\t\t}\r\n\t\t},\r\n\t\tseries: [{ \r\n\t\t\t\t\tname: title,\r\n\t\t\t\t\t// data: dataVals\r\n\t\t\t\t\tdata:[] \r\n\t\t\t\t}]\r\n\t};\r\n\r\n //Direction\r\n if ((typeof dataVals[0] != 'undefined') && (dataVals[0].length == 3)) {\r\n for (i in dataVals){\r\n arr = dataVals[i];\r\n //only use marker symbol if less than 50 points\r\n if (dataVals.length > 100) { //50?!!!\r\n options.series[0].data.push({ x: arr[0], y: arr[1], name: arr[2].toFixed().toString() });\r\n } else {\r\n if(/wind/i.test(title) || /wind/i.test(subtitle)) {\r\n dirMarker = 'url(http://neocoweb.ucsd.edu/cgi-bin/asbs/barb.py?sp='+arr[1]+'&dir='+arr[2]+')'\r\n } else {\r\n //ocean current\r\n dirMarker = 'url(http://neocoweb.ucsd.edu/cgi-bin/asbs/arrow.py?dir='+arr[2]+')'\r\n }\r\n options.series[0].data.push({ x: arr[0], y: arr[1], marker: {symbol: dirMarker}, name: arr[2].toFixed().toString()}); \r\n }\r\n }\r\n } else {\r\n options.series[0].data = dataVals;\r\n // options.tooltip.formatter = function () {}\r\n }\r\n \r\n \r\n\tht = $(\"#chartWrapper\").height();\r\n\twd = $(\"#chartWrapper\").width();\r\n\tmyLayout.south.options.onresize_end = function () {setChartSize();}\r\n\t\r\n\t// if (myLayout.state.south.isVisible == false) {\n\t\t// myLayout.open('south', false);\n\t// }\r\n\r\n\tnoDataMsg = 'No data is available at the selected location and/or with in the \"Time Span\"';\r\n\tif (dataVals.length == 0) {\r\n\t\torig = $(\"#duration\").val();\r\n\t\tvar loop = ((typeof chart == 'undefined') || (loop == true)) ? true: false;\r\n\t\tif ((document.getElementById(\"now\").checked == true) && (orig != 31536000) && (typeof loop != 'undefined') && (loop)) {\r\n\t\t\t$(\"#duration option\").each(function(){\r\n\t\t\t\toptVal = parseInt($(this).val())\r\n\t\t\t\tif (optVal > orig) {\r\n\t\t\t\t\tvar step = function (optVal) {\r\n\t\t\t\t\t\tvar dfrd = $.Deferred();\r\n\t\t\t\t\t\t$(\"#duration\").val(optVal.toString());\r\n\t\t\t\t\t\tconsole.log(\"setting duration:\", optVal);\r\n\t\t\t\t\t\ttimeSpan();\r\n\t\t\t\t\t\tsetGraph();\r\n\t\t\t\t\t\tdfrd.resolve(); // use Deferred??\r\n\t\t\t\t\t\treturn dfrd.promise();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar callstep = step(optVal);\r\n\t\t\t\t\tstep.done(); //Doesn't work with callstep.done()??\r\n\t\t\t\t\t// step.done(function() {console.log(\"post setGraph\");}); //Not right console log\r\n\t\t\t\t} //else { console.log(\"ignore - smaller duration\");}\r\n\t\t\t});\r\n\t\t\tloop = false;\r\n\t\t} else {\r\n\t\t\tchartError(noDataMsg);\r\n\t\t}\r\n\t\tdelete loop;\r\n\t\t// chartError(noDataMsg);\r\n\t}\t\r\n\tchart = new Highcharts.Chart(options);\r\n\tsetChartSize();\r\n\t$(\"#chart\").val(\"usingChart\");\r\n\r\n}", "function setYval(val) {\n\t// Update yVal\n\tyVal = val;\n\t// Update the axis\n\tyScale.domain([d3.min(data, function(d) { return parseFloat(d[yVal]); })-1,\n\t\t\t\t d3.max(data, function(d) { return parseFloat(d[yVal]); })+1])\n\tyAxis.scale(yScale);\n\tyAxisG.call(yAxis);\n\tyLabel.text(yVal);\n\t// Update the points\n\td3.selectAll('.point')\n\t\t.transition()\n\t\t.duration(transDur)\n\t\t.attr('cy', function(d) { return yScale(d[yVal]); });\n}", "function renderYaxes(newYScale, yAxis) {\n let leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n}", "function renderLabelsVertical() {\n var i, origin;\n\n // Y Labels\n for (i = 0; i < this.range.max - this.range.min + 1; i++) {\n origin = getInnerChartPoint([\n 0,\n 100 - (i * 100) / (this.range.max - this.range.min)\n ]);\n\n origin[0] -= LABEL_MARGIN;\n\n this.svg.add('text', origin, String(i + this.range.min), { class: 'chart-label chart-label-y' });\n }\n}", "function yScale(universities2, chosenYAxis) {\n // create scales\n var yLinearScale = d3.scaleLinear()\n .domain([0,\n 110\n ])\n .range([height, 0]);\n return yLinearScale;\n}", "function format_y_tooltip_ph(dataPoint) {\n return \" pH: \" + dataPoint.ph;\n }", "function appendChartTitle(svg, plot) {\n svg.append('text')\n .attr('id', 'chartTitle')\n .attr('x', plot.svg.width/2)\n .attr('y', plot.padding.top * 0.66)\n .text('Carbo-Hydroxyl-Frutinoid Concentrations'); //Ok I just made up this concept\n }", "function make_y_gridlines() {\n return d3.axisLeft(y)\n .ticks(10);\n }", "function yScale (data, yvalue) {\n var yLinearScale = d3.scaleLinear()\n .domain(d3.extent(data, data => data[yvalue]))\n .range([chartHeight, 0])\n return yLinearScale;\n }", "function make_y_gridlines() {\n return d3.axisLeft(YScale)\n .ticks(10)\n }", "function initYaxis(yLinScale, yAxis) {\n var leftAx = d3.axisLeft(yLinScale);\n yAxis.transition()\n .duration(1000)\n .call(leftAx);\n return yAxis;\n }", "function showAxis(xaxis, yaxis) {\n\t\n\tg.select('.x.axis')\n\t .call(xaxis)\n\t //.attr('transform', 'translate(0,' + height + ')')\n\t //.transition().duration(400)\n\t //.call(xaxis)\n\t //.selectAll('text')\n\t //.style('text-anchor','end')\n\t //.attr(\"dx\", \"-1em\")\n\t //.attr(\"dy\", \"-0.5em\")\n\t //.attr('transform', function(d){\n\t //\treturn \"rotate(-90)\";\n\t //})\n\t .style('opacity', 1.0)\n\t //.selectAll(\".tick text\")\n\t //.call(wrap, 10)\n\t;\n\t\n\n\tg.select('.y.axis')\n\t .call(yaxis)\n\t .style('opacity', 1.0);\n//\t .transition().duration(400)\n//\t .style('opacity', 1.0);\n\n\t\n//\tg.select('.x.axis')\n//\t .call(axis)\n//\t .transition().duration(500)\n//\t .style('opacity', 1);\n }", "renderYAxis(column: Array, maxYValue: any) {\n return (\n <div className=\"y-axis-wrapper\">\n <div className=\"y-axis\">\n {column.map((item, i) => (\n <div className=\"y-caption\" key={i}>\n {i % 2 === 0 ? maxYValue - item.y_value : null}\n </div>\n ))}\n </div>\n </div>\n );\n }", "function make_y_gridlines() {\t\t\n return d3.axisLeft(y)\n .ticks( 2*commentTicks )\n }", "function make_y_gridlines() {\t\t\n return d3.axisLeft(yScale)\n .ticks(10)\n }", "configYAxis(yConf) {\n // Default: duration, bounds and orient\n const bounds = yConf.bounds;\n const yAxisConfig = {\n duration: yConf.duration,\n bounds,\n orient: yConf.yOrient,\n tickSize: 0,\n };\n\n // Assemble the y-scale object\n const yDomain = yConf.data.map(d => d.category);\n // NOTE: rangebands for bar charts are 'top-to-bottom', unlike\n // other components that run 'bottom-to-top'. This relates to\n // sorting...\n yAxisConfig.scale = D3.scale.ordinal()\n .rangeBands([ 0, bounds.height ], 0.1)\n .domain(yDomain);\n\n return yAxisConfig;\n }", "formatYAxis(tickItem) {\n\treturn tickItem.toLocaleString();\n }", "async _refreshBarTitle() {\n this._top.attr(\"width\", this._dimView.width).attr(\"height\", this._barTitleHeight);\n }", "function getYaxisOptions(opts, unit, min, max){\r\n\topts.axes.yaxis = {\r\n min: min,\r\n max: max,\r\n numberTicks: 5,\r\n autoscale: true,\r\n label: unit,\r\n tickOptions: {\r\n          angle: 0\r\n },\r\n tickInterval: null\r\n };\r\n opts.seriesDefaults.shadow = true;\r\n opts.seriesDefaults.pointLabels = {show: true};\r\n opts.seriesDefaults.markerOptions.color = 'darkblue';\r\n opts.highlighter.sizeAdjust = 4; \r\n\r\n return opts;\r\n}", "function appendYAxis(paddingGroup, scales) {\n const yAxis = d3.axisLeft().scale(scales.y);\n paddingGroup.append('g')\n .attr('class', 'yAxis')\n .call(yAxis);\n }", "function changeYAxes(newYScale, yAxis) {\n let leftAxis = d3.axisLeft(newYScale).ticks(10);\n \n yAxis.transition()\n .duration(500)\n .call(leftAxis);\n \n return yAxis;\n}", "function make_y_gridlines() {\t\t\r\n return d3.axisLeft(y_scale);\r\n}", "function addFacebookAxis(g, y) {\n let yAxis = d3.svg.axis()\n .scale(y)\n .orient(\"left\");\n\n g.append(\"g\")\n .attr(\"class\", \"y axis\")\n .call(yAxis);\n}", "function setupYScale()\n{\n var maxPopulation = d3.max(Spain.concat(Germany), function(d, i) {return d.y;});\n\n y = d3.scaleLinear()\n .range([height, 0])\n .domain([0, maxPopulation]);\n\n}", "yAxisScale(d) {\n const vis = this;\n\n const yAxisName = d3\n .scaleOrdinal()\n .domain(vis.listOfHabits)\n .range(vis.yAxisData);\n\n return yAxisName(d);\n }", "function setChartYRange(chart, minY, maxY, minY2, maxY2) {\n\t// console.log(\"I am setChartYRange(%O, %s, %s, %s, %s)\", chart, minY, maxY, minY2, maxY2);\n\tchart.axis.range({\n\t\tmin: {\n\t\t\ty: minY,\n\t\t\ty2: minY2\n\t\t},\n\t\tmax: {\n\t\t\ty: maxY,\n\t\t\ty2: maxY2\n\t\t}\n\t});\n}", "setTextValues() {\n const dataset = this.settings?.dataset;\n if (!dataset || (dataset && dataset.constructor !== Array)) {\n return;\n }\n const elems = this.element[0].querySelectorAll('.bar-chart .axis.y .tick text');\n const brief = {};\n if (this.ellipsis.use) {\n brief.maxWidth = this.element.width();\n brief.transX = this.svg?.node()?.transform?.baseVal?.consolidate()?.matrix?.e || 1;\n brief.customCss = () => ({\n tooltip: { maxWidth: `${brief.maxWidth}px` },\n arrow: { left: this.isRTL ? 'calc(100% - 20px)' : '20px' }\n });\n }\n const getText = (d, i) => {\n let r;\n if (this.ellipsis.use) {\n r = charts.trimText(d.name, this.ellipsis.threshold);\n if (r.substr(-3) === '...') {\n const textWidth = charts.calculateTextRenderWidth(d.name);\n const truncatedWidth = charts.calculateTextRenderWidth(r);\n const parentNode = elems[i].parentNode;\n const calculatePos = (rect) => {\n const numOfLines = Math.ceil(textWidth / brief.maxWidth);\n let x = brief.transX - truncatedWidth;\n let y = rect.top;\n x = (x < 0 ? 30 : x) + 20;\n y = (y < 0 ? 30 : y) - 36;\n if (numOfLines > 1) {\n y -= (33 * ((numOfLines - 1) * 0.5));\n }\n if (this.isRTL) {\n x = rect.left - textWidth + brief.transX;\n }\n return { x, y };\n };\n\n if (!env.browser.isIE11()) {\n r = d.name;\n elems[i].classList.add('hidden');\n d3.select(parentNode).append('foreignObject')\n .attr('overflow', 'visible')\n .attr('width', `${brief.transX}`)\n .attr('height', '16')\n .attr('class', `foreign-object tick-y${i}`)\n .attr('x', `-${brief.transX}`)\n .attr('y', '-1em')\n .attr('requiredFeatures', 'http://www.w3.org/TR/SVG11/feature#Extensibility')\n .html('<div class=\"text ellipsis\" resizeable=\"false\" xmlns=\"http://www.w3.org/1999/xhtml\"></div>');\n const ellipsisEl = parentNode.querySelector('.text.ellipsis');\n if (ellipsisEl) {\n const textContent = document.createTextNode(d.name);\n ellipsisEl.appendChild(textContent);\n }\n }\n\n d3.select(parentNode)\n .on(`mouseover.${this.namespace}`, () => {\n const pos = calculatePos(parentNode.getBoundingClientRect());\n charts.showTooltip(pos.x, pos.y, d.name, 'top', brief.customCss());\n })\n .on(`mouseout.${this.namespace}`, () => charts.hideTooltip());\n }\n } else {\n r = charts.getLabel(d, this.viewport);\n }\n return r;\n };\n\n if (!this.settings.selectable) {\n this.element.find('.bar').css('cursor', 'inherit');\n }\n\n if (this.settings.isGrouped) {\n dataset.forEach((d, i) => {\n elems[i].textContent = getText(d, i);\n });\n } else {\n dataset.forEach((d) => {\n const keys = Object.keys(d).map(key => key);\n const values = Object.keys(d).map(key => d[key]);\n values.forEach((key, i) => {\n if (key && key.constructor === Array) {\n key.forEach((k, i2) => {\n if (keys[i] !== 'attributes') {\n elems[i2].textContent = getText(k, i2);\n }\n });\n }\n });\n });\n }\n }", "function drawTitle(color, title_Y)\n{\n ctx.font = \"50px Arial\";\n ctx.textAlign = \"center\";\n ctx.strokeStyle = color;\n ctx.lineWidth = 3;\n ctx.strokeText(\"CASINO\", MID_CANVAS, title_Y);\n}", "function renderyAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale); \n yAxis.transition()\n .duration(500)\n .call(leftAxis);\n return yAxis;\n}", "_updateYAxis(yMin, yMax){\n if(yMin >= yMax) return;\n\n this.yMin = yMin;\n this.yMax = yMax;\n this.yRange.domain([yMin, yMax]);\n this.svg.select(\".y.axis\").call(this.yAxis); // update svg\n\n this._recalculateDyValues();\n }", "updateChart(data, yAxisLabel = \"count\") {\n\n\t\tlet _this = this;\n\t\tlet chart = d3.select(\"#compChart\");\n\t\tlet countMin = d3.min(data, d => d.count);\n\t\tlet countMax = d3.max(data, d => d.count);\n\n\t\t//Create the scales\n\t\t_this.xScale = d3.scaleBand()\n\t\t\t.range([0, _this.width - _this.xOffset])\n\t\t\t.padding(0.1);\n\t\t_this.xScale.domain(data.map(d => d.bucket));\n\t\t\n\t\t_this.yScale = d3.scaleLinear()\n\t\t\t.domain([countMax, 0])\n\t\t\t.range([0, _this.height])\n\t\t\t.nice();\n\t\t\n\t\t//Draw the bucket/x axis\n\t\tlet xAxis = d3.axisBottom();\n\t\txAxis.scale(_this.xScale);\n\t\t\n\t\tchart.select(\"#xAxis\")\n\t\t\t.attr(\"transform\", \"translate(\" + _this.xOffset + \", \" + (_this.height + _this.yOffset) + \")\")\n\t\t\t.call(xAxis)\n\t\t\t.selectAll(\"text\")\n\t\t\t.style(\"text-anchor\", \"end\")\n\t\t\t.style(\"font-size\", \"9pt\")\n\t\t\t.attr(\"transform\", \"rotate(-90)\")\n\t\t\t.attr(\"x\", -10)\n\t\t\t.attr(\"y\", -5);\n\t\t\n\t\t//Draw the count/y axis\n\t\tlet yAxis = d3.axisLeft()\n\t\t\t.tickFormat(function(d) {\n\t\t\t\tif (Math.floor(d) != d) {\n\t\t\t\t\td3.select(this.parentNode).select(\"line\").remove();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\treturn d;\n\t\t\t});\n\t\tyAxis.scale(_this.yScale);\n\t\t\n\t\tchart.select(\"#yAxis\")\n\t\t\t.attr(\"transform\", \"translate(\" + _this.xOffset + \", \" + _this.yOffset + \")\")\n\t\t\t.call(yAxis);\n\t\t\n\t\tchart.selectAll(\".descriptionLabel\").remove();\n\t\tchart.append(\"text\")\n\t\t\t.text(yAxisLabel)\n\t\t\t.attr(\"class\", \"descriptionLabel\")\n\t\t\t.attr(\"transform\", \"translate(\" + (10) + \", \" + (_this.yOffset + _this.height / 2) + \") rotate(-90)\")\n\t\t\t.style(\"text-anchor\", \"middle\");\n\t\t\n\t\t//Plot the points\n\t\tlet points = chart.select(\"#dataPoints\")\n\t\t\t.selectAll(\"circle\")\n\t\t\t.data(data);\n\t\tpoints.exit()\n\t\t\t.remove();\n\t\tpoints = points.enter()\n\t\t\t.append(\"circle\")\n\t\t\t.merge(points);\n\t\t\t\n\t\tpoints.attr(\"transform\", function(d) {\n\t\t\t\treturn \"translate(\" + _this.xScale(d.bucket) + \", \" + (_this.height + _this.yOffset) + \") scale(1, -1)\";\n\t\t\t})\n\t\t\t.style(\"fill\", \"black\")\n\t\t\t.attr(\"r\", 4)\n\t\t\t.attr(\"cx\", _this.xOffset + _this.xScale.bandwidth()/2)\n\t\t\t.attr(\"cy\", function(d) {\n\t\t\t\treturn _this.yScale(0) - _this.yScale(d.count);\n\t\t\t})\n\t\t\t.on(\"mouseover\", function(d){\n\t\t\t\td3.select(this)\n\t\t\t .append(\"title\")\n\t\t\t .text(d.count);\n\t\t\t})\n\t\t\t.on(\"mouseout\", function(d){\n\t\t\t\td3.select(this)\n\t\t\t .select(\"title\")\n\t\t\t .remove();\n\t\t\t});\n\n\t\t\t\n\t\t//Draw the lines\n\t\tlet lineGenerator = d3.line()\n\t\t\t\t.x(d => _this.xOffset + _this.xScale(d.bucket) + _this.xScale.bandwidth()/2)\n\t\t\t\t.y(d => _this.yOffset + _this.yScale(d.count));\n\t\t\n\t\tlet line = chart.select(\"#dataLines\");\n\t\tlet path = line.selectAll(\"path\");\n\t\tpath.attr(\"d\", function() {\n\t\t\t\treturn lineGenerator(data);\n\t\t\t})\n\t\t\t.attr(\"stroke\", \"black\")\n\t\t\t.attr(\"fill\", \"none\");\n\t}", "get title() { return this.Nls(\"Legend_Title\") }", "function make_y_gridlines() {\t\t\n return d3.axisLeft(y)\n .ticks(5)\n }" ]
[ "0.79353875", "0.6971474", "0.68736976", "0.6855753", "0.6648476", "0.6598415", "0.64830506", "0.6376461", "0.6376461", "0.6343131", "0.6199379", "0.61716086", "0.60718036", "0.60692686", "0.60502845", "0.6016776", "0.6013383", "0.5992236", "0.59639055", "0.59461194", "0.5931751", "0.59021765", "0.58851165", "0.58560306", "0.5835492", "0.58193856", "0.5814233", "0.5789987", "0.5789334", "0.5773215", "0.5760082", "0.57538617", "0.57341206", "0.57020074", "0.569323", "0.5678437", "0.5666616", "0.5647551", "0.563231", "0.5631999", "0.5621043", "0.5618237", "0.5591067", "0.5589579", "0.5561883", "0.55571634", "0.55381376", "0.55353135", "0.55270034", "0.55261755", "0.55223596", "0.55220574", "0.55197275", "0.55108255", "0.55062616", "0.5506085", "0.5505016", "0.5503869", "0.54980886", "0.5497918", "0.5462961", "0.54513216", "0.5445268", "0.54411846", "0.5434095", "0.5424037", "0.5416159", "0.5414421", "0.54114085", "0.54091525", "0.53954", "0.53932476", "0.5390359", "0.53769696", "0.53676957", "0.5362754", "0.53627104", "0.5354098", "0.5351671", "0.53450686", "0.53371376", "0.5331464", "0.53287035", "0.5328683", "0.5321692", "0.5319285", "0.53123516", "0.53113437", "0.53094685", "0.5308543", "0.52990687", "0.52989876", "0.5292551", "0.52915317", "0.5280498", "0.5276715", "0.5268304", "0.52629226", "0.52558994" ]
0.81854814
0
set the y axis title of the chart
function getCSVDataFtn() { return google.visualization.dataTableToCsv(obj.chart.data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setYAxisTitleFtn(chart, index, labels) {\n $log.info('setting the Y Axis title: ' + labels[index]);\n chart.options.vAxis.title = labels[index];\n }", "function setYAxisTitleFtn(chart, index, labels) {\n $log.info('setting the Y Axis title: ' + labels[index]);\n chart.options.vAxis.title = labels[index];\n }", "function appendYAxisTitle(svg, plot) {\n svg.append('text')\n .attr('id', 'yTitle')\n .attr('transform', 'translate(' + (plot.padding.left/3) + ','\n + (plot.padding.top + plot.range.y/2) + ') rotate(-90)')\n .text('Concentration %');\n }", "function drawYAxis() {\n paper.leonardo.vLine(plotArea.x, plotArea.y, plotArea.height);\n\n // TODO: Get rid of magic number. Base text on font size instead.\n var valueX = plotArea.x - opts.tickSize,\n valueTextX = plotArea.x - (3 * opts.tickSize);\n\n plot(scaleValues, function (x, y, value) {\n paper.leonardo.hLine(valueX, y, opts.tickSize);\n paper.text(valueTextX, y, value);\n });\n }", "function updateYlabel() {\n if (options.ylabel && ylabel) {\n ylabel.text(options.ylabel);\n } else {\n ylabel.style(\"display\", \"none\");\n }\n }", "function plot_set_yLabel(plot_id, text) {\n\tif (! (plot_id in plots)) {\n\t\tconsole.log('Broken plot_set_yLabel');\n\t\treturn;\n\t}\n\tplot_options(plot_id).scales.yAxes[0].scaleLabel.labelString = text;\n}", "function nameYAxisTitle(axis_shortname){\n\n let axis_name = axis_shortname;\n // console.log(\"Given Axis: \", axis_shortname);\n\n metrics_chosen.map( (metric) => {\n \n // console.log(\"Metric Axis: \", metrics_info[metric].yaxis);\n \n if(metrics_info[metric].yaxis === axis_shortname && metrics_info[metric].name !== axis_shortname){\n axis_name = axis_name + \" (\" + metrics_info[metric].name + \")\";\n }\n });\n\n // if there are no metrics using the y1 axis, set the name to be blank\n if(axis_name === \"y1\"){\n axis_name = \"\";\n }\n\n return axis_name;\n}", "_defineAxisTitle(yAxisTag) {\n // title should be the same for all trends of the axis\n let axisTitle = \"\";\n let axisTitleSet = false;\n\n for (let trend of yAxisTag.trends) {\n let curTitle = trend.getAxisTitle();\n\n if (axisTitleSet) {\n if (axisTitle !== curTitle) {\n axisTitle = \"\";\n break;\n }\n } else {\n axisTitle = curTitle;\n axisTitleSet = true;\n }\n }\n\n yAxisTag.title = axisTitle;\n }", "function customYAxis( g ) {\n\t\t// move axis to align properly with the bottom left corner including tick values\n\t\tchart.attr( \"transform\", \"translate(\" + ( -chart_margins.left / 2 ) + \", 0)\" )\n\t\tchart.call( yAxis );\n\t\tchart.select( \".domain\" );\n\t\tchart.attr( \"text-anchor\", \"end\" );\n\t\tchart.selectAll( \".tick:not(:first-of-type) line\" ).attr( \"stroke\", \"#777\" ).attr( \"stroke-dasharray\", \"2,2\" );\n\t\tchart.selectAll( \".tick text\" ).attr( \"x\", -4 ).attr( \"dy\", 0 );\n\t} // appends y-axis to chart group", "function createYAxis() {\n return d3.svg.axis().scale(that.y).orient('left').ticks(chart.yAxis.tickCount);\n }", "function createYAxis() {\n return d3.svg.axis().scale(that.y).orient('left').ticks(chart.yAxis.tickCount);\n }", "function customYAxis( g ) {\n\t\t// move axis to align properly with the bottom left corner including tick values\n\t\tg.attr( \"transform\", \"translate(\" + ( -chart_margins.left / 2 ) + \", 0)\" )\n\t\tg.call( yAxis );\n\t\tg.select( \".domain\" );\n\t\tg.attr( \"text-anchor\", \"end\" );\n\t\tg.selectAll( \".tick:not(:first-of-type) line\" ).attr( \"stroke\", \"#777\" ).attr( \"stroke-dasharray\", \"2,2\" );\n\t\tg.selectAll( \".tick text\" ).attr( \"x\", -4 ).attr( \"dy\", 0 );\n\t}", "updatePlot (initialization) {\n const { weightedSumMax } = this.palmMath.getData()\n this.yscale.domain([0, weightedSumMax]).nice()\n this.yAxis.scale(this.yscale)\n\n const container = (initialization)\n ? this.axisContainer\n : this.axisContainer.transition().duration(this.duration)\n\n container\n .call(this.yAxis)\n .selectAll('.tick text')\n .style('font-size', this.fontSize + 'px')\n .style('font-family', this.fontFamily)\n .style('fill', this.fontColor)\n }", "function setYAxisColor(chart, color, yaxis) {\n yaxis = yaxis || 0;\n\n chart.yAxis[yaxis].update({\n title: { style: { color: color } },\n labels: { style: { color: color } }\n });\n }", "function drawYlabels(data, chartHeight, element) {\n\n // extracts scale from data\n var scale = data.scale;\n\n // determines the maximum value to be displayed on the Y axis of the chart\n var maxY = findMaxY(data.values, scale);\n\n // creates the label area that the labels are rendered to\n var labelArea = $(\"<div>\").attr(\"id\", \"yArea\");\n $(labelArea).css({height: chartHeight + \"px\"});\n $(element).append(labelArea);\n\n var labelHeight;\n var i;\n\n for (i = 0; i <= maxY / scale; i++) {\n // creates a label for each multiple of scale less than or equal to maxY\n var label = $(\"<div>\").addClass(\"yLabel\");\n\n // determines the label height\n labelHeight = ((i * scale) / maxY) * chartHeight;\n\n // updates the position and text displayed for the label\n $(label).css({marginBottom: (labelHeight - 13) + \"px\"});\n $(label).text((i * scale) + \" -\");\n\n // appends the label to the label area\n $(labelArea).append(label);\n }\n}", "function addXYTitles(svg,xTitle,yTitle,xAxis,yAxis,width,height){\n\tvar ticks = svg .append(\"g\")\n\t.attr(\"class\", \"x axis\")\n\t.attr(\"transform\", \"translate(0,\" + height + \")\")\n\t.call(xAxis)\n\t.selectAll('.tick');\n\n\tfor (var j = 0; j < ticks[0].length; j++) {\n\t\tvar c = ticks[0][j],\n\t\t n = ticks[0][j+1];\n\t\tif (!c || !n || !c.getBoundingClientRect || !n.getBoundingClientRect)\n\t\tcontinue;\n\t\twhile (c.getBoundingClientRect().right > n.getBoundingClientRect().left) {\n\t\td3.select(n).remove();\n\t\tj++;\n\t\tn = ticks[0][j+1];\n\t\tif (!n)\n\t\t break;\n\t\t}\n\t}\n\t\n\t/*if(data.length > 7) {\n\t//rotate the x axis labels\n\tsvg.selectAll(\".x text\") // select all the text elements for the xaxis\n\t\t .attr(\"transform\", function(d) {\n\t\t return \"translate(\" + this.getBBox().height*-2 + \",\" + this.getBBox().height + \")rotate(-45)\";\n\t\t });\n\t}*/\n\t\n\tsvg .append(\"g\").append(\"text\")\n\t.attr(\"transform\", \"translate(0,\" + height + \")\")\n\t.attr(\"x\", width / 2)\n\t.attr(\"y\", 25)\n\t.attr(\"dy\", \".71em\")\n\t.style(\"text-anchor\",\"end\")\n\t.text(xtitle)\n\t.attr(\"class\", \"xTitle\");\n\t\n\tsvg\t.append(\"g\")\n\t\t.attr(\"class\", \"y axis\")\n\t\t.call(yAxis).append(\"text\")\n\t\t.attr(\"transform\", \"rotate(-90)\")\n\t\t.attr(\"y\", 6)\n\t\t.attr(\"dy\", \".71em\")\n\t\t.style(\"text-anchor\", \"end\")\n\t\t.text(yaxisname)\n\t\t.attr(\"class\",\"yTitle\");\n}", "function drawYAxis() {\n // draw tick marks and labels\n var domain = y1Domain,\n styles = vis.__styles,\n ticks = vis.getYTicks(scales.y, c.h, extendRange, useLogScale);\n\n if (!extendRange && ticks[ticks.length-1] != domain[1]) ticks.push(domain[1]);\n\n if ($('body').hasClass('fullscreen')) {\n theme.horizontalGrid['stroke-width'] = 2;\n }\n\n _.each(ticks, function(val, t) {\n var y = scales.y(val), x = c.lpad;\n if (val >= domain[0] && val <= domain[1] || extendRange) {\n // c.paper.text(x, y, val).attr(styles.labels).attr({ 'text-anchor': 'end' });\n\n // axis label\n vis.label(x+2, y-10, formatter.y1(val, t == ticks.length-1), { align: 'left', cl: 'axis' });\n // axis ticks\n if (theme.yTicks) {\n vis.path([['M', c.lpad-25, y], ['L', c.lpad-20,y]], 'tick');\n }\n // grid line\n if (theme.horizontalGrid) {\n vis.path([['M', c.lpad, y], ['L', c.w - c.rpad,y]], 'grid')\n .attr(theme.horizontalGrid);\n }\n }\n });\n\n // draw axis line\n if (domain[0] <= 0 && domain[1] >= 0) {\n y = scales.y(0);\n vis.path([['M', c.lpad, y], ['L', c.w - c.rpad,y]], 'axis')\n .attr(theme.xAxis);\n }\n }", "function displayAxisTitles (options) {\n var xTitle = $(\"<h3></h3\").attr( {\"id\": \"xtitle\",\n \"class\": \"axistitle\"});\n xTitle.text(options.xaxistitle);\n var yTitle = $(\"<h3></h3\").attr( {\"id\": \"ytitle\",\n \"class\": \"axistitle\"});\n yTitle.text(options.yaxistitle);\n $(\"#chartarea\").append(xTitle,yTitle);\n\n $(\"#xtitle\").css({\n \"align-self\": \"center\",\n \"margin\": \"2px\",\n \"padding\": \"5px\",\n \"position\": \"absolute\",\n \"top\": \"105%\",\n \"font-size\": \"medium\"\n });\n\n$(\"#ytitle\").css( {\n \"left\": \"-20%\",\n \"margin\": \"2px\",\n \"padding\": \"2px\",\n \"position\": \"absolute\",\n \"top\":\"50%\",\n \"transform\": \"rotate(-90deg)\",\n \"font-size\": \"medium\"\n });\n\n}", "function addBarAxis () {\n\t\t\textraChartGroup.append(\"g\")\n\t\t\t .attr(\"class\", \"barYAxis\")\n\t\t\t .style(\"font-size\", 13 * screenRatio + \"px\")\n\t\t\t .call(leftAxis_extraChart);\n\t\t}", "function make_y_axis() {\n return d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .ticks(10)\n }", "function yAxis() {\t\t\n return d3.axisLeft(y)\n .tickSize(-width)\n .tickFormat(\"\")\n}", "function setupYScale() {\n var maxSales = d3.max(totalSales, function(d, i) {\n return d.sales;\n });\n y = d3.scaleLinear()\n .range([0, height])\n .domain([maxSales, 0]);\n}", "function createSubtitle(targetData){\n\t//define chart constants\n\tlet svg = d3.select(\".chart\");\n\n\tlet subtitle = svg.append(\"g\")\n\t\t.attr(\"class\", \"chart-subtitle\");\n\tsubtitle.append(\"text\")\n\t\t.attr(\"x\", 70)\n\t\t.attr(\"y\", 50)\n\t\t.attr(\"text-anchor\", \"center\")\n\t\t.style(\"font\", \"15px Archivo\")\n\t\t.style(\"font-style\", \"italic\")\n\t\t.text(targetData.yaxis);\n}", "function updateBertinMatrixYaxisLabel(collectionHeight) {\n\tvar labelWidth = 90;\n\tvar label = \"\";\n\tif (universityVisObj.currentCollIndex == 0) {\n\t\tlabel = \"Universities\";\n\t} else if (universityVisObj.currentCollIndex == 1) {\n\t\tlabel = \"Colleges\";\n\t} else if (universityVisObj.currentCollIndex == 2) {\n\t\tlabel = \"Courses\";\n\t}\n\tvar x;\n\tif (collectionHeight > 120) {\n\t\tx = -(collectionHeight + labelWidth) / 2;\n\t} else {\n\t\tx = -100;\n\t}\n\n\tuniversityVisObj.svg.select(\".yaxisLabelMatrix\")\n\t\t.transition()\n\t\t.duration(1000)\n\t\t.attr(\"y\", 20)\n\t\t.attr(\"x\", x)\n\t\t.attr(\"transform\", \"rotate(-90)\")\n\t\t.text(label);\n}", "function make_y_axis() {\n return d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .ticks(5)\n }", "labelTextAxis(xAxis, yAxis){\n this.xAxis = xAxis;\n this.yAxis = yAxis;\n }", "function highChart(xAxisArr,yAxisArray,subTitle,yTitle){\n var chart = Highcharts.chart('container', {\n title: {\n text: 'IPL Match'\n },\n subtitle: {\n text: subTitle\n },\n xAxis: {\n categories: xAxisArr\n },\n yAxis: {\n title:{\n text:yTitle,\n align:'middle'\n }\n },\n series: [{\n type: 'column',\n colorByPoint: true,\n data: yAxisArray,\n showInLegend: false\n }] \n });\n}", "function build_y_axis(y_axis_scale, y_axis_label) {\n var y_axis_elem = d3.svg.axis()\n .scale(y_axis_scale)\n .orient('left')\n .ticks(5);\n\n return d3.select('#yAxis')\n .transition()\n .call(y_axis_elem)\n .select('#xLabel')\n .text(y_axis_label);\n }", "function updateXAxisTitle() {\n\tmyDiv.layout.xaxis.title = getXAxisTitle();\n}", "function renderAxesY(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n return yAxis;\n }", "function renderTextY(textGroup, newYScale, chosenYAxis){\n textGroup.transition()\n .duration(1000)\n .attr(\"y\",function(d){\n return newYScale(d[chosenYAxis]);\n });\n \n return textGroup;\n}", "function renderAxesY(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n return yAxis;\n}", "function renderYAxis(newYScale, yAxis2) {\n var leftAxis = d3.axisLeft(newYScale);\n yAxis2.transition()\n .duration(1000)\n .call(leftAxis);\n return yAxis2;\n }", "function renderAxesY(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis}", "function make_y_axis() {\n return d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .ticks(5)\n}", "function grid_y_axis()\r\n\t{\r\n\t\treturn d3.svg.axis()\r\n\t\t\t.scale(yScale)\r\n\t\t\t.orient(\"left\")\r\n\t\t\t.ticks(y_ticks);\r\n\t}", "function buildYAxis(yScaleFn) {\n return axisLeft(yScaleFn).ticks(10, \"%\");\n }", "function setTitle(title) {\r\n d3.select(\".timelapse-chart-title\")\r\n .attr(\"x\", chartSettings.width / 2)\r\n .attr(\"y\", -chartSettings.padding / 2)\r\n .text(title);\r\n\r\n return this;\r\n }", "function yA(data){\n\t\treturn d3.svg.axis()\n\t\t\t.scale(yScales(data))\n\t\t\t.orient(\"left\")\n\t\t\t.ticks(10)\n\t\t\t.tickSize(5,0); //the second argumnet takes the first and last tick off\n\t}", "_drawYGrid(yAxisTag) {\n let layout = this._chartLayout;\n let yAxisConfig = yAxisTag.axisConfig;\n let yAxisLayout = yAxisTag.axisLayout;\n let yAxisRect = yAxisLayout.areaRect;\n\n this._context.textBaseline = \"middle\";\n this._context.font = yAxisConfig.fontSize + \"px \" + this.displayOptions.chartArea.fontName;\n\n let labelMarginT = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 0);\n let labelMarginR = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 1);\n let labelMarginB = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 2);\n let labelMarginL = scada.chart.DisplayOptions.getMargin(yAxisConfig.labelMargin, 3);\n let prevLblY = NaN;\n let tickL, tickR, minorTickL, minorTickR, axisX, lblX;\n\n if (yAxisConfig.position === scada.chart.AreaPosition.LEFT) {\n this._context.textAlign = \"right\";\n tickR = yAxisRect.right - 1;\n tickL = tickR - yAxisConfig.majorTickSize;\n minorTickR = tickR;\n minorTickL = minorTickR - yAxisConfig.minorTickSize;\n axisX = yAxisRect.right - 1;\n lblX = tickL - labelMarginR;\n } else {\n this._context.textAlign = \"left\";\n tickL = yAxisRect.left;\n tickR = tickL + yAxisConfig.majorTickSize;\n minorTickL = tickL;\n minorTickR = minorTickL + yAxisConfig.minorTickSize;\n axisX = yAxisRect.left;\n lblX = tickR + labelMarginL;\n }\n\n let gridL = layout.plotAreaRect.left + layout.canvasXOffset;\n let gridR = gridL + layout.plotAreaRect.width - 1;\n let axisT = yAxisRect.top + layout.canvasYOffset;\n let axisB = axisT + yAxisRect.height - 1;\n\n for (let y = yAxisLayout.gridStart; y < yAxisTag.max; y += yAxisLayout.gridStep) {\n let ptY = this._trendYToCanvasY(y, yAxisTag);\n\n // horizontal grid line\n if (yAxisConfig.showGridLines) {\n this._setColor(this.displayOptions.plotArea.gridColor);\n this._drawLine(gridL, ptY, gridR, ptY);\n }\n\n // major tick and axis line\n this._setColor(yAxisConfig.lineColor);\n this._drawLine(tickL, ptY, tickR, ptY);\n this._drawLine(axisX, axisT, axisX, axisB);\n\n // minor ticks\n if (yAxisConfig.minorTickCount > 0) {\n for (let minorTickY = y + yAxisLayout.minorTickStep, maxMinorTickY = y + yAxisLayout.gridStep;\n minorTickY < maxMinorTickY && maxMinorTickY < yAxisTag.max; minorTickY += yAxisLayout.minorTickStep) {\n\n let minorTickCnvY = this._trendYToCanvasY(minorTickY, yAxisTag);\n this._drawLine(minorTickL, minorTickCnvY, minorTickR, minorTickCnvY);\n }\n }\n\n // label\n this._setColor(yAxisConfig.textColor);\n let lblY = ptY;\n\n if (isNaN(prevLblY) || prevLblY - lblY > yAxisConfig.fontSize) {\n this._context.fillText(y.toFixed(yAxisLayout.gridDigits), lblX, lblY);\n prevLblY = lblY;\n }\n }\n\n // axis title\n if (yAxisConfig.showTitle && yAxisTag.title) {\n this._context.textAlign = \"center\";\n this._context.save();\n this._context.translate(yAxisRect.left + layout.canvasXOffset, yAxisRect.bottom + layout.canvasYOffset);\n this._context.rotate(-Math.PI / 2);\n let titleY;\n\n if (yAxisConfig.position === scada.chart.AreaPosition.LEFT) {\n this._context.textBaseline = \"top\";\n titleY = labelMarginT;\n } else {\n this._context.textBaseline = \"bottom\";\n titleY = yAxisRect.width - labelMarginB;\n }\n\n this._context.fillText(yAxisTag.title, yAxisRect.height / 2, titleY, yAxisRect.height);\n this._context.restore();\n }\n }", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n \n yAxis.transition()\n .duration(300).call(leftAxis);\n\n return yAxis;\n }", "function barChartOptions() {\n return {\n axisY: {\n labelInterpolationFnc: function(value) {\n return `${value} mi`;\n },\n },\n };\n}", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n \n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n \n return yAxis;\n}", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n }", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n }", "function assignYAxisToData(chart, data) {\n\t// console.log('I am assignYAxisToData(%O, %O)', chart, data);\n\tvar columns = data.columns,\n\t\tselectedMeasures = data.measuresSelected,\n\t\tfound, dataName;\n\tfor (var i = 1; i < columns.length; i++) {\n\t\tfound = false;\n\t\tdataName = columns[i][0];\n\t\tfor (var j = 0; j < selectedMeasures.length; j++) {\n\t\t\t// Per le misure selezionate\n\t\t\tif (dataName.includes(selectedMeasures[j].name)) {\n\t\t\t\tif (selectedMeasures[j].type == 0 || selectedMeasures[j].type == 2) {\n\t\t\t\t\tconsole.log(dataName + \" goes to Y\");\n\t\t\t\t\tchart.data.axes()[dataName] = 'y';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tconsole.log(dataName + \" goes to Y2\");\n\t\t\t\t\tchart.data.axes()[dataName] = 'y2';\n\t\t\t\t}\n\t\t\t\tfound = true; // trovata una misura che sicuramente e' portata\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Per altre misure\n\t\tif (!found) {\n\t\t\tif (dataName.toLowerCase().includes('[l/s]')) {\n\t\t\t\tconsole.log(dataName + \" goes to Y\");\n\t\t\t\tchart.data.axes()[dataName] = 'y';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log(dataName + \" goes to Y2\");\n\t\t\t\tchart.data.axes()[dataName] = 'y2';\n\t\t\t}\n\t\t}\n\t}\n\tchart.flush();\n}", "function gridYaxis() {\t\t\n return d3.axisLeft(y)\n .ticks(5)\n \n}", "function modifyYaxisName(z){\n var notation =[];\n for (var i= 0; i<z.length; i++){\n notation.push(`OTU ${z[i]}`)\n }\n return notation;}", "function drawAxisY(svg, yAxis, graphXStart, axisPadding) {\n drawAxis(svg, yAxis, 'translate(' + (graphXStart + axisPadding) + ', 0)', {});\n}", "function renderYAxis(newYScale, yAxis) {\n let leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition().duration(2000).call(leftAxis);\n\n return yAxis;\n}", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n // use a transition to shift the axis\n yAxis.transition()\n .duration(svgTransitionDuration)\n .call(leftAxis);\n //\n return yAxis;\n}", "function updateChart(chart, dataValues, title) {\n console.log(chart.id);\n console.log(\"data\",dataValues);\n chart.data.datasets[0].data = dataValues;\n console.log(\"universidad:\",title);\n if(chart.id == 0){\n chart.options.title.text = \"Estadísticas de estudiantes de la \"+\" \"+title+\" \"+\"año 2017\";\n }else{\n\n chart.options.title.text = \"Estadísticas de docentes de la \"+\" \"+title+\" \"+\"año 2017\";\n\n\n\n }\n //chart.options.title.text = title;\n //console.log(\"chart\", chart);\n chart.update();\n }", "function yAxis(g){\n g.attr(\"transform\", 'translate('+settings.margin.left+',0)')\n .attr('id','yAxis')\n .call(d3.axisLeft(y).tickSize(0))\n .call(g => g.select(\".domain\").remove())\n}", "function updateLineGraphTitle(data_option, year) {\n var title = lineGraphTitles[data_option] + \" in \" + year;\n d3.select(\"#lineGraphTitle\").text(title);\n}", "function updateTitle(chartText) {\n $('#default-chart-map-variable').html(chartText);\n }", "yAxisControl(y) {\n this.yAxis = y;\n this.referringToClass.style.top = `${this.yAxis}px`;\n }", "function renderyaxis(yscale, yaxis) {\n var leftAxis = d3.axisLeft(yscale);\n yaxis.transition()\n .duration(1000)\n .call(leftAxis);\n return yaxis;\n }", "function renderYAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale);\n // use a transition to shift the axis\n yAxis.transition()\n .duration(svgTransitionDuration)\n .call(leftAxis);\n return yAxis;\n}", "function styleYAxis(selection) {\n // Add classes for tests.\n selection.attr('class', 'chartYAxis');\n\n // These paths are added by d3.axis, but we don't need them.\n selection.selectAll('path')\n .remove();\n\n selection.selectAll('line')\n .attr('class', 'chartYAxisTick__mark');\n\n // Move the text to the left side of the SVG.\n selection.selectAll('text')\n .attr('class', 'chartYAxisTick__text')\n .attr('dx', -(width - marginRight));\n\n // Add small background boxes behind each tick's text.\n // Remove existing boxes first, to avoid duplicates.\n selection.selectAll('rect')\n .remove();\n selection.selectAll('.tick')\n .insert('rect', ':last-child')\n .attr('class', 'chartYAxisTick__background')\n .attr('x', -marginLeft)\n .attr('y', -8)\n .attr('width', marginLeft)\n .attr('height', 15)\n .attr('rx', 2) // Border-radius\n .attr('ry', 2); // Border-radius\n }", "function readTitle(dtxData, value){\n dtxData.chartInfo.title = value;\n }", "function make_y_gridlines() {\t\t\n \t \treturn d3.axisLeft(yo).ticks(5)\n \t }", "homeYAxis(){\n this._updateYAxis(this.yMinHome, this.yMaxHome);\n }", "set title( val ) {\n this.title_bar_text.innerText = val;\n }", "function renderYaxes(newYScale, yAxis) {\n let leftAxis = d3.axisLeft(newYScale);\n \n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n \n return yAxis;\n}", "function renderYAxis(newLinearYScale, yAxis) {\n\n // Call the axisLeft function to update the axis values\n var leftAxis = d3.axisLeft(newLinearYScale);\n\n // Transition to the newly chosen y-axis\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n}", "function getTitleMarg() {\r\n return (y.domain()[1] < 1000) ? -40 : \r\n (y.domain()[1] < 10000) ? -45 :\r\n (y.domain()[1] < 100000) ? -50 :\r\n (y.domain()[1] < 1000000) ? -55 : -60;\r\n }", "function gen_yaxis(percentile, yx, y, minValue, maxValue, metricName){\n\n //set normalize the y-scale\n if (percentile) {\n y.domain([minValue/maxValue, maxValue/maxValue]);\n var yAxis = d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .tickFormat(d3.format(\"%\"));\n\n yx.selectAll(\".axis_label\").remove();\n yx\n .attr(\"class\", \"y_axis\")\n .call(yAxis)\n .append(\"text\")\n .attr('id','yAxisLabel')\n //.attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", -28)\n .attr(\"x\",28)\n .attr(\"dy\", \".71em\")\n .style(\"text-anchor\", \"end\")\n .attr(\"class\", \"axis_label\")\n .text(\"Percentile\"); // label at the side of the y-axis\n\n //set raw value y-scale\n } else {\n y.domain([minValue, maxValue]);\n var yAxis = d3.svg.axis()\n .scale(y)\n .orient(\"left\")\n .tickFormat(d3.format(\"d\"));\n\n yx\n .attr(\"class\", \"y_axis\")\n .call(yAxis)\n .append(\"text\")\n .attr('id','yAxisLabel')\n //.attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", -28)\n .attr(\"x\",28)\n .attr(\"dy\", \".71em\")\n .style(\"text-anchor\", \"end\")\n .text(metricName); // label at the side of the y-axis\n }\n\n}", "function yText(circlesGroup, yLinScale, paramY) {\n circlesGroup.transition()\n .duration(1000)\n .attr(\"dy\", d=> yUpdate(d[paramY]));\n return circlesGroup;\n }", "function setYval(val) {\n\t// Update yVal\n\tyVal = val;\n\t// Update the axis\n\tyScale.domain([d3.min(data, function(d) { return parseFloat(d[yVal]); })-1,\n\t\t\t\t d3.max(data, function(d) { return parseFloat(d[yVal]); })+1])\n\tyAxis.scale(yScale);\n\tyAxisG.call(yAxis);\n\tyLabel.text(yVal);\n\t// Update the points\n\td3.selectAll('.point')\n\t\t.transition()\n\t\t.duration(transDur)\n\t\t.attr('cy', function(d) { return yScale(d[yVal]); });\n}", "function makeStandardChart(title, subtitle, units, utcData) {\r\n\twindow.utcData = utcData;\r\n\tdataVals = (document.getElementById(\"utcGraph\").checked) ? utcData : adjustDataToTZO(utcData);\r\n\tconsole.log($(\"#duration\").val(), dataVals.length );\r\n\tmarkerRadius = (utcData.length > 200) ? 1 : 2;\r\n\tunits = $.trim(units).toLowerCase();\r\n\tif (units.toLowerCase() in unitAlias) {\r\n\t console.log(units, unitAlias[units.toLowerCase()]); \r\n\t units = unitAlias[units.toLowerCase()]; \r\n\t}\r\n\tvar yAxisArr = [{\r\n title: { \r\n text: units,\n align: 'high',\n rotation:0,\n offset: 10,\n y: -10\n } \r\n }];\r\n //Have two y-axises if there is a conversion\r\n if (units in conversions) {\r\n yAxisArr.push({\r\n title: {\r\n text: conversions[units][0],\r\n align: 'high',\r\n rotation:0,\r\n offset: 20,\r\n y: -10\r\n },\r\n opposite: true,\r\n linkedTo:0,\r\n labels: {\n formatter: function() {\r\n // console.log(\"label converted:\", this.value, convert(this.value, units)[0]);\n return convert(this.value, units)[0];\n }\r\n } \r\n });\r\n }\r\n /// define the options\r\n\tvar options = {\r\n\t\tchart: \r\n\t\t\t{ \r\n\t\t\t\trenderTo: 'chart',\r\n\t\t\t\tevents: {\r\n\t\t\t\t\tload: function(event) {\r\n\t\t\t\t\t chartBusyDone(); \r\n\t\t\t\t\t}\r\n\t\t\t\t} \r\n\t\t\t},\r\n\t\ttitle: { text: title },\r\n\t\tsubtitle: { text: subtitle },\r\n\t\txAxis: { type: 'datetime' },\r\n yAxis: yAxisArr,\r\n\t\t// yAxis: [\n\t\t\t// { title: \n\t\t\t\t// { \n\t\t\t\t\t// text: unitStr,\n\t\t\t\t\t// align: 'high',\n\t\t\t\t\t// rotation:0,\n\t\t\t\t\t// offset: 10,\n\t\t\t\t\t// y: -10\n\t\t\t\t// } \n\t\t\t// }],\r\n\t\tlegend: { enabled: false },\r\n\t\ttooltip: {\r\n\t\t\tshared: true,\r\n\t\t\tcrosshairs: true,\r\n\t\t\tpointFormat: '{series.name}: <b>{point.y}</b> '+units,\r\n\t\t\tformatter: function () {\r\n\t\t\t thisDate = Highcharts.dateFormat('%a %b %e %Y %H:%M', this.x)+\"<br>\";\r\n\t\t\t var value = ((typeof this.y == 'number') && (this.y % 1 != 0))? this.y.toFixed(2) : this.y;\r\n if (units in conversions) {\r\n post = convert(this.y, units);\r\n // var post = parseFloat(this.y*conversions[units][1]).toFixed(1);\r\n // var postUnit = conversions[units][0];\r\n thisDate += title+\": <b>\"+value+units+\"</b>,<b>\"+post[0]+post[1]+\"</b>\";\r\n } else {\r\n thisDate += title+\": <b>\"+value+units+\"</b>\";\r\n } \r\n if (dataVals[0].length == 3) {\r\n thisDate += \"<br>Direction: <b>\"+this.points[0].key+\"\\u00B0</b>\"; //\\u00B0 is degree symbol\r\n }\r\n return thisDate;\r\n\t\t\t},\r\n\t\t\tdateTimeLabelFormats: {\r\n\t\t\t\tmillisecond: '%b %e %y %H:%M:%S.%L',\r\n\t\t\t\tsecond: '%b %e %y %H:%M:%S',\r\n\t\t\t\tminute: '%b %e %y %H:%M',\r\n\t\t\t\thour: '%b %e %y %H:%M',\r\n\t\t\t\tday: '%b %e %y %H:%M',\r\n\t\t\t\tmonth: '%b \\'%y',\r\n\t\t\t\tyear: '%Y'\r\n\t\t\t}\r\n\t\t},\r\n\t\tplotOptions: { \r\n\t\t\tline: {\r\n\t\t\t\tmarker: { radius: markerRadius}\r\n\t\t\t}\r\n\t\t},\r\n\t\tseries: [{ \r\n\t\t\t\t\tname: title,\r\n\t\t\t\t\t// data: dataVals\r\n\t\t\t\t\tdata:[] \r\n\t\t\t\t}]\r\n\t};\r\n\r\n //Direction\r\n if ((typeof dataVals[0] != 'undefined') && (dataVals[0].length == 3)) {\r\n for (i in dataVals){\r\n arr = dataVals[i];\r\n //only use marker symbol if less than 50 points\r\n if (dataVals.length > 100) { //50?!!!\r\n options.series[0].data.push({ x: arr[0], y: arr[1], name: arr[2].toFixed().toString() });\r\n } else {\r\n if(/wind/i.test(title) || /wind/i.test(subtitle)) {\r\n dirMarker = 'url(http://neocoweb.ucsd.edu/cgi-bin/asbs/barb.py?sp='+arr[1]+'&dir='+arr[2]+')'\r\n } else {\r\n //ocean current\r\n dirMarker = 'url(http://neocoweb.ucsd.edu/cgi-bin/asbs/arrow.py?dir='+arr[2]+')'\r\n }\r\n options.series[0].data.push({ x: arr[0], y: arr[1], marker: {symbol: dirMarker}, name: arr[2].toFixed().toString()}); \r\n }\r\n }\r\n } else {\r\n options.series[0].data = dataVals;\r\n // options.tooltip.formatter = function () {}\r\n }\r\n \r\n \r\n\tht = $(\"#chartWrapper\").height();\r\n\twd = $(\"#chartWrapper\").width();\r\n\tmyLayout.south.options.onresize_end = function () {setChartSize();}\r\n\t\r\n\t// if (myLayout.state.south.isVisible == false) {\n\t\t// myLayout.open('south', false);\n\t// }\r\n\r\n\tnoDataMsg = 'No data is available at the selected location and/or with in the \"Time Span\"';\r\n\tif (dataVals.length == 0) {\r\n\t\torig = $(\"#duration\").val();\r\n\t\tvar loop = ((typeof chart == 'undefined') || (loop == true)) ? true: false;\r\n\t\tif ((document.getElementById(\"now\").checked == true) && (orig != 31536000) && (typeof loop != 'undefined') && (loop)) {\r\n\t\t\t$(\"#duration option\").each(function(){\r\n\t\t\t\toptVal = parseInt($(this).val())\r\n\t\t\t\tif (optVal > orig) {\r\n\t\t\t\t\tvar step = function (optVal) {\r\n\t\t\t\t\t\tvar dfrd = $.Deferred();\r\n\t\t\t\t\t\t$(\"#duration\").val(optVal.toString());\r\n\t\t\t\t\t\tconsole.log(\"setting duration:\", optVal);\r\n\t\t\t\t\t\ttimeSpan();\r\n\t\t\t\t\t\tsetGraph();\r\n\t\t\t\t\t\tdfrd.resolve(); // use Deferred??\r\n\t\t\t\t\t\treturn dfrd.promise();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar callstep = step(optVal);\r\n\t\t\t\t\tstep.done(); //Doesn't work with callstep.done()??\r\n\t\t\t\t\t// step.done(function() {console.log(\"post setGraph\");}); //Not right console log\r\n\t\t\t\t} //else { console.log(\"ignore - smaller duration\");}\r\n\t\t\t});\r\n\t\t\tloop = false;\r\n\t\t} else {\r\n\t\t\tchartError(noDataMsg);\r\n\t\t}\r\n\t\tdelete loop;\r\n\t\t// chartError(noDataMsg);\r\n\t}\t\r\n\tchart = new Highcharts.Chart(options);\r\n\tsetChartSize();\r\n\t$(\"#chart\").val(\"usingChart\");\r\n\r\n}", "function renderYaxes(newYScale, yAxis) {\n let leftAxis = d3.axisLeft(newYScale);\n\n yAxis.transition()\n .duration(1000)\n .call(leftAxis);\n\n return yAxis;\n}", "function renderLabelsVertical() {\n var i, origin;\n\n // Y Labels\n for (i = 0; i < this.range.max - this.range.min + 1; i++) {\n origin = getInnerChartPoint([\n 0,\n 100 - (i * 100) / (this.range.max - this.range.min)\n ]);\n\n origin[0] -= LABEL_MARGIN;\n\n this.svg.add('text', origin, String(i + this.range.min), { class: 'chart-label chart-label-y' });\n }\n}", "function yScale(universities2, chosenYAxis) {\n // create scales\n var yLinearScale = d3.scaleLinear()\n .domain([0,\n 110\n ])\n .range([height, 0]);\n return yLinearScale;\n}", "function format_y_tooltip_ph(dataPoint) {\n return \" pH: \" + dataPoint.ph;\n }", "function appendChartTitle(svg, plot) {\n svg.append('text')\n .attr('id', 'chartTitle')\n .attr('x', plot.svg.width/2)\n .attr('y', plot.padding.top * 0.66)\n .text('Carbo-Hydroxyl-Frutinoid Concentrations'); //Ok I just made up this concept\n }", "function make_y_gridlines() {\n return d3.axisLeft(y)\n .ticks(10);\n }", "function yScale (data, yvalue) {\n var yLinearScale = d3.scaleLinear()\n .domain(d3.extent(data, data => data[yvalue]))\n .range([chartHeight, 0])\n return yLinearScale;\n }", "function initYaxis(yLinScale, yAxis) {\n var leftAx = d3.axisLeft(yLinScale);\n yAxis.transition()\n .duration(1000)\n .call(leftAx);\n return yAxis;\n }", "function make_y_gridlines() {\n return d3.axisLeft(YScale)\n .ticks(10)\n }", "function showAxis(xaxis, yaxis) {\n\t\n\tg.select('.x.axis')\n\t .call(xaxis)\n\t //.attr('transform', 'translate(0,' + height + ')')\n\t //.transition().duration(400)\n\t //.call(xaxis)\n\t //.selectAll('text')\n\t //.style('text-anchor','end')\n\t //.attr(\"dx\", \"-1em\")\n\t //.attr(\"dy\", \"-0.5em\")\n\t //.attr('transform', function(d){\n\t //\treturn \"rotate(-90)\";\n\t //})\n\t .style('opacity', 1.0)\n\t //.selectAll(\".tick text\")\n\t //.call(wrap, 10)\n\t;\n\t\n\n\tg.select('.y.axis')\n\t .call(yaxis)\n\t .style('opacity', 1.0);\n//\t .transition().duration(400)\n//\t .style('opacity', 1.0);\n\n\t\n//\tg.select('.x.axis')\n//\t .call(axis)\n//\t .transition().duration(500)\n//\t .style('opacity', 1);\n }", "renderYAxis(column: Array, maxYValue: any) {\n return (\n <div className=\"y-axis-wrapper\">\n <div className=\"y-axis\">\n {column.map((item, i) => (\n <div className=\"y-caption\" key={i}>\n {i % 2 === 0 ? maxYValue - item.y_value : null}\n </div>\n ))}\n </div>\n </div>\n );\n }", "function make_y_gridlines() {\t\t\n return d3.axisLeft(y)\n .ticks( 2*commentTicks )\n }", "function make_y_gridlines() {\t\t\n return d3.axisLeft(yScale)\n .ticks(10)\n }", "configYAxis(yConf) {\n // Default: duration, bounds and orient\n const bounds = yConf.bounds;\n const yAxisConfig = {\n duration: yConf.duration,\n bounds,\n orient: yConf.yOrient,\n tickSize: 0,\n };\n\n // Assemble the y-scale object\n const yDomain = yConf.data.map(d => d.category);\n // NOTE: rangebands for bar charts are 'top-to-bottom', unlike\n // other components that run 'bottom-to-top'. This relates to\n // sorting...\n yAxisConfig.scale = D3.scale.ordinal()\n .rangeBands([ 0, bounds.height ], 0.1)\n .domain(yDomain);\n\n return yAxisConfig;\n }", "formatYAxis(tickItem) {\n\treturn tickItem.toLocaleString();\n }", "async _refreshBarTitle() {\n this._top.attr(\"width\", this._dimView.width).attr(\"height\", this._barTitleHeight);\n }", "function getYaxisOptions(opts, unit, min, max){\r\n\topts.axes.yaxis = {\r\n min: min,\r\n max: max,\r\n numberTicks: 5,\r\n autoscale: true,\r\n label: unit,\r\n tickOptions: {\r\n          angle: 0\r\n },\r\n tickInterval: null\r\n };\r\n opts.seriesDefaults.shadow = true;\r\n opts.seriesDefaults.pointLabels = {show: true};\r\n opts.seriesDefaults.markerOptions.color = 'darkblue';\r\n opts.highlighter.sizeAdjust = 4; \r\n\r\n return opts;\r\n}", "function appendYAxis(paddingGroup, scales) {\n const yAxis = d3.axisLeft().scale(scales.y);\n paddingGroup.append('g')\n .attr('class', 'yAxis')\n .call(yAxis);\n }", "function changeYAxes(newYScale, yAxis) {\n let leftAxis = d3.axisLeft(newYScale).ticks(10);\n \n yAxis.transition()\n .duration(500)\n .call(leftAxis);\n \n return yAxis;\n}", "function make_y_gridlines() {\t\t\r\n return d3.axisLeft(y_scale);\r\n}", "function addFacebookAxis(g, y) {\n let yAxis = d3.svg.axis()\n .scale(y)\n .orient(\"left\");\n\n g.append(\"g\")\n .attr(\"class\", \"y axis\")\n .call(yAxis);\n}", "function setupYScale()\n{\n var maxPopulation = d3.max(Spain.concat(Germany), function(d, i) {return d.y;});\n\n y = d3.scaleLinear()\n .range([height, 0])\n .domain([0, maxPopulation]);\n\n}", "function setChartYRange(chart, minY, maxY, minY2, maxY2) {\n\t// console.log(\"I am setChartYRange(%O, %s, %s, %s, %s)\", chart, minY, maxY, minY2, maxY2);\n\tchart.axis.range({\n\t\tmin: {\n\t\t\ty: minY,\n\t\t\ty2: minY2\n\t\t},\n\t\tmax: {\n\t\t\ty: maxY,\n\t\t\ty2: maxY2\n\t\t}\n\t});\n}", "yAxisScale(d) {\n const vis = this;\n\n const yAxisName = d3\n .scaleOrdinal()\n .domain(vis.listOfHabits)\n .range(vis.yAxisData);\n\n return yAxisName(d);\n }", "setTextValues() {\n const dataset = this.settings?.dataset;\n if (!dataset || (dataset && dataset.constructor !== Array)) {\n return;\n }\n const elems = this.element[0].querySelectorAll('.bar-chart .axis.y .tick text');\n const brief = {};\n if (this.ellipsis.use) {\n brief.maxWidth = this.element.width();\n brief.transX = this.svg?.node()?.transform?.baseVal?.consolidate()?.matrix?.e || 1;\n brief.customCss = () => ({\n tooltip: { maxWidth: `${brief.maxWidth}px` },\n arrow: { left: this.isRTL ? 'calc(100% - 20px)' : '20px' }\n });\n }\n const getText = (d, i) => {\n let r;\n if (this.ellipsis.use) {\n r = charts.trimText(d.name, this.ellipsis.threshold);\n if (r.substr(-3) === '...') {\n const textWidth = charts.calculateTextRenderWidth(d.name);\n const truncatedWidth = charts.calculateTextRenderWidth(r);\n const parentNode = elems[i].parentNode;\n const calculatePos = (rect) => {\n const numOfLines = Math.ceil(textWidth / brief.maxWidth);\n let x = brief.transX - truncatedWidth;\n let y = rect.top;\n x = (x < 0 ? 30 : x) + 20;\n y = (y < 0 ? 30 : y) - 36;\n if (numOfLines > 1) {\n y -= (33 * ((numOfLines - 1) * 0.5));\n }\n if (this.isRTL) {\n x = rect.left - textWidth + brief.transX;\n }\n return { x, y };\n };\n\n if (!env.browser.isIE11()) {\n r = d.name;\n elems[i].classList.add('hidden');\n d3.select(parentNode).append('foreignObject')\n .attr('overflow', 'visible')\n .attr('width', `${brief.transX}`)\n .attr('height', '16')\n .attr('class', `foreign-object tick-y${i}`)\n .attr('x', `-${brief.transX}`)\n .attr('y', '-1em')\n .attr('requiredFeatures', 'http://www.w3.org/TR/SVG11/feature#Extensibility')\n .html('<div class=\"text ellipsis\" resizeable=\"false\" xmlns=\"http://www.w3.org/1999/xhtml\"></div>');\n const ellipsisEl = parentNode.querySelector('.text.ellipsis');\n if (ellipsisEl) {\n const textContent = document.createTextNode(d.name);\n ellipsisEl.appendChild(textContent);\n }\n }\n\n d3.select(parentNode)\n .on(`mouseover.${this.namespace}`, () => {\n const pos = calculatePos(parentNode.getBoundingClientRect());\n charts.showTooltip(pos.x, pos.y, d.name, 'top', brief.customCss());\n })\n .on(`mouseout.${this.namespace}`, () => charts.hideTooltip());\n }\n } else {\n r = charts.getLabel(d, this.viewport);\n }\n return r;\n };\n\n if (!this.settings.selectable) {\n this.element.find('.bar').css('cursor', 'inherit');\n }\n\n if (this.settings.isGrouped) {\n dataset.forEach((d, i) => {\n elems[i].textContent = getText(d, i);\n });\n } else {\n dataset.forEach((d) => {\n const keys = Object.keys(d).map(key => key);\n const values = Object.keys(d).map(key => d[key]);\n values.forEach((key, i) => {\n if (key && key.constructor === Array) {\n key.forEach((k, i2) => {\n if (keys[i] !== 'attributes') {\n elems[i2].textContent = getText(k, i2);\n }\n });\n }\n });\n });\n }\n }", "function drawTitle(color, title_Y)\n{\n ctx.font = \"50px Arial\";\n ctx.textAlign = \"center\";\n ctx.strokeStyle = color;\n ctx.lineWidth = 3;\n ctx.strokeText(\"CASINO\", MID_CANVAS, title_Y);\n}", "function renderyAxis(newYScale, yAxis) {\n var leftAxis = d3.axisLeft(newYScale); \n yAxis.transition()\n .duration(500)\n .call(leftAxis);\n return yAxis;\n}", "_updateYAxis(yMin, yMax){\n if(yMin >= yMax) return;\n\n this.yMin = yMin;\n this.yMax = yMax;\n this.yRange.domain([yMin, yMax]);\n this.svg.select(\".y.axis\").call(this.yAxis); // update svg\n\n this._recalculateDyValues();\n }", "updateChart(data, yAxisLabel = \"count\") {\n\n\t\tlet _this = this;\n\t\tlet chart = d3.select(\"#compChart\");\n\t\tlet countMin = d3.min(data, d => d.count);\n\t\tlet countMax = d3.max(data, d => d.count);\n\n\t\t//Create the scales\n\t\t_this.xScale = d3.scaleBand()\n\t\t\t.range([0, _this.width - _this.xOffset])\n\t\t\t.padding(0.1);\n\t\t_this.xScale.domain(data.map(d => d.bucket));\n\t\t\n\t\t_this.yScale = d3.scaleLinear()\n\t\t\t.domain([countMax, 0])\n\t\t\t.range([0, _this.height])\n\t\t\t.nice();\n\t\t\n\t\t//Draw the bucket/x axis\n\t\tlet xAxis = d3.axisBottom();\n\t\txAxis.scale(_this.xScale);\n\t\t\n\t\tchart.select(\"#xAxis\")\n\t\t\t.attr(\"transform\", \"translate(\" + _this.xOffset + \", \" + (_this.height + _this.yOffset) + \")\")\n\t\t\t.call(xAxis)\n\t\t\t.selectAll(\"text\")\n\t\t\t.style(\"text-anchor\", \"end\")\n\t\t\t.style(\"font-size\", \"9pt\")\n\t\t\t.attr(\"transform\", \"rotate(-90)\")\n\t\t\t.attr(\"x\", -10)\n\t\t\t.attr(\"y\", -5);\n\t\t\n\t\t//Draw the count/y axis\n\t\tlet yAxis = d3.axisLeft()\n\t\t\t.tickFormat(function(d) {\n\t\t\t\tif (Math.floor(d) != d) {\n\t\t\t\t\td3.select(this.parentNode).select(\"line\").remove();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\treturn d;\n\t\t\t});\n\t\tyAxis.scale(_this.yScale);\n\t\t\n\t\tchart.select(\"#yAxis\")\n\t\t\t.attr(\"transform\", \"translate(\" + _this.xOffset + \", \" + _this.yOffset + \")\")\n\t\t\t.call(yAxis);\n\t\t\n\t\tchart.selectAll(\".descriptionLabel\").remove();\n\t\tchart.append(\"text\")\n\t\t\t.text(yAxisLabel)\n\t\t\t.attr(\"class\", \"descriptionLabel\")\n\t\t\t.attr(\"transform\", \"translate(\" + (10) + \", \" + (_this.yOffset + _this.height / 2) + \") rotate(-90)\")\n\t\t\t.style(\"text-anchor\", \"middle\");\n\t\t\n\t\t//Plot the points\n\t\tlet points = chart.select(\"#dataPoints\")\n\t\t\t.selectAll(\"circle\")\n\t\t\t.data(data);\n\t\tpoints.exit()\n\t\t\t.remove();\n\t\tpoints = points.enter()\n\t\t\t.append(\"circle\")\n\t\t\t.merge(points);\n\t\t\t\n\t\tpoints.attr(\"transform\", function(d) {\n\t\t\t\treturn \"translate(\" + _this.xScale(d.bucket) + \", \" + (_this.height + _this.yOffset) + \") scale(1, -1)\";\n\t\t\t})\n\t\t\t.style(\"fill\", \"black\")\n\t\t\t.attr(\"r\", 4)\n\t\t\t.attr(\"cx\", _this.xOffset + _this.xScale.bandwidth()/2)\n\t\t\t.attr(\"cy\", function(d) {\n\t\t\t\treturn _this.yScale(0) - _this.yScale(d.count);\n\t\t\t})\n\t\t\t.on(\"mouseover\", function(d){\n\t\t\t\td3.select(this)\n\t\t\t .append(\"title\")\n\t\t\t .text(d.count);\n\t\t\t})\n\t\t\t.on(\"mouseout\", function(d){\n\t\t\t\td3.select(this)\n\t\t\t .select(\"title\")\n\t\t\t .remove();\n\t\t\t});\n\n\t\t\t\n\t\t//Draw the lines\n\t\tlet lineGenerator = d3.line()\n\t\t\t\t.x(d => _this.xOffset + _this.xScale(d.bucket) + _this.xScale.bandwidth()/2)\n\t\t\t\t.y(d => _this.yOffset + _this.yScale(d.count));\n\t\t\n\t\tlet line = chart.select(\"#dataLines\");\n\t\tlet path = line.selectAll(\"path\");\n\t\tpath.attr(\"d\", function() {\n\t\t\t\treturn lineGenerator(data);\n\t\t\t})\n\t\t\t.attr(\"stroke\", \"black\")\n\t\t\t.attr(\"fill\", \"none\");\n\t}", "get title() { return this.Nls(\"Legend_Title\") }", "function make_y_gridlines() {\n return d3.axisLeft(y)\n .ticks(5)\n }" ]
[ "0.81841975", "0.81841975", "0.79346555", "0.6973585", "0.68735033", "0.6855978", "0.66479844", "0.65946144", "0.648563", "0.6378859", "0.6378859", "0.63450253", "0.6200137", "0.61728144", "0.60724187", "0.6066875", "0.60516083", "0.60153437", "0.6014644", "0.5994542", "0.5965452", "0.5948038", "0.593174", "0.5903053", "0.5887506", "0.58562684", "0.58355844", "0.5816724", "0.58162034", "0.5792396", "0.579209", "0.5775644", "0.5762681", "0.57563645", "0.5736632", "0.5704048", "0.5695218", "0.56750077", "0.56672996", "0.5648421", "0.5634555", "0.56338316", "0.56236124", "0.5620794", "0.5593614", "0.5591908", "0.55634665", "0.5558178", "0.5540042", "0.5538026", "0.5529564", "0.552515", "0.5524529", "0.55219924", "0.5517912", "0.5513735", "0.5508227", "0.5507516", "0.5506196", "0.55040616", "0.54989123", "0.5498467", "0.54594594", "0.54535365", "0.5448262", "0.5438113", "0.5436111", "0.54265064", "0.54164976", "0.5416456", "0.5413741", "0.5408711", "0.53985155", "0.53943443", "0.53873724", "0.53787696", "0.53699", "0.5364696", "0.53645194", "0.53549725", "0.5353094", "0.5346514", "0.5338703", "0.53329176", "0.5329748", "0.5325317", "0.53234446", "0.5321935", "0.53141356", "0.5313197", "0.53114337", "0.5311194", "0.5301345", "0.53013355", "0.5292636", "0.5289388", "0.5283177", "0.5278939", "0.52695465", "0.5261148", "0.52576643" ]
0.0
-1
all things done only once
function setup() { createCanvas(600, 400); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeOnce(){\n console.log('writeOnce()');\n doPicList();\n doLargeText();\n // tracker();\n onesZeros();\n}", "__init3() {this._finished = false;}", "__init3() {this._finished = false;}", "__init3() {this._finished = false;}", "once() {\n this.stop()\n this.step()\n }", "function trykk() {\n on[i] = false;\n finishTime = new Date().getTime();\n clearTimeout(timeID);\n utregningTid();\n updateView();\n}", "function takeShurikenHandler() {\n \ttakeShurikens(1);\n }", "function once(fn){var called=false;return function(){if(called){return;}called=true;return fn.apply(this,arguments);};}", "function once(fn){var called=false;return function(){var args=[],len=arguments.length;while(len--){args[len]=arguments[len];}if(called){return;}called=true;return fn.apply(this,args);};}", "function once(fn){var called=false;return function(){if(!called){called=true;fn.apply(this,arguments);}};}", "function once(fn){var called=false;return function(){if(!called){called=true;fn.apply(this,arguments);}};}", "function doublecheck(){\n if(!started){\n setup();\n }\n}", "function init() {\n\n// reset();\n lastTime = Date.now();\n main();\n }", "started() {\n\t\tthis.clearStats();\n\n\t}", "function processDuplicateFree(/* CODE HERE ONLY AFTER COMPLETING ALL OTHER TASKS */) {\n /* CODE HERE ONLY AFTER COMPLETING ALL OTHER TASKS */\n}", "function update(){\n keepResources()\n keepPopulation();\n keepProtection();\n keepPolitics();\n keepTech();\n}", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function AllDone(){\n \n}", "function doOnce(f) {\n\n\tif($.cookie(f.name) === null) {\n\t\t$.cookie(f.name, \"true\");\n\t\tf();\n\t}\n}", "firstUpdated() {}", "function init() {\r\n reset();\r\n lastTime = Date.now();\r\n main();\r\n }", "_reset() {}", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "_firstRendered() { }", "function allDone(){\n\t\tinitCalculator(currenciesData,feesData,userData);\n\t}", "function sync() {\n \n}", "doHomework() {\n this.homeworkDone = true;\n }", "function always () { return true }", "_complete() {\n this._resetCurrent(true);\n\n super._complete();\n }", "function Main()\n{\n initial_save=0;\n Savecheck();\n\n if (initial_save == 0)\n {\n \n Graphic1();\n Getstats();\n \n }\n\n if (initial_save == 1)\n {\n \n Graphic2();\n Load();\n Map();\n Hud();\n Commands();\n \n }\n \n}", "function mainPageSetupRepeat() {\n hideGenres(globalUserSettings);\n handleContinueWatching(globalUserSettings);\n}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function always(){return true}", "function upDateAll(){\n//UIONOFF = false; \n updateSaleItems1();\n// logSales(\"Shop 1 Called\",{})\n updateSaleItems2();\n// logSales(\"Shop 2 Called\",{})\n updateSaleItems3();\n// logSales(\"Shop 3 Called\",{})\n updateSaleItems4();\n// logSales(\"Shop 4 Called\",{})\n updateSaleItems5();\n// logSales(\"Shop 5 Called\",{})\n updateSaleItems6();\n updateSaleItems7();\n}", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "setupOnce() {\n if (!isBrowser()) {\n return;\n }\n\n this._setup();\n\n // XXX: See method comments above\n setTimeout(() => this.start());\n }", "function debug_reset(){\n debug_executed = false\n debug[\"debug object.self\"][1] ? console.log(\"ready\") : \"\"\n }", "function refreshInfo() { \t \n everyone.now.setStatus(statusv);\n\t upSongNum();\n\t setTimeout(upPlaylist(everyone),350);\n }", "firstRun() { }", "function cachedExecute() {\n setTimeout(function() {\n if ($(imgHrefRemoved).length) {\n init();\n }\n }, 1000);\n }", "function init() {\n lastTime = Date.now();\n main();\n }", "function init() {\n lastTime = Date.now();\n main();\n }", "function reset() {\n\tstarted = false; count = 0;\n\treturn;\n}", "function processonce()\n{\n\tdocument.getElementById('autopencil').checked = false;\n\tprocess();\n\tcheck(\"N\");\n}", "function Synchronized () {}", "function Synchronized () {}", "function Synchronized () {}", "static postUpdate() {\n return false;\n }", "postrender() {\n this.count++;\n if (this.mode === settings_1.settings.GC_MODES.MANUAL) {\n return;\n }\n this.checkCount++;\n if (this.checkCount > this.checkCountMax) {\n this.checkCount = 0;\n this.run();\n }\n }", "function init() {\r\n\t // quit if this function has already been called\r\n\t if (arguments.callee.done) return;\r\n\t\r\n\t // flag this function so we don't do the same thing twice\r\n\t arguments.callee.done = true;\r\n\t\r\n\t // kill the timer\r\n\t if (_timer) clearInterval(_timer);\r\n\t\r\n\t savedqueries_init();\r\n\t}", "function redo(){\n\t\t\tflush();\n\t\t\tinit();\n\t\t\ttimeout = false;\n\t\t}", "function reset() {\n started = false;\n count = 0;\n return;\n}", "function eventHandlersOnce() {\n\tif (globalDebug) {console.group(\"Event Handlers Once\");}\n\n\tmenuTrigger();\n\n\tif (globalDebug) {console.groupEnd();}\n}", "function _____SHARED_functions_____(){}", "function alwaysRunOnload () {\n\t\t// Placeholder/Future use.\n\t}", "function reloadData() {\n if (typeof (CPData) != \"undefined\") { CPData.regenerate(); }\n if (typeof (CPDataSoon) != \"undefined\") { CPData.regenerate(); }\n if (typeof (CPDataDownloaded) != \"undefined\") { CPData.regenerate(); }\n loadInfo();\n }", "reset() {}", "reset() {}", "reset() {}", "_postProcessing() {\n // None yet...\n }", "function once (fn) {\n\t var called = false;\n\t return function () {\n\t if (!called) {\n\t called = true;\n\t fn();\n\t }\n\t }\n\t}", "function once (fn) {\n\t var called = false;\n\t return function () {\n\t if (!called) {\n\t called = true;\n\t fn();\n\t }\n\t }\n\t}", "function once (fn) {\n\t var called = false;\n\t return function () {\n\t if (!called) {\n\t called = true;\n\t fn();\n\t }\n\t }\n\t}", "refresh()\n\t{\n\t}", "function handler() {\n fired = true;\n }", "_main () {\n const n = Object.keys(this._accessories).length\n if (n > 0) {\n this.log('restored %d accessories from cache', n)\n }\n if (this.listenerCount('heartbeat') > 0) {\n let beat = -1\n setInterval(() => {\n beat += 1\n this.emit('heartbeat', beat)\n }, 1000)\n }\n this._upnpConfig(this._configJson.upnp || {})\n if (this.listenerCount('upnpDeviceAlive') > 0) {\n this._upnpMonitor.listen()\n }\n if (this.listenerCount('upnpDeviceFound') > 0) {\n this._upnpMonitor.search()\n }\n }", "function reflowContent() {\n\t\t\t}", "function all_done() {\n console.log('\\n------------------------------------------ All Done ------------------------------------------\\n');\n broadcast_state('registered_owners');\n process.env.app_first_setup = 'no';\n\n logger.debug('hash is', helper.getHash());\n helper.write({ hash: helper.getHash() });\t\t\t\t\t\t\t//write state file so we know we started before\n ws_server.check_for_updates(null);\t\t\t\t\t\t\t\t//call the periodic task to get the state of everything\n}", "async makeFresh() {\n if (this.allFresh) {\n return;\n }\n if (!this.startDataLoaded) {\n await this.loadStartData();\n }\n this.updatePromises = [];\n this.updating = true;\n console.timeStart('update');\n for (let [uri, item] of this.map.entries()) {\n if (!item.fresh) {\n this.updateFile(uri, item);\n }\n }\n // May push more promises even when updating.\n for (let i = 0; i < this.updatePromises.length; i++) {\n let promise = this.updatePromises[i];\n await promise;\n }\n let updatedCount = this.updatePromises.length;\n console.timeEnd('update', `${updatedCount} files loaded`);\n this.updatePromises = null;\n this.updating = false;\n this.allFresh = true;\n }", "function main () {\n if (localStorage.getItem('productState')) {\n productState = getProductState();\n productObject = productState.productObject;\n previousImages = productState.previousImages;\n if (productState.userClicks <= maxClicks) {\n userClicks = productState.userClicks;\n } else {\n userClicks = 0;\n }\n start();\n } else {\n createProductObjects();\n start();\n }\n}", "function one(callback) {\n ///<summary>Execute a callback only once</summary>\n callback = callback || noop;\n\n if (callback._done) {\n return;\n }\n\n callback();\n callback._done = 1;\n }", "handler() {\n this.totalMilliseconds = this.time;\n this.endTime = this.now() + this.time;\n\n if (this.autoStart) {\n this.start();\n }\n }", "function freshStart(full) {\n\t\tif (full) {\n\t\t\t// Clear user name and country if TRUE\n\t\t\tuserName = \"\";\n\t\t\tuserCountry = \"\";\n\t\t\tuserCountryFlag = \"\";\n\t\t}\n\n\t\tmode = \"\";\n\t\tpairs = 2;\n\t\ttries = 0;\n\t\ttimeToBeat = 20;\n\t\ttime = 0;\n\t\ttimeUsed = 0;\n\t\tlevel = 1;\n\t\tpairsMatched = 0;\n\t\toverallTime = 0;\n\t\toverallTries = 0;\n\t\ttimer = false;\n\t\tchallenge = false;\n\t\tfinishGame = false;\n\t\turlArray = [];\n\t\tindexArray = [];\n\t}", "async work() {\n if(this.needConnect) {\n this.log.info(`(Re)Connect due to ${this.needConnect}`);\n await this.evo.login();\n this.needConnect = \"\";\n await this.initObjects();\n this.log.info(\"Connected ok\");\n }\n\n if(this.needConnect) \n return;\n \n await this.mergeStatus();\n \n if(this.evo.structureError) {\n this.log.info(`Structure refresh due to ${this.evo.structureError}`);\n this.needConnect = \"StructureError\";\n await this.initObjects();\n // catch the update next time...\n }\n }", "continue() {\n this.disable = false;\n this.add(null, null, true);\n }", "function resetStarted(){\n selectionStarted = false;\n bubbleStarted = false;\n insertionStarted = false;\n bogoStarted = false;\n quickStarted = false;\n heapStarted = false;\n mergeStarted = false;\n}", "function onReady () {\n restoreTime()\n }", "function allDone(){\n under = false;\n done = true;\n displayDealer(houseHand);\n dealerLogic(houseHand);\n}//end of allDone()", "function reset() {\n\nstart();\n\n}", "started () {}", "function requestData() {\n firstDataPass = true;\n __notifySubscribersForNewDataCache(firstDataValues);\n firstDataValues = [];\n }", "function work() {\n\t\t// Set running to true to prevent more calls until the first one is done\n\t\trunning = true;\n\t\t\n\t\t// Go through the DOM\n\t\twalk(document.body);\n\n\t\t// Set running to false to allow additional calls\n\t\trunning = false;\n\t}", "function clear() {\n once = 0;\n clearInterval(go)\n}", "function done() {}", "function init() {\n // quit if this function has already been called\n if (arguments.callee.done) return;\n\n // flag this function so we don't do the same thing twice\n arguments.callee.done = true;\n\n // kill the timer\n if (_timer) clearInterval(_timer);\n if (!document.getElementById) return false;\n\tstripeTables();\n\thighlightRows();\n\tstripeSubjectTables();\n\tstripeBrowseTables();\n\n}", "_reflow() {\n this._init();\n }" ]
[ "0.68978596", "0.60764295", "0.60764295", "0.60764295", "0.60626596", "0.6017886", "0.5959235", "0.58961654", "0.5879064", "0.583562", "0.583562", "0.5827244", "0.5810413", "0.5771238", "0.5762178", "0.5724368", "0.57111174", "0.56801957", "0.5660528", "0.56424916", "0.56411904", "0.56408095", "0.5636045", "0.5636045", "0.5636045", "0.5636045", "0.56223285", "0.5609224", "0.5601433", "0.5598376", "0.5597654", "0.5554315", "0.55520123", "0.5548707", "0.5547851", "0.5547851", "0.5547851", "0.5547851", "0.5547851", "0.5547851", "0.5547851", "0.5547851", "0.5547851", "0.5547851", "0.5547851", "0.5547851", "0.5547851", "0.55442613", "0.5541195", "0.5541195", "0.5533138", "0.5531182", "0.5528622", "0.5504409", "0.5501238", "0.5499472", "0.5499472", "0.5492581", "0.54565436", "0.54551584", "0.54551584", "0.54551584", "0.5452036", "0.5450553", "0.5450171", "0.5448062", "0.543525", "0.5435198", "0.54302263", "0.5429115", "0.54266375", "0.54190844", "0.54190844", "0.54190844", "0.5417705", "0.5416654", "0.5416654", "0.5416654", "0.54121125", "0.540328", "0.5397451", "0.53946906", "0.5376417", "0.53753984", "0.53748685", "0.53455186", "0.534549", "0.53451985", "0.5344057", "0.53418493", "0.53393453", "0.5337501", "0.53365964", "0.533292", "0.5318776", "0.53185344", "0.5318528", "0.5315578", "0.53080153", "0.5307512", "0.5307099" ]
0.0
-1
check and report error conditions fail will execute the callback
function error(args, err, cb) { if (err) { seneca.log.debug('error: ' + err); seneca.fail({code:'entity/error',store:name}, cb); } return err; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function failureCB(){}", "function failureCB() { }", "callbackWrapper() {\n if (this.error == \"obstruction_error\") {\n this.error = false\n this.callback('obstruction_error')\n } else if (this.error == 'outofbounds_error') {\n this.error = false\n this.callback('outofbounds_error')\n } else\n this.callback()\n }", "function statusError()\n\t{\n\t\tcallback();\n\t}", "onError() {}", "function error (err) {\n if(error.err) return;\n callback(error.err = err);\n }", "function failedCb(){\n\t\t\t\tdbm.updateJobFailed(uuid, function(err, rows, fields){\n\t\t\t\t\tif(err) log.error('update status error:', err);\n\n\t\t\t\t\tdbm.loadJobById(uuid, function(err, rows, fields){\n\t\t\t\t\t\tif(err) {\n\t\t\t\t\t\t\tlog.error('load job by id:%s error', uuid, err);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//delete job first\n\t\t\t\t\t\tlog.warn('delete job first...');\n\t\t\t\t\t\tdelete jobpool[uuid];\n\t\t\t\t\t\tlog.warn('query result:%s ', rows.length, rows);\n\t\t\t\t\t\tif(rows.length > 0 && rows[0].retry_times < rows[0].retry_max) {\n\t\t\t\t\t\t\tlog.warn('re-insert job...');\n\t\t\t\t\t\t\tlog.warn('retry_times:%s, retry_max:%s, retry_interval:%s', \n\t\t\t\t\t\t\t\trows[0].retry_times, rows[0].retry_max, rows[0].retry_interval);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar newRetryInterval = new Date( jobtime.getTime() + rows[0].retry_interval * 1000 )\n\t\t\t\t\t\t//if(retry_times >= retry_max)\n\t\t\t\t\t\t\tinitJobFromDb(jobid, jobname, jobtime, catg, opts, \n\t\t\t\t\t\t\t\trows[0].retry_max, rows[0].retry_times , cron_job, job_endtime, retry_interval);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t}", "function checkError() {\n if (err && !err.message.match(/response code/)) {\n return when().delay(1000); // chill for a second\n }\n }", "function processErrors(data){\n \n}", "function executeCallback(self, errorsForCallback, callback) {\n\n callback.apply(self, [\n false, //pass in a value indicating it is invalid\n errorsForCallback, //pass in the errors for this item\n self.items]); //pass in all errors in total\n }", "function error(err) {\n if (error.err) return;\n callback((error.err = err));\n }", "function error(err) {\n if (error.err) return;\n callback((error.err = err));\n }", "function error(err) {\n if (error.err) return;\n callback((error.err = err));\n }", "function onFail(message) {\n\n}", "async function fails () {\n throw new Error('Contrived Error');\n }", "function fail(callback) {\n queue[queue.length - 1].fail = callback;\n return ctx.$loader;\n }", "handleFailure() {\n console.log(\"Failure\");\n }", "each(callback)\n {\n let thrown = this.error;\n while(thrown instanceof ApplicationCallError) {\n callback(thrown);\n thrown = thrown.error;\n }\n }", "function yankError(callback) {\n\t return function (err, results) {\n\t if (err || (results[0] && results[0].error)) {\n\t callback(err || results[0]);\n\t } else {\n\t callback(null, results.length ? results[0] : results);\n\t }\n\t };\n\t}", "function errorCB(err) {\n //alert(\"Error processing SQL: \"+err.code);\n \n }", "handleFailure (error_)\n\t{\n\t\tthrow error_;\n\t}", "function try_callback(callback, reply) {\n try {\n callback(null, reply);\n } catch (err) {\n process.nextTick(function () {\n throw err;\n });\n }\n}", "triggerError1() {\n\t\tsetTimeout(() => {\n\t\t\tif (typeof this._cbError === \"function\") {\n\t\t\t\tthis._cbError()\n\t\t\t}\n\t\t}, 3000)\n\t\treturn true\n\t}", "function onFail(message) {\n }", "function OnErr() {\r\n}", "function handleError(error) {\n console.log(\"failed!\".red);\n return callback(error);\n }", "function done(callback) {\n if(callback) { console.log(\"Error: \", callback); }\n}", "function failToDoSomething (cb) {\n cb(new Error('failed'))\n}", "function onFail(d) { console.log(\"ERR:ON FAIL\"+d); logm(\"ERR\",1,\"ON FAIL\",d); }", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function cb (err) {\n expect(err).to.not.exist();\n barrier.pass();\n }", "function yankError(callback) {\n return function (err, results) {\n if (err || (results[0] && results[0].error)) {\n callback(err || results[0]);\n } else {\n callback(null, results.length ? results[0] : results);\n }\n };\n}", "function yankError(callback) {\n return function (err, results) {\n if (err || (results[0] && results[0].error)) {\n callback(err || results[0]);\n } else {\n callback(null, results.length ? results[0] : results);\n }\n };\n}", "function yankError(callback) {\n return function (err, results) {\n if (err || (results[0] && results[0].error)) {\n callback(err || results[0]);\n } else {\n callback(null, results.length ? results[0] : results);\n }\n };\n}", "function yankError(callback) {\n return function (err, results) {\n if (err || (results[0] && results[0].error)) {\n callback(err || results[0]);\n } else {\n callback(null, results.length ? results[0] : results);\n }\n };\n}", "function yankError(callback) {\n return function (err, results) {\n if (err || (results[0] && results[0].error)) {\n callback(err || results[0]);\n } else {\n callback(null, results.length ? results[0] : results);\n }\n };\n}", "function yankError(callback) {\n return function (err, results) {\n if (err || (results[0] && results[0].error)) {\n callback(err || results[0]);\n } else {\n callback(null, results.length ? results[0] : results);\n }\n };\n}", "function yankError(callback) {\n return function (err, results) {\n if (err || (results[0] && results[0].error)) {\n callback(err || results[0]);\n } else {\n callback(null, results.length ? results[0] : results);\n }\n };\n}", "function yankError(callback) {\n return function (err, results) {\n if (err || (results[0] && results[0].error)) {\n callback(err || results[0]);\n } else {\n callback(null, results.length ? results[0] : results);\n }\n };\n}", "function triggerFail(){\n\n}", "function callback(err) {\n if (err) {\n error = err;\n }\n --count || fn(error);\n }", "function callback(err) {\n if (err) {\n error = err;\n }\n --count || fn(error);\n }", "function callback(err) {\n if (err) {\n error = err;\n }\n --count || fn(error);\n }", "function assess() {\n\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\tif (args[0]) handleError(args[0]);\n\t\t\telse if (callback) callback.apply(null, args);\n\t\t}", "function callback(err) {\n if (err != null) {\n error = err;\n }\n --count || fn(error);\n }", "function callback(){}", "triggerError2() {\n\t\tsetTimeout(() => {\n\t\t\tif (typeof this._cbError === \"function\") {\n\t\t\t\tthis._cbError()\n\t\t\t}\n\t\t}, 3000)\n\t\treturn true\n\t}", "function errorCB(err) {\r\n console.log(\"Error occured while executing SQL: \"+err.code);\r\n }", "function updateErrHandler(error, result) {\n\tif (error) {\n\t\tlog(\"cannot update data\")\n\t\tthrow error\n\t} else {\n\t\tlog(\"Update Success\") \n\t}\n}", "function _callback(err, data) { _call(callback, err, data); }", "function errorCB(err) {\n console.log(\"Error processing SQL: \"+err.code);\n}", "errorCallback(callback) {\n\t\tthis._cbError = callback\n\t}", "function failureCallback (err) {\n console.error(`Failed with ${err}`)\n}", "function handleError(err,callback)\n {\n logger.error(err); //to save more data (e.g. ts)\n var d = {};\n d['Error'] = err.toString();\n d['roundId'] = $scope.round.roundId;\n d['robotName'] = err.robotName;\n d['created'] = err.created;\n d['fileName'] = err.fileName;\n d['timestamp'] = (new Date()).getTime();\n db.collection('errors').insertOne(d,function(err,res)\n {\n $scope.round['errors'].push(res['_id']);\n setTimeout(callback,0);//to save id of error to current round and than save round to db with errorId\n });\n }", "function _checkSQL(e, r, res, callback) {\n if (e) _sendError(res, e);\n else if (callback) callback(r);\n else console.log(\"[_checkSQL]: no callback defined\")\n}", "function findErrHandler(error, result) {\n\tif (error) {\n\t\tlog(\"cannot find data\")\n\t\tthrow error\n\t} else {\n\t\tlog(result) \n\t}\n}", "function search_errorCB(data) {\n console.log(\"Error callback: \" + data);\n }", "function callback(err) {\n if (err) {\n console.log(err);\n } else {\n //console.log(\"successo\");\n }\n }", "function callback(err, r) { console.log(`callback: result=${r}; error=${err}`); }", "function errorReportCallback(err) {\n if (err) {\n process.nextTick(function () {\n if (typeof err === 'string') {\n throw new Error(err);\n } else {\n throw err;\n }\n });\n }\n}", "triggerError3() {\n\t\tsetTimeout(() => {\n\t\t\tif (typeof this._cbError === \"function\") {\n\t\t\t\tthis._cbError()\n\t\t\t}\n\t\t}, 3000)\n\t\treturn true\n\t}", "function errorReportCallback (err) {\n if (err) {\n process.nextTick(function () {\n if (typeof err === 'string') {\n throw new Error(err)\n } else {\n throw err\n }\n })\n }\n}", "function error_callback(e) {\n\t\talert(\"chyba:\" + e);\n\t}", "function errorCB(tx, err) {\n\t//alert(\"Error processing SQL: \"+err);\n}", "error(error) {}", "onerror() {}", "onerror() {}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "function handleCallback(callback, err, result) {\n try {\n callback(err, result);\n } catch (err) {\n process.nextTick(function() {\n throw err;\n });\n }\n}", "function handleCallback(callback, err, result) {\n try {\n callback(err, result);\n } catch (err) {\n process.nextTick(function() {\n throw err;\n });\n }\n}", "function onFail(message) {\n console.log('Failed because: ' + message);\n }", "function errorCB(err) {\r\n alert(\"Error processing SQL: \"+err.code);\r\n }", "static sendFailHandler (err, conContext) {\n if (conContext.handlers) {\n if (conContext.handlers.sendFailCb) {\n conContext.handlers.sendFailCb(err)\n }\n }\n }", "function onFail(message){\n console.log('Failed because: ' + message);\n}", "errorCallback(callback) {\n\t\tthis._cbError = callback;\n\t\t\n\t\tsetTimeout(function() {\n\t\t\tthis._cbError(Math.round(Math.random() * 4));\n\t\t}, Math.random() * 60000);\n\t}", "function callsBackWithError(cb) {\n setTimeout(\n function () { \n try {\n console.log('bad culprit', culprit); \n cb(null, 'yay');\n } catch(err) {\n cb(err);\n }\n }\n , 20);\n}", "function fail() {\n return error('Something failed');\n }", "function handleErrors () {\n\tvar args = Array.prototype.slice.call(arguments);\n\n\tnotify.onError({\n\t\ttitle: 'Task Failed [<%= error.message %>',\n\t\tmessage: 'See console.',\n\t\tsound: 'Sosumi' // See: https://github.com/mikaelbr/node-notifier#all-notification-options-with-their-defaults\n\t}).apply(this, args);\n\n\tgutil.beep(); // Beep 'sosumi' again\n\n\t// Prevent the 'watch' task from stopping\n\tthis.emit('end');\n}", "function safe_callback(callback, error, data) {\r\n try {\r\n callback(error, data);\r\n } catch (err) {\r\n process.nextTick(function () {\r\n throw err;\r\n });\r\n }\r\n}", "function check(err) {\n\tif (!err) { return }\n\tconsole.log(\"ERROR\", err)\n\tthrow err\n}", "function errorCB(err) {\n\talert(\"Error processing SQL: \"+err.code+\" msg: \"+err.message);\n}", "function handleErrors () {\n const args = Array.prototype.slice.call(arguments);\n\n notify.onError({\n 'title': 'Task Failed [<%= error.message %>',\n 'message': 'See console.',\n 'sound': 'Sosumi' // See: https://github.com/mikaelbr/node-notifier#all-notification-options-with-their-defaults\n }).apply(this, args);\n\n beeper(); // Beep\n\n // Prevent the 'watch' task from stopping.\n this.emit('end');\n}", "function errorHandling(err) {\r\n if (err) console.log(err);\r\n else console.log(`Done`)\r\n\r\n}", "function errorHandler(err)\n {\n if(err.code == 1)\n {\n console.log(\"error: access is denied!\");\n }\n else if( err.code == 2) {\n console.log(\"error: position is unavailable!\");\n }\n }", "function OnErrorCallMaladie(jqXHR, status) {\n\t\t}", "function listenCallback(error, no_error_data) {\n if (error) {\n \t// ....\n \treturn console.error(\"this shit be bunk yo: \", error);\n }\n\n console.log(\"We are listening for your requests on port \" + port);\n}", "handleCallError(errs, url, method) {\n // TODO: probably we need some logger, now it's just logging to console\n console.log(`Failed calling ${method} for URL:`, url);\n console.log(`Reason:`, errs);\n }", "onerror(err) {\n debug(\"error\", err);\n super.emit(\"error\", err);\n }", "function error(dataError,mQmlCallbackError){\n return ((dataError !== Errors.NoError)\n || (mQmlCallbackError !== Errors.NoError))\n}" ]
[ "0.7674386", "0.73315495", "0.71292096", "0.6966852", "0.67104733", "0.66389793", "0.6566288", "0.6564513", "0.6526316", "0.64390206", "0.64347565", "0.64347565", "0.64347565", "0.6406681", "0.6391222", "0.63375586", "0.63260365", "0.63135886", "0.6309453", "0.6307777", "0.62963593", "0.6288682", "0.62722015", "0.6261695", "0.6260845", "0.62607807", "0.625766", "0.6249617", "0.62479764", "0.6233386", "0.6233386", "0.6233386", "0.6233386", "0.6233386", "0.6233386", "0.6233386", "0.6233386", "0.6233386", "0.6232698", "0.6180932", "0.6180932", "0.6180932", "0.6180932", "0.6180932", "0.6180932", "0.6180932", "0.6180932", "0.61739784", "0.6173427", "0.6173427", "0.6173427", "0.6172211", "0.61669636", "0.61503744", "0.6131215", "0.6107651", "0.6102393", "0.6102027", "0.60983765", "0.6091446", "0.60797715", "0.60648113", "0.6048772", "0.6045448", "0.6045386", "0.60424584", "0.6039234", "0.60361594", "0.60326153", "0.60287094", "0.60207844", "0.5988117", "0.59861624", "0.5985042", "0.5985042", "0.598097", "0.598097", "0.598097", "0.598097", "0.598097", "0.597899", "0.597899", "0.59609234", "0.59509873", "0.5948306", "0.59344065", "0.59316856", "0.5930179", "0.5917625", "0.5917064", "0.59160423", "0.58881193", "0.5885676", "0.58819795", "0.58738065", "0.58600605", "0.58565235", "0.5852065", "0.5844791", "0.58445364", "0.5840444" ]
0.0
-1
ensure that the nominated simpledb domain exists. if it does not exist it will be created. params: args ent cb callback
function ensureDomain(args, ent, cb) { var canon = ent.canon$({object:true}); var domainName = (canon.base?canon.base + '_' : '') + canon.name; dbinst.listDomains(function(err, domains){ if (!err) { if (!_.find(domains, function(item) { return item === domainName; })) { dbinst.createDomain(domainName, function(err, result) { cb(err, dbinst, domainName); }); } else { cb(err, dbinst, domainName); } } else { cb(err, null, null); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkPartnerX(callback) {\n origin.create(callback, { url: \"/doesntexist\" });\n }", "function validateDomain() {\n HttpFactory.post('/api/v1/validate', {domain: ctrl.domain.domain})\n .then(function(response) {\n ctrl.isValidDomain = response.data;\n\n if (ctrl.isValidDomain) {\n Notification.success({\n message:'This domain is valid!',\n title: 'Success'\n });\n } else {\n Notification.error({\n message: 'This domain already exists in our database.',\n title: 'Uh Oh'\n });\n }\n })\n .catch(function(response) {\n Notification.error({\n message: response.data,\n title: 'Uh Oh'\n });\n\n ctrl.isValidDomain = false;\n })\n }", "function makeEnsureExistsCallback(callback) {\n return function ensureExistsCallback(error,success) {\n //winston.log('info',sprintf(\"ensureExistsCallback:(%s,%s)\",JSON.stringify(error),JSON.stringify(success)));\n if (!error) {\n callback(null,1);\n }\n else if (error['code'] == mongo.errors.duplicateKeyError) {\n callback(null,0);\n } \n else {\n callback(error);\n }\n }\n }", "async function create(company) {\n if (await Company.findOne({name: company.name})){\n throw `Company ${company.name} already exists`\n }\n\n var query = company.save()\n return query\n}", "create(data, fn)\n {\n var errors = CompanyController.validateData(data);\n if (errors.length > 0)return fn(errors, null); //if errors execute callback with generated errors\n else\n {\n data.URID = data.name.slug();\n this.\n find({URID:new RegExp(data.URID)}).\n sort({URID:-1}).\n exec( (err,res)=>{\n if(res.length != 0) //if any company with the same uri\n {\n var matches = new RegExp(\"(\"+data.URID+\")-?([0-9])?\").exec(res[0].URID);\n var n = (matches != null && matches[2] == undefined )? 1:parseInt(matches[2])+1;\n data.URID = data.URID+\"-\"+n; //create an autoincrement URID\n }\n super.create(data, fn);\n });\n\n }\n\n }", "create(dn, entry, callback) {\n this.ldapClient.add(dn, entry, callback);\n }", "function createDomain(name){\n domain.push(new domainObj(name));\n for(var i = 0; i < name.length; i++){\n var ascii = name.charCodeAt(i);\n domain[domain.length-1].hash[indexASCII(ascii)]++;\n }\n}", "function withoutSudomainLink() {\n if (withoutSubDomain(window.domain)) {\n $(\"#currentDomain\").append(\"<span class='new-domain-link' title='Search just \\\"\" + newdomain + \"\\\"'>\" + newdomain + \"</a>\");\n $(\".new-domain-link\").click(function() {\n newSearch(newdomain);\n });\n }\n}", "async function assertEnsDomain(ensDomain, address) {\n ensDomain;\n address;\n}", "function Domain (domain_name) \r\n{\r\n if (arguments.length > 0) {\r\n\tthis.init(domain_name);\r\n }\r\n}", "function checkExistDB(){\n\t\topenDatabaseZoe();\n\t\tdb.transaction(checkTableSalesrep,errorExistDB,successExistDB);\n\t}", "async function createCompany(company, cityName) {\n try {\n // if (cityName.length <= 1) throw \"The name of the city is invalid!\";\n console.log(\"[DEBUG] City Name: \" + cityName);\n // Search for the city that the company belongs too\n let city = await citySchema.findOne({ name: cityName });\n\n if (city) {\n console.log(\"[DEBUG] Company: \" + company);\n let companyToCreate = new companySchema(company);\n // Save the Company and get the ID\n let { _id } = await companyToCreate.save();\n // Add the City to the Company\n let companyCreated = await companySchema.findById(_id);\n await companyCreated.city.push(city);\n let companySaved = await companyCreated.save();\n console.log(\"[INFO] Company successfully created with ID: \" + companySaved);\n return companySaved;\n } else {\n console.log(\"[ERROR] The City entered does not exist!\");\n }\n } catch(error) {\n console.log(\"[ERROR] While trying to create the Company, error msg: \" + error);\n }\n}", "static async addHost(username) {\n const duplicateCheck = await db.query(\n `SELECT host_username\n FROM hosts\n WHERE host_username = $1`,\n [username],\n );\n \n if (duplicateCheck.length < 1) {\n `INSERT INTO hosts (username) \n VALUES ($1)`,\n [username]\n }\n }", "function awsDBcheck(uuid, thumb, titleEN, bodyEN, keysEN, titleFR, bodyFR, keysFR, topicCat, callback) {\n\t//Check the Drupal content table to make sure the current uuid/application-name pair don't already exist as content\n\tcon.query(\"SELECT * FROM fgpwp_content WHERE uuid='\"+uuid+\"' AND titleEN='\"+titleEN+\"' AND topic='\"+topicCat+\"'\", function (error, results, fields) {\n\t\tif (error) throw (error);\n\n\t\tif (results != '') {\n\t\t\tthisRecord = \"exists\";\n\t\t} else {\n\t\t\tthisRecord = \"new\";\n\t\t}\n\t\treturn callback(thisRecord, uuid, thumb, titleEN, bodyEN, keysEN, titleFR, bodyFR, keysFR, topicCat);\n\n\t});\n}", "function addNewCompany(req, callback) {\n let companyTag = req.body.tag;\n let companyTwitterUrl = \"https://twitter.com/users/username_available?username=\" + companyTag;\n request.get(companyTwitterUrl, { json: true }, (err, res, body) => {\n if (err) { throw err; }\n // Username is taken so company exists\n if (!body.value & body.reason != \"invalid_username\") {\n console.log(companyTag + \" Found!\");\n let companyInstance = new CompanySchema({\n tag: req.body.tag,\n ratings: {\n inclusiveness: req.body.inclusiveness,\n compensation: req.body.compensation,\n balance: req.body.balance,\n advancement_opp: req.body.advancement_opp\n },\n total_reviews: 1,\n links: []\n });\n companyInstance.save(function(err) {\n if (err) console.log(err);\n else callback(\"Success\");\n });\n }\n else {\n console.log(companyTag + \" Not Found :C\");\n callback(\"Failure\");\n }\n });\n}", "function loadDbFirst(callback){\n var _doc=null;\n db.findOne({\n machid: '2001'\n }, function (err, doc) {\n _doc=doc;\n if(_doc == null){\n insertNewData()\n }else{\n callback(_doc)\n }\n })\n}", "function CloudFrontDist(domainName) {\n return new Promise((resolve, reject) => {\n cloudfront.listDistributions({}).promise()\n .then(data=>{\n let items = data.DistributionList.Items\n let lastElem = items.length-1\n for(let i in items){\n if(items[i].Origins.Items[0].DomainName.startsWith(domainName)){\n let exists = items[i].Id\n resolve(exists)\n }\n if(i === lastElem.toString()) resolve(null)\n }\n }).catch(err=>reject(err))\n }) \n}", "function addDepartment(dept_name) {\n connection.query(\"SELECT * FROM departments\", (err, res) => {\n if (err) throw err\n for (const row of res) {\n if (row.dept_name === dept_name) {\n console.log(\"This department already exists!\")\n return\n }\n }\n connection.query(`INSERT INTO departments(dept_name) VALUES ('${dept_name}')`, (err, res) => {\n if (err) throw err;\n console.log(\"New department added!\");\n isComplete()\n })\n })\n}", "createDepartment(department) {\n return this.connection\n .promise()\n .query(\"INSERT INTO department SET ?\", department);\n }", "function found() {\n console.log(\"Contact already exists in database.\");\n}", "function fareExist(from, to) {\n debug('CREATING A NEW FARE');\n\n logMsg({\n from: from,\n to: to\n });\n var defferd = q.defer();\n //console.log(\"log data \",{from: from, to:to});\n FareModel.findOne({\n from: from,\n to: to\n })\n .exec()\n .then(result => {\n //fare\n if (result) {\n logMsg(\"This record already exists.\");\n //fare doesn't exist\n defferd.resolve(true);\n } else {\n //fare exists\n defferd.resolve(false);\n }\n }).catch(err => {\n defferd.reject(err);\n });\n\n return defferd.promise;\n\n }", "function insertObj(orgUrl, shortUrl) {\n var sites = db.collection('sites');\n sites.insert({\n \"shortUrl\": \"http://camper-api-project-dlagrone1971.c9users.io/short/\" + shortUrl,\n \"orginal_url\" : orgUrl\n }, function(err, data) {\n if(err) throw err;\n console.log(\"The object saved in the database\");\n checkForUrl(orgUrl);\n });\n }", "async function createCollectionIfNotExists (name) {\n // requires list buckets...\n const collections = await database.getCollectionNames()\n // console.log('Database collections', collections)\n\n if (!collections.includes(name)) {\n const collection = await database.createCollection(name)\n // console.log('collection: (created)', collection.getFQN())\n return collection\n }\n\n const collection = await database.getCollection(name)\n // console.log('collection: (existing)', collection.getFQN())\n return collection\n}", "function added(_domain, ee) {\n if (arguments.length < 2) {\n ee = _domain;\n _domain = domain.active;\n }\n \n _domain && _domain.emit('added', ee);\n \n}", "function loadSimpleDomain() {\n var path = ExtensionUtils.getModulePath(module, \"node/SimpleDomain\");\n var loadPromise = nodeConnection.loadDomains([path], true);\n loadPromise.fail(function () {\n console.log(\"[brackets-simple-node] failed to load domain\");\n });\n return loadPromise;\n }", "addDomain (key, config, options) {\n this.follower = false\n\n let domain = this.realm.add(key, config, options)\n\n this.rebase(key)\n\n return domain\n }", "static databaseExists(callback) {\n var req = indexedDB.open(IdbHelper.dbName);\n var existed = true;\n req.onsuccess = function () {\n req.result.close();\n if (!existed)\n indexedDB.deleteDatabase(IdbHelper.dbName);\n callback(existed);\n };\n req.onupgradeneeded = function () {\n existed = false;\n };\n }", "async single(domain) {\n\n let domains = []\n \n domains.push(domain)\n\n return await this.sendWhoisRequest(domains)\n }", "function insertOne(callback, Property) {\n PropertyModel.create(Property)\n .then((data) => console.log(\"INSERTED ONE DOCUMENT\"));\n\n}", "function storeNewKey(domain){\n\n\t// Turn hostname into a proper name by removing subdomains\n\tvar site = psl.get(domain);\n\n\t// Get the current values of domains/passwords\n\tchrome.storage.local.get(\"domains\", function(data){\n\n\t\t// Save the domain\n\t\tif(data.domains == undefined) data.domains = [];\n\t\tdata.domains.push(site);\n\n\t\t// Now write back the data\n\t\tchrome.storage.local.set(data, null);\n\n\t\t// Return success\n\t\treturn 1;\n\t});\n\n\t// Return failed\n\treturn 0;\n}", "async function creating () {\n try {\n const options = {\n where: {\n name: 'Dengar'\n },\n default: {\n client: 'Mercurial Swift',\n active: false\n }\n }\n const [hunters, created] = await db.hunters.findOrCreate(options)\n if(created === true) console.log(\"you got it!\");\n } catch (error) {\n console.log(error);\n }\n}", "async function creating () {\n try {\n\n const options = {\n where: {\n name: 'Dengar',\n client: 'Mercurial Swift',\n active: false\n }\n }\n const [hunters, created] = await db.hunters.findOrCreate(options)\n if(created === true) console.log(\"you got it!\");\n } catch (error) {\n console.log(error);\n }\n}", "checkDatabase(){\n var query = `CREATE DATABASE IF NOT EXISTS ` + config.SQL_DATABASE\n this.db.run(query)\n }", "async function captureDomain(domainId){\n console.log('domainId'.blue, domainId)\n if (typeof(domainId) !== 'number'){\n throw `domainId [number] must be passed to captureDomain, got ${domainId}`;\n }\n //find page, if it doesn't exist, add domain as url\n let pages = await pg.select('pages.id', 'pages.url', 'domains.domain')\n .from('pages')\n .rightOuterJoin('domains', 'domains.id', 'pages.domain')\n .where('domains.id', domainId);\n const page = pages[0];\n\n //Already have a row in \"pages\" for this id\n if (page.id !== null){\n return capturePage({\n pageId:page.id,\n url: page.url\n });\n }\n else {\n const url = `http://www.${page.domain}`;\n let id = (await pg('pages')\n .returning('id')\n .insert({\n domain: domainId,\n url\n }))[0];\n return capturePage({pageId:id, url});\n }\n}", "function createDepartment() {\n var sql = \"SELECT department_name FROM departments\";\n connection.query(sql, function (error, result) {\n if (error) throw error;\n \n var depArr = [];\n result.forEach(function(val) {\n depArr.push(val.department_name);\n });\n\n inquirer.prompt([\n {\n type: \"input\",\n name: \"department\",\n message: \"Enter department name:\",\n validate: function (input) {\n var ret = \"\";\n depArr.forEach(function(val) {\n if (input === val) {\n ret = input + \" already exists.\";\n }\n });\n if (ret) return ret;\n return true;\n }\n }, {\n type: \"input\",\n name: \"overhead\",\n message: \"Enter overhead costs:\",\n validate: function (input) {\n if (isNaN(input)) {\n return \"Please input a number.\";\n }\n else if (input < 0) {\n return \"Please input a positive number\";\n }\n return true;\n }\n }\n ]).then(function (answers) {\n var valuesArr = [[answers.department, answers.overhead]]\n addDepartmentDB(valuesArr);\n });\n });\n}", "function addNewDomain() {\n var postData = { \n url: $('input[name=\"url\"]').val()\n } \n $.ajax({\n type: 'POST',\n data: postData,\n url: '',\n dataType: 'JSON',\n success: function(resp, mes, obj) {\n //TODO - Update table\n if (!resp.errno) {\n //Notification for success\n $.growl({\n message: 'New Domain Added: ' + resp.url + ' &nbsp&nbsp'\n }, {\n type: 'success',\n animate: {\n enter: 'animated fadeInDown',\n exit: 'animated fadeOutUp'\n }\n });\n\n //Updates Table\n var table = $('table[id=\"myDomains\"]').dataTable();\n var deleteButton = '<a id=\"' + resp.id +\n '\" name=\"deleteDomainButton\" ' +\n 'class=\"linkDeleteFromAll btn btn-danger btn-sm delete-column\">X</a>';\n table.fnAddDataAndDisplay([resp.url, deleteButton]);\n\n //Rebinds all delete buttons\n bindAllDeleteButtons(); \n } else {\n BootstrapDialog.show({\n title: resp.code, \n message: resp\n });\n }\n },\n error: function(resp, mes, obj) {\n //TODO - Use message from the backend\n BootstrapDialog.show({\n title: 'Error', \n message:'Could not add new domain.'\n });\n } \n });\n }", "function domain() {\n return wrap('domain', function domainCheckTLD() {\n var result = or(obsDomain, dotAtom, domainLiteral)();\n if (opts.rejectTLD) {\n if (result.semantic.indexOf('.') < 0) {\n return null;\n }\n }\n // strip all whitespace from domains\n if (result) {\n result.semantic = result.semantic.replace(/\\s+/g, '');\n }\n return result;\n }());\n }", "function domain() {\n return wrap('domain', function domainCheckTLD() {\n var result = or(obsDomain, dotAtom, domainLiteral)();\n if (opts.rejectTLD) {\n if (result.semantic.indexOf('.') < 0) {\n return null;\n }\n }\n // strip all whitespace from domains\n if (result) {\n result.semantic = result.semantic.replace(/\\s+/g, '');\n }\n return result;\n }());\n }", "function domain() {\n return wrap('domain', function domainCheckTLD() {\n var result = or(obsDomain, dotAtom, domainLiteral)();\n if (opts.rejectTLD) {\n if (result.semantic.indexOf('.') < 0) {\n return null;\n }\n }\n // strip all whitespace from domains\n if (result) {\n result.semantic = result.semantic.replace(/\\s+/g, '');\n }\n return result;\n }());\n }", "isUserExistenceAndUnique(username) {\n var connectionDB = this.connectDB()\n var checkExistenceAndUniqueProcess = connectionDB.then((connection) => {\n return new Promise((resolve, reject) => {\n connection.query('SELECT id FROM ' + dbTesterInfo +\n ' WHERE testerID = ?', username, (err, results, fields) => {\n\n if (!err) {\n if(results.length === 1) {\n connection.release()\n resolve()\n } else if (results.length === 0){\n connection.release()\n reject({err: {msg: 'This username does not exist!'}})\n } else {\n connection.release()\n reject({err: {msg: 'This username is duplicated!Please remove!'}})\n }\n } else {\n connection.release()\n reject({err: {msg: 'Lost database connection!'}})\n }\n })\n })\n }).catch((err) => {\n return Promise.reject(err)\n })\n return checkExistenceAndUniqueProcess\n }", "function createNewBlog(user, proto, noArticle, callback) {\n assert(typeof (user) === \"object\");\n if (typeof (proto) === \"function\") {\n callback = proto;\n proto = null;\n noArticle = null;\n }\n if (typeof (noArticle) === \"function\") {\n assert(typeof callback === \"undefined\");\n callback = noArticle;\n noArticle = null;\n }\n\n function _createNewBlog(user, proto, noArticle, callback) {\n debug(\"createNewBlog\");\n if (proto && proto.id) return callback(new Error(\"Should not exist proto id\"));\n\n exports.findOne(\" where data->>'name' like 'WN%'\", { column: \"name\", desc: true }, function(err, result) {\n if (err) return callback(err);\n const blog = create();\n let name = \"WN250\";\n let endDate = new Date();\n if (result) {\n if (result.name.substring(0, 2) === \"WN\") {\n name = result.name;\n if (result.endDate && typeof (result.endDate) !== \"undefined\") {\n endDate = new Date(result.endDate);\n }\n }\n }\n debug(\"Maximum Blog Name in DB: %s\", name);\n const wnId = name.substring(2, 99);\n const newWnId = parseInt(wnId) + 1;\n const newName = \"WN\" + newWnId;\n const startDate = new Date(endDate);\n startDate.setDate(startDate.getDate() + 1);\n endDate.setDate(endDate.getDate() + 7);\n blog.name = newName;\n blog.status = \"open\";\n blog.startDate = startDate.toISOString();\n blog.endDate = endDate.toISOString();\n for (const k in proto) {\n blog[k] = proto[k];\n }\n const change = {};\n change.name = blog.name;\n change.status = blog.status;\n change.startDate = blog.startDate;\n change.endDate = blog.endDate;\n // create an Empty blog and simualte an id != 0\n const emptyBlog = exports.create();\n emptyBlog.id = -1;\n const newArticles = configModule.getConfig(\"newArticles\");\n\n async.eachOf(newArticles,\n function createArticle(value, key, cb) {\n if (noArticle) return cb();\n const newArticle = { blog: blog.name };\n for (const k in value) {\n newArticle[k] = value[k].replaceAll(\"#BlogName#\", blog.name);\n }\n articleModule.createNewArticle(newArticle, cb);\n },\n function finalFunction(err) {\n if (err) return callback(err);\n blog.save(function feedback(err, savedblog) {\n if (err) return callback(err);\n emptyBlog.id = savedblog.id;\n messageCenter.global.updateBlog(user, emptyBlog, change, function(err) {\n if (err) {\n return callback(err);\n }\n return callback(null, savedblog);\n });\n });\n });\n });\n }\n if (callback) {\n return _createNewBlog(user, proto, noArticle, callback);\n }\n return new Promise((resolve, reject) => {\n _createNewBlog(user, proto, noArticle, (err, result) => err ? reject(err) : resolve(result));\n });\n}", "static async createAnEmployee(req, res) {\n const employeeDomain = new EmployeeDomain();\n employeeDomain.createAnEmployee(req, res);\n }", "function domain() {\n return wrap('domain', function domainCheckTLD() {\n var result = or(obsDomain, dotAtom, domainLiteral)();\n if (opts.rejectTLD) {\n if (result && result.semantic && result.semantic.indexOf('.') < 0) {\n return null;\n }\n }\n // strip all whitespace from domains\n if (result) {\n result.semantic = result.semantic.replace(/\\s+/g, '');\n }\n return result;\n }());\n }", "CreateAuthor(name, lastname) {\n let connection = new Connection();\n connection = connection.createTheConnection();\n\n let query = connection.query('INSERT INTO author(name, lastname) VALUES (?, ?)', [name, lastname], (err, res) => {\n if (err) {\n return callback(false);\n } else {\n return callback(null, true);\n }\n });\n connection.end();\n }", "validate() {\n this.exists()\n return true\n }", "function smtpAddDomain(callback, email) {\n if ((email === undefined) || (!email.length)) {\n return callback(returnError('Empty email'));\n }\n var data = {\n email: email\n }\n sendRequest('smtp/domains', 'POST', data, true, callback);\n}", "function createDevDB(req, res, next) {\n var query = {\n userName: req.body.userName,\n 'database.name': req.body.dbName\n };\n console.log('in createDB', req.body);\n Devs.findOne(query, function(err, dev){\n console.log('dev null is good: ', dev);\n if(!dev){\n var devDB = mongoose.createConnection(uri + req.body.dbId + '_' + req.body.dbName);\n var devModel = devDB.model('label', new mongoose.Schema({\n createdBy: String\n }));\n devModel({\n createdBy: req.body.userName\n }).save(function (err, results) {\n if (err) throw err;\n req.body.results = results;\n next();\n });\n }\n else (res.json({nah: 'b'}))\n })\n}", "function createExistingIdentities() {\n\n}", "_checkIfAlreadyExist() {\n\n let that = this;\n\n database.child(\"users/\" + this.uid).once(\"value\", function (snap) {\n let exists = (snap.val() !== null);\n\n if (!exists) {\n that._createUserToDatabase();\n } else {\n if (typeof snap.val().loops !== \"undefined\")\n that.currentIdLoopDatabase = snap.val().loops.length;\n }\n\n });\n\n }", "async function insertValidation(data, unique = true){\n var post_data = Object.assign({}, data);;\n var valid = UserInsertSchema(data);\n if (!valid){\n console.log(UserInsertSchema.errors);\n return AjvResponseHandler.formatError(UserInsertSchema.errors, userSchemas.getInsertSchema());\n }\n \n if(unique === false)\n return true;\n\n var docs = await db.get().collection('users').findOne({username:data.username});\n if(docs){\n return ([{'message':'Username is already exists'}])\n }\n return true;\n}", "function checkUsername(username){ \n return new Promise((resolve, reject) => {\n firebase.database().ref('/usernames/'+username).once('value')\n .then((snapshot)=> { \n if(snapshot.exists()) \n reject('username allready exists!');\n else \n resolve();\n })\n })\n}", "function createAliasId(data, callback){\n if(!gun){\n return callback('Database not init!',null);\n }\n if(data){\n if(isEmpty(data.alias)==false){\n gun.get(data.alias).once(async function(data2, key){\n if(data2){\n //console.log(data2);\n return callback(null,{message:\"EXIST\"});\n }else{\n let pass = bcrypt.hashSync(data.passphrase, saltRounds);\n\n //TODOLIST\n //need to work on encrypt data...\n let sea = await SEA.pair();\n let pub = sea.pub;\n\n let saltkey = await SEA.work(data.passphrase, data.alias);\n sea = await SEA.encrypt(sea, saltkey);\n let userId = await createUserId();\n //console.log('userId:',userId)\n let time = timeStamp();\n\n // for SEARCH PUB ID for username\n gun.get(pub).put({\n alias:data.alias\n ,pub:pub\n ,time:time\n })\n \n /// for account set up\n gun.get(data.alias).put({\n alias:data.alias\n ,aliasId:userId\n ,passphrase: pass\n ,role:'user'\n ,token:''\n ,pub:pub\n ,auth:sea\n ,date:time\n });\n return callback(null,{message:\"CREATED\",alias:data.alias});\n }\n });\n }else{\n return callback('Empty Alias!',null);\n }\n }else{\n return callback('No args!',null);\n }\n}", "function createArticle(article,username,callback)\n{\n db.run(\"INSERT INTO Articles VALUES (?,?,?)\",\n [article.title, username, article.content],\n function(err)\n {\n callback();\n });\n}", "isDocumentExisted(documentName) {\n var checkExistedProcess = this.dbConnect.then((connection) => {\n return new Promise ((resolve, reject) => {\n connection.query('SELECT id FROM ' + dbDocumentInfo + ' WHERE documentName = ?', documentName, (err, results, fields) => {\n if (!err) {\n var docName = results\n var quantity = docName.length\n if(quantity === 1) {\n //connection.release()\n resolve(true)\n } else if (quantity === 0){\n // console.log('Inside dbDoc : ' + docName[0].id)\n //connection.release()\n resolve(false)\n } else {\n //connection.release()\n reject({err: {msg: 'There are two of them in Database - System ERR'}})\n }\n } else {\n reject(err)\n }\n })\n })\n }).catch((err) =>{\n return Promise.reject(err)\n })\n return checkExistedProcess\n }", "createProperty({context, entities}) {\n\n return new Promise(function(resolve, reject) {\n console.log(\"Creating property\");\n\n var address = firstEntityValue(entities, \"location\");\n\n if (address) {\n // Geocode address\n geocoder.geocode(address + \"Australia\", function(err, data) {\n if(err) {\n console.log(\"Error geocoding property location\" + err);\n } else {\n address = data.results[0].formatted_address;\n // Add to property database\n db.collection(PROPERTIES).insert({\n \"_id\" : data.results[0].place_id,\n \"address\" : data.results[0].formatted_address,\n \"loc\" : {\n \"type\" : \"Point\",\n \"coordinates\" : [data.results[0].geometry.location.lng, data.results[0].geometry.location.lat]\n }\n }, function(err, result) {\n if(err) {\n console.log(err);\n property_msg = \"Property already exists at \" + address;\n context.property = property_msg;\n\n } else {\n property_msg = \"Created property at \" + address + \".\";\n context.property = property_msg;\n\n }\n });\n }\n });\n delete context.address;\n } else if (!address) {\n context.address = true;\n delete context.address;\n }\n return resolve(context);\n });\n }", "function checkIfExists({domain, token, path, args}) {\n return head.func(args)({domain, path, token}).then(({response}) => {\n return true;\n }).catch((error) => {\n if (error.response && error.response.status === 404) return false;\n console.log('Error', error);\n throw error;\n });\n}", "exists (name, cb) {\n cb(null, true);\n }", "static databaseExists(dbname) {\n return new Promise((resolve, reject) => {\n const req = indexedDB.open(dbname);\n req.onsuccess = () => {\n req.result.close();\n resolve(true);\n };\n req.onupgradeneeded = event => {\n event.target.transaction.abort();\n reject(false);\n };\n });\n }", "async function creating () {\n try {\n const [hunters, created] = await db.hunters.create({\n name: 'Bobba Fett',\n client: 'Jabba the Hut',\n active: true\n })\n if(created === true) console.log(\"you got it!\");\n } catch (error) {\n console.log(error);\n }\n}", "function oidExist(oid){\n return itemOp.findOne({oid: oid})\n .then(\n function(data){\n if(!data){\n return new Promise(function(resolve, reject) { resolve(oid) ;} );\n } else {\n oid = uuid();\n oidExist(oid);\n }\n })\n .catch(\n function(err){\n return new Promise(function(resolve, reject) { reject('Error in Mongo: ' + err) ;} );\n });\n}", "create(name, cb) {\n orm.create(name, cb);\n }", "function ifContractExists(email, con_name, version) {\n\n console.log(\"Inside ifemailexists ... \" + email + \" con_name=\" + con_name + ' version=' + version);\n var xx = 0;\n var ret = '';\n\n var query = ContractDoc.findOne({ 'email': email, 'contract_name': con_name, 'contract_version': version });\n\n query.select();\n query.exec(function (err, result) {\n if (err) {\n console.log(\"ifemail .. Error:\" + err);\n ret = \"Error: \" + err;\n }\n console.log('result = ' + result);\n if (result) {\n console.log(\"Exists\");\n xx = 1;\n ret = \"Exists\";\n } else {\n xx = 1;\n console.log(\"New\");\n ret = 'New'\n }\n });\n\n var loop = 1;\n while (xx < 1) {\n require('deasync').sleep(1000);\n console.log(\"Loop = \" + loop + \" xx = \" + xx);\n loop++;\n if (loop > 25) {\n //console.log(\"Looping ifexists loop=\" + loop + ' xx=' + xx + \" >\");\n ret = 'Timeout';\n }\n }\n\n return ret;\n\n}", "function createPersonSync(person_name){\n var deferred=Q.defer();\n api.request('/person/create',{\n person_name:person_name\n },function(err,result){\n if(err)\n deferred.reject(err);\n else\n deferred.resolve(result);\n });\n return deferred.promise;\n}", "createUser(name, pw, cb) {\n let query = {\n name: name\n };\n\n //ensure the userId is unique\n this.storage\n .collection('users')\n .find(query)\n .limit(1)\n .hasNext((e, exists) => {\n if(!e && !exists) {\n //get the sequence ID\n this.sequence.getSequenceId(this.key, (e, id) => {\n if(!e) {\n let obj = {\n id: id,\n name: name,\n pw: pw\n };\n\n //create a new user\n this.storage\n .collection('users')\n .insertOne(obj, (e, r) => {\n if(!e) cb(null, id);\n else cb(e);\n });\n }\n else cb(e);\n });\n }\n else cb(e || exists); //there is user with the same userId\n });\n }", "if (Object.hasOwnProperty.call(inputValues, 'domainId')) {\n const { count } = await this.client.getDomainCount.call();\n if (count < inputValues.domainId)\n throw new Error(`Domain ID ${inputValues.domainId} not found`);\n }", "function findDomain(domains,hostname){return domains.find(function(domain){return[endsWithHostName,endsWithParsedDomain].some(function(callable){return callable(hostname,domain);});});}", "_welcomeIfNewNode(contact, cb = ()=>{} ){\n\n if (this._kademliaNode.routingTable.map[ contact.identityHex ] || contact.identity.equals( this._kademliaNode.contact.identity ))\n return cb(null, \"already\");\n\n this._kademliaNode.routingTable.addContact(contact);\n\n if (this._replicatedStoreToNewNodesAlready[contact.identityHex])\n return cb(null, \"skipped\");\n\n this._replicatedStoreToNewNodesAlready[contact.identityHex] = Date.now();\n this._replicateStoreToNewNode(contact, undefined, cb )\n\n }", "function doesUserExist(req, res, callback) {\n var user = req.body.username,\n pass = req.body.password;\n\n User.find({\n email: user\n }).count(function (err, count) {\n if (count > 0) {\n //username already exists\n console.log(\"Signup Error: \" + user + \" already exists\");\n res.jsonp({\n message: \"This user name already exists\"\n });\n } else {\n //username does not exist, create it\n console.log(\"User does not exist\");\n callback(req);\n res.jsonp({\n message: \"The user has been added\"\n });\n }\n });\n}", "function createDatabase(database, callback) {\n\n database.type = databases.alias(database.type);\n\n //\n // Make sure that the user is passing in a valid database type\n //\n if (databases.available.indexOf(database.type) === -1) {\n jitsu.log.warn('Invalid database type ' + database.type.red);\n database.type = null;\n return promptForDatabase(callback);\n }\n\n jitsu.databases.create(database.type, database.name, function (err, a, res) {\n if (err || res.statusCode >= 400) {\n //\n // TODO: Refactor this error handling\n //\n if (err && (err.statusCode === 409 || err.statusCode === 404)) {\n jitsu.log.error('Database with name ' + database.name.magenta + ' already exists');\n jitsu.log.info('Try again with a new database name');\n database.name = null;\n return promptForDatabase(callback);\n }\n else {\n jitsu.log.error('Database could not be created');\n jitsu.log.error(err || ('Unknown error code: ' + res.statusCode));\n jitsu.log.error('Try again and if it still fails, please contact nodejitsu');\n return callback(err);\n }\n }\n else {\n jitsu.log.info('A new ' + database.type.magenta + ' has been created');\n }\n\n databases.get(database.name, callback);\n });\n }", "static createLoopbackServerAlreadyExistsError() {\n return new NodeAuthError(NodeAuthErrorMessage.loopbackServerAlreadyExists.code, `${NodeAuthErrorMessage.loopbackServerAlreadyExists.desc}`);\n }", "function createDept(dept) {\n connection.query('INSERT INTO departments SET ?',\n {\n department: `${dept}`,\n },\n (err, res) => {\n if (err) throw err; \n }\n );\n}", "createDepartment() {\n // ask user for department name\n inquirer.prompt(questions.department)\n .then((results) => {\n // view all departments\n dbFunctions.viewDepartments()\n .then((departments) => {\n const deptArr = []\n // loop through departments and push to empty array\n for (let i = 0; i < departments.length; i++) {\n deptArr.push(departments[i].dept_name)\n }\n // if the department the user input doesn't exist send the results to the add department function and ask next question\n if (!deptArr.includes(results.deptName)) {\n dbFunctions.addDepartment(results)\n console.log('\\n Successfully added department! \\n')\n startManagement()\n }\n // if it already exist ask next question\n else {\n console.log('\\n Unsuccessful! Department already exists. \\n')\n startManagement()\n }\n })\n })\n }", "function CheckIfPatientExists(){\n\t\t\t\n\t\t\t\n\t\t\treturn true;\n\t\t}", "function create(value, args) {\n console.log('Inserted venue in DB');\n let venue = new models.venue(args.venue);\n return venue.save();\n}", "function makeNewAlias(callback) {\n var alias = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n for (var i = 0; i < 10; i++)\n alias += possible.charAt(Math.floor(Math.random() * possible.length));\n\n // proove generated alias against db... \n listdao.findOne(alias, function (err, result) {\n if (!result) {\n logEvent(\"made a new alias: \" + alias);\n // ...and return return it\n return callback(alias);\n } else {\n logEvent(\"alias already exists - try generating another one\");\n // ...and call function recursivly in case of already existing alias\n makeNewAlias(callback);\n }\n });\n}", "function is_domain(str)\n{\n //RE for checking of domain that begins with www and ends with .com , .net or .org\n regularexp = /^(w{3}[\\.])?([a-z0-9\\-])+\\.((com)|(org)|(net))$/i;\n\n if (regularexp.test(str)) //check for input\n {\n alert(\"Correct domain name\");\n }\n else\n {\n alert(\"Incorrect domain name\");\n }\n}", "static async create(title, salary, equity, company_handle) {\n try {\n const newJob = await db.query(`INSERT INTO jobs (title, salary, equity, company_handle) VALUES ($1, $2, $3, $4) RETURNING id, title, salary, equity, company_handle, date_posted`, [title, salary, equity, company_handle]);\n const j = newJob.rows[0];\n return new Job(j.id, j.title, j.salary, j.equity, j.company_handle, j.date_posted);\n } catch (e) {\n if (e.code == 23503) {\n throw new ExpressError(`Company with handle: ${company_handle} does not exists`, 400)\n }\n throw new Error(\"Something went wrong\");\n }\n\n }", "async addDomainMatchingFunc(fn) {\n this.hasDomainPattern = true;\n this.domainMatchingFunc = fn;\n }", "function createGuestHouse(recordToInsert, callback) {\n guestHouseDao.create(recordToInsert, callback);\n}", "async function valid(req) {\n let result = await data.get({\n table: 'accounts',\n key: req.body.email\n })\n if(result) {\n return {\n location: `/?error=exists`\n }\n }\n}", "function isExists(siteUrl,siteModel,callback){\r\n\tconsole.log('check site exists...');\r\n\tsiteModel.findOne({siteUrl:siteUrl},'siteUrl',function(err,docs){\r\n\t\tif (err) return console.error(err);\t\t\r\n\t\tvar isExists = true;\r\n\t\tif(docs == null) isExists = false \r\n\t\tconsole.log('isExists=%s',isExists);\r\n\t\tcallback(isExists);\r\n\t});\r\n}", "createTodo(req, res) {\n if (!req.body.title) {\n return res.status(400).send({\n success: 'false',\n message: 'title is required',\n });\n }\n models.Todo.findOne({\n where: { title: req.body.title }\n })\n .then((todoFound) => {\n if (todoFound) {\n return res.status(403).send({\n success: 'false',\n message: 'A todo with that title exists already',\n });\n }\n const todo = {\n title: req.body.title,\n };\n //note the .then()runs when the todo has been successfully added to the database\n models.Todo.create(todo).then((todo) => {\n return res.status(201).send({\n success: 'true',\n message: 'todo added successfully',\n todo,\n });\n });\n })\n }", "function checkExistRegistro(ressult){\n if(ressult.length > 0) { msjDanger('REGISTRO', '<strong>Existe un registro pendiente con esa cuenta</strong>'); }\n else {\n gestor.addLocal(\"\", \"\", \"\", 'registro');\n\n let registro = {};\n registro[\"id\"] = $(\"#usuario\").val();\n registro[\"pass\"] = gestor.stringBase64($(\"#pass\").val());\n registro[\"nombre\"] = $(\"#nombre\").val();\n registro[\"departamento\"] = $(\"#departamento\").val();\n registro[\"nivel\"] = $(\"#nivel\").val();\n\n registroManager.addRegistro(registro, 'changePageIndex');\n }\n}", "function is_cookie_valid(cookie_name, domain, cb_cookie_valid) {\n\n}", "createDepartment(department) {\r\n return this.connection.query(\"INSERT INTO department SET ?\", department);\r\n }", "function ensureUser (email, next) {\n email = email.toLowerCase();\n db.users.findOne({\n _id: emailLocalPart(email)\n }, function (err, user) {\n if (err || user) {\n next(err, user);\n } else {\n var user = {\n _id: emailLocalPart(email),\n domain: emailDomainPart(email),\n created: Date.now(),\n sessionid: null\n };\n db.users.save(user, function (err) {\n next(err, user);\n })\n }\n });\n}", "_ensureDomainIsSet(args, coins) {\r\n let self = this;\r\n //When /begin has already returned a response, we must use that Issuer's domain \r\n if (args && args.beginResponse && args.beginResponse.headerInfo && args.beginResponse.headerInfo.domain) {\r\n args.domain = args.beginResponse.headerInfo.domain;\r\n //} else if (typeof(args.domain) === \"undefined\") {\r\n //Set the domain if all coins come from the same Issuer\r\n //args.domain = self._getSameDomain(coins); \r\n }\r\n //finally use the default issuer \r\n if (args.domain === null) {\r\n args.domain = self.getSettingsVariable(self.config.DEFAULT_ISSUER);\r\n }\r\n }", "function signup(db, enteredAccount, response) {\n const users = db.collection(userdbname);\n console.log(\"Searching database for accounts with this email or username.\");\n users.find({ $or : [{\"username\" : enteredAccount.username}, {\"email\" : enteredAccount.email}]}, {}, function(e, docs) {\n console.log(\"Sign up query completed.\\n\\tErrors: \", e,\n \"\\n\\tEntries found during signup: \\n\\t\" + ((JSON.stringify(docs, undefined, \"\\t\")).replace(/\\n/g, \"\\n\\t\")));\n if (docs.length === 0) {\n console.log(\"Putting record\", enteredAccount, \"into user database.\");\n users.insert(enteredAccount, null, function () {\n console.log(\"Completed user insertion.\");\n });\n //force login\n console.log(\"Force login for new account.\");\n login(enteredAccount, undefined, response, true);\n response.redirect('/landing');\n } else {\n console.log(\"Submitted record is a duplicate.\");\n logout(response);\n console.log(\"Redirecting to the signup page.\");\n response.redirect('/signup?r=d');\n }\n });\n}", "async function checkNameExistence(dogName) {\n await database.ref(\"Dogs/\" + dogName).get().then(function (data) {\n if (data.exists() && !cancelAllCommands) {\n //location.reload();\n petNameAlreadyTaken = true;\n }\n nameChecked = true;\n }).catch(function (error) {\n console.error(error);\n });\n}", "async function newSeed() {\n try{\n await checkExist(seeds.tomato);\n await checkExist(seeds.pakchoi);\n await checkExist(seeds.brassica);\n await checkExist(seeds.cucumber);\n await checkExist(seeds.cabbage);\n }catch (err) {\n throw err\n }\n}", "function insertDefaultOrganization(database, storeName, callback) {\n loadJSON('Default_Organization.json', function(object) {\n var tx = database.transaction([storeName], 'readwrite');\n var store = tx.objectStore(storeName);\n \n tx.oncomplete = function() {\n if (typeof callback === 'function') {\n callback();\n }\n };\n \n for (var key in object) {\n if (object.hasOwnProperty(key)) {\n var addRequest = store.add(object[key], key);\n }\n }\n });\n }", "function update_domain(value) {\n console.log(\"Setting domain to \" + value);\n domain_str = value;\n start();\n}", "createOne(req, res) {\n this.sendNotFound(req, res);\n }", "create(...args) {\n return this.database.create(...args, 'sync');\n }", "function resourceCreate(cb) {\n\n var resource = new Resource({\n //_projectId: [projects[0]],\n name: 'server',\n type: 'Facility',\n status: 'Available',\n deletedAt: null\n });\n\n resource.save(function (err) {\n if (err) {\n cb('resource', null);\n return\n }\n console.log('New Resource ' + resource);\n resources.push(resource);\n cb(null, resource);\n } );\n}", "createIfNotExists(schemaName, callable){\n const blueprint = new CreateBlueprint(schemaName, true);\n callable(blueprint);\n\n this.blueprints.push(blueprint);\n }", "function emailValid() {\n\tvar domain = new RegExp(/^[A-z0-9.]{1,}@(?=(my.bcit.ca$|bcit.ca$|gmail.com$))/i); //checks email for single occurrence of @ and valid domain containing only valid characters.\n\tvar email = document.getElementById(\"email\").value;\n\tif (domain.test(email))\n\t{\n\t\t/*if (email exists in database) {\n\t\t\tdocument.getElementById(\"email\").value = \"Email already exists\"\n\t\t} else {whatever value to let form submit}*/\n\t\tdocument.getElementById(\"emailErrorField\").innerHTML = \"Email valid\"\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\tdocument.getElementById(\"emailErrorField\").innerHTML = \"Email invalid.\"\n\t\treturn false;\n\t}\n}", "function create(values, callback) {\n\n // handle Deferred where \n // it passes criteria first\n // see https://github.com/balderdashy/waterline/blob/master/lib/waterline/query/dql/create.js#L26\n if (arguments.length === 3) {\n var args = Array.prototype.slice.call(arguments);\n callback = args.pop();\n values = args.pop();\n }\n\n // return Deferred\n // if no callback passed\n // See https://github.com/balderdashy/waterline/blob/master/lib/waterline/query/dql/create.js#L54\n if (typeof callback !== 'function') {\n //this refer to the\n //model context\n return new Deferred(model, model.create, {}, values);\n }\n\n //otherwise\n //call sails create\n sailsCreate\n .call(model, values, function(error, result) {\n if (error) {\n callback(error);\n } else {\n if(!_.isUndefined(result)) {\n result.auditor = new Auditor(model,config)\n result.auditor.startAuditing(result,null,function(err) {\n if(err)\n callback(err) \n callback(null, result);\n }) \n } else {\n callback(null, result); \n }\n \n }\n });\n }", "async function tryCreate(docPath, o) { // (string, object) => Promise of Boolean\n\n // \"Creates a document referred to by this 'DocumentReference' with the provided object values. The write fails\n // if the document already exists.\"\n //\n const ret = await dbAdmin.doc(docPath).create(o).then( _ =>\n true\n )\n .catch(async err => {\n if (err.code === 6) { // { code: 6, message: \"6 ALREADY_EXISTS: entity already exists: [...]\" }\n return false;\n }\n throw err; // unknown exception\n });\n\n return ret;\n}", "function isExist(collection,param,callback)\n\t\t{\n\t\tdb.collection(collection).findOne(param,function(err,res)\n\t\t\t{\n\t\t\tif (err!=null){console.log('Error find docs when check existence!',url,collection,param,err);callback(err);return false;}\t\n\t\t\tcallback(null,res!=null);\n\t\t\t})\n\t\t}" ]
[ "0.56095916", "0.5509912", "0.5504735", "0.5421949", "0.53671265", "0.53012884", "0.5293016", "0.5180597", "0.5156601", "0.50719464", "0.5054258", "0.5015661", "0.4983323", "0.49825045", "0.49250302", "0.4923558", "0.49111757", "0.4907865", "0.48981434", "0.48894697", "0.4887494", "0.4885946", "0.48845467", "0.48732406", "0.48709035", "0.4861346", "0.48607954", "0.4858852", "0.48502705", "0.48436794", "0.48408765", "0.4834732", "0.48330536", "0.48300132", "0.48237607", "0.48144498", "0.48122674", "0.48122674", "0.48122674", "0.48052493", "0.4805032", "0.4803196", "0.47962368", "0.4793472", "0.4792568", "0.4792232", "0.47864124", "0.47823814", "0.47670847", "0.4763412", "0.47555473", "0.47550243", "0.47520742", "0.47434857", "0.47383744", "0.47164237", "0.47160536", "0.46875668", "0.46836418", "0.46817303", "0.46805978", "0.4673641", "0.46707964", "0.46632907", "0.46595326", "0.46565425", "0.4655381", "0.46451664", "0.46445343", "0.46434653", "0.4639762", "0.46383497", "0.46347463", "0.46343258", "0.4622474", "0.46223155", "0.4619907", "0.46124926", "0.46119678", "0.4607861", "0.4606522", "0.45988563", "0.45982397", "0.4594789", "0.45943666", "0.45881757", "0.45870793", "0.45861068", "0.45790124", "0.45788315", "0.45747784", "0.45713988", "0.45709145", "0.45657575", "0.45627093", "0.45613098", "0.45525613", "0.4547528", "0.45463794", "0.4545546" ]
0.82122284
0
deserialize data from simple DB: objects and boolans need conversion from string TODO: this should most likely live in the simpledb driver NOT here...
function deserialize(data) { var result = {}; _.each(data, function(value, key, list) { if (typeof value === 'string') { if (value === 'true') { data[key] = true; } if (value === 'false') { data[key] = false; } if (value.match(/[\d]+-[\d]+-[\d]+T/g)) { data[key] = new Date(value.replace(/^["\s]+|["\s+]$/g,'')); } if (value.match(/^[\{\[].*[\}\]]$/g)) { try { data[key] = JSON.parse(value); } catch (e) { // not an object continue in any case... } } } }); return data; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n }", "function deserialize(value) {\n\t // If we haven't marked this string as being specially serialized (i.e.\n\t // something other than serialized JSON), we can just return it and be\n\t // done with it.\n\t if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n\t return JSON.parse(value);\n\t }\n\n\t // The following code deals with deserializing some kind of Blob or\n\t // TypedArray. First we separate out the type of data we're dealing\n\t // with from the data itself.\n\t var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n\t var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n\t var blobType;\n\t // Backwards-compatible blob type serialization strategy.\n\t // DBs created with older versions of localForage will simply not have the blob type.\n\t if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n\t var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n\t blobType = matcher[1];\n\t serializedString = serializedString.substring(matcher[0].length);\n\t }\n\t var buffer = stringToBuffer(serializedString);\n\n\t // Return the right type based on the code/type set during\n\t // serialization.\n\t switch (type) {\n\t case TYPE_ARRAYBUFFER:\n\t return buffer;\n\t case TYPE_BLOB:\n\t return _createBlob([buffer], { type: blobType });\n\t case TYPE_INT8ARRAY:\n\t return new Int8Array(buffer);\n\t case TYPE_UINT8ARRAY:\n\t return new Uint8Array(buffer);\n\t case TYPE_UINT8CLAMPEDARRAY:\n\t return new Uint8ClampedArray(buffer);\n\t case TYPE_INT16ARRAY:\n\t return new Int16Array(buffer);\n\t case TYPE_UINT16ARRAY:\n\t return new Uint16Array(buffer);\n\t case TYPE_INT32ARRAY:\n\t return new Int32Array(buffer);\n\t case TYPE_UINT32ARRAY:\n\t return new Uint32Array(buffer);\n\t case TYPE_FLOAT32ARRAY:\n\t return new Float32Array(buffer);\n\t case TYPE_FLOAT64ARRAY:\n\t return new Float64Array(buffer);\n\t default:\n\t throw new Error('Unkown type: ' + type);\n\t }\n\t }", "function deserialize(value) {\n\t // If we haven't marked this string as being specially serialized (i.e.\n\t // something other than serialized JSON), we can just return it and be\n\t // done with it.\n\t if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n\t return JSON.parse(value);\n\t }\n\n\t // The following code deals with deserializing some kind of Blob or\n\t // TypedArray. First we separate out the type of data we're dealing\n\t // with from the data itself.\n\t var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n\t var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n\t var blobType;\n\t // Backwards-compatible blob type serialization strategy.\n\t // DBs created with older versions of localForage will simply not have the blob type.\n\t if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n\t var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n\t blobType = matcher[1];\n\t serializedString = serializedString.substring(matcher[0].length);\n\t }\n\t var buffer = stringToBuffer(serializedString);\n\n\t // Return the right type based on the code/type set during\n\t // serialization.\n\t switch (type) {\n\t case TYPE_ARRAYBUFFER:\n\t return buffer;\n\t case TYPE_BLOB:\n\t return _createBlob([buffer], { type: blobType });\n\t case TYPE_INT8ARRAY:\n\t return new Int8Array(buffer);\n\t case TYPE_UINT8ARRAY:\n\t return new Uint8Array(buffer);\n\t case TYPE_UINT8CLAMPEDARRAY:\n\t return new Uint8ClampedArray(buffer);\n\t case TYPE_INT16ARRAY:\n\t return new Int16Array(buffer);\n\t case TYPE_UINT16ARRAY:\n\t return new Uint16Array(buffer);\n\t case TYPE_INT32ARRAY:\n\t return new Int32Array(buffer);\n\t case TYPE_UINT32ARRAY:\n\t return new Uint32Array(buffer);\n\t case TYPE_FLOAT32ARRAY:\n\t return new Float32Array(buffer);\n\t case TYPE_FLOAT64ARRAY:\n\t return new Float64Array(buffer);\n\t default:\n\t throw new Error('Unkown type: ' + type);\n\t }\n\t }", "function deserialize(value) {\n\t // If we haven't marked this string as being specially serialized (i.e.\n\t // something other than serialized JSON), we can just return it and be\n\t // done with it.\n\t if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n\t return JSON.parse(value);\n\t }\n\n\t // The following code deals with deserializing some kind of Blob or\n\t // TypedArray. First we separate out the type of data we're dealing\n\t // with from the data itself.\n\t var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n\t var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n\t var blobType;\n\t // Backwards-compatible blob type serialization strategy.\n\t // DBs created with older versions of localForage will simply not have the blob type.\n\t if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n\t var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n\t blobType = matcher[1];\n\t serializedString = serializedString.substring(matcher[0].length);\n\t }\n\t var buffer = stringToBuffer(serializedString);\n\n\t // Return the right type based on the code/type set during\n\t // serialization.\n\t switch (type) {\n\t case TYPE_ARRAYBUFFER:\n\t return buffer;\n\t case TYPE_BLOB:\n\t return _createBlob([buffer], { type: blobType });\n\t case TYPE_INT8ARRAY:\n\t return new Int8Array(buffer);\n\t case TYPE_UINT8ARRAY:\n\t return new Uint8Array(buffer);\n\t case TYPE_UINT8CLAMPEDARRAY:\n\t return new Uint8ClampedArray(buffer);\n\t case TYPE_INT16ARRAY:\n\t return new Int16Array(buffer);\n\t case TYPE_UINT16ARRAY:\n\t return new Uint16Array(buffer);\n\t case TYPE_INT32ARRAY:\n\t return new Int32Array(buffer);\n\t case TYPE_UINT32ARRAY:\n\t return new Uint32Array(buffer);\n\t case TYPE_FLOAT32ARRAY:\n\t return new Float32Array(buffer);\n\t case TYPE_FLOAT64ARRAY:\n\t return new Float64Array(buffer);\n\t default:\n\t throw new Error('Unkown type: ' + type);\n\t }\n\t }", "_unpackValue(buf, type, typeClass) {\n let isNull, obj, value;\n switch (type) {\n case types.DB_TYPE_NUMBER:\n value = buf.readOracleNumber();\n if (value !== null)\n value = parseFloat(value);\n return value;\n case types.DB_TYPE_BINARY_INTEGER:\n return buf.readBinaryInteger();\n case types.DB_TYPE_VARCHAR:\n case types.DB_TYPE_CHAR:\n return buf.readStr(constants.CSFRM_IMPLICIT);\n case types.DB_TYPE_NVARCHAR:\n case types.DB_TYPE_NCHAR:\n return buf.readStr(constants.CSFRM_NCHAR);\n case types.DB_TYPE_RAW:\n return Buffer.from(buf.readBytesWithLength());\n case types.DB_TYPE_BINARY_DOUBLE:\n return buf.readBinaryDouble();\n case types.DB_TYPE_BINARY_FLOAT:\n return buf.readBinaryFloat();\n case types.DB_TYPE_DATE:\n case types.DB_TYPE_TIMESTAMP:\n return buf.readOracleDate(true);\n case types.DB_TYPE_TIMESTAMP_LTZ:\n case types.DB_TYPE_TIMESTAMP_TZ:\n return buf.readOracleDate(false);\n case types.DB_TYPE_BOOLEAN:\n return buf.readBool();\n case types.DB_TYPE_OBJECT:\n isNull = buf.getIsAtomicNull();\n if (isNull)\n return null;\n obj = new ThinDbObjectImpl(typeClass);\n if (obj._objType.isCollection || this._objType.isCollection) {\n obj.packedData = Buffer.from(buf.readBytesWithLength());\n } else {\n obj._unpackDataFromBuf(buf);\n }\n return obj;\n default:\n errors.throwErr(errors.ERR_NOT_IMPLEMENTED, type);\n }\n }", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== \"__lfsc__:\" /* SERIALIZED_MARKER */) {\n return JSON.parse(value);\n }\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === \"blob\" /* TYPE_BLOB */ && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case \"arbf\" /* TYPE_ARRAYBUFFER */:\n return buffer;\n case \"blob\" /* TYPE_BLOB */:\n return createBlob([buffer], { type: blobType });\n case \"si08\" /* TYPE_INT8ARRAY */:\n return new Int8Array(buffer);\n case \"ui08\" /* TYPE_UINT8ARRAY */:\n return new Uint8Array(buffer);\n case \"uic8\" /* TYPE_UINT8CLAMPEDARRAY */:\n return new Uint8ClampedArray(buffer);\n case \"si16\" /* TYPE_INT16ARRAY */:\n return new Int16Array(buffer);\n case \"ur16\" /* TYPE_UINT16ARRAY */:\n return new Uint16Array(buffer);\n case \"si32\" /* TYPE_INT32ARRAY */:\n return new Int32Array(buffer);\n case \"ui32\" /* TYPE_UINT32ARRAY */:\n return new Uint32Array(buffer);\n case \"fl32\" /* TYPE_FLOAT32ARRAY */:\n return new Float32Array(buffer);\n case \"fl64\" /* TYPE_FLOAT64ARRAY */:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n }", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n } // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n\n\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n var blobType; // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n\n var buffer = stringToBuffer(serializedString); // Return the right type based on the code/type set during\n // serialization.\n\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n\n case TYPE_BLOB:\n return createBlob([buffer], {\n type: blobType\n });\n\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n\n default:\n throw new Error('Unkown type: ' + type);\n }\n }", "function rsToObj(data) {\n var object = {};\n var fields = data.split(\"`\");\n if (data == \"\" || data == \"null\") return null;\n if (fields.length > 1) {\n fields.forEach(function(item) {\n \n // now get the name/value and assign the object\n var pair = item.split(\"~\");\n if (pair[1] == \"\") {\n object[pair[0]] = null;\n } else {\n \n // check to make sure there are only two pairs\n // if there are more than two we need to combine everything after the first entry because they were separated using the same character\n if (pair.length > 2) {\n for (i=2; i<pair.length; i++) pair[1] += \"~\" + pair[i];\n object[pair[0]] = pair[1];\n } else {\n if ($.isNumeric(pair[1])) {\n object[pair[0]] = parseFloat(pair[1]);\n } else {\n if (pair[1].toLowerCase() == \"false\") object[pair[0]] = false;\n else if (pair[1].toLowerCase() == \"true\") object[pair[0]] = true;\n else object[pair[0]] = pair[1];\n }\n }\n }\n });\n } else object = null;\n return object;\n}", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n}", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n}", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n}", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n}", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n}", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n}", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n}", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n}", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n}", "function deserialize(value) {\n\t // If we haven't marked this string as being specially serialized (i.e.\n\t // something other than serialized JSON), we can just return it and be\n\t // done with it.\n\t if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n\t return JSON.parse(value);\n\t }\n\n\t // The following code deals with deserializing some kind of Blob or\n\t // TypedArray. First we separate out the type of data we're dealing\n\t // with from the data itself.\n\t var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n\t var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n\t var blobType;\n\t // Backwards-compatible blob type serialization strategy.\n\t // DBs created with older versions of localForage will simply not have the blob type.\n\t if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n\t var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n\t blobType = matcher[1];\n\t serializedString = serializedString.substring(matcher[0].length);\n\t }\n\t var buffer = stringToBuffer(serializedString);\n\n\t // Return the right type based on the code/type set during\n\t // serialization.\n\t switch (type) {\n\t case TYPE_ARRAYBUFFER:\n\t return buffer;\n\t case TYPE_BLOB:\n\t return createBlob([buffer], { type: blobType });\n\t case TYPE_INT8ARRAY:\n\t return new Int8Array(buffer);\n\t case TYPE_UINT8ARRAY:\n\t return new Uint8Array(buffer);\n\t case TYPE_UINT8CLAMPEDARRAY:\n\t return new Uint8ClampedArray(buffer);\n\t case TYPE_INT16ARRAY:\n\t return new Int16Array(buffer);\n\t case TYPE_UINT16ARRAY:\n\t return new Uint16Array(buffer);\n\t case TYPE_INT32ARRAY:\n\t return new Int32Array(buffer);\n\t case TYPE_UINT32ARRAY:\n\t return new Uint32Array(buffer);\n\t case TYPE_FLOAT32ARRAY:\n\t return new Float32Array(buffer);\n\t case TYPE_FLOAT64ARRAY:\n\t return new Float64Array(buffer);\n\t default:\n\t throw new Error('Unkown type: ' + type);\n\t }\n\t}", "function deserialize(value) {\n\t // If we haven't marked this string as being specially serialized (i.e.\n\t // something other than serialized JSON), we can just return it and be\n\t // done with it.\n\t if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n\t return JSON.parse(value);\n\t }\n\n\t // The following code deals with deserializing some kind of Blob or\n\t // TypedArray. First we separate out the type of data we're dealing\n\t // with from the data itself.\n\t var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n\t var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n\t var blobType;\n\t // Backwards-compatible blob type serialization strategy.\n\t // DBs created with older versions of localForage will simply not have the blob type.\n\t if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n\t var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n\t blobType = matcher[1];\n\t serializedString = serializedString.substring(matcher[0].length);\n\t }\n\t var buffer = stringToBuffer(serializedString);\n\n\t // Return the right type based on the code/type set during\n\t // serialization.\n\t switch (type) {\n\t case TYPE_ARRAYBUFFER:\n\t return buffer;\n\t case TYPE_BLOB:\n\t return createBlob([buffer], { type: blobType });\n\t case TYPE_INT8ARRAY:\n\t return new Int8Array(buffer);\n\t case TYPE_UINT8ARRAY:\n\t return new Uint8Array(buffer);\n\t case TYPE_UINT8CLAMPEDARRAY:\n\t return new Uint8ClampedArray(buffer);\n\t case TYPE_INT16ARRAY:\n\t return new Int16Array(buffer);\n\t case TYPE_UINT16ARRAY:\n\t return new Uint16Array(buffer);\n\t case TYPE_INT32ARRAY:\n\t return new Int32Array(buffer);\n\t case TYPE_UINT32ARRAY:\n\t return new Uint32Array(buffer);\n\t case TYPE_FLOAT32ARRAY:\n\t return new Float32Array(buffer);\n\t case TYPE_FLOAT64ARRAY:\n\t return new Float64Array(buffer);\n\t default:\n\t throw new Error('Unkown type: ' + type);\n\t }\n\t}", "function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0,\n SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH,\n TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return _createBlob([buffer], {type: blobType});\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n }", "readDbObject() {\n const obj = {};\n let numBytes = this.readUB4();\n if (numBytes > 0)\n obj.toid = Buffer.from(this.readBytesWithLength());\n numBytes = this.readUB4();\n if (numBytes > 0)\n obj.oid = Buffer.from(this.readBytesWithLength());\n numBytes = this.readUB4();\n if (numBytes > 0)\n obj.snapshot = Buffer.from(this.readBytesWithLength());\n this.skipUB2(); // version\n numBytes = this.readUB4();\n this.skipUB2(); // flags\n if (numBytes > 0)\n obj.packedData = Buffer.from(this.readBytesWithLength());\n return obj;\n }", "function DataTypeConverter() {\n this._fields = [];\n this._numOfRows = 0;\n}", "function deserializeValue(value){try{return value?value==\"true\"||(value==\"false\"?false:value==\"null\"?null:+value+\"\"==value?+value:/^[\\[\\{]/.test(value)?$.parseJSON(value):value):value;}catch(e){return value;}}", "function model() {\n\tlet rawdata = fs.readFileSync(dbf, 'utf-8');\n\tif (rawdata) {\n\t\treturn new LINQ(JSON.parse(rawdata));\n\t} else\n\t\treturn new LINQ(JSON.parse('[{}]'));\n}", "deserialize(query, data) {\n return this.transform(query, data, 'deserialize');\n }", "function jsonConvertRow(obj) {\n if (obj == null) {\n return obj;\n }\n var modelname = obj._class_;\n var model = getDBModel(modelname);\n if (model.initialized) {\n for (var colname in model._meta) {\n // coltype, colname, default, m2m, nullable, uselist, collection\n var value = obj.value[colname];\n if (typeof(value) != \"undefined\") {\n if (model._meta[colname][0] == \"RelationshipProperty\") {\n if (model._meta[colname][5] == true) { // uselist\n obj.value[colname] = map(jsonConvertRow, value);\n } else {\n obj.value[colname] = jsonConvertRow(value);\n };\n } else {\n obj.value[colname] = convertClasses(value);\n };\n };\n }\n };\n var inst = new DBModelInstance(model, obj._str_, obj.value);\n return inst;\n}", "function deserialize(data) {\n var value;\n if (typeof data === 'string') {\n value = JSON.parse(data);\n }\n else {\n value = deserializeBinary(data);\n }\n return value;\n}", "function deserializeValue(value) {\n try {\n return value\n ? value == 'true' ||\n (value == 'false'\n ? false\n : value == 'null'\n ? null\n : +value + '' == value\n ? +value\n : /^[\\[\\{]/.test(value)\n ? h.parseJSON(value)\n : value)\n : value;\n } catch (e) {\n return value;\n }\n }", "function toAPIData(json) {\n return cast(JSON.parse(json), m(\"\"));\n}", "function deserializeValue( value ) {\n try {\n return value ? value == \"true\" || (value == \"false\" ? false : value == \"null\" ? null : +value + \"\" == value ? +value : /^[\\[\\{]/.test( value ) ? $.parseJSON( value ) : value) : value\n } catch ( e ) {\n return value\n }\n }", "static fromDBData(data) {\n const json = data.toJSON();\n const attrs = [];\n const tags = [];\n json.tag.forEach(t => {\n tags.push(new Tag(t.value, { id: t.id }));\n });\n json.attribute.forEach(at => {\n attrs.push(new Attribute(at.key, at.value, at.searchable, { id: at.id }));\n });\n const mutationName = json.mutationName;\n return new Note(null, mutationName, tags, attrs, {\n uuid: `${json.uuid}`,\n id: json.id,\n created_at: json.created_at,\n updated_at: json.updated_at,\n preview: JSON.parse(json.preview)\n });\n }", "function convertAttributesForSQL(dataAttrs, typeAttrs) {\n var splitString;\n var regEx;\n var data = {};\n var keys = Object.keys(typeAttrs);\n var key = keys.pop();\n\n while (key !== undefined) {\n if (!(typeAttrs[key] instanceof Array)) {\n\n // TODO do i need to wory about converting any other data types here?\n if (typeAttrs[key].parse !== undefined) {\n data[typeAttrs[key].field] = typeAttrs[key].parse(dataAttrs[key]);\n } else if (typeAttrs[key].dataType === 'boolean') {\n data[typeAttrs[key].field] = dataTypes.revert['boolean'](dataAttrs[key]);\n } else {\n data[typeAttrs[key].field] = dataAttrs[key];\n }\n } else {\n // build string from joins\n splitString = '';\n typeAttrs[key].forEach(function (a) {\n if (a.join !== undefined) {\n splitString += a.join;\n }\n });\n\n // turn joins into regex and split attribute with that\n if (splitString !== undefined && splitString.length > 0) {\n regEx = new RegExp(splitString, 'i');\n splitString = String(dataAttrs[key]).trim().split(regEx);\n\n typeAttrs[key].forEach(function (item) {\n if (item.field !== undefined) {\n data[item.field] = splitString.shift();\n }\n });\n }\n }\n\n key = keys.pop();\n }\n\n return data;\n }", "static deserialize() {}", "function normalizeData(value) {\n if (value === 'true') {\n return true;\n }\n if (value === 'false') {\n return false;\n }\n if (value === Number(value).toString()) {\n return Number(value);\n }\n if (value === '' || value === 'null') {\n return null;\n }\n if (typeof value !== 'string') {\n return value;\n }\n try {\n return JSON.parse(decodeURIComponent(value));\n } catch (_unused) {\n return value;\n }\n }", "serialize(val) {\n if (this.is_bool(val)) return Boolean(val);\n if (typeof(val) === 'string' && ['true', 'false'].includes(val.toLowerCase())) return Boolean(val);\n if (typeof(val) === 'string') return val;\n if (this.is_numeric(val)) return String(val);\n if (this.is_numeric(val)) return String(val);\n if (this.is_object(val)) return this.serialize_object(val);\n if (this.is_array(val)) return this.serialize_array(val);\n return false;\n }", "function deserializeValue(value) {\n\t try {\n\t return value ? value == \"true\" || (value == \"false\" ? false : value == \"null\" ? null : +value + \"\" == value ? +value : /^[\\[\\{]/.test(value) ? $.parseJSON(value) : value) : value;\n\t } catch (e) {\n\t return value;\n\t }\n\t }", "function constructFromDb(model, row) {\n\t var o = new model();\n\t console.assert(o instanceof Instance);\n\t for (var col in row) {\n\t var val = row[col];\n\t var _col = '_' + col;\n\t // TODO: refactor this into column class\n\t switch (model.columns[col].type) {\n\t case Updraft.ColumnType.json:\n\t o[_col] = JSON.parse(val);\n\t break;\n\t case Updraft.ColumnType.date:\n\t case Updraft.ColumnType.datetime:\n\t o[_col] = new Date(val * 1000);\n\t break;\n\t case Updraft.ColumnType.enum:\n\t var enumClass = o._model.columns[col].enum;\n\t console.assert(enumClass != null);\n\t if (typeof enumClass === 'object' && typeof enumClass.get == 'function') {\n\t o[_col] = enumClass.get(val);\n\t }\n\t else {\n\t console.assert(val in enumClass);\n\t o[_col] = enumClass[val];\n\t }\n\t break;\n\t case Updraft.ColumnType.set:\n\t o[_col].push(val);\n\t break;\n\t default:\n\t o[_col] = val;\n\t break;\n\t }\n\t }\n\t o._isInDb = true;\n\t console.assert(o._changeMask === 0);\n\t return o;\n\t }", "function deserializeValue(value) {\r\n try {\r\n return value ?\r\n value == \"true\" ||\r\n ( value == \"false\" ? false :\r\n value == \"null\" ? null :\r\n +value + \"\" == value ? +value :\r\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\r\n value )\r\n : value\r\n } catch(e) {\r\n return value\r\n }\r\n }", "convertTypesForDb(input) {\n\t\tswitch (input?.constructor.name) {\n\t\t\tcase 'Long':\n\t\t\t\treturn input.toString();\n\t\t\tdefault: return input;\n\t\t}\n\t}", "function deserializeValue(value) {\r\n try {\r\n return value ?\r\n value == \"true\" ||\r\n ( value == \"false\" ? false :\r\n value == \"null\" ? null :\r\n +value + \"\" == value ? +value :\r\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\r\n value )\r\n : value\r\n } catch(e) {\r\n return value\r\n }\r\n }", "function deserializeValue(value) {\r\n try {\r\n return value ?\r\n value == \"true\" ||\r\n ( value == \"false\" ? false :\r\n value == \"null\" ? null :\r\n +value + \"\" == value ? +value :\r\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\r\n value )\r\n : value\r\n } catch(e) {\r\n return value\r\n }\r\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n (value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value) : value\n } catch (e) {\n return value\n }\n }", "function deserializeValue(value) {\n var num;\n try {\n return value ? value == \"true\" || (value == \"false\" ? false : value == \"null\" ? null : !/^0/.test(value) && !isNaN(num = Number(value)) ? num : /^[\\[\\{]/.test(value) ? $.parseJSON(value) : value) : value;\n } catch (e) {\n return value;\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n +value + \"\" == value ? +value :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function toType(str) {\n var type = typeof str;\n if (type !== 'string') {\n return str;\n }\n var nb = parseFloat(str);\n if (!isNaN(nb) && isFinite(str)) {\n return nb;\n }\n if (str === 'false') {\n return false;\n }\n if (str === 'true') {\n return true;\n }\n\n try {\n str = JSON.parse(str);\n } catch (e) {}\n\n return str;\n }", "function diserialize_object_database(key) {\n var obj = get_item_database(key);\n return JSON.parse(obj);\n}", "function diserialize_object_database(key) {\n var obj = get_item_database(key);\n return JSON.parse(obj);\n}", "function getDataObject(state) {\n\t var data = state.data;\n\t if (!data) {\n\t data = state.data = RelayRecord.create(getComponentDataID(state));\n\t }\n\t !(data instanceof Object) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'readRelayQueryData(): Unable to read field on non-object.') : invariant(false) : undefined;\n\t return data;\n\t}", "function getDataObject(state) {\n\t var data = state.data;\n\t if (!data) {\n\t data = state.data = RelayRecord.create(getComponentDataID(state));\n\t }\n\t !(data instanceof Object) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'readRelayQueryData(): Unable to read field on non-object.') : invariant(false) : undefined;\n\t return data;\n\t}", "function deserializeValue(value) {\n var num\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n !/^0/.test(value) && !isNaN(num = Number(value)) ? num :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n var num\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n !/^0/.test(value) && !isNaN(num = Number(value)) ? num :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n var num\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n !/^0/.test(value) && !isNaN(num = Number(value)) ? num :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n var num\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n !/^0/.test(value) && !isNaN(num = Number(value)) ? num :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "function deserializeValue(value) {\n var num\n try {\n return value ?\n value == \"true\" ||\n ( value == \"false\" ? false :\n value == \"null\" ? null :\n !/^0/.test(value) && !isNaN(num = Number(value)) ? num :\n /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n value )\n : value\n } catch(e) {\n return value\n }\n }", "_deserialize(val) {\n return val;\n }", "_unpackDataFromBuf(buf) {\n let unpackedArray, unpackedAssocArray, assocIndex, unpackedAttrs;\n const objType = this._objType;\n if (objType.isCollection) {\n if (objType.collectionType === constants.TNS_OBJ_PLSQL_INDEX_TABLE) {\n unpackedAssocArray = new Map();\n } else {\n unpackedArray = [];\n }\n this.collectionFlags = buf.readUInt8();\n const numElements = buf.readLength();\n for (let i = 0; i < numElements; i++) {\n if (objType.collectionType === constants.TNS_OBJ_PLSQL_INDEX_TABLE) {\n assocIndex = buf.readUInt32BE();\n }\n const value = this._unpackValue(buf, objType.elementType,\n objType.elementTypeClass);\n if (objType.collectionType === constants.TNS_OBJ_PLSQL_INDEX_TABLE) {\n unpackedAssocArray.set(assocIndex, value);\n } else {\n unpackedArray.push(value);\n }\n }\n } else {\n unpackedAttrs = new Map();\n for (const attr of objType.attributes) {\n const value = this._unpackValue(buf, attr.type, attr.typeClass);\n unpackedAttrs.set(attr.name, value);\n }\n }\n this.unpackedAttrs = unpackedAttrs;\n this.unpackedArray = unpackedArray;\n this.unpackedAssocArray = unpackedAssocArray;\n }", "function deserialize (rawData) {\r\n return JSON.parse(rawData, function (k, v) {\r\n if (k === '$$date') { return new Date(v); }\r\n if (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || v === null) { return v; }\r\n if (v && v.$$date) { return v.$$date; }\r\n\r\n return v;\r\n });\r\n}", "function translateToSQL(ob) {\n let arr = [];\n for (let key in ob) {\n let value = ob[key];\n if (Object.hasOwnProperty.call(ob, key)) {\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n arr.push(key + \"=\" + value);\n }\n }\n return arr.toString();\n}", "function objToSql(ob) {\n const arr = [];\n\n// loop keys & push key-value to array\nfor (const key in ob) {\n const value = ob[key];\n\n if(Object.hasOwnProperty.call(ob, key)) {\n\n if(typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n arr.push(key + \"=\" + value);\n }\n }\n//convert arrays to single string\n return arr.toString();\n}", "function objToSql(ob) {\n let arr = [];\n\n // loop through the keys and push the key/value as a string int arr\n for (let key in ob) {\n let value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n // if string with spaces, add quotations \n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n\n arr.push(key + \"=\" + value);\n }\n }\n\n // translate array of strings to a single string\n return arr.toString();\n}", "_deserializeValue(value, type) {\n if (type == Boolean) {\n return !(!value || value.toLowerCase() == 'false');\n }\n return super._deserializeValue(value, type);\n }", "function convertDBData2UserData(dbData) {\n debug && console.log(\"convertDBData2UserData().\");\n for (var i = 0; i < dbData.length; i++) {\n var arr = dbData[i][\"id\"].propName.split(\"-\");\n if (arr.length != 3) {\n // for templateName, categoryTemplateName, such properties are not belong to any step. Reserve them and will write back to DB when saving data.\n mDbDataReserved.push(dbData[i]);\n continue;\n }\n\n var step = arr[0];\n var field = arr[1];\n var index = arr[2];\n if (mUserData[step] == undefined) {\n // if (isNaN(index)) {\n // mUserData[step] = {};\n // } else {\n mUserData[step] = [];\n // }\n }\n if (isNaN(index)) {\n // mUserData[step][field] = dbData[i].propValue;\n index = 0;\n }\n // else {\n if (mUserData[step][index] == undefined) {\n mUserData[step][index] = {};\n }\n mUserData[step][index][field] = dbData[i].propValue;\n // }\n }\n debug && console.log(\">> converted dbData to userData:\", mUserData);\n debug && console.log(\">> reserved dbData:\", mDbDataReserved);\n }", "function fromDatastore(obj){\n\t\tobj.data.id = obj.key.id;\n\t\treturn obj.data;\n\t}", "function convertSql(item) {\n var arr = [];\n \n for (var key in item) {\n var value = item[key];\n if (Object.hasOwnProperty.call(item, key)) {\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n arr.push(key + \"=\" + value);\n }\n }\n return arr.toString();\n}", "_parseFrom(schema) {\n const parsed = {};\n Object.entries(schema.properties).forEach(([pName, prop]) => {\n let p = prop;\n let name = pName;\n if (typeof p === 'string') {\n p = {\n type: p\n };\n }\n if (name === 'id')\n name = '_id';\n parsed[name] = p;\n if (p.type instanceof Array) {\n parsed[name].type = mongoose_1.default.Schema.Types.Mixed;\n }\n else {\n switch (p.type) {\n case 'email':\n parsed[name].type = String;\n break;\n case 'uuid':\n parsed[name].type = String;\n parsed[name].default = () => v4_1.default();\n break;\n }\n }\n if (p.unique) {\n parsed[name].index = {\n unique: true\n };\n }\n });\n parsed.createdAt = { type: Date, required: true, default: Date.now };\n parsed.updatedAt = Date;\n parsed.deletedAt = Date;\n return parsed;\n }", "function objToSql(ob) {\n\tvar arr = [];\n\n\tfor (var key in ob){\n\t\tarr.push(key + \"=\" + ob[key]);\n\t}\n\treturn arr.toString();\n}", "static getRawObject(data) {\n if (data && typeof data.toObject === 'function') {\n return data.toObject();\n }\n return data;\n }", "function objToSql(ob) {\n var arr = [];\n // loop through the keys and push the key/value as a string int arr\n for (var key in ob) {\n var value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n // e.g. {name: 'Lana Del Grey'} => [\"name='Lana Del Grey'\"]\n // e.g. {sleepy: true} => [\"sleepy=true\"]\n arr.push(key + \"=\" + value);\n }\n }\n\n // translate array of strings to a single comma-separated string\n return arr.toString();\n }", "function normalizeData(val) {\n if (val === 'true') {\n return true;\n }\n\n if (val === 'false') {\n return false;\n }\n\n if (val === Number(val).toString()) {\n return Number(val);\n }\n\n if (val === '' || val === 'null') {\n return null;\n }\n\n return val;\n }", "function normalizeData(val) {\n if (val === 'true') {\n return true;\n }\n\n if (val === 'false') {\n return false;\n }\n\n if (val === Number(val).toString()) {\n return Number(val);\n }\n\n if (val === '' || val === 'null') {\n return null;\n }\n\n return val;\n }", "function handleData(err,res,data){\n var d = JSON.parse(data);// string to json\n // object\n var newData = new dataJs({\n\t\tid : d[0].id,\n\t\ttime : timestamp()\n\t});\n //save to db\n newData.save(cb);\n format(d);\n}", "function prepDataForDB(data) {\n if (data.hasOwnProperty('active') === true) {\n data.active = data.active === true\n ? 1\n : 0\n }\n if (data.hasOwnProperty('type') === true) {\n delete data.type\n }\n return data;\n}", "function deserialize(rawData) {\n return JSON.parse(rawData, function(k, v) {\n if (k === '$$date') {\n return new Date(v);\n }\n if (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || v === null) {\n return v;\n }\n if (v && v.$$date) {\n return v.$$date;\n }\n\n return v;\n });\n}", "function convert2SqlValue(value) {\n var result = '';\n if(typeof value == 'string') {\n result = \"'\"+value.replace(/'/g, \"''\")+\"'\";\n }\n else\n if(isTypeDate(value)) {\n result = result+\"'\"+formatDate(value)+\"'\";\n }\n else\n if(value === null) {\n result = result + value;\n }\n else\n if(typeof value == 'object') {\n result = result + propEqValue2String(value);\n }\n else {\t\t\n result = value;\n }\n return result;\n}", "function objToSql(ob) {\n var arr = [];\n \n // loop through the keys and push the key/value as a string int arr\n for (var key in ob) {\n var value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n // if string with spaces, add quotations (Lana Del Grey => 'Lana Del Grey')\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n // e.g. {name: 'Lana Del Grey'} => [\"name='Lana Del Grey'\"]\n // e.g. {sleepy: true} => [\"sleepy=true\"]\n arr.push(key + \"=\" + value);\n }\n }\n \n // translate array of strings to a single comma-separated string\n return arr.toString();\n }", "function objToSql(ob) {\n var arr = [];\n \n // loop through the keys and push the key/value as a string int arr\n for (var key in ob) {\n var value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n // if string with spaces, add quotations (Lana Del Grey => 'Lana Del Grey')\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n // e.g. {name: 'Lana Del Grey'} => [\"name='Lana Del Grey'\"]\n // e.g. {sleepy: true} => [\"sleepy=true\"]\n arr.push(key + \"=\" + value);\n }\n }\n \n // translate array of strings to a single comma-separated string\n return arr.toString();\n }", "function unmarshal(context, data, container, pname) { // from database\n\tif (!data)\n\t\treturn;\n\t\n\tif (pname != undefined)\n\t\tcontainer[pname] = data; // might get overwritten below\n\t\n\tif (Array.isArray(data)) {\n\t\tvar newArray = container[pname] = [];\n\t\tfor (var i=0; i<data.length; i++) {\n\t\t\tunmarshal(context, data[i], newArray, i);\n\t\t}\n\t\treturn;\n\t}\n\t\n\tif (data instanceof Date)\n\t\treturn;\n\t\t\n\tswitch (typeof data) {\n\t\tdefault:\n\t\t\treturn;\n\n\t\tcase 'string':\n\t\t\tvar match = /([\\w_]+):(.+)/.exec(data);\n\t\t\tif (match) {\n\t\t\t\tvar eid;\n\t\t\t\tswitch (match[1]) {\n\t\t\t\tcase '_ds':\n\t\t\t\t\teid = getDataSpace(context).makeEid(match[2]);\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase '_host':\n\t\t\t\t\tmatch = /^(.*)\\/(.*)$/.exec(match[2]);\n\t\t\t\t\teid = getEntityService(context).makeEid(match[1], match[2]);\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase '_class':\n\t\t\t\t\tcontainer[pname] = MjClass.get(match[2]);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (eid) {\n\t\t\t\t\tcontainer.__defineGetter__(pname, function() {\n\t\t\t\t\t\treturn container[pname] = getEntityService(context).get(eid);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tmatch = /\\s*(\\d+)-(\\d+)-(\\d+)(T(\\d+):(\\d+):(\\d+))?\\s*/.exec(data);\n\t\t\tif (match) {\n\t\t\t\tcontainer[pname] = new Date(data);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase 'object':\n\t\t\tvar newObj = {};\n\t\t\tcontainer[pname] = newObj;\n\t\t\tfor (var p2 in data) {\n\t\t\t\tif (data.hasOwnProperty(p2)) {\n\t\t\t\t\tunmarshal(context, data[p2], newObj, p2);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t}\n}", "_dataType(col, passed_options) {\n const options = Object.assign(\n {},\n {\n is_atomic: false,\n },\n passed_options,\n );\n const { is_atomic } = options;\n const props = this.fields[col];\n\n if (this._isKeyCandidate(col)) {\n return 'BIGINT.UNSIGNED';\n } else {\n let { type } = props;\n\n if (type.startsWith('ref|list')) {\n if (is_atomic) {\n type = type.replace('ref|list|', '');\n } else {\n return 'TEXT';\n }\n }\n\n switch (type) {\n case 'short':\n return 'INTEGER';\n case 'int':\n return 'INTEGER';\n case 'uint':\n return 'INTEGER.UNSIGNED';\n case 'long':\n return 'BIGINT';\n case 'ulong':\n return 'BIGINT.UNSIGNED';\n case 'float':\n return 'FLOAT';\n case 'double':\n return 'DOUBLE';\n case 'ref|string':\n return 'TEXT';\n case 'bool':\n return 'BOOLEAN';\n case 'byte':\n // TINYINT\n return 'INTEGER'; // TODO bits in sequelize\n case 'ref|int':\n return 'INTEGER';\n case 'ubyte':\n return 'INTEGER.UNSIGNED'; // TODO bits in sequelize\n default:\n throw new Error(`unrecognized type '${props.type}'`);\n }\n }\n }", "static castToPrimitiveType(field, data) {\n if (data.hasOwnProperty(field)) {\n if (Array.isArray(data[field])) {\n data[field] = data[field].map(val => detectType(val));\n } else {\n data[field] = detectType(data[field]);\n }\n }\n }", "function objToSql(ob) {\n var arr = [];\n\n // loop through the keys and push the key/value as a string int arr\n for (var key in ob) {\n var value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n // if string with spaces, add quotations (Lana Del Grey => 'Lana Del Grey')\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n // e.g. {name: 'Lana Del Grey'} => [\"name='Lana Del Grey'\"]\n // e.g. {sleepy: true} => [\"sleepy=true\"]\n arr.push(key + \"=\" + value);\n }\n }\n\n // translate array of strings to a single comma-separated string\n return arr.toString();\n}", "function objToSql(ob) {\n var arr = [];\n\n // loop through the keys and push the key/value as a string int arr\n for (var key in ob) {\n var value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n // if string with spaces, add quotations (Lana Del Grey => 'Lana Del Grey')\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n // e.g. {name: 'Lana Del Grey'} => [\"name='Lana Del Grey'\"]\n // e.g. {sleepy: true} => [\"sleepy=true\"]\n arr.push(key + \"=\" + value);\n }\n }\n\n // translate array of strings to a single comma-separated string\n return arr.toString();\n}", "function objToSql(ob) {\n\tvar arr = [];\n\n\tfor (var key in ob) {\n\t\tarr.push(key + \"=\" + ob[key]);\n\t}\n\n\treturn arr.toString();\n}", "function objToSql(ob) {\n const arr = []\n\n for(var key in ob) {\n arr.push(key + '=' + ob[key])\n }\n return arr.toString()\n}", "function objToSql(ob) {\n var arr = [];\n\n // loop through the keys and push the key/value as a string int arr\n for (var key in ob) {\n var value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n // if string with spaces, add quotations (Lana Del Grey => 'Lana Del Grey')\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n arr.push(key + \"=\" + value);\n }\n }\n // translate array of strings to a single comma-separated string\n return arr.toString();\n}", "function objToSql(ob) {\n // empty array just like the question marks function\n let arr = [];\n // this will loop through keys then push the key/value as a string into the array\n for (var key in ob) {\n let value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n // if a string with spaces then add quotes \n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n // adding a single quote to either side of the value\n value = \"'\" + value + \"'\";\n }\n // push key=value to the end of the array\n arr.push(key + \"=\" + value);\n };\n };\n // then turn the array of strings into one string with commas in between each value\n return arr.toString();\n }", "function parse_Obj(blob, length, opts) {\n if (opts && opts.biff < 8) return parse_BIFF5Obj(blob, length, opts);\n var cmo = parse_FtCmo(blob, 22); // id, ot, flags\n\n var fts = parse_FtArray(blob, length - 22, cmo[1]);\n return {\n cmo: cmo,\n ft: fts\n };\n }", "deserialize(any) {\n const url = any.type_url;\n const idx = url.indexOf(\"/\");\n let hostName = \"\";\n let type = url;\n if (url.indexOf(\"/\") >= 0) {\n hostName = url.substr(0, idx + 1);\n type = url.substr(idx + 1);\n }\n\n let bytes = any.value;\n if (typeof bytes === \"undefined\") {\n bytes = new Buffer(0);\n }\n\n if (hostName === CloudStatePrimitive) {\n return AnySupport.deserializePrimitive(bytes, type);\n }\n\n if (hostName === CloudStateJson) {\n const json = AnySupport.deserializePrimitive(bytes, \"string\");\n return JSON.parse(json);\n }\n\n const desc = this.root.lookupType(type);\n return desc.decode(bytes);\n }", "function objToSql(ob) {\n var arr = [];\n\n // loop through the keys and push the key/value as a string int arr\n for (var key in ob) {\n var value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n // if string with spaces, add quotations\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n arr.push(key + \"=\" + value);\n }\n }\n\n // translate array of strings to a single comma-separated string\n return arr.toString();\n}" ]
[ "0.5997156", "0.59551406", "0.59551406", "0.59551406", "0.5939179", "0.58839494", "0.5883745", "0.58017576", "0.5796141", "0.5796141", "0.5796141", "0.5796141", "0.5796141", "0.5796141", "0.5796141", "0.5796141", "0.5796141", "0.57506883", "0.57506883", "0.574295", "0.5721118", "0.56772774", "0.5665898", "0.56449485", "0.5605828", "0.5546194", "0.5532765", "0.54779124", "0.54630023", "0.5457237", "0.540537", "0.54026854", "0.53649825", "0.5355998", "0.53429675", "0.5333787", "0.53036326", "0.5302788", "0.5288771", "0.5265332", "0.5265332", "0.5245276", "0.5211199", "0.51700413", "0.51700413", "0.51700413", "0.51700413", "0.51700413", "0.51700413", "0.51700413", "0.51700413", "0.51700413", "0.51700413", "0.51700413", "0.51700413", "0.51700413", "0.51522005", "0.5146486", "0.5146486", "0.51343876", "0.51343876", "0.5115839", "0.5115839", "0.5115839", "0.5115839", "0.5115839", "0.509862", "0.50768524", "0.50356877", "0.5032264", "0.50271666", "0.4956879", "0.49529222", "0.49521145", "0.49511588", "0.49438715", "0.49433523", "0.49086267", "0.49070987", "0.4906183", "0.49034524", "0.49034524", "0.48890045", "0.48889288", "0.48807704", "0.4875915", "0.48669308", "0.48669308", "0.48661265", "0.48632506", "0.4859332", "0.48557305", "0.48557305", "0.4855388", "0.48434213", "0.48427427", "0.48419613", "0.48406392", "0.48364547", "0.48348638" ]
0.5867194
7
make a GUID Notes: needs better seed generation.
function makeGuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c){ var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); return v.toString(16); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static createGuid() {\n return Math.random().toString(36).substring(2, 15) +\n Math.random().toString(36).substring(2, 15);\n }", "createGuid() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n // eslint-disable-next-line\n var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n }", "function guidGenerator() {\nvar S4 = function() {\nreturn (((1+Math.random())*0x10000)|0).toString(16).substring(1);\n};\nreturn (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n}", "function guidGenerator() {\n\t var S4 = function() {\n\t return (((1+Math.random())*0x10000)|0).toString(16).substring(1);\n\t };\n\n\t return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n\t }", "function guidGenerator() {\n var S4 = function() {\n return (((1+Math.random())*0x10000)|0).toString(16).substring(1);\n };\n\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n }", "function guidGenerator() {\n function S4() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n return S4()+S4()+'-'+S4()+'-'+S4()+'-'+S4()+'-'+S4()+S4()+S4();\n}", "function generateGUID() {\n\tvar S4 = function() {\n\t\treturn (((1+Math.random())*0x10000)|0).toString(16).substring(1);\n\t};\n\treturn (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n}", "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 }", "function guidGenerator() {\n const 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\n}", "createGuid() {\n let dateTime = new Date().getTime();\n let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char) => {\n let randNo = (dateTime + Math.random() * 16) % 16 | 0;\n dateTime = Math.floor(dateTime / 16);\n return (char === 'x' ? randNo : (randNo & 0x3 | 0x8)).toString(16);\n });\n return uuid;\n }", "function guid() \n\t {\n\t function s4() \n\t {\n\t return Math.floor((1 + Math.random()) * 0x10000)\n\t .toString(16)\n\t .substring(1);\n\t }\n\t return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\n\t s4() + '-' + s4() + s4() + s4();\n\t }", "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() + '-' + s4() + '-' + s4() + s4() + s4();\n }", "function genGuid() {\n\t\treturn (S4() + S4() + \"-\" + S4() + \"-4\" + S4().substr(0, 3) + \"-\" + S4() + \"-\" + S4() + S4() + S4()).toLowerCase();\n\t}", "function guid() {\n const 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 }", "function newGuid() {\n\treturn (S4() + S4() + \"-\" + S4() + \"-4\" + S4().substr(0,3) + \"-\" + S4() + \"-\" + S4() + S4() + S4()).toLowerCase();\n\t}", "function guid() {\n function S4() {\n return (65536 * (1 + Math.random()) | 0).toString(16).substring(1);\n }\n\n return S4() + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + S4() + S4();\n}", "function guid() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1)\n\t .toUpperCase();\n }\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\n s4() + '-' + s4() + s4() + s4();\n}", "function guid() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n }\n\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\n s4() + '-' + s4() + s4() + s4();\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}", "function guid() {\r\n function s4() {\r\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\r\n }\r\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();\r\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() + '-' + s4() + '-' + s4() + s4() + s4()\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}", "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}", "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}", "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}", "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}", "function _guid() {\n function S4() {\n return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\n }\n\n return (S4() + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + S4() + S4());\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() + '-' + s4() + '-' + s4() + s4() + s4();\n }", "function guid() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\n s4() + '-' + s4() + s4() + s4();\n}", "function guid() {\n function s4() {\n return Math\n .floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n return s4() + s4() + '-' + s4() + '-' + s4() + '-'\n + s4() + '-' + s4() + s4() + s4();\n }", "function guid() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n\n return \"ss-s-s-s-sss\".replace(/s/g, s4);\n}", "function guid() {\n\tfunction s4() {\n\t return Math.floor((1 + Math.random()) * 0x10000)\n\t .toString(16)\n\t .substring(1);\n\t}\n\treturn s4() + s4() + s4();\n}", "function guid() {return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();}", "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}", "function guid() {\r\n function s4() {\r\n return Math.floor((1 + Math.random()) * 0x10000)\r\n .toString(16)\r\n .substring(1);\r\n };\r\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\r\n s4() + '-' + s4() + s4() + s4();\r\n}", "function CreateGUID() {\n var d = new Date().getTime();\n var uuid = '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 return uuid.toUpperCase();\n}", "createNewGuid() {\n return this.guidGenerator.generateGuid();\n }", "function guid() {\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n}", "function guid() {\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n}", "function guid() {\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n}", "function guid() {\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\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}", "function guid() {\r\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\r\n}", "static generateGUID() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function(c) {\n let r = (Math.random() * 16) | 0,\n v = c == \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }", "function createGUID() {\n\n var s = [];\n var hexDigits = \"0123456789abcdef\";\n for (var i = 0; i < 36; i++) {\n s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);\n }\n s[14] = \"4\"; // bits 12-15 of the time_hi_and_version field to 0010\n s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01\n s[8] = s[13] = s[18] = s[23] = \"-\";\n\n var uuid = s.join(\"\");\n return uuid;\n}", "function genGuid()\n{\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n}", "function guid() {\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n }", "function guid() {\n return (S4()+S4()+S4()+S4());\n}", "function guid() {\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n}", "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 }", "guid() {\n\t\tfunction s4() {\n\t\t\treturn Math.floor((1 + Math.random()) * 0x10000)\n\t\t\t\t.toString(16)\n\t\t\t\t.substring(1);\n\t\t}\n\t\treturn s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();\n\t}", "function guid() {\n return S4() + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + S4() + S4();\n}", "GUID() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n }\n return \"ss-s-s-s-sss\".replace(/s/g, s4);\n }", "function guid() {\n return parseInt(Date.now() + Math.random())\n }", "function generateGUID() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (a) {\n var b, c;\n return b = Math.random() * 16 | 0, c = a === \"x\" ? b : b & 3 | 8, c.toString(16);\n });\n}", "function guid() {\r\n return parseInt(Date.now() + Math.random());\r\n}", "function guid() {\r\n\treturn parseInt(Date.now() + Math.random());\r\n}", "function generateGUID(){\n\tvar chars = '1234567890ABCDEF';\n\tvar guid = generateRandomString(8, chars) + '-' +\n\t\tgenerateRandomString(4, chars) + '-' +\n\t\tgenerateRandomString(4, chars) + '-' +\n\t\tgenerateRandomString(4, chars) + '-' +\n\t\tgenerateRandomString(12, chars);\n\treturn guid;\n}", "function guid() {\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n }", "function guid() {\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\n s4() + '-' + s4() + s4() + s4();\n}", "generateGuid() {\n return uuid.v4();\n }", "function guid() {\n var id = '', i, random;\n\n for (i = 0; i < 32; i++) {\n random = Math.random() * 16 | 0;\n\n if (i == 8 || i == 12 || i == 16 || i == 20) {\n id += \"-\";\n }\n id += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);\n }\n\n return id;\n }", "getGuid() {\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 }", "function guidGenerator(){\n let sec = ()=>(((1+Math.random())*0x10000)|0).toString(16).substring(1); \n console.log((sec() + sec() + \"-\" + sec() + \"-4\" + sec().substr(0,3) + \"-\" + sec() + \"-\" + sec() + sec() + sec()).toLowerCase())\n return (sec() + sec() + \"-\" + sec() + \"-4\" + sec().substr(0,3) + \"-\" + sec() + \"-\" + sec() + sec() + sec()).toLowerCase();\n}", "function _makeId() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(\n /[xy]/g,\n function (c) {\n var r = (Math.random() * 16) | 0;\n var v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n },\n );\n }", "function GUID ()\n{\n // TODO Guarantee Uniqueness\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n}", "function guid()\n{\n function _p8(s) {\n var p = (Math.random().toString(16) + \"000000000\").substr(2, 8);\n return s ? \"-\" + p.substr(0, 4) + \"-\" + p.substr(4, 4) : p;\n }\n\n return _p8() + _p8(true) + _p8(true) + _p8();\n}", "function guid() {\n\n var d = new Date().getTime();\n\n var guid = 'xxxx-xxxx-xxxx-xxxx'.replace(\n /[xy]/g,\n function(c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return(c == 'x' ? r : (r & 0x7 | 0x8)).toString(16);\n });\n\n return guid;\n }", "function guid() {\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n }", "function guid() {\n return (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n }", "function makeId() {\r\n var rtn;\r\n\r\n rtn = String(Math.random());\r\n rtn = rtn.substring(2);\r\n rtn = parseInt(rtn).toString(36);\r\n\r\n return rtn;\r\n}", "function guid() {\n\t\treturn (S4() + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + S4() + S4());\n\t}", "function _guid(len) {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n }\n let s = s4();\n for (var i = 0; i < len-1; i++)\n s += s4();\n return s;\n }", "function guid() {\n \n var d = new Date().getTime();\n \n var guid = 'xxxx-xxxx-xxxx-xxxx'.replace(\n /[xy]/g,\n function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c == 'x' ? r : (r & 0x7 | 0x8)).toString(16);\n });\n \n return guid;\n }", "function guid() {\n \n var d = new Date().getTime();\n \n var guid = 'xxxx-xxxx-xxxx-xxxx'.replace(\n /[xy]/g,\n function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c == 'x' ? r : (r & 0x7 | 0x8)).toString(16);\n });\n \n return guid;\n }", "function guid() {\n \n var d = new Date().getTime();\n \n var guid = 'xxxx-xxxx-xxxx-xxxx'.replace(\n /[xy]/g,\n function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c == 'x' ? r : (r & 0x7 | 0x8)).toString(16);\n });\n \n return guid;\n }", "function guid() {\n return s4() + s4() + s4() + s4() + '-' + (new Date()).getTime();\n }", "function guid() {\n\n\t\tvar d = new Date().getTime();\n\n\t\tvar guid = 'xxxx-xxxx-xxxx-xxxx'.replace(\n\t\t\t/[xy]/g,\n\t\t\tfunction (c) {\n\t\t\t\tvar r = (d + Math.random() * 16) % 16 | 0;\n\t\t\t\td = Math.floor(d / 16);\n\t\t\t\treturn (c == 'x' ? r : (r & 0x7 | 0x8)).toString(16);\n\t\t\t});\n\n\t\treturn guid;\n\t}", "function guid() {\n\t return (\n\t randHex(8)+'-'+\n\t randHex(4)+'-'+\n\t // v4 UUID always contain \"4\" at this position to specify it was\n\t // randomly generated\n\t '4' + randHex(3) +'-'+\n\t // v4 UUID always contain chars [a,b,8,9] at this position\n\t choice(8, 9, 'a', 'b') + randHex(3)+'-'+\n\t randHex(12)\n\t );\n\t }", "function guid() {\n return (\n randHex(8)+'-'+\n randHex(4)+'-'+\n // v4 UUID always contain \"4\" at this position to specify it was\n // randomly generated\n '4' + randHex(3) +'-'+\n // v4 UUID always contain chars [a,b,8,9] at this position\n choice(8, 9, 'a', 'b') + randHex(3)+'-'+\n randHex(12)\n );\n }", "function createID() {\n return (\"\" + 1e10).replace(/[018]/g, function(a) {\n return (a ^ Math.random() * 16 >> a / 4).toString(16)\n });\n}", "function generateGuid(a){return a?(a^Math.random()*16>>a/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,generateGuid)} // eslint-disable-line", "function makeId() {\n return Math.random().toString(36).substr(2, 5);\n}", "function makeId() {\n var result = \"\";\n var hexChars = \"0123456789abcdef\";\n for (var i = 0; i < 16; i += 1) {\n result += hexChars[Math.floor(Math.random() * 16)];\n }\n return result;\n}", "function makeId() {\n var result = \"\";\n var hexChars = \"0123456789abcdef\";\n for (var i = 0; i < 16; i += 1) {\n result += hexChars[Math.floor(Math.random() * 16)];\n }\n return result;\n}", "function getGUID() {\n var d = Date.now();\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}", "function makeId() {\n return \"_\" + Math.random().toString(36).substr(2, 9);\n }", "function guid() {\n // function to create unique id for each todo\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 }", "function guid() {\n return (S4() + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + S4() + S4());\n }", "static createID() {\n return /*'_' + */Math.random().toString(36).substr(2, 9);\n }", "static guid() {\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n }", "function newUuid() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n}", "function newUuid() {\n return Math.floor(Math.random() * 100000).toString();\n }", "function createID() {\n return 'xxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n}", "function creatID() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();\n}", "function createID(){\n\treturn '_' + Math.random().toString(36).substr(2, 9);\n}", "function getGuid()\r\n{\r\n var aGuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'\r\n .replace(/[xy]/g, function(c)\r\n {\r\n var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n\r\n return aGuid;\r\n}", "function createId() {\r\n return (\r\n Math.floor(Math.random() * 10000000) +\r\n \"-\" +\r\n Math.floor(Math.random() * 10000000)\r\n );\r\n }", "function getGuid() {\n\treturn Guid.create();\n}", "function createUUID() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n }\n\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();\n}" ]
[ "0.85585445", "0.8417411", "0.8376842", "0.83348507", "0.82978654", "0.8284737", "0.82768565", "0.8243388", "0.82218874", "0.82210916", "0.8205596", "0.81921417", "0.8188581", "0.8166545", "0.8163857", "0.81575906", "0.815113", "0.8149187", "0.8144711", "0.8143359", "0.8134548", "0.81330675", "0.81330675", "0.81330675", "0.81330675", "0.81330675", "0.8127279", "0.81212676", "0.8119477", "0.81117916", "0.8104998", "0.8102096", "0.80962753", "0.8095459", "0.8094129", "0.8059793", "0.8048721", "0.80443966", "0.80443966", "0.80443966", "0.80443966", "0.80386263", "0.8024501", "0.8022247", "0.8021871", "0.80208945", "0.8018021", "0.80087745", "0.8008074", "0.80017", "0.7996053", "0.7991714", "0.7985891", "0.7968342", "0.7967476", "0.79669976", "0.79664683", "0.79492295", "0.7942703", "0.79363126", "0.79323316", "0.79222697", "0.7909404", "0.7909265", "0.7908488", "0.7866098", "0.7855842", "0.7855697", "0.7852298", "0.7852298", "0.78519946", "0.7849129", "0.7832643", "0.78271705", "0.78271705", "0.78271705", "0.7814972", "0.7812599", "0.7807721", "0.78003824", "0.77999693", "0.77996445", "0.7779925", "0.7767368", "0.7767368", "0.77661884", "0.7761887", "0.77423483", "0.77381027", "0.77374345", "0.7725818", "0.77208865", "0.77118033", "0.7708483", "0.7705774", "0.76969683", "0.76914996", "0.7686105", "0.76715773", "0.764212" ]
0.8633084
0
builds a simple db select statement from a mongo style JSON query
function buildSimpleDbSelect(domainName, q) { var query; if (_.keys(q).length > 0) { var where = convertQueryFromJsonToWhere(q); query = "select * from `" + escapeStr(domainName) + "` " + where; } else { query = "select * from `" + escapeStr(domainName) + "`"; } return query; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function queryDataTest3() {\n var start_q ='\\\"'+(new Date(Date.UTC(2017,11,1,8,0,0))).toISOString()+'\\\"';\n var end_q = '\\\"'+(new Date(Date.UTC(2017,11,2,10,0,0))).toISOString()+'\\\"';;\n var or1 = '{\"start_time\":{\"$gte\":'+start_q+',\"$lte\":'+end_q+'}},';\n var or2 = '{\"end_time\":{\"$gte\":'+start_q+',\"$lte\":'+end_q+'}},';\n var or3 = '{\"start_time\":{\"$lt\":'+start_q+'},\"end_time\":{\"$gt\":'+end_q+'}}';\n var query ='where={\"$or\":['+or1+or2+or3+']}';\n console.log(query)\n XHR.GET(SERVER_URL+'/classes/Sleep?'+encodeURI(query))\n}", "find (queries = {}, projections = {}, one = false, bykey = false) {\n let cursor = new Cursor();\n if (Helpers.is(queries, '!Object')) {\n let value;\n if ((value = this.get(queries, false)) !== Helpers._null) {\n cursor.add(new MapQLDocument(queries, value).bykey(true));\n if (one || bykey) {\n return cursor;\n }\n }\n queries = { '$eq' : queries };\n }\n let _queries = this.compile(queries);\n if (!!_queries.list.length) {\n for (let entry of this.entries()) {\n if (this._validate(!bykey ? entry : [entry[0], entry[0]], _queries)) {\n cursor.add(new MapQLDocument(entry[0], entry[1]).bykey(bykey));\n if (one) {\n return cursor;\n }\n }\n }\n return cursor;\n } else {\n return new Cursor().add(MapQLDocument.convert(one ? [[...this.entries()][0]] : [...this.entries()]));\n }\n }", "function jsonToQuery (jsonObject) {\n\tvar str = \"\";\n\tfor (var key in jsonObject) {\n\t\tvar value = jsonObject[key];\n\n\t\tif(value != \"\" && key != \"amo\")\n\t\t\tstr += ` AND rate.rate_${key} = \"${value}\"`;\n\t}\n\treturn str;\n\t\n}", "function bson_query(query, result_cb, opts){\n\topts.type=\"arraybuffer\";\n\t\n\txhr_query(query,function(error, qdata){\n\t if(error) \n\t\treturn result_cb(error);\n\t else{\n\t\tvar data;\n\n\t\ttry{\n\t\t //console.log(\"DATA IN [\"+text_data+\"]\");\n\t\t data=BSON.deserialize(qdata);\n\t\t}\n\t\tcatch (e){\n\t\t return result_cb(\"json_query: JSON parse error \" + e);\n\t\t}\n\n\t\t/*\n\t\t if(data.error){\n\t\t return result_cb(\"json_query: Server reported error : \" + data.error);\n\t\t }\n\t\t*/\n\t\tresult_cb(null,data);\n\t }\n\t}, opts);\n }", "selectOneQuery() {\n return `select * from ${this.tablename('selectOne')} where id = $1`;\n }", "function jsonToSQL(jsonObj) {\n\n let sql = '';\n\n /**\n * Uses mysql.escape to sanitize given values\n * @param value\n * @returns {*}\n */\n\n let sanitizeValue = function (value) {\n\n if (mysql.escape(value) === '' + value) {\n return value;\n } else {\n return mysql.escape(value).slice(1,-1);\n }\n\n };\n\n /**\n * Adds conditions to a given sql statement\n * @param conditions\n * @param sql\n * @returns {*}\n */\n\n let addConditions = function (conditions, sql) {\n\n // add conditions if any\n\n if (conditions !== undefined) {\n\n // conditions need to be added\n\n sql += ' WHERE ';\n\n conditions.forEach(function (condition) {\n\n if (condition.hasOwnProperty('binaryOperator')) {\n sql += sanitizeValue(condition.binaryOperator) + ' ';\n } else {\n sql += sanitizeValue(condition.column) + ' ' + sanitizeValue(condition.compareOperator) + ' '\n + (typeof(condition.compareValue) === 'string' && condition.compareValue[0] !== '(' ?\n \"'\" + sanitizeValue(condition.compareValue) + \"'\"\n : sanitizeValue(condition.compareValue)) + ' ';\n }\n });\n }\n\n return sql;\n };\n\n switch (jsonObj.queryType) {\n\n case 'SELECT':\n sql += 'SELECT ';\n\n // add tables fields\n\n //console.log(jsonObj.selectQueryFields.tableFields);\n\n jsonObj.selectQueryFields.columns.forEach(function (value) {\n sql += sanitizeValue(value) + ', ';\n });\n\n // add table name\n\n sql = sql.slice(0, -2) + ' FROM ' + sanitizeValue(jsonObj.tableName) + ' ';\n\n // add conditions if any\n\n sql = addConditions(jsonObj.selectQueryFields.conditions, sql);\n\n sql += ';';\n\n break;\n\n case 'INSERT':\n sql += 'INSERT INTO ' + sanitizeValue(jsonObj.tableName) + (\n jsonObj.hasOwnProperty(\"insertQueryColumns\")? '(' + jsonObj.insertQueryColumns.toString() + ')':''\n ) + ' VALUES(';\n\n // insert values into query\n\n jsonObj.insertQueryValues.forEach(function (value) {\n\n if (value == null)\n sql += 'NULL,';\n else\n sql += (typeof(value) === 'string'? '\"' + sanitizeValue(value) + '\"': sanitizeValue(value)) + ',';\n });\n\n if (jsonObj.tableName === 'recycling_logs')\n // add the NOW() function to calculate date and time for the recycling log\n sql += 'NOW()';\n else\n sql = sql.slice(0, -1);\n\n sql += ');';\n break;\n\n case 'DELETE':\n\n sql += 'DELETE FROM ' + sanitizeValue(jsonObj.tableName) + ' ';\n\n sql = addConditions(jsonObj.deleteQueryFields.conditions, sql);\n\n sql += ';';\n\n break;\n\n case 'UPDATE':\n sql += 'UPDATE ' + sanitizeValue(jsonObj.tableName) + ' SET ';\n\n // add column names and new values\n\n _.zip(jsonObj.updateQueryFields.columns, jsonObj.updateQueryFields.values).forEach(\n function (pair) {\n sql += sanitizeValue(pair[0]) + ' = ' + (typeof(sanitizeValue(pair[1])) === 'string'? \"'\" + sanitizeValue(pair[1]) + \"'\": sanitizeValue(pair[1])) + ', ';\n }\n );\n\n sql = sql.slice(0, -2);\n\n // add conditions if any\n\n sql = addConditions(jsonObj.updateQueryFields.conditions, sql);\n\n sql += ';';\n\n console.log(sql);\n\n break;\n\n }\n\n\n return sql;\n }", "function createSelectQuery(item){\n return response = `connection.query(\"SELECT * FROM ${item}\", function(error, results, fields) {\n if (error) throw error;\n console.log(\"The solution is: \", results);\n res.json(results);\n });`\n}", "function constructSelectQuery( p_table, p_data, p_selectAll, p_keyword ){\n // The # of properties there are in the object\n var len = getObjLength( p_data ); \n // Tracks the current # of properties in the object\n var keyCount = 0;\n\n // Beginning the sql string\n var sql = \"SELECT * FROM \" + p_table;\n // If selectAll is true then the statement ends at the beginning\n if( p_selectAll == false ){\n sql += \" WHERE \";\n for( key in p_data ){\n sql += key;\n\n // Add on ilike if its keyword/pattern or in if its specific value\n sql += ( (p_keyword==true) ? \"\":\" IN (\" );\n for( var i=0; i<p_data[key].length; i++ ){\n // Open % or quote\n sql += ( (p_keyword==true) ? \" ILIKE '%\" : \"'\" );\n\n // Value\n sql += p_data[key][i];\n\n // Close % or quote\n sql += ( (p_keyword==true) ? \"%'\":\"'\" );\n\n if ( p_data[key].length > 1 && i < p_data[key].length-1 ){\n sql += ( (p_keyword==true) ? \" OR \" + key:\",\" );\n } \n }\n sql += ( (p_keyword==true) ? \"\":\")\" );\n \n keyCount++; \n // Only add 'and' if the # of properties in the object is greater than 1, and \n // the current property # is less than the # of properties in the object\n if(len > 1 && keyCount < len){\n sql += \" AND \"; \n } \n }\n }\n return sql;\n}", "function getJSON(adSql) {\n return $fairCmd.execute(cmd, {\n type: 'JSON',\n name: adSql\n });\n }", "function query(dbName, queryObj, response){\n MongoClient.connect(dburl, function(err, db) {\n if (err) throw err;\n db.collection(dbName).find(queryObj).sort( { \"time\": 1 } ).toArray(function(err, result) {\n if (err) throw err;\n response.writeHead(200, {\n \"Content-Type\": \"text/json\"\n });\n response.end(JSON.stringify(result));\n console.log(\"Get \"+result.length+\" documents from \"+dbName);\n db.close();\n });\n });\n}", "function getJSON(adSql) {\n return $miscCmd.execute(cmd, {\n sqlType: 'JSON',\n name: adSql\n });\n }", "function sql_select(query) {\n \"use strict\";\n if (query === 0 || query == null) {\n return primary_data;\n }\n if (secondary_data[query]) {\n return secondary_data[query];\n }\n return [];\n}", "function parseQuery(query) {\n var Query = query.split(' ');\n var query = { key: \"[PK]\", op: \"==\", value: \"\" };\n \n if (isCol(Query[0])) {\n query.key = Query.shift();\n query.op = Query.shift();\n query.value = parseAndOr(Query.join(' '));\n } else {\n query.value = parseAndOr(Query.join(' '));\n }\n \n return query;\n }", "static parseQuery(query) {\n const qObj = Util.getRawObject(query);\n const q = {},\n opts = {};\n Object.entries(qObj).map(entry => {\n const [k, v] = entry;\n if (k[0] === '$') {\n opts[k] = v;\n } else {\n q[k] = v;\n }\n });\n return { q, opts };\n }", "query(condition, fuzzy = true) {\n let cond = getCondition(condition, fuzzy, true);\n let mongo = new Mongo();\n return mongo.query(COLLECTION, cond);\n }", "queryHandler (model, query) {\r\n // JOIN aka populate, e.g. join=comments,reviews\r\n if (query.join) {\r\n // Split comma-separated string into an array.\r\n let joins = query.join.split(',')\r\n let shallowJoins = []\r\n // Make a collection of shallow joins. Search for any deep joins\r\n for (let join of joins) {\r\n // If there's a subfield, it's a deep join - Split and popilate the model's subfields now.\r\n if (join.includes('.')) {\r\n const paths = join.split('.')\r\n model = model.populate({\r\n path: paths[0],\r\n populate: { path: paths[1] }\r\n })\r\n } else {\r\n // Otherwise, add to your list of shallow joins.\r\n shallowJoins.push(join)\r\n }\r\n }\r\n // Join all fields w/o deep popilation\r\n // Mongoose can do many simple joins with one function call, if separated by spaces.\r\n if (shallowJoins.length > 0) {\r\n model = model.populate(shallowJoins.join(' '))\r\n }\r\n }\r\n // SELECT, gathering specific fields e.g. select=name\r\n if (query.select) model = model.select(query.select.split(',').join(' '))\r\n return model\r\n }", "transformQuery(query) {\n var limitQuery = `select * from (${query}) as t limit 1`;\n return this.db.result(limitQuery, true).then(result => {\n const firstGeomField = result.fields.filter(isGeometryField).shift();\n const selectClause = result.fields.map(field => {\n if(isGeometryField(field)) {\n return `ST_AsGeoJSON(ST_Transform(${field.name}, 4326)) as ${field.name}`\n }\n return field.name;\n }).join(',');\n\n if(!firstGeomField) throw Error('No geometry column found in query');\n return {\n query: `SELECT ${selectClause} FROM (${query}) as t`,\n geomField: firstGeomField\n };\n });\n }", "selectQuery() {\n return `select * from ${this.tablename('select')}`;\n }", "function whereQueryBuilder(results) {\n\n var entityString = \" WHERE \";\n if (results[0] != \"\") {\n entityString = entityString + \"papername LIKE '\" + results[0] + \"'\";\n if (results[1] != \"\" || results[2] != \"\" || results[3] != \"\") {\n entityString = entityString + \" AND \";\n }\n }\n if (results[1] != \"\") {\n entityString = entityString + \"code LIKE '\" + results[1] + \"'\";\n if (results[2] != \"\" || results[3] != \"\") {\n entityString = entityString + \" AND \";\n }\n }\n if (results[2] != \"\") {\n entityString = entityString + \"major LIKE '\" + results[2] + \"'\";\n if (results[3] != \"\") {\n entityString = entityString + \" AND \";\n }\n }\n if (results[3] != \"\") {\n entityString = entityString + \"level LIKE '\" + results[3] + \"'\";\n }\n\n return entityString;\n}", "async selectingStatement(query){\n return HTTP.get(this.getConfig('database', '') + this._buildSelectUrl(query));\n }", "constructor() {\n\t\t/**\n\t\t * This object holds all query parts: tableName, select, where, order_by, and group_by\n\t\t */\n\t\tthis._query = {};\n\t\tthis.opType = 'select';\n\t}", "function repoFindJson(req, res, template, block, next) {\n\n var Repo = calipso.db.model('Repo');\n var query = req.moduleParams.query || \"*\";\n var type = req.moduleParams.type || \"module\";\n\n // Deal with wildcards\n var qryRegex = new RegExp(query,\"ig\");\n\n Repo.find({type:type, $or: [{name: qryRegex}, {description: qryRegex}] })\n .sort('name')\n .limit(10)\n .find(function(err,all) {\n var op = all.map(function(a) {\n return {name:a.name,\n description:a.description,\n author:a.author,\n versions:a.versions.map(function(b){\n return {version:b.version,url:b.url}\n })\n\n };\n });\n res.end(JSON.stringify(op),'UTF-8');\n });\n\n}", "function buildQuery(u,s){\n // TODO: add cooky user\n return {\"query\": {\n\t\"bool\": {\n\t \"must\": [\n\t\t{\"match\": {\n\t\t \"user_id\": u\n\t\t}},\n\t {\"exists\":{\"field\":\"resource\"}}\n\t\t]\n\t}\n },\n \"size\": s,\n \"sort\": [{\"date\": \"desc\"}]\n\t } \n}", "async query(constraints) {\n\n let queryConstraints = { ...constraints }\n \n queryConstraints.address = { ...constraints.address }\n \n // Convert _id to an ObjectID if it looks like a string ObjectID (24 hex digits).\n\n if (queryConstraints._id && typeof queryConstraints._id == 'string' && queryConstraints._id.match(/^(\\d|[a-f]){24}$/)) {\n\n queryConstraints._id = new ObjectID(queryConstraints._id)\n }\n\n let client = await MongoClient.connect(this.mongoDb)\n let results = await client.db(this.database).collection(this.collection).find(constraints).toArray()\n\n await client.close()\n\n return results\n }", "soql(soql){\n this.log(soql);\n var ret = this.callCommandJson('sfdx force:data:soql:query -q \"' + soql +'\" -r json');\n if(ret != undefined || ret.result.totalSize > 0){\n return ret.result.records;\n }\n return null;\n }", "getAll(collection,query){\n return this.connect().then(db=>{\n //llamamoos al metodo de mongo de busqueda por medio de una query \n return db.collection(collection).find(query).toArray();\n });\n }", "getAllFriendly(request, response, next) {\n this.model.findSorted({}, (err, data) => {\n // this.model.find({}, (err, data) => { // vanilla find\n // this.model.find2({}, { firstName: 1, lastName: 1, _id: 0 }, (err, data) => { // set projection here\n if (err) {\n return next(err);\n }\n else if (data.length) {\n response.render('costumers', { costumers: data });\n }\n else {\n response.send('No documents found');\n }\n });\n }", "retrieve_specifics_by_wildcard_and(select_list, wildcard_json, table_name, callback) {\r\n\t\t\r\n\t\tvar query_str = \"SELECT \" + select_list.join(\", \" ) + \" from \" + table_name + \" where \";\r\n\t\t\r\n\t\tvar count = 0;\r\n\t\t\r\n\t\t// iterate through the query json , appending each specifier \r\n\t\tfor (var key in wildcard_json) { \r\n\t\t\tvar value = wildcard_json[key];\r\n\t\t\tvar form_key = key;\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tvar temp = form_key + \" like '%\" + value + \"%'\";\r\n\t\t\t\r\n\t\t\tquery_str += temp;\r\n\t\t\tcount +=1;\r\n\t\t\t// Check if the item is last in json object,\r\n\t\t\t// If so, terminate the query and execute\r\n\t\t\tif(count == Object.keys(wildcard_json).length){\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tquery_str += \" AND \" ;\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\tthis.db_connection.query(\r\n\t\t\tquery_str, \r\n\t\t\tfunction(err, results, fields)\r\n\t\t\t{\r\n\t\t\t\tcallback(err, results);\t\r\n\t\t\t}\t\t\r\n\t\t);\r\n\t}", "static database_query(json, fcn) {\n if (window.Settings.enableLog)\n WebUtils.log(\"Web.database_query({0})\".format(json));\n Database.query(json, fcn);\n }", "filter() {\n //1. Filtering\n const queryObj = { ...this.queryString };\n // console.log(queryObj);\n const excludedFields = ['page', 'sort', 'limit', 'fields'];\n excludedFields.forEach(el => delete queryObj[el]);\n // console.log(queryObj);//{ duration: { gte: '5' } }\n\n //2. Advanced Filtering\n let queryStr = JSON.stringify(queryObj);\n queryStr = queryStr.replace(/\\b(lte|lt|gte|gt)\\b/g, match => `$${match}`);\n // console.log(queryStr); // => {\"duration\":{\"$gte\":\"5\"}}\n // console.log(JSON.parse(queryStr));//{ duration: { '$gte': '5' } }\n this.query = this.query.find(JSON.parse(queryStr));\n //The below query was changed to above line ▲\n // let query = Tour.find(JSON.parse(queryStr));\n return this;\n }", "async function get(query = {}) {\n const { limit = 10, sortby = \"id\", sortdir = \"asc\" } = query;\n const {\n location = \"\",\n urgency_level = 0,\n funding_goal = 0,\n deadline = \"\",\n title = \"\",\n description = \"\",\n specie_id = 0\n } = query;\n\n let rows = await db(\"campaigns\")\n .orderBy(sortby, sortdir)\n .limit(limit)\n .modify(function(queryBuilder) {\n if (location) {\n queryBuilder.where({ location });\n }\n if (urgency_level) {\n queryBuilder.where({ urgency_level });\n }\n if (funding_goal) {\n queryBuilder.where({ funding_goal });\n }\n if (deadline) {\n queryBuilder.where({ deadline });\n }\n if (title) {\n queryBuilder.where(\"title\", \"like\", \"%\" + title + \"%\");\n }\n if (description) {\n queryBuilder.where(\"description\", \"like\", \"%\" + description + \"%\");\n }\n if (specie_id) {\n queryBuilder.where({ specie_id });\n }\n });\n console.log(query);\n\n return rows;\n}", "function filter(data) {\n let query = {};\n\n for (let key in data) {\n if (data[key] !== undefined) {\n query[key] = data[key];\n }\n }\n\n // If our query object is empty - send params to db, which will not return products (because empty object in mongoose query will return ALL products)\n if (isEmpty(query)) {\n query._id = undefined;\n }\n\n return query;\n }", "function buildQuery(qrydata) {\n var qry,\n union = false,\n length,\n ndx = 1;\n if (qrydata.length > 1) {\n union = true;\n length = qrydata.length;\n };\n _.forEach(qrydata, function (arg) {\n if (ndx === 1) {\n qry = 'select ' + arg.fields +\n ' from ' + arg.from_objects +\n _.join(arg.join_condition, ' ') +\n (arg.where_clause ? ' where ' + arg.where_clause : '') +\n (arg.group_by ? ' group by ' + arg.group_by : '') +\n (arg.order_by ? ' order by ' + arg.order_by : '');\n } else {\n qry += 'select ' + arg.fields +\n ' from ' + arg.from_objects +\n _.join(arg.join_condition, ' ') +\n (arg.where_clause ? ' where ' + arg.where_clause : '') +\n (arg.group_by ? ' group by ' + arg.group_by : '') +\n (arg.order_by ? ' order by ' + arg.order_by : '');\n }\n if (union && ndx != length) {\n qry += ' union all ';\n };\n ndx++;\n })\n return qry;\n}", "function buildSQLString (parsedQueryObject, cb) {\n\n try {\n\n let toSelect = _.uniq(_.concat(parsedQueryObject.categoryNames, \n parsedQueryObject.fields, \n alwaysSelected).filter(k => k))\n\n // If a category is no specified\n let wherePredicates = _.defaults(parsedQueryObject.categoryPredicates, defaultCategoryPredicates)\n\n\n // If no geography codes are provided, we default to returning the data for all the states.\n if (!wherePredicates.geography) {\n return cb(new Error('One or more geography codes must be specified.'))\n }\n\n parsedQueryObject.sqlStatement = \n 'SELECT ' + toSelect.join(', ') + '\\n' +\n 'FROM ' + parsedQueryObject.tableName + '\\n' + \n 'WHERE ' + \n _.map(wherePredicates, (reqCategoryValues, categoryName) => {\n\n // The client specified requested values for the category.\n if (reqCategoryValues && reqCategoryValues.length) {\n // For geographies, we do a prefix match\n // This allows us to get all the metro-level data for a state, for example.\n if (categoryName === 'geography') {\n // For prefix matching, we remove the zero padding if it exists.\n // Because some state fips codes start with zero, we must take care \n // not to remove the leading zeroes of the padded fips code... thus the `{2,5}`.\n let codes = reqCategoryValues.map(code => code.replace(/^0{2,5}/, ''))\n return '(' + codes.map(code => `(geography = '${code}')`).join(' OR ') + ')'\n }\n\n if (categoryName === 'industry') {\n let codes = reqCategoryValues.map(code => code.replace(/^0{3}/, ''))\n return '(' + codes.map(code => `(industry = '${code}')`).join(' OR ') + ')'\n }\n\n // Years and quarters are numeric data types in the table.\n if (categoryName === 'quarter') {\n let quarters = reqCategoryValues.map(i => parseInt(i))\n\n return '(' + quarters.map(qtr => `(quarter = ${qtr})`).join(' OR ') + ')'\n }\n\n // Years and quarters are numeric data types in the table.\n if (categoryName === 'year') {\n\n let years = reqCategoryValues.map(year => parseInt(year)).sort()\n\n if (years.length === 2) {\n return `(year BETWEEN ${years[0]} AND ${years[1]})`\n }\n\n return '(' + years.map(val => `(year = ${val})`).join(' OR ') + ')'\n }\n\n // Not a special case\n return '(' + reqCategoryValues.map(val => `(${categoryName} = '${val.toUpperCase()}')`).join(' OR ') + ')'\n\n } else {\n // No requested values for the category that were requested.\n // In this case, if the category has a default value that represents\n // the sum across all members of the category, we exclude that value from the result.\n return (_.includes(alwaysSelected, categoryName)) ? '' :\n '(' + `${categoryName} <> '${categoryVariableDefaults[categoryName]}'` + ')'\n }\n\n\n }).filter(s=>s).join(' AND \\n') + \n ';'\n\n return cb(null, parsedQueryObject)\n } catch (err) {\n return cb(err)\n }\n}", "function searchFrames(query,projection, options, cb){\n var q = q2coll(query, '@ID @name lexUnit.@ID lexUnit.@name - priority');\n //console.log('QUERY', q)\n\n Models.hebFrameModel.aggregate(\n {$match: q},//{frameid: Number('281') }},\n {$project: {\"_id\":0,'@name': \"$@name\", '@ID': '$@ID'}},\n {$sort: {\"@name\": 1}},\n cb)\n}", "function selectQ(conditions){\n\t\t//Table to perform the query on\n\t\tvar table = req.body.qtable;\n\t\tvar operators = req.body.operators;\n\t\tvar s = squel.select();\n\t\ts.from(table);\n\t\t//s.field(...)\n\t\t//This for loop will give away the desired structurefor conditions.\n\t\tvar whereStream = \"\"\n\t\tvar i = 0;\n\t\tfor(var cond in conditions){\n\t\t\t//Supply conditions in one list. Make sure the conditions are safe, legal statements on client-side.\n\t\t\t//If more than one condition then second list \"operators\" will not be empty.\n\t\t\t//This list will specify AND or OR between conditions.\n\t\t\tif(conditions.length>1 && i > 0){\n\t\t\t\twhereStream += \" \" + operators + \" \";\n\t\t\t}\n\t\t\twhereStream += conditions[cond];\n\t\t\ti+=1;\n\t\t}\n\t\ts.where(whereStream);\n\t\treturn s.toString();\n\t}", "function buildGetPetitionsQuery(queries){\n let q = \"SELECT petition_id as petitionId, title, Category.name as category, User.name as authorName, \" +\n \"(SELECT count(*) FROM Signature WHERE Signature.petition_id=Petition.petition_id) as signatureCount \" +\n \"FROM Petition \" +\n \"INNER JOIN Category ON Category.category_id=Petition.category_id \" +\n \"INNER JOIN User ON author_id=user_id \";\n let constraints = [];\n\n //Check if the 'q' query exists, if so add the relevant constraint\n if(queries[\"q\"]) {\n constraints.push(`title LIKE \"%${queries[\"q\"]}%\"`);\n }\n\n //Check if the 'categoryId' query exists, if so add the relevant constraint\n if(queries[\"categoryId\"]) {\n constraints.push(`Petition.category_id = ${queries[\"categoryId\"]}`);\n }\n\n //Check if the 'authorId' query exists, if so add the relevant constraint\n if(queries[\"authorId\"]) {\n constraints.push(`Petition.author_id = ${queries[\"authorId\"]}`);\n }\n\n //If there is a query, add it to the SQL query\n if(constraints.length > 0) {\n q += 'WHERE';\n for(let constraint of constraints) {\n q += ` ${constraint} AND`\n }\n //We need to remove the trailing 'AND', slice it from the string\n q = q.slice(0, -3);\n }\n\n //Check if the 'sortBy' query exists, if so add the requested ordering\n if(queries[\"sortBy\"]) {\n switch(queries[\"sortBy\"]) {\n case \"ALPHABETICAL_ASC\":\n q += \"ORDER BY title ASC, petitionId ASC\";\n break;\n case \"ALPHABETICAL_DESC\":\n q += \"ORDER BY title DESC,Completed /petitions endpoint petitionId ASC\";\n break;\n case \"SIGNATURES_ASC\":\n q += \"ORDER BY signatureCount ASC, petitionId ASC\";\n break;\n case \"SIGNATURES_DESC\":\n q += \"ORDER BY signatureCount DESC, petitionId ASC\";\n break;\n default:\n //Use the Node.js implementation to specify an error code\n throw new ApiError('sortBy query unavailable', 400);\n }\n } else {\n //Default sorting mode\n q += \"ORDER BY signatureCount DESC, petitionId ASC\";\n }\n\n return q;\n}", "makeSelQuery(onlyArray) {\n return this.query.only(onlyArray);\n }", "toJSON() {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _a = this, { query } = _a, rest = __rest(_a, [\"query\"]);\n return rest;\n }", "getById(db, id) {\n return db.raw(`select r.id, r.name, r.description, r.instructions, r.owner_id,\n (select json_agg(recing)\n from (\n select ingredient_id as id, i.name, quantity, u.name as unit, u.id as unit_id, special_instructions, recipe_id from recipes_ingredients \n join ingredients i on ingredient_id = i.id\n join units u on unit_id = u.id\n where recipe_id = r.id\n ) recing\n ) as ingredients\n from recipes r\n where r.id = ${id}`);\n }", "function getFindFields(coll,query) {\n var filter = {};\n switch (coll) {\n case 'force':\n if (query.hasOwnProperty('fields')) {\n filter.fields = query.fields.split(',')\n .reduce(function(acc, item) {\n acc[item] = 1;\n return acc;\n },{})\n }\n break;\n }\n winston.info('mongo collection find fields: ',util.inspect(filter));\n return filter;\n}", "function collect_query_info() {\n let query = {};\n\n let all_fields = get_all_fields_input();\n if (all_fields !== null && all_fields !== '') {\n query['all_fields'] = all_fields;\n }\n\n let name = get_name_input();\n if (name !== null && name !== '') {\n query['all_display_names'] = name;\n }\n\n let type = get_type_select()\n if (type !== EMPTY_TYPE) {\n query['party_sub_type'] = type;\n }\n\n let program = get_program_select()\n if (program != '') {\n query['programs'] = program;\n }\n\n $.each(get_search_row_ids(), (index, row_id) => {\n let [select, input] = get_row(row_id);\n if (select != EMPTY_SELECT && input !== null && input !== \"\") {\n query[select] = input;\n }\n });\n console.log(query);\n return query;\n}", "retrieve_by_wildcard_and(wildcard_json, table_name, callback) {\r\n\t\tvar query_str = \"SELECT * from \" + table_name + \" where \";\r\n\t\t\r\n\t\tvar count = 0;\r\n\t\t// iterate through the query json , appending each specifier \r\n\t\tfor (var key in wildcard_json) { \r\n\t\t\tvar value = wildcard_json[key];\r\n\t\t\tvar form_key = key;\r\n\t\t\t\r\n\t\t\tvar temp = form_key + \" like '%\" + value + \"%'\";\r\n\t\t\t\r\n\t\t\tquery_str += temp;\r\n\t\t\tcount +=1;\r\n\t\t\t// Check if the item is last in json object,\r\n\t\t\t// If so, terminate the query and execute\r\n\t\t\tif(count == Object.keys(wildcard_json).length){\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tquery_str += \" AND \" ;\r\n\t\t}\r\n\t\t\r\n\t\tthis.db_connection.query(\r\n\t\t\tquery_str, \r\n\t\t\tfunction(err, results, fields)\r\n\t\t\t{\r\n\t\t\t\tcallback(err, results);\r\n\t\t\t}\t\t\r\n\t\t);\r\n\t}", "async function getProducts(){\n var result=await Product.\n find()\n .limit(2) // Number of records required\n .sort({name:1}) // sort in ascending order w.r.t name\n .select({author:\"Hamad\"}); // properties required by items\n\n console.log(\" \\n\\nGet all records, then sort ascendingly on name, pick top 2 elements, and display whose author is hamad\\n\\n \"+result);\n\n result=await Product.\n find({price:{$lt:70,$gt:30}}); // price less than 70 and greator than 30\n console.log(\" \\n\\nprice less than 70 and greator than 30 \\n\\n\"+result);\n\n result=await Product.\n find({price:{$ne:30}}); // whose price is not equal to 30\n console.log(\" \\n\\nwhose price is not equal to 30 \\n\\n\"+result);\n\n result=await Product.\n find({price:{$in:[40,30]}}); // whose price is 40 or 30\n console.log(\"\\n\\n whose price is 40 or 30 \\n\\n\"+result);\n\n result=await Product.\n find({price:{$nin:[40,30]},name:\"rice\"}); // price is neither 40 nor 30 and name is rice \n console.log(\"\\n\\n price is neither 40 nor 30 and name is rice \\n\\n \"+result);\n\n}", "function customQuery(db, fun, opts) {\n\t return new PouchPromise(function (resolve, reject) {\n\t db._query(fun, opts, function (err, res$$1) {\n\t if (err) {\n\t return reject(err);\n\t }\n\t resolve(res$$1);\n\t });\n\t });\n\t }", "async getSelectQuery (request, reply) {\n // set basic query properties\n const ownerId = globalHelpers.getOwnerIdOrDieTrying(request, reply)\n const table = this.db\n const select = this.getSelectParams()\n\n // set pagination properties\n const pag = request.query\n const limit = pag.limit\n const offset = (pag.page * pag.limit) - pag.limit\n const totalCount = await queries.countRows({ ownerId, table })\n request.totalCount = totalCount\n\n const params = { ownerId, table, select, limit, offset }\n return queries.selectMany(params)\n }", "_formatQuery(document) {\n let q = document.query;\n if (document.exclude && document.exclude.length > 0) {\n document.exclude.forEach(item => {\n // eslint-disable-next-line quotes\n q += ' -\"' + item + '\"';\n });\n }\n q += ' AND -filter:retweets';\n return q;\n }", "function getDocumentsFromDB(queryOptions, model, res) {\n model.find(queryOptions.where)\n .limit(queryOptions.limit)\n .sort(queryOptions.sort)\n .select(queryOptions.select)\n .skip(queryOptions.skip)\n .exec(function(err, docs) {\n if (err) {\n return res.status(500).json({ message: 'Error: Unable to retrieve results from database.', \n data: [] }); \n }\n else {\n var dataObj = docs;\n var msg = 'Returning a list of documents.'\n if (queryOptions.count) {\n dataObj = docs.length;\n msg = 'Returning a count of documents'\n }\n return res.status(200).json({ message: msg,\n data: dataObj,\n opts: queryOptions }); //TODO\n }\n });\n}", "function search(req, res, callback) {\r\n /*res.setHeader('Access-Control-Allow-Origin', 'http://localhost:4200');\r\n res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');\r\n res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');\r\n res.setHeader('Access-Control-Allow-Credentials', true);*/\r\n\r\n var query = Doctor.find({\r\n statusflag: 'A' \r\n //orguid: req.session.orguid\r\n })\r\n\r\n console.log('name : ' + req.body.name);\r\n console.log('location : ' + req.body.location);\r\n console.log('specialty : ' + req.body.specialtyuid);\r\n\r\n /*if (req.body.code != null && req.body.code.length > 0)\r\n query.where('code').equals(!!req.body.isstrictcode ? req.body.code : { '$regex': getBetweenRegx(req.body.code) });\r\n */\r\n if (req.body.location != null && req.body.location.length > 0) {\r\n query.where({\r\n orguid: {\r\n $in: req.body.location\r\n }\r\n });\r\n }\r\n\r\n if (req.body.specialtyuid != null && req.body.specialtyuid.length > 0) {\r\n query.where({\r\n specialtyuid: {\r\n $in: req.body.specialtyuid\r\n }\r\n });\r\n }\r\n \r\n if (req.body.name != null && req.body.name.length > 0) {\r\n query.where({\r\n $or: [{\r\n name: {\r\n '$regex': getBetweenRegx(req.body.name)\r\n }\r\n }, {\r\n lastname: {\r\n '$regex': getBetweenRegx(req.body.name)\r\n }\r\n },\r\n {\r\n licensenumber: {\r\n '$regex': getBetweenRegx(req.body.name)\r\n }\r\n }\r\n ]\r\n });\r\n }\r\n\r\n /*if (req.body.location != null && req.body.location.length > 0) {\r\n query.where({\r\n location: {\r\n '$regex': getBetweenRegx(req.body.location)\r\n }\r\n });\r\n } */\r\n \r\n \r\n query.select('printname genderuid titleuid primarydept location qualification specialtyuid _id externalid orguid');\r\n query.populate('genderuid', 'valuedescription');\r\n query.populate('titleuid', 'valuedescription');\r\n query.populate('specialtyuid', 'valuedescription');\r\n\r\n query.exec(function(err, docs) { \r\n if (!err) {\r\n console.log(docs);\r\n\r\n if (!!callback) {\r\n setTimeout(function() { callback(null, docs); });\r\n return;\r\n } else {\r\n res.status(200).json({\r\n doctors: docs\r\n });\r\n }\r\n } else {\r\n //winston.error(err, {\r\n // timestamp: Date.now(),\r\n // pid: process.pid,\r\n // url: req.url\r\n //});\r\n if (!!callback) {\r\n setTimeout(function() { callback('ERRORS.RECORDNOTFOUND'); });\r\n return;\r\n } else {\r\n res.status(500).json({\r\n error: 'ERRORS.RECORDNOTFOUND'\r\n });\r\n }\r\n }\r\n });\r\n}", "function queryToJS(value) {\n if (value && typeof value === \"object\") {\n //query is a query object\n\n if (value instanceof Array) {\n //call recursively on all elements of the array\n return '[' + that.each(value, function (value, emit) {\n emit(queryToJS(value));\n }) + ']';\n } else {\n var jsOperator = that.jsOperatorMap[value.name];\n if (jsOperator) {\n //it's a basic boolean operator (equals / greater / less / etc)\n //build a path to the javascript property we want to test, testing for each part as we go\n // item['foo.bar'] ==> (item && item.foo && item.foo.bar && ...)\n var path = value.args[0];\n var target = value.args[1];\n var item;\n if (typeof target == \"undefined\") {\n item = \"item\";\n target = path;\n } else if (path instanceof Array) {\n item = \"item\";\n var escaped = [];\n for (var i = 0; i < path.length; i++) {\n escaped.push(that.stringify(path[i]));\n item += \"&&item[\" + escaped.join(\"][\") + ']';\n }\n } else {\n item = \"item&&item[\" + that.stringify(path) + \"]\";\n }\n\n //make the condition, <path to value> <operator> <target>\n // e.g. item && item[\"foo\"] === \"bar\"\n var condition = item + jsOperator + queryToJS(target);\n\n //apply the condition against items in the array, using a filter to weed out those that fail it. 'this' is the array\n // use native Array.prototype.filter if available\n if (typeof Array.prototype.filter === 'function') {\n return \"(function(){return this.filter(function(item){return \" + condition + \"})})\";\n //???return \"this.filter(function(item){return \" + condition + \"})\";\n } else {\n return \"(function(){var filtered = []; for(var i = 0, length = this.length; i < length; i++){var item = this[i];if(\" + condition + \"){filtered.push(item);}} return filtered;})\";\n }\n } else {\n //date case\n if (value instanceof Date) {\n return value.valueOf();\n }\n //otherwise its a fancy operator function (see RqlArray.operators above)\n //apply the operator using the op function (declared above)\n return \"(function(){return op('\" + value.name + \"').call(this\" +\n (value && value.args && value.args.length > 0 ? (\", \" + that.each(value.args, function (value, emit) {\n emit(queryToJS(value));\n }).join(\",\")) : \"\") +\n \")})\";\n }\n }\n } else {\n //query is not an object. return the value\n return typeof value === \"string\" ? that.stringify(value) : value;\n }\n }", "async find(query) {\n return this.db.oneOrNone(\n 'SELECT * FROM $(table:name) WHERE email = $(query:list)',\n {\n // columns: ['id', 'firstname', 'lastname', 'email', 'password', 'department'],\n table: this.table,\n query,\n },\n )\n .then((obj) => obj)\n .catch((error) => {\n throw error;\n });\n }", "customQuery(record) {\n\t\tfunction generateRangeQuery(dataField) {\n\t\t\tif (record.length > 0) {\n\t\t\t\treturn record.map(singleRecord => ({\n\t\t\t\t\trange: {\n\t\t\t\t\t\t[dataField]: {\n\t\t\t\t\t\t\tgte: singleRecord.start,\n\t\t\t\t\t\t\tlte: singleRecord.end,\n\t\t\t\t\t\t\tboost: 2.0\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\treturn null;\n\t\t}\n\n\t\tif (record) {\n\t\t\tconst query = {\n\t\t\t\tbool: {\n\t\t\t\t\tshould: generateRangeQuery(this.props.dataField),\n\t\t\t\t\tminimum_should_match: 1,\n\t\t\t\t\tboost: 1.0\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn query;\n\t\t}\n\t\treturn null;\n\t}", "function build_query(table){\n\tvar where = {};\n\tif (table == 'projects') {\n\t\t// create needed empty object(s) and array(s)\n\t\tif (Object.keys(this.all_groups).length){\n\t\t\twhere['groups'] = {\n\t\t\t\t'id' : {\n\t\t\t\t\t'$in' : []\n\t\t\t\t}\n\t\t\t};\n\t\t\t// add groups to where-object\n\t\t\t$.each(this.all_groups, function(key, val){\n\t\t\t\twhere['groups']['id']['$in'].push(key);\n\t\t\t});\n\t\t}\n\t}\n\tif (table == 'samples') {\n\t\tif (this.projects.length){\n\t\t\t// create needed empty object(s) and array(s)\n\t\t\twhere['project'] = {\n\t\t\t\t'id' : {\n\t\t\t\t\t'$in' : []\n\t\t\t\t}\n\t\t\t};\n\t\t\t$.each(this.projects, function(key, val){\n\t\t\t\twhere['project']['id']['$in'].push(val);\n\t\t\t});\n\t\t}\n\t}\n\tif (table == 'variants' || table == 'only_variants') {\n\t\tif (this.samples.length){\n\t\t\t// create needed empty object(s) and array(s)\n\t\t\twhere['sa'] = {\n\t\t\t\t'id' : {\n\t\t\t\t\t'$in' : []\n\t\t\t\t}\n\t\t\t};\n\t\t\t// add selected samples to where-array\n\t\t\t$.each(this.samples, function(key, val){\n\t\t\t\twhere['sa']['id']['$in'].push(val);\n\t\t\t});\n\t\t}\n\t\t// add required samples to where-array\n\t\tif (this.require.length){\n\t\t\twhere['sa.id'] = {\n\t\t\t\t'$all' : []\n\t\t\t};\n\t\t\t$.each(this.require, function(key, val){\n\t\t\t\t\t\twhere['sa.id']['$all'].push(val);\n\t\t\t});\n\t\t}\n\t\tif (this.exclude.length){\n\t\t\tif (where.hasOwnProperty(\"sa.id\")){\n\t\t\t\twhere['sa.id']['$nin'] = [];\n\t\t\t} else {\n\t\t\t\twhere['sa.id'] = {\n\t\t\t\t\t'$nin' : []\n\t\t\t\t};\n\t\t\t}\n\t\t\t// add excluded samples to where-array\n\t\t\t$.each(this.exclude, function(key, val){\n\t\t\t\t\t\twhere['sa.id']['$nin'].push(val);\n\t\t\t});\n\t\t}\n\t}\n\n\t// put where-array in query\n\treturn (where);\n}", "function formatClassQueryString(json) {\n let queryString = \"select * from courses join departments using(departmentid) join course_instructor using(courseID) join instructors using(instructorID) join course_schedule using(courseID) join schedules using(scheduleID) where \";\n //loop for length of subjects appending query strings to end of query\n\n for(var i=0; i<json.subjects.length; i++) {\n \n \n if(json.attributes.length < 1) \n queryString += \"departmentID = \" + json.subjects[i];\n \n\n //Creates query string for combining attributes with a subjects\n for(var j = 0; j < json.attributes.length; j++) {\n queryString += \"departmentID = \" + json.subjects[i] + \" and\";\n\n queryString += ' courses.title like \"' + json.attributes[j] + ' %\"';\n\n if(j < json.attributes.length -1)\n queryString += \" or \";\n }\n\n if(i < json.subjects.length -1)\n queryString += \" or \";\n } \n\n console.log(queryString);\n return queryString;\n}", "async function example11() {\n try {\n const result = await studentsCollection.aggregate([\n {$unwind: '$scores'},\n {$match: {$or: [{'scores.type': 'quiz'}, {'scores.type': 'homework'}]}},\n {\n $group: {\n _id: {_id: '$name'},\n name: {$first: '$name'},\n quiz: {$first: '$scores.score'},\n hw: {$last: '$scores.score'}\n }\n },\n {\n $sort: {\n quiz: 1,\n hw: -1\n }\n }\n ]);\n // await result.forEach(doc => console.log(doc));\n } catch (error) {\n console.log(error);\n }\n}", "async findBy(request, response, next, app) {\n let queryState = { $or: [{ \"key\": 0 }, { \"key\": 2 }] };\n findDocuments(State_1.default, queryState, \"\", {}, '', '', 0, null, null).then((findResult) => {\n response.json({\n message: findResult,\n success: false\n });\n }).catch((err) => {\n response.json({\n message: err.message,\n success: false\n });\n });\n }", "getRecipes(db, userId) {\n return db.raw(`select json_agg(rec)\n from (\n select r.id, r.name, r.description, r.instructions, r.owner_id,\n (select json_agg(recing)\n from (\n select ingredient_id as id, i.name, quantity, u.name as unit, u.id as unit_id, special_instructions, recipe_id from recipes_ingredients \n join ingredients i on ingredient_id = i.id\n join units u on unit_id = u.id\n where recipe_id = r.id\n ) recing\n ) as ingredients\n from recipes as r where r.owner_id = ${userId} or r.owner_id = 1) as rec\n `);\n }", "function query_db_page2sbs(res, user_quer) {\nMongoClient.connect(\"mongodb://master:[email protected]:27017,cluster0-shard-00-01-uavue.mongodb.net:27017,cluster0-shard-00-02-uavue.mongodb.net:27017/test?ssl=true\", function(err, db) {\n if(err) { return console.dir(err); }\n\n var the_sims = db.jsondata.find({'title': sanitize(user_quer).trim().toLowerCase()}, {'similars':1}).toArray();\n var rows = db.jsondata.find({track_id: {$in: the_sims[0].similars}}, {'artist':1, 'title':1});\n\n output_page2sbs(res,user_quer, rows);\n});\n\n}", "function filterParamJsonToSql({ filterParamStr = null } = {}) {\n\tvar filterableTables = ['sample', 'seqgroup', 'seqtype'];\n\tvar queryAliases = ['isSample', 'belongsGroup', 'isType'];\n\tvar doFilter = false;\n\tvar filterSQL = '';\n\tif (filterParamStr) {\n\t\ttry {\n\t\t\tlet filterParam = JSON.parse(filterParamStr);\n\t\t\tfor (let i = 0; i < 3; i++) {\n\t\t\t\tlet tablename = filterableTables[i];\n\t\t\t\tlet queryAlias = queryAliases[i];\n\t\t\t\tif (filterParam[tablename]) {\n\t\t\t\t\tlet IDs = [];\n\t\t\t\t\tfor (let j = 0; j < filterParam[tablename].length; j++) {\n\t\t\t\t\t\tif (Number.isInteger(filterParam[tablename][j])) {\n\t\t\t\t\t\t\tIDs.push(filterParam[tablename][j]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (IDs.length > 0) {\n\t\t\t\t\t\tfilterSQL += ` AND ${queryAlias} IN ( `;\n\t\t\t\t\t\tfor (let j = 0; j < IDs.length; j++) {\n\t\t\t\t\t\t\tif (j === 0) {\n\t\t\t\t\t\t\t\tfilterSQL += `${IDs[j]}`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfilterSQL += `, ${IDs[j]}`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfilterSQL += ` )`;\n\t\t\t\t\t\tdoFilter = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t/* Filter Param not valid JSON.*/\n\t\t\tthrow error;\n\t\t}\n\t}\n\tif (doFilter) {\n\t\treturn filterSQL;\n\t} else {\n\t\treturn null;\n\t}\n}", "async function queryThree() {\n const courses = await Course.find({ isPublished: true }).or([\n { price: { $gte: 15 } },\n { name: /.*by.*/i },\n ]);\n console.log(courses);\n}", "\"filter:database\"(queryPayload) {\n return queryDatabase(queryPayload, (data, attrs) => _.filter(data.results, attrs));\n }", "function testQueryBuilder() {\n // user input should have the following:\n // -> userID\n // -> Semester selected\n // -> Course Subject\n // -> Course Code\n // const userInput = req.body;\n // Example or Test statement from postman --> in the body ->> x-www-form-urlencoded was selected\n // let testTitle = userInput.COEN;\n\n // setting the mongoose debugging to true\n const mongoose = require(\"mongoose\");\n mongoose.set('debug', true);\n\n dbHelpers.defaultConnectionToDB();\n\n // both findOne() and find() works\n // const query = scheduleModel.find();\n const query = scheduleModel.findOne();\n query.setOptions({lean: true});\n query.collection(scheduleModel.collection);\n // example to do the query in one line\n // query.where('object.courseSubject').equals(userInput.courseSubject).exec(function (err, scheduleModel) {\n // building a query with multiple where statements\n query.where('object.courseSubject').equals(userInput.courseSubject);\n query.where('object.courseCatalog').equals(userInput.courseCatalog);\n query.exec(function (err, scheduleModel) {\n try {\n res.status(200).json({\n userInput,\n scheduleModel,\n message: \"addCourseToSequence executed\"\n })\n // }\n } catch (err) {\n console.log(\"Error finding the course provided by the user\");\n res.status(200).json({\n message: \"Internal Server Error: Course not found\"\n })\n }\n });\n}", "function consultarInscripcionByEvento(idEvento, res) {\n\n var queryMongo = InscripcionEvento.aggregate(\n [\n {\n $match: {\n id_evento: idEvento,\n }\n },\n {\n $lookup: {\n from: 'funcionarios',\n localField: 'id_documento',\n foreignField: 'id_documento',\n as: 'funcionario'\n }\n },\n {\n $unwind: {\n path: \"$funcionario\",\n }\n },\n {\n $lookup: {\n from: 'eventos',\n localField: 'id_evento',\n foreignField: '_id',\n as: 'evento'\n }\n },\n {\n $unwind: {\n path: \"$evento\",\n }\n },\n {\n $project: {\n titulo: '$id_documento',\n nombre: '$funcionario.primer_nombre',\n apellido: \"$funcionario.primer_apellido\",\n correo: \"$correo\",\n id_evento: \"$id_evento\",\n titulo_evento: \"$evento.titulo\"\n }\n },\n ])\n queryMongo.exec((error, inscripciones) => {\n if (error) {\n console.log(error);\n } else {\n res.json(inscripciones)\n }\n });\n}", "searchUserName() {\n return \"select u.userName from users u where u.userName = ?;\";\n }", "getAllUser(req, res) {\n User.find({})\n .populate({\n path: \"thoughts\",\n select: \"-__v\",\n })\n .select(\"-__v\")\n .then((dbData) => res.json(dbData))\n .catch((err) => {\n console.log(err);\n res.status(400).json(err);\n });\n }", "function getFilter(query) {\n var qsp = {};\n if (query.guestid) {\n Object.assign(qsp, {guestid: query.guestid});\n }\n if(query.facilityid) {\n Object.assign(qsp, {facilityid: query.facilityid});\n }\n if (query.checkindate && query.checkoutdate) {\n var checkin = moment.tz(query.checkindate + ' 12:00', 'Asia/Calcutta');\n var checkout = moment.tz(query.checkoutdate + ' 12:00', 'Asia/Calcutta');\n\n Object.assign(qsp, {$or: [\n {checkindate: {'$lte': checkin}, checkoutdate: {'$gt': checkin}},\n {checkindate: {'$lt': checkout}, checkoutdate: {'$gte': checkout}},\n {checkindate: {'$gt': checkin}, checkoutdate: {'$lt': checkout}}\n ]});\n }\n if (query.roomtype) {\n Object.assign(qsp, {'rooms.type': query.roomtype});\n }\n return qsp;\n}", "function advancedProjectSearch( form, onSuccess, onError ) { // LEO WAS HERE\n var searchText = form.searchText;\n var regExp = new RegExp( '' + searchText );\n var aggregate = [\n { '$match' : { '$or' : [ \n { name : { '$regex' : regExp, '$options' : 'i' } },\n { alias : { '$regex' : regExp, '$options' : 'i' } },\n { description : { '$regex' : regExp, '$options' : 'i' } },\n { code : { '$regex' : regExp, '$options' : 'i' } }\n ] } },\n { $match : { enabled : true } }\n ];\n // { $project : { name : 1, username : 1 } }\n models.Project.aggregate( aggregate, function ( err, projects ) {\n if ( err ) {\n onError( { success: false, code: 500, msg: 'Error getting projects', err : err } );\n } else {\n onSuccess( { success: true, code: 200, msg: 'Advanced search Projects', projects : projects } );\n }\n });\n}", "async function dbQuery(resource) {\n const db = await MongoClient.connect(url);\n const dbo = db.db(\"dev-challenge\");\n const result = await dbo.collection(resource).find().toArray()\n return result;\n}", "function buildQuery(movieEntity, query) {\n // Code for query part\n if (query.id) {\n movieEntity = movieEntity.where('id').equals(query.id);\n }\n if (query.year) {\n if (query.year[0] > query.year[1]) {\n query.year = query.year.reverse();\n }\n movieEntity = movieEntity.where('release_year').gte(query.year[0]).lte(query.year[1]);\n }\n if (query.rating) {\n if (query.rating.method == GT) {\n movieEntity = movieEntity.where('rating').gt(query.rating.value);\n } else if (query.rating.method == LT) {\n movieEntity = movieEntity.where('rating').lt(query.rating.value);\n } else if (query.rating.method == LTE) {\n movieEntity = movieEntity.where('rating').lte(query.rating.value);\n } else if (query.rating.method == GTE) {\n movieEntity = movieEntity.where('rating').gte(query.rating.value);\n } else if (query.rating.method == EQ) {\n movieEntity = movieEntity.where('rating').equals(query.rating.value);\n }\n }\n if (query.genres) {\n movieEntity = movieEntity.where('genres').in(query.genres);\n }\n return movieEntity;\n}", "async function queryOne() {\n const courses = await Course.find({\n isPublished: true,\n tags: 'backend',\n })\n .sort('-name')\n .select('name author isPublished price');\n console.log(courses);\n}", "async function getCourses() {\n\n const courses = await Course\n .find({ isPublished: true, tags: { $in: ['backend','backend'] } }) ///// course that have tags frontend or backend tags\n .limit(10)\n .sort('-price') /// 1 for ascending order,,, name: -1 for descending order\n .select('name author price') /// select properties that you want to return \n\n ///// or\n\n const courses = await Course\n .find({ isPublished: true }) ///// course that have tags frontend or backend tags\n .or([{ tags: 'frontend'},{ tags:'backend' }])\n .limit(10)\n .sort('-price') /// 1 for ascending order,,, name: -1 for descending order\n .select('name author price') /// select properties that you want to return \n\n console.log(\"courses \", courses)\n}", "function query(context, connection, queryString, rowProcessFunc) {\r\n const Request = require('tedious').Request;\r\n let data = [];\r\n let request = new Request(queryString, function(err, rowCount, rows) {\r\n if (err) {\r\n error(err, context);\r\n }\r\n else {\r\n context.res = {\r\n status: 200,\r\n body: data,\r\n headers: { \"Content-Type\": \"application/json\" }\r\n };\r\n context.done();\r\n }\r\n });\r\n\r\n request.on('row', function(columns) {\r\n data.push(rowProcessFunc(columns));\r\n });\r\n connection.execSql(request);\r\n}", "function selectAll() {\n //query all info from burgers_db\n var queryString = \"SELECT * FROM burgers;\"\n connection.query(queryString, function(err, result) {\n if (err) throw err;\n console.log(result);\n res.json(result);\n });\n }", "_buildQueryString(query){\n // create a copy of the object with reformatted data.\n var data = {};\n data._aggregate = query._aggregate === null ? undefined : query._aggregate;\n data._columns = query._columns === null ? undefined : query._columns.join(',');\n data._wheres = query._wheres === null ? undefined : JSON.stringify(query._wheres);\n data._limit = query._limit === null ? undefined : query._limit;\n data._offset = query._offset === null ? undefined : query._offset;\n data._orders = query._orders === null ? undefined : query._orders.map((order) => order.join(',')).join('|');\n data._groups = query._groups === null ? undefined : query._groups;\n data._with = query._with === null ? undefined : query._with.join(',');\n // return as a string.\n return qs.stringify(data);\n }", "toQuery() {\n return this.knexQuery.toQuery();\n }", "getRecords(queryObject) {\n let options = {\n method: 'GET',\n url: this.url + queryObject.table + '.do',\n qs: this.qs\n };\n options.qs.sysparm_query = qs.stringify(queryObject.query, '^');\n\n return new Promise((resolve, reject) => {\n this.request(options, (err, response, body) => {\n if(err) {\n return reject(err);\n }\n\n try {\n if(response.statusCode !== 200) {\n return reject(new Error(`Unexpected response status ${response.statusCode}`));\n }\n\n let jsonRes = body.records;\n resolve(jsonRes);\n } catch(e) {\n return reject(e);\n }\n });\n });\n }", "function convertSql(item) {\n var arr = [];\n \n for (var key in item) {\n var value = item[key];\n if (Object.hasOwnProperty.call(item, key)) {\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n arr.push(key + \"=\" + value);\n }\n }\n return arr.toString();\n}", "function BaseQuery(all) {\n this.select = function(property) {\n return mapProperty(all(), property);\n };\n}", "function whereify(query) {\n\tfunction proc( parms, op ) {\n\t\tfunction fix( key, escape ) {\n\t\t\treturn key.parseOP( /(.*?)(\\$)(.*)/, key => escape(key), (lhs,rhs,op) => {\n\t\t\t\tif (lhs) {\n\t\t\t\t\tvar idx = rhs.split(\",\");\n\t\t\t\t\tidx.forEach( (key,n) => idx[n] = escape( n ? key : op+key) );\n\t\t\t\t\treturn `json_extract(${escapeId(lhs)}, ${idx.join(\",\")} )`;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\treturn escapeId(rhs);\n\t\t\t});\n\t\t}\n\t\t\n\t\tvar\n\t\t\tlhsEscape = escapeId,\n\t\t\trhsEscape = escape;\n\t\t\n\t\tfor ( var key in parms ) {\n\t\t\tvar \n\t\t\t\tlhs = fix( key, lhsEscape ),\n\t\t\t\trhs = fix( parms[key], rhsEscape );\n\n\t\t\tif ( rhs.indexOf(\"%\") >= 0 ) \n\t\t\t\tswitch (op) {\n\t\t\t\t\tcase \"=\":\n\t\t\t\t\t\tex.push( `${lhs} LIKE ${rhs}` );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t\tcase \"!=\":\n\t\t\t\t\t\tex.push( `${lhs} NOT LIKE ${rhs}` );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t\tswitch ( op ) {\n\t\t\t\t\tcase \"!bin=\":\n\t\t\t\t\t\tex.push( `MATCH(${lhs}) AGAINST( '${rhs}' IN BOOLEAN MODE)` );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"!exp=\":\n\t\t\t\t\t\tex.push( `MATCH(${lhs}) AGAINST( '${rhs}' IN QUERY EXPANSION)` );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"!nlp=\":\n\t\t\t\t\t\tex.push( `MATCH(${lhs}) AGAINST( '${rhs}' IN NATURAL LANGUAGE MODE)` );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tex.push( `${lhs} ${op} ${rhs}` );\n\t\t\t\t}\n\t\t}\n\t}\n\t\n\t//Log(\"whereify\",query);\n\tvar ex = [];\n\tfor ( var op in query ) \n\t\tproc( query[op], op );\n\n\t//Log(\">>>where\", ex);\n\treturn ex.join(\",\");\n}", "function makeStandardQuery(table, operation, reqBody) {\n curModel = model[table]\n curFields = curModel.fields\n\n // Get all\n if (operation == \"getAll\") {\n query = `SELECT * FROM ${table}`\n }\n\n // Find an element by certain fields given in request\n else if (operation == \"find\") {\n wherePairs = [] // Elements have format \"username = 'x'\"\n\n for (key in reqBody) {\n if (key in curFields) {\n val = reqBody[key]\n if (quoteTypes.indexOf(curFields[key]) >= 0) {\n curPair = `${key} = '${val}'`\n } else {\n curPair = `${key} = ${val}`\n }\n wherePairs.push(curPair)\n }\n }\n\n whereQuery = wherePairs.join(\" AND \")\n if (whereQuery != \"\") {\n whereQuery = \" WHERE \" + whereQuery\n }\n\n query = `SELECT * FROM ${table}${whereQuery}`\n }\n\n // Create an element\n else if (operation == \"create\") {\n keys = [\"createdAt\",\"updatedAt\"]\n vals = [\"NOW()\",\"NOW()\"]\n for (key in reqBody) {\n if (key in curFields) {\n val = reqBody[key]\n keys.push(key)\n // If it is a string, add quotes around it\n if (quoteTypes.indexOf(curFields[key]) >= 0) val = `'${val}'`\n vals.push(val)\n }\n }\n keysStr = keys.join(\",\")\n valsStr = vals.join(\",\")\n query = `INSERT INTO ${table} (${keysStr}) VALUES (${valsStr})`\n }\n\n // Update an element\n else if (operation == \"update\") {\n\n // Get primary key\n primaryKey = curModel.primaryKey\n primaryVal = reqBody[primaryKey]\n if (quoteTypes.indexOf(curFields[primaryKey]) >= 0) primaryVal = `'${primaryVal}'`\n\n // Get fields to update\n setClauseArr = [\"updatedAt = NOW()\"] // Change \"updatedAt\" field\n for (key in reqBody) {\n if (key in curFields & key != primaryKey) {\n val = reqBody[key]\n if (quoteTypes.indexOf(curFields[key]) >= 0) val = `'${val}'`\n curClause = `${key} = ${val}`\n setClauseArr.push(curClause)\n }\n }\n\n // Make query\n setClauseStr = setClauseArr.join(\", \")\n query = `UPDATE ${table} SET ${setClauseStr} WHERE ${primaryKey} = ${primaryVal}`\n\n }\n\n // Delete an element\n else if (operation == \"delete\") {\n primaryKey = curModel.primaryKey\n primaryVal = reqBody[primaryKey]\n if (quoteTypes.indexOf(curFields[primaryKey]) >= 0) primaryVal = `'${primaryVal}'`\n query = `DELETE FROM ${table} WHERE ${primaryKey} = ${primaryVal}`\n }\n\n return(query)\n}", "searchExistingReview() {\n return `Select r.apiID, r.userName, r.review FROM reviews r\n where r.apiID = ? and r.userName=?;`;\n }", "search() {\n return db.many(`\n SELECT *\n FROM parks p\n WHERE p.borough LIKE '%ook%'\n `);\n }", "async runQuery() {\n try {\n const data = await this.db\n .collection(\"students\")\n .where(\"Skills\", \"array-contains\", \"Python\")\n .where(\"Graduation Year\", \"==\", \"2020\")\n .where(\"Seeking\", \"==\", \"Internship\")\n .where(\"Majors\", \"==\", [\"Computer Science\"])\n .where(\"Minors\", \"==\", [\"Biology\"])\n .where(\"School\", \"==\", \"UNC Chapel Hill\")\n .where(\"First Name\", \"==\", \"Sai\")\n .where(\"Last Name\", \"==\", \"Gongidi\")\n .where(\"Email\", \"==\", \"[email protected]\")\n .where(\"Frameworks.React\", \"==\", true)\n .where(\"Frameworks.Angular\", \"==\", true)\n .where(\"Resume Access\", \"==\", [\"Hack NC\"])\n .get();\n return data.docs.map((doc) => doc.data());\n } catch (err) {\n console.error(err);\n }\n }", "static async getAll(userName) {\n let projection = {\n aliases: 1, contactPersons: 1, name: 1, \"clientAddress.state.name\": 1,\n \"clientAddress.country.name\": 1\n }\n try {\n const db = mongodb.getDB();\n let aggregate = await db.db().collection(Collection.CLIENT_PROJECT_PERMISSION).aggregate(\n [\n { \"$match\": { \"userName\": userName } },\n { \"$unwind\": \"$clients\" },\n { \"$lookup\": { \"from\": \"client\", \"localField\": \"clients\", \"foreignField\": \"_id\", \"as\": \"data\" } }]\n ).toArray();\n //let result = await DatabaseService.getAll(collectionName, projection);\n if (aggregate.length > 0) {\n\n return aggregate[0].data;\n } else {\n return [];\n }\n\n } catch (err) {\n throw err;\n }\n\n }", "function createPopulateQuery(model) {\n\treturn \"//.populate('\" + model + \"')\" + outputFormat;\n}", "function queryConfig(req, res, config) {\n\n\tvar sort = req.query.sort,\n\t\torder = req.query.order,\n\t\tfilter = req.query.filter,\n\t\tselect = req.query.select,\n\t\tskip = req.query.skip,\n\t\tlimit = req.query.limit,\n\t\tpage = req.query.page,\n\t\tperPage = config.perPage || 10,\n\t\tidAttribute = config.idParam ? req.params[config.idParam] : req.params.idAttribute,\n\t\tquery = config.query || {},\n\t\tconditions = query.conditions || {},\n\t\toptions = query.options || {},\n\t\tfields = query.fields || '',\n\t\tparams = req.params,\n\t\tsubDoc = config.subDoc,\n\t\tdata = req.body;\n\n\t//sort order\n\tif (sort && (order === 'desc' || order === 'descending' || order === '-1')) {\n\t\toptions.sort = '-' + sort;\n\t}\n\n\tif (skip) {\n\t\toptions.skip = skip;\n\t}\n\n\tif (limit) {\n\t\toptions.limit = limit;\n\t}\n\n\t//pagination\n\tif (page) {\n\t\toptions.skip = page * perPage;\n\t\toptions.limit = perPage;\n\t}\n\n\t//to find unique record for update, remove and findOne\n\tif (idAttribute) {\n\t\tconditions[config.idAttribute || '_id'] = idAttribute;\n\t}\n\n\twhile (subDoc) {\n\t\tidAttribute = subDoc.idParam ? req.params[subDoc.idParam] : req.params.idAttribute;\n\t\tif (idAttribute) {\n\t\t\tsubDoc.conditions = {};\n\t\t\tsubDoc.conditions[subDoc.idAttribute] = idAttribute;\n\t\t}\n\t\tsubDoc = subDoc.subDoc;\n\t}\n\n\tif (select) {\n\t\tfields = select.replace(/,/g, ' ');\n\t}\n\n\treturn {\n\t\tconditions: conditions,\n\t\tsubDoc: config.subDoc,\n\t\tfields: fields,\n\t\toptions: options,\n\t\tdata: data,\n\t\tcallback: callback(res)\n\t};\n\n}", "function getRecordsByQuery(query,callback){\n\t//console.log(\"###### query\",query)\n\n\torg.query({ query: query,oauth: oauth }, function(err, res) {\n\t\tif(err) {\t\t\t\n\t\t\tcallback(err);\n\t \t}\n\t\telse {\t\t\n\t\t\tcallback(res.records);\n\t\t}\n\t});\n}", "function getFindCriteria(coll,query) {\n var criteria = {};\n switch (coll) {\n case 'force':\n if (query.hasOwnProperty('source')) {\n criteria.source = query.source;\n };\n if (query.hasOwnProperty('ip')) {\n criteria.IP = query.ip;\n };\n break;\n }\n winston.info('find criteria: ',util.inspect(criteria));\n return criteria;\n}", "getAllUsers(req, res) {\n User.find({})\n .select('-__v')\n .then(dbUserData => res.json(dbUserData))\n .catch(err => {\n console.log(err);\n res.sendStatus(400);\n });\n }", "getAllThoughts(req, res) {\n Thought.find({})\n .select(\"-__v\")\n .then(thoughtData => {\n res.json(thoughtData);\n })\n .catch(err => {\n console.log(err);\n res.status(500).json(err);\n });\n }", "getAll(collection, query) { // devuelve toda la coleccion.\n // El connect o coneccion es una promesa.\n return this.connect().then(db => {\n // Usando la base de datos accedemos a la coleccion, le pasamos la coleccion para que sepa cual usamos\n // y buscamos con query en la base de datos o coleccion, por ultimo convertimos a array para trabajarlo\n // con json.\n return db.collection(collection).find(query).toArray();\n });\n }", "function aoj_select(array, filter) {\n var res = [];\n for (var i in array) {\n if (json_filter(array[i], filter))\n res.push(array[i]);\n }\n return res;\n}", "function getOrSnapshotDocsByQuery(method, collection, lambda, whereFieldArray,\n whereValueArray, orderByField=false, orderDirection=false, varArray=false) {\n var ref = db.collection(collection);\n// Filter by fields\n i = 0;\n while (i < whereFieldArray.length) {\n console.log(\"filter by fields: where \" + whereFieldArray[i] + \" == \" + whereValueArray[i]);\n ref = ref.where(whereFieldArray[i], \"==\", whereValueArray[i]);\n // Use prefix increment\n i = ++i;\n }\n // Sort query\n if (orderByField != false) {\n if (orderDirection != false) {\n ref = ref.orderBy(orderByField, orderDirection);\n } else {\n ref = ref.orderBy(orderByField);\n }\n }\n // Get documents based on method get or snapshot\n if (method == \"get\") {\n ref.get()\n .then(lambda);\n } else { // method == \"snapshot\"\n ref.onSnapshot(lambda);\n }\n}", "function runQuery() {\n const WOQL = TerminusDB.WOQL\n\n const query = WOQL.or(\n WOQL.triple('v:Person', 'knows', 'v:OtherPerson'),\n WOQL.triple('v:OtherPerson', 'knows', 'v:Person'),\n )\n\n return client.query(query)\n}", "static transformQuery (query) {\n if (query && query.id) {\n query._id = new mongodb.ObjectId(query.id)\n delete query.id\n }\n // if query is an array of strings, assume it's a set of IDs to search for\n if (query instanceof Array && query.every(v => typeof v === 'string')) query = { '_id': { '$in': query.map(q => new mongodb.ObjectId(q)) } }\n return query\n }", "static sql (sql, values = []) {\n\t\treturn adapter(this).sql({sql, values});\n\t}", "function fetch(request, response, type, err, contents)\n{\n \"use strict\";\n var query = \"SELECT * FROM Book \"+\n \"LEFT JOIN Author ON Author.code = Book.author \"+\n \"WHERE Book.genre = 'poetry' \"+\n \"AND Author.dob >= \"+goldenAgeStart+\" \"+\n \"AND Author.dob <= \"+goldenAgeEnd+\" \"+\n \"ORDER BY surname, yearPublished, title;\";\n\n db.all(query, ready);\n\n function ready(err, data)\n {\n if(err) throw err;\n begin(response, type, err, contents, data);\n }\n}", "function makeQuery(req) {\n const {\n company_id,\n sort, direction,\n international_transportation_mode,\n page, per = 4, } = req.query\n const offset = page ? parseInt(per) * (parseInt(page) - 1) : 0\n const order = [\n sort ? [Shipment, sort, direction] : [Shipment, 'id', 'asc']\n ]\n const productWhere = { company_id }\n const shipmentWhere = international_transportation_mode \n ? { company_id, international_transportation_mode }\n : { company_id }\n return {\n offset,\n order,\n limit: per,\n include: [\n { model: Shipment, where: shipmentWhere },\n { model: Product, where: productWhere },\n ],\n }\n}", "function selectData(err, results, fields, req, res, recordsTotal, recordsFiltered) {\n\tif (err) throw err;\n\n\t// Convert object to array, format datetime\n\tarr = [];\n\tfor(i = 0; i < results.length; i++) {\n\t\tarr.push(Object.values(results[i]));\n\t\tarr[i][1] = arr[i][1].toLocaleString();\n\t}\n\n\tsendback = {\n\t\t\"draw\": req.query.draw,\n\t\t\"recordsTotal\": recordsTotal,\n\t\t\"recordsFiltered\": recordsFiltered,\n\t\t\"data\": JSON.parse(JSON.stringify(arr))\n\t}\n\n\tres.send(sendback);\n}", "function getpatient (param,res){\n req=\"SELECT patientJSON FROM testjson where idPatient=?\"\n var paramarray = [param];\n console.log(\"requete : \"+req+\" \"+paramarray)\n reqsql.requetesql(req,paramarray,res); \n}" ]
[ "0.5997834", "0.5974881", "0.58595425", "0.5710631", "0.570789", "0.56883186", "0.56547165", "0.56492716", "0.5605174", "0.55827487", "0.5573866", "0.5559298", "0.5507013", "0.5469353", "0.543465", "0.5406462", "0.53495574", "0.5342546", "0.5339981", "0.53333884", "0.526077", "0.5241832", "0.52382165", "0.5210981", "0.51972806", "0.51650685", "0.515426", "0.5152699", "0.51504385", "0.51449776", "0.5121818", "0.5119312", "0.5115635", "0.5098206", "0.5096387", "0.50910133", "0.50614816", "0.50500876", "0.5048535", "0.5041985", "0.5040915", "0.5036908", "0.5033404", "0.5032333", "0.5029858", "0.5026962", "0.50260955", "0.5025712", "0.5016426", "0.5012147", "0.5009462", "0.5007719", "0.4990426", "0.49890015", "0.498707", "0.4984327", "0.49633446", "0.49573973", "0.49509698", "0.4949783", "0.49377322", "0.49372777", "0.49282315", "0.49238396", "0.4917827", "0.4916898", "0.49138078", "0.49131206", "0.4907763", "0.49070737", "0.4906718", "0.4904957", "0.49033985", "0.4902664", "0.48969746", "0.48828793", "0.48789573", "0.48698944", "0.48689428", "0.4863926", "0.48627838", "0.48613715", "0.48543662", "0.48520625", "0.48463145", "0.48434678", "0.48428327", "0.4840727", "0.48315334", "0.4827578", "0.4827443", "0.4822081", "0.48210263", "0.48196295", "0.4818879", "0.48183292", "0.48092863", "0.4794596", "0.4791432", "0.4790327" ]
0.58769935
2
Code for toggle functions taken from
function togglePriNon() { if ($('#prioritize').is(':checked')) $('#list-likey').replaceWith($('<ol id="list-likey">' + $('#list-likey').html() + '</ol>')); else $('#list-likey').replaceWith($('<ul id="list-likey">' + $('#list-likey').html() + '</ul>')); $('.up-down').toggleClass('invisible'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onToggle() {}", "toggle(){this.off=!this.off}", "toggle4() {\r\n }", "onToggle() {\r\n this.toggle = !this.toggle;\r\n }", "function toggles(e){\n switch(e){\n case 49: //1\n lightsOn[0] = !lightsOn[0];\n break;\n case 50: //2\n lightsOn[1] = !lightsOn[1];\n break;\n case 51: //3\n lightsOn[2] = !lightsOn[2];\n break;\n case 52: //4\n lightsOn[3] = !lightsOn[3];\n break;\n case 80: //p\n isDisco=!isDisco;\n break;\n case 79: //o\n fanOn=!fanOn;\n break;\n case 72:\n controlsShown ? (document.getElementById(\"overlay\").style.display = \"none\", controlsShown = !1) : (document.getElementById(\"overlay\").style.display = \"block\", controlsShown = !0);\n break;\n case 73: //i\n self.noclip=!self.noclip;\n break;\n case 32: //space\n if(!self.noclip){\n \tif(self.canJump){\n \tself.velocity[1] = 3.5;\n \tself.canJump=false;\n }\n }\n break;\n case 69: //e\n doorOpen=!doorOpen;\n break;\n case 81: //q\n spawnEntity(types[Math.floor(Math.random()*(types.length))]);\n break;\n }\n}", "function switchToggle() {\n\t\t\t\t\t$scope.isToggleOn = !$scope.isToggleOn;\n\t\t\t\t}", "toggleButtonA() {}", "function toggle() {\n setIsToggledOn(prev => !prev)\n }", "toggle_() {\n if (this.isOpen_()) {\n this.close_();\n } else {\n this.open_();\n }\n }", "function simpleSwitcherToggle() {\n \"use strict\";\n $(\"#switcher-head .button\").toggle(function() {\n $(\"#style-switcher\").animate({\n left: 0\n }, 500);\n }, function() {\n $(\"#style-switcher\").animate({\n left: -263\n }, 500);\n });\n }", "function toggle(){\r\n\ttoggleResult();\r\n\t// toggleSearch();\r\n}", "toggle(value = !this.onOff) {\r\n return this.operatePlug({ onOff: value });\r\n }", "function py(e,t){var n=e||[!0,!1],r=K();t===void 0?r=K(n[1]):$t(t)?r=t:r=K(t);var a=function(i){i!==void 0?r.value=i:r.value=r.value===n[1]?n[0]:n[1]};return{state:r,toggle:a}}", "toggle () {\n this.opened = !this.opened;\n }", "toggle () {\n this.opened = !this.opened;\n }", "function toggle() {\n setOpened(!opened);\n expandedCallback(!opened);\n }", "handleToggle() {\n this.toggle.addEventListener(\"click\", (e) => {\n this.doToggle()\n })\n }", "function toggleSpecial(which)\n{\n\n\tswitch(which) {\n case true:\nspecials.addLayer(specialLayer);\nspecialLayer.bringToFront()\n\t$(\"#btSpecial\").addClass(\"on\")\n\n break;\n case false:\nspecials.removeLayer(specialLayer);\n\t$(\"#btSpecial\").removeClass(\"on\")\n break;\n default:\n // default code block\n}\n\n}", "function toggleSpecial(which)\n{\n\n\tswitch(which) {\n case true:\nspecials.addLayer(specialLayer);\nspecialLayer.bringToFront()\n\t$(\"#btSpecial\").addClass(\"on\")\n\n break;\n case false:\nspecials.removeLayer(specialLayer);\n\t$(\"#btSpecial\").removeClass(\"on\")\n break;\n default:\n // default code block\n}\n\n}", "function toggle(x){\n switch(x){\n case \"on\":\n $('newBook').style.display = \"none\";\n $('displayData').style.display = \"none\";\n $('clearForm').style.display = \"inline\";\n $('anotherOne').style.display = \"inline\";\n break;\n\n case \"off\":\n $('newBook').style.display = \"block\";\n $('displayData').style.display = \"inline\";\n $('clearForm').style.display = \"inline\";\n $('anotherOne').style.display = \"none\";\n $('books').style.display = \"none\";\n break;\n default:\n return false;\n };\n }", "function toggleFavoriteButton(){\n // if toggle is true set it to false\n if(toggled){\n toggled = false;\n // if toggle is false set it to true\n }else{\n toggled = true;\n }\n}", "function toggle(on){\n assign(document.getElementById(\"btn-edit\"), on ? \"none\":\"block\");\n assign(document.getElementById(\"btn-submit\"), on ? \"none\":\"block\");\n assign(document.getElementById(\"btn-update\"), on ? \"block\":\"none\");\n assign(document.getElementById(\"btn-cancel\"), on ? \"block\":\"none\");\n assign(document.getElementById(\"btn-delete\"), on ? \"block\":\"none\");\n}", "action() {\n\t\tthis.toggle();\n\t}", "action() {\n\t\tthis.toggle();\n\t}", "action() {\n\t\tthis.toggle();\n\t}", "function toggle(){\n\tif($(\"[data-toggle-btn]\").length){\n\t\t$(\"[data-toggle-btn]\").click(function(){\n\t\t\tvar btn = $(this).data(\"toggle-btn\");\n\t\t\t$(this).toggleClass(\"act\");\n\t\t\t$(\"[data-toggle-e = \"+btn+\"]\").toggle();\n\t\t\t$(\"[data-toggle-group = \"+btn+\"]\").toggle();\n\n\t\t\tif($(\".uc\").length){\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\tuc(\".uc\");\n\t\t\t\t},130);\n\t\t\t}\n\t\t});\n\n\n\t\t$(document).click(function(event){\n\t\t\tvar clk_obj = $(event.target).closest(\"[data-toggle-area]\");\n\n\t\t\t$(\"[data-toggle-area]\").each(function(){\n\t\t\t\tif(clk_obj.get(0)===$(this).get(0)){\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$(this).removeClass(\"act\");\n\t\t\t\t\t$(this).find(\"[data-toggle-e]\").hide();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\t$(\"[data-show-btn]\").click(function(){\n\t\t\tvar btn = $(this).data(\"show-btn\");\n\t\t\tvar e_group = $(\"[data-toggle-e *= \"+btn+\"]\");\n\t\t\t$(\"[data-toggle-group = \"+btn+\"]\").show();\n\t\t\te_group.show();\n\t\t\treturn false;\n\t\t});\n\n\t\t$(\"[data-hide-btn]\").click(function(){\n\t\t\tvar btn = $(this).data(\"hide-btn\");\n\t\t\tvar group = $(this).data(\"toggle-group\");\n\t\t\tvar e_group = $(\"[data-toggle-group = \"+group+\"][data-toggle-e]\");\n\t\t\t$(\"[data-toggle-e = \"+btn+\"]\").hide();\n\t\t\tif(btn===group){\n\t\t\t\te_group.hide();\n\t\t\t}\n\n\t\t\tvar q = false;\n\t\t\te_group.each(function(){\n\t\t\t\tif($(this).css(\"display\")!==\"none\"){\n\t\t\t\t\treturn q=false;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\treturn q=true;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif(q){\n\t\t\t\t$(\"[data-toggle-k = \"+group+\"]\").hide();\n\t\t\t\t$(\"[data-toggle-mes = \"+group+\"]\").show();\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t\t\n\t\t$(\"[data-toggle-keyup]\").keyup(function(event){\n\t\t\tvar btn_val = $(this).data(\"toggle-keyup\");\n\t\t\tif(event.keyCode==13){\n\t\t\t\t$(\"[data-toggle-btn = \"+btn_val+\"]\").click();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t}\t\n}", "toggleList() {}", "function toggleState(item){\n if($(item).attr(\"data-tog\") == \"0\") {\n $(item).attr(\"data-tog\",\"1\");\n } \n else {\n $(item).attr(\"data-tog\", \"0\");\n }\n}", "toggleButton(event, id) {\n if ((id === \"chloro\" && this.state.chloroHidden) ||\n (id === \"bubble\" && this.state.bubbleHidden)) {\n this.setState({\n chloroHidden: !this.state.chloroHidden,\n bubbleHidden: !this.state.bubbleHidden\n })\n }\n }", "function toggle(o) { o.is(':visible') ? o.hide() : o.show(); }", "toggle() {\n this.enabled = !this.enabled;\n }", "function toggle() {\n setState(!state);\n }", "toggleState() {\n\n // Update the state to the opposite of what it is currently\n this.state = !this.state;\n }", "function toggle(value){\n return !value;\n }", "function toggle(x) {\n\t\tswitch(x) {\n\t\t\tcase \"on\":\n\t\t\t\t$('#workoutForm').css(\"display\", \"none\");\n\t\t\t\t$('#showData').css(\"display\", \"none\");\n\t\t\t\t// $('#clearData').css(\"display\", \"none\");\n\t\t\t\t// $('#startNew').css(\"display\", \"inline\");\n\t\t\t\t// $('#saveData').css(\"display\", \"none\");\n\t\t\t\t// $('#addBack').css(\"display\", \"none\");\n\t\t\t\t// $('#foot').css(\"display\", \"none\");\n\t\t\t\tbreak;\n\t\t\tcase \"off\":\n\t\t\t\t$('#workoutForm').css(\"display\", \"block\");\n\t\t\t\t// $('#showData').css(\"display\", \"inline\");\n\t\t\t\t// $('#clearData').css(\"display\", \"inline\");\n\t\t\t\t// $('#startNew').css(\"display\", \"none\");\n\t\t\t\t$('#saveData').css(\"display\", \"inline\");\n\t\t\t\t// $('#addBack').css(\"display\", \"inline\");\n\t\t\t\t$('#foot').css(\"display\", \"block\");\n\t\t\t\t$('#items').css(\"display\", \"none\");\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}", "function toggleBool() {\n if(myFlag) \n myFlag = false;\n else\n myFlag = true;\n}", "_toggle() {\n if (this._isVisible) {\n this._hide();\n } else {\n this._show();\n }\n }", "function toggle() {\n opened = !opened;\n element.removeClass(opened ? 'closed' : 'opened');\n element.addClass(opened ? 'opened' : 'closed');\n }", "function toggle() {\n opened = !opened;\n element.removeClass(opened ? 'closed' : 'opened');\n element.addClass(opened ? 'opened' : 'closed');\n }", "function toggleOn() {\n if(toggle==0)\n {\n toggle=1;\n $(\".content\").css(\"display\",\"none\");\n $(\".containeffect\").css(\"display\",\"inline-block\");\n if(equal==1)\n {\n $(\".contain\").css(\"display\",\"none\");\n $(\".fa-bar-chart\").toggleClass('bar-icon')\n $(\"svg\").css(\"display\",\"none\");\n equal=0;\n }\n }\n else {\n toggle=0;\n $(\".containeffect\").css(\"display\",\"none\");\n $(\".content\").css(\"display\",\"inline-block\");\n }\n}", "toggleHandleClick(e) {\n if (this.opened) {\n this.hide();\n } else {\n this.show();\n }\n }", "function toggleControl(e) {\n\n\t// Define variables.\n\tvar id = e.target.id,\n\t\ti;\n\n\tif (board[id]) {\n\t\t\n\t\t// Deactivate current toggle button.\n\t\tthis.removeClass(board.activeClass);\n\t\t\n\t\t// Set default actions.\n\t\tboard.setDefaults(false);\n\t\t\n\t} else {\n\t\t\n\t\t// Disable moving.\n\t\tboard.moving = false;\n\t\t\n\t\t// Activate current toggle button.\n\t\tthis.addClass(board.activeClass);\n\t\t\n\t\t// Loop through all toggle actions.\n\t\tfor (i=0; i<board.toggleActions.length; i++) {\t\t\t\n\t\t\tvar action = board.toggleActions[i],\n\t\t\t\tbutton = select('#'+action);\n\t\t\tif (action == id) {\n\t\t\t\t// Enable action for current toggle button.\n\t\t\t\tboard[action] = true;\t\n\t\t\t} else {\n\t\t\t\t// Deactivate/disable action for other toggle buttons.\n\t\t\t\tbutton.removeClass(board.activeClass);\n\t\t\t\tboard[action] = false;\n\t\t\t}\n\t\t}\t\t\n\t\t\n\t}\n\t\n\t// Prevent default functionality.\n\treturn false;\n\n}", "function _toggleButtons(){\n\n\t\t\t\tif($nav.children('.fn-previous-button').is(':hidden')){\n\t\t\t\t\t$nav.children('.fn-previous-button, .fn-next-button').show();\n\t\t\t\t \t$nav.children('.fn-close-button').hide();\n\t\t\t\t }\n\t\t\t\telse {\n\t\t\t\t\t$nav.children('.fn-previous-button, .fn-next-button').hide();\n\t\t\t\t \t$nav.children('.fn-close-button').show();\n\t\t\t\t}\n\t\t\t}", "function toggle(n) {\r\n\tif (n != 0) {\r\n\t\tvar newString = \"\"\r\n\t\tvar currState = getCurrState() // of whole outline\r\n\t\tvar expanded = currState.charAt(n-1) // of clicked item\r\n\t\tnewString += currState.substring(0,n-1)\r\n\t\tnewString += expanded ^ 1 // Bitwise XOR clicked item\r\n\t\tnewString += currState.substring(n,currState.length)\r\n\t\tsetCurrState(newString) // write new state back to cookie\r\n\t}\r\n}", "function toggleButtonClick() {\n toggleButton(event.target);\n}", "function toggleControls(n){\r\n\t\tswitch(n){\r\n\t\t\tcase \"on\":\r\n\t\t\t\te('comicForm').style.display = \"none\";\r\n\t\t\t\te('clearData').style.display = \"inline\";\r\n\t\t\t\te('displayData').style.display = \"none\";\r\n\t\t\t\te('addNew').style.display = \"inline\";\t\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"off\":\r\n\t\t\t\te('comicForm').style.display = \"block\";\r\n\t\t\t\te('clearData').style.display = \"inline\";\r\n\t\t\t\te('displayData').style.display = \"inline\";\r\n\t\t\t\te('addNew').style.display = \"none\";\r\n\t\t\t\te('items').style.display = \"none\";\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t}", "function toggleControls (n) {\n\t \tswitch(n) {\n\t\t \tcase \"on\":\n\t\t \t\t$(\"contactForm\").style.display = \"none\";\n\t\t \t\t$(\"clear\").style.display = \"inline\";\n\t\t \t\t$(\"displayLink\").style.display = \"none\";\n\t\t \t\t$(\"addNew\").style.display = \"inline\";\n\t\t \t\tbreak;\n\t\t \tcase \"off\":\n\t\t \t\t$(\"contactForm\").style.display = \"block\";\n\t\t \t\t$(\"clear\").style.display = \"inline\";\n\t\t \t\t$(\"displayLink\").style.display = \"inline\";\n\t\t \t\t$(\"addNew\").style.display = \"none\";\n\t\t \t\t$(\"items\").style.display = \"none\";\n\t\t \t\tbreak;\n\t\t \tdefault:\n\t\t \t\treturn false;\n\t \t}\n \t}", "handleToggleClickA(){\n this.setState({\n toggleStateA: !this.state.toggleStateA\n })\n }", "handleToggleClickA(){\n this.setState({\n toggleStateA: !this.state.toggleStateA\n })\n }", "function toggleSwitch() {\n for(let i = 0; i < toggleContainer.length; i++){\n toggleContainer[i].addEventListener(\"click\", (e) => {\n if(toggleText[i].textContent === \"On\"){\n toggleOff(i);\n localStorage.setItem('toggle' + i, 'off');\n }\n else if (toggleText[i].textContent === \"Off\"){\n toggleOn(i);\n localStorage.setItem('toggle' + i, 'on');\n }\n });\n }\n}", "function toggle(el) {\n el.style.display = (el.style.display == 'none') ? '' : 'none'\n\n}", "function shifter(onFunc, offFunc) {\n window.toggleFlag = true;\n\n return function () {\n if (toggleFlag) {\n onFunc();\n toggleFlag = false;\n } else {\n offFunc();\n toggleFlag = true;\n }\n };\n }", "onSwitchToggle(id, enabled ){\n this.props.toggleEnableFav(id, !enabled);\n }", "toggle() {\n this.setState({\n isOpened: !this.state.isOpened,\n chevronState: !this.state.isOpened ? \"opened\" : \"\"\n })\n }", "function toggle() {\n $( \"#target\" ).toggle();}", "function toggle_all(){\n toggle_disable('edit');\n toggle_disable('save');\n toggle_disable('load');\n toggle_disable('strum');\n}", "function ToggleAll(e) {\n\tif (e.innerHTML=='Activate'){\n\t\tCheckAll();\n\t\te.innerHTML='De-Activate';\n\t} else {\n\t\tClearAll();\n\t\te.innerHTML='Activate';\n\t}\n}", "onToggle(d) {\n const { onChangeToggle, identifier } = this.props;\n if (onChangeToggle) {\n onChangeToggle(d[identifier]);\n }\n }", "function togglemenu(){\n this.isopen = !this.isopen;\n }", "toggle() {\n this.checked = !this.checked;\n }", "function toggleView(){\n\n }", "function toggleView(){\n\n }", "function hookStateToggle(e) {\n $(this).toggleClass('active', e.type == 'in');\n }", "function toggleElement() {\n\tvar toggleTargets = $(this).attr('target');\n\t$.each(toggleTargets.split(' '), function( index, value ) {\n\t\t$('#'.concat(value)).toggle();\t\n\t});\n}", "toggle() {\n return this[this.isExpanded ? 'collapse' : 'expand']();\n }", "toggleVisibility() {\n return this.stateIsOpen ? this.close() : this.open();\n }", "toggle() {\n this[ this.options.animate ? '_toggleAnimate' : '_toggleClass']();\n }", "onUntoggle() {\n const { onChangeToggle } = this.props;\n if (onChangeToggle) {\n onChangeToggle(null);\n }\n }", "toggle() {\n if (this.isActive) {\n this.close();\n } else {\n this.open();\n }\n }", "function toggleVisibility() {\n toggle(this);\n}", "switchOff() {\n this.setState({\n color : \"grey\",\n toggler : null,\n active : false,\n iAmWinner : this.iAmWinner\n })\n //this.toggle_flag = false;\n }", "function toggle(eltname){\n var elt = myDocument.getElementById(eltname);\n elt.style.display = (elt.style.display=='none')?'block':'none'\n }", "function toggle(t) {\n\tt.reversed() ? t.play() : t.reverse();\n\t\n}", "function toggle() {\r\n //if the object is current hidden\r\n if (hidden) {\r\n //set display to be on in block form\r\n document.getElementById('output').style.display = 'block';\r\n //and set the status to currently visible\r\n hidden = false;\r\n }\r\n //otherwise it is implied that it is visible\r\n else {\r\n //set the status to hidden\r\n hidden = true;\r\n //set the objects display to be off\r\n document.getElementById('output').style.display = 'none';\r\n }\r\n }", "function ToggleEdit(){\n\t\n}", "render_toggle() {\n if (this.visible) {\n this.render_hide();\n\n } else {\n this.render_display();\n\n }\n }", "function toggleMove(){ //Toggle between Viewing and Moving\n if(modeArray.viewingMode){ //Only runs if viewing is enabled\n if(!modeArray.movingMode){ //Swap to Moving\n modeArray.movingMode =true;\n document.getElementById(\"Mode\").innerText = \"Moving\"; //Update mode text\n document.getElementById(\"btnToggleMove\").innerText = \"Stop Moving\"; //Update toggle button text\n }\n else{\n modeArray.movingMode =false; //Swap back to Viewing\n document.getElementById(\"btnToggleMove\").innerText = \"Move Marker\"; //Update toggle button text\n document.getElementById(\"Mode\").innerText = \"Viewing\"; //Update mode text\n }\n }\n}", "function toggleVisibility(passedElementId, togglevalue) {\n\n // access passed element\n var e = document.getElementById(passedElementId);\n\n // read visibility status\n //assign inverse visibility status\n if (togglevalue == 'on') {\n e.style.display = 'block';\n } else if (togglevalue == 'off') {\n e.style.display = 'none';\n } else {\n e.style.display = 'block';\n }\n\n}", "toggle(value) {\n this.isSelected(value) ? this.deselect(value) : this.select(value);\n }", "function toggleControls(n) {\n\t\tswitch(n){\n\t\t\tcase \"on\":\n\t\t\t\t$('addNewHire').style.display = 'none';\n\t\t\t\t$('clearLink').style.display = 'inline';\n\t\t\t\t$('displayLink').style.display = 'none';\n\t\t\t\t$('addNewLink').style.display = 'inline';\n\t\t\t\tbreak;\n\t\t\tcase \"off\":\n\t\t\t\t$('addNewHire').style.display = 'block';\n\t\t\t\t$('clearLink').style.display = 'inline';\n\t\t\t\t$('displayLink').style.display = 'inline';\n\t\t\t\t$('addNewLink').style.display = 'none';\n\t\t\t\t$('employeeList').style.display = 'none';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\n\t\t}\n\t}", "function toggleBit(e) {\n if (e.text() === \"0\") { e.text(1); }\n else { e.text(0); }\n}", "function toggleTrueFalse(passedIndex, subject) {\n setToggle(prev => {\n const updatedArray = prev.map((x, index) =>\n index === passedIndex ? !prev[index] : prev[index]\n );\n return updatedArray;\n });\n if(toggle[passedIndex]){\n setDisplayArray(prev=>[...prev])\n }else{\n setDisplayArray(prev => [...prev, subject]); \n }\n }", "function setToggleButton() {\n var collapse = $toggleButton.attr(\"data-collapse\");\n var expand = $toggleButton.attr(\"data-expand\");\n if ($panels.next().hasClass('in')) {\n $panels.next().collapse('hide');\n $toggleButton.text(expand);\n $toggleButton.removeClass('closed');\n } else {\n $panels.next().collapse('show');\n $toggleButton.text(collapse);\n $toggleButton.addClass('closed');\n }\n}", "function toggle(item){\n\titem === true ? item = false : item = true\n\treturn item\n}", "function changeRADVDStatus(toggleObj){\n onImageToggle(toggleObj);\n checkMode();\n}", "toggle() {\n this.expanded = !this.expanded;\n }", "handleChangeToggle(e)\n { \n let togglelocal=\"false\";\n if(e)\n {\n \n togglelocal=\"true\";\n\n }\n this.setState({status: togglelocal});\n }", "toggle() {\n if (this.isActive) {\n this.hide();\n } else {\n this.show();\n }\n }", "function Toggle(id, multi) {\n\t\n spanid1 = \"ToggleRow_\"+id;\n spanid2 = \"ToggleImg_\"+id;\n\t\n if(multi == true) {\n \t\n\telements = document.getElementsByName(spanid1);\n\tval = document.getElementsByName(spanid1)[0].style.display;\n\tfor (var i=0;i<elements.length;i++) {\n\t if (val == \"none\") elements[i].style.display = \"inline\";\n\t else elements[i].style.display = \"none\";\n\t}\n }\n else {\n\n\t if (/MSIE/.test(navigator.userAgent)){\n\t \timages = document.getElementById(spanid1).getElementsByTagName('img');\n\t anz = images.length\n\t for(i=0;i<anz;i++){\n\t \telem = images[i];\n\t if(typeof elem.onload == \"function\") elem.onload();\n\t }\n\t }\n\t val = document.getElementById(spanid1).style.display;\n\t if (val == \"none\")\n\t {\n\t document.getElementById(spanid1).style.display = \"block\";\n\t document.getElementById(spanid2).src = \"images/icons/collapse.gif\";\n\t document.getElementById(spanid2).alt = \"hide\";\n\t\t document.getElementById(spanid2).title = \"hide\";\n\t }\n\t else\n\t {\n\t document.getElementById(spanid1).style.display = \"none\";\n\t document.getElementById(spanid2).src = \"images/icons/expand.gif\"\n\t document.getElementById(spanid2).alt = \"read more\";\n\t\t document.getElementById(spanid2).title = \"read more\";\n\t }\n }\n}", "static toggle() {\n if (this.isLight()) {\n this.dark()\n } else {\n this.light()\n }\n }", "toggle(params={}) {\n\t\tif (this.targetObj.action && !params.avoidCallAction) this.targetObj.action();\n\t\tif (this._$pwActive) {\n\t\t\t// Give menu a z-index to put it on top of any windows\n\t\t\tif (this.$pwMain.isBar) {\n\t\t\t\tif (this.$pwMain.order > 0) {\n\t\t\t\t\tthis.$pwMain.order = this.$pwMain.order - 1;\n\t\t\t\t\tif (this.$pwMain.order === 0) {\n\t\t\t\t\t\tthis.$pwMain.element.classList.remove('pw-order');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Give menu its normal z-index\n\t\t\tif (this.$pwMain.isBar) {\n\t\t\t\tif (this.$pwMain.order === 0) {\n\t\t\t\t\tthis.$pwMain.element.classList.add('pw-order');\n\t\t\t\t}\n\t\t\t\tthis.$pwMain.order = this.$pwMain.order + 1;\n\t\t\t}\n\t\t}\n\t\tsuper.toggle();\n\t}", "function switchOnFn(scope) {\n\t/** Iniatialy the switch on flag set as false, in the click event of button 'Switch On Light' the flag will be set as true */\n\tif ( switch_on_flag == false ) {\n\t\tgetChild(\"current_display\", side_view_container).alpha = 1; /** Display the current value in machine */\n\t\tswitch_on_rect.alpha = 1; /** Machine light display */\n\t\tswitch_on_flag = true;\n\t\tscope.switch_on_light = switch_off_text; /** The button text is changed as 'Switch Off Light' */\n\t} else { /** Else the click event of button 'Switch Off Light' the flag will be set as false */\n\t\tgetChild(\"current_display\", side_view_container).alpha = 0;\n\t\tswitch_on_rect.alpha = 0.01; \n\t\tswitch_on_flag = false;\n\t\tscope.switch_on_light = switch_on_text; /** The button text is changed as 'Switch On Light' */\n\t}\t\n\tbrewsters_stage.update();\n}", "function toggleModule( evnt ) {\n\t\t\t\t// we require jQuery for this not just jQLite\n\t\t\t\tvar element = $( evnt.currentTarget );\n\t\t\t\tvar parent = element.parent();\n\t\t\t\tvar well = parent.siblings('.well');\n\t\t\t\t// do toggling of hidden class\n\t\t\t\tif( well.hasClass('hidden') ) {\n\t\t\t\t\twell.removeClass('hidden');\n\t\t\t\t\telement.find('.fa-caret-square-o-down')\n\t\t\t\t\t.removeClass('fa-caret-square-o-down')\n\t\t\t\t\t.addClass('fa-caret-square-o-up')\n\t\t\t\t} else {\n\t\t\t\t\twell.addClass('hidden');\n\t\t\t\t\telement.find('.fa-caret-square-o-up')\n\t\t\t\t\t.removeClass('fa-caret-square-o-up')\n\t\t\t\t\t.addClass('fa-caret-square-o-down')\n\t\t\t\t}\n\t\t\t}", "function toggleBtnState(sub, add) {\n btnSubtract.disabled = sub\n btnAdd.disabled = add\n}", "function ToggleSwitchControl(action) {\n if ($(this).hasClass('active')) {\n $(this).removeClass('active');\n $(this).parent().removeClass('active');\n }\n else {\n $(this).addClass('active');\n $(this).parent().addClass('active');\n }\n // Change Text and React based on ID\n switch ($(this).attr('id')) {\n case 'pieceTypeLine':\n {\n $(this).hasClass('active') ? $(this).html('Line') : $(this).html('Shape');\n $('#PTcutout').css('display', $(this).hasClass('active') ? 'none' : 'inline-block');\n $('#PTcutoutLbl').css('display', $('#PTcutout').css('display'));\n for (var _i = 0, selectedPieces_3 = selectedPieces; _i < selectedPieces_3.length; _i++) {\n var piece = selectedPieces_3[_i];\n piece.Line = $(this).hasClass('active');\n }\n Redraw();\n break;\n }\n case 'spotTypeConnect':\n {\n $(this).hasClass('active') ? $('#spotTypeTension').removeClass('folded') :\n $('#spotTypeTension').addClass('folded');\n $(this).hasClass('active') ? $(this).html('Curve') : $(this).html('Corner');\n // Whole Piece\n if (selectedSpots.length < 1) {\n for (var _a = 0, selectedPieces_4 = selectedPieces; _a < selectedPieces_4.length; _a++) {\n var piece = selectedPieces_4[_a];\n for (var _b = 0, _c = piece.Data; _b < _c.length; _b++) {\n var spot = _c[_b];\n spot.Connection = $(this).hasClass('active') ? Connector.Curve : Connector.Corner;\n }\n }\n }\n // Selected Spots\n else {\n for (var _d = 0, selectedSpots_3 = selectedSpots; _d < selectedSpots_3.length; _d++) {\n var spot = selectedSpots_3[_d];\n spot.Connection = $(this).hasClass('active') ? Connector.Curve : Connector.Corner;\n }\n }\n Redraw();\n break;\n }\n }\n}", "toggle() {\n this.selected = !this.selected;\n }", "toggle() {\n this.selected = !this.selected;\n }", "toggle()\n {\n if (this.showing)\n {\n this.close();\n }\n else\n {\n this.open();\n }\n }", "function ToggleWidget(ontxt,offtxt) {\n\tWidget.apply(this);\n\tvar onlink = A({href:'javascript:undefined'},ontxt);\n\tvar offlink = A({href:'javascript:undefined'},offtxt);\n\tthis.events.toggleOn = extractEvent_e(onlink,'click').constant_e(true);\n\tthis.events.toggleOff = extractEvent_e(offlink,'click').constant_e(false);\n\tthis.events.toggle = merge_e(this.events.toggleOn,this.events.toggleOff);\n\tthis.behaviors.toggled = this.events.toggle.startsWith(false);\n\tthis.dom = this.behaviors.toggled.transform_b(function(t) {return t ? offlink : onlink;});\n}", "function toggleAndShow(element) {\n toggle(element);\n makeVisible(element);\n}", "function toggle() {\n setIsActive(!isActive);\n }" ]
[ "0.82004464", "0.8072964", "0.7931358", "0.74784875", "0.73484015", "0.7144393", "0.7030745", "0.7023448", "0.69760704", "0.69117826", "0.69022447", "0.69011825", "0.68635625", "0.68274593", "0.68274593", "0.6820734", "0.6818354", "0.68117297", "0.68117297", "0.68075037", "0.679882", "0.67837566", "0.67463344", "0.67463344", "0.67463344", "0.67387265", "0.6737255", "0.66983664", "0.66926825", "0.6687859", "0.66605437", "0.6626163", "0.6625965", "0.6620723", "0.6617783", "0.6600943", "0.6584398", "0.65741163", "0.65741163", "0.6572941", "0.65627575", "0.65472424", "0.65425986", "0.65305734", "0.6526495", "0.6521994", "0.65172344", "0.6512032", "0.6512032", "0.6503079", "0.65001696", "0.64978445", "0.6497288", "0.6496502", "0.6492399", "0.64900315", "0.6486009", "0.6484132", "0.6474024", "0.6470543", "0.64675736", "0.64675736", "0.64629674", "0.6460857", "0.6458135", "0.6451102", "0.6449905", "0.6448681", "0.6442714", "0.64396125", "0.64395154", "0.64331", "0.6408862", "0.6405524", "0.6396786", "0.63952136", "0.63945687", "0.6392356", "0.6391429", "0.639114", "0.63884443", "0.63880193", "0.638497", "0.63750464", "0.63674766", "0.6361577", "0.63584155", "0.63570166", "0.63563985", "0.6355267", "0.6352603", "0.6352018", "0.6351109", "0.6348495", "0.6346327", "0.6344941", "0.6344941", "0.6341407", "0.6338921", "0.6336319", "0.6334145" ]
0.0
-1
Lifecycle hook, runs after component has mounted onto the DOM structure
componentDidMount() { const request = new Request('http://127.0.0.1:8081/questions/'); fetch(request) .then(response => response.json()) .then(data => this.setState({data: data})); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createdCallback() {\n\t // component will mount only if part of the active document\n\t this.componentWillMount();\n\t}", "load (el) {\n console.log('Component was mounted on the DOM')\n }", "componentDidMount() {\n if(typeof componentHandler !== 'undefined')\n componentHandler.upgradeDom();\n }", "componentDidMount() {\n this.componentLoaded = true;\n }", "connectedCallback() {\n this.renderAndUpdateDom();\n }", "componenetDidMount() { }", "connectedCallback() {\n // Do things when component is added to the DOM\n }", "componentDidMount() {\n navRoot.appendChild(this.el);\n }", "componentDidUpdate() {\n window.componentHandler.upgradeDom()\n }", "componentDidMount() {\n\t\tthis.init();\n\t}", "attachedCallback() {\n\t\t// update attached status\n\t\tthis._componentAttached = true;\n\n\t\t// wait until dependencies are ok\n\t\tthis._whenMountDependenciesAreOk().then(() => {\n\t\t\t// switch on the mountWhen prop\n\t\t\tswitch(this.props.mountWhen) {\n\t\t\t\tcase 'inViewport':\n\t\t\t\t__whenInViewport(this).then(() => {\n\t\t\t\t\tthis._mountComponent();\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t\tcase 'mouseover':\n\t\t\t\t\tthis.addEventListener('mouseover', this._onMouseoverComponentMount.bind(this));\n\t\t\t\tbreak;\n\t\t\t\tcase 'isVisible':\n\t\t\t\t\t__whenVisible(this).then(() => {\n\t\t\t\t\t\tthis._mountComponent();\n\t\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t// mount component directly\n\t\t\t\t\tthis._mountComponent();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\t}", "onComponentConstructed() {}", "onComponentConstructed() {}", "componenetWillMount() { }", "postInitialize() {\n // Take component initialize asynchronously to take care\n // about constructor of extending component class\n setTimeout(() => {this.initialize()}, 1);\n }", "beforerender (el) {\n console.log('Component is about to be rendered for the first time')\n\n // this is where you can register other lifecycle events:\n // on.resize()\n // on.ready()\n // on.intersect()\n // on.idle()\n }", "componentDidMount() {\r\n window.addEventListener('load', this.listenForEvents);\r\n }", "_mountComponent() {\n\t\t// wait next frame\n\t\tthis.mutate(() => {\n\t\t\t// sometimes, the component has been unmounted between the\n\t\t\t// fastdom execution, so we stop here if it's the case\n\t\t\tif ( ! this._componentAttached) return;\n\t\t\t// init\n\t\t\tthis.componentMount();\n\t\t\t// render\n\t\t\tthis.render();\n\t\t\t// component did mount\n\t\t\tthis.componentDidMount();\n\t\t});\n\n\t}", "connectedCallback() {\n this._defineUsedComponents();\n this._checkForUndefinedComponents();\n this.render();\n this.updateStyles();\n }", "beforeUnmount() {\n // reference to detached method\n const { detached } = this.$options;\n\n // no longer attached, clean up\n if (!this.$el.offsetParent) {\n detached.call(this);\n return;\n }\n\n // if we're still attached it's likely a transition is running, we need to\n // determine the moment when we're no longer attached to the DOM so we can\n // clean up properly\n const mutationHandler = (mutations, observer) => {\n const removedNodes = (mutations[0] || {}).removedNodes || [];\n const removedNode = removedNodes[0];\n if (!removedNode || !removedNode.contains(this.$el)) return;\n observer.disconnect();\n detached.call(this);\n };\n\n // start observing parent element for changes to the DOM\n const observer = new MutationObserver(mutationHandler);\n observer.observe(document.documentElement, {\n childList: true,\n subtree: true,\n });\n }", "didInsertElement() {\n this._super(...arguments);\n\n let $item = this.$();\n if (this.get('_hasSubmenu')) {\n\n // Initialize Semantic UI dropdown module.\n $item.dropdown();\n } else if (!Ember.isNone(MutationObserver)) {\n\n // Sometimes Semantic UI adds/removes classes too late what breaks results of component's class name bindings.\n // So to fix it, we need to observe changes in 'class' attribute through mutation observer.\n let classObserver = new MutationObserver((mutations) => {\n let isActive = this.get('_isActive');\n if (isActive && !$item.hasClass('active')) {\n $item.addClass('active');\n return;\n }\n\n if (!isActive && $item.hasClass('active')) {\n $item.removeClass('active');\n return;\n }\n });\n\n classObserver.observe($item[0], {\n attributes: true,\n attributeFilter: ['class']\n });\n\n this.set('_classObserver', classObserver);\n }\n }", "componentDidMount() {\n this.container = this.props.container ? document.getElementsByClassName(this.props.container)[0]\n : window;\n this.container.addEventListener('scroll', this.handleScrollEnd);\n }", "componentWillMount() {\n console.log('Before component gets created.');\n //document.querySelector('h4').style.color = 'red';\n // this line will throw an error. because we are trying to access which is not created yet.\n }", "connectedCallback() {\n self.addComponentContent()\n }", "componentDidMount() {\n\n window.addEventListener('resize', this.layout);\n\t\twindow.addEventListener('scroll', this.layout);\n\n this.layout();\n }", "componentDidMount() {\n this.onLoad();\n }", "connectedCallback() {\r\n this.addComponentContent()\r\n }", "render() {\n if (!this.initialized) {\n this.init();\n }\n }", "async connectedCallback() {\n const ctor = this.constructor;\n this.setAttribute(`_ui5rt${(0, _Runtimes.getCurrentRuntimeIndex)()}`, \"\");\n this.setAttribute(\"_ui5host\", \"\");\n this.setAttribute(ctor.getMetadata().getPureTag(), \"\");\n if (ctor.getMetadata().supportsF6FastNavigation()) {\n this.setAttribute(\"data-sap-ui-fastnavgroup\", \"true\");\n }\n const slotsAreManaged = ctor.getMetadata().slotsAreManaged();\n this._inDOM = true;\n if (slotsAreManaged) {\n // always register the observer before yielding control to the main thread (await)\n this._startObservingDOMChildren();\n await this._processChildren();\n }\n if (!this._inDOM) {\n // Component removed from DOM while _processChildren was running\n return;\n }\n (0, _Render.renderImmediately)(this);\n this._domRefReadyPromise._deferredResolve();\n this._fullyConnected = true;\n this.onEnterDOM();\n }", "async componentDidLoad() {\r\n // when this component is rendered inside slot of dxp-tabs\r\n let host = this.element.closest('dxp-tabs');\r\n // when this component is rendered inside shadow root of dxp-tabs\r\n host = host ? host : this.element['getRootNode']()['host'];\r\n const hostComponentRef = host && await host.componentOnReady();\r\n if (hostComponentRef) {\r\n await hostComponentRef.registerTab();\r\n }\r\n }", "componentDidMount() {\n const { onMount } = this.props;\n if (this.domElement && typeof onMount === 'function') {\n const clientRect = this.domElement.getBoundingClientRect();\n onMount(clientRect);\n }\n }", "init() {\n // override init to make sure createEl is not triggered\n }", "render() {\n\t\tif (!this.component_.element) {\n\t\t\tthis.component_.element = document.createElement('div');\n\t\t}\n\t\tthis.emit('rendered', !this.isRendered_);\n\t}", "componentDidMount() {\n console.log('componentDidMount UserPanel');\n window.addEventListener('scroll', this.handleScroll.bind(this));\n this.init();\n }", "ready() {\n this._root = this._createRoot();\n super.ready();\n this._firstRendered();\n }", "render() {\n if (!this.initialized) this.init();\n }", "componentDidMount() {\n var container = React.findDOMNode(this).querySelector('#compare-view');\n var width = React.findDOMNode(this).offsetWidth;\n var height = React.findDOMNode(this).offsetHeigh;\n\n this.komparator = new Komparator({\n container: container\n });\n\n window.addEventListener(\"resize\", this.update.bind(this));\n }", "attachedCallback () {\n /**\n * Now that we are in the DOM we can append our container\n */\n this.appendChild(this._container);\n\n /**\n * Create our Map and MapView.\n */\n this.map = new Map({\n basemap: this.basemap\n });\n\n this.view = new MapView({\n container: this._container.id,\n zoom: this.zoom,\n map: this.map,\n center: this.center\n });\n\n /**\n * Dispatch a event, just like a click or keyboard\n * event, bubbling it up the DOM. This is useful for\n * inter-element communication or for notifiying\n * applications of things the element is doing.\n *\n * You must bubble the event or you cannot listen\n * to then event in some frameworks like Ember.\n */\n this.dispatchEvent(new CustomEvent('mapready', {\n bubbles: true\n }));\n\n /**\n * Set a flag so other elements can check if this\n * is ready.\n */\n this.ready = true;\n }", "componentDidMount () {\n this.init();\n }", "componentDidMount () {\n this.init();\n }", "componentDidMount () {\n this.init();\n }", "created() {\n this.__initEvents();\n }", "componentDidMount() {\n\n console.log(\"componentDidMount()\");\n\n window.readyForStuff = this.readyForStuff.bind(this);\n\n }", "componentDidMount() {\n\t\tthis.startup();\n\t}", "postRender() {\n // Take component render method and apply UUID\n const componentElement = this.render();\n\n componentElement.setAttribute('data-component', this.uuid);\n\n this._element = componentElement;\n this.postUpdate();\n }", "componentDidMount() {\n // $('.float-label').jvFloat();\n // var WinHeight = $(window).height();\n // $('.step_form_wrap').height(WinHeight - (240 + $('.app_header').outerHeight(true)));\n }", "render() {\n // always reinit on render\n this.init();\n }", "render() {\n // always reinit on render\n this.init();\n }", "componentDidMount() {\n document.lazyLoadInstance.update();\n }", "componentDidMount() {\n window.addEventListener(\"resize\", this.resize);\n this.renderDag(true);\n }", "mounted() {\n this.$nextTick(() => {\n // The Tooltip/Popover instance is defined in each individual component\n const TPInstance = this.bootstrap()\n\n // If there's no TPInstance it means that there's no target, so just return here\n if (!TPInstance) {\n return\n }\n\n this._enableDOMObserver()\n\n if (this.disabled) {\n this._handleDisable()\n }\n\n if (this.show) {\n this._handleShow()\n }\n })\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "mounted() {\n this.initialize()\n }", "componentDidMount() {\n this.buildTagMap(this.props.tags);\n this.initialize();\n $(ReactDOM.findDOMNode(this)).on('change', this.handleChange.bind(this));\n }", "componentDidMount() {\n window.addEventListener('resize', this.setToolBoxDeltaPoints);\n this.setToolBoxDeltaPoints(this.toolboxRef);\n }", "attached() {\n super.attached();\n const that = this;\n\n that._handleContainers();\n }", "render(){\n console.log('Render Fired')\n return(\n <div>Lifecycle Method Examples</div>\n )\n }", "componentDidMount() {\n\t\tthis.updateContext();\n\t\tthis.updateBoundingClientRect();\n\t\tthis.drawPatterns();\n\t\t// attaching event handlers\n\t\twindow.addEventListener(\"scroll\", this.updateBoundingClientRect.bind(this));\n\t\twindow.addEventListener(\"resize\", this.updateBoundingClientRect.bind(this));\n\t}", "componentDidMount() {\n document.addEventListener('DOMContentLoaded', function() {\n var elems = document.querySelectorAll('.dropdown-button');\n var instances = window.M.Dropdown.init(elems, {});\n }); \n }", "initializeElements () {\n this.$els = {\n window,\n body: document.body\n }\n }", "componentDidMount(){ //Cuando un compoennte se monta y se muestra en pantalla se llama este método\n console.log(\"did Mount\");\n }", "createdCallback() {\r\n this.init()\r\n }", "ready() {\n super.ready();\n\n afterNextRender(this, function() {});\n }", "ready() {\n super.ready();\n\n afterNextRender(this, function() {});\n }", "ready() {\n super.ready();\n\n afterNextRender(this, function() {});\n }", "ready() {\n super.ready();\n\n const that = this;\n\n that._render();\n }", "render() {\r\n document.body.insertBefore(this.element, document.querySelector('script'));\r\n\r\n this.append(this.PageContent.element, [this.NewsList, this.Footer]);\r\n this.append(this.Sidebar.element, [this.SidebarTitle, this.SourcesList]);\r\n this.append(this.element, [this.Spinner, this.PageContent, this.Sidebar, this.ToggleBtn]);\r\n }", "componentDidMount() {\n this.initialize();\n }", "function init(){\n buildComponent();\n attachHandlers();\n addComponents();\n }", "componentDidUpdate() {\n document.lazyLoadInstance.update();\n }", "componentDidMount() {\n if (document.querySelector(\".product-item-space\") === null)\n setTimeout(this.updateComponent, 1000);\n }", "connectedCallback(){\n\n //Though here DOM is inserted, but not rendered, so you can change the attribute \n //but you cannot manipulate the DOM \n\n //You can not programatically add or remove the element \n console.log(\"Child's Component's Connected Callback is Called!\");\n }", "componentDidMount() {\n this.windowOnLoadOverride()\n this.listenToScrollEvent()\n }", "componentDidMount() {\n document.addEventListener('change', this.handleChange);\n this.callRender();\n this._seqObj.onSubpartSelected(this.props.onSubpartSelected);\n this._seqObj.onMouseSelection(this.props.onMouseSelection);\n }", "componentDidMount(){\n console.log(\"El componente se ha montado\")\n }", "componentDidMount() {\n window.addEventListener(\"scroll\", this.onScrollHandler);\n this.onChangeOfPageHandler();\n this.showSocialIconsDesktopHandler();\n }", "componentDidMount() {\n // alert(\"se acaba de cargar el componente\")\n }", "componentDidMount() {\n \n }", "componentDidMount() {\n \n }", "componentDidMount() {\r\n console.log(\"El componente se renderizó\");\r\n }", "componentDidMount() {\n $(window).on('focus', this._startPolling.bind(this));\n $(window).on('blur', this._stopPolling.bind(this));\n\n this.mounted = true;\n\n console.log(`Widget '${this.props.widget.name}' mounted`);\n\n this._paramsHandler = new WidgetParamsHandler(this.props.widget,this._getToolbox());\n this._fetchData();\n }", "componentDidMount(){\n console.log('mounted to the page')\n }", "setupComponent() {\n if (document && window && window.google && window.google.maps) {\n this.setAutocomplete();\n if (this.get('withGeoLocate')) {\n this.geolocateAndSetBounds();\n }\n this.get('autocomplete').addListener('place_changed', () => {\n run(() => {\n this.placeChanged();\n });\n });\n } else {\n if (!this.isDestroyed && !this.isDestroying) {\n run.later(this, 'setupComponent', 100);\n }\n }\n }", "onComponentMount() {\n\n }", "componentDidUpdate() { }", "componentDidUpdate() { }", "componentDidMount() {\n // console.log(\"currentUserContainer Mounted\")\n this.init()\n }", "componentDidMount(){\n \n }", "function onViewRendered(domEl) {\n setDOMElement(domEl);\n // from the ViewMixinEventDelegator\n if (this.delegateEvents) {\n this.delegateEvents();\n }\n\n if (this.viewDidMount) {\n this.viewDidMount();\n }\n }", "componentDidMount() {\n //this.assignPhotos();\n this.noFocusElements();\n }", "componentDidMount(){\n\t\t$(\"main\").css(\"backgroundImage\",`url(${barImage})`);\n\t\t$(\"main\").css(\"background-color\",\"#00000080\");\n\t\t$(\"main\").css(\"background-blend-mode\",\"overlay\");\n\t\t$(\"#menu\").css(\"marginTop\",\"7.5%\");\n\n\t\t//Trigger margin-top autoadjustment\n\t\tthis.advancedSearchToggle();\n\t}", "mount() {\n this.updateAnimationControlsSubscription();\n }", "componentDidMount() {\n modalRoot.appendChild(this.element);\n }", "componentDidMount(){\n //this.setState({helperIntervalID: helperIntervalID});\n let elem = document.getElementById(\"App\");\n if(elem){\n if(!this.snapper){\n this.snapper = new VerticalSnapper(elem);\n }\n }\n }", "componentDidMount() {\n this.resizeDetector.listenTo(this.virtualCSSGrid.container, this.handleResize)\n }", "componentDidMount() {\n\t\tthis.props.onLoad();\n\t}", "init_() {\n // Add CSS marker that component upgrade is finished.\n // Useful, but beware flashes of unstyled content when relying on this.\n this.root_.dataset.mdlUpgraded = '';\n }", "componentDidMount() {\n this.props.actions.watchInitialise(this.props.scrollerId, this.child.getScrollTop);\n }", "componentDidMount()\n {\n\n }" ]
[ "0.7476048", "0.71652204", "0.70766634", "0.70227003", "0.68935144", "0.68838584", "0.68679917", "0.6843725", "0.6842333", "0.6817542", "0.6811037", "0.678628", "0.678628", "0.67698866", "0.67332137", "0.6731511", "0.67174995", "0.67026144", "0.6663898", "0.6647855", "0.6636433", "0.6636216", "0.66271883", "0.6624926", "0.6615682", "0.66113925", "0.6610606", "0.65914136", "0.6561002", "0.6556664", "0.6545124", "0.6541699", "0.6538496", "0.65100783", "0.65027726", "0.6502719", "0.65024114", "0.64963216", "0.6495514", "0.6495514", "0.6495514", "0.64922684", "0.64911956", "0.6485137", "0.6467179", "0.64627767", "0.6460919", "0.6460919", "0.64593995", "0.64475703", "0.6444276", "0.6443685", "0.6443685", "0.6443685", "0.6443518", "0.6442736", "0.6436943", "0.6432066", "0.64276105", "0.64274883", "0.6424993", "0.64156187", "0.6410274", "0.64097255", "0.63964266", "0.63964266", "0.63964266", "0.63926053", "0.63898695", "0.6385019", "0.638412", "0.63811255", "0.6379241", "0.6373277", "0.6366765", "0.6363656", "0.6360756", "0.63601464", "0.6358114", "0.635484", "0.635484", "0.6348293", "0.6345835", "0.6342086", "0.63354146", "0.63231856", "0.63137996", "0.63137996", "0.6311634", "0.6308909", "0.63063055", "0.6305791", "0.6302975", "0.6300184", "0.6293674", "0.6291854", "0.6289079", "0.6280419", "0.6271924", "0.62696695", "0.6258326" ]
0.0
-1
rootselector allow for linktracking on ajax loaded content
function linktracking($rootselector) { // console.log("... RUNNING LINK TRACKING ON: " + $rootselector.selector); /* Begin JQuery link tracking */ // allows for link tracking to include a defined prefix for any given page if (typeof(trackingPrefix) != "string") {trackingPrefix = "";} else { trackingPrefix = "/" + trackingPrefix; } // find all A and AREA links to external sites, and enable onclick tacking var allLinks = $rootselector.find("A[href^='http'],AREA[href^='http']"); // must start with http (outgoing), but can't link back to visitphilly.com allLinks = allLinks.not("[class*='cboxElement']"); allLinks = allLinks.not("[href*='://dev.visitphilly.com']"); allLinks = allLinks.not("[href*='://stage.visitphilly.com']"); allLinks = allLinks.not("[href*='://visitphilly.serv']"); allLinks = allLinks.not("[href*='://visitphilly.com']"); allLinks = allLinks.not("[href*='://www.visitphilly.com']"); allLinks = allLinks.not("[href$='.pdf']"); allLinks = allLinks.not("[href$='.mp3']"); allLinks.each(function(i){ $(this).addClass("tracking"); $(this).click(function(e) { var thisHref = $(this).attr("href"); console.log(thisHref); thisHref = thisHref.replace("http://", ""); // remove http thisHref = thisHref.replace("https://", ""); // remove http if (thisHref.charAt(thisHref.length - 1) == "/") { // trim ending slash thisHref = thisHref.substr(0,thisHref.length - 1); } trackitem('/outbound/'+thisHref,this,e); }); var aHref = $(this).attr("href"); if(aHref.indexOf("youvisit.com") == -1) { // Open all external in new window // moved to before click atarget = $(this).attr("target"); if (empty(atarget)) { $(this).attr("target","_blank"); } } }); /* $(".youvisit_container").each(function(i){ $(this).addClass("tracking"); $(this).click(function(e) { _gaq.push(['_trackEvent', 'YouVisit', 'YouVisit','YouVisit']); }); });*/ var allPdf = $rootselector.find("a[href$='.pdf'],a[href$='.mp3']"); allPdf.each( function(i){ $(this).click(function(e) { var thisHref = $(this).attr("href"); thisHref = thisHref.replace("http://c0526532.cdn.cloudfiles.rackspacecloud.com/", ""); thisHref = thisHref.replace("http://www.visitphilly.com/", ""); trackitem('/downloads/' + thisHref,this,e); }); var aHref = $(this).attr("href"); if(aHref.indexOf("youvisit.com") == -1) { // Open all external in new window // moved to before click atarget = $(this).attr("target"); if (empty(atarget)) { $(this).attr("target","_blank"); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fancybox_nested_links() {\n\t\t$.get($(this).attr('href'), function(data){\n\t\t\t// pull out the html starting with div class=\"content\"\n\t\t\tvar x = $('div.content', data).html();\n\t\t\t// insert the new html\n\t\t\t$('#fancybox-content div.content').html(x);\n\t\t\t// register any new fancybox-nested links\n\t\t\t$('#fancybox-content a.fancybox-nested').click(fancybox_nested_links);\n\t\t});\n\n\t\treturn false;\n\t}", "function click(e) {\n //prevent all default clicks.\n //e.preventDefault();\n\n if (this.href.indexOf(\"_jcr_content\") === -1 && this.href.indexOf(\"jcr:content\") === -1) {\n var asynchronousPath = $(Cru.components.searchresults.className).data(\"asynchronous-path\");\n var a = $('<a>', { href:asynchronousPath } )[0];\n var path = a.href.split(\"/jcr:content\")[0];\n var selectors = this.href.split(path).pop();\n\n Cru.components.searchresults.refresh(asynchronousPath + selectors);\n } else {\n Cru.components.searchresults.refresh(this.href);\n }\n }", "function loadEventPage(selectorPattern) { \n\t\n jQuery(selectorPattern).each(function(index) {\n var a = jQuery(this);\n\t\t\t\n a.bind(\"click\", function (evt) {\n\n\t\t\t\tvar params = a.attr(\"rel\").replace(/\\r\\n\\s/g,\"\").toString(); \n\t\t\t\t\n var splitParams = params.split(\"&\");\n\t\t\t\t//data: \"module={$config[\"moduleOuputId\"]}&moduleParams={}&token={$config[\"token\"]}\",\n var postData = \"module={\\\"\" + splitParams[0] + \"\\\":{}}\\&\"+ splitParams[1]+\"&moduleParams={}\";\n var urlInput = splitParams[2] == \"''\" ? '' : splitParams[2];\n\t\t\t\tvar idBlogOutput=splitParams[0];\n\t\t\t\tvar tabContent = {};\n\n\t\t\t $.ajax({\n\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\turl: urlInput,\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\tdata: postData,\n\t\t\t\t\tsuccess: function(msg){\n\t\t\t\t\t//\t$(\"#\"+idBlogOutput).html(msg[idBlogOutput]);\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t if($(\"#\"+idBlogOutput)){\n \t\t\t $(\"#\"+idBlogOutput).html(msg.idBlogOutput['content']);\n\t\t\t\t\t\t\t }\n \t\t\t if($(\"#paging_\"+idBlogOutput)){\n \t\t\t $(\"#paging_\"+idBlogOutput).html(msg.{$config[idBlogOutput]}['paging']); \t\t\t\t\t\t }\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\tloadEventPage(selectorPattern);\n\t\t\t\t\t},error :function(err){\n\t\t\t\t\t\t//alert(err.message);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t\n return false;\n });\n });\n }", "function _ajaxLink($link) {\n var $target = $($link.data('target')),\n action = $link.data('ajax');\n\n $.ajax({\n url: $link.attr('href'),\n method: $link.data('method') || 'post',\n params: $link.data('params'),\n success: function (content) {\n if ($target.length) {\n if (action === 'remove') {\n $target.remove();\n\n } else if (action === 'success') {\n $target.toggleClass('bg-success');\n\n } else if (action === 'select') {\n $target.toggleClass('is-selected');\n\n } else if (action === 'replace') {\n $target.html(content);\n Skeleton.initContent($target);\n }\n }\n }\n });\n }", "function loadBlockPage(selectorPattern) { //selectorPattern must have format ' [selector] ul[class|id] > li > a '\n //jTab\n jQuery(selectorPattern).each(function(index) {\n var a = jQuery(this);\n\t\t\t\n a.bind(\"click\", function (evt) {\n\t\t\t\t\n\t\t\t\t//a.parent().parent().find(\"> li\").removeClass(\"ui-state-active\");\n // a.parent().addClass(\"ui-state-active\");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t//uZ2RhbnxQSFA&amp;token=07fd86969878e4damp&amp;firstname&amp;getData.php\n\t\t\t\tvar params = a.attr(\"rel\").replace(/\\r\\n\\s/g,\"\").toString(); // Thay the xuong hang\n\t\t\t\t\n var splitParams = params.split(\"&\");\n var postData = \"block={\\\"\" + splitParams[0] + \"\\\":{}}\\&\"+ splitParams[1];\n var urlInput = splitParams[2] == \"''\" ? '' : splitParams[2];\n\t\t\t\tvar idBlogOutput=splitParams[0];\n\t\t\t\t//alert(postData);\n var clientCallback = function (targetID, response) {\n // \n };\n \n\t\t\t var tabContent = {};\n\n\t\t\t $.ajax({\n\t\t\t type: \"POST\",\n\t\t\t url: urlInput,\n\t\t\t dataType: \"json\",\n\t\t\t data: postData,\n\t\t\t success: function(msg){\n\t\t\t \t\n\t\t\t\t\t\n\t\t\t\t\t//tabContent[tabName] = msg.items[tabName];\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t \t$(\"#\"+idBlogOutput).html(msg[idBlogOutput]);\n\t\t\t\t\tloadBlockPage(selectorPattern);\n\t\t\t },error :function(err){\n\t\t\t\t\t//alert(err.message);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t\t\n return false;\n });\n });\n }", "function _initialize() {\r\n\t\t\t_start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked\r\n\t\t\treturn false; // Avoid the browser following the link\r\n\t\t}", "function getAnchorTagsFromMarkup () {\n $('a');\n $('.link');\n $('[href=\"#\"]');\n $('#fizz > *');\n $('#foo *:not(div)');\n }", "function ajax_pagination() {\n // setup data-remote for page links\n $('.pagination a').attr('data-remote', 'true');\n\n // onclick setup container for ajax indicator\n $('.pagination a').live(\"click\", function () {\n $(this).html(\".....\");\n });\n}", "function _initialize() {\n\t\t\t_start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked\n\t\t\treturn false; // Avoid the browser following the link\n\t\t}", "function _initialize() {\n\t\t\t_start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked\n\t\t\treturn false; // Avoid the browser following the link\n\t\t}", "function make_async(){\n let anchors = document.querySelectorAll('a.async');\n\n anchors.forEach((anchor => {\n anchor.addEventListener('click', (a) => {\n a.preventDefault();\n\n fetchHTML(anchor.pathname);\n })\n }))\n}", "function t(o) {\n z.ajax({\n url: o.find(\"a.post-link\").attr(\"href\"),\n data: { justcontent: \"yes\" },\n dataType: \"text\",\n success: function (e) {\n var t = z(e).find(\".post-content\");\n null != o.attr(\"id\")\n ? (y[o.attr(\"id\")] = t)\n : (y[\"post-\" + o.data(\"id\")] = t),\n \"open\" == o.attr(\"data-lazyload\") && r(o),\n o.attr(\"data-lazyload\", \"loaded\");\n },\n });\n }", "function clickTree( ev ) {\n\t\t\t\t\tupdateLinkInTree( ev.currentTarget );\n\t\t\t\t}", "function intercept_links(selector) {\n $(selector).click(function(e) {\n var url = $(this).prop('href');\n\n //don't intercept external links or ones forced off\n if (this.host != location.host || $(this).hasClass(\"ext-link\") || $(this).attr(\"data-lightbox\")) {\n return;\n }\n\n //prevent link from clicking through\n e.preventDefault();\n\n //if we're linking to something on the same page\n if (this.protocol == location.protocol &&\n this.host == location.host &&\n this.pathname == location.pathname &&\n this.search == location.search) {\n \n //scoll to new anchor if one exists\n if (this.hash !== '' && this.hash !== '#') {\n\n //push new history state\n if (this.hash != location.hash) {\n history.pushState({url: url}, document.title, url);\n }\n\n //scroll to anchor\n window.scrollTo(0, $(this.hash).offset().top);\n }\n\n //don't do anything else if on the same page\n return;\n }\n\n //push new history state if link is valid\n history.pushState({url: url}, document.title, url);\n load_new_page(url);\n\n //clicking on a link should scroll to top\n //browser forward/back maintain scrolling positions\n window.scrollTo(0, 0);\n\t});\n}", "handleFactDeepLink() {\n if (location.hash.startsWith(\"#f-\")) {\n this.selectItem(location.hash.slice(3));\n }\n }", "function loadOrganizationTree(){\n\t$.ajax({\n\t type: \"GET\",\n\t url: \"organization/all\"\n\t}).done(function( msg ) {\n\t //Load the system manage tree\n\t allOrganizationTreeObj = $.fn.zTree.init($(\"#div_allOrganization_tree\"), allOrganizationTreeSetting, msg);\n\t //rename the\n\t var rootNode = allOrganizationTreeObj.getNodeByParam(\"id\",\"1\");\n\t rootNode.name = $(\"title\").html();\n\t allOrganizationTreeObj.refresh();\n\t //if selected a node, then append it ,else append the root node \n\t var selectedNode;\n\t if(selectedNodeId){\n\t\t selectedNode = allOrganizationTreeObj.getNodeByParam(\"id\",selectedNodeId);\n\t }else{\n\t\t selectedNode = allOrganizationTreeObj.getNodes()[0];\n\t }\n\t allOrganizationTreeObj.expandNode(selectedNode,true,false,false,false);\n\t //Select the node which id is selectedNodeId, then trigger the click event on it\n\t allOrganizationTreeObj.selectNode(selectedNode);\n\t //sometime it require the server twice, I wonder~\n\t $(\"#\"+selectedNode.tId+\"_a\").trigger(\"click\");\n\t});\n}", "get supportLink() {return $(\"//a[text()='Support']\")}", "function libraryLoadTab_home(selectorPattern){\n\t\n\t \n\t\tjQuery(selectorPattern).each(function(index) {\n\t\t\n\t\t\tvar a = jQuery(this);\n\t\t\tvar tabContent_library = {};\n a.bind(\"mouseover\", function (evt) {\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\n\t\t\t\ta.parent().parent().find(\"> li\").removeClass(\"ui-state-active\");\n a.parent().addClass(\"ui-state-active\");\n\t\t\t\t\n\t//MTkwODBA&token=04b5d384f6024ef2fc252e9112309daf&&amp;http://gunnynew.zing.vn/home/danh-sach.hinh-nen.html\n\t\t\t\tvar params = a.attr(\"rel\").replace(/\\r\\n\\s/g,\"\").toString(); // Thay the xuong hang\n\t\t\t\t//alert(params);\n var splitParams = params.split(\"&\");\n var postData = \"block={\\\"\" + splitParams[0] + \"\\\":{}}\\&\"+ splitParams[1];\n var urlInput = splitParams[3] == \"''\" ? '' : splitParams[3];\n\t\t\t\tvar idBlogOutput=splitParams[0];\n\t\t\t\tvar tabName=splitParams[2];\n\t\t\t\t \n\t\t\t\n\t\t\t\t if( !tabContent_library[tabName] ){\n\t\t\t\t\t$.ajax({\n\t\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\t\turl: urlInput,\n\t\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t\tdata: postData,\n\t\t\t\t\t\tsuccess: function(msg){\n\t\t\t\t\t\t\ttabContent_library[tabName]=msg[idBlogOutput]['content'];\n\t\t\t\t\t\t\t$(\"#\"+idBlogOutput).html(tabContent_library[tabName]);\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}else{\n\t\t\t\t\t$(\"#\"+idBlogOutput).html(tabContent_library[tabName]);\n\t\t\t\t}\n\t\t\t\n\t\t\t});\n\t\t});\n}", "_hijackLinks () {\n return $(document).on('click', 'a[data-route]', function (ev) {\n // Get the absolute anchor href.\n const $link = $(ev.currentTarget);\n const href = { prop: $link.prop('href'), attr: $link.attr('href') };\n // Get the absolute root.\n const root = location.protocol + '//' + location.host + Backbone.history.options.root;\n\n // Ensure the root is part of the anchor href, meaning it's relative.\n if (href.prop.slice(0, root.length) === root) {\n // Stop the default event to ensure the link will not cause a page\n // refresh.\n ev.preventDefault();\n\n // `Backbone.history.navigate` is sufficient for all Routers and will\n // trigger the correct events. The Router's internal `navigate` method\n // calls this anyways. The fragment is sliced from the root.\n return Backbone.history.navigate(href.attr, true);\n }\n });\n }", "function magicClickInterceptor(e) {\n e.preventDefault();\n \n var state = {};\n state.api = $(this).attr(\"href\").substring(6, $(this).attr(\"href\").length - 5);\n $.bbq.pushState(state);\n \n var _self = $(this);\n $(\"#apiHolder\").load($(this).attr(\"href\") + \" #documentation\", function(){\n $(\"#apiHolder\").removeClass(\"apiIntro\").removeClass(\"span9\");\n $(\"#documentation\").removeClass(\"span9\").addClass(\"span7\");\n ux();\n setupClicker();\n \n // handles dropping in from new link\n var section = $.bbq.getState(\"section\");\n if (section) {\n $(\"li#dropdown_\" + section.replace(/\\./g, '\\\\.') + \" a\").triggerHandler('click');\n }\n \n //setupDisqus(_self.attr(\"href\"));\n });\n }", "function processLinks() {\n $(document).find('*').each(function () {\n var localName = $(this)[0].localName;\n if (localName.startsWith(\"link-\")) {\n\n var parts = localName.split(\"-\");\n var txt = $(this).text() || parts[1];\n\n $(this).empty();\n $(this).append('<a href=\"#\" onclick=\"$(\\'#list-' + parts[1] + '-list\\').click()\">' + txt + '</a>');\n }\n })\n}", "function ajaxLoaded(data) {\r\n\t\tdebug('AjaxLoaded: '+this.url);\r\n\t\tmodal.tmp.html(currentSettings.selector\r\n\t\t\t?filterScripts($('<div>'+data+'</div>').find(currentSettings.selector).contents())\r\n\t\t\t:filterScripts(data));\r\n\t\tif (modal.tmp.html()) {\r\n\t\t\tmodal.dataReady = true;\r\n\t\t\tshowContentOrLoading();\r\n\t\t} else\r\n\t\t\tloadingError();\r\n\t}", "function ajaxLoaded(data) {\n debug('AjaxLoaded: '+this.url);\n modal.tmp.html(currentSettings.selector\n ?filterScripts($('<div>'+data+'</div>').find(currentSettings.selector).contents())\n :filterScripts(data));\n if (modal.tmp.html()) {\n modal.dataReady = true;\n showContentOrLoading();\n } else\n loadingError();\n }", "setupSubLinks() {\n for (let subLink in this.subLinks) {\n this.subLinks[subLink].addEventListener(\"click\", (e) => {\n let linkID = e.target.id;\n if (linkID === \"\") {\n linkID = e.target.parentNode.id;\n }\n let subViewToShow = linkID.slice(0, -5);\n this.showSubView(subViewToShow);\n });\n }\n }", "function menuLoadFirstBlock() {\n \"use strict\";\n\n var detailPageId = jQuery('.service-detail');\n console.log(detailPageId);\n\n if (detailPageId.length) {\n var IdValueServicePage = detailPageId.attr('data-id');\n console.log(IdValueServicePage);\n jQuery('#header-service-menu-list .item.item-' + IdValueServicePage + ' a.sub-section').trigger('click');\n } else {\n jQuery('#header-service-menu-list .item:last-child a.sub-section').trigger('click');\n }\n} // ---------------------------------------------------------", "function loadAux() {\n\t\t\t\t\t var $aux = $('.aux');\n\t\t\t\t\t $aux.each(function(index) {\n\t\t\t\t\t var $this = $(this);\n\t\t\t\t\t\t var auxLink = $this.find('a');\n\t\t\t\t\t\t var auxFragment = auxLink.attr('href');\n\t\t\t\t\t\t\t var auxContent = $this.find('[role=tabpanel]');\n\t\t\t\t\t\t\t if (auxContent.size()===0 && $this.hasClass('loaded')===false) {\n\t\t\t\t\t\t\t\t loadContent(auxFragment,$this);\n\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\t }", "function shAjaxifyLinks(elementId) {\n\tvar container = null;\n\tif (elementId) {\n\t container = document.getElementById( elementId);\n\t}\n\tvar links = null;\n\tif (container) {\n\t // restrict search to only part of the document\n\t links = container.getElementsByTagName('a');\n\t} else {\n\t links = document.getElementsByTagName('a');\n\t} \n\tif (links) {\n\t \t// search for links with class=shajaxLinkXXXXX \n\t \tvar aClass = '';\n\t \tvar aRel ='';\n\t\tfor(var i=0;i<links.length;i++){\n\t\t\taClass = links[i].className;\n\t\t\taRel = links[i].rel;\n\t\t\tif (aClass && aRel && aClass.substr(0, 10)=='shajaxLink') {\n\t\t\t\tlinks[i].name='#'+aClass;\n\t\t\t\t// this is one of our links. insert an onclick handler\n \t\t\tlinks[i].onclick=function() {\n \t\t\t\t// find about the link : does it map to something else\n \t\t\t var aLink = this.href;\n \t\t\t if (typeof( shajaxUrlMap) != 'undefined') {\n \t\t\t \tif ( shajaxUrlMap[this.className]) {\n \t\t\t \t\taLink = shajaxUrlMap[this.className];\n \t\t\t }\n \t\t\t } \n \t\t\t\t// make sure we have an absolute link\n\t\t\t\t\tif (shajaxLiveSiteUrl && aLink.substr( 0, 7) != 'http://' && aLink.substr( 0, 9) == 'index.php') {\n\t\t\t\t\t\t// prepend live site url\n\t\t\t\t\t\taLink = shajaxLiveSiteUrl + aLink;\n\t\t\t\t\t}\n \t\t\t\tshajax( aLink, this.rel, 'format=raw&tmpl=component', 'shajaxProgress'+this.className.substr(10));\n \t\t\t\t// and remove the actual link\t\n \t\t\tthis.href='#' + this.className;\n \t\t\t// return false, otherwise don't work when base tag is wrong\n \t\t\treturn false;\n \t\t}\n \t\t}\n \t}\n\t}\n}", "get hyperLink() { return $(\"//a[contains(text(),'Site Map')]\") }", "function maybe_populate_folder_contents( anchor ) {\n\t\tvar container = $( anchor ).closest( '.toggleable' ).find( '.toggle-content.folder-loop' ).first();\n\n\t\t// If the folder content has already been populated, do nothing.\n\t\tif ( $.trim( container.text() ).length ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Do not continue if we are currently fetching a set of results.\n\t\tif ( fetching_folder_contents !== false ) {\n\t\t\treturn;\n\t\t}\n\t\tfetching_folder_contents = true;\n\t\tcontainer.addClass( 'loading' );\n\n\t\t// Make the AJAX request and populate the list.\n\t\t$.ajax( {\n\t\t\turl: ajaxurl,\n\t\t\ttype: 'GET',\n\t\t\tdata: {\n\t\t\t\tfolder: $( anchor ).data( 'folder-id' ),\n\t\t\t\tgroup_id: $( '#directory-group-id' ).val(),\n\t\t\t\tuser_id: $( '#directory-user-id' ).val(),\n\t\t\t\taction: 'bp_docs_get_folder_content',\n\t\t\t},\n\t\t\tsuccess: function( response ) {\n\t\t\t\t$( container ).html( response );\n\t\t\t\tset_folder_related_colspans();\n\t\t\t\tfetching_folder_contents = false;\n\t\t\t\tcontainer.removeClass( 'loading' );\n\t\t\t}\n\n\t\t} );\n\n\t}", "function hellYeah(text) { //connected with Start CLick assign 931\r\n//alert(text);\r\nvar b=$(event.target); //$(location).attr('href'); //.prev()\r\nvar bb=$(document.documentElement).find('a')/*.attr('href')*/.length; //alert(bb);\r\nalert(\"There are \" +bb /* +$('a').length*/ + \" links on this page \");\r\n //document.getElementById(\"text-holder\").innerHTML = text;\r\n}", "function qll_module_ajax()\r\n{\r\n\r\n\taddJS('http://www.erepublik.com/js/jquery-1.3.2.min.js','head');\r\n\taddJS('http://www.erepublik.com/js/jquery.history.plugin.js','head');\r\n\taddJS('http://www.erepublik.com/js/exchange/filters.js','head');\r\n\taddJS('http://www.erepublik.com/js/exchange/historyList.js','head');\r\n\taddJS('http://www.erepublik.com/js/exchange/currency.js','head');\r\n\taddJS('http://www.erepublik.com/js/exchange/listOffers.js','head');\r\n\r\n\taddJS('http://economy.erepublik.com/js/uncompressed.jquery.dd.js','head');\r\n\taddJS('http://economy.erepublik.com/js/jquery.tools.min.js','head');\r\n\taddJS('http://economy.erepublik.com/js/ui.core.js','head');\r\n\taddJS('http://economy.erepublik.com/js/ui.slider.js','head');\r\n\taddJS('http://economy.erepublik.com/js/jquery.blockUI.js','head');\r\n\taddJS('http://economy.erepublik.com/js/Market/marketplace.js','head');\r\n\taddJS('http://economy.erepublik.com/js/numberChecks.js','head');\r\n\taddCSS('http://www.erepublik.com/css/cmp/marketplace.css','head');\r\n\r\n\t//$(\"#content a\").each(function(){\r\n\t$(\"a\").each(function(){\r\n\t\tif($(this).attr(\"href\") == \"#\")\r\n\t\t\treturn;\r\n\t\t$(this).click(function(event){\r\n\t\t\tevent.preventDefault()\r\n\t\t\tqll_module_ajax_perform($(this).attr(\"href\"))\r\n\t\t});\r\n\t\t\r\n\t});\r\n}", "function InitCategoriesTreeView() \r\n{\r\n var treeNodes = document.body.getElementsByTagName('a');\r\n for (i = 0; i < treeNodes.length; i++) \r\n {\r\n //Search the node. \r\n var searchExpandPosition = treeNodes[i].id.search(regexExpand); \r\n \r\n //Attach event to expand/collapse link.\r\n if (searchExpandPosition >= 0) \r\n {\r\n var anchorExpand = document.getElementById(treeNodes[i].id);\r\n var clickExpandEventHandler = anchorExpand.onclick;\r\n anchorExpand.onclick = function(){OnCategoryExpandCollapse(this);if (!!clickExpandEventHandler)clickExpandEventHandler;};\r\n } \r\n }\r\n}", "constructor(){\n\t\tjavascriptAlertsLink = Selector('#content ul li a').withText('JavaScript Alerts');\n\t}", "function fetch_child_groups( anchor ) {\n\t\tvar target = anchor.closest( \".child-groups-container\" ).find( \".child-groups\" ).first();\n\n\t\t// If the folder content has already been populated, do nothing.\n\t\tif ( $.trim( target.text() ).length ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Do not continue if we are currently fetching a set of results.\n\t\tif ( fetching_child_groups !== false ) {\n\t\t\treturn;\n\t\t}\n\t\tfetching_child_groups = true;\n\n\t\t// Show a loading indicator.\n\t\ttarget.addClass( \"loading\" );\n\n\t\t// Make the AJAX request and populate the list.\n\t\t$.ajax({\n\t\t\turl: ajaxurl,\n\t\t\ttype: \"GET\",\n\t\t\tdata: {\n\t\t\t\tparent_id: anchor.data( \"group-id\" ),\n\t\t\t\taction: \"hgbp_get_child_groups\",\n\t\t\t},\n\t\t\tsuccess: function( response ) {\n\t\t\t\t/*\n\t\t\t\t * Upon success, flow the html into the target container.\n\t\t\t\t * Also fire an event so other javascript can respond if needed, like\n\t\t\t\t * jQuery( \".child-groups\" ).on( \"childGroupsContainerPopulated\", function(){ console.log( \"doing something\" ); });\n\t\t\t\t */\n\t\t\t\t$( target ).html( response ).trigger( \"childGroupsContainerPopulated\" );\n\t\t\t}\n\t\t})\n\t\t.done( function( response ) {\n\t\t\tfetching_child_groups = false;\n\t\t\ttarget.removeClass( \"loading\" );\n\t\t});\n\n\t}", "function loadContent(href) {\r\n\t$('.menuOption').removeClass('selected');\r\n\t$('#'+href+'Menu').addClass('selected');\r\n\r\n\t$('.resumeSection').hide();\r\n\t$('#'+href).show();\r\n}", "linksHandler() {\n\t\treplaceLinks(this.content, (href) => {\n\t\t\tthis.emit(EVENTS.CONTENTS.LINK_CLICKED, href);\n\t\t});\n\t}", "function GlobalSiteAutoCompleteRootPage() {\n\n\tGlobalSiteAutoCompleteChildPage();\n\n}", "function loadgroupbuttons(findings){\n\n $('.selector').change(function () {\n //Show loading text\n $('.loading', window.parent.frames[0].document).css(\"display\", \"block\");\n /*Switch to findings view*/\n if ($('.package_explorer').is(\":visible\")){\n $('.package_explorer').hide();\n }\n $('.findings').hide();\n jQuery.jstree._reference('.findings').destroy(); //Destroy the jstree\n $('.findings').empty(); //Clear the DOM\n display_all(findings, $(this).prop('value'));\n });\n\n}", "function fnDisplayVisitedContentDetails() {\n try {\n $('#search').on('deferredQuerySuccess', function(e, result) {\n\n //Assign event to capture the click\n if ($(\"[class^='CoveoResultLink']\").length != 0) {\n $(\"[class^='CoveoResultLink']\").bind('click', fnContentVistedInsertOrUpdateData);\n }\n\n var elements = $('.CustomContentVisited');\n\n for (var k = 0; k < elements.length; k++) {\n if ($(elements[k]).attr('data-customContentURL').length > 0) {\n var itemURL = $(elements[k]).attr('data-customContentURL').trim().toString().toLowerCase();\n //itemURL = itemURL.split(/[?#]/)[0];\n fnGetVisitedContentDetails(itemURL, elements[k], $.cookie(\"coveo_visitorId\"));\n }\n }\n });\n\n $('.CoveoResultList').on('newResultDisplayed', fnDisplayVisitedContentDetailsForShowMore);\n\n } catch (err) {\n console.log('fnDisplayVisitedContentDetails : ' + err.message);\n }\n}", "function displayLinks() {\n $('[data-type=gallery] .image').each(function(index, item) {\n const link = $('a', item.parentNode);\n if (!link.get(0)) return;\n\n item = $(item);\n item.addClass('clickable');\n item.data('href', link.attr('href'));\n item.on('click', goto_article);\n });\n\n function goto_article(event) {\n let el = event.currentTarget;\n window.location = $(el).data('href');\n }\n}", "function loadContent() {\n $.ajax({\n url: 'ajax-get-page-content',\n type: 'GET',\n data: $data,\n beforeSend: function() {},\n success: function(response) {\n $('div#main-content').html(response);\n location.hash = $data.page || '';\n },\n complete: function(response) {\n loadModuleScript();\n }\n });\n }", "function setUpClickListeners() {\n $(\"#content a\").live('click', function() { //If links point to galleries, make them use getContent.\n var href = $(this).attr('href');\n if(href.indexOf(\"image/tid\") > -1) {\n var id = href.split(\"/\")[3];\n getContent(id);\n return false;\n }\n });\n $('.galleria-images .galleria-image img').live('click', function() { //Make images clickable. This is to make up for the\n window.open($(this).attr('src'), '_blank'); //wrapping a-tag removed above.\n });\n }", "_initAnchors() {\n //\tInvoke \"before\" hook.\n this.trigger('initAnchors:before');\n document.addEventListener('click', evnt => {\n /** The clicked element. */\n var target = evnt.target.closest('a[href]');\n if (!target) {\n return;\n }\n /** Arguments passed to the bound methods. */\n var args = {\n inMenu: target.closest('.mm-menu') === this.node.menu,\n inListview: target.matches('.mm-listitem > a'),\n toExternal: target.matches('[rel=\"external\"]') ||\n target.matches('[target=\"_blank\"]')\n };\n var onClick = {\n close: null,\n setSelected: null,\n preventDefault: target.getAttribute('href').slice(0, 1) == '#'\n };\n //\tFind hooked behavior.\n for (let c = 0; c < this.clck.length; c++) {\n let click = this.clck[c].call(this, target, args);\n if (click) {\n if (typeof click == 'boolean') {\n evnt.preventDefault();\n return;\n }\n if (type(click) == 'object') {\n onClick = extend(click, onClick);\n }\n }\n }\n //\tDefault behavior for anchors in lists.\n if (args.inMenu && args.inListview && !args.toExternal) {\n //\tSet selected item, Default: true\n if (valueOrFn(target, this.opts.onClick.setSelected, onClick.setSelected)) {\n this.setSelected(target.parentElement);\n }\n //\tPrevent default / don't follow link. Default: false.\n if (valueOrFn(target, this.opts.onClick.preventDefault, onClick.preventDefault)) {\n evnt.preventDefault();\n }\n //\tClose menu. Default: false\n if (valueOrFn(target, this.opts.onClick.close, onClick.close)) {\n if (this.opts.offCanvas &&\n typeof this.close == 'function') {\n this.close();\n }\n }\n }\n }, true);\n //\tInvoke \"after\" hook.\n this.trigger('initAnchors:after');\n }", "function _onPageLoadOuter() {\n // Back-forward navigation can add nodes: create a clean slate.\n removeAddedNodes(); // defined by application.\n onPageLoad(); // defined by application.\n}", "function initial() {\n\t$('.load-to-content').off('click');\n\t$('.load-to-content').on('click', function (event) {\n\t\tevent.preventDefault();\n\t\tlet url = $(this).attr('href');\n\t\tloadContent(url, 'get');\n\t});\n\n\t// Ketika form di submit\n\t$('form.form-load-to-content').on('submit', function (event) {\n\t\tevent.preventDefault();\n\t\tlet url = $(this).attr('action');\n\t\tloadContent(url, 'post', new FormData(this));\n\t});\n}", "function letsJQuery() {\r\n alert(\"Loaded!\");\r\n $(\"a[id*='.editLink']\").alert(\"Editing an event!\");\r\n}", "function loadMenu() {\n GetPage('treemenu.html', \n function(pResponse) { \n $(\"#menu\").jstree({\n \"plugins\" : [ \"themes\", \"html_data\", \"ui\", \"cookies\"],\n \"cookies\" : {\n \"save_opened\" : \"evolved_tree\",\n \"save_selected\" : \"evolved_selected\",\n \"auto_save\" : true\n },\n \"themes\" : {\n \"theme\" : \"apple\",\n \"dots\" : true,\n \"icons\" : false\n },\n \"html_data\" : {\n \"data\" : pResponse\n }\n });\n ShowLoading(false);\n AttachLinkEvents();\n \n var goTo = $.query.get('GoTo');\n if(goTo) {\n ShowPage(unescape(goTo));\n } else {\n GetPage('welcome.html', \n function(pResponse) {\n $('#page').html(pResponse);\n AttachLinkEvents();\n }\n );\n }\n }\n );\n}", "function applyAjaxTabControl (selectorPattern) { //selectorPattern must have format ' [selector] ul[class|id] > li > a '\n //jTab\n\t\t\n jQuery(selectorPattern).each(function(index) {\n var a = jQuery(this);\n\t\t\t var tabContent = {};\n a.bind(\"mouseover\", function (evt) {\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\n\t\t\t\ta.parent().parent().find(\"> li\").removeClass(\"ui-state-active\");\n a.parent().addClass(\"ui-state-active\");\n\t\t\t\t\n\t//uZ2RhbnxQSFA&amp;token=07fd86969878e4damp&amp;firstname&amp;getData.php\n\t\t\t\tvar params = a.attr(\"rel\").replace(/\\r\\n\\s/g,\"\").toString(); // Thay the xuong hang\n\t\t\t\t//alert(params);\n var splitParams = params.split(\"&\");\n var postData = \"block={\\\"\" + splitParams[0] + \"\\\":{}}\\&\"+ splitParams[1];\n var urlInput = splitParams[3] == \"''\" ? '' : splitParams[3];\n\t\t\t\tvar idBlogOutput=splitParams[0];\n\t\t\t\tvar tabName=splitParams[2];\n\t\t\t\t \n \n var clientCallback = function (targetID, response) {\n // \n };\n \n\t\t\t \n\t\t\t\t\n\t\t\t if( !tabContent[tabName] ){\n\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\t\turl: urlInput,\n\t\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t\tdata: postData,\n\t\t\t\t\t\tsuccess: function(msg){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//alert(msg.items.firstname);\n\t\t\t\t\t\t\t//tabContent[tabName] = msg.items[tabName];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttabContent[tabName]=msg[idBlogOutput];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"#\"+idBlogOutput).html(tabContent[tabName]);\n\t\t\t\t\t\t},error :function(err){\n\t\t\t\t\t\t\t//alert(err.message);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\n\t\t\t }\n\t\t\t else {\n\t\t\t\t\t$(\"#\"+idBlogOutput).html(tabContent[tabName]);\n\t\t\t }\n\t\t\t\treturn false;\n\t\t\t});\n\t\t\t\n });\n }", "function loadContent(_targetKey){\r\n\t$.ajax({\r\n\t\turl:'pages/'+_targetKey+'.html',\r\n\t\tcache:false,\r\n\t\tsuccess:function(data){\r\n\t\t\t$('.content').empty();\r\n\t\t\t$('.content').html(data);\r\n\t\t}\r\n\t});\r\n}", "function selectAndExecute(hash, cb) {\n if (location.hash == \"#/\" + hash) {//we're already here\n if (cb) cb();\n } else {\n executeOnContentLoad = cb;\n contentLoadDestination = null;\n if (hash.indexOf(\"st/\") === 0) {//setting hash does not work for type \"st\"\n var listId = hash.substr(3);\n if (!clickListCard(listId)) {\n selectAndExecute(\"rd\", function() {//try to find it on the mixes page\n executeOnContentLoad = cb;//set again (was overwritten by the recursive call)\n if (!clickListCard(listId)) {//still not found\n executeOnContentLoad = null;\n if (cb) cb(true);\n }\n });\n }\n } else {\n location.hash = \"/\" + hash;\n }\n }\n }", "async connectedCallback() {\n this.append(this.cssTemplate());\n await this.fetchData()\n let links = this.querySelectorAll(\"a\");\n links.forEach(link => this.addCustomEvent(link));\n }", "function loadContentClick () {\n\t\t$feedOverlay.removeClass(\"hidden\");\n\t\tMassIdea.loadHTML(SEL_CONTENT, URL_LOAD_FEED, function () {\n\t\t\t$feedOverlay.addClass(\"hidden\");\n\t\t});\n\t}", "function loadRightContent(event, isComp) {\n\t\t\tif (target_div.target != \"empty\") {\n\t\t\t\twindow.history.pushState({}, document.title, getBase(window.location.href) + '?src=' + event.target );\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t\t//url variables sort by rating - ratings plugin\n\t\t\t\tvar vars = \"?r_sortby=highest_rated&amp;r_orderby=desc #content\";\n\t\t\t\tjQuery(\"#\" + target_div.target).load(event.target + vars, function() {\n\t\t\t\t\tjQuery(\"#\" + target_div.target).append(\"<div style='clear:both'/>\");\n\t\t\t\t\tbackToTop();\n\t\t\t\t\tjQuery(\".pagination\").click(function(event) {\n\t\t\t\t\t\tloadRightContent(event, isComp);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\t\n\t\t}", "['click .method-container a'](e, $el) {\n\t\tToc.goToHash($el.attr('href'));\n\t}", "_init() {\n const id = this.$element[0].id || GetYoDigits(6, 'smooth-scroll-with-links');\n this.$element.attr({ id });\n\n this._events();\n }", "function addListen() {\r\n if (document.getElementById(\"related_adsLazyLoad\")) {\r\n document.getElementById(\"related_adsLazyLoad\").addEventListener(\"DOMSubtreeModified\", eventRerun, false);\r\n }\r\n // Your Recent History\r\n // not working, right now\r\n if (document.getElementById(\"rhf\")) {\r\n document.getElementById(\"rhf\").addEventListener(\"DOMSubtreeModified\", eventRerun, false);\r\n }\r\n // Main node for product results for browsing pages\r\n if (document.getElementById(\"rightResultsATF\")) {\r\n document.getElementById(\"rightResultsATF\").addEventListener(\"DOMSubtreeModified\", eventRerun, false);\r\n }\r\n}", "function loadUrlBeforeCallback(url, targetId, options, next)\n{\n\tvar target = sal.getTargetByAttr(\"id\", targetId);\n\tif(targetId.indexOf(\"main\") === 0)\n\t{\n\t\tnext();\n\t}\n\tif(targetId.indexOf(\"content-\") === 0)\n\t{\n\t\tnext();\n\t}\n\tif(targetId.indexOf(\"subcontent-\") === 0)\n\t{\n\t\tnext();\n\t}\n}", "function loadUrlAfterCallback(url, targetId, options, response, next)\n{\n\tvar target = sal.getTargetByAttr(\"id\", targetId);\n\tvar targetArray = target.getElements();\n\tvar eResponse = document.createElement(\"div\");\n\teResponse.innerHTML = response;\n\t\n\tfor(var key in targetArray)\n\t{\n\t\tvar elem = targetArray[key];\n\t\tvar objToReplace = eResponse.querySelectorAll(\".ajaxContent[assetid=\" + target.id + \"]\")[0]\n\t\t\t\t\t\t\t.cloneNode(true);\n\t\telem.parentNode.replaceChild(objToReplace, elem); \n\t}\n\t\n\t// remember to update history! this function will do it if necessary... (options.doPushState)\n\tsal.updateHistory(url, target, options, eResponse);\n\t\n\tif(targetId.indexOf(\"main\") === 0)\n\t{\n\t\tnext();\n\t}\n\tif(targetId.indexOf(\"content-\") === 0)\n\t{\n\t\tnext();\n\t}\n\tif(targetId.indexOf(\"subcontent-\") === 0)\n\t{\n\t\tnext();\n\t}\n}", "function ajaxLinks(){\n $('.ajaxForm').submitWithAjax();\n $('a.get').getWithAjax();\n $('a.post').postWithAjax();\n $('a.put').putWithAjax();\n $('a.delete').deleteWithAjax();\n}", "function cb_contentLoaded(cb) {}", "function initElementGroupFilter(){\n\t$('ul.elementGroupFilter').each(function() { //get the ul elements having elementGroupFilter class(filtering tabs)\n\t\t\n\t\t// For each set of tabs, we want to keep track of which tab is active and it's associated content\n\t\tvar active, links = $(this).find('a');\n\n\t\t// If the location.hash matches one of the links, use that as the active tab.\n\t\t// If no match is found, use the first link as the initial active tab.\n\t\tactive = $(links.filter('[href=\"' + location.hash + '\"]')[0]|| links[0]);\n\t\tactive.parent().addClass('NSelect');\t\t\n\n\t\t// Bind the click event handler\n\t\t$(this).on('click', 'a', function(e) {\n\t\t\t// Make the old tab inactive.\n\t\t\tactive.parent().removeClass('NSelect');\n\n\t\t\t// Update the variables with the new link and content\n\t\t\tactive = $(this);\t\t\t\n\n\t\t\t// Make the tab active.\n\t\t\tactive.parent().addClass('NSelect');\n\t\t\t// $content.show();\n\n\t\t\t// Prevent the anchor's default click action\n\t\t\te.preventDefault();\n\n\t\t\tdoElementGroupFiltering($(this).attr('id'));\n\t\t});\n\t\tactive.click();\n\t});\n}", "function loadPartial() {\n $(\"#dynamic_content_container\").html('<div class=\"module loading\"><h2>Loading...</h2><img src=\"/assets/load.gif\" /></div>');\n window.scrollTo(0, 0);\n $.ajax({\n \turl: window.location.hash.replace(\"#!\", \"\"),\n \tsuccess: function(data) {\n \t $(\"#dynamic_content_container\").html(data);\n \t},\n \terror: function(data) {\n \t var div = $(\"<div class='module'><h2>Requested page could not be loaded</h2><a href='/#!/home'>Go home</a></div>\");\n \t $(\"#dynamic_content_container\").html(div);\n \t},\n \tdataType: \"html\",\n\t timeout: 10000\n });\n}", "function selectNode(event){\n item = $(event.toElement).closest('.literal-sequence, .literal, .capture-group, .charset, .digit, .non-digit, .word, .non-word, .white-space, .non-white-space, .start, .end, .space, .any-character, .word-boundary ');\n\n itemID = item.attr('id');\n }", "get cartLink() { return $('//a[contains(@href, \"/cart\")]'); }", "function getChildrenId(response)\r\n{\r\n\tif ( response.indexOf(\"<div id=\\\"endnode\\\"\")==0)\r\n\t{\r\n\t\tvar indexString = null;\r\n\t\tvar docViewId = null;\r\n\t\tindexString = response.substring(response.indexOf(\"is=\")+3,response.indexOf(\" \",response.indexOf(\"is=\")));\r\n\t\tdocViewId = response.substring(response.indexOf(\"dv=\")+3,response.indexOf(\" \",response.indexOf(\"dv=\")));\r\n//\t\tloadWorkArea('menu.do','NAV-MENU&docViewId='+docViewId+'&searchBy='+indexString);\r\n// Tracker#: 14883\r\n// left side nav was not getting refreshed when final node reached\r\n\t\tloadWorkArea('menu.do','NAV-MENU&docViewId='+docViewId+'&searchBy='+indexString,'',loadNavigationGrid);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tgetElemnt(menuId).innerHTML = response;\r\n\t}\r\n}", "function bindingArticleClick() {\n $('#rovat .content a').bind('click', function (event, ui) {\n document.getElementById(\"article-content\").src = this.dataset.url;\n });\n}", "function _nodeClickHandler(options, pid, el) {\n var container = el.parent();\n var child = container.children('ul');\n if (child.size() > 0) {\n if (child.is(':hidden')) {\n child.show();\n el.addClass('ui-tree-root-expanded').removeClass('ui-tree-root');\n } else {\n child.hide();\n el.addClass('ui-tree-root').removeClass('ui-tree-root-expanded');\n }\n } else {\n el.addClass('ui-tree-root-expanded').removeClass('ui-tree-root');\n $.ajax({\n url: options.url,\n beforeSend: options.beforeOpen,\n error: options.openError,\n dataType: options.dataType,\n data: (options.nodeParameterName + '=' + pid),\n success: function(data) {\n if (options.dataType = 'json') {\n _buildFromJson(data, container, options);\n if (options.openingFinished) {\n options.openingFinished(pid);\n }\n } else {\n alert('data type not implemented');\n }\n }\n });\n }\n }", "componentDidMount() {\n document.querySelectorAll(\"a[href^='#']\").forEach(node => {\n node.addEventListener('click', e => {\n e.preventDefault();\n });\n })\n }", "function fireLinksEvents(){\n\t$(\".showMutualLinks\").click(function(){\n\t\t__addOverlay();\n\t\tvar uid = $(\"input#userId\").val();\n\t\tjQuery.ajax({\n\t url: \"/\" + PROJECT_NAME + \"profile/mutual-links-listing\",\n\t type: \"POST\",\n\t dataType: \"json\",\n\t data : \"uid=\"+uid,\n\t success: function(jsonData) \n\t {\n\t \t__removeOverlay();\n\t \t$(\".mutual-links-listing\").empty();\n\t \t$(\".links-listing\").empty();\n\t \t$(\".links-listing\").empty();\n\t \t\n\t \t\n\t \tvar html=\"\";\n\t \tif(jsonData.mutual_links!=\"\")\n\t \t{\n\t \t\thtml+=jsonData.mutual_links;\n\t \t}\n\t \telse\n\t \t{\n\t \t\thtml+='<div id=\"links-profie\" class=\"accord-content purple-header-bot\" style=\"display: block; text-align: left;font-family:arial;color: #7F7F7F !important; padding-left: 3% !important;font-weight: bold;\">No Mutual Links.</div>';\t\n\t \t}\n\t \t$(\".showMutualLinks\").removeClass('inactiveLink');\n\t \t$(\".showLinks\").addClass('inactiveLink');\n\t \t$(\".mutual-links-listing\").append(html);\n\t \t$(\".mutual-links-listing\").fadeIn();\n\t\t\t},\n\t error: function(xhr, ajaxOptions, thrownError) \n\t {\n\t\t\t\talert(thrownError + \"\\r\\n\" + xhr.statusText + \"\\r\\n\" + xhr.responseText);\n\t\t\t}\n\t });\n\t});\t\n\t// click on all links\n\t$(\".showLinks\").click(function(){\n\t\t__addOverlay();\n\t\tvar uid = $(\"input#userId\").val();\n\t\tjQuery.ajax({\n\t url: \"/\" + PROJECT_NAME + \"profile/links-profile-listing\",\n\t type: \"POST\",\n\t dataType: \"json\",\n\t data : \"uid=\"+uid,\n\t success: function(jsonData) {\n\t \t__removeOverlay();\n\t \t$(\".mutual-links-listing\").empty();\n\t \t$(\".links-listing\").empty();\n\t \tvar html=\"\";\n\t \tif(jsonData!=0){\n\t \t\thtml+=jsonData.links;\n\t \t}\n\t \telse{\n\t \t\thtml+='No Links';\t\n\t \t}\n\t \t$(\".showLinks\").removeClass('inactiveLink');\n\t \t$(\".showMutualLinks\").addClass('inactiveLink');\n\t \t$(\".links-listing\").append(html);\n\t \t$(\".links-listing\").fadeIn();\n\t\t\t},\n\t error: function(xhr, ajaxOptions, thrownError) \n\t {\n\t\t\t\talert(thrownError + \"\\r\\n\" + xhr.statusText + \"\\r\\n\" + xhr.responseText);\n\t\t\t}\n\t });\n\t});\t\n}", "function highlight_load() {\n\tvar frag = location.hash.substring(1);\n\n\tfrag_highlight(frag);\n\trules_aliases_highlight(frag);\n}", "function qwerySelector (cssQuery, context) {}", "onContentLoading() {\r\n // Stub\r\n }", "onEnterDOM() {}", "function loadFirstLevel() {\n var addRA = \"\"\n if (activeOnly) {\n addRA = \"A\";\n }\n $j.ajax({\n url: getResearchAreaAjaxCall(),\n type: 'GET',\n dataType: 'html',\n cache: false,\n data: 'researchAreaCode=000001&addRA=' + addRA,\n async: false,\n timeout: 1000,\n error: function () {\n alert('Error loading XML document');\n },\n success: function (xml) {\n $j(xml)\n .find('h3')\n .each(\n function () {\n var item_text = $j(this).text();\n icur++;\n var racode = item_text.substring(0,\n item_text.indexOf(\"%3A\"))\n .trim();\n var activeflag = item_text.substring(\n item_text.indexOf(\"%4A\") + 3)\n .trim();\n item_text = item_text.replace(\"%3A\",\n \":\");\n item_text = item_text.substring(0,\n item_text.indexOf(\"%4A\"))\n .trim();\n var id = \"item\" + icur;\n var tagId = \"listcontrol\" + icur;\n var divId = \"listcontent\" + icur;\n\n // NOTES : if use 'div', then FF will\n // display the '+' and idDiv in\n // separate lines. IE7 is fine\n // But 'IE7 has problem with 'span'\n var idDiv;\n //if (jQuery.browser.msie) {\n if(navigator.appName == 'Microsoft Internet Explorer') {\n idDiv = $j('<div></div>').attr(\"id\",\n \"itemText\" + icur).html(\n item_text);\n } else {\n idDiv = $j('<span>').attr(\"id\",\n \"itemText\" + icur).html(\n item_text);\n }\n var tag = $j(\n '<a style = \"margin-left:2px;\" ></a>')\n .attr(\"id\", tagId).html(idDiv);\n var div = $j(\n '<div class=\"hierarchydetail\" style=\"margin-top:2px; \"></div>')\n .attr(\"id\", divId);\n var hidracode = $j(\n '<input type=\"hidden\" id = \"racode\" name = \"racode\" />')\n .attr(\"id\", \"racode\" + icur).attr(\n \"name\", \"racode\" + icur)\n .attr(\"value\", racode);\n hidracode.appendTo(div);\n var hidactiveflag = $j(\n '<input type=\"hidden\" id = \"activeflag\" name = \"activeflag\" />')\n .attr(\"id\", \"activeflag\" + icur).attr(\n \"name\", \"activeflag\" + icur)\n .attr(\"value\", activeflag);\n hidactiveflag.appendTo(div);\n tag\n .click(function () {\n $j(\n \".hierarchydetail:not(#\"\n + divId\n + \")\")\n .slideUp(300);\n var idx = $j(this)\n .attr(\"id\")\n .substring(11);\n if ($j(this)\n .siblings(\n 'div:eq(1)')\n .children(\n 'table:eq(0)')\n .size() == 0) {\n tableTag(item_text,\n \"item\" + idx)\n .appendTo(\n $j(\"#listcontent\"\n + idx));\n if ($j(\"#\" + divId).is(\n \":hidden\")) {\n $j(\n \"#listcontent\"\n + idx)\n .show();\n // $j(\"#listcontent\"+idx).slideToggle(300);\n }\n } else {\n $j(\"#listcontent\" + idx)\n .slideToggle(\n 300);\n }\n\n loadChildrenRA(item_text,\n tagId);\n });\n var listitem = $j(\n '<li class=\"closed\"></li>')\n .attr(\"id\", id).html(tag);\n ulTagId = \"researcharea\";\n div.appendTo(listitem);\n // need this ultag to force to display\n // folder.\n var childUlTag = $j('<ul></ul>').attr(\n \"id\", \"ul\" + icur);\n childUlTag.appendTo(listitem);\n listitem.appendTo('ul#researcharea');\n // also need this to show 'folder' icon\n $j('#researcharea').treeview({\n add: listitem\n\n });\n });\n }\n });\n}", "function loadContent(areacode, language_id) {\r\n\tvar action = \"show_\" + areacode;\r\n\r\n\t$.ajax({\r\n\t\ttype : \"POST\",\r\n\t\turl : \"logic/process_content_handling.php\",\r\n\t\tdata : {\r\n\t\t\taction : action,\r\n\t\t\tlanguage_id : language_id\r\n\t\t}\r\n\t}).done(function(msg) {\r\n\t\t$('.content_container').html(msg);\r\n\t\t\r\n\t\t// set menu focus\r\n\t\t// remove old active menu item\r\n\t\t$('a.mm_active').removeClass('mm_active');\r\n\t\t// set new active menu item\r\n\t\t$('a[id='+areacode+']').addClass('mm_active');\r\n\t});\r\n}", "bindEvents() {\n this.sorting.querySelectorAll(\"a\").forEach((a) => {\n a.addEventListener(\"click\", (e) => {\n e.preventDefault();\n this.loadUrl(a.getAttribute(\"href\"));\n });\n });\n }", "function loadMoreContent(container,opt,a) {\n\n\t\t//MARK THE LAST CLICKED AJAX ELEMENT\n\t\tcontainer.find('.lastclickedajax').removeClass(\"lastclickedajax\");\n\t\ta.addClass(\"lastclickedajax\");\n\n\n\t\tvar act = jQuery(\"#\"+opt.ajaxContentTarget).find('.eg-ajax-target'),\n\t\t\tpostid = a.data('ajaxsource'),\n\t\t\tposttype = a.data('ajaxtype'),\n\t\t\tvideoaspect = a.data('ajaxvideoaspect');\n\n\t\t\tact.data('container',container);\n\n\t\tif (videoaspect==\"16:9\")\n\t\t\tvideoaspect =\"widevideo\"\n\t\telse\n\t\t\tvideoaspect =\"normalvideo\";\n\n\n\t\tshowHideAjaxContainer(act,false);\n\n\t\tif (act.length>0) {\n\n\n\n\t\t\t// ADD LOAD MORE TO THE CONTAINER\n\t\t\t//try{\n\t\t\t\t// PRELOAD AJAX JS FILE IN CASE IT NEEDED\n\t\t\t\tif (opt.ajaxJsUrl!=undefined && opt.ajaxJsUrl!=\"\" && opt.ajaxJsUrl.length>3)\t{\n\t\t\t\t\tjQuery.getScript(opt.ajaxJsUrl).done( function(script,textStatus) {\n\t\t\t\t\t\topt.ajaxJsUrl = \"\";\n\t\t\t\t\t})\n\t\t\t\t\t.fail(function(jqxhr,settings,exception) {\n\t\t\t\t\t\tconsole.log(\"Loading Error on Ajax jQuery File. Please doublecheck if JS File and Path exist:\"+opt.ajaxJSUrl);\n\t\t\t\t\t\topt.ajaxJsUrl = \"\";\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// PRELOAD AJAX CSSS FILE IN CASE IT NEEDED\n\t\t\t\tif (opt.ajaxCssUrl!=undefined && opt.ajaxCssUrl!=\"\" && opt.ajaxCssUrl.length>3)\t{\n\t\t\t\t\tjQuery(\"<link>\")\n\t\t\t\t\t\t.appendTo('head')\n\t\t\t\t\t\t.attr({type:\"text/css\", rel:\"stylesheet\"})\n\t\t\t\t\t\t.attr('href', opt.ajaxCssUrl);\n\n\t\t\t\t\topt.ajaxCssUrl == \"\";\n\t\t\t\t}\n\n\t\t\t\tbuildLoader(act.closest('.eg-ajaxanimwrapper'),opt);\n\n\t\t\t\tif (act.data('ajaxload') != undefined)\n\t\t\t\t\tact.data('ajaxload').abort();\n\n\t\t\t\tkillOldCustomAjaxContent(act);\n\n\t\t\t\tswitch (posttype) {\n\t\t\t\t\t// IF THE CONTENT WE LOAD IS FROM A POST\n\t\t\t\t\tcase \"postid\":\n\t\t\t\t\t\tvar objData = {\n\t\t\t\t\t\t\t\t\t\t action: opt.loadMoreAjaxAction,\n\t\t\t\t\t\t\t\t\t client_action: 'load_more_content',\n\t\t\t\t\t\t\t\t\t token: opt.loadMoreAjaxToken,\n\t\t\t\t\t\t\t\t\t postid:postid\n\t\t\t\t\t\t\t\t\t };\n\n\t\t\t\t\t\tsetTimeout(function() {\n\n\t\t\t\t\t\t\tact.data('ajaxload',jQuery.ajax({\n\t\t\t\t\t\t\t type:'post',\n\t\t\t\t\t\t\t url:opt.loadMoreAjaxUrl,\n\t\t\t\t\t\t\t dataType:'json',\n\t\t\t\t\t\t\t data:objData\n\t\t\t\t\t\t\t }));\n\t\t\t\t\t\t\tact.data('ajaxload').success(function(data,status,arg3) {\n\n\t\t\t\t\t\t\t\t\tif (data.success) {\n\t\t\t\t\t\t\t\t\t\tjQuery(act).html(data.data);\n\t\t\t\t\t\t\t\t\t\tshowHideAjaxContainer(act,true,opt.ajaxScrollToOnLoad,opt.ajaxScrollToOffset);\n\t\t\t\t\t\t\t\t\t\tremoveLoader(act);\n\t\t\t\t\t\t\t\t\t\tajaxCallBack(opt,a);\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t act.data('ajaxload').error(function(arg1, arg2, arg3) {\n\t\t\t\t\t\t\t \t\tif (arg2!=\"abort\") {\n\t\t\t\t\t\t\t\t \tjQuery(act).append(\"<p>FAILURE: <strong>\"+arg2+\"</strong></p>\");\n\t\t\t\t\t\t\t\t\t\tremoveLoader(act);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t });\n\t\t\t\t\t\t},300);\n\t\t\t\t\tbreak;\n\t\t\t\t\t// IF THE CONTENER WE LOAD IS A YOUTUBE VIDEO\n\t\t\t\t\tcase \"youtubeid\":\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\tact.html('<div class=\"eg-ajax-video-container '+videoaspect+'\"><iframe width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/'+postid+'?autoplay=1&vq=hd1080\" frameborder=\"0\" allowfullscreen></iframe></div>');\n\t\t\t\t\t\t removeLoader(act);\n\t\t\t\t\t\t\tshowHideAjaxContainer(act,true,opt.ajaxScrollToOnLoad,opt.ajaxScrollToOffset);\n\t\t\t\t\t\t\tajaxCallBack(opt,a);\n\t\t\t\t\t\t},300);\n\t\t\t\t\tbreak;\n\t\t\t\t\t// IF THE CONTENER WE LOAD IS A VIMEO VIDEO\n\t\t\t\t\tcase \"vimeoid\":\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\tact.html('<div class=\"eg-ajax-video-container '+videoaspect+'\"><iframe src=\"//player.vimeo.com/video/'+postid+'?portrait=0&autoplay=1\" width=\"500\" height=\"281\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>');\n\t\t\t\t\t\t removeLoader(act);\n\t\t\t\t\t\t\tshowHideAjaxContainer(act,true,opt.ajaxScrollToOnLoad,opt.ajaxScrollToOffset);\n\t\t\t\t\t\t\tajaxCallBack(opt,a);\n\t\t\t\t\t\t},300);\n\t\t\t\t\tbreak;\n\t\t\t\t\t// IF THE CONTENER WE LOAD IS A Wistia VIDEO\n\t\t\t\t\tcase \"wistiaid\":\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\tact.html('<div class=\"eg-ajax-video-container '+videoaspect+'\"><iframe src=\"//fast.wistia.net/embed/iframe/'+postid+'\"allowtransparency=\"true\" frameborder=\"0\" scrolling=\"no\" class=\"wistia_embed\" name=\"wistia_embed\" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width=\"640\" height=\"388\"></iframe></div>');\n\t\t\t\t\t\t removeLoader(act);\n\t\t\t\t\t\t\tshowHideAjaxContainer(act,true,opt.ajaxScrollToOnLoad,opt.ajaxScrollToOffset);\n\t\t\t\t\t\t\tajaxCallBack(opt,a);\n\t\t\t\t\t\t},300);\n\t\t\t\t\tbreak;\n\t\t\t\t\t// IF THE CONTENER WE LOAD IS A VIMEO VIDEO\n\t\t\t\t\tcase \"html5vid\":\n\t\t\t\t\t\tpostid=postid.split(\"|\");\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\tact.html('<video autoplay=\"true\" loop=\"\" class=\"rowbgimage\" poster=\"\" width=\"100%\" height=\"auto\"><source src=\"'+postid[0]+'\" type=\"video/mp4\"><source src=\"'+postid[1]+'\" type=\"video/webm\"><source src=\"'+postid[2]+'\" type=\"video/ogg\"></video>');\n\t\t\t\t\t\t removeLoader(act);\n\t\t\t\t\t\t\tshowHideAjaxContainer(act,true,opt.ajaxScrollToOnLoad,opt.ajaxScrollToOffset);\n\t\t\t\t\t\t\tajaxCallBack(opt,a);\n\t\t\t\t\t\t},300);\n\t\t\t\t\tbreak;\n\t\t\t\t\t// IF THE CONTENER WE LOAD IS A VIMEO VIDEO\n\t\t\t\t\tcase \"soundcloud\" :\n\t\t\t\t\tcase \"soundcloudid\":\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\tact.html('<iframe width=\"100%\" height=\"250\" scrolling=\"no\" frameborder=\"no\" src=\"https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/'+postid+'&amp;auto_play=true&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;visual=true\"></iframe>');\n\t\t\t\t\t\t removeLoader(act);\n\t\t\t\t\t\t\tshowHideAjaxContainer(act,true,opt.ajaxScrollToOnLoad,opt.ajaxScrollToOffset);\n\t\t\t\t\t\t\tajaxCallBack(opt,a);\n\t\t\t\t\t\t},300);\n\t\t\t\t\tbreak;\n\t\t\t\t\t// IF THE CONTENER WE LOAD IS AN IMAGE\n\t\t\t\t\tcase \"imageurl\":\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\tvar img = new Image();\n\t\t\t\t\t\t\timg.onload = function () {\n\t \t\t\t\t\t\t\t var img = jQuery(this);\n\t \t\t\t\t\t\t\t act.html(\"\");\n\t \t\t\t\t\t\t\t img.css({width:\"100%\",height:\"auto\"});\n\t\t\t\t\t\t\t\t act.append(jQuery(this));\n\t\t\t\t\t\t\t\t removeLoader(act);\n\t\t\t\t\t\t\t\t showHideAjaxContainer(act,true,opt.ajaxScrollToOnLoad,opt.ajaxScrollToOffset);\n\t\t\t\t\t\t\t\t ajaxCallBack(opt,a);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\timg.onerror = function(e) {\n\t\t\t\t\t\t\t\t act.html(\"Error\");\n\t\t\t\t\t\t\t\t removeLoader(act);\n\t\t\t\t\t\t\t\t showHideAjaxContainer(act,true,opt.ajaxScrollToOnLoad,opt.ajaxScrollToOffset);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t img.src=postid;\n\t\t\t\t\t\t},300);\n\t\t\t\t\tbreak;\n\t\t\t\t\t// EXTENDED VARIABLES FOR CONTENT LOADING\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tjQuery.each(jQuery.fn.tpessential.defaults.ajaxTypes,function(index,obj) {\n\n\t\t\t\t\t\tif (obj.openAnimationSpeed==undefined) obj.openAnimationSpeed=0;\n\n\t\t\t\t\t\t\tif (obj != undefined && obj.type!=undefined) {\n\t\t\t\t\t\t\t\tif (obj.type==posttype) {\n\t\t\t\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\t\t\t\tact.data('lastposttype',posttype);\n\t\t\t\t\t\t\t\t\t\tact.data('oldajaxsource',postid);\n\t\t\t\t\t\t\t\t\t\tact.data('oldajaxtype',posttype);\n\t\t\t\t\t\t\t\t\t\tact.data('oldajaxvideoaspect',videoaspect);\n\t\t\t\t\t\t\t\t\t\tact.data('oldselector',\"#\"+opt.ajaxContentTarget+' .eg-ajax-target');\n\t\t\t\t\t\t\t\t\t\tshowHideAjaxContainer(act,true,opt.ajaxScrollToOnLoad,opt.ajaxScrollToOffset,0);\n\t\t\t\t\t\t\t\t\t\tact.html(obj.func.call(this,{id:postid,type:posttype,aspectratio:videoaspect}));\n\t\t\t\t\t\t\t\t\t\tremoveLoader(act);\n\n\t\t\t\t\t\t\t\t\t},300);\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\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\n\t\t\t //} catch(e) {}\n\t\t}\n\n}", "function loadPage(path, anchor) {\n $('div.non-sidebar').load(path, function () {\n formatPage();\n goToAnchor(anchor);\n });\n }", "function ajax_selected_boxes_pagination(onclick_field, paginate_class, container, address, div_loader, select_class_name, input_read, input_unread, input_all, delete_something ){\n\n\t\t$(onclick_field).on('click', paginate_class, function (e){\n\t\t\te.preventDefault(); \n\t\t\tvar page = $(this).attr('rel');\n\t\t\t//alert(page);\n\t\t\t$(container).load(address + page + div_loader, function(){\n\t\t\t\tselected_boxes(select_class_name, input_read, input_unread, input_all);\n\t\t\t\tdelete_something_pagination(delete_something);\n\t\t\t});\n\t\t});\t\n\t}", "function watchTargets() {\n jQuery(document).ajaxComplete(processResponse);\n }", "function edmund_widget_vanilla_setup_links(){\n\tif (document.getElementsByClassName('ItemComment').length==0) {\n\t\twindow.setTimeout(edmund_widget_vanilla_setup_links,5000); \n\t\treturn false; \n\t}\n\tif (document.getElementsByClassName('Loading').length > 0) {\n\t\twindow.setTimeout(edmund_widget_vanilla_setup_links,5000); \n\t\treturn false; \n\t}\n\tif(!document.getElementById('edmund_widget_next_favourite_top_link')){ \n\t\tdocument.getElementById('Form_Comment').innerHTML+='<a id=\"edmund_widget_next_favourite_top_link\" name=\"edmund_widget_next_favourite_top_link\" href=\"#edmund_widget_next_favourite_top_link\" onClick=\"return edmund_widget_vanilla_next_favourite(null,this);\">First Favourite</a> '; \n\t}\n\n\tif(document.getElementById('PagerMore')){ \n\t\tdocument.getElementById('PagerMore').onclick='edmund_widget_vanilla_setup_links_when_ready();';\n\t};\n\tedmund_widget_vanilla_set_styles();\n\tlis=document.getElementsByClassName('ItemComment');\n\tfor(i=0;i<lis.length;i++){ \n\t\tedmund_widget_vanilla_linkify_child_node(lis[i]); \n\t};\n\tedmund_widget_refresh_document();\n\n\treturn false;\n\t\n}", "loadContent(element) {\n let id = $(element).data(\"post\");\n //$(element).parent().data(\"targetDiv\").slideToggle(\"slow\");\n $(element).parent().data(\"targetDiv\").load('data/blog.html ' + id);\n // $(element).parent().data(\"targetDiv\").slideToggle(\"slow\");\n \n }", "function load_blocks_html(action) {\n $.ajax({\n url: g_settings.base_url + 'social/create/' + action,\n type: 'POST',\n success: function (html) {\n\n $container.html(html);\n\n rebind_vars($container);\n\n //update selectik items\n $(\".select_block\").each(function (indx) {\n var self = $(this);\n $(this).ddslick({\n width: self.data('width') || 174,\n height: self.data('height') || null\n })\n });\n\n $container.find('input').iCheck({\n checkboxClass: 'icheckbox_minimal-grey',\n radioClass: 'iradio_minimal-grey',\n increaseArea: '20%' // optional\n });\n\n\n },\n complete: function () {\n //if we load html after selecting RSS post\n // we need to insert selected data into inputs\n if ($container.find('input[name=url]').length) {\n $container.find('input[name=url]').val(selected_link);\n $container.find('textarea[name=description]').val(selected_description.trim());\n }\n\n if ($container.find('div.suggested').length) {\n $('#rss-feed-container').html($loading);\n rss_paginate_load_html($container.find('div.suggested').data('url'), 1, '');\n }\n\n }\n })\n }", "function mainLoaded() {\n if (typeof(executeOnContentLoad) == \"function\") {\n if (contentLoadDestination && location.hash != contentLoadDestination) return;//wait til we are on the correct page\n var fn = executeOnContentLoad;\n executeOnContentLoad = null;\n contentLoadDestination = null;\n fn();\n }\n }", "function loadBranch(type, id, element) {\n //$( \"#loader\" ).show();\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\turl: 'index.php?r=branch/load&id='+id,\n\t\t\tdataType : 'json',\n\t\t\tsuccess:function(data) {\n\t\t\t\tif (data) {\n\t\t\t\t\tli = element.append(\"<ul class='Container Branch'></ul>\");\n\t\t\t\t\t$.each(data, function(index, element){\t\t\t\t\t\n\t\t\t\t\t\tl_class = (index == (data.length-1))?\"IsLast\":\"\";\n\t\t\t\t\t\tul = li.find('ul');\n\t\t\t\t\t\tn_div = $(\"<div class='Expand'></div>\");\n n_b = $(\"<div class='tree-menu-button-branch'><a href='#'></a></div>\");\n\t\t\t\t\t\tn_content = $(\"<div class='Content'><a id='branch-\"+this.id_branch+\"' href='index.php?r=branch/show&id=\"+this.id_branch+\"'>\"+this.name+\"</a></div>\");\n\t\t\t\t\t\tnode = $(\"<li id=branch-\"+this.id_branch+\" class='Node ExpandClosed \"+l_class+\"'></li>\")\n .append(n_div)\n .append(n_b)\n\t\t\t\t\t\t .append(n_content);\n\t\t\t\t\t\tul.append(node);\n\t\t\t\t\t});\n\t\t\t\t}\t\t\t\t\n\t\t\t},\n\t\t\tfailure: function() {\n alert(\"Ajax request broken\");\n }\n /*complete: function() {\n $( \"#loader\" ).hide();\n }*/\n\t\t});\n\t}", "function interceptClickEvent(e) {\n var href;\n var target = e.target || e.srcElement;\n if (target.tagName === 'A') {\n href = target.getAttribute('href');\n var isLocal = href != null && href.startsWith('/');\n\n //put your logic here...\n if (isLocal) {\n location.hash = href;\n\n var anchorSearch = RegExp(/[\\/\\w]+(\\?\\w+=\\w*(&\\w+=\\w*))?#(\\w+)/g).exec(href);\n if (anchorSearch != null && anchorSearch[3] != null) {\n setTimeout(function () {\n var anchorElem = document.getElementById(anchorSearch[3]);\n anchorElem && anchorElem.scrollIntoView();\n }, 1);\n }\n\n //tell the browser not to respond to the link click\n e.preventDefault();\n }\n }\n }", "function appendToLinks() {\n let snapTextElements = document.evaluate(\"//a[contains(translate(@href, 'HTTP', 'http'), 'http') and contains(@href, 'assetstore.unity')]\",\n document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);\n for (let i = snapTextElements.snapshotLength - 1; i >= 0; i--) {\n let elmLink = snapTextElements.snapshotItem(i);\n let latest = $(elmLink).attr('href').split('/').pop().trim();\n let data_id = Number.isInteger(latest) ? latest : latest.split('-').pop().trim();\n $(elmLink).wrap(`<span class=\"unitystore-holder\" data-id=\"${data_id}\"></span>`);\n $(elmLink).addClass('unitystore-link');\n }\n }", "function paginationOnClick() {\n $(\".page\").each(function(){\n $(this).click(function(e) {\n $('#contenu').load($(this).attr(\"href\"), [], paginationOnClick );\n console.log($(this).attr(\"href\"));\n e.preventDefault();\n })\n });\n }", "link() {\n\t\t// Call super link to link members of Top Level (Identified)\n\t\tsuper.link();\n\t\t\n this._built = this._sbolDocument.lookupURI(this._built);\t\t\n }", "function r(e) {\n var t = e.find(\"a\").attr(\"href\"),\n o = e.data(\"title\");\n e.attr(\"data-lazyload\", \"opened\"),\n e.append(y[e.attr(\"id\")]),\n e.find(\".post-content\").css({ opacity: 0, top: 50 }),\n TweenLite.to(e.find(\".post-content\"), 0.7, { opacity: 1, top: 0 }),\n d(),\n z.lazyBg(),\n l(),\n n(e.find(\".header-container\")),\n e.find(\".featured-img\").addClass(\"reactive\"),\n e.find(\".post-content\").initShortcodes(),\n History.pushState(\n null,\n o,\n t.replace(\n document.location.protocol + \"//\" + document.location.hostname,\n \"\"\n )\n ),\n setTimeout(function () {\n e.siblings(\"article\").css(\"display\", \"none\"),\n e.css(\"top\", 0),\n z(\"body.blog #content\").css(\"paddingTop\", 0),\n p.css(\"paddingTop\", 0);\n }, 400);\n }", "function attachAjaxOpener() {\n\t\t$('.ajax-trigger').click(function(e) {\n\t\t\tif (!$.support.ajax) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\te.preventDefault();\n\t\t\t$(this).toggleClass('active');\n\t\t\t$panel = $(this).parents('.trigger-container').find('.panel');\n\t\t\tif ($(this).hasClass('active')) {\n\t\t\t\t// Opening\n\t\t\t\tlink = getLink(this);\n\t\t\t\tvar time = getHiddenElementHeight ($panel) * 2;\n\t\t\t\tattachLoading($panel, 'dark');\n\t\t\t\t$panel.stop(true, true).slideToggle(time, function() {\n\t\t\t\t\t\t$.ajax(link, {\n\t\t\t\t\t\t\tcontext: $panel,\n\t\t\t\t\t\t\tdataType: 'html',\n\t\t\t\t\t\t\tsuccess: function(data) {\n\t\t\t\t\t\t\t\t$panel = $(this);\n\t\t\t\t\t\t\t\tif ($(this).parents('.trigger-container').find('.ajax-trigger').hasClass('active')) {\n\t\t\t\t\t\t\t\t\tremoveLoading(400, function() {\n\t\t\t\t\t\t\t\t\t\t$panel.css({opacity:'0'});\n\t\t\t\t\t\t\t\t\t\t$panel.html(innerShiv(data)).animate({opacity: '1'}, 500);\n\t\t\t\t\t\t\t\t\t\tpngFix();\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});\n\t\t\t} else {\n\t\t\t\t// Closing\n\t\t\t\tvar time = $('.panel').height();\n\n\t\t\t\t$panel.stop(true, true).slideToggle(time, function() {\n\t\t\t\t\tif (!$('.ajax-trigger').hasClass('active')) {\n\t\t\t\t\t\t$panel.empty();\n\t\t\t\t\t\t$panel.removeAttr('style');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function navigateLink(ev){\n /*\n this is an event handler for navigation for the varius pages.\n it will load the page using ajax. create push state in history and\n change the url to match new page. It will call function to display\n loading gif while waiting for a response from the server\n */\n var link_elem;\n ev.preventDefault();\n toggleLoadingGif(true);\n if(ev.target.nodeName == \"A\"){\n link_elem = ev.target;\n } else {\n link_elem = ev.target.parentElement;\n }\n state_obj.page = link_elem.getAttribute(\"data-link\");\n var params = {};\n params.method = \"GET\";\n params.url = \"/section/\"+state_obj.page;\n params.data = null;\n params.setHeader = false;\n ajaxRequest(params, navigationResponse);\n }", "function ajax_pagination(onclick_field, paginate_class, container, address, div_loader, div_on_click, input_class_name_for_selecting_all, input_class_name_for_selecting_each, delete_something ){\n\n\t\t$(onclick_field).on('click', paginate_class, function (e){\n\t\t\te.preventDefault(); \n\t\t\tvar page = $(this).attr('rel');\n\t\t\t//alert(page);\n\t\t\t$(container).load(address + page + div_loader, function(){\n\t\t\t\tajax_select_all_boxes(div_on_click, input_class_name_for_selecting_all, input_class_name_for_selecting_each);\n\t\t\t\tdelete_something_pagination(delete_something);\n\t\t\t});\t\t\n\t\t});\n\t}", "function vfGaLinkTrackingInit() {\n vfGaLogMessage('vfGaLinkTrackingInit');\n document.body.addEventListener(\"mousedown\", function (evt) {\n // Debug event type clicked\n vfGaLogMessage(evt.target.tagName);\n vfGaLogMessage(evt.target);\n\n // we only track clicks on interactive elements (links, buttons, forms)\n if (evt.target) {\n if (evt.target.tagName) {\n var clickedElementTag = evt.target.tagName.toLowerCase();\n var actionElements = [\"a\", \"button\", \"label\", \"input\", \"select\", \"textarea\", \"details\", \"area\"];\n if (actionElements.indexOf(clickedElementTag) > -1) {\n vfGaTrackInteraction(evt.target);\n return;\n }\n }\n }\n\n // In the case that elements such as `span` are wrapped in action elements (e.g. `a`),\n // we need to find the latter and supply them for tracking\n var ancestors = [\"a\", \"details\", \"label\"];\n for (var i = 0; i < ancestors.length; i++) {\n var from = findParent(ancestors[i], evt.target || evt.srcElement);\n if (from) {\n vfGaTrackInteraction(from);\n return;\n }\n }\n }, false);\n\n //find first parent with tagName [tagname]\n function findParent(tagname, el) {\n while (el) {\n if ((el.nodeName || el.tagName).toLowerCase() === tagname.toLowerCase()) {\n return el;\n }\n el = el.parentNode;\n }\n return null;\n }\n}", "function init() {\n $(\"nav a\").click(function (event) {\n let btnId = this.id;\n let contentID = btnId + \"Content\";\n\n $(\"#app\").html(eval(contentID));\n });\n}", "function news_photo() {\n\n\t$(\".canhcam-news-photo-1 .box-zoom\").lightGallery({\n\t\tthumbnail: true,\n\t\tselector: 'a'\n\t});\n\n\t// $('.canhcam-news-photo-1 .wrapper-gallery').each(function() {\n\t// \t$(this).click(function() {\n\t// \t\t$(this).find('.hidden a:first-child').trigger('click')\n\t// \t})\n\t// });\n}", "follow(selector) {\n this.check_state('doc')\n let link = this.$(selector).attr('href')\n if (!link) { throw new Error(`No link with selector ${selector}`) }\n return (this.get(link))\n }", "function loadPageData() {\n\tvar cC = '#mw-content-text';\n\t$( cC ).load( location.href + \" \" + cC + \" > *\", function ( data ) {\n\t\tif ( doRefresh ) {\n\t\t\tajaxTimer = setTimeout( loadPageData, ajaxRefresh );\n\t\t}\n\t} );\n}", "function loadPageData() {\n\tvar cC = '#mw-content-text';\n\t$( cC ).load( location.href + \" \" + cC + \" > *\", function ( data ) {\n\t\tif ( doRefresh ) {\n\t\t\tajaxTimer = setTimeout( loadPageData, ajaxRefresh );\n\t\t}\n\t} );\n}", "function onClick() {return thisObj.load(this.href);}" ]
[ "0.57153624", "0.57060015", "0.55183095", "0.5467071", "0.54174405", "0.53914773", "0.53624797", "0.53550285", "0.5324521", "0.5324521", "0.5321673", "0.5247417", "0.52308464", "0.5228402", "0.5218341", "0.52110463", "0.520964", "0.51868904", "0.517908", "0.5176264", "0.51544255", "0.51510215", "0.5134121", "0.51257306", "0.51079345", "0.5091147", "0.50787646", "0.5075127", "0.5074915", "0.5064154", "0.5059639", "0.505918", "0.50486606", "0.50484717", "0.5037797", "0.5033756", "0.50332", "0.50181496", "0.5015983", "0.5011929", "0.50056064", "0.5000429", "0.49906608", "0.49903628", "0.49769017", "0.49717858", "0.4966434", "0.49654937", "0.49605292", "0.49567574", "0.49547088", "0.4952737", "0.49496588", "0.4948194", "0.4948076", "0.49319085", "0.49308884", "0.49287748", "0.49242342", "0.49222967", "0.4917582", "0.4916656", "0.49128848", "0.49015692", "0.4896665", "0.48887834", "0.4879607", "0.4869366", "0.48571956", "0.48513848", "0.4842985", "0.48391527", "0.48374447", "0.4835493", "0.48322013", "0.48303336", "0.48297426", "0.48291612", "0.48266387", "0.48249006", "0.48245126", "0.48205858", "0.48156157", "0.48145252", "0.48098812", "0.48055914", "0.48028624", "0.47986126", "0.47926304", "0.47914276", "0.4783594", "0.478343", "0.47797823", "0.47705016", "0.47682628", "0.47681037", "0.47632596", "0.47577465", "0.47577465", "0.4756684" ]
0.5219606
14
GENERAL EVENT TRACKING FUNCTION
function trackevent(e,wType,wLab,wVal,nonint,cleantext) { // assumes interaction, unless specficy as not // VALUE CAN ONLY BE NUMBER if (typeof(eventpagename) == "undefined") { console.log("no event page name"); return; } if (empty(eventpagename)) { console.log("no event page name"); return; } wSection = eventpagename; if (typeof(e) != "boolean") { if ( e.originalEvent === undefined ) { console.log("NHEVENT PCLICK"); return; // programatic click, no tracking } } if (!nonint) { nonint = false; } // wVal = nhclean(wVal); wType = oneline(wType); if (empty(wLab)) { wLab = ""; } else { wLab = justpath(wLab); } // strip down if url if (empty(wVal)) { wVal = "0"; } else { wVal = justpath(wVal); } console.log(">>>>>>>>>>>> TRACKEVENT: "+ " " +wSection+ " " + wType + " " + wVal); wVal = parseInt(wVal,10); ///////////_trackEvent, category, action, opt_label, opt_value<number, opt_noninteraction) _gaq.push(['_trackEvent', wSection, wType, wLab , wVal ,nonint]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EventInfo() { }", "function EventInfo() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() {}", "function EventHelper (possibleEvents) {\n }", "onEvent() {\n \n }", "track({eventType, args}) {\n this.handleEvent(eventType, args);\n }", "function event_seen(evnt) {\n alert(\"Got event: \" + evnt.type);\n}", "function EventDict() {}", "function logEvent(eventType) {}", "function FsEventsHandler() {}", "function T(e,t,n){Q.reference.addEventListener(e,t),n.push({eventType:e,handler:t})}", "handleEvents() {\n }", "function EventReader() {}", "function tpieevents(input) {\n store_remote_events(input);\n parse_events(input);\n}", "function constroiEventos(){}", "function onEventTimer() {\n triggerEvents(inbandEvents);\n triggerEvents(inlineEvents);\n removeEvents();\n }", "function onevent(args) {\n console.log(\"Event:\", args[0]);\n }", "function EventEmitter(){}// Shortcuts to improve speed and size", "function onEvent(name, event) {\n //console.log(event);\n console.log(name, JSON.stringify(event, null, 2));\n}", "function onevent(args) {\n console.log(\"Event:\", args[0]);\n }", "function registerEvents() {\n}", "function recordEvent(info) {\n ///console.log('event', info);\n var detail = { detail: info };\n var event = new CustomEvent('benchmarkEvent', detail);\n document.dispatchEvent(event);\n }", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}" ]
[ "0.7364112", "0.7364112", "0.6907364", "0.6907364", "0.6907364", "0.6907364", "0.6907364", "0.68415046", "0.66852003", "0.666705", "0.6660577", "0.66283613", "0.6622913", "0.66098434", "0.6585084", "0.6584334", "0.6563585", "0.6528329", "0.65011793", "0.64636385", "0.63906354", "0.6390104", "0.63857645", "0.6380968", "0.63539404", "0.6340907", "0.6330053", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696", "0.6312696" ]
0.6362163
24
Requests to /api/morechildren are capped at 20 comments at a time, but requests to /api/info are capped at 100, so it's easier to send to the latter. The disadvantage is that comment replies are not automatically sent from requests to /api/info.
fetchMore(options) { var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; if (options.amount <= 0 || startIndex >= this.children.length) { return _Promise2.default.resolve([]); } if (!options.skipReplies) { return this.fetchTree(options, startIndex); } var ids = getNextIdSlice(this.children, startIndex, options.amount, _constants.MAX_API_INFO_AMOUNT).map(function (id) { return 't1_' + id; }); // Requests are capped at 100 comments. Send lots of requests recursively to get the comments, then concatenate them. // (This speed-requesting is only possible with comment Listings since the entire list of ids is present initially.) var promiseForThisBatch = this._r._getListing({ uri: 'api/info', qs: { id: ids.join(',') } }); var nextRequestOptions = _extends({}, options, { amount: options.amount - ids.length }); var promiseForRemainingItems = this.fetchMore(nextRequestOptions, startIndex + ids.length); return _Promise2.default.all([promiseForThisBatch, promiseForRemainingItems]).then(_flatten3.default); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getComments(response, request) {\n\tconsole.log(\"Request handler 'getComments' was called.\");\n\n\t// get parent ID\n\tvar queryData = url.parse(request.url, true).query;\n\tvar pid = queryData.id;\n\tif (!data.isValid(pid)) {\n\t\tresponse.writeHead(400, { \"Content-Type\" : MIME_TYPES['.txt']});\n\t\tresponse.end(\"400: Invalid id specified.\");\n\t}\n\telse {\n\t\tresponse.writeHead(200, { \"Content-Type\" : MIME_TYPES['.json']});\n\t\t\n\t\t// get all children comments...\n\t\tvar commentNodes = traverseComments(pid);\n\n\t\t// ...but since traverseComments does a pre-order traversal, it also\n\t\t// includes this node's own root ID at the front. Remove it.\n\t\tcommentNodes.shift();\n\n\t\t// send them back to the client\n\t\tconsole.log(\"Populated commentNodes with \" + commentNodes.length + \" items\");\n\t\tresponse.write(JSON.stringify(commentNodes));\n\t\tresponse.end();\n\t}\n\t\n}", "function api_get_comments(req, res) {\n Message.find({type : 'comment', parent : req.param('msg_id')}).sort({time:-1}).exec(function(err, messages) {\n\tif(!err && messages) {\n\t\tvar m = new Array();\n\n\t\tfor (var i = 0; i < messages.length; i++) {\n\t\t\tvar r = messages[i].toObject();\n\t\t\tr.id = messages[i]._id.toHexString();\n\t\t\tm.push(r);\n\t\t}\n\t\tres.json(200, m);\n\t} else if(err){\n res.json(500, {message : \"Error\"});\n }else{\n\t\tres.json(404, {message : \"Couldn't get comments for message \" + req.param('msg_id')});\n\t}\n });\n}", "function view_more_note_comments(selector) { //return false;\n\t$(selector).append('<span class=\"preload\"></span>');\n\t\n\tvar main_id = $(selector).attr('data-parentid');\n\tvar noteid = $(selector).attr('data-noteid');\n\tvar page = $(selector).find('input[name=\"page\"]').val();\n\tvar total_pages = $(selector).attr('data-total-pages');\n\tvar type = $(selector).attr('data-feed-type');\n\tvar objdata = {\n\t\tmain_id: main_id,\n\t\tnoteid: noteid,\n\t\tpage: page,\n\t\tf_type: type\n\t};\n\tif (page <= total_pages) {\n\t\t$.post(admin_url + 'misc/get_more_replies/', objdata, function(response) {\n\t\t\tif (response.feedshtml !== undefined) {\n\t\t\t\t$(selector).data('track-load-comments', page);\n\t\t\t\t$(selector).parent().before(response.feedshtml);\n\t\t\t\tpage++;\n\t\t\t\t$(selector).find('input[name=\"page\"]').val(page);\n\t\t\t\tif (page >= total_pages - 1) {\n\t\t\t\t\t$(selector).parent().addClass('hide');\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetTimeout(function() {\n\t\t\t\t$(selector).find('.preload').remove();\n\t\t\t}, 200);\n\t\t}, 'json');\n\t}\n\t$(selector).parent().next('.write-comment').removeClass('hide');\n}", "function getComments(){\n \n var comments = new Comments(); //New comments object\n \n //Get comments count for creating navigation pages\n comments.commentsCount(currentArticleId).done(function(response){\n \n //Calculate number of pages or set them to 0 if getComments fails\n if(response.length > 0){\n commCount = response[0].totalComments;\n commTotalPages = Math.ceil(commCount/commPageSize);\n }else{\n commTotalPages = 0;\n }\n \n // If there is at least one page create navigation menu\n //hide navigation until comments are displayed\n if(commTotalPages > 0){\n $('navigation').addClass('hidden');\n createCommentsNavigation(commTotalPages);\n comments.getCommentsForArticle(currentArticleId,commCurrentPage,commPageSize).done(displayComments);\n }\n \n }); //END commentsCount function\n \n \n}//END getComments function", "function getServletComments() {\n let maxComments = verifyNumberCommentsInput();\n if (maxComments != null) {\n fetch('/data?maxComments=' + maxComments).then(response => response.json()).then((comments) => {\n // Get the comments container\n const commentsContainer = document.getElementById('js-comments-container');\n commentsContainer.innerHTML = '';\n \n // Check if the array of comments is empty\n if (!Array.isArray(comments) || !comments.length) {\n const pElement = document.createElement('p');\n pElement.innerText = \"Looks like there are no comments yet. Be the first one to comment!\"\n commentsContainer.appendChild(pElement);\n } else {\n for (const comment of comments) {\n // Add each comment to the commentsContainer\n commentsContainer.appendChild(createCommentElement(comment));\n }\n }\n });\n }\n}", "function loadComments(req,res) {\n var scoreId = req.params.scoreId;\n if(scoreId.length < 10){\n noteModel\n .loadComments(scoreId)\n .then(function (score) {\n res.json(score);\n }, function (error) {\n res.statusCode(404).send(error);\n });\n }else{\n noteModel\n .loadOwnComments(scoreId)\n .then(function (score) {\n res.json(score);\n }, function (error) {\n res.statusCode(404).send(error);\n });\n }\n\n }", "function fetchComments(offset)\n{\n $.getJSON('/_/comments?offset='+offset, function(data) {\n if(typeof data.first === 'undefined') {return ;}\n var pagination = '<b>Showing comments '+(data.first+1)+' - ' +\n (data.first + data.comments.length)+' of '+data.total+'</b>';\n if(data.first > 0)\n {\n pagination += ' | <a href=\"#\" onClick=\"javascript:fetchComments(' +\n (data.first - data.pageSize)+');return false;\">newer comments</a>';\n }\n if(data.total > data.first + data.comments.length)\n {\n pagination += ' | <a href=\"#\" onClick=\"javascript:fetchComments(' +\n (data.first + data.pageSize)+');return false;\">older comments</a>';\n }\n pagination += '<hr/>';\n var comments = [];\n $.each(data.comments, function(idx, comment) {\n comments.push('<div><b>Post time:</b> '+comment.date+' <b>By:</b> '+comment.author+\n '<br/><b>Title: '+comment.title+'</b><br/><pre class=\"wrapped_pre\">'+comment.text+'</pre></div><hr/>');\n });\n $(\"#comments\").html(pagination + comments.join('\\n'));\n });\n return false;\n}", "function loadMoreCommentaires(){\n for(i=2;i<(commentaires.last_page+2);i++){\n $.ajax({\n method: 'GET',\n url: article.id+'?page='+i,\n data: \"\",\n dataType:\"json\",\n })\n .done(function(data) {\n $.each(data.data, function(){\n var html = \"<div class='divider'></div><div class='section' style='display:none'><h5 class='small'>\"+this.auteur+\"</h5><p class='justify dotdotdot commentaire'>\"+this.contenu+\"</p><p class='date right-align'>\"+moment(this.created_at).startOf('hour').fromNow()+\"</p></div>\";\n $('.commentaire-container').append(html);\n $('.commentaire-container').find('.section').slideDown();\n $('.commentaire').readmore({\n speed: 75,\n moreLink: '<a href=\"#\">Plus</a>',\n lessLink: '<a href=\"#\">Moins</a>',\n });\n });\n $('.load-more').hide();\n })\n .fail(function(data){\n //alert('fail');\n console.log(data);\n })\n }\n}", "function getComments(limit = 10, offset = 0, firstLoad = true) {\n\t$.ajax({\n\t\turl: \"api/actions.php\",\n\t\tmethod: \"GET\",\n\t\tdataType: 'json',\n\t\tdata: {limit: limit, offset: offset}\n\t}).done(function (response) {\n\t\tif (response.status === true) {\n\t\t\tconsole.log('getComments response: ', response);\n\t\t\tbuildComments(response.data);\n\t\t\tif(firstLoad) comments = response.data;\n\t\t\telse comments = comments.concat(response.data);\n\t\t}\n\t\telse {\n\t\t\tconsole.error(\"getComments ajax request return status false: \", response);\n\t\t}\n\t});\n}", "function getComments(req, res, next){\n courseService.getComments(req.params.id, req.user.sub).then(x => {\n res.json(x);\n });\n\n}", "function recurseOrDraw(jsonResponse) { \n\t\t\t// var commentsThisPage = parseComments(jsonResponse);\n\t\t\tvar commentsThisPage = parseComments_TimeLength(jsonResponse);\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < commentsThisPage.length; i++) {\n\t\t\t\tcommentsTimesLengths.push(commentsThisPage[i]);\n\t\t\t}\n\t\t\tvar commentsProcessed = i + MAX_COMMENTS_PER_PAGE*(commentPageNumber-1);\n\t\t\t// console.log(\"comment page = \" + page);\n\t\t\tconsole.log(\"comments processed = \" + commentsProcessed);\n\t\t\tcommentPageNumber++;\n\t\t\t\n\t\t\tvar nextPageToken = jsonResponse.nextPageToken; // if there's another page of comments, this is the token to get it with the api call. Otherwise this is empty\n\t\t\tif ( commentsProcessed >= MAX_COMMENTS_TO_PROCESS) {\n\t\t\t\tconsole.log(\"Maximum number of comments (\" + MAX_COMMENTS_TO_PROCESS + \") reached. Halting API calls\");\n\t\t\t\tnextPageToken = false; // if we've processed too many comments, time to stop\n\t\t\t}\n\t\t\tif (nextPageToken) { // if another page of results exists ...\n\t\t\t\tapiUrl = buildCommentsApiRequestUrl(videoId, nextPageToken); \t// ... build api url for that page\n\t\t\t\tmakeApiCommentRequest(apiUrl, commentPageNumber, commentsTimesLengths); \t\t\t\t// ... and request that page (recursively)\n\t\t\t} else { // if this is the last page of results ...\n\t\t\t\t\n\t\t\t\t// var sortedArray = commentsTimesLengths.sort(function(a,b){return b-a});\n\t\t\t\t// logArray(sortedArray); // Log the list of comment lengths\n\t\t\t\t\n\t\t\t\tconsole.log(\"comments processed at draw time = \"+ commentsProcessed);\n\t\t\t\tdrawVisualization(\"manual\", commentsTimesLengths); \t\t\t//... draw with the results!\n\t\t\t}\n\t\t}", "function morelinks() {\n\tvar json10afterurl = redditTracker.jsonurl + \"?after=\" + redditTracker.after + \"&limit=10\";\n\t$.getJSON(json10afterurl, getAfterLinks);\n}", "static async getPostComments(parent, count = 10, offset = 0, orderBy) {\n const queryParams = [];\n\n if (orderBy !== undefined) {\n const orderByParams = orderBy.split('_');\n queryParams.push(aql`SORT v.${orderByParams[0]} ${orderByParams[1]}`);\n }\n \n const query = aql`\n FOR v IN 1..1 OUTBOUND ${parent} ${collections.PostComments}\n ${aql.join(queryParams)}\n LIMIT ${offset}, ${count}\n RETURN v\n `;\n\n const cursor = await db.query(query);\n return cursor.all();\n }", "function fetchComments() {\n fetch(`https://sneaker-db.herokuapp.com//api/v1/comments/`)\n .then(r => r.json())\n .then((data) => {\n allComments = data\n viewComments()\n })\n}", "function getDiscussions(req, res, next) {\n async.waterfall([\n function(callback) { \n // create a default filters\n var filters = {\n offset: 0,\n limit: queryConfig.pageSize,\n where: {}\n };\n // req.swagger.params returns empty value for non-existing parameters, it can't determine it's non-existing\n // or empty value. So req.query should be used to validate empty value and not-supported parameters.\n // parse request parameters\n _.each(_.keys(req.query), function(key) {\n if (key === 'offset' || key === 'limit') {\n paramHelper.parseLimitOffset(req, filters, key, req.query[key]);\n } else if (key === 'orderBy') {\n paramHelper.parseOrderBy(Discussion, req, filters, req.query[key]);\n } else if (key === 'filter') {\n paramHelper.parseFilter(Discussion, req, filters, req.query[key]);\n } else {\n routeHelper.addValidationError(req, 'Request parameter ' + key + ' is not supported');\n }\n });\n callback(req.error, filters);\n },\n function(filters, callback) {\n // get discussions and total count\n _findDiscussions(req, filters, function(err, totalCount, discussions) {\n callback(err, totalCount, discussions);\n });\n }\n ], function(err, totalCount, discussions) {\n if (!err) {\n req.data = {\n success: true,\n status: 200,\n metadata: {\n totalCount: totalCount\n },\n content: discussions\n };\n } \n next();\n });\n\n}", "onLoadMoreClick(eventObject) {\n /* Display \"loading comments\" text */\n let loadingText = eventObject.target;\n loadingText.classList.add(\"loading\");\n loadingText.textContent = RoKA.Application.localisationManager.get(\"loading_generic_message\");\n let generateRequestUrl = `https://api.reddit.com/r/${this.commentThread.threadInformation.subreddit}\"/comments/${this.commentThread.threadInformation.id}/z/${this.data.id}.json`;\n new RoKA.HttpRequest(generateRequestUrl, RoKA.RequestType.GET, function (responseData) {\n /* Remove \"loading comments\" text */\n let getParentNode = loadingText.parentNode.parentNode;\n getParentNode.removeChild(loadingText.parentNode);\n /* Traverse the retrieved comments and append them to the comment section */\n let commentItems = JSON.parse(responseData)[1].data.children;\n if (commentItems.length > 0) {\n commentItems.forEach(function (commentObject) {\n var readmore, comment;\n if (commentObject.kind === \"more\") {\n readmore = new LoadMore(commentObject.data, this.referenceParent, this.commentThread);\n this.referenceParent.children.push(readmore);\n getParentNode.appendChild(readmore.representedHTMLElement);\n }\n else {\n comment = new RoKA.Comment(commentObject.data, this.commentThread);\n this.referenceParent.children.push(comment);\n getParentNode.appendChild(comment.representedHTMLElement);\n }\n });\n }\n });\n }", "function getComments(){\n fetch('/data').then(response => response.json()).then((comments) => {\n const historyEl = document.getElementById('history');\n console.log(comments + \" and \" + comments.length);\n for(i=0; i<comments.length; i++){\n addCommentToDom(historyEl, comments[i]);\n }\n });\n }", "function listComments(owner, repo, action, per_page, page, link){\n\t\t\t\tvar url = link ? link : ApiRoot + 'repos/' + owner + '/' + repo + '/comments';\n\t\t\t\tif(!link){\n\t\t\t\t\turl += per_page ? ((/\\?/).test(url) ? '&' : '?') + 'per_page=' + limit : ((/\\?/).test(url) ? '&' : '?') + 'per_page=100';\n\t\t\t\t\turl += page ? ((/\\?/).test(url) ? '&' : '?') + 'page=' + page : '';\n\t\t\t\t}\n\t\t\t\tApi('GET', url, function(data, status, xhr){\n\t\t\t\t\taction(data, status, xhr);\n\n\t\t\t\t\t//If there is a link header in the response then the results are paginated so we'll re run the function for all the pages\n\t\t\t\t\tif(xhr.getResponseHeader('Link')){\n\t\t\t\t\t\tparseLinkHeader (xhr.getResponseHeader('Link'), function(linkHeader){\n\t\t\t\t\t\t\tconsole.log('linkHeader: ' + linkHeader)\n\t\t\t\t\t\t\tlistComments('', '', action, '', '', linkHeader);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}", "function getComments() {\n\t\t$.ajax({ \n\t\t\turl: '/comments', type: 'GET', dataType: 'json',\n\t\t\tsuccess: (data) => {\n\t\t\t\tcomments = ''\n\t\t\t\tfor (const c of data){\n\t\t\t\t\tcomments = \n\t\t\t\t\t\t`<br><div id=comment>`+\n\t\t\t\t\t\t\t`<div id=name>`+\n\t\t\t\t\t\t\t\tc.name + ' — ' + c.datetime + \n\t\t\t\t\t\t\t`</div>` + \n\t\t\t\t\t\t\t`<div id=message>`+\n\t\t\t\t\t\t\t\tc.comment + \n\t\t\t\t\t\t\t`</div>` + \n\t\t\t\t\t\t`<br><hr></div>` +\n\t\t\t\t\t\tcomments\n\t\t\t\t}\n\t\t\t\t$('#comments').html(comments)\n\t\t\t\t$('#commentCount').html(data.length + (data.length==1 ? ' comment' : ' comments'))\n\t\t}})\t\n\t}", "function displayAllChirps() {\n $('.list-group-item').remove();\n $.ajax({\n url: '/api/chirps',\n type: 'get',\n success: function (data) {\n // calls function to display all pre-existing chirps\n for (var i in data) {\n if (i !== \"nextid\") {\n new Comment(data[i].user, data[i].text, i);\n }\n }\n }\n });\n}", "function displayComments(response){\n \n //Check if comments were received corectlly\n if(response.length > 0 && response[0].article_id === currentArticleId){\n \n var commentsContainer = $(\"#comments-list\");\n \n commentsContainer.empty(); //Clear comments list of old content\n \n //Iterates received comments and add them to the comments list\n for(var i = 0; i < response.length; i++){\n var comm = new Comment(response[i]);\n commentsContainer.append(createCommentElement(comm));\n }\n \n //Show pagination menu after articles were displayed\n\t $(\"#navigation\").removeClass('hidden');\n\t \n }else{\n popUp(\"error\",\"Comments were not received or they are not as expected!\");\n }\n \n}//END displayComments function", "function getUserTopComments(commentId, alphaComment, username) {\n reddit.get(\n '/user/' + username + '/comments/?limit=100&sort=top',\n {},\n function (error, response, body) {\n console.log(error);\n let info = JSON.parse(body);\n\n let top100Comments = '';\n\n for(let property in info.data.children) {\n top100Comments += info.data.children[property].data.body + '\\n';\n }\n const checkedTopComments = topCommentsChecker(top100Comments);\n const finalComment = alphaComment + '\\n\\n' + checkedTopComments;\n console.log(finalComment);\n\n postComment(commentId, finalComment);\n })\n}", "function dbFetchComments(action) {\n var payload, postId, page, limit, getCommentsRequest, commentResult;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function dbFetchComments$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n payload = action.payload;\n postId = payload.postId, page = payload.page, limit = payload.limit;\n getCommentsRequest = _api_CommentAPI__WEBPACK_IMPORTED_MODULE_1__[\"default\"].createGetCommentsRequest(postId);\n _context.next = 5;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_4__[\"put\"])(_store_actions__WEBPACK_IMPORTED_MODULE_6__[\"serverActions\"].sendRequest(getCommentsRequest));\n\n case 5:\n _context.prev = 5;\n _context.next = 8;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_4__[\"call\"])(commentService.getComments, postId, page, limit);\n\n case 8:\n commentResult = _context.sent;\n\n if (commentResult.hasMore) {\n _context.next = 12;\n break;\n }\n\n _context.next = 12;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_4__[\"put\"])(_store_actions__WEBPACK_IMPORTED_MODULE_6__[\"commentActions\"].notMoreComments(postId));\n\n case 12:\n _context.next = 14;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_4__[\"put\"])(_store_actions__WEBPACK_IMPORTED_MODULE_6__[\"commentActions\"].addCommentList(postId, commentResult.comments));\n\n case 14:\n getCommentsRequest.status = _store_actions_serverRequestStatusType__WEBPACK_IMPORTED_MODULE_7__[\"ServerRequestStatusType\"].OK;\n _context.next = 17;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_4__[\"put\"])(_store_actions__WEBPACK_IMPORTED_MODULE_6__[\"serverActions\"].sendRequest(getCommentsRequest));\n\n case 17:\n _context.next = 24;\n break;\n\n case 19:\n _context.prev = 19;\n _context.t0 = _context[\"catch\"](5);\n getCommentsRequest.status = _store_actions_serverRequestStatusType__WEBPACK_IMPORTED_MODULE_7__[\"ServerRequestStatusType\"].Error;\n _context.next = 24;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_4__[\"put\"])(_store_actions__WEBPACK_IMPORTED_MODULE_6__[\"serverActions\"].sendRequest(getCommentsRequest));\n\n case 24:\n case \"end\":\n return _context.stop();\n }\n }\n }, _marked, null, [[5, 19]]);\n}", "getAllcomments(slug) {\n return HelperClass.getRequest(`/articles/comments/${slug}`);\n }", "function CommentsController (db) {\n\t\"use strict\";\n\n\tvar dao = new CommentsDAO(db);\n\n\tthis.add = function(req, res, next) {\n\t\t\"use strict\";\n\n\t\tdao.add(req.params, function(err, result) {\n\t \t\"use strict\";\n\n\t \tif (err)\n\t \t\treturn next(err);\n\n\t \tconsole.log(\"Created \" + result);\n\t \t\n\t \tres.setHeader(\"Content-Type\", \"application/json\");\n\t \tres.send(result);\n\t \treturn next();\n\t });\n \n\t}\n\n\tthis.remove = function(req, res, next) {\n\t\t\"use strict\";\n\n\t\tdao.remove(req.params.id, function(err, result) {\n\t \t\"use strict\";\n\n\t \tif (err)\n\t \t\treturn next(err);\n\n\t \tconsole.log(\"Removed \" + req.params.id );\n\t \t\n\t \tres.setHeader(\"Content-Type\", \"application/json\");\n\t \tres.send();\n\t \treturn next();\n\t });\n \n\t}\n\tthis.get = function(req, res, next) {\n\t\t\"use strict\";\n\n\t\tdao.get(req.params.id, function(err, comment) {\n\t \t\"use strict\";\n\n\t \tif (err)\n\t \t\treturn next(err);\n\n\t \tres.setHeader(\"Content-Type\", \"application/json\");\n\t \tres.send(comment);\n\t \treturn next();\n\t });\n \n\t}\n\tthis.getAll = function(req, res, next) {\n\t\t\"use strict\";\n\t\tvar max = parseInt(req.query.max);\n\t\tvar limit = max ? max : 10;\n \tdelete req.query.max; // remove max param and use other query params as criteria for search\n \tvar skip = parseInt(req.query.skip);\n \tvar skip = skip ? skip : 0;\n \tdelete req.query.skip; // remove skip param and use other query params as criteria for search\n \tvar sortSpec = req.params.sort\n \tdelete req.query.sort;\n\n \tvar criteria = req.query;\n\n \tdao.getAll(criteria, skip, limit, sortSpec,function(err, items) {\n \t\t\"use strict\";\n\n \t\tif (err)\n \t\t\treturn next(err);\n\n \t\tres.setHeader(\"Content-Type\", \"application/json\");\n \t\tres.send(items);\n \t\treturn next();\n \t});\n \n \t}\n\n\tthis.update = function(req, res, next) {\n\t\t\"use strict\";\n\t\tvar commentId = req.params.id;\n\n\n\t\tdao.update(commentId, req.params, function(err, result){ \n\t \t\"use strict\";\n\n\t \tif (err)\n\t \t\treturn next(err);\n\n\t \tres.setHeader(\"Content-Type\", \"application/json\");\n\t \tres.send(200);\n\t \treturn next();\n\t });\n\t}\n}", "function renderComments ( data ) {\n\t\tif ( data && data.comments ) {\n\t\t\tvar comments = data.comments;\n\t\t\tcomments.forEach( function ( comment ) {\n\t\t\t\tcomment.margin = comment.depth * 5 + '%';\n\t\t\t\tvar is_target = comment._id == window.target_comment;\n\t\t\t\tvar rendered_comment = comment_template( \n\t\t\t\t\t\t{ comment: comment, \n\t\t\t\t\t\t is_mod: data.is_mod, \n\t\t\t\t active_user_id: data.active_user_id,\n\t\t\t\t site_url: window.site_url,\n\t\t\t\t target_comment: is_target} );\n\n\t\t\t\t$('.comments-listing').append( rendered_comment );\n\n\t\t\t\t// Do we need to animate to the linked comment??\n\t\t\t\tif ( is_target ) {\n\t\t\t\t\t// Why yes we do.\n\t\t\t\t\t$('html, body').animate({\n\t\t\t\t scrollTop: $(\".comments .target-comment\").offset().top - $(window).height() / 2\n\t\t\t\t }, 750, function() {\n\t\t\t\t \t$('.comments .target-comment').removeClass('target-comment');\n\t\t\t\t });\n\t\t\t\t}\n\n\t\t\t});\n\t\t}\n\t}", "function getAllComments(){\n\tvar secret_key = \"630008bbe5ae4d6fbf3266dfbacd648e\";\n\tvar renren = new OAuth2('renren', {\n\t\tclient_id:'de7d400db676479b9847a0cdecefac2d',\n\t\tclient_secret:secret_key,\n\t\tapi_scope:'read_user_status,read_user_comment,read_user_request' \n\t});\n\t\n\trenren.authorize(function() {\n\t\tupdate_status('授权成功,开始获取好友回复...');\n\t\taccess_token = renren.getAccessToken();\n\t\tif (window.console) {\n\t\t\tconsole.log(access_token); \n\t\t}\n\t\ttime_allocation = 1000;\n\t\tvar iAFC = 0;\n\t\tfor (var owner_id in globalStatus){\n\t\t\tif (globalStatus[owner_id].crawl){\n\t\t\t\tfor (var i=0; i<globalStatus[owner_id].doingArray.length; i++){\n\t\t\t\t\tcomment_count = globalStatus[owner_id].doingArray[i].comment_count;\n\t\t\t\t\tif (comment_count && globalStatus[owner_id].doingArray[i].crawl){\n\t\t\t\t\t\tglobalSignAFC.push(false);\n\t\t\t\t\t\tgetComment(owner_id, i, time_allocation, secret_key, access_token, iAFC);\n\t\t\t\t\t\tiAFC ++;\n\t\t\t\t\t\ttime_allocation += paramInterval * 1000;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tglobalStatus[owner_id].doingArray[i].replyList = [];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (var i=0; i<globalStatus[owner_id].doingArray.length; i++){\n\t\t\t\t\tglobalStatus[owner_id].doingArray[i].replyList = [];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsetTimeout(function(){\n\t\t\tglobalOkWithFriendComment = true;\n\t\t}, time_allocation+10*1000);\n\t});\n}", "function getComments(req, res) {\n Arena.findOne({ _id: req.params.id }, function (err, arena) {\n if(err){\n res.status(400).json({ error: err.message });\n return;\n }\n return res.json({comments: arena.comments});\n });\n}", "function displayCommentApi() {\r\n axios.get(`https://project-1-api.herokuapp.com/comments${apiKey}`)\r\n .then(response => {\r\n response.data.sort((a, b) => {a.timestamp < b.timestamp ? 1 : -1})\r\n response.data.forEach(index => {\r\n displayComment(index);\r\n })\r\n })\r\n .catch((error) => {\r\n console.error(error);\r\n })\r\n}", "function addCommentsToView(comments) {\n for (var i = 0; i < comments.length; i++) {\n var parentCommentID = comments[i].ParentCommentID;\n var target = $(\"#\" + parentCommentID + \">.commentChildren\");\n if (target != null) {\n var html = commentTemplate([comments[i]]); // Comment template is defined in Project.js\n target.append(html);\n $(\"#\" + comments[i].CommentID).hide();\n $(\"#\" + comments[i].CommentID).show(1000);\n }\n }\n}", "function loadComments() {\n fetch('/data').then((response) => response.json()).then((comments) => {\n const commentListElement = document.getElementById('comments-container');\n comments.forEach((comment) => {\n commentListElement.appendChild(createCommentElement(comment.name,\n comment.message, comment.time));\n });\n });\n}", "function getComments(){\n\tvar url = \"servlet/child/comments/i\" + imgSrc.split(\".\")[0]\n\tvar div = document.getElementById(\"comment-field\")\n\tdiv.innerHTML = \"<br><p><b><u>Comments: </u></b></p>\"\n\tvar req = new XMLHttpRequest()\n\treq.open(\"GET\", url, true)\n\treq.onreadystatechange = function() {\n\t\tif ( req.readyState == 4) {\t\n\t\t\tvar d = req.responseXML.documentElement\n\t\t\tvar e = d.childNodes;\n\t\t\te = e[0];\n\t\t\tvar f = e.childNodes\n\t\t\tfor(var i = 0; i < f.length; i++){\n\t\t\t\tvar comment = f[i].childNodes;\n\t\t\t\tif(!(f[i].nodeName == \"#text\")){\n\t\t\t\t\tdiv.innerHTML += \"<p style='padding:10px; border:1px solid #000000'><b>\" + f[i].nodeName + \": </b>\" + f[i].textContent + \"</p>\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\t\t\t\t\t\t\n\treq.send(null) \n}", "function getUserCommentList(userIdentity) {\n const APILIMIT = 100;\n\n return new Promise((resolve) => {\n let xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n let response = JSON.parse(this.responseText); //convert the result into JSON\n let thingList = response.data.children.map((x) => x.data.name); //get an array of all the \"thing ID's\" or whatever they're called. They can be utilized to delete comments.\n resolve(thingList);\n }\n };\n let targetURL =\n \"/user/\" + userIdentity.name + \"/comments.json?limit=\" + APILIMIT;\n xhttp.open(\"GET\", targetURL, true);\n xhttp.send();\n });\n}", "function fetchComments(fundraiserId, page, limit) {\n var paginated = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n return new Promise(function (resolve, reject) {\n if (!paginated) {\n page = 1;\n }\n\n external_commonjs_vue_commonjs2_vue_root_Vue_default.a.axios.get(\"\".concat(baseURL, \"/comments?fundraiser_id=\").concat(fundraiserId, \"&_limit=\").concat(limit, \"&_page=\").concat(page++)).then(function (response) {\n if (response.data.length) {\n resolve(response.data);\n } else {\n reject({\n code: 404\n });\n }\n }).catch(function (e) {\n reject(e);\n });\n });\n}", "function get_new_comments() {\n\t\n\tvar nid = jQuery('#task_nid').val();\n\tvar cid = jQuery(\"#last_comment_details\").attr(\"data-cid\");\n\tvar time = jQuery(\"#last_comment_details\").attr(\"data-time\");\n\tvar count = jQuery(\"#last_comment_details\").attr(\"data-count\");\n\tvar content;\t\n\tjQuery.ajax({\n type:\"get\", \n url: \"/js/new_comment_show/\"+cid+\"/\"+nid,\n beforeSend: function() {\n var loadText = Drupal.t('Loading...');\n jQuery( \"#new_arrival\" ).after( \"<div class='ajax-processed-throbber'>\"+loadText+\"</div>\" );\n \tjQuery('#new_comment').removeAttr('onclick');\n },\n success: function(data){\n \tcontent = data;\n \t jQuery(\"#latest_comment\").prepend(content);\n \t Drupal.attachBehaviors(jQuery(\"#latest_comment\"));\n \t jQuery(\"#post_list_content div.ajax-processed-throbber\").hide();\n \t jQuery(\"#new_arrival\").slideUp('slow');\n \t var cid_last = jQuery(\"#last_cid\").val();\n \t\tvar count_last = jQuery(\"#last_count\").val();\n \t\tjQuery(\"#last_comment_details\").attr(\"data-cid\", cid_last);\n \t\tjQuery(\"#last_comment_details\").attr(\"data-count\", count_last);\n \t\tjQuery('.comment_count a').html(count_last);\n \t\tjQuery('#new_comment').attr('onclick', 'get_latest_count();');\n }\n });\n}", "fetchContent() {\n Axios.jsonp(\n `${CONTENT_PATH}${startIndex_param}${startIndex}&${count_param}${count}`\n )\n .then(res => {\n this.setContent(res);\n\n this.fetchComments(res);\n })\n .catch(err => {\n console.log(err);\n });\n }", "function fetchDiscussions(refresh) {\n if (refresh) {\n page = 0;\n }\n\n return $mmaModForum.getDiscussions(forum.id, page).then(function(response) {\n var promise = usesGroups ?\n $mmaModForum.formatDiscussionsGroups(forum.cmid, response.discussions) : $q.when(response.discussions);\n return promise.then(function(discussions) {\n if (page == 0) {\n $scope.discussions = discussions;\n } else {\n $scope.discussions = $scope.discussions.concat(discussions);\n }\n\n $scope.count = $scope.discussions.length;\n $scope.canLoadMore = response.canLoadMore;\n page++;\n\n preFetchDiscussionsPosts(discussions);\n });\n }, function(message) {\n $mmUtil.showErrorModal(message);\n $scope.canLoadMore = false; // Set to false to prevent infinite calls with infinite-loading.\n return $q.reject();\n });\n }", "function getLikesOfChildComment(childCommentId) {\n let $likeDiv = $(`#${'child-comment-likes' + childCommentId}`);\n const $ASYNC = false;\n const $URL = `${$HEROKU_URL}/api/v1/likedComments/comment/${childCommentId}/count`;\n const $VERB = 'GET';\n const $DATATYPE = 'json';\n let childCommentLikesCount = 0;\n\n $.ajax({\n async: $ASYNC,\n type: $VERB,\n url: $URL,\n dataType: $DATATYPE,\n success: function (childCommentLikes) {\n childCommentLikesCount = childCommentLikes;\n }\n });\n $likeDiv.replaceWith(`<a id=\"${'child-comment-likes' + childCommentId}\" class=\"btn text-red\" style=\"font-size: medium\" onclick=\"createLikeToComment(${childCommentId})\"><ion-icon name=\"heart\" size=\"smaller\"></ion-icon> ${childCommentLikesCount}</a>`);\n}", "function ajaxGetComments(id, page, url) {\n var url = url || '/future/comments/';\n var page = page || '';\n var arguments = '?ajax=true&t=' + Math.round(new Date().getTime()) + page ;\n \n return jQuery.getJSON(url + id + arguments);\n }", "async function frontComments() {\n const CommentsText = [];\n const OwnId = []; //frontcomments own id\n const ParentId = []; //or storyid\n const Ownkids = []; //front comment kids\n const kidolen = [];\n const [, kidos, Title, Url] = await StoriesOnFrontPage();\n\n const allkids = [].concat(...kidos);\n\n const requests = allkids.map((x) =>\n fetch(`https://hacker-news.firebaseio.com/v0/item/${x}.json?print=pretty`)\n );\n const response = await Promise.all(requests);\n const filter = await Promise.all(response.map((res) => res.json()));\n\n for (const [k, v] of filter.entries()) {\n if (v.deleted !== true) {\n CommentsText.push(v.text);\n OwnId.push(v.id);\n ParentId.push(v.parent);\n Ownkids.push(v.kids);\n } else {\n OwnId.push(v.id);\n ParentId.push(v.parent);\n }\n }\n\n return [OwnId, ParentId, Ownkids, CommentsText, kidolen];\n //OwnId:frontcomments own id\n //ParentId:or storyid\n //Ownkids:kids of front comment\n}", "function all_comments(){\r\n\treturn this.getChildren('Comment',{},{sort:{date:'asc'}});\r\n}", "function getComments(){\n $(\"#example-list\").empty()\n $.get(\"/api/examples/\" + postId,function( data ){\n console.log(data.Comments)\n for(i = 0; i < data.Comments.length; i++){\n $(\"#example-list\").append($(\"<div class='row animation-element slide-left'><div class='card mt-4 cardx'><div class='card-body'><p>\"+ data.Comments[i].text +\"</p></div></div></div>\"))\n }\n})\n}", "function getComments(article_id, pageNumber, pageSize) {\n\n return $http.get(URLS.BASE + URLS.ARTICLES + article_id + \"/\" + URLS.COMMENTS + pageNumber + '/' + pageSize)\n .then((responce) => {\n return responce.data;\n })\n .catch((error) => {\n console.log(error);\n return $q.reject(error);\n });\n\n }", "function showComments( parent ) {\n $.ajax( {\n type: 'POST',\n url: 'bat/comments-form.php',\n success: function ( response ) {\n let commentsContent = $( parent );\n let html = '';\n let myJson = JSON.parse( response );\n\n myJson.forEach( function ( comment ) {\n html += commentHtml( comment );\n } );\n\n commentsContent.html( html );\n }\n } );\n }", "function fetchDiscussions(callback) {\n var comments = Comments(conf);\n\n comments.get(ret, function(err, comments) {\n if (err) {\n return callback(err);\n }\n ret.discussions = comments;\n callback();\n });\n }", "function Comment(req,res) {\n var comment = req.params.comment;\n var noteId = req.params.noteId;\n var username = req.params.username;\n if(noteId.length <10){\n noteModel\n .findApiNoteComment(noteId)\n .then(\n function (response) {\n if(response == null){\n noteModel\n .addApiComment(comment, noteId, username)\n .then(\n function (stats) {\n res.send(200);\n },\n function (error) {\n res.statusCode(404).send(error);\n });\n }else{\n noteModel\n .pushComment(comment, noteId, username)\n .then(function (response) {\n res.json(200);\n },\n function (error) {\n res.statusCode(404).send(error);\n });\n }\n }\n\n );\n }else{\n noteModel\n .addComment(comment, noteId, userId)\n .then(\n function (stats) {\n console.log(stats);\n res.send(200);\n },\n function (error) {\n res.statusCode(404).send(error);\n });\n }\n }", "function populateChildren(contentList, depth, limit){\n contentList.forEach(function(content) {\n ContentModel.get({contentModel:content.id, limit:100, skip:0, sort:'createdAt DESC'}).then(function(contentList){\n if (contentList.length > 0){\n depth++ \n content.children = contentList;\n $scope.content.children.push(content);\n if (depth < limit){populateChildren(contentList, depth, limit)}\n }\n });\n });\n }", "loadComments() {\n $.ajax({\n url: '/Vuvuzela/services/comment/get_comments.php',\n type: 'GET',\n data: {\n first: this.lastCommentID === undefined ? -1 : this.lastCommentID,\n num: 3,\n article: this.articleID\n },\n success: (msg) => {\n if(msg['status'] === 'error') {\n this.showError('Error downloading comments');\n console.log(msg['errorMsg']);\n } else if(msg['status'] === 'success') {\n if(msg['data'].length < 3)\n $(`#${this.idDOM}`).children('.article-big-comments-button-show-more').hide();\n this.addContent(msg['data']);\n }\n },\n error: (jqXHR, textStatus, errorThrow) => {\n this.showError('Error downloading comments');\n console.log(jqXHR.responseText + \"\\n\" + textStatus + \"\\n\" + errorThrow)\n },\n dataType: 'json'\n });\n }", "function buildComments(comments) {\n\tif(comments.length == 0){\n\t\t$('.load-more').text('All comments loaded');\n\t\treturn\n\t}\n\t$('.comments-container').prepend(loaderElement);\n\tfor (let comment of comments) {\n\t\tconsole.log('comment: ', comment)\n\t\tlet commentElement = \"\\\n\t\t<div class='row'>\\\n\t\t\t<div class='comment-container hidden col-md-8 col-sm-12 mx-auto'>\\\n\t\t\t\t<div class='comment-content'>\" + comment.body + \"</div>\\\n\t\t\t\t<div class='btn-section'>\\\n\t\t\t\t\t<button class='update-comment' data-id='\" + comment.id + \"'>U</button>\\\n\t\t\t\t\t<button class='remove-comment' data-id='\" + comment.id + \"'>X</button>\\\n\t\t\t\t</div>\\\n\t\t\t\t<div class='date-section'>\\\n\t\t\t\t\t\t<span>Updated at: \"+comment.updated_at+\"</span>\\\n\t\t\t\t\t\t<br>\\\n\t\t\t\t\t<span>Created at: \"+comment.created_at+\"</span>\\\n\t\t\t\t</div>\\\n\t\t\t</div>\\\n\t\t</div>\\\n\t\t\";\n\t\t$('.comments-container').append(commentElement);\n\t}\n\tlet hiddenComments = $('.hidden');\n\taddCommentEvents(); // because the comment came as async call\n\n\tif(hiddenComments.length > 0) animateIn(hiddenComments);\n\telse $('.lds-ring').parent().remove();\n}", "function ApiGetCommentsFromLearner(cmiCoreDTO) {\n var result = \"\";\n var errorCode = \"0\";\n var parameter = cmiCoreDTO.parameter;\n var commentsLearnerList = cmiCoreDTO.commentsLearnerList;\n\n if (parameter == \"cmi.comments_from_learner._children\") {\n result = cmiCoreDTO.commentsFromLearnerChildren;\n } else if (parameter == \"cmi.comments_from_learner._count\") {\n result = commentsLearnerList.length;\n } else if (parameter == \"cmi.comments_from_learner\") {\n errorCode = \"401\";\n } else {\n var nValue = ApiGetNValue(parameter, \"cmi.comments_from_learner.\");\n if (nValue == -1) {\n errorCode = \"403\";\n } else if (nValue >= commentsLearnerList.length) {\n errorCode = \"301\";\n } else {\n var cmiCommentsLearnerDTO = commentsLearnerList[nValue];\n var lastParam = ApiGetLastParam(parameter);\n\n // cmi.comments_from_learner.n.comment\n if (lastParam == \"comment\") {\n result = cmiCommentsLearnerDTO.learnerComment;\n }\n // cmi.comments_from_learner.n.location\n else if (lastParam == \"location\") {\n result = cmiCommentsLearnerDTO.learnerLocation;\n }\n // cmi.comments_from_learner.n.timestamp\n else if (lastParam == \"timestamp\" || lastParam == \"date_time\") {\n result = cmiCommentsLearnerDTO.learnerTimestamp;\n } else {\n errorCode = \"201\";\n }\n\n if (result == null) {\n result = \"\";\n errorCode = \"403\";\n }\n }\n }\n\n cmiCoreDTO.result = result;\n cmiCoreDTO.errorCode = errorCode;\n\n return cmiCoreDTO;\n}", "function reloadComments() {\n\t$('.load-more').text('Load More ...');\n\tclearComments();\n\tgetComments();\n}", "function cmtxRefreshComments(options) {\n var request = jQuery.ajax({\n type: 'POST',\n cache: false,\n url: options.commentics_url + 'frontend/index.php?route=main/comments/getComments',\n data: 'cmtx_page_id=' + encodeURIComponent(options.page_id) + '&cmtx_sort_by=' + encodeURIComponent(options.sort_by) + '&cmtx_search=' + encodeURIComponent(options.search) + '&cmtx_page=' + encodeURIComponent(options.page_number),\n dataType: 'json',\n beforeSend: function() {\n if (options.effect) {\n jQuery('.cmtx_loading_icon').show();\n\n jQuery('body').addClass('cmtx_loading_body');\n }\n }\n });\n\n request.always(function() {\n if (options.effect) {\n jQuery('.cmtx_loading_icon').hide();\n\n jQuery('body').removeClass('cmtx_loading_body');\n }\n });\n\n request.done(function(response) {\n if (response['result']) {\n if (options.pagination == 'button' || options.pagination == 'infinite') {\n var comments = jQuery('.cmtx_comment_boxes', jQuery(response['result'])).html();\n\n jQuery('.cmtx_comment_boxes').append(comments);\n\n jQuery('#cmtx_more_button').val(cmtx_js_settings_comments.lang_button_more);\n\n jQuery('#cmtx_more_button').prop('disabled', false);\n\n jQuery('#cmtx_more_button').removeClass('cmtx_button_disabled');\n\n var total_comments = parseInt(jQuery('#cmtx_loading_helper').attr('data-cmtx-total-comments'));\n\n if (total_comments > jQuery('.cmtx_comment_section').length) {\n // there are more comments that can be loaded\n } else {\n jQuery('#cmtx_more_button').remove();\n\n jQuery('#cmtx_loading_helper').attr('data-cmtx-load', '0');\n }\n } else {\n jQuery('.cmtx_comments_section').html(response['result']);\n }\n\n if (jQuery('#cmtx_search').val() != '') {\n jQuery('#cmtx_search').addClass('cmtx_search_focus');\n };\n\n /* Load the comment settings in case they weren't already loaded (if there were no comments) */\n if (jQuery('#cmtx_js_settings_comments').length) {\n cmtx_js_settings_comments = JSON.parse(jQuery('#cmtx_js_settings_comments').text());\n }\n\n /* Load the notify settings in case they weren't already loaded (if there were no comments) */\n if (jQuery('#cmtx_js_settings_notify').length) {\n cmtx_js_settings_notify = JSON.parse(jQuery('#cmtx_js_settings_notify').text());\n }\n\n /* Load the online settings in case they weren't already loaded (if there were no comments) */\n if (jQuery('#cmtx_js_settings_online').length) {\n cmtx_js_settings_online = JSON.parse(jQuery('#cmtx_js_settings_online').text());\n }\n\n cmtxViewReplies();\n cmtxTimeago();\n cmtxHighlightCode();\n cmtxViewersOnline();\n cmtxCloseShareBox();\n cmtxClosePermalinkBox();\n }\n });\n\n request.fail(function(jqXHR, textStatus, errorThrown) {\n if (console && console.log) {\n console.log(jqXHR.responseText);\n }\n });\n}", "function getComments(callback)\n {\n var fullLink = getUrl();\n var splittedLink = fullLink.split(\"?\");\n var href = splittedLink[0] + \"/list\";\n var commentsQueryString = splittedLink[1];\n var splittedQs = commentsQueryString.split('&');\n var body = {};\n\n for(var key in splittedQs) {\n var t = splittedQs[key].split('=');\n body[t[0]] = t[1];\n }\n\n var init = {\n type: 'POST',\n data: JSON.stringify(body),\n crossDomain: true,\n headers: { 'Access-Control-Allow-Origin': '*' },\n xhrFields: {\n withCredentials: true\n },\n contentType: \"application/json; charset=utf-8\",\n url: href,\n success: function(data, status){\n callback(true, data);\n },\n error: function(xOptions, error)\n {\n callback(false);\n }\n };\n\n $.PercServiceUtils.makeAjaxRequest(init);\n }", "function loadComments() {\n loadCommentTexts().then(amount => {loadCommentAvatars(amount)});\n }", "parseComments(redditResponse) {\n const posts = redditResponse.data.children;\n const allComments = [];\n // Parse Posts\n posts.forEach((post) => {\n const data = post.data;\n // TODO: We should recurse and collect replies to this comment.\n const newComment = new _shared_classes__WEBPACK_IMPORTED_MODULE_3__[\"Comment\"](data.id, data.body_html);\n allComments.push(newComment);\n });\n return allComments;\n }", "_getComments(){\n // repo\n // call REST api resources (AJAX request)\n const commentList = [\n {author : \"First\", body : \"This is first comment!!!\" },\n {author : \"Second\", body : \"This is second comment!!!\" },\n {author : \"Third\", body : \"This is third comment!!!\" },\n ];\n\n // return a JSX Code\n // loop through all comments and generate a Comment component\n return commentList.map(comment => {\n return (<Comment author={comment.author} body={comment.body} />);\n });\n }", "function getComments() {\n $http.get(CONFIG.API_BSE_URL+'resources/' + $stateParams.id + '/comments')\n .success(function(response){\n $scope.comments = response.data.comments;\n });\n }", "async getComments() {\n try {\n if (!this.API || !this.issue || this.isLoadingComments)\n return;\n this.isLoadingComments = true;\n const comments = await this.API.getComments({\n accessToken: this.accessToken,\n issueId: this.issue.id,\n query: this.query,\n });\n this.comments = comments;\n if (this.query.page !== comments.page) {\n this.query.page = comments.page;\n }\n if (this.query.perPage !== comments.perPage) {\n this.query.perPage = comments.perPage;\n }\n return comments;\n }\n catch (e) {\n if (e.response &&\n [401, 403].includes(e.response.status) &&\n !this.isLogined) {\n this.isLoginRequired = true;\n }\n else {\n this.$emit('error', e);\n throw e;\n }\n }\n finally {\n this.isLoadingComments = false;\n }\n }", "function fetchReadMore(baseURL, title, showReadMoreHandler) {\n var xhr = new XMLHttpRequest()\n if (baseURL === null) {\n baseURL = ''\n }\n\n const pageCountToFetch = 3\n const params = {\n action: 'query',\n continue: '',\n exchars: 256,\n exintro: 1,\n exlimit: pageCountToFetch,\n explaintext: '',\n format: 'json',\n generator: 'search',\n gsrinfo: '',\n gsrlimit: pageCountToFetch,\n gsrnamespace: 0,\n gsroffset: 0,\n gsrprop: 'redirecttitle',\n gsrsearch: `morelike:${title}`,\n gsrwhat: 'text',\n ns: 'ppprop',\n pilimit: pageCountToFetch,\n piprop: 'thumbnail',\n pithumbsize: 120,\n prop: 'pageterms|pageimages|pageprops|revisions|extracts',\n rrvlimit: 1,\n rvprop: 'ids',\n wbptterms: 'description',\n formatversion: 2\n }\n\n const paramsString = Object.keys(params)\n .map(function(key){\n return `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`\n })\n .join('&')\n\n xhr.open('GET', `${baseURL}/w/api.php?${paramsString}`, true)\n xhr.onload = function() {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n showReadMoreHandler(JSON.parse(xhr.responseText).query.pages)\n } else {\n // console.error(xhr.statusText);\n }\n }\n }\n /*\n xhr.onerror = function(e) {\n console.log(`${e}`);\n // console.error(xhr.statusText);\n }\n */\n xhr.send(null)\n}", "async function midcomments() {\n const [\n OwnIdorSecondPartid,\n firstparentid,\n Ownkidsid,\n ,\n ] = await frontComments();\n const subsequentComments = [];\n const ourkids = [];\n const subparentid = [];\n const ownid2 = [];\n //const Ownkidlen = [];\n\n const furthercomments = [].concat(...Ownkidsid).filter((e) => e !== undefined);\n\n //fetch childrens of first comment\n const requests = furthercomments.map((x) =>\n fetch(`https://hacker-news.firebaseio.com/v0/item/${x}.json?print=pretty`)\n );\n const response = await Promise.all(requests);\n const filter = await Promise.all(response.map((res) => res.json()));\n for (const [k, v] of filter.entries()) {\n if (v === null) {\n console.log(\"null val\");\n } else if (v.deleted !== true) {\n subsequentComments.push(v.text);\n ownid2.push(v.id);\n subparentid.push(v.parent);\n ourkids.push(v.kids);\n } else {\n console.log(\"undefined\");\n subparentid.push(v.parent)\n ownid2.push(v.id)\n }\n //return [ourkids,subparentid,subsequentComments]\n //subsequentcomments:childrens of front comments\n //subparent:frontcomments\n }\n return [ownid2, ourkids, subparentid, subsequentComments];\n}", "silentRefreshComments() {\n\t\tfetch(\"/api/posts/\"+this.props.id+\"/comments/\", {\n\t\t\tmethod: 'GET',\n\t\t\tcredentials: \"same-origin\",\n\t\t\theaders : new Headers(),\n\t\t\theaders: {\n\t\t\t\t \"X-CSRFToken\": csrftoken,\n\t\t\t\t 'Accept': 'application/json',\n\t\t\t\t 'Content-Type': 'application/json',\n\t\t\t},\n\t\t})\n\t\t.then(res => res.json())\n\t\t.then(\n\t\t\t(result) => {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcomments: result,\n\t\t\t\t\tcomment_count: result.length,\n\t\t\t\t});\n\t\t\t},\n\t\t\t(error) => {\n\t\t\t\talert(\"Issue reaching server. Check your connection and refresh.\");\n\t\t\t}\n\t\t);\n\t}", "getAll(slug) {\n return this._$http({\n url: `${this._AppConstants.api}/foods/${slug}/comments`,\n method: 'GET',\n }).then((res) => res.data.comments);\n\n }", "function getChildCommentData(commentId) {\n const $ASYNC = false;\n const $URL = `${$HEROKU_URL}/api/v1/comments/childComments/comment/${commentId}`;\n const $VERB = 'GET';\n const $DATATYPE = 'json';\n let commentsResultArray = {};\n\n $.ajax({\n async: $ASYNC,\n type: $VERB,\n url: $URL,\n dataType: $DATATYPE,\n success: function (comments) {\n commentsResultArray = comments;\n }\n });\n return commentsResultArray;\n}", "function OnFetchMore(){\n setUrl(info.next);\n if(contacts.length==info.count){\n setHasMore(false) \n }\n}", "function getComments() {\n console.log(\"getComments\");\n fetch('/data')\n .then(response => response.json())\n .then((comments) => {\n var comment_content = '';\n for (var i = 0; i < comments.length; i++) {\n comment_content = comment_content + comment_item_code;\n comment_content = comment_content + comments[i].userName;\n comment_content = comment_content + comment_name_code;\n comment_content = comment_content + comments[i].currentTime;\n comment_content = comment_content + comment_time_code;\n comment_content = comment_content + comments[i].commentText;\n comment_content = comment_content + comment_text_code;\n }\n console.log(comment_content);\n document.getElementById('comment-list').innerHTML = comment_content;\n });\n}", "function displayTenMore() {\n if (!firstPageDisplayed) {\n firstPageDisplayed = parseInt(((postsStartPosition+10)/10), 10);\n }\n postsStartPosition = postsStartPosition+10;\n showPosts(10);\n }", "listComments() {\n\t\tthis._isMounted = true;\n\t\tAxios.get(\n\t\t\"http://jsonplaceholder.typicode.com/posts/\" +\n\t\t\tthis.props.match.params.postId +\n\t\t\t\"/comments?postId=\" +\n\t\t\tthis.props.match.params.postId\n\t\t)\n\t\t.then(result => {\n\t\t\tif (this._isMounted) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcomments: result.data,\n\t\t\t\t\tisLoading: false,\n\t\t\t\t\tpostId: this.props.match.params.postId,\n\t\t\t\t\terror: \"Loaded\",\n\t\t\t\t});\n\t\t\t}\n\t\t})\n\t\t.catch(error =>\n\t\t\tthis.setState({\n\t\t\t\terror: \"Loading Error\",\n\t\t\t\tisLoading: false\n\t\t\t})\n\t\t);\n \t}", "function fetchMorePosts()\n\t{\n\t\tsetTimeout(function(){\n\t\t\t\t$loaderbody.show();\n\t\t}, 3000)\n\n\t\tsetTimeout(function() {\n\n\t\t\tif($urlDeterminer)\n\t\t\t{\n\t\t\t\tgrabTypePosts();\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tgrabFeedPosts();\n\t\t\t}\n\n\t\t}, 6000)\n\t}", "function getComments(req, res) {\n Article\n .findOne({ _id: req.params.articleId })\n .populate('comments')\n\n // return all comments for that article\n .then(doc => res.json(doc.comments))\n .catch(err => res.status(404).send(err.message));\n}", "function getPostComments(pid, inclDeleted = false) {\n ajaxRequests++;\n\n return new Promise(function (resolve, reject) {\n if (typeof pid === 'undefined' || pid == null) { reject(); return; }\n\n $.get(`${location.origin}/posts/${pid}/comments?includeDeleted=${inclDeleted}&fkey=${fkey}`)\n .done(function (data) {\n const v = $(data).filter('.comment');\n resolve(v);\n })\n .fail(reject)\n .always(() => ajaxRequests--);\n });\n}", "function fetchRecent() {\n addAbout() \n fetchProjects(numRecentResponses, addProjectsToPage);\n if (includeBlogPosts) {\n fetchPosts(numRecentResponses, addPostsToPage);\n }\n}", "addContent(comments) {\n let $self = $(`#${this.idDOM}`);\n let $container = $self.children('.article-big-comments-list');\n\n if(comments.length === 0) return;\n\n this.lastCommentID = comments[comments.length - 1].id;\n let commentsObj = comments.map(comment => new Comment(comment, false));\n commentsObj.forEach(comment => comment.create($container));\n this.comments = this.comments.concat(commentsObj);\n }", "function traverseComments(root_id) {\n\tchildNodes = new Array();\n\n\t// since pre-order, start with root at beginning\n\tchildNodes.push(data.nodes[root_id]);\n\n\t// now recurse through children comments, from top to bottom.\n // already sorted by vote count.\n\tvar cids = data.nodes[root_id].children_ids;\n \n console.log(\"CIDs of \" + root_id + \" are \" + cids);\n\tfor (var i = 0; i < cids.length; i++) {\n\t\tvar cid = cids[i];\n\t\tchildNodes = childNodes.concat(traverseComments(cid));\n\t}\n\t\n\tconsole.log(\"Traversal of \" + root_id + \" is: \");\n\tfor (var i = 0; i < childNodes.length; i++) {\n\t\tconsole.log(\" \" + childNodes[i].id);\n\t}\n\treturn childNodes;\n}", "function viewMoreVisitHistory() {\r\n\tajaxSend( \"./findMoreVisit.json\" \r\n\t\t\t, { cmStorSeq\t\t: clickedCmStorSeq\r\n\t\t\t\t, pageNo \t\t: ++pageVisitNo\r\n\t\t\t }\r\n\t\t\t, viewMoreVisitHistoryAft );\r\n}", "getAllCommentsOfPost(bid, pid, callback) {\n var request = gapi.client.request({\n method: 'GET',\n path: pathBlogs + '/' + bid + '/posts/' + pid + '/comments'\n })\n\n request.execute((result) => {\n if (result.items) {\n const commentArray = result.items.map(el => new Comment(el.id, el.blog.id, el.post.id, el.author.displayName, el.published, el.updated, el.content))\n console.log(result.items);\n callback(commentArray)\n } else {\n callback()\n }\n })\n }", "function deleteChildComments(childCommentId) {\n let $childCommentDiv = $(`#${'delete-child-comment' + childCommentId}`);\n $.ajax({\n async: true,\n type: 'DELETE',\n url: `${$HEROKU_URL}/api/v1/comments/${childCommentId}`,\n dataType: 'json',\n success: function () {\n },\n error: function () {\n }\n });\n $childCommentDiv.empty();\n}", "function printComment() {\r\n fetch('/data').then(response => response.json()).then((comments) => {\r\n const taskListElement = document.getElementById('comment-container');\r\n comments.forEach((comment) => {\r\n taskListElement.appendChild(createCommentElement(comment));\r\n })\r\n });\r\n}", "function loadComments() {\n fetch('/list-comments').then(response => response.json()).then((comments) => {\n var commentListElement = document.getElementById('js-comment-list');\n // Deletes all of the current comments\n while (commentListElement.lastChild) {\n commentListElement.removeChild(commentListElement.firstChild); \n }\n\n comments.forEach((comment) => {\n commentListElement.appendChild(createCommentElement(comment));\n })\n });\n}", "function showComments(ajax) {\n\tif (ajax == '1') {\n\t\tdijit.byId(\"commentsResponse\").refresh();\n\t\tcommentTab(tagType,slaveID);\n\t}\n}", "function makeApiCommentRequest(apiUrl, commentPageNumber, commentsTimesLengths) {\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t//TODO: what if the video has no comments? \n\t\t// example: https://www.youtube.com/watch?v=KTkCPqBY7Gs\n\t\t// do all live videos have no comments?\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tfetchJsonWrapper(apiUrl, recurseOrDraw);\n\t\t\n\t\t// Parse results of YouTube API call, then either:\n\t\t// ... recurse (call \"makeApiCommentRequest\" again for next page of comments) \n\t\t// ... or draw (call \"drawVisualization\" if we're on the last page of comments or reached max number of comments to process)\n\t\tfunction recurseOrDraw(jsonResponse) { \n\t\t\t// var commentsThisPage = parseComments(jsonResponse);\n\t\t\tvar commentsThisPage = parseComments_TimeLength(jsonResponse);\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < commentsThisPage.length; i++) {\n\t\t\t\tcommentsTimesLengths.push(commentsThisPage[i]);\n\t\t\t}\n\t\t\tvar commentsProcessed = i + MAX_COMMENTS_PER_PAGE*(commentPageNumber-1);\n\t\t\t// console.log(\"comment page = \" + page);\n\t\t\tconsole.log(\"comments processed = \" + commentsProcessed);\n\t\t\tcommentPageNumber++;\n\t\t\t\n\t\t\tvar nextPageToken = jsonResponse.nextPageToken; // if there's another page of comments, this is the token to get it with the api call. Otherwise this is empty\n\t\t\tif ( commentsProcessed >= MAX_COMMENTS_TO_PROCESS) {\n\t\t\t\tconsole.log(\"Maximum number of comments (\" + MAX_COMMENTS_TO_PROCESS + \") reached. Halting API calls\");\n\t\t\t\tnextPageToken = false; // if we've processed too many comments, time to stop\n\t\t\t}\n\t\t\tif (nextPageToken) { // if another page of results exists ...\n\t\t\t\tapiUrl = buildCommentsApiRequestUrl(videoId, nextPageToken); \t// ... build api url for that page\n\t\t\t\tmakeApiCommentRequest(apiUrl, commentPageNumber, commentsTimesLengths); \t\t\t\t// ... and request that page (recursively)\n\t\t\t} else { // if this is the last page of results ...\n\t\t\t\t\n\t\t\t\t// var sortedArray = commentsTimesLengths.sort(function(a,b){return b-a});\n\t\t\t\t// logArray(sortedArray); // Log the list of comment lengths\n\t\t\t\t\n\t\t\t\tconsole.log(\"comments processed at draw time = \"+ commentsProcessed);\n\t\t\t\tdrawVisualization(\"manual\", commentsTimesLengths); \t\t\t//... draw with the results!\n\t\t\t}\n\t\t}\n\t}", "function build_replies_tree(child_list) {\n const child_map = (0, _keyBy3.default)(child_list, 'name');\n (0, _forEach3.default)(child_list, add_empty_replies_listing);\n (0, _forEach3.default)((0, _filter3.default)(child_list, child => child.constructor.name === 'Comment'), child => {\n child.replies._more = _More.empty_children;\n });\n (0, _remove3.default)(child_list, child => child_map[child.parent_id]).forEach(child => {\n if (child.constructor.name === 'More') {\n child_map[child.parent_id].replies._set_more(child);\n child.link_id = child_map[child.parent_id].link_id;\n } else {\n child_map[child.parent_id].replies.push(child);\n }\n });\n return child_list;\n}", "function _getComments(req, res){\n var missingParams = Validation.validateParams(req, [\n \"since\",\n \"id\",\n \"limit\"\n ]); //implied id in the URL\n\n if(missingParams.length > 0){\n return Output.sendJSON(res, Errors.clientErrors.ERROR_CLIENT_INVALID_PARAMS, {params: missingParams});\n }\n else if(!req.user){\n sails.log.error('Failed to share moment to Twitter', {error: \"Request object doesn't have user model instance\"});\n return Output.sendJSON(res, Errors.serverErrors.ERROR_SERVER_FAILED_TO_SHARE_TO_TWITTER);\n }\n\n new Promise(function(resolve, reject){\n var sinceFloat = parseFloat(req.param('since'));\n\n if(isNaN(sinceFloat)){\n return reject(new Error('since parameter must be UTC milliseconds'));\n }\n\n resolve(sinceFloat);\n })\n .then(function(sinceFloat) {\n return ProductServices.getComments(req.param('id'), sinceFloat, req.param('limit'), req.user);\n })\n .then(function(comments){\n Output.sendJSON(res, Errors.noError, {results: comments});\n })\n .catch(function(err){\n sails.log.error('Failed to get comments for product', {error: err});\n Output.sendJSON(res, Errors.serverErrors.ERROR_SERVER_FAILED_TO_FIND);\n });\n}", "* postComment (request, response) {\n const input = request.only('content', 'parent_id', 'repo_id')\n\n try {\n // Attempt to authenticate user based on auth token and subsequently create new comment\n const user = request.authUser\n input.user_id = user.id\n input.github = user.github\n console.log(input.parent_id)\n if (input.parent_id) {input.is_child = true}\n else {input.is_child = false}\n const comment = yield Comment.create(input)\n\n // Begin Logging Block\n console.log(chalk.blue('\\n=============================='))\n console.log(chalk.blue(' New Comment Posted'))\n console.log(chalk.blue('=============================='))\n console.log(chalk.dim.white(' Comment content: ') + chalk.white('%s') + chalk.dim.white('\\n email: ') + chalk.white('%s') + chalk.dim.white('\\n github account: ') + chalk.white('%s') + chalk.dim.white('\\n is_child: ') + chalk.white(\"%s\\n\"), input.content,request.authUser.email, request.authUser.github, input.is_child);\n // End Logging Block\n return response.json(comment.toJSON())\n\n} catch (e) {\n return response.status(401).json({ error: e.message });\n }\n}", "function viewMore() {\r\n\t\r\n\t// Send ajax data.\r\n\tajaxSend( \"./findVisitHistory.json\"\r\n\t\t\t, { usrId\t: document.querySelector( 'input[name=\"usrId\"]'\t).value\r\n\t\t\t\t, fDt\t: document.querySelector( \"#sFromDate\" \t\t\t).value\r\n\t\t\t\t, tDt\t: document.querySelector( \"#sToDate\" \t\t\t).value\r\n\t\t\t\t, usrNm\t: document.querySelector( \"#usrNm\" \t\t\t).value\r\n\t\t\t\t,pageNo:++pageNo}\r\n\t\t\t, searchVisitHistoryAft );\r\n\t\r\n}", "function getAllComments(postID,num){\n postIDLatest = postID;\n $(\".modal .post-comments\").empty();\n $.ajax({\n url: postURL + postID + \"/comments\",\n type: 'GET',\n contentType: 'application/json',\n success: function (res) {\n var i = res.length-1;\n for(i ; i >= 0 ; i--){\n var commentData = res[i];\n var dateObj = commentData.date.split(\" \");\n console.log(commentData);\n var currentComment= \"<div class='comment'>\"+\n \"<div class='media'>\"+\n \"<img src='images/profiles/user.jpeg' alt=''>\"+\n \"<div class='media-body'>\"+\n \"<h6>\"+commentData.name+\"</h6>\"+\n \"<span>\"+dateObj[0]+\"<i class='dot'></i>\"+dateObj[1].substr(0,dateObj[1].lastIndexOf(\":\"))+\"</span>\"+\n \"<p>\"+commentData.text+\"</p>\"+\n \"</div>\"+\n \"</div>\"+\n \"</div>\";\n if(num==-1){\n console.log(\"here\");\n $(\".modal .post-comments\").prepend(currentComment);\n break;\n }\n $(\".modal .post-comments\").append(currentComment);\n }\n },\n error: function () {\n // alert(\"Something Went Wrong!!\");\n },\n });\n}", "comments(parent, args, ctx, info) {\n // 'Post' Object data -> is present in 'parent' argument in comments() method\n return COMMENTS_DATA.filter(comment => {\n return comment.post === parent.id\n })\n }", "async function loadMorePosts() {\n if (end == true) {\n return\n }\n\n const posts = await fetch('/api/latest/load/morePosts?skip=' + skip + '&context=' + postContext + '&userid=' + userid);\n skip = skip + 1\n\n const json = await posts.json()\n\n if (json.length == 0) {\n document.getElementById('bottomWarning').innerHTML = 'Sorry, no more posts<span class=\"text-blue-600\">.</span>'\n\n return end = true\n }\n\n var html = ''\n\n for (i = 0; i < json.length; i++) {\n html = html + createPost(json[i])\n }\n\n var html = htmlToElems(html)\n\n document.getElementById('postsContainer').appendChild(html)\n}", "@action\n loadMore () {\n this.set('offset', this.offset + 8);\n this.fetchAllCourses.perform();\n }", "function fetchComments(quantity=5) {\n \n const endpoint = '/data?';\n var queryString = new URLSearchParams();\n queryString.append('quantity', String(quantity));\n const url = endpoint + queryString.toString();\n\n fetch(url).then(response => response.json()).then((commentData) => {\n let commentContent = \"\";\n\n if (commentData.length === 0 ) { // if there are no existing comments\n // disable the delete comments button & display \"No Comments\"\n document.getElementById('delete-comments-button').setAttribute('disabled','true');\n commentContent = '<div class=\"comment\"><p class=\"body-text\">No Comments</p></div>';\n document.getElementById('comment-list').innerHTML = commentContent;\n\n } else { // otherwise display the comments and any attached image\n for (let i = 0; i < commentData.length; i++) {\n let commentText = commentData[i].commentText; // The actual comment\n \n // Comment author name: \"'Anonymous' if there was not a name submitted.\"\n let commentAuthor = commentData[i].commentAuthor === \"\" ? \"Anonymous\" : commentData[i].commentAuthor; \n \n let authorEmailContent = \"\";\n // Show email if the user said so\n if (commentData[i].showEmail == true) {\n // 'No email provided' if comment had been submitted before implementation of authentication\n let authorEmail = commentData[i].authorEmail === \"\" ? \"No email provided\" : commentData[i].authorEmail;\n authorEmailContent = '<p class=\"footnote-text\"> ' + authorEmail + '</p>';\n }\n\n // Display image as well, if there is an image\n let blobKey = commentData[i].blobKey;\n fetchCommentImage(blobKey).then((imageUrl) => {\n commentContent += '<div class=\"comment\"><div class=\"flex-item\"><p class=\"body-text\"><b>' + commentAuthor + '</b></p>'\n + authorEmailContent\n + '<p class=\"body-text\">' + commentText + '</p></div>'; // outer <div> not closed yet\n\n if (imageUrl === null) { // No image\n commentContent += '</div>'; // close outer div\n } else if (imageUrl === undefined) { // Error occured\n commentContent += '<div class=\"body-text\">Error fetching image</div></div>';\n } else {\n commentContent += '<div class=\"flex-item\"><a href=' + imageUrl + ' target=\"_blank\"><img class=\"comment-image\" src=' \n + imageUrl + '></a></div></div>'; // add image\n }\n document.getElementById('comment-list').innerHTML = commentContent;\n });\n }\n }\n });\n}", "function getAllPosts(num){\n var userID = \"5\";\n $.ajax({\n url: postsURL + userID,\n type: 'GET',\n contentType: 'application/json',\n success: function (res) {\n var i = res.length-1;\n for(i ; i >= 0 ; i--){\n var postData = res[i];\n var dateObj = postData.date.split(\" \");\n var currentPost = \"<div class='post'>\"+\n \"<div class='image'>\"+\n \"<img src='images/profiles/user.jpeg' alt=''>\"+\n \"</div>\"+\n \"<div class='post-content'>\"+\n \"<div class='text'>\"+\n \"<h6 class='name second-color'>\"+postData.name+\"<span class='date'>\"+dateObj[0].substr(0,dateObj[0].lastIndexOf(\"/\"))+\"<i class='dot'></i>\"+dateObj[1].substr(0,dateObj[1].lastIndexOf(\":\"))+\"</span></h6>\"+\n \"<p>\"+postData.text+\"</p>\"+\n \"<span class='hr'></span>\"+\n \"</div>\"+\n \"<div class='votes'>\"+\n \"<div class='up'>\"+\n \"<i class='fas fa-chevron-up disabled'></i>\"+\n \"<span>\"+postData.votesUp+\"</span>\"+\n \"</div>\"+\n \"<div class='down'>\"+\n \"<span>\"+postData.votesDown+\"</span>\"+\n \"<i class='fas fa-chevron-down disabled'></i>\"+\n \"</div>\"+\n \"</div>\"+\n \"<div class='comments btn' data-toggle='modal' data-target='#comments' data-postid=\"+postData._id+\">\"+\n \"<span onclick=getAllComments('\"+postData._id+\"','0')>Comments</span>\"+\n \"</div>\"+\n \"</div>\"+\n \"</div>\";\n if(num==-1){\n $(\".profile .posts\").prepend(currentPost);\n break;\n }\n $(\".profile .posts\").append(currentPost);\n }\n },\n error: function () {\n alert(\"Something Went Wrong!!\");\n },\n });\n }", "function deleteAllComments() {\n const request = new Request('/delete-data', {'method': 'POST'});\n fetch(request).then(response => {\n fetchComments(); \n }\n );\n}", "function getComments(id) {\n $(\"#comments\").html(\"\");\n $.ajax({\n url: myroot + \"/comments?postId=\" + id,\n method: 'GET',\n success: function(data) {\n console.log(data);\n for(var i=0, len = data.length; i < len; i++){\n //debugger;\n if(data[i].postId == id){\n $(\"#comments\").append( \"<div id='comment\" + i + \"'style='padding:10px;' class='card'>\" +\n \"<div id='comment\" + i + \"body' class='card-body'>\" +\n \"<i>\" + getCountryFlag(data[i].country_code) + \"</i>\" +\n \"<p>\" + data[i].body + \"</p>\" +\n \"</div></div>\");\n }\n }\n },\n error: function (e) {\n console.log(e);\n }\n });\n\n}", "function listAllCommentsSwnapshot(req,res,next){\n //origine des comments, defaut: all \n req.checkQuery(\"from_user\").optional().isInt();\n req.checkQuery(\"from_news\").optional().isInt();\n req.checkQuery(\"from_pizza\").optional().isInt();\n\n req.checkQuery(\"etat\").optional().isCommentWaiting();\n\n req.getValidationResult().then(result=>{\n //requete par defaut: only waiting \n \n if(!result.isEmpty()){\n //a voir....\n let errors = result.array();\n for(let err of errors){\n req.query[err.param] = null;//annule le parametre\n }\n }\n \n //limite a 1 utilisateur\n let user_limit = req.query.from_user ? {\n id : req.query.from_user //si limite a 1 utilisateur en particulier\n } : null;\n\n //limite a 1 pizza\n let source= [\n {\n model:users,\n attributes:['id','nom','prenom'],\n where: user_limit\n }\n ];\n \n if(req.query.from_pizza){\n source.push({\n model: pizza,\n attributes:[],\n where:{\n id:req.query.from_pizza\n }\n });\n req.query.etat = \"all\";\n\n\n }else if(req.query.from_news){\n source.push({\n model: news,\n attributes:[],\n where:{\n id:req.query.from_news\n }\n });\n req.query.etat = \"all\";\n }\n\n let params = user_limit || req.query.etat == \"all\" ? null : {etat:\"waiting\"};\n\n\n\n return comments.findAll({\n attributes:[\"id\",\"date\",\"texte\",\"etat\"],\n where:params,\n include: source\n });\n }).then(dt=>{\n req._comments = dt.map(el=>{ \n return el.dataValues\n });\n next();\n }).catch(err=>next(err));\n}", "function GetCommentsFromFamily() {\n fetch('https://gentle-ridge-58844.herokuapp.com/family', {\n method: 'get',\n headers: {'content-type': 'application/json'},\n })\n .then(data => data.json())\n .then(res => CreateComment(res.forEach(obj => CreateComment(obj))))\n .catch(console.log);\n}", "async function createComments () {\n let comments = [];\n\n for (let i = 0; i < 100; i++){\n let userId = Math.ceil(Math.random()*31);\n let trackId = Math.ceil(Math.random()*40);\n let sentences = Math.ceil(Math.random()*4);\n let res = await fetch(`https://baconipsum.com/api/?type=meat-and-filler&sentences=${sentences}&start-with-lorem`)\n let data = await res.json()\n let comment = {\n content: data[0],\n userId,\n trackId\n }\n comments.push(comment)\n }\n // console.log(comments)\n}", "async function fetchComments (post, callback) {\n // Get this post's comments\n const comments = await r.getSubmission(post).expandReplies({ limit: 10, depth: 3 })\n\n // Add the comment bodies to list\n const AllComments = []\n // console.log('comment0: ', comments.comments[0])\n for (const comment of comments.comments) {\n var com = {}\n com.author = comment.author.name\n com.body = comment.body\n com.body_html = comment.body_html\n com.permalink = comment.permalink\n com.score = comment.score\n com.subreddit = comment.subreddit_name_prefixed\n com.timestamp = comment.created_utc // .created also an optino\n com.depth = comment.depth\n com.guildings = comment.guildings\n\n AllComments.push(com)\n }\n return AllComments\n}", "function expandComments($item) {\n // Regardless of round, we expand whatever long coments are visible\n var $expandLink = $item.find(S_EXPAND_COMMENT);\n if ($expandLink.length) {\n $expandLink.each(function(i, item) {\n click(item);\n });\n return;\n }\n\n var $commentsButton = $item.find(_C_COMMENTS_OLDER_BUTTON);\n if ($commentsButton.length && $commentsButton.is(':visible')) {\n click($commentsButton);\n } else {\n $commentsButton = $item.find(_C_COMMENTS_BUTTON);\n if ($commentsButton.length && $commentsButton.is(':visible')) {\n click($commentsButton);\n }\n }\n}", "async function getAllComment(commentSection, userData) {\n commentSection.innerHTML = \" \";\n const div = document.createElement('div');\n div.classList.add('add-comment');\n div.innerHTML = `\n <input class=\"comment-input\" type=\"text\" placeholder=\"Add Comment\">\n <i class=\"fas fa-paper-plane add-comment-button\" onClick = \"commentButtonClick(event)\"></i>\n </div>`;\n commentSection.appendChild(div);\n while (commentSection.children.length > 1) {\n console.log(commentSection.children[0]);\n commentSection.removeChild(commentSection.children[0]);\n }\n const res = await fetch(`${url}/feed/getAllPostComment`, {\n method: \"POST\",\n body: userData,\n headers: {\n \"Content-Type\": \"application/json\",\n \"Authorization\": `${localStorage.getItem(\"userToken\")}`,\n },\n });\n\n if (res.status === 200) {\n if (commentSection.children.length > 1) {\n return;\n }\n const data = await res.json();\n for (let i = 0; i < data.comment.length; i++) {\n const comment = data.comment[i];\n const div = document.createElement('div');\n div.classList.add('comment');\n div.innerHTML = `\n <div class=\"comment\">\n <a href=\"${frontendUrl}/pages/profile/index.html?username=${comment.username}\"><img class=\"profile-photo\" src=\"${comment.profilephoto}\" /></a>\n <div class=\"comment-box\">\n <div class=\"comment-details\">\n <div class=\"comment-user-name\"><a href=\"${frontendUrl}/pages/profile/index.html?username=${comment.username}\">${comment.username}</a></div>\n <div class=\"comment-message\">${comment.comment}</div>\n </div>\n <div class=\"time\">${comment.datetime}</div>\n </div> \n </div>`;\n commentSection.prepend(div);\n }\n } else {\n console.log('error');\n }\n}", "function commentsShow(req, res) {\n Legend\n .findById(req.params.id)\n .populate('comments.user')\n .then(legend => {\n if (!legend) return res.status(404).json({ message: 'Not found' })\n res.status(200).json(legend.comments)\n })\n .catch(() => res.status(404).json({ message: 'Not Found ' }))\n}", "function expandComments(postID, num, json) {\n\n // for later removal\n document.getElementById(\"xBtn_post\").setAttribute('onclick', \"$('.comment').remove();\");\n document.getElementById(\"closeBtn_post\").setAttribute('onclick', \"$('.comment').remove();\");\n\n var ul = document.getElementById('ulcomments'.concat(postID));\n\n if (json == null || num === 0) {\n //p\n var pComments = document.createElement(\"p\");\n pComments.setAttribute('id', 'pComments'.concat(postID));\n pComments.setAttribute('class', 'comment');\n pComments.style = \"padding:0px; margin:0px;\";\n ul.appendChild(pComments);\n //center\n var center = document.createElement(\"div\");\n center.setAttribute('class', 'card text-center');\n center.style = \"width: 480px; height:55px; margin-left:-47px;\";\n pComments.appendChild(center);\n\n //body\n var body = document.createElement(\"div\");\n body.setAttribute('class', 'card-body');\n center.appendChild(body);\n\n //title (content of comment)\n var title = document.createElement(\"p\");\n title.setAttribute('class', 'card-title');\n title.style = \"font-family: monaco;font-size: 13px;\";\n title.innerHTML = \"No comments yet.\";\n body.appendChild(title);\n }\n for (i = 0; i < num; i++) {\n //p\n var pComments = document.createElement(\"p\");\n pComments.setAttribute('id', 'pComments'.concat(postID, i.toString()));\n pComments.setAttribute('class', 'comment');\n pComments.style = \"padding:0px; margin:0px;\";\n ul.appendChild(pComments);\n //center\n var center = document.createElement(\"div\");\n center.setAttribute('class', 'card text-center');\n center.style = \"width: 480px; height:55px; margin-left:-47px;\";\n pComments.appendChild(center);\n\n //body\n var body = document.createElement(\"div\");\n body.setAttribute('class', 'card-body');\n center.appendChild(body);\n\n //sender name (content of comment)\n var sender = document.createElement(\"kbd\");\n sender.style = \"font-family: monaco;float:left; background-color:lightgrey; height:32px; font-size:12px; margin-left:-15px; margin-top:-2px; color:black;border-right:1px solid #000;height:30px\";\n sender.innerHTML = json[i].SenderName;\n body.appendChild(sender);\n\n //title (content of comment)\n var title = document.createElement(\"p\");\n title.setAttribute('class', 'card-title');\n title.style = \"font-family: monaco;font-size: 13px;\";\n title.innerHTML = json[i].Comment;\n body.appendChild(title);\n }\n\n // WRITE COMMENT FIELD\n //p\n var pWComments = document.createElement(\"p\");\n pWComments.setAttribute('id', 'pWComments'.concat(postID));\n pWComments.setAttribute('class', 'comment');\n pWComments.style = \"padding:0px; margin:0px;\";\n ul.appendChild(pWComments);\n //center\n var centerW = document.createElement(\"div\");\n centerW.setAttribute('class', 'card text-center');\n centerW.style = \"width: 480px; height:55px; margin-left:-47px;\";\n pWComments.appendChild(centerW);\n\n //body\n var bodyW = document.createElement(\"div\");\n bodyW.setAttribute('class', 'card-body');\n centerW.appendChild(bodyW);\n\n //input\n var inputW = document.createElement(\"INPUT\");\n inputW.setAttribute('class', 'form-control mr-sm-2');\n inputW.setAttribute('type', 'text');\n inputW.setAttribute('placeholder', 'Add comment here');\n inputW.style = \"font-family: monaco;margin-top: -21px;width: 400px; height: 55px; margin-left:-20px;\";\n inputW.setAttribute('id', 'txtComment');\n bodyW.appendChild(inputW);\n\n //button\n var btnAddW = document.createElement(\"BUTTON\");\n btnAddW.setAttribute('class', 'form-control mr-sm-2');\n btnAddW.setAttribute('onclick', 'addComment('.concat(postID, ')'));\n btnAddW.style = \"padding:0px; color: #ffffff; margin-left:380px; margin-top: -55px; background-color: #000000; width: 80px; height: 55px; font-size: 13px\";\n btnAddW.setAttribute('id', 'addBtn');\n btnAddW.setAttribute('data-dismiss', 'modal');\n btnAddW.setAttribute('onclick', 'addComment('.concat(postID, \",\", email, \",\", num, \")\"));\n btnAddW.innerHTML = \"Add\";\n bodyW.appendChild(btnAddW);\n}" ]
[ "0.63925064", "0.6156463", "0.61188966", "0.60353184", "0.5958397", "0.5895701", "0.58913016", "0.58614826", "0.5786016", "0.5769686", "0.5767934", "0.5744528", "0.57321906", "0.57219565", "0.5721494", "0.5683956", "0.5682594", "0.5672276", "0.56685805", "0.5590386", "0.54742694", "0.54732037", "0.54572546", "0.5452512", "0.54080427", "0.5391391", "0.53830075", "0.53761935", "0.53597325", "0.5342955", "0.5329298", "0.53291416", "0.5324266", "0.53228414", "0.53145516", "0.53134596", "0.53121984", "0.5286167", "0.5282333", "0.5275251", "0.5267255", "0.526653", "0.52558964", "0.52547014", "0.5251727", "0.5245807", "0.524427", "0.52370864", "0.5234717", "0.5233289", "0.5226514", "0.5216921", "0.521194", "0.5208478", "0.5206612", "0.52014494", "0.51978856", "0.5183349", "0.5182335", "0.51794726", "0.5174614", "0.51745504", "0.51702034", "0.5165429", "0.5144854", "0.51393306", "0.51358914", "0.5126027", "0.5120759", "0.5115413", "0.51043016", "0.5103042", "0.5088676", "0.50865525", "0.5084347", "0.5082233", "0.50805575", "0.5067883", "0.5063481", "0.5055931", "0.5048157", "0.504771", "0.5045162", "0.5035997", "0.50333136", "0.50324607", "0.50291544", "0.50284827", "0.50217646", "0.5020691", "0.50197697", "0.5019164", "0.50072306", "0.4988345", "0.49848306", "0.49829662", "0.49791154", "0.49720272", "0.49712852", "0.49666154" ]
0.6965359
0
Row navigation needs to be calculated according to TableFilter's validRowsIndex array
function onAfterSelection(et, selecteElm, e){ if(!o.validRowsIndex) return; //table is not filtered var row = et.defaultSelection != 'row' ? selecteElm.parentNode : selecteElm; var cell = selecteElm.nodeName=='TD' ? selecteElm : null; //cell for default_selection = 'both' or 'cell' var keyCode = e != undefined ? et.Event.GetKey(e) : 0; var isRowValid = o.validRowsIndex.tf_Has(row.rowIndex); var nextRowIndex; var d = (keyCode == 34 || keyCode == 33 ? (o.pagingLength || et.nbRowsPerPage) : 1); //pgup/pgdown keys //If next row is not valid, next valid filtered row needs to be calculated if(!isRowValid){ //Selection direction up/down if(row.rowIndex>o._lastRowIndex){ if(row.rowIndex >= o.validRowsIndex[o.validRowsIndex.length-1]) //last row nextRowIndex = o.validRowsIndex[o.validRowsIndex.length-1]; else{ var calcRowIndex = (o._lastValidRowIndex + d); if(calcRowIndex > (o.validRowsIndex.length-1)) nextRowIndex = o.validRowsIndex[o.validRowsIndex.length-1]; else nextRowIndex = o.validRowsIndex[calcRowIndex]; } } else{ if(row.rowIndex <= o.validRowsIndex[0]) nextRowIndex = o.validRowsIndex[0];//first row else{ var v = o.validRowsIndex[o._lastValidRowIndex - d]; nextRowIndex = v ? v : o.validRowsIndex[0]; } } o._lastRowIndex = row.rowIndex; DoSelection(nextRowIndex); } else{ //If filtered row is valid, special calculation for pgup/pgdown keys if(keyCode!=34 && keyCode!=33){ o._lastValidRowIndex = o.validRowsIndex.tf_IndexByValue(row.rowIndex); o._lastRowIndex = row.rowIndex; } else { if(keyCode == 34){ //pgdown if((o._lastValidRowIndex + d) <= (o.validRowsIndex.length-1)) //last row nextRowIndex = o.validRowsIndex[o._lastValidRowIndex + d]; else nextRowIndex = o.validRowsIndex[o.validRowsIndex.length-1]; } else { //pgup if((o._lastValidRowIndex - d) <= (o.validRowsIndex[0])) //first row nextRowIndex = o.validRowsIndex[0]; else nextRowIndex = o.validRowsIndex[o._lastValidRowIndex - d]; } o._lastRowIndex = nextRowIndex; o._lastValidRowIndex = o.validRowsIndex.tf_IndexByValue(nextRowIndex); DoSelection(nextRowIndex); } } //Next valid filtered row needs to be selected function DoSelection(nextRowIndex){ if(et.defaultSelection == 'row'){ et.Selection.SelectRowByIndex(nextRowIndex); } else { et.ClearSelections(); var cellIndex = selecteElm.cellIndex; var row = o.tbl.rows[nextRowIndex]; if(et.defaultSelection == 'both') et.Selection.SelectRowByIndex(nextRowIndex); if(row) et.Selection.SelectCell(row.cells[cellIndex]); } //Table is filtered if(o.validRowsIndex.length != o.GetRowsNb()){ var row = o.tbl.rows[nextRowIndex]; if(row) row.scrollIntoView(false); if(cell){ if(cell.cellIndex==(o.GetCellsNb()-1) && o.gridLayout) o.tblCont.scrollLeft = 100000000; else if(cell.cellIndex==0 && o.gridLayout) o.tblCont.scrollLeft = 0; else cell.scrollIntoView(false); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function watchByTableRows(){\n scope.$watch(function () {\n return tableCtrl.items;\n }, function (newVal) {\n scope.firstShowingRecordNumber = ( (tableCtrl.currentPage - 1) * tableCtrl.rowsOnPage) + 1;\n scope.lastShowingRecordNumber = scope.firstShowingRecordNumber + newVal.length - 1;\n })\n }", "function getRowAcrossPages(row) {\n // Get the index for the selected row\n var index = row.childIndex;\n console.log(\"Row is at index: \"+index);\n\n // Find the \"relative\" row location for each page and remove rows\n // from page 1 onward\n index = index % pageSize;\n}", "trackRow(e) {\n let newRow = 0\n this.state.rowMap.forEach((row, index) => {\n let value = e.clientY\n let min = row[0]\n let max = row[1]\n let isInRange = (value - min) * (value - max) <= 0\n if (isInRange) {\n newRow = index\n }\n })\n return newRow\n }", "_updateRowIndexContext() {\n const viewContainer = this._rowOutlet.viewContainer;\n for (let renderIndex = 0, count = viewContainer.length; renderIndex < count; renderIndex++) {\n const viewRef = viewContainer.get(renderIndex);\n const context = viewRef.context;\n context.count = count;\n context.first = renderIndex === 0;\n context.last = renderIndex === count - 1;\n context.even = renderIndex % 2 === 0;\n context.odd = !context.even;\n if (this.multiTemplateDataRows) {\n context.dataIndex = this._renderRows[renderIndex].dataIndex;\n context.renderIndex = renderIndex;\n }\n else {\n context.index = this._renderRows[renderIndex].dataIndex;\n }\n }\n }", "function lightRow(rowIndex){ \n var row = GRID[rowIndex - 1];\n return row;\n}", "refreshIndexes() {\n this.element.find('tr').removeAttr('aria-rowindex');\n this.element.find('tr').removeAttr('data-index');\n\n if (this.hasLeftPane) {\n this.element.find('.datagrid-wrapper.left tbody > tr').each((idx, obj) => {\n const el = $(obj);\n el.attr('aria-rowindex', idx + 1);\n el.attr('data-index', idx);\n });\n }\n\n const page = this.settings.paging && this.pagerAPI.activePage > 1 ?\n (this.pagerAPI.activePage - 1) * this.settings.pagesize : 0;\n this.element.find('.datagrid-wrapper.center tbody > tr').each((idx, obj) => {\n const el = $(obj);\n el.attr('aria-rowindex', idx + page + 1);\n el.attr('data-index', idx + page);\n });\n\n if (this.hasRightPane) {\n this.element.find('.datagrid-wrapper.right tbody > tr').each((idx, obj) => {\n const el = $(obj);\n el.attr('aria-rowindex', idx + 1);\n el.attr('data-index', idx);\n });\n }\n }", "function Filter_TableRows(set_filter_isactive) { // PR2019-06-09 PR2020-08-31 PR2022-03-03\n //console.log( \"===== Filter_TableRows=== \");\n //console.log( \"filter_dict\", filter_dict);\n\n // function filters by inactive and substring of fields\n // - iterates through cells of tblRow\n // - skips filter of new row (new row is always visible)\n // - if filter_name is not null:\n // - checks tblRow.cells[i].children[0], gets value, in case of select element: data-value\n // - returns show_row = true when filter_name found in value\n // - if col_inactive has value >= 0 and hide_inactive = true:\n // - checks data-value of column 'inactive'.\n // - hides row if inactive = true\n\n if (set_filter_isactive){\n HandleFilterInactive();\n };\n selected.item_count = 0;\n const data_inactive_field = (selected_btn !== \"btn_userpermit\") ? \"data-inactive\" : null;\n for (let i = 0, tblRow, show_row; tblRow = tblBody_datatable.rows[i]; i++) {\n tblRow = tblBody_datatable.rows[i]\n show_row = t_Filter_TableRow_Extended(filter_dict, tblRow, data_inactive_field);\n\n //console.log( \"show_row\", show_row);\n\n add_or_remove_class(tblRow, cls_hide, !show_row);\n if (show_row) {selected.item_count += 1};\n }\n\n// --- show total in sidebar\n t_set_sbr_itemcount_txt(loc, selected.item_count, loc.User, loc.Users, setting_dict.user_lang);\n }", "matchRowCount(skipRender = false) {\n const me = this,\n rows = me._rows,\n numRows = rows.length,\n delta = numRows - me.rowCount,\n grid = me.grid;\n\n if (delta) {\n if (delta < 0) {\n const newRows = [];\n\n // add rows\n for (\n let index = numRows, dataIndex = numRows ? rows[numRows - 1].dataIndex + 1 : 0;\n index < me.rowCount;\n index++, dataIndex++\n ) {\n newRows.push(\n new Row({\n rowManager: me,\n grid,\n index,\n dataIndex\n })\n );\n }\n rows.push.apply(rows, newRows);\n // and elements (by triggering event used by SubGrid to add elements)\n me.trigger('addRows', { rows: newRows });\n\n if (!skipRender) {\n // render\n me.renderFromRow(rows[Math.max(0, numRows - 1)]);\n }\n } else {\n // remove rows from bottom\n const removedRows = rows.splice(numRows - delta, delta);\n // and linked elements\n removedRows.forEach((row) => row.eachElement((element) => element.remove()));\n\n // trigger event in case some feature needs to cleanup when removing (widget column might be interested)\n me.trigger('removeRows', { rows: removedRows });\n\n // no need to rerender or such when removing from bottom. all is good :)\n }\n }\n }", "_reorderRows(){const body=this.$.items,items=body.querySelectorAll(\"tr\");if(!items.length){return}const adjustedVirtualStart=this._virtualStart+this._vidxOffset,targetRow=this._rowWithFocusedElement||Array.from(items).filter(row=>!row.hidden)[0];// Which row to use as a target?\nif(!targetRow){// All rows are hidden, don't reorder\nreturn}// Where the target row should be?\nconst targetPhysicalIndex=targetRow.index-adjustedVirtualStart,delta=Array.from(items).indexOf(targetRow)-targetPhysicalIndex;// Reodrer the DOM elements to keep the target row at the target physical index\nif(0<delta){for(let i=0;i<delta;i++){body.appendChild(items[i])}}else if(0>delta){for(let i=items.length+delta;i<items.length;i++){body.insertBefore(items[i],items[0])}}}", "matchRowCount(skipRender = false) {\n const me = this,\n {\n rows,\n grid\n } = me,\n numRows = rows.length,\n delta = numRows - me.rowCount;\n\n if (delta) {\n if (delta < 0) {\n const newRows = []; // add rows\n\n for (let index = numRows, dataIndex = numRows ? rows[numRows - 1].dataIndex + 1 : 0; index < me.rowCount; index++, dataIndex++) {\n newRows.push(new Row({\n rowManager: me,\n grid,\n index,\n dataIndex\n }));\n }\n\n rows.push.apply(rows, newRows); // and elements (by triggering event used by SubGrid to add elements)\n\n me.trigger('addRows', {\n rows: newRows\n });\n\n if (!skipRender) {\n // render\n me.renderFromRow(rows[Math.max(0, numRows - 1)]);\n }\n } else {\n // remove rows from bottom\n const removedRows = rows.splice(numRows - delta, delta); // trigger event in case some feature needs to cleanup when removing (widget column might be interested)\n\n me.trigger('removeRows', {\n rows: removedRows\n });\n removedRows.forEach(row => row.destroy()); // no need to rerender or such when removing from bottom. all is good :)\n }\n }\n }", "@computed get currentRow() { return `row_${this.currentStep - 1}` }", "function HighlightAdjustRows(selectedLegNumber, selectedIsArriveBefore, legCount)\n{\t\n\t// If leave after search, then highlight all cells after the selected location, otherwise all cells before\n\tif (selectedIsArriveBefore == \"False\")\t// (leave after)\n\t{\n\t\tfor(i=selectedLegNumber; i < legCount; i++)\n\t\t{\n\t\t\tHighlightAdjustRow(i);\n\t\t}\n\t}\n\telse\t// (arrive before)\n\t{\n\t\tfor(i=selectedLegNumber - 1; i >= 0; i--)\n\t\t{\n\t\t\tHighlightAdjustRow(i);\n\t\t}\n\t}\n}", "function Filter_TableRows() { // PR2019-06-09 PR2020-08-31 PR2022-03-03\n //console.log( \"===== Filter_TableRows=== \");\n //console.log( \"filter_dict\", filter_dict);\n\n // function filters by inactive and substring of fields\n // - iterates through cells of tblRow\n // - skips filter of new row (new row is always visible)\n // - if filter_name is not null:\n // - checks tblRow.cells[i].children[0], gets value, in case of select element: data-value\n // - returns show_row = true when filter_name found in value\n // - if col_inactive has value >= 0 and hide_inactive = true:\n // - checks data-value of column 'inactive'.\n // - hides row if inactive = true\n\n const data_inactive_field = null; // \"data-inactive\";\n for (let i = 0, tblRow, show_row; tblRow = tblBody_datatable.rows[i]; i++) {\n tblRow = tblBody_datatable.rows[i]\n show_row = t_Filter_TableRow_Extended(filter_dict, tblRow, data_inactive_field);\n add_or_remove_class(tblRow, cls_hide, !show_row);\n };\n }", "setRowPage(){\n var table = document.getElementById(`${this.state.config.tableId}_Body`);\n var tr = table.getElementsByTagName(\"tr\");\n for (var i = 0; i < tr.length; i++) {\n let page = parseInt(tr[i].getAttribute(\"page\"));\n if (page === this.state.currentPage){\n tr[i].classList.add(\"showIt\");\n tr[i].classList.remove(\"hideIt\");\n }else {\n tr[i].classList.add(\"hideIt\");\n tr[i].classList.remove(\"showIt\");\n }\n }\n }", "function handlePagination() {\n\n var numResults = rowsParent.childElementCount;\n\n //disable and enable buttons based on row count\n if (numResults <= 5){\n //do nothing\n }else if(numResults <= 10){\n createPaginationListElement(2);\n } else if(numResults <= 15){\n createPaginationListElement(2);\n createPaginationListElement(3);\n } else { //over 20\n createPaginationListElement(2);\n createPaginationListElement(3);\n createPaginationListElement(4);\n }\n\n //store all rows in an array\n tableContent = rowsParent.innerHTML;\n\n showSelectedChildren(0, 4)\n\n\n}", "handlerForwardClick() {\n let dealers = this.state.delers;\n let rows = [];\n var count = 0;\n\n if (dealers.length < this.state.pointer + 10) {\n for (var i = this.state.pointer; i < dealers.length; i++) {\n rows[count] = dealers[i];\n count++;\n }\n this.state.page += 1;\n this.setState({\n rows: rows,\n forwardDisabled: true,\n backDisabled: false\n });\n } else {\n this.state.nextPointer = this.state.pointer + 10;\n for (var i = this.state.pointer; i < this.state.nextPointer; i++) {\n rows[count] = dealers[i];\n count++;\n }\n let pointer = this.state.pointer + 10;\n this.state.page += 1;\n this.setState({\n rows: rows,\n backDisabled: false,\n pointer: pointer\n });\n }\n }", "handleRowSort({oldIndex, newIndex}) {\n alert(`Row sorting handle has not been set: ${oldIndex} to ${newIndex}`)\n }", "function auditTracking_RowsFiltered(evt, ui) {\n //After the user enters criteria in filtering the rows using the built in igGridFiltering,\n //the results of the filter cause iggrid to be resized. We need to account for the show more/ show less \n //button's state and make adjustmenst to the ui accordingly.\n var hasShowMoreBeenClicked = auditTrackingScrollHeight !== null;\n if (hasShowMoreBeenClicked) {\n showMoreRowsOfData(false);\n }\n if (Compass.Global.isThisBrowserIE7) {\n //ie7 hack: ie7 igfiltering rowsfiltered event fires to early, we need a slight delay \n window.setTimeout(function () {\n helm.showMoreData_Initialize(evt, ui);\n });\n } else { //not IE7\n helm.showMoreData_Initialize(evt, ui);\n }\n }", "function groupTable($rows, startIndex, total){\n\n if (total === 0) { return; }\n\n var currentIndex = startIndex;\n var count = 1;\n var lst = [];\n var tds = $rows.find('td:eq('+ currentIndex +')');\n var ctrl = $(tds[0]);\n\n lst.push($rows[0]);\n\n var i;\n\n for (i=1; i<=tds.length; i++) {\n\n if (\n ctrl.text() == $(tds[i]).text() &&\n// ctrl.text() != \"\" &&\n // we don't want to merge column cells between different network interfaces\n $(tds[i]).closest('tr').attr('interface') == undefined\n ) {\n console.log(ctrl.text())\n console.log(ctrl.closest('tr').attr('interface'))\n count++;\n $(tds[i]).addClass('deleted');\n lst.push($rows[i]);\n } else {\n if (count>1) {\n ctrl.attr('rowspan',count);\n groupTable($(lst),startIndex+1,total-1)\n }\n count=1;\n lst = [];\n ctrl=$(tds[i]);\n lst.push($rows[i]);\n }\n }\n }", "_applyRowFilters() {\r\n const that = this;\r\n\r\n if (!that.filtering || !that.filterRow) {\r\n return;\r\n }\r\n\r\n const filterRow = that.$.tableContainer.querySelector('.smart-table-filter-row'),\r\n selectionColumnCorrection = that.selection ? 1 : 0,\r\n filters = [];\r\n\r\n for (let i = 0; i < that._columns.length; i++) {\r\n const dataField = that._columns[i].dataField,\r\n dataType = that._columns[i].dataType,\r\n container = filterRow.children[i + selectionColumnCorrection].firstElementChild,\r\n button = container.children[2];\r\n let filterValue = container.firstElementChild.value,\r\n filterCondition = container.children[1].value;\r\n\r\n if (dataType === 'string') {\r\n filterCondition = that._filterInfo.stringConditions.find(condition => condition.label === filterCondition).value;\r\n\r\n }\r\n else {\r\n filterCondition = that._filterInfo.numberAndDateConditions.find(condition => condition.label === filterCondition).value;\r\n\r\n if (filterValue !== '') {\r\n if (dataType === 'number') {\r\n filterValue = parseFloat(filterValue);\r\n\r\n if (isNaN(filterValue)) {\r\n container.firstElementChild.value = '';\r\n filterValue = '';\r\n }\r\n }\r\n else if (dataType === 'date') {\r\n filterValue = new Date(filterValue);\r\n filterValue.setHours(0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n const conditionWithEmptyValue = ['EMPTY', 'NOT_EMPTY', 'NULL', 'NOT_NULL'].indexOf(filterCondition) !== -1;\r\n\r\n if (filterValue !== '' || conditionWithEmptyValue) {\r\n const filterGroup = new Smart.Utilities.FilterGroup(),\r\n filterObject = filterGroup.createFilter(dataType, filterValue, filterCondition);\r\n\r\n filterGroup.addFilter('or', filterObject);\r\n filters.push([dataField, filterGroup]);\r\n\r\n button.classList.remove('smart-hidden');\r\n }\r\n else {\r\n button.classList.add('smart-hidden');\r\n }\r\n\r\n if (conditionWithEmptyValue) {\r\n container.firstElementChild.setAttribute('disabled', true);\r\n }\r\n else {\r\n container.firstElementChild.removeAttribute('disabled');\r\n }\r\n }\r\n\r\n if (filters.length > 0) {\r\n if (!that.dataSource.virtualDataSource) {\r\n that.dataSource._filter(filters, 'and');\r\n }\r\n\r\n that._filterInfo.rowFilters = filters;\r\n delete that._filterInfo.appliedFilters;\r\n that._fullRefresh('filter');\r\n that.$.fireEvent('filter', { action: 'add', filters: filters });\r\n }\r\n else if (that._filterInfo.rowFilters) {\r\n that.clearFilters();\r\n }\r\n }", "location(index) {\n var idx = this.search.findLeft(index)\n if(idx+1<this.rows.length && this.rows[idx+1]==index) return [idx+1,0]\n return [idx, index-this.rows[idx]]\n }", "function render_prev_row() {\n\n current_row = (current_row == 0) ? current_row : current_row - 1;\n render_row(current_row)\n\n}", "_createFilterRow(existingFilterRow) {\r\n const that = this;\r\n\r\n if (!that.filtering || !that.filterRow) {\r\n return;\r\n }\r\n\r\n if (existingFilterRow) {\r\n that.$.tableContainer.children[1].insertBefore(existingFilterRow, that.$.tableContainer.children[1].firstElementChild);\r\n return;\r\n }\r\n\r\n const row = document.createElement('tr'),\r\n animation = ` animation=\"${that.animation}\" `,\r\n rightToLeft = that.rightToLeft ? ' right-to-left' : '';\r\n let content = '';\r\n\r\n row.className = 'smart-table-filter-row';\r\n\r\n if (that.selection) {\r\n content += '<td></td>';\r\n }\r\n\r\n for (let i = 0; i < that._columns.length; i++) {\r\n const column = that._columns[i],\r\n classes = [];\r\n let dataSource, inputType, className, value;\r\n\r\n if (column.dataType === 'string') {\r\n dataSource = that._filterInfo.stringConditions;\r\n inputType = 'string';\r\n className = 'string-filter';\r\n value = that.localize('CONTAINS');\r\n }\r\n else {\r\n dataSource = that._filterInfo.numberAndDateConditions;\r\n inputType = column.dataType;\r\n className = 'num-date-filter';\r\n value = that.localize('EQUAL');\r\n }\r\n\r\n if (column.freeze) {\r\n classes.push('freeze-' + (column.freeze === 'far' ? 'far' : 'near'));\r\n }\r\n\r\n if (column.responsivePriority) {\r\n classes.push('priority-' + column.responsivePriority);\r\n }\r\n\r\n if (column.allowFilter === false) {\r\n classes.push('no-filter');\r\n }\r\n\r\n content += `<td${classes.length ? ' class=\"' + classes.join(' ') + '\"' : ''} filter-for=\"${column.dataField}\">\r\n <div>\r\n <input type=\"${inputType}\" class=\"filter-value\" aria-label=\"Filter value\" />\r\n <smart-input class=\"${className}${animation}data-source='${JSON.stringify(dataSource)}' drop-down-button-position=\"right\" drop-down-width=\"auto\" readonly${rightToLeft} value=\"${value}\" title=\"${that.localize('filterCondition')}\" aria-label=\"Filter condition\"></smart-input>\r\n <smart-button class=\"smart-hidden\" title=\"${that.localize('clearFilter')}\"${animation}${rightToLeft} aria-label=\"Clear filter\"></smart-button>\r\n </div>\r\n </td>`;\r\n }\r\n\r\n row.innerHTML = content;\r\n\r\n that.$.tableContainer.children[1].insertBefore(row, that.$.tableContainer.children[1].firstElementChild);\r\n }", "function onFilter() {\n if (component.filterChanged && component.visibleRows !== grid.api.core.getVisibleRows().length) {\n var visibleRows = grid.api.core.getVisibleRows();\n if (isFiltering()) {\n changeRecords(visibleRows.length);\n } else {\n changeRecords(component.model.values.length);\n }\n // Update row number column size\n updateRowNumberColumn();\n if (visibleRows.length > 0) {\n var columns = component.getColumns();\n grid.api.core.scrollToIfNecessary(visibleRows[0], columns[0]);\n }\n component.filterChanged = false;\n }\n }", "function ShowTableRow(tblRow, tblName_settings) {\n // only called by Filter_TableRows\n //console.log( \"===== ShowTableRow ========= \");\n let hide_row = false;\n if (tblRow){\n// show all rows if filter_name = \"\"\n if (!isEmpty(filter_dict)){\n for (let i = 1, el_fldName, el; el = tblRow.cells[i]; i++) {\n const filter_text = filter_dict[i];\n const filter_tag = field_settings[tblName_settings].filter_tags[i];\n // skip if no filter on this colums\n if(filter_text){\n if(filter_tag === \"text\"){\n const blank_only = (filter_text === \"#\")\n const non_blank_only = (filter_text === \"@\" || filter_text === \"!\")\n // get value from el.value, innerText or data-value\n // PR2020-06-13 debug: don't use: \"hide_row = (!el_value)\", once hide_row = true it must stay like that\n let el_value = el.innerText;\n if (blank_only){\n // empty value gets '\\n', therefore filter asc code 10\n if(el_value && el_value !== \"\\n\" ){\n hide_row = true\n };\n } else if (non_blank_only){\n // empty value gets '\\n', therefore filter asc code 10\n if(!el_value || el_value === \"\\n\" ){\n hide_row = true\n }\n } else {\n el_value = el_value.toLowerCase();\n // hide row if filter_text not found or el_value is empty\n // empty value gets '\\n', therefore filter asc code 10\n if(!el_value || el_value === \"\\n\" ){\n hide_row = true;\n } else if(!el_value.includes(filter_text)){\n hide_row = true;\n }\n }\n } else if(filter_tag === \"toggle\"){\n const el_value = get_attr_from_el_int(el, \"data-value\")\n if (filter_text === 1){\n if (!el_value ) {hide_row = true};\n } else if (filter_text === -1){\n if (el_value) {hide_row = true};\n }\n }\n } // if(!!filter_text)\n } // for (let i = 1, el_fldName, el; el = tblRow.cells[i]; i++) {\n } // if if (!isEmpty(filter_dict))\n } // if (!!tblRow)\n return !hide_row\n }", "function ShowTableRow(tblRow, tblName_settings) {\n // only called by Filter_TableRows\n //console.log( \"===== ShowTableRow ========= \");\n let hide_row = false;\n if (tblRow){\n// show all rows if filter_name = \"\"\n if (!isEmpty(filter_dict)){\n for (let i = 1, el_fldName, el; el = tblRow.cells[i]; i++) {\n const filter_text = filter_dict[i];\n const filter_tag = field_settings[tblName_settings].filter_tags[i];\n // skip if no filter on this colums\n if(filter_text){\n if(filter_tag === \"text\"){\n const blank_only = (filter_text === \"#\")\n const non_blank_only = (filter_text === \"@\" || filter_text === \"!\")\n // get value from el.value, innerText or data-value\n // PR2020-06-13 debug: don't use: \"hide_row = (!el_value)\", once hide_row = true it must stay like that\n let el_value = el.innerText;\n if (blank_only){\n // empty value gets '\\n', therefore filter asc code 10\n if(el_value && el_value !== \"\\n\" ){\n hide_row = true\n };\n } else if (non_blank_only){\n // empty value gets '\\n', therefore filter asc code 10\n if(!el_value || el_value === \"\\n\" ){\n hide_row = true\n }\n } else {\n el_value = el_value.toLowerCase();\n // hide row if filter_text not found or el_value is empty\n // empty value gets '\\n', therefore filter asc code 10\n if(!el_value || el_value === \"\\n\" ){\n hide_row = true;\n } else if(!el_value.includes(filter_text)){\n hide_row = true;\n }\n }\n } else if(filter_tag === \"toggle\"){\n const el_value = get_attr_from_el_int(el, \"data-value\")\n if (filter_text === 1){\n if (!el_value ) {hide_row = true};\n } else if (filter_text === -1){\n if (el_value) {hide_row = true};\n }\n } else if(filter_tag === \"activated\"){\n const el_value = get_attr_from_el_int(el, \"data-value\")\n if (filter_text && el_value !== filter_text ) {hide_row = true};\n }\n } // if(!!filter_text)\n } // for (let i = 1, el_fldName, el; el = tblRow.cells[i]; i++) {\n } // if if (!isEmpty(filter_dict))\n } // if (!!tblRow)\n return !hide_row\n }", "filterPredictions() {\n const rows = document.querySelectorAll('table.prediction tbody tr');\n let rowCounter = 0;\n rows.forEach((row) => {\n const displayRow = Object.keys(this.activeFilters_).every((parameter) => {\n const rowValue = row.getAttribute(parameter);\n return rowValue && this.activeFilters_[parameter][rowValue];\n });\n row.style.display = displayRow ? 'table-row' : 'none';\n rowCounter += displayRow;\n });\n this.setPredictionsListEmpty_(!rowCounter);\n }", "function update_offset() {\n\t\tlet totFilteredRecs = ndx.groupAll().value();\n\t\t// let end = ofs + pag > totFilteredRecs ? totFilteredRecs : ofs + pag;\n\t\tofs =\n\t\t\tofs >= totFilteredRecs\n\t\t\t\t? Math.floor((totFilteredRecs - 1) / pag) * pag\n\t\t\t\t: ofs;\n\t\tofs = ofs < 0 ? 0 : ofs;\n\t\tdataTable.beginSlice(ofs);\n\t\tdataTable.endSlice(ofs + pag);\n\t}", "render() {\n const {\n dataList,\n toggleRowIndex,\n } = this.state;\n return (\n\n <WithDrawer\n drawerContent={(rowProps) => {\n return (<div className=\"sub-table\">{this.ruleRenderer(rowProps.index, rowProps.rowData.plan_id)}</div>);\n }}\n rowsDimensions={dataList.map((dataItem) => ({ collapsedHeight: 40, expandedHeight: 130 }))}\n >\n {({ rowHeight, rowRenderer, toggleDrawerWithAnimation, setTableRef }) => (\n <AutoSizer disableHeight>\n {({ width }) => (\n <InfiniteLoader\n isRowLoaded={this._isRowLoaded}\n loadMoreRows={this._loadMoreRows}\n rowCount={dataList.length}\n height={dataList.length * 80}\n threshold={10}\n >\n {({ onRowsRendered, registerChild }) => (\n <Table\n ref={setTableRef}\n headerHeight={39}\n height={dataList.length * 80}\n width={width}\n rowCount={dataList.length}\n rowGetter={this._rowGetter}\n rowHeight={rowHeight}\n rowRenderer={rowRenderer}\n noRowsRenderer={this.noRowsRenderer}\n className=\"data-table table-no-border report-table\"\n >\n <Column\n dataKey=\"alert_id\"\n label=\"Alert ID\"\n headerRenderer={headerRenderer}\n cellRenderer={this.alertIdAnchorCellRenderer}\n disableSort={true}\n width={300}\n flexGrow={1}\n />\n <Column\n dataKey=\"asset\"\n label=\"Name\"\n headerRenderer={headerRenderer}\n cellRenderer={this.nameCellRenderer}\n disableSort={true}\n width={300}\n flexGrow={1}\n />\n\n <Column\n dataKey=\"asset\"\n label=\"Region\"\n headerRenderer={headerRenderer}\n cellRenderer={this.regionCellRenderer}\n disableSort={false}\n width={300}\n flexGrow={2}\n\n />\n\n {/* <Column\n className=\"col-td toggle-row\"\n label=\"\"\n dataKey=\"resource\"\n width={20}\n flexGrow={1}\n headerRenderer={headerRenderer}\n cellRenderer={\n ({ cellData, rowIndex }) => {\n return (\n <div onClick={() => { this.toggleActiveClass(rowIndex) }} className={rowIndex === toggleRowIndex ? 'arrow-down' : ''}>\n <span style={{ cursor: \"pointer\",fontSize:\"24px\",color:\"#225BDE\" }} onClick={() => toggleDrawerWithAnimation(rowIndex)}>\n <i className=\"fa fa-caret-left\"></i>\n </span>\n </div>\n );\n }\n }\n /> */}\n <Column\n dataKey=\"work_done\"\n label=\"Work Done\"\n headerRenderer={() => {\n return (\n <div className=\"table-td text-center\">\n Work Done\n </div>\n );\n }}\n cellRenderer={this.workDoneCellRenderer}\n disableSort={false}\n width={150}\n flexGrow={3}\n className=\"justify-content-center\"\n />\n <Column\n dataKey=\"verified\"\n label=\"Verified\"\n headerRenderer={() => {\n return (\n <div className=\"table-td text-center\">\n Verified\n </div>\n );\n }}\n cellRenderer={this.verifiedCellRenderer}\n disableSort={false}\n width={150}\n flexGrow={4}\n className=\"justify-content-center\"\n />\n\n </Table>\n )}\n </InfiniteLoader>\n )}\n </AutoSizer>\n )}\n </WithDrawer>\n )\n }", "function renderTable() {\n $tbody.innerHTML = \"\";\n var endingIndex = startingIndex + resultsPerPage;\n console.log(endingIndex)\n var filteredDataSubset = filteredData.slice(startingIndex, endingIndex);\n \n for (var i = 0; i < filteredDataSubset.length; i++) {\n // Get the current address object and its fields\n \n var address = filteredDataSubset[i];\n var fields = Object.keys(address);\n console.log(\"hello\", i, \" \", startingIndex)\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 address object, create a new cell and set its inner text to be the current value at the current address's field\n var field = fields[j];\n // console.log(field)\n var $cell = $row.insertCell(j);\n if (field == 'state' || field == 'country'){\n $cell.innerText = address[field].toUpperCase();\n }\n else if(field == 'city' || field == 'shape'){\n add = capitalizeFirstLetter(address[field]);\n $cell.innerText = add;\n // $cell.innerText = address[field];\n }\n else{\n $cell.innerText = address[field];\n }\n }\n }\n\n if (endingIndex == 10) {\n $backBtn.classList.add(\"disabled\");\n $backBtn.innerText = \"First Page\";\n $backBtn.removeEventListener(\"click\", handleBackButtonClick);\n}else{\n $backBtn.classList.remove(\"disabled\");\n $backBtn.innerText = \"Back\";\n $backBtn.addEventListener(\"click\", handleBackButtonClick);\n\n if (startingIndex + resultsPerPage >= filteredData.length) {\n $loadMoreBtn.classList.add(\"disabled\");\n $loadMoreBtn.innerText = \"Last Page\";\n $loadMoreBtn.removeEventListener(\"click\", handleButtonClick);\n}else{\n $loadMoreBtn.classList.remove(\"disabled\");\n $loadMoreBtn.innerText = \"Next\";\n $loadMoreBtn.addEventListener(\"click\", handleButtonClick);\n \n}\n\n}\n\n}", "function showFilterSet(cellIndexes, instanceName)\r\n{\r\n var filterRow = document.getElementById('filterRow' + instanceName);\r\n var widthEval = 0;\r\n filterRow.style.display = '';\r\n filterRow.style.height = '20px';\r\n\r\n var cellIndexArray = cellIndexes.split(',');\r\n for (var i = 0; i < cellIndexArray.length; i++)\r\n {\r\n if (i < cellIndexArray.length - 1)\r\n {\r\n //FIXME: Clean up.\r\n widthEval = (docjslib_getRealLeft(document.getElementById('cell' + instanceName + cellIndexArray[i+1])) - docjslib_getRealLeft(document.getElementById('cell' + instanceName + cellIndexArray[i])) - 2);\r\n if (widthEval < 0)\r\n {\r\n widthEval = 0;\r\n }\r\n document.getElementById('filter_cell' + i + instanceName).style.width = widthEval + 'px';\r\n }\r\n else\r\n {\r\n widthEval = ((docjslib_getRealLeft(document.getElementById('table' + instanceName)) + document.getElementById('table' + instanceName).offsetWidth) - docjslib_getRealLeft(document.getElementById('cell' + instanceName + cellIndexArray[i])) - 2)\r\n if (widthEval < 0)\r\n {\r\n widthEval = 0;\r\n }\r\n document.getElementById('filter_cell' + i + instanceName).style.width = widthEval + 'px';\r\n }\r\n document.getElementById('filter_cell' + i + instanceName).style.top = '-3px';\r\n }\r\n filterRow.style.height = document.getElementById('filter_cell' + cellIndexArray[0] + instanceName).offsetHeight + 'px';\r\n}", "renderRows() {\n let tableHtml = '';\n let tableHtmlLeft = '';\n let tableHtmlRight = '';\n let j = 0;\n const self = this;\n const s = self.settings;\n const body = self.table.find('tbody');\n let activePage = 1;\n if (self.pagerAPI) {\n const pagerState = self.pagerAPI.state;\n if (pagerState.filteredActivePage) {\n activePage = pagerState.filteredActivePage;\n } else {\n activePage = pagerState.activePage;\n }\n }\n self.bodyColGroupHtmlLeft = '<colgroup>';\n self.bodyColGroupHtml = '<colgroup>';\n self.bodyColGroupHtmlRight = '<colgroup>';\n self.triggerDestroyCell(); // Trigger Destroy on previous cells\n\n if (!self.settings.columns || self.settings.columns.length === 0) {\n self.settings.columns.push({ id: 'blank', value: '', field: '' });\n }\n\n this.currentPageRows = [];\n\n for (j = 0; j < self.settings.columns.length; j++) {\n const col = self.settings.columns[j];\n const container = self.getContainer(col.id);\n const colWidth = self.columnWidth(col, j);\n\n switch (container) {\n case 'left':\n self.bodyColGroupHtmlLeft += `<col${colWidth}${col.hidden ? ' class=\"is-hidden\"' : ''}></col>`;\n break;\n case 'right':\n self.bodyColGroupHtmlRight += `<col${colWidth}${col.hidden ? ' class=\"is-hidden\"' : ''}></col>`;\n break;\n default:\n self.bodyColGroupHtml += `<col${colWidth}${col.hidden ? ' class=\"is-hidden\"' : ''}></col>`;\n }\n\n if (col.colspan) {\n self.hasColSpans = true;\n }\n }\n\n // Prevent flashing message area on filter / reload\n if (self.emptyMessageContainer) {\n self.emptyMessageContainer.hide();\n }\n\n if (body.length === 0) {\n if (self.hasLeftPane) {\n self.tableBodyLeft = $('<tbody role=\"rowgroup\"></tbody>');\n self.tableLeft.append(self.tableBodyLeft);\n }\n self.tableBody = $('<tbody role=\"rowgroup\"></tbody>');\n self.table.append(self.tableBody);\n if (self.hasRightPane) {\n self.tableBodyRight = $('<tbody role=\"rowgroup\"></tbody>');\n self.tableRight.append(self.tableBodyRight);\n }\n }\n\n self.groupArray = [];\n\n self.recordCount = 0;\n self.filteredCount = 0;\n self.runningCount = 0;\n\n // Reset recordCount for paging\n if (s.treeGrid && s.paging && !s.source && activePage > 1) {\n self.recordCount = s.treeRootNodes[(s.pagesize * activePage) - s.pagesize].idx - 1;\n }\n\n if (this.restoreSortOrder) {\n this.sortDataset();\n }\n let rowStatusTooltip = false;\n\n if (self.originalDataset && (!s.groupable && s.dataset.length > 0)) {\n s.dataset = self.originalDataset;\n }\n\n for (let i = 0; i < s.dataset.length; i++) {\n // For better performance dont render out of page\n if (s.paging && !s.source) {\n if (activePage === 1 && (i - this.filteredCount) >= s.pagesize) {\n if (!s.dataset[i]._isFilteredOut) {\n this.recordCount++;\n } else {\n this.filteredCount++;\n }\n continue; //eslint-disable-line\n }\n\n if (activePage > 1 && !((i - this.filteredCount) >= s.pagesize * (activePage - 1) &&\n (i - this.filteredCount) < s.pagesize * activePage)) {\n if (!s.dataset[i]._isFilteredOut) {\n if (this.filteredCount) {\n this.recordCount++;\n }\n } else {\n this.filteredCount++;\n }\n continue; //eslint-disable-line\n }\n }\n\n if (s.virtualized) {\n if (!this.isRowVisible(this.recordCount)) {\n this.recordCount++;\n continue; //eslint-disable-line\n }\n }\n\n // Exclude Filtered Rows\n if ((!s.treeGrid && s.dataset[i])._isFilteredOut) {\n this.filteredCount++;\n continue; //eslint-disable-line\n }\n\n // Handle Grouping\n if (this.settings.groupable) {\n // Filter and sorted\n if (s.dataset[i].values) {\n const thisLength = s.dataset[i].values.length;\n let thisFilterCount = 0;\n for (let k = 0; k < thisLength; k++) {\n if (s.dataset[i].values[k]._isFilteredOut) {\n thisFilterCount++;\n }\n }\n if (thisFilterCount === thisLength) {\n continue; //eslint-disable-line\n }\n }\n\n // First push group row\n if (!this.settings.groupable.suppressGroupRow) {\n // Show the grouping row\n const groupHtml = self.rowHtml(s.dataset[i], this.recordCount, i, true);\n\n if (this.hasLeftPane && groupHtml.left) {\n tableHtmlLeft += groupHtml.left;\n }\n if (groupHtml.center) {\n tableHtml += groupHtml.center;\n }\n if (this.hasRightPane && groupHtml.right) {\n tableHtmlRight += groupHtml.right;\n }\n }\n\n if (this.settings.groupable.showOnlyGroupRow && s.dataset[i].values[0]) {\n const rowData = s.dataset[i].values[0];\n\n if (s.dataset[i].list) {\n rowData.list = s.dataset[i].list;\n }\n\n rowData.values = s.dataset[i].values;\n const groupHtml = self.rowHtml(rowData, this.recordCount, i);\n if (this.hasLeftPane && groupHtml.left) {\n tableHtmlLeft += groupHtml.left;\n }\n if (groupHtml.center) {\n tableHtml += groupHtml.center;\n }\n if (this.hasRightPane && groupHtml.right) {\n tableHtmlRight += groupHtml.right;\n }\n\n this.recordCount++;\n self.groupArray.push({ group: i, node: 0 });\n continue; //eslint-disable-line\n }\n\n // Now Push Groups\n for (let k = 0; k < s.dataset[i].values.length; k++) {\n if (!s.dataset[i].values[k]._isFilteredOut) {\n const rowHtml = self.rowHtml(\n s.dataset[i].values[k],\n this.recordCount,\n s.dataset[i].values[k].idx\n );\n if (self.hasLeftPane && rowHtml.left) {\n tableHtmlLeft += rowHtml.left;\n }\n if (rowHtml.center) {\n tableHtml += rowHtml.center;\n }\n if (self.hasRightPane && rowHtml.right) {\n tableHtmlRight += rowHtml.right;\n }\n this.recordCount++;\n self.groupArray.push({ group: i, node: k });\n }\n }\n\n // Now Push summary rowHtml\n if (this.settings.groupable.groupFooterRow) {\n const rowHtml = self.rowHtml(s.dataset[i], this.recordCount, i, true, true);\n if (self.hasLeftPane && rowHtml.left) {\n tableHtmlLeft += rowHtml.left;\n }\n if (rowHtml.center) {\n tableHtml += rowHtml.center;\n }\n if (self.hasRightPane && rowHtml.right) {\n tableHtmlRight += rowHtml.right;\n }\n }\n\n continue; //eslint-disable-line\n }\n\n let currentCount = i;\n if (s.treeGrid) {\n currentCount = this.recordCount;\n }\n\n self.runningCount++;\n const rowHtml = self.rowHtml(s.dataset[i], currentCount, i);\n if (self.hasLeftPane && rowHtml.left) {\n tableHtmlLeft += rowHtml.left;\n }\n if (rowHtml.center) {\n tableHtml += rowHtml.center;\n\n if (s.treeGrid && this.filterExpr?.length) {\n if ($(`<table>${rowHtml.center}</table>`).find('tr:first').is('.is-hidden')) {\n this.filteredCount++;\n }\n }\n }\n if (self.hasRightPane && rowHtml.right) {\n tableHtmlRight += rowHtml.right;\n }\n\n if (!s.dataset[i]?._isFilteredOut) {\n this.recordCount++;\n }\n this.visibleRowCount = currentCount + 1;\n\n if (s.dataset[i]?.rowStatus) {\n rowStatusTooltip = true;\n }\n }\n\n // Append a Summary Row\n if (this.settings.summaryRow) {\n self.element.addClass('has-summary-row');\n\n const totals = self.calculateTotals();\n const summaryRowHtml = self.rowHtml(totals, this.recordCount, null, false, true);\n if (self.hasLeftPane && summaryRowHtml.left) {\n tableHtmlLeft += summaryRowHtml.left;\n }\n if (summaryRowHtml.center) {\n tableHtml += summaryRowHtml.center;\n }\n if (self.hasRightPane && summaryRowHtml.right) {\n tableHtmlRight += summaryRowHtml.right;\n }\n }\n\n if (self.bodyColGroupHtml !== '<colgroup>') {\n if (this.settings.spacerColumn) {\n self.bodyColGroupHtml += '<col style=\"width: 100%\">';\n }\n self.bodyColGroupHtmlLeft += '</colgroup>';\n self.bodyColGroupHtml += '</colgroup>';\n self.bodyColGroupHtmlRight += '</colgroup>';\n\n if (self.bodyColGroupLeft) {\n self.bodyColGroupLeft.remove();\n }\n\n if (self.bodyColGroup) {\n self.bodyColGroup.remove();\n }\n\n if (self.bodyColGroupRight) {\n self.bodyColGroupRight.remove();\n }\n\n if (self.hasLeftPane) {\n self.bodyColGroupLeft = $(self.bodyColGroupHtmlLeft);\n (self.tableBodyLeft || self.headerRowLeft).before(self.bodyColGroupLeft);\n }\n\n self.bodyColGroup = $(self.bodyColGroupHtml);\n (self.headerRow || self.tableBody).before(self.bodyColGroup);\n\n if (self.hasRightPane) {\n self.bodyColGroupRight = $(self.bodyColGroupHtmlRight);\n (self.tableBodyRight || self.headerRowRight).before(self.bodyColGroupRight);\n }\n }\n\n if (self.hasLeftPane) {\n DOM.html(self.tableBodyLeft, tableHtmlLeft, '*');\n }\n\n DOM.html(self.tableBody, tableHtml, '*');\n\n if (self.hasRightPane) {\n DOM.html(self.tableBodyRight, tableHtmlRight, '*');\n }\n\n self.setVirtualHeight();\n self.setScrollClass();\n self.setupTooltips(rowStatusTooltip);\n self.afterRender();\n }", "getRowCallback() {\n\n }", "function displayRows (filteredRows) {\n var headerStack = []; // stack of header ids\n\n for (let r of filteredRows) {\n var rid = r.id;\n var pid = utils.parentOfPath(rid);\n\n while (headerStack.length>0 && utils.top(headerStack) != pid) headerStack.pop();\n if (headerStack.length == 0) {\n r.label = utils.isAbsolutePath(rid) ? rid.substring(1) : rid;\n r.level = 0;\n } else {\n r.label = utils.nameOfPath(rid);\n r.level = headerStack.length;\n }\n\n headerStack.push(rid);\n }\n\n return filteredRows;\n}", "function re(idx) {return {row: Math.floor(idx/elesPerRow), ele: idx%elesPerRow}}", "getRowFormat(table, start, end) {\n let tableRow = start.paragraph.associatedCell.ownerRow;\n if (tableRow === end.paragraph.associatedCell.ownerRow) {\n return;\n }\n for (let i = table.childWidgets.indexOf(tableRow) + 1; i < table.childWidgets.length; i++) {\n let tempTableRow = table.childWidgets[i];\n this.rowFormat.combineFormat(tempTableRow.rowFormat);\n if (tempTableRow === end.paragraph.associatedCell.ownerRow) {\n return;\n }\n }\n }", "function menuClick(e) {\n console.log(\"Menu Click\");\n var hc = views.view('table').header().columns();\n switch(e.name) {\n case 'Row Count':\n if (filtered_data == null) {\n alert(\"Row Count is \"+raw_data.length);\n } else {\n alert(\"Row Count is \"+filtered_data.length);\n }\n break;\n\n case 'renderSize':\n var a = views.view('table').renderingRows();\n alert(a);\n break;\n\n case 'Reset Sort':\n for(var i=0;i<hc.length;i++) {\n hc[i].sort(0);\n }\n last_sort = \"0\";\n break;\n\n case 'Reset Filters':\n try\n {\n for(var i=0;i<hc.length;i++) {\n hc[i].filterValue(\"\");\n }\n } catch (err) { console.log(err);}\n break;\n\n case 'Reset All':\n for(var i=0;i<hc.length;i++) {\n hc[i].sort(0);\n }\n last_sort = \"0\";\n for(var i=0;i<hc.length;i++) {\n hc[i].filterValue(\"\");\n }\n break;\n\n case 'Leak Check':\n setTimeout(rebuild, 1000);\n break;\n\n case 'Reload':\n var sI = views.view('table' ).selectedIndexes();\n console.log(sI);\n reload(sI);\n break;\n\n case 'Redraw Row':\n var i = views.view('table' ).list().selectedIndex();\n views.view('table').redrawRow(i);\n break;\n\n case 'Edit Grid [F2]':\n if (views.view('table').isEditing()) {\n views.view('table').stopEditInPlace();\n } else {\n views.view('table' ).startEditInPlace();\n }\n break;\n\n case 'Insert Row':\n if (views.view('table').isEditing()) {\n views.view('table').EIPInsertRow();\n } else {\n alert(\"You must be in Grid Edit mode, to insert -- Press the (F2) Key.\");\n }\n\n default:\n alert(\"You clicked on \"+e.name);\n break;\n }\n}", "function addRowIndex() {\r\n const table = $('#main').DataTable();\r\n \r\n table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {\r\n const data = this.data();\r\n data[0] = rowIdx + 1;\r\n this.data(data);\r\n });\r\n}", "function checkRow(i, arr, skipCurrent) {\r\n var arrLength = arr.length;\r\n var counter = 0;\r\n if (i > 0 && arr[i - 1]) counter++;\r\n if (!skipCurrent && arr[i]) counter++;\r\n if (i < arrLength - 1 && arr[i + 1]) counter++;\r\n\r\n return counter;\r\n}", "isFirstTable(tableIndex) {\n return tableIndex === 0;\n }", "_addRow() {\n const indicativeRow = this._hoveredCell.closest('TR');\n let index = this._getHoveredSideOfContainer();\n\n if (index === 1) {\n index = indicativeRow.sectionRowIndex;\n // if inserting after hovered cell\n index = index + this._isBottomOrRight();\n }\n\n this._table.addRow(index);\n }", "function nextRow( bSuccess )\n{\n // Clear highlighting\n $( '#bgt_table > tbody .' + g_sPendingClass ).removeClass( g_sPendingClass );\n $( '#bgt_table > tbody .' + g_sSuccessClass ).removeClass( g_sSuccessClass );\n\n // If current row contains new, live data, highlight it\n if ( bSuccess && ! g_tCachedValues )\n {\n $( '#row_' + g_iRow ).addClass( g_sSuccessClass );\n }\n\n // Advance row index\n if ( g_iRow < ( g_aRows.length - 1 ) )\n {\n // Advance to next row\n g_iRow ++;\n if ( ! g_tCachedValues )\n {\n enableRefreshButton( true );\n }\n }\n else\n {\n // Finished last row\n g_iRow = 0;\n g_tCachedValues = null;\n stopRefresh();\n enableRefreshButton( true );\n $( '.sortable' ).removeClass( 'sorter-false' );\n console.log( '=> View initialized in ' + ( Date.now() - g_iStartTime ) + ' ms' );\n }\n\n // Reinitialize variables\n g_iInstanceOffset = 2;\n g_aRowData = [];\n\n // Update tablesorter event handlers\n g_tTable.off( 'sortEnd' );\n g_tTable.off( 'filterEnd' );\n g_tTable.on( 'sortEnd', onSortEnd );\n g_tTable.on( 'filterEnd', onFilterEnd );\n g_tTable.on( 'tablesorter-ready', onTablesorterReady );\n\n // Trigger event to update tablesorter cache\n g_tTable.trigger( 'update' );\n}", "function lightRow(rowNumber){\n let rowIndex = rowNumber - 1;\n return GRID[rowIndex];\n}", "function datagrid_get_field_index(table, row) {\n\t// find the correct index of the row in the field\n\tvar table_data = table.fnGetData();\n\tvar row_index = table.fnGetPosition(row);\n\tvar empty_rows = 0;\n\tfor (var i = 0; i < row_index; i++)\n\t\tif (!table_data[i])\n\t\t\tempty_rows++;\n\n\treturn row_index - empty_rows;\n}", "getRowElementAt(rowIndex) {\n return this.table.find(latte.sprintf(\"tr:eq(%s)\", rowIndex + 1));\n }", "function Table({ columns, data }) {\n console.log('data on FormList', data)\n const filterTypes = React.useMemo(\n () => ({\n text: (rows, id, filterValue) => {\n return rows.filter(row => {\n const rowValue = row.values[id]\n return rowValue !== undefined\n ? String(rowValue)\n .toLowerCase()\n .startsWith(String(filterValue).toLowerCase())\n : true\n })\n },\n }),\n []\n )\n\n const defaultColumn = React.useMemo(\n () => ({\n Filter: DefaultColumnFilter,\n }),\n []\n )\n\n const {\n getTableProps,\n getTableBodyProps,\n headerGroups,\n rows,\n prepareRow,\n state,\n visibleColumns,\n preGlobalFilteredRows,\n setGlobalFilter,\n } = useTable (\n {\n columns,\n data,\n defaultColumn,\n filterTypes,\n initialState: {\n sortBy: [{ id: 'incident_date', desc: true }]\n }\n },\n useFilters,\n useSortBy,\n )\n\n const firstPageRows = rows.slice(0,10)\n\n return (\n <>\n <table className=\"table\" {...getTableProps()}>\n <thead>\n {headerGroups.map(headerGroup => (\n <tr {...headerGroup.getHeaderGroupProps()}>\n {headerGroup.headers.map(column => (\n <th scope=\"col\" {...column.getHeaderProps(column.getSortByToggleProps())}>\n {column.render('Header')}\n {/* Render the columns filter UI */}\n <div>{column.canFilter ? column.render('Filter') : null}</div>\n <span>{column.isSorted ? (column.isSortedDesc ? '' : '') : ''}</span>\n </th>\n ))}\n </tr>\n ))}\n </thead>\n <tbody {...getTableBodyProps()}>\n {firstPageRows.map((row, i) => {\n prepareRow(row)\n return (\n <tr {...row.getRowProps()}>\n {row.cells.map(cell => {\n return <td {...cell.getCellProps()}>{cell.render('Cell')}</td>\n })}\n </tr>\n )\n })}\n </tbody>\n </table>\n <br />\n <div>Showing the first 20 results of {rows.length} rows</div>\n </>\n )\n}", "_updateActiveRows() {\n if (!this.changeMultiple) {\n this.activeRows = this.$element.find('tbody tr.active');\n this.$element.trigger('changed.zf.table.checkbox', [this.activeRows]);\n }\n }", "getRow() {\n return INDEX2ROW(this.cellIndex);\n }", "_handleDeleteRows() {\n const { _rows: oldRows, _searchString: searchString } = this;\n this._rows = oldRows.filter((row) => !row.selected || !doesRowMatchSearchString(row, searchString));\n this.requestUpdate('_rows', oldRows);\n }", "adjustIndex(index) {\n return index - this.hiddenIndices.filter(i => i < index).length;\n }", "_onRowSelect(e) {\n let row = e.currentTarget;\n let range = this._range;\n let ord = Number.parseInt(row.getAttribute('data-ordinal'));\n if (!this._majorAvailable && (ord < 1 || ord > 14)) {\n return;\n }\n if (range.high === -1) {\n this._selectRangeRows(ord, ord)\n } else if (range.low == range.high) {\n this._selectRangeRows(range.low, ord);\n } else {\n this._clearRangeTable();\n this._selectRangeRows(ord, ord);\n }\n }", "updateWidgetsToTable(tableWidgets, rowWidgets, row) {\n let rowHeight = this.getRowHeight(row, [row]);\n let viewer = this.viewer;\n //initializing row properties with default values.\n let isHeader = row.rowFormat.isHeader;\n let isAllowBreakAcrossPages = row.rowFormat.allowBreakAcrossPages;\n let heightType = row.rowFormat.heightType;\n let cellSpacing = 0;\n let count = 0;\n let tableRowWidget = row;\n let moveRowToNextTable = false;\n if (row.ownerTable.continueHeader && !isHeader) {\n row.ownerTable.continueHeader = false;\n }\n let isInitialLayout = row.ownerTable.isInsideTable;\n let isLastRow = false;\n cellSpacing = (!isNullOrUndefined(row.ownerTable) && !isNullOrUndefined(row.ownerTable.tableFormat)) ? HelperMethods.convertPointToPixel(row.ownerTable.tableFormat.cellSpacing) : 0;\n while (count < rowWidgets.length) {\n count = rowWidgets.length;\n if (row.ownerTable.isInsideTable || (viewer.splittedCellWidgets.length === 0 && tableRowWidget.y + tableRowWidget.height + cellSpacing <= viewer.clientArea.bottom)) {\n this.addWidgetToTable(viewer, tableWidgets, rowWidgets, tableRowWidget, undefined, isInitialLayout);\n if (viewer.splittedCellWidgets.length > 0 && isNullOrUndefined(rowWidgets[rowWidgets.length - 1].nextRow)) {\n count--;\n isLastRow = true;\n }\n isInitialLayout = false;\n }\n else {\n isInitialLayout = false;\n //Split widget for next page\n if (viewer.splittedCellWidgets.length > 0 && tableRowWidget.y + tableRowWidget.height <= viewer.clientArea.bottom) {\n let isRowSpanEnd = this.isRowSpanEnd(row, viewer);\n if (!isRowSpanEnd) {\n if (this.isVerticalMergedCellContinue(row) && (tableRowWidget.y === viewer.clientArea.y\n || tableRowWidget.y === this.viewer.clientArea.y + tableRowWidget.ownerTable.headerHeight)) {\n this.insertSplittedCellWidgets(viewer, tableWidgets, tableRowWidget, tableRowWidget.indexInOwner - 1);\n }\n this.addWidgetToTable(viewer, tableWidgets, rowWidgets, tableRowWidget);\n continue;\n }\n }\n let splittedWidget = tableRowWidget;\n let tableWidget = tableWidgets[tableWidgets.length - 1];\n if (rowHeight + tableRowWidget.y > viewer.clientArea.bottom) {\n // tslint:disable-next-line:max-line-length\n if (!isAllowBreakAcrossPages || (isHeader && row.ownerTable.continueHeader) || (heightType === 'AtLeast' && HelperMethods.convertPointToPixel(row.rowFormat.height) < viewer.clientArea.bottom)) {\n // tslint:disable-next-line:max-line-length\n if ((heightType === 'AtLeast' && HelperMethods.convertPointToPixel(row.rowFormat.height) < viewer.clientActiveArea.height && isAllowBreakAcrossPages) || (heightType !== 'Exactly' && tableRowWidget.y === viewer.clientArea.y) || (heightType === 'Auto' && isAllowBreakAcrossPages)) {\n splittedWidget = this.splitWidgets(tableRowWidget, viewer, tableWidgets, rowWidgets, splittedWidget, isLastRow);\n }\n if (heightType === 'Exactly' && tableRowWidget.y === viewer.clientArea.y) {\n this.addWidgetToTable(viewer, tableWidgets, rowWidgets, tableRowWidget);\n count++;\n }\n if (isHeader && row.ownerTable.continueHeader) {\n row.ownerTable.header = false;\n row.ownerTable.continueHeader = false;\n row.ownerTable.headerHeight = 0;\n let pages = undefined;\n // if (viewer instanceof PageLayoutViewer) {\n pages = viewer.pages;\n // }\n if (!isNullOrUndefined(pages)) {\n for (let i = 0; i < pages.length; i++) {\n if (pages[i].repeatHeaderRowTableWidget) {\n pages[i].repeatHeaderRowTableWidget = false;\n }\n }\n }\n }\n }\n else {\n if ((heightType === 'Auto' || heightType === 'AtLeast') && isAllowBreakAcrossPages) {\n // tslint:disable-next-line:max-line-length\n if (!(HelperMethods.convertPointToPixel(row.rowFormat.height) > viewer.clientArea.bottom) || tableRowWidget.y === viewer.clientArea.y) {\n splittedWidget = this.splitWidgets(tableRowWidget, viewer, tableWidgets, rowWidgets, splittedWidget, isLastRow);\n }\n }\n else if (heightType === 'Exactly' && tableRowWidget.y === viewer.clientArea.y) {\n this.addWidgetToTable(viewer, tableWidgets, rowWidgets, tableRowWidget);\n count++;\n }\n }\n }\n else {\n let isInsertSplittedWidgets = false;\n // Splitting handled for the merged cell with allowRowBreakAcross pages. \n if (this.isVerticalMergedCellContinue(row) && (isAllowBreakAcrossPages ||\n (isInsertSplittedWidgets = (tableRowWidget.y === viewer.clientArea.y\n || tableRowWidget.y === this.viewer.clientArea.y + tableRowWidget.ownerTable.headerHeight)))) {\n if (isInsertSplittedWidgets) {\n this.insertSplittedCellWidgets(viewer, tableWidgets, splittedWidget, tableRowWidget.indexInOwner - 1);\n }\n else {\n splittedWidget = this.splitWidgets(tableRowWidget, viewer, tableWidgets, rowWidgets, splittedWidget, isLastRow);\n }\n }\n else if (isLastRow && !isAllowBreakAcrossPages) {\n splittedWidget = this.splitWidgets(tableRowWidget, viewer, tableWidgets, rowWidgets, splittedWidget, isLastRow);\n }\n }\n //Create New table for splitted widget\n if (!isNullOrUndefined(splittedWidget)) {\n if (splittedWidget !== tableRowWidget) {\n this.addWidgetToTable(viewer, tableWidgets, rowWidgets, tableRowWidget, tableRowWidget.nextRow);\n //Updates the fitted table rows to current page.\n this.updateWidgetsToPage(tableWidgets, rowWidgets, row.ownerTable, tableRowWidget.nextRow);\n let index = tableWidgets.indexOf(tableRowWidget.containerWidget);\n if (index + 1 >= tableWidgets.length) {\n //Creates new table widget for splitted rows.\n this.addTableWidget(viewer.clientActiveArea, tableWidgets, true);\n }\n tableRowWidget = splittedWidget;\n }\n else {\n if (row.index > 0) {\n //Updates the fitted table rows to current page.\n this.updateWidgetsToPage(tableWidgets, rowWidgets, row.ownerTable, row);\n // Need to update on this further\n if (row.previousRenderedWidget instanceof TableRowWidget) {\n // Need to update on this further\n let prevWidget = row.previousRenderedWidget;\n if (HelperMethods.round(tableRowWidget.y, 2) === HelperMethods.round(prevWidget.y + prevWidget.height, 2)) {\n let prevIndex = tableWidgets.indexOf(prevWidget.containerWidget);\n if (prevIndex + 1 >= tableWidgets.length) {\n //Creates new table widget for splitted rows.\n this.addTableWidget(viewer.clientActiveArea, tableWidgets, true);\n }\n }\n else {\n //Creates new table widget for splitted rows.\n this.addTableWidget(viewer.clientActiveArea, tableWidgets, true);\n }\n }\n else {\n //Creates new table widget for splitted rows.\n this.addTableWidget(viewer.clientActiveArea, tableWidgets, true);\n }\n }\n moveRowToNextTable = true;\n count--;\n }\n tableWidget = tableWidgets[tableWidgets.length - 1];\n let prevBodyWidget = undefined;\n if (tableWidgets.length > 1) {\n //Get Previous Splitted Widget container\n prevBodyWidget = tableWidgets[tableWidgets.length - 2].containerWidget;\n }\n else {\n let previousBlock = row.ownerTable.previousRenderedWidget;\n prevBodyWidget = previousBlock.containerWidget;\n }\n let pageIndex = 0;\n if (!isNullOrUndefined(prevBodyWidget)) {\n pageIndex = viewer.pages.indexOf(prevBodyWidget.page);\n }\n let index = row.ownerTable.containerWidget.index;\n let bodyWidget;\n let block;\n if (moveRowToNextTable && tableWidgets.length === 1) {\n block = tableWidgets[tableWidgets.length - 1];\n }\n else {\n block = tableWidgets[tableWidgets.length - 2];\n }\n bodyWidget = this.moveBlocksToNextPage(block);\n let curretTable = tableWidgets[tableWidgets.length - 1];\n //Move Next RowWidge to next page\n if (moveRowToNextTable) {\n // tslint:disable-next-line:max-line-length\n if (row.index === 0 && curretTable.containerWidget && curretTable.containerWidget.childWidgets.indexOf(curretTable) !== -1) {\n curretTable.containerWidget.childWidgets.splice(curretTable.containerWidget.childWidgets.indexOf(curretTable), 1);\n }\n }\n if (bodyWidget.childWidgets.indexOf(curretTable) !== -1) {\n bodyWidget.childWidgets.splice(bodyWidget.childWidgets.indexOf(curretTable), 1);\n }\n bodyWidget.childWidgets.unshift(curretTable);\n curretTable.containerWidget = bodyWidget;\n if (moveRowToNextTable && row.index > 0 || rowWidgets.length > 1) {\n this.moveNextWidgetsToTable(tableWidgets, rowWidgets, !moveRowToNextTable);\n }\n moveRowToNextTable = false;\n if (row.ownerTable.header && tableRowWidget.height < viewer.clientArea.bottom) {\n // if (viewer instanceof PageLayoutViewer) {\n viewer.currentRenderingPage.repeatHeaderRowTableWidget = true;\n // }\n //Updates table widgets location.\n viewer.updateClientAreaForBlock(row.ownerTable, true, tableWidgets);\n // tslint:disable-next-line:max-line-length\n //Update splitted row widget location. if header is repeated update the y position of splitted widget to header height.\n splittedWidget.x = splittedWidget.x;\n splittedWidget.y = tableWidget.y + row.ownerTable.headerHeight;\n // let cellspace: number = viewer instanceof PageLayoutViewer ? cellspacing / 2 : cellspacing;\n let cellspace = cellSpacing / 2;\n this.updateChildLocationForRow(tableWidget.y + row.ownerTable.headerHeight - cellspace, splittedWidget);\n }\n else {\n //Updates table widgets location.\n viewer.updateClientAreaForBlock(row.ownerTable, true, tableWidgets);\n // tslint:disable-next-line:max-line-length\n //Update splitted row widget location. if header is repeated update the y position of splitted widget to header height.\n splittedWidget.x = splittedWidget.x;\n splittedWidget.y = tableWidget.y;\n // let cellspace: number = viewer instanceof PageLayoutViewer ? cellspacing / 2 : cellspacing;\n let cellspace = cellSpacing / 2;\n this.updateChildLocationForRow(tableWidget.y - cellspace, splittedWidget);\n }\n }\n isLastRow = false;\n }\n if (isHeader && row.ownerTable.continueHeader) {\n row.ownerTable.header = true;\n row.ownerTable.headerHeight = rowHeight + row.ownerTable.headerHeight;\n }\n if (isHeader && !isNullOrUndefined(this.getHeader(row.ownerTable)) && row.index === this.getHeader(row.ownerTable).index) {\n let headerHeight = this.getHeaderHeight(row.ownerTable, row, rowWidgets);\n if (headerHeight > row.ownerTable.headerHeight || headerHeight > row.ownerTable.headerHeight) {\n row.ownerTable.headerHeight = headerHeight;\n }\n if (row.ownerTable.headerHeight > viewer.clientArea.height) {\n row.ownerTable.header = false;\n row.ownerTable.continueHeader = false;\n row.ownerTable.headerHeight = 0;\n let pages = viewer.pages;\n for (let i = 0; i < pages.length; i++) {\n if (pages[i].repeatHeaderRowTableWidget) {\n pages[i].repeatHeaderRowTableWidget = false;\n }\n }\n }\n }\n if (tableWidgets.length > 2 && row.ownerTable.header && tableRowWidget.height < viewer.clientActiveArea.bottom &&\n !viewer.currentRenderingPage.repeatHeaderRowTableWidget) {\n viewer.currentRenderingPage.repeatHeaderRowTableWidget = true;\n }\n }\n }", "filterRows(searchString, columnsToSearch) {\n const lowercaseSearchString = searchString || '';\n const objKeyLength = columnsToSearch.length;\n\n this.setState((prevState) => {\n const newRows = {\n filteredRows: prevState.totalRows.filter((row) => {\n for (let i = 0; i < objKeyLength; i += 1) {\n const key = columnsToSearch[i];\n if (row[key] &&\n row[key].toLowerCase &&\n row[key].toLowerCase().indexOf(lowercaseSearchString) > -1) {\n return row[key];\n }\n }\n return false;\n }),\n };\n return newRows;\n }, () => {\n /* Nested setState is no bueno, but it's the only way to directly capture the newly set filteredRows value in this function in a live search */\n this.setState({\n filteredPageCount: Math.ceil(this.state.filteredRows.length / this.state.perPage),\n filteredRowsPaged: this.state.filteredRows.slice(0, this.state.perPage),\n }, () => {\n this.globalSelectorGroup(this.state.filteredRowsPaged);\n });\n });\n }", "function DoSelection(nextRowIndex){\r\n\t\t\t\t\tif(et.defaultSelection == 'row'){\r\n\t\t\t\t\t\tet.Selection.SelectRowByIndex(nextRowIndex);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tet.ClearSelections();\r\n\t\t\t\t\t\tvar cellIndex = selecteElm.cellIndex;\r\n\t\t\t\t\t\tvar row = o.tbl.rows[nextRowIndex];\r\n\t\t\t\t\t\tif(et.defaultSelection == 'both') et.Selection.SelectRowByIndex(nextRowIndex);\r\n\t\t\t\t\t\tif(row) et.Selection.SelectCell(row.cells[cellIndex]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//Table is filtered\r\n\t\t\t\t\tif(o.validRowsIndex.length != o.GetRowsNb()){\r\n\t\t\t\t\t\tvar row = o.tbl.rows[nextRowIndex];\r\n\t\t\t\t\t\tif(row) row.scrollIntoView(false);\r\n\t\t\t\t\t\tif(cell){\r\n\t\t\t\t\t\t\tif(cell.cellIndex==(o.GetCellsNb()-1) && o.gridLayout) o.tblCont.scrollLeft = 100000000;\r\n\t\t\t\t\t\t\telse if(cell.cellIndex==0 && o.gridLayout) o.tblCont.scrollLeft = 0;\r\n\t\t\t\t\t\t\telse cell.scrollIntoView(false);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "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}", "function buildTableRows() {\r\n\tconsole.log('buildTableRows');\r\n\r\n\t// Initialise row count\r\n\tvar bodyHtml = [];\r\n\tvar numRowsMatched = 0;\r\n\tvar numRowsDisplayed = 0;\r\n\tvar startRowNo = pageNo == Infinity ? 1 : maxTableRows * (pageNo - 1) + 1;\r\n\tvar endRowNo = pageNo == Infinity ? Infinity : startRowNo + maxTableRows;\r\n\tconsole.log('buildTableRows', pageNo, maxTableRows, startRowNo, endRowNo);\r\n\t\r\n\t// Loop through all data rows\r\n\t$.each(data, function(index, record) {\r\n\t\t\r\n\t\t// Check if this row passes all the filters\r\n\t\tif (record[0] && !record[0].__filters.every(value => value)) return;\r\n\t\tif (record[1] && !record[1].__filters.every(value => value)) return;\r\n\t\tnumRowsMatched++;\r\n\t\t\r\n\t\t// Show only selected page\r\n\t\tif (numRowsMatched >= startRowNo && numRowsMatched < endRowNo) {\r\n\t\t\t\r\n\t\t\t// Add row to table body\r\n\t\t\tbodyHtml.push('<tr' + (record[0] && record[0].elected ? ' class=\"sjo-api-row-elected\"' : '') + '>' + buildTableRowCells(record).join('') + '</tr>');\r\n\t\t\tnumRowsDisplayed++;\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t});\r\n\t\r\n\t// Calculate actual end row\r\n\tendRowNo = startRowNo + numRowsDisplayed;\r\n\t\r\n\t// Return values as an object\r\n\treturn {\r\n\t\t'bodyHtml': \t\tbodyHtml,\r\n\t\t'numRowsMatched': \tnumRowsMatched,\r\n\t\t'numRowsDisplayed': numRowsDisplayed,\r\n\t\t'startRowNo': \t\tstartRowNo,\r\n\t\t'endRowNo': \t\tendRowNo,\r\n\t};\r\n\t\r\n}", "function dap_previousRow()\n{\n\tthis.saveData(this.getCurrentRow());\n\tif (this.DynamicTable.previousRow() == true)\n\t{\n\t\tvar boolflag = this.DataSource[this.getRecordIndex(\n\t\t\t\tthis.getCurrentRow())][this.DataSource[0].length-1];\n\t\tthis.DynamicTable.disableRow(this.getCurrentRow(),\n\t\t\t\t(boolflag == constLoadStatus)||(boolflag == constUpdateStatus));\n\t}\n}", "navigateForecastOptions(currentRow, e) {\n e.preventDefault();\n\n const target = e.target;\n\n if (target.nodeName.toLowerCase() === 'a') {\n let a = this.state.actionableRows.concat();\n\n if (!a.length) {\n const forecastGroups = this.state.forecastGroups;\n a = [];\n\n ['Gross Revenue', 'COGS', 'Sales,General,Admin Expenses', 'Non-Operating'].forEach(groupName => {\n a = a.concat(forecastGroups[groupName].data.toggled);\n });\n\n // Note that the currentRow isn't the same object (yet) in the `actionableRows` list that was constructed\n // from the forecastGroups. It will be on subsequent navigations, but initially when the list is seeded\n // we have to search through it manually and overwrite the `currentRow` that is passed to the event handler.\n currentRow = a.filter(item => item.Id === currentRow.Id)[0];\n }\n\n const indexOf = a.indexOf(currentRow);\n let row;\n\n if (target.text.toLowerCase() === 'previous') {\n if (indexOf === 0) {\n window.alert('You are at the first item, there is no previous item!');\n } else {\n row = a[indexOf - 1];\n }\n } else {\n if (indexOf === a.length - 1) {\n window.alert('You are at the last item, there is no next item!');\n } else {\n row = a[indexOf + 1];\n }\n }\n\n if (row) {\n this.setState({\n actionableRows: a, // It doesn't hurt to set this again, even if it was previously set by a ForecastOptions nav action.\n modal: Object.assign({}, this.state.modal, {\n data: {\n row\n }\n }),\n expanded: Object.assign({}, this.state.expanded, { [row.GroupName]: true }) // Automatically expand groups as user\n // navigages through them.\n });\n }\n }\n }", "function startNewRow (index, count) {\n console.log(index, count);\n return ((index) % count) === 0;\n }", "function show_rows(init_number) {\n for(var i = 0; i < $('.crash-table tbody tr').length; i++) {\n if(i >= init_number && i < MAX_CRASH_PER_PAGE+init_number)\n $('.crash-table tbody tr').eq(i).css(\"display\", \"table-row\");\n else\n $('.crash-table tbody tr').eq(i).css(\"display\", \"none\");\n }\n}", "function getRowAtIndex(index){\r\n \t currentIndex=index;\r\n \t showLeaveConfirmModal(index);\r\n \t \r\n }", "renderRows() {\n this._renderRows = this._getAllRenderRows();\n const changes = this._dataDiffer.diff(this._renderRows);\n if (!changes) {\n this._updateNoDataRow();\n return;\n }\n const viewContainer = this._rowOutlet.viewContainer;\n // @breaking-change 11.0.0 Remove null check for `_viewRepeater` and the\n // `else` clause once `_viewRepeater` is turned into a required parameter.\n if (this._viewRepeater) {\n this._viewRepeater.applyChanges(changes, viewContainer, (record, _adjustedPreviousIndex, currentIndex) => this._getEmbeddedViewArgs(record.item, currentIndex), (record) => record.item.data, (change) => {\n if (change.operation === 1 /* INSERTED */ && change.context) {\n this._renderCellTemplateForItem(change.record.item.rowDef, change.context);\n }\n });\n }\n else {\n changes.forEachOperation((record, prevIndex, currentIndex) => {\n if (record.previousIndex == null) {\n const renderRow = record.item;\n const rowDef = renderRow.rowDef;\n const context = { $implicit: renderRow.data };\n this._renderRow(this._rowOutlet, rowDef, currentIndex, context);\n }\n else if (currentIndex == null) {\n viewContainer.remove(prevIndex);\n }\n else {\n const view = viewContainer.get(prevIndex);\n viewContainer.move(view, currentIndex);\n }\n });\n }\n // Update the meta context of a row's context data (index, count, first, last, ...)\n this._updateRowIndexContext();\n // Update rows that did not get added/removed/moved but may have had their identity changed,\n // e.g. if trackBy matched data on some property but the actual data reference changed.\n changes.forEachIdentityChange((record) => {\n const rowView = viewContainer.get(record.currentIndex);\n rowView.context.$implicit = record.item.data;\n });\n this._updateNoDataRow();\n this.updateStickyColumnStyles();\n }", "_isRowHeader(rowHeader, index) {\n return index === 0 && rowHeader;\n }", "renderRow(startIndex, endIndex) {\n let elements = [];\n for (let i = startIndex; i !== endIndex; i++) {\n elements.push(this.renderElement(this.props.grid[i], i));\n }\n return (\n <Row key={startIndex}>\n {elements}\n </Row>\n );\n }", "function pagination(tableID) {\n var table = tableID;\n var trnum = 0;\n var maxRows = 15;\n var totalRows = $(table + \" tbody tr[class*='inList']\").length;\n $(table + \" tbody tr[class*='inList']\").each(function () {\n trnum++;\n if (trnum > maxRows) {\n $(this).hide();\n } if (trnum <= maxRows) {\n $(this).show();\n }\n });\n\n if (totalRows > maxRows) {\n var pagenu = Math.ceil(totalRows / maxRows);\n for (var i = 1; i <= pagenu && tableID == \"#custb\";) {\n $('#customer .pagination').append('<li data-page=\"' + i + '\">\\<span>' + i++ + '<span class=\"sr-only\">(current)</span>\\</li>').show();\n }\n for (var i = 1; i <= pagenu && tableID == \"#frtb\";) {\n $('#freelancer .pagination').append('<li data-page=\"' + i + '\">\\<span>' + i++ + '<span class=\"sr-only\">(current)</span>\\</li>').show();\n }\n for (var i = 1; i <= pagenu && tableID == \"#cattb\";) {\n $('#categoryValue .pagination').append('<li data-page=\"' + i + '\">\\<span>' + i++ + '<span class=\"sr-only\">(current)</span>\\</li>').show();\n }\n }\n\n $('.pagination li:first-child').addClass('active');\n $('.pagination li').on('click', function () {\n var pagenum = $(this).attr('data-page');\n var trIndex = 0;\n $('.pagination li').removeClass('active')\n $(this).addClass('active');\n $(table + \" tbody tr[class*='inList']\").each(function () {\n trIndex++;\n if (trIndex > (maxRows * pagenum) || trIndex <= ((maxRows * pagenum) - maxRows)) {\n $(this).hide();\n } else {\n $(this).show();\n }\n });\n });\n}", "function getRowIndex(target){\n var tr = $(target).closest('tr.datagrid-row');\n return parseInt(tr.attr('datagrid-row-index'));\n}", "renderer({ record, grid }) {\n return record.meta.specialRow ? '' : grid.store.indexOf(record, true) + 1;\n }", "reinitialize(returnToTop = false) {\n const me = this; // Calculate and correct the amount of rows needed (without triggering render)\n // Rows which are found to be surplus are destroyed.\n\n me.calculateRowCount(false, true, true); // If our row range is outside of the store's range, force a return to top\n\n if (me.topIndex + me.rowCount - 1 > me.store.count) {\n returnToTop = true;\n }\n\n const top = me.topRow && !returnToTop ? me.topRow.top : 0;\n me.scrollTargetRecordId = null;\n\n if (returnToTop) {\n me.topIndex = me.lastScrollTop = 0;\n }\n\n const {\n topRow\n } = me;\n\n if (topRow) {\n // Ensure rendering from the topRow starts at the correct position\n topRow.dataIndex = me.topIndex;\n topRow.setTop(top, true);\n } // Need to estimate height in case we have Grid using autoHeight\n\n me.estimateTotalHeight();\n me.renderFromRow(topRow);\n }", "topRow() {\n return INDEX2ROW(this.topLeft);\n }", "_hideRowsOutOfView() {\n const rect = this.dom.getBoundingClientRect();\n const scrollTop = this.dom.scrollTop;\n this._prevScrollTop = scrollTop;\n\n this._resizingVisibleRows.length = 0;\n const visible = this._resizingVisibleRows;\n\n // Find all the rows that are inside the scroll view\n // and store them in _resizingVisibleRows.\n // We will hide the rest.\n let foundFirst = false;\n let row = this.body.dom.childNodes[0];\n while (row) {\n if (row.ui instanceof TableRow && !row.ui.hidden) {\n const rowRect = row.getBoundingClientRect();\n\n if (rowRect.bottom >= rect.top && rowRect.top <= rect.bottom) {\n visible.push(row);\n foundFirst = true;\n } else if (foundFirst) {\n // early break as if this rect is not visible\n // but we have already added one this means we are\n // beyond the bottom bounds of the scroll view.\n break;\n }\n }\n\n row = row.nextSibling;\n }\n\n if (visible.length) {\n // calculate the height before the first visible row\n // and the height after the last visible row.\n const bodyRect = this.body.dom.getBoundingClientRect();\n const firstRect = visible[0].getBoundingClientRect();\n const lastRect = visible[visible.length - 1].getBoundingClientRect();\n const beforeHeight = firstRect.top - bodyRect.top;\n const afterHeight = bodyRect.bottom - lastRect.bottom;\n\n requestAnimationFrame(() => {\n if (!visible.length) return;\n\n // Set custom CSS properties for before and after heights so that we fill\n // the table with a pseudo-element row before the first visible row and one\n // after the last visible row. This will ensure that our scrollview remains\n // the same height and the scroll position remains at the same place. The user\n // should not see any movement or changes to the scrollview that way.\n this.body.style.setProperty(CSS_PROPERTY_HEIGHT_BEFORE, beforeHeight + 'px');\n this.body.style.setProperty(CSS_PROPERTY_HEIGHT_AFTER, afterHeight + 'px');\n visible.forEach((dom) => dom.classList.add(CLASS_RESIZING_VISIBLE));\n this.dom.scrollTop = scrollTop;\n });\n }\n }", "function dap_paintRow(numIndex,boolHighLightFlag)\n{\n\tthis.DynamicTable.panitRow(numIndex,boolHighLightFlag);\n}", "function SetModRowIndices(hdnModId,rowIndex,columnIndex)\n{\n var hdnModRows=document.getElementById(hdnModId);\n var arrMod=hdnModRows.value.split(',');\n arrMod.push(rowIndex);\n document.getElementById(hdnModId).value=RemoveDuplicates(arrMod).join(',');\n //To calcualte page level amounts in child grid view\n CalculatePagingAmounts(rowIndex,columnIndex);\n}", "_updateGridRows() {\n\n [...this.element.children].forEach((item, i) => {\n let index = i % this.maxItemsPerRow;\n let position;\n if ( index === 0){\n this.rows.push([]);\n }\n\n position = this._getItemPosition(index);\n this.rows[this.lastIndex].push({item: item, position: position});\n });\n }", "__getRowFrom(item) {\n return this.tree.getLookupTable().indexOf(item);\n }", "prev() {\n const that = this,\n availableItems = that.dataSource.length;\n \n if (that.disabled || availableItems === 0) {\n return;\n }\n\n let previousItem = that._currentIndex;\n\n if(that.loop){\n previousItem = previousItem <= 0 ? availableItems - 1 : previousItem - 1;\n }\n else {\n previousItem = previousItem <= 0 ? 0 : previousItem - 1;\n }\n\n that._goToItem(previousItem);\n }", "function MUA_Filter_SelectRows(filter_text) {\n //console.log( \"===== MUA_Filter_SelectRows ========= \");\n //console.log( \"filter_text: <\" + filter_text + \">\");\n const filter_text_lower = (filter_text) ? filter_text.toLowerCase() : \"\";\n let has_selection = false, has_multiple = false;\n let sel_value = null, sel_pk = null, sel_mapid = null;\n let row_count = 0;\n\n let tblBody_select = document.getElementById(\"id_MUA_tbody_select\");\n for (let i = 0, tblRow; tblRow = tblBody_select.rows[i]; i++) {\n if (tblRow){\n let hide_row = false\n// --- show all rows if filter_text = \"\"\n if (filter_text_lower){\n const data_value = get_attr_from_el(tblRow, \"data-value\")\n// --- show row if filter_text_lower is found in data_value, hide when data_value is blank\n hide_row = (data_value) ? hide_row = (!data_value.toLowerCase().includes(filter_text_lower)) : true;\n };\n if (hide_row) {\n tblRow.classList.add(cls_hide)\n } else {\n tblRow.classList.remove(cls_hide);\n row_count += 1;\n// --- put values from first row that is shown in select_value etc\n if(!has_selection ) {\n sel_pk = get_attr_from_el(tblRow, \"data-pk\");\n sel_value = get_attr_from_el(tblRow, \"data-value\");\n sel_mapid = tblRow.id;\n } else {\n has_multiple = true;\n }\n has_selection = true;\n }}};\n// --- set select_value etc null when multiple items found\n if (has_multiple){\n sel_pk = null;\n sel_value = null,\n sel_mapid = null;\n }\n return {selected_pk: sel_pk, selected_value: sel_value, selected_mapid: sel_mapid};\n }", "function showTable(table, page=1){\n //Calculate the page number\n const rows = Array.from(table.rows).slice(1);\n const maxrows = document.getElementById('maxrows').value;\n let maxpage = Math.ceil(rows.length/maxrows);\n //page could not be grater than maxpage\n page = (page <= maxpage)?page:maxpage;\n //page could not be less than 1\n page = (page < 1)?1:page;\n \n //Calculate the init index and final index\n let init_idx = (page-1) * maxrows;\n let final_idx = (rows.length >= page*maxrows)?(page*maxrows):rows.length;\n let show_rows = rows.slice(init_idx, final_idx);\n \n //Hide the table\n hideTable(table);\n //Show the rows\n show_rows.map(showRow);\n //Update the pagination\n selectPagePagination(page);\n}", "onRowBackToViewportRange(e, args) {\n if (args && args.item) {\n this._views.forEach((view) => {\n if (view[this.datasetIdPropName] === args.item[this.datasetIdPropName]) {\n this.redrawViewComponent(view);\n }\n });\n }\n }", "function rowCallback (row, data, index) {\n var rowId = data.DT_RowId.toString();\n\n if (_.indexOf(selectedRows, rowId) !== -1) {\n setRowSelectedUI(row, true);\n }\n\n if (origRowCallback) origRowCallback(row, data, index);\n }", "get rowsCount() {\n return (this.endRow - this.startRow) + 1\n }", "addWidgetToTable(viewer, tableCollection, rowCollection, row, endRowWidget, isInitialLayout) {\n //Adds table row widget to owner table widget.\n let tableWidget = tableCollection[0];\n let index = tableWidget.childWidgets.length;\n let prevWidget = undefined;\n let rowWidgetIndex = rowCollection.indexOf(row);\n if (rowWidgetIndex > 0) {\n prevWidget = rowCollection[rowWidgetIndex - 1];\n // Need to update on this further\n }\n else if (row.previousRenderedWidget instanceof TableRowWidget &&\n row.previousRenderedWidget.ownerTable.equals(row.ownerTable)) {\n // Need to update on this further\n prevWidget = row.previousRenderedWidget;\n }\n if (!isNullOrUndefined(prevWidget)) {\n tableWidget = prevWidget.containerWidget;\n // index = tableWidget.childWidgets.length;\n index = tableWidget.childWidgets.indexOf(prevWidget) + 1;\n if (Math.round(row.y) !== Math.round(prevWidget.y + prevWidget.height)) {\n let prevIndex = tableCollection.indexOf(tableWidget);\n if (prevIndex + 1 >= tableCollection.length) {\n //Creates new table widget for splitted rows.\n this.addTableWidget(viewer.clientActiveArea, tableCollection, true);\n }\n tableWidget = tableCollection[prevIndex + 1];\n index = tableWidget.childWidgets.length;\n }\n if (rowWidgetIndex > 0) {\n index = 0;\n }\n }\n this.updateRowHeightBySpannedCell(tableWidget, row, index);\n this.updateRowHeightByCellSpacing(tableCollection, row, viewer);\n //Remove widget from previous container after splitteing\n if (row.containerWidget && row.containerWidget !== tableWidget &&\n row.containerWidget.childWidgets.indexOf(row) !== -1) {\n row.containerWidget.childWidgets.splice(row.containerWidget.childWidgets.indexOf(row), 1);\n }\n if (tableWidget.childWidgets.indexOf(row) === -1) {\n tableWidget.childWidgets.splice(index, 0, row);\n }\n row.containerWidget = tableWidget;\n tableWidget.height = tableWidget.height + row.height;\n // Shift the widgets for Right to left directed table.\n if (tableWidget.isBidiTable) {\n row.shiftWidgetForRtlTable(this.viewer.clientArea, tableWidget, row);\n }\n if (!isNullOrUndefined(tableWidget.containerWidget)\n && tableWidget.containerWidget.childWidgets.indexOf(tableWidget) >= 0 &&\n !(tableWidget.containerWidget instanceof HeaderFooterWidget)) {\n tableWidget.containerWidget.height += row.height;\n }\n this.updateHeightForRowWidget(viewer, false, tableCollection, rowCollection, row, false, endRowWidget, isInitialLayout);\n viewer.cutFromTop(row.y + row.height);\n }", "function getRow(i) {\n return Math.ceil((i+1)/3);\n}", "function isolateHorizontal(tr, map, table, start, left, right, top, mapFrom) {\n if (top == 0 || top == map.height) { return false }\n var found = false;\n for (var col = left; col < right; col++) {\n var index = top * map.width + col, pos = map.map[index];\n if (map.map[index - map.width] == pos) {\n found = true;\n var cell = table.nodeAt(pos);\n var ref = map.findCell(pos);\n var cellTop = ref.top;\n var cellLeft = ref.left;\n tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, setAttr(cell.attrs, \"rowspan\", top - cellTop));\n tr.insert(tr.mapping.slice(mapFrom).map(map.positionAt(top, cellLeft, table)),\n cell.type.createAndFill(setAttr(cell.attrs, \"rowspan\", (cellTop + cell.attrs.rowspan) - top)));\n col += cell.attrs.colspan - 1;\n }\n }\n return found\n}", "function HighlightAdjustRow(index)\n{\n\t// Update the class used for the row to set to highlight\n\tvar row = document.getElementById(TagPrefix_Table + index);\n\tif (row != null)\n\t\trow.className = HighlightedTableTagClass;\n\t\n\t// Update the style used by the image in the select column to dictate whether tick image shown or not\n\tvar tickControlIndex = parseInt(index);\n\ttickControlIndex++;\n\t\n\tvar tick = document.getElementById(TickPrefix_Table + tickControlIndex + TickSuffix_Table);\n\tif (tick != null)\n\t\ttick.style.display='';\n\t\n}", "renderFlights(obj, startpl, pagination) {\n const flights = Object.keys(obj).map(i => obj[i]);\n const sp = Object.keys(startpl).map(i => startpl[i]);\n //if the user uses the next-button and then uses a filter, we have to reset the index-nrs. of the flight to use the slice-methode\n let itemsToShowIndex = (pagination === 0 || pagination < (this.state.itemsToShowStart/this.state.numberOfShowItems)) ? 0 : this.state.itemsToShowStart;\n let itemsToShowIndexMax = (pagination === 0 || pagination < (this.state.itemsToShowStart/this.state.numberOfShowItems)) ? this.state.numberOfShowItems : this.state.itemsToShow;\n return flights.slice(itemsToShowIndex, itemsToShowIndexMax).map((x) => {\n return sp.map((z)=>{\n if(x.startplace.area === z.id){\n let startplaceName = _.find(z.startplaces, { id: x.startplace.startplace }).name;\n let isactiveuser = x.pilot.email === this.props.activeUser ? true : false;\n return (\n <tr className=\"table__row table__row--animated\" key={x.id}>\n <td className=\"table__date\">{x.date}</td>\n <td className=\"table__pilot\">{x.pilot.name}</td> \n <td className=\"table__start\">{`${z.name}, ${startplaceName}`}</td>\n <td className=\"table__duration\">{utils.timeToHourMinString(x.flighttime)}</td>\n <td className=\"table__distance\">{x.xcdistance}&nbsp;km</td>\n <td className=\"table__details\"><Link className=\"anchor table__link\" to={routes.FLUG + x.id}>Flugdetails</Link></td>\n <td className=\"table__details table__details--icons\"> \n {isactiveuser ? <Link className=\"table__icon\" to={routes.FLUGDATEN_ERFASSEN + \"/\" + x.id}>\n <svg version=\"1.1\" className=\"svg-icon svg-icon--edit\" x=\"0px\" y=\"0px\" viewBox=\"0 0 23.7 23.7\">\n <path className=\"svg-icon__path\" d=\"M20.5,6.3l2.4-2.4l-3.1-3.1l-2.4,2.4\"/>\n <path className=\"svg-icon__path\" d=\"M6.4,20.3l14.1-14l-3.1-3.1l-14.1,14l-2.5,5.5L6.4,20.3z M3.3,17.2l3.1,3.1\"/>\n </svg>\n </Link> : null}\n <button className=\"table__icon\" onClick={(event) => {this.copyFlight(event, x.id)}}>\n <svg version=\"1.1\" className=\"svg-icon svg-icon--copy\" x=\"0px\" y=\"0px\" viewBox=\"0 0 23.7 23.7\" >\n <path className=\"svg-icon__path\" d=\"M5.9,6h16.9v16.9H5.9V6z\"/>\n <path className=\"svg-icon__path\" d=\"M5.9,17.7H0.8V0.8h16.9v5.1\"/>\n </svg>\n </button>\n {isactiveuser ? <button className=\"table__icon\" onClick={(event) => {this.showMessageBox(event, x.id, x.imgUrl)}}>\n <svg version=\"1.1\" className=\"svg-icon svg-icon--delete\" x=\"0px\" y=\"0px\" viewBox=\"0 0 23.7 23.7\">\n <path className=\"svg-icon__path\" d=\"M2.2,3.7h19 M8.1,3.7V2.2c0-0.8,0.6-1.4,1.4-1.4H14c0.8,0,1.4,0.6,1.4,1.4l0,0v1.5 M19.2,3.7L18.1,21\n c0,1-0.8,1.8-1.8,1.8H7.1c-1,0-1.8-0.8-1.8-1.8L4.2,3.7\"/>\n <path className=\"svg-icon__path\" d=\"M11.7,6.7v13.2 M8.1,6.7l0.7,13.2 M15.4,6.7l-0.7,13.2\"/>\n </svg>\n </button> : null}\n </td>\n </tr>\n );\n }\n return null;\n })\n }); \n }", "pos(index) {\n var idx = this.search.findLeft(index)\n if(idx+1<this.rows.length && this.rows[idx+1]==index)\n return [idx+1,0]\n return [idx, index-this.rows[idx]]\n }", "function renderTable(page=0) {\r\n $tbody.innerHTML = \"\";\r\n var start =page * $maxresults;\r\n var end=start + $maxresults;\r\n for (var i = 0; i < $maxresults; i++) {\r\n // Get get the current address object and its fields\r\n console.log(start, i);\r\n var alien = filterdata[start + i];\r\n console.log(alien);\r\n var fields = Object.keys(alien);\r\n // Create a new row in the tbody, set the index to be i + startingIndex\r\n var $row = $tbody.insertRow(i);\r\n for (var j = 0; j < fields.length; j++) {\r\n // For every field in the address object, create a new cell at set its inner text to be the current value at the current address's field\r\n var field = fields[j];\r\n var $cell = $row.insertCell(j);\r\n $cell.innerText = alien[field];\r\n }\r\n }\r\n // show pagination\r\nvar Numberofpages=filterdata.length/$maxresults;\r\n$pagination.innerHTML=\"\";\r\nfor(let i=0; i < Numberofpages; i++){\r\n var li=document.createElement(\"Li\");\r\n var a=document.createElement(\"a\");\r\n li.classList.add(\"page-item\");\r\n a.classList.add(\"page-Link\");\r\n a.text=i+1;\r\n a.addEventListener(\"click\",function(){\r\n renderTable(i);\r\n });\r\n li.appendChild(a);\r\n $pagination.appendChild(li);\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n}", "onRowClick({ index }) {\n const { expandedHeight } = this.props;\n const { openIndex } = this.state;\n const selectedIndex =\n expandedHeight && index === openIndex ? undefined : index;\n this.setState({ openIndex: selectedIndex });\n }", "getTableRowMoveImages() {\n\t\tconst selected = this.props.controller.getSelectedRows(this.props.propertyId).sort();\n\t\tconst controlValue = this.props.controller.getPropertyValue(this.props.propertyId);\n\t\tlet topEnabled = (\n\t\t\t!this.props.disableRowMoveButtons &&\n\t\t\t(selected.length !== 0 && selected[0] !== 0) &&\n\t\t\t!this.props.disabled\n\t\t);\n\t\tlet bottomEnabled = (\n\t\t\t!this.props.disableRowMoveButtons &&\n\t\t\t(selected.length !== 0 && selected[selected.length - 1] !== controlValue.length - 1) &&\n\t\t\t!this.props.disabled\n\t\t);\n\t\tconst staticRows = this.props.controller.getStaticRows(this.props.propertyId).sort();\n\t\tif (selected.length > 0 && staticRows.length > 0 && staticRows.includes(selected[0])) {\n\t\t\ttopEnabled = false;\n\t\t\tbottomEnabled = false;\n\t\t} else if (selected[0] === staticRows[staticRows.length - 1] + 1) {\n\t\t\ttopEnabled = false;\n\t\t\tbottomEnabled = (\n\t\t\t\t!this.props.disableRowMoveButtons &&\n\t\t\t\t(selected.length !== 0 && selected[selected.length - 1] !== controlValue.length - 1) &&\n\t\t\t\t!this.props.disabled\n\t\t\t);\n\t\t} else if (selected[0] === staticRows[0] - 1) {\n\t\t\tbottomEnabled = false;\n\t\t}\n\n\n\t\tconst topLabel = formatMessage(this.props.controller.getReactIntl(), MESSAGE_KEYS.MOVEABLE_TABLE_BUTTON_TOP_DESCRIPTION);\n\t\tconst upLabel = formatMessage(this.props.controller.getReactIntl(), MESSAGE_KEYS.MOVEABLE_TABLE_BUTTON_UP_DESCRIPTION);\n\t\tconst topImages = (\n\t\t\t<div key=\"topImages\">\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"table-row-move-button\"\n\t\t\t\t\tonClick={this.topMoveRow}\n\t\t\t\t\tdisabled={!topEnabled}\n\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\trenderIcon={UpToTop24}\n\t\t\t\t\ticonDescription={topLabel}\n\t\t\t\t\ttooltipPosition=\"left\"\n\t\t\t\t\thasIconOnly\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"table-row-move-button\"\n\t\t\t\t\tonClick={this.upMoveRow}\n\t\t\t\t\tdisabled={!topEnabled}\n\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\trenderIcon={ArrowUp24}\n\t\t\t\t\ticonDescription={upLabel}\n\t\t\t\t\ttooltipPosition=\"left\"\n\t\t\t\t\thasIconOnly\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t\tconst bottomLabel = formatMessage(this.props.controller.getReactIntl(),\tMESSAGE_KEYS.MOVEABLE_TABLE_BUTTON_DOWN_DESCRIPTION);\n\t\tconst downLabel = formatMessage(this.props.controller.getReactIntl(),\tMESSAGE_KEYS.MOVEABLE_TABLE_BUTTON_BOTTOM_DESCRIPTION);\n\t\tconst bottomImages = (\n\t\t\t<div key=\"bottomImages\">\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"table-row-move-button\"\n\t\t\t\t\tonClick={this.downMoveRow}\n\t\t\t\t\tdisabled={!bottomEnabled}\n\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\trenderIcon={ArrowDown24}\n\t\t\t\t\ticonDescription={bottomLabel}\n\t\t\t\t\ttooltipPosition=\"left\"\n\t\t\t\t\thasIconOnly\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"table-row-move-button\"\n\t\t\t\t\tonClick={this.bottomMoveRow}\n\t\t\t\t\tdisabled={!bottomEnabled}\n\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\trenderIcon={DownToBottom24}\n\t\t\t\t\ticonDescription={downLabel}\n\t\t\t\t\ttooltipPosition=\"left\"\n\t\t\t\t\thasIconOnly\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t\treturn [topImages, bottomImages];\n\t}", "function handlePrevButtonClick() {\n count--;\n renderTable();\n}", "doOnClickHighlight(row) {\n let indexFound = this.clickedRow.indexOf(this.rows[row.$index]);\n if (indexFound == -1) {\n this.clickedRow.push(this.rows[row.$index]);\n }\n else {\n this.clickedRow.splice(indexFound, 1);\n }\n }", "insertSplittedCellWidgets(viewer, tableCollection, rowWidget, previousRowIndex) {\n let left = rowWidget.x;\n let tableWidth = 0;\n tableWidth = HelperMethods.convertPointToPixel(rowWidget.ownerTable.tableHolder.tableWidth);\n for (let i = 0; i < rowWidget.childWidgets.length; i++) {\n let cellWidget = rowWidget.childWidgets[i];\n if (Math.round(left) < Math.round(cellWidget.x - cellWidget.margin.left)) {\n if (this.insertRowSpannedWidget(rowWidget, viewer, left, i)) {\n i--;\n continue;\n }\n let length = rowWidget.childWidgets.length;\n this.insertEmptySplittedCellWidget(rowWidget, tableCollection, left, i, previousRowIndex);\n if (length < rowWidget.childWidgets.length) {\n i--;\n continue;\n }\n }\n left += cellWidget.margin.left + cellWidget.width + cellWidget.margin.right;\n if (i === rowWidget.childWidgets.length - 1 && Math.round(left) < Math.round(rowWidget.x + tableWidth)) {\n if (this.insertRowSpannedWidget(rowWidget, viewer, left, i + 1)) {\n continue;\n }\n this.insertEmptySplittedCellWidget(rowWidget, tableCollection, left, i + 1, previousRowIndex);\n continue;\n }\n }\n // tslint:disable-next-line:max-line-length\n // Special case: when the child widgets of row is equal to 0 then the splitted widgets in the viewer is added in the table row widgets. \n if ((isNullOrUndefined(rowWidget.childWidgets) || rowWidget.childWidgets.length === 0) && viewer.splittedCellWidgets.length > 0) {\n for (let j = 0; j < viewer.splittedCellWidgets.length; j++) {\n let widget = viewer.splittedCellWidgets[j];\n if (Math.round(left) <= Math.round(widget.x - widget.margin.left)) {\n if (this.insertRowSpannedWidget(rowWidget, viewer, left, j)) {\n j--;\n continue;\n }\n let count = rowWidget.childWidgets.length;\n this.insertEmptySplittedCellWidget(rowWidget, tableCollection, left, j, previousRowIndex);\n if (count < rowWidget.childWidgets.length) {\n j--;\n continue;\n }\n }\n left += widget.margin.left + widget.width + widget.margin.right;\n if (j === rowWidget.childWidgets.length - 1 && Math.round(left) <\n Math.round(rowWidget.x + tableWidth)) {\n if (this.insertRowSpannedWidget(rowWidget, viewer, left, j + 1)) {\n continue;\n }\n this.insertEmptySplittedCellWidget(rowWidget, tableCollection, left, j + 1, previousRowIndex);\n continue;\n }\n }\n }\n if (viewer.splittedCellWidgets.length > 0) {\n viewer.splittedCellWidgets = [];\n }\n }", "renderer({\n record,\n grid\n }) {\n return record.meta.specialRow ? '' : grid.store.indexOf(record, true) + 1;\n }", "function filterInclusiveStart(rows, targetValue, index) {\n\t var indexFields = index.def.fields;\n\t for (var i = 0, len = rows.length; i < len; i++) {\n\t var row = rows[i];\n\n\t // shave off any docs at the beginning that are <= the\n\t // target value\n\n\t var docKey = getKeyFromDoc(row.doc, index);\n\t if (indexFields.length === 1) {\n\t docKey = docKey[0]; // only one field, not multi-field\n\t } else { // more than one field in index\n\t // in the case where e.g. the user is searching {$gt: {a: 1}}\n\t // but the index is [a, b], then we need to shorten the doc key\n\t while (docKey.length > targetValue.length) {\n\t docKey.pop();\n\t }\n\t }\n\t //ABS as we just looking for values that don't match\n\t if (Math.abs(collate$1(docKey, targetValue)) > 0) {\n\t // no need to filter any further; we're past the key\n\t break;\n\t }\n\t }\n\t return i > 0 ? rows.slice(i) : rows;\n\t}", "function ResetFilterRows() { // PR2019-10-26 PR2020-06-20\n //console.log( \"===== ResetFilterRows ========= \");\n\n selected_user_pk = null;\n\n filter_dict = {};\n filter_mod_employee = false;\n\n Filter_TableRows(true); // true = set filter isactive\n\n let filterRow = tblHead_datatable.rows[1];\n if(!!filterRow){\n for (let j = 0, cell, el; cell = filterRow.cells[j]; j++) {\n if(cell){\n el = cell.children[0];\n if(el){\n const filter_tag = get_attr_from_el(el, \"data-filtertag\")\n if(el.tagName === \"INPUT\"){\n el.value = null\n } else {\n const el_icon = el.children[0];\n if(el_icon){\n let classList = el_icon.classList;\n while (classList.length > 0) {\n classList.remove(classList.item(0));\n }\n el_icon.classList.add(\"tickmark_0_0\")\n }\n }\n }\n }\n }\n };\n FillTblRows();\n } // function ResetFilterRows", "function RowObject(grid, row, prevRowSelect, SelectedRowIndex) {\n this.grid = grid;\n this.row = row;\n this.prevRowSelect = prevRowSelect;\n this.SelectedRowIndex = SelectedRowIndex;\n this.Style = \"\";\n this.RowClick = function () {\n if (this.row == undefined) return false;\n if (this.grid == undefined) return false;\n if (typeof this.grid == 'string')\n this.grid = document.getElementById(this.grid);\n else\n this.grid = document.getElementById(this.grid.id);\n if (this.grid == null) return false;\n if (this.row > this.grid.rows.length) this.row = 0;\n if (this.grid.rows.length == 1) return false;\n //13931004\n //var GridSize = document.getElementById('DbnavigatorPage1_txtGridSize').value;\n var GridSize = 15;\n if (document.getElementById('DbnavigatorPage1_txtGridSize')) GridSize = document.getElementById('DbnavigatorPage1_txtGridSize').value;\n\n this.SelectedRowIndex = this.row;\n if (this.row == -1) return false;\n if ((this.prevRowSelect != -2) && (this.prevRowSelect < this.grid.rows.length)) {\n k = (this.prevRowSelect % 2);\n if (k == 0) this.grid.rows[this.prevRowSelect].className = 'GridAlternating' + this.Style;\n else this.grid.rows[this.prevRowSelect].className = 'GridItem' + this.Style;\n }\n\n this.prevRowSelect = this.row + 1;\n if (this.prevRowSelect >= this.grid.rows.length) this.prevRowSelect = this.grid.rows.length - 1;\n this.grid.rows[this.prevRowSelect].className = 'highlight GridRowSelected' + this.Style;\n //13931004\n if (document.getElementById('DbnavigatorPage1_lblCurrentPage')) {\n var index = (parseInt(document.getElementById('DbnavigatorPage1_lblCurrentPage').value) - 1) * GridSize;\n document.getElementById('DbnavigatorPage1_lblCurrentItem').value = (this.prevRowSelect + index);\n }\n\n return true;\n }\n\n}", "expandableRow(row) {\r\n return this.rowClickId.includes(row.Id);\r\n }", "_selectRow(e) {\n let allTr = this.shadowRoot.querySelector('tbody').querySelectorAll('tr');\n let len = allTr.length;\n while (len--) {\n allTr[len].setAttribute('selected', false);\n }\n\n if (e.target.parentElement.parentNode.rowIndex >= 0) {\n e.target.parentElement.parentNode.setAttribute('selected', true);\n this._selectedIndex = e.target.parentElement.parentNode.rowIndex - 1;\n\n if (e.type === 'click') {\n this.dispatchEvent(new CustomEvent('tablerow-selected', {\n detail: this._collection.rawEntity.entities[this._selectedIndex], bubbles: true, composed: true\n }));\n }\n } else if (e.target.nodeName === 'INPUT' && e.target.parentNode.parentElement.parentElement.rowIndex >= 0) {\n this._selectedIndex = e.target.parentNode.parentElement.parentElement.rowIndex - 1;\n }\n\n }", "_linkifyRows() {\n this._rowsTimeoutId = undefined;\n const buffer = this._bufferService.buffer;\n if (this._rowsToLinkify.start === undefined || this._rowsToLinkify.end === undefined) {\n this._logService.debug('_rowToLinkify was unset before _linkifyRows was called');\n return;\n }\n // Ensure the start row exists\n const absoluteRowIndexStart = buffer.ydisp + this._rowsToLinkify.start;\n if (absoluteRowIndexStart >= buffer.lines.length) {\n return;\n }\n // Invalidate bad end row values (if a resize happened)\n const absoluteRowIndexEnd = buffer.ydisp + Math.min(this._rowsToLinkify.end, this._bufferService.rows) + 1;\n // Iterate over the range of unwrapped content strings within start..end\n // (excluding).\n // _doLinkifyRow gets full unwrapped lines with the start row as buffer offset\n // for every matcher.\n // The unwrapping is needed to also match content that got wrapped across\n // several buffer lines. To avoid a worst case scenario where the whole buffer\n // contains just a single unwrapped string we limit this line expansion beyond\n // the viewport to +OVERSCAN_CHAR_LIMIT chars (overscan) at top and bottom.\n // This comes with the tradeoff that matches longer than OVERSCAN_CHAR_LIMIT\n // chars will not match anymore at the viewport borders.\n const overscanLineLimit = Math.ceil(OVERSCAN_CHAR_LIMIT / this._bufferService.cols);\n const iterator = this._bufferService.buffer.iterator(false, absoluteRowIndexStart, absoluteRowIndexEnd, overscanLineLimit, overscanLineLimit);\n while (iterator.hasNext()) {\n const lineData = iterator.next();\n for (let i = 0; i < this._linkMatchers.length; i++) {\n this._doLinkifyRow(lineData.range.first, lineData.content, this._linkMatchers[i]);\n }\n }\n this._rowsToLinkify.start = undefined;\n this._rowsToLinkify.end = undefined;\n }", "layoutTable(table, startIndex) {\n table.isBidiTable = table.bidi;\n if (!table.isGridUpdated) {\n table.buildTableColumns();\n table.isGridUpdated = true;\n }\n let tableView = [table];\n this.addTableWidget(this.viewer.clientActiveArea, tableView);\n this.viewer.updateClientAreaTopOrLeft(table, true);\n let isHeader = table.childWidgets[0].rowFormat.isHeader;\n if (table.childWidgets.length > 0) {\n table.header = isHeader;\n table.continueHeader = isHeader;\n table.headerHeight = 0;\n }\n let row = table.childWidgets[startIndex];\n while (row) {\n row = this.layoutRow(tableView, row);\n row = row.nextRow;\n }\n this.updateWidgetsToPage(tableView, [], table);\n return tableView[tableView.length - 1];\n }" ]
[ "0.6275539", "0.6152105", "0.61089987", "0.606125", "0.60141224", "0.599389", "0.59630674", "0.58686024", "0.5865561", "0.5861295", "0.5817468", "0.5797318", "0.5789881", "0.5705301", "0.5701013", "0.56493944", "0.56161875", "0.5613135", "0.5569459", "0.5564996", "0.5547341", "0.55268", "0.5516145", "0.5510229", "0.5507256", "0.5507256", "0.55012584", "0.54748297", "0.5470194", "0.5460677", "0.5433386", "0.54317015", "0.5429439", "0.54202294", "0.541225", "0.5411762", "0.54038", "0.5401196", "0.5396853", "0.5393218", "0.53796554", "0.53559095", "0.53555715", "0.53545123", "0.5349691", "0.53474337", "0.53472847", "0.5342229", "0.53372836", "0.53346443", "0.5328531", "0.53192794", "0.53121656", "0.5305379", "0.5300836", "0.53006476", "0.5274017", "0.52675587", "0.5263352", "0.52566785", "0.5254547", "0.5253954", "0.52524835", "0.5246611", "0.52422327", "0.52422", "0.52372664", "0.5229389", "0.52269787", "0.52259064", "0.52231455", "0.5222754", "0.52144384", "0.5214039", "0.521371", "0.52133644", "0.52118206", "0.52085423", "0.5206863", "0.5205717", "0.52032965", "0.5203026", "0.5200298", "0.51924455", "0.51900506", "0.5173481", "0.5170884", "0.51697004", "0.5169542", "0.51550555", "0.51525956", "0.5150846", "0.5148553", "0.51479965", "0.5147407", "0.5146697", "0.5146154", "0.51398414", "0.51360846", "0.51353997" ]
0.5573224
18
Next valid filtered row needs to be selected
function DoSelection(nextRowIndex){ if(et.defaultSelection == 'row'){ et.Selection.SelectRowByIndex(nextRowIndex); } else { et.ClearSelections(); var cellIndex = selecteElm.cellIndex; var row = o.tbl.rows[nextRowIndex]; if(et.defaultSelection == 'both') et.Selection.SelectRowByIndex(nextRowIndex); if(row) et.Selection.SelectCell(row.cells[cellIndex]); } //Table is filtered if(o.validRowsIndex.length != o.GetRowsNb()){ var row = o.tbl.rows[nextRowIndex]; if(row) row.scrollIntoView(false); if(cell){ if(cell.cellIndex==(o.GetCellsNb()-1) && o.gridLayout) o.tblCont.scrollLeft = 100000000; else if(cell.cellIndex==0 && o.gridLayout) o.tblCont.scrollLeft = 0; else cell.scrollIntoView(false); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onAfterSelection(et, selecteElm, e){\r\n\t\t\t\tif(!o.validRowsIndex) return; //table is not filtered\r\n\t\t\t\tvar row = et.defaultSelection != 'row' ? selecteElm.parentNode : selecteElm;\r\n\t\t\t\tvar cell = selecteElm.nodeName=='TD' ? selecteElm : null; //cell for default_selection = 'both' or 'cell'\r\n\t\t\t\tvar keyCode = e != undefined ? et.Event.GetKey(e) : 0;\r\n\t\t\t\tvar isRowValid = o.validRowsIndex.tf_Has(row.rowIndex);\r\n\t\t\t\tvar nextRowIndex;\r\n\t\t\t\tvar d = (keyCode == 34 || keyCode == 33 ? (o.pagingLength || et.nbRowsPerPage) : 1); //pgup/pgdown keys\r\n\r\n\t\t\t\t//If next row is not valid, next valid filtered row needs to be calculated\r\n\t\t\t\tif(!isRowValid){\r\n\t\t\t\t\t//Selection direction up/down\r\n\t\t\t\t\tif(row.rowIndex>o._lastRowIndex){\r\n\t\t\t\t\t\tif(row.rowIndex >= o.validRowsIndex[o.validRowsIndex.length-1]) //last row\r\n\t\t\t\t\t\t\tnextRowIndex = o.validRowsIndex[o.validRowsIndex.length-1];\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\tvar calcRowIndex = (o._lastValidRowIndex + d);\r\n\t\t\t\t\t\t\tif(calcRowIndex > (o.validRowsIndex.length-1))\r\n\t\t\t\t\t\t\t\tnextRowIndex = o.validRowsIndex[o.validRowsIndex.length-1];\r\n\t\t\t\t\t\t\telse nextRowIndex = o.validRowsIndex[calcRowIndex];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else{\r\n\t\t\t\t\t\tif(row.rowIndex <= o.validRowsIndex[0]) nextRowIndex = o.validRowsIndex[0];//first row\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\tvar v = o.validRowsIndex[o._lastValidRowIndex - d];\r\n\t\t\t\t\t\t\tnextRowIndex = v ? v : o.validRowsIndex[0];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\to._lastRowIndex = row.rowIndex;\r\n\t\t\t\t\tDoSelection(nextRowIndex);\r\n\t\t\t\t} else{\r\n\t\t\t\t\t//If filtered row is valid, special calculation for pgup/pgdown keys\r\n\t\t\t\t\tif(keyCode!=34 && keyCode!=33){\r\n\t\t\t\t\t\to._lastValidRowIndex = o.validRowsIndex.tf_IndexByValue(row.rowIndex);\r\n\t\t\t\t\t\to._lastRowIndex = row.rowIndex;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif(keyCode == 34){ //pgdown\r\n\t\t\t\t\t\t\tif((o._lastValidRowIndex + d) <= (o.validRowsIndex.length-1)) //last row\r\n\t\t\t\t\t\t\t\tnextRowIndex = o.validRowsIndex[o._lastValidRowIndex + d];\r\n\t\t\t\t\t\t\telse nextRowIndex = o.validRowsIndex[o.validRowsIndex.length-1];\r\n\t\t\t\t\t\t} else { //pgup\r\n\t\t\t\t\t\t\tif((o._lastValidRowIndex - d) <= (o.validRowsIndex[0])) //first row\r\n\t\t\t\t\t\t\t\tnextRowIndex = o.validRowsIndex[0];\r\n\t\t\t\t\t\t\telse nextRowIndex = o.validRowsIndex[o._lastValidRowIndex - d];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\to._lastRowIndex = nextRowIndex;\r\n\t\t\t\t\t\to._lastValidRowIndex = o.validRowsIndex.tf_IndexByValue(nextRowIndex);\r\n\t\t\t\t\t\tDoSelection(nextRowIndex);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//Next valid filtered row needs to be selected\r\n\t\t\t\tfunction DoSelection(nextRowIndex){\r\n\t\t\t\t\tif(et.defaultSelection == 'row'){\r\n\t\t\t\t\t\tet.Selection.SelectRowByIndex(nextRowIndex);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tet.ClearSelections();\r\n\t\t\t\t\t\tvar cellIndex = selecteElm.cellIndex;\r\n\t\t\t\t\t\tvar row = o.tbl.rows[nextRowIndex];\r\n\t\t\t\t\t\tif(et.defaultSelection == 'both') et.Selection.SelectRowByIndex(nextRowIndex);\r\n\t\t\t\t\t\tif(row) et.Selection.SelectCell(row.cells[cellIndex]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//Table is filtered\r\n\t\t\t\t\tif(o.validRowsIndex.length != o.GetRowsNb()){\r\n\t\t\t\t\t\tvar row = o.tbl.rows[nextRowIndex];\r\n\t\t\t\t\t\tif(row) row.scrollIntoView(false);\r\n\t\t\t\t\t\tif(cell){\r\n\t\t\t\t\t\t\tif(cell.cellIndex==(o.GetCellsNb()-1) && o.gridLayout) o.tblCont.scrollLeft = 100000000;\r\n\t\t\t\t\t\t\telse if(cell.cellIndex==0 && o.gridLayout) o.tblCont.scrollLeft = 0;\r\n\t\t\t\t\t\t\telse cell.scrollIntoView(false);\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}", "function next_selection() {\n if (window.selected_rows.length == 0) {\n return null;\n }\n var next_row_index = window.selected_rows.shift();\n window.current_row_index = next_row_index;\n\n // remove the selected class so it is not highlighted\n var dt = window.datatable;\n var tr_node = dt.row(next_row_index).node();\n var next = $(tr_node);\n next.removeClass(\"selected\");\n\n // return row index\n return next_row_index;\n}", "selectNextResult() {\n this.selectedResultIndex += 1;\n // Wrap around as needed\n if (this.selectedResultIndex === this.results.length) {\n this.selectedResultIndex = 0;\n }\n }", "next() {\n var _a, _b;\n let found = ITERATION_STATUS.EO_STRM;\n while (this.inputDataSource.hasNext()) {\n this._unfilteredPos++;\n let next = this.inputDataSource.next();\n //again here we cannot call the filter function twice, because its state might change, so if indexed, we have a decent snapshot, either has next or next can trigger\n //the snapshot\n if (next != ITERATION_STATUS.EO_STRM &&\n (((_b = (_a = this._filterIdx) === null || _a === void 0 ? void 0 : _a[this._unfilteredPos]) !== null && _b !== void 0 ? _b : false) || this.filterFunc(next))) {\n this._filterIdx[this._unfilteredPos] = true;\n found = next;\n break;\n }\n }\n this._current = found;\n return found;\n }", "function selectNext(gridRows, indexAt) {\n return gridRows[++indexAt.index];\n }", "function dap_nextRow()\n{\n\tthis.saveData(this.getCurrentRow());\n\tif (this.DynamicTable.nextRow() == true)\n\t{\n\t\tvar boolflag = this.DataSource[this.getRecordIndex(\n\t\t\t\tthis.getCurrentRow())][this.DataSource[0].length-1];\n\t\tthis.DynamicTable.disableRow(this.getCurrentRow(),\n\t\t\t\t((boolflag == constLoadStatus)||(boolflag == constUpdateStatus)));\n\t}\n}", "function handle_next() {\n // get the next row\n var next = next_selection();\n if (next == null) {\n //my_alert(\"Selection set is empty\");\n lb_alert(\"info\", \"No more selections to process\");\n return;\n }\n // set selections left indicator\n set_selections_left();\n\n // call the initiator function on the next selection\n window.initiate_fcn(next, $(featherlight_selector()).get(0));\n}", "function selectRow(index) {\n if (index == undefined || index < 0 || index >= _currentData.length) return;\n selectedIndexes().push(index);\n }", "getNextChange() {\n const filterCriteria = [{\n attributeName: 'hasError',\n attributeValue: 0,\n attributeType: 'NUMBER',\n filterCondition: 'EQUALS'\n }];\n return this.getStore().then(s => s.filter(filterCriteria, 'id', {\n offset: 0,\n limit: 1\n })).then((changes) => {\n return changes && changes[0];\n });\n }", "gotoNextHit() {\n let me = this,\n grid = me.grid,\n // start from focused cell, or if focus has left grid use lastFocusedCell\n currentId = grid._focusedCell ? grid._focusedCell.id : grid.lastFocusedCell.id,\n currentIndex = grid.store.indexOf(currentId) || 0,\n nextHit = me.found.find((hit) => hit.index > currentIndex);\n\n if (nextHit) {\n grid.focusCell({\n columnId: me.columnId,\n id: nextHit.id\n });\n } else {\n me.gotoFirstHit();\n }\n }", "function _select(e,row) {\n let { checked } = e.target;\n let index = rows.indexOf(row);\n rows[index].checked = checked;\n getCheckedRows();\n }", "function SetFocusNextRow(e,sender)\n{\n var keyCode = e.keyCode||e.which; \n if (keyCode==9) { \n var idSplit=sender.id.split('_');\n var rowIndex=parseInt(idSplit[4].replace('GVRow',''))+1;\n var gridId=idSplit[0]+'_'+idSplit[1]+'_'+idSplit[2]+'_'+idSplit[3];\n var rowSelector=\"#\"+gridId+\" tr[id*='GVRow']:eq(\"+rowIndex+\")\";\n //Select input text box. here 0 th element is checkbox \n var inputSelector=\":input:visible:eq(1)\";\n var target=jQuery(rowSelector).find(inputSelector);\n if(target.size()>0)\n {\n if(target.closest('tr').css('display')==='none') {\n //Call recursively for deleted rows\n SetFocusNextRow(e,target[0]);\n }\n else {\n if(e.preventDefault)e.preventDefault();\n else e.returnValue=false;\n setTimeout(function(){target[0].focus();},4);\n }\n }\n }\n}", "function getNextEditableRow() {\r\n\t\t\trowNum = parseInt(rowNum) + 1;\r\n\t\t\teditableFieldsList = getEditableFieldListInOrder(nmsp, rowNum);\r\n\t\t\tvar maxVisibleRowNum = parseInt(grid.getRowCount()) + parseInt(initRowNum);\r\n\t\t\tif (editableFieldsList && editableFieldsList.length > 0) {\r\n\t\t\t\tnextEditableCol = editableFieldsList[0];\r\n\t\t\t\tnextEditableFieldId = getNextGridFieldId(rowNum, nextEditableCol);\r\n\t\t\t} else if (maxVisibleRowNum < rowNum && grid.getBodyContainer().maxVerticalScrollPosition > $(gridBlockElem).scrollTop()) { // if maximum number visible rows exceeded then scroll write the next set\r\n\t\t\t\tvar ypos = $(gridBlockElem).scrollTop() + grid.getBodyContainer().height - grid.getBodyContainer().verticalMask;\r\n\t\t\t\tif (grid.getBodyContainer()._calculatedTotalHeight > ypos) {\r\n\t\t\t\t\t$(gridBlockElem).animate({\r\n\t\t\t\t\t\t'scrollTop': ypos\r\n\t\t\t\t\t}, 300, '', function () {\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\trowNum = initRowNum;\r\n\t\t\t\t\t\t\tgetNextEditableRow();\r\n\t\t\t\t\t\t}, 400);\r\n\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t} else if ((grid.getBodyContainer().maxVerticalScrollPosition > $(gridBlockElem).scrollTop()) || (Object.keys(nmsp.rowEditableColumnMap).length > rowNum))\r\n\t\t\t\tgetNextEditableRow();\r\n\t\t}", "function selectRow(target, step, state) {\n if (!state) state = $.data(target, 'combotree');\n if (!state.tree) $(target).combo(\"panel\");\n var tree = state.tree;\n state.remainText = false;\n if (step < 0) tree.tree(\"selectPrev\");\n else tree.tree(\"selectNext\");\n }", "selectNext() {\n const children = Array.from(this.children);\n if (!children || children.length === 0) {\n return;\n }\n const selectedItem = this.selectedItem;\n const prevIndex = children.indexOf(selectedItem);\n const nextIndex = prevIndex + 1 >= children.length ? 0 : prevIndex + 1;\n this.selected = nextIndex;\n }", "gotoNextHit() {\n let me = this,\n grid = me.grid,\n // start from focused cell, or if focus has left grid use lastFocusedCell\n currentId = grid._focusedCell ? grid._focusedCell.id : grid.lastFocusedCell.id,\n currentIndex = grid.store.indexOf(currentId) || 0,\n nextHit = me.found.find(hit => hit.index > currentIndex);\n\n if (nextHit) {\n grid.focusCell({\n columnId: me.columnId,\n id: nextHit.id\n });\n } else {\n me.gotoFirstHit();\n }\n }", "setNextRowActive() {\n this._activeRowIndex < 0 ? this.setFirstCellActive() : this._setActiveCellByDelta(1, 0);\n }", "next() {\n this.selectNonDisabled(this.activeTabIndex, 1);\n }", "selectPrevResult() {\n this.selectedResultIndex -= 1;\n if (this.selectedResultIndex < 0) {\n this.selectedResultIndex = this.results.length - 1;\n }\n }", "next() {\n // $(this.parentElement).data(\"obj\").select_fwd();\n $(this.parentElement).data(\"obj\").update_idx(1);\n return false;\n }", "_selectRowByIndex(idx) {\n let allTr = this.shadowRoot.querySelector('tbody').querySelectorAll('tr');\n\n if (idx >= 0 && allTr.length > 1 && idx < allTr.length) {\n\n let len = allTr.length;\n while (len--) {\n allTr[len].setAttribute('selected', false);\n }\n allTr[idx].setAttribute('selected', true);\n this._selectedIndex = idx;\n }\n }", "function runCellAndSelectBelow(_) {\n _.selectedCell.execute(function () {\n return selectNextCell(_);\n });\n return false;\n }", "next() {\n const that = this,\n availableItems = that.dataSource.length;\n \n if (that.disabled || availableItems === 0) {\n return;\n }\n\n let nextItem = that._currentIndex;\n\n if(that.loop){\n nextItem = nextItem >= availableItems-1 ? 0 : nextItem + 1;\n }\n else {\n nextItem = nextItem >= availableItems-1 ? nextItem : nextItem + 1;\n }\n\n that._goToItem(nextItem);\n }", "function MUA_Filter_SelectRows(filter_text) {\n //console.log( \"===== MUA_Filter_SelectRows ========= \");\n //console.log( \"filter_text: <\" + filter_text + \">\");\n const filter_text_lower = (filter_text) ? filter_text.toLowerCase() : \"\";\n let has_selection = false, has_multiple = false;\n let sel_value = null, sel_pk = null, sel_mapid = null;\n let row_count = 0;\n\n let tblBody_select = document.getElementById(\"id_MUA_tbody_select\");\n for (let i = 0, tblRow; tblRow = tblBody_select.rows[i]; i++) {\n if (tblRow){\n let hide_row = false\n// --- show all rows if filter_text = \"\"\n if (filter_text_lower){\n const data_value = get_attr_from_el(tblRow, \"data-value\")\n// --- show row if filter_text_lower is found in data_value, hide when data_value is blank\n hide_row = (data_value) ? hide_row = (!data_value.toLowerCase().includes(filter_text_lower)) : true;\n };\n if (hide_row) {\n tblRow.classList.add(cls_hide)\n } else {\n tblRow.classList.remove(cls_hide);\n row_count += 1;\n// --- put values from first row that is shown in select_value etc\n if(!has_selection ) {\n sel_pk = get_attr_from_el(tblRow, \"data-pk\");\n sel_value = get_attr_from_el(tblRow, \"data-value\");\n sel_mapid = tblRow.id;\n } else {\n has_multiple = true;\n }\n has_selection = true;\n }}};\n// --- set select_value etc null when multiple items found\n if (has_multiple){\n sel_pk = null;\n sel_value = null,\n sel_mapid = null;\n }\n return {selected_pk: sel_pk, selected_value: sel_value, selected_mapid: sel_mapid};\n }", "function adjustRowStatuses() {\n for (var i = 0; i < $scope.rows.length; i++) {\n if ($scope.rows[i].status === 'Not Started') {\n $scope.rows[i].status = 'Next';\n break;\n }\n }\n }", "function dap_firstRow()\n{\n\tthis.saveData(this.getCurrentRow());\n\tif (this.DynamicTable.firstRow() == true)\n\t{\n\t\tvar boolflag = this.DataSource[this.getRecordIndex(\n\t\t\t\tthis.getCurrentRow())][this.DataSource[0].length-1];\n\t\tthis.DynamicTable.disableRow(this.getCurrentRow(),\n\t\t\t\t(boolflag == constLoadStatus)||(boolflag == constUpdateStatus));\n\t}\n}", "getNextSelectionRow(row) {\n if (!isNullOrUndefined(row.nextRenderedWidget)) {\n let isForwardSelection = this.isEmpty || this.isForward;\n if (isForwardSelection) {\n // tslint:disable-next-line:max-line-length\n let cell = row.nextRenderedWidget.childWidgets[row.nextRenderedWidget.childWidgets.length - 1];\n let block = cell.childWidgets[cell.childWidgets.length - 1];\n return this.getLastParagraphBlock(block);\n }\n else {\n return this.getNextParagraphSelection(row.nextRenderedWidget);\n }\n }\n return this.getNextSelectionBlock(row.ownerTable);\n }", "function MUD_Filter_SelectRows(filter_text) {\n //console.log( \"===== MUD_Filter_SelectRows ========= \");\n //console.log( \"filter_text: <\" + filter_text + \">\");\n const filter_text_lower = (filter_text) ? filter_text.toLowerCase() : \"\";\n let has_selection = false, has_multiple = false;\n let sel_value = null, sel_pk = null, sel_mapid = null;\n let row_count = 0;\n\n let tblBody_select = document.getElementById(\"id_MUD_tbody_select\");\n for (let i = 0, tblRow; tblRow = tblBody_select.rows[i]; i++) {\n if (tblRow){\n let hide_row = false\n// --- show all rows if filter_text = \"\"\n if (filter_text_lower){\n const data_value = get_attr_from_el(tblRow, \"data-value\")\n// --- show row if filter_text_lower is found in data_value, hide when data_value is blank\n hide_row = (data_value) ? hide_row = (!data_value.toLowerCase().includes(filter_text_lower)) : true;\n };\n if (hide_row) {\n tblRow.classList.add(cls_hide)\n } else {\n tblRow.classList.remove(cls_hide);\n row_count += 1;\n// --- put values from first row that is shown in select_value etc\n if(!has_selection ) {\n sel_pk = get_attr_from_el(tblRow, \"data-pk\");\n sel_value = get_attr_from_el(tblRow, \"data-value\");\n sel_mapid = tblRow.id;\n } else {\n has_multiple = true;\n }\n has_selection = true;\n }}};\n// --- set select_value etc null when multiple items found\n if (has_multiple){\n sel_pk = null;\n sel_value = null,\n sel_mapid = null;\n }\n return {selected_pk: sel_pk, selected_value: sel_value, selected_mapid: sel_mapid};\n }", "gotoHit(index) {\n let me = this,\n grid = me.grid,\n nextHit = me.found[index];\n\n if (nextHit) {\n grid.focusCell({\n field: nextHit.field,\n id: nextHit.id\n });\n }\n\n return !!nextHit;\n }", "function Filter_TableRows(set_filter_isactive) { // PR2019-06-09 PR2020-08-31 PR2022-03-03\n //console.log( \"===== Filter_TableRows=== \");\n //console.log( \"filter_dict\", filter_dict);\n\n // function filters by inactive and substring of fields\n // - iterates through cells of tblRow\n // - skips filter of new row (new row is always visible)\n // - if filter_name is not null:\n // - checks tblRow.cells[i].children[0], gets value, in case of select element: data-value\n // - returns show_row = true when filter_name found in value\n // - if col_inactive has value >= 0 and hide_inactive = true:\n // - checks data-value of column 'inactive'.\n // - hides row if inactive = true\n\n if (set_filter_isactive){\n HandleFilterInactive();\n };\n selected.item_count = 0;\n const data_inactive_field = (selected_btn !== \"btn_userpermit\") ? \"data-inactive\" : null;\n for (let i = 0, tblRow, show_row; tblRow = tblBody_datatable.rows[i]; i++) {\n tblRow = tblBody_datatable.rows[i]\n show_row = t_Filter_TableRow_Extended(filter_dict, tblRow, data_inactive_field);\n\n //console.log( \"show_row\", show_row);\n\n add_or_remove_class(tblRow, cls_hide, !show_row);\n if (show_row) {selected.item_count += 1};\n }\n\n// --- show total in sidebar\n t_set_sbr_itemcount_txt(loc, selected.item_count, loc.User, loc.Users, setting_dict.user_lang);\n }", "runFilters (row) {\n let match = true\n this.props.filters.items.map((filter) => {\n\n //sanity check against old filters\n if (isItemPresent(this.props.columns.items, filter.column)) {\n //if the item doesn't have this field filled\n if (!row.values || $.isEmptyObject(row.values) || !row.values[filter.column])\n match = false\n //if it does\n else {\n let value = row.values[filter.column]\n\n switch (filter.type) {\n case 'text':\n //does this value contain query text\n if (value.toLowerCase().indexOf(filter.values[0].toLowerCase()) < 0)\n match = false\n\n break\n\n case 'number':\n //is it between given numbers\n if (filter.values[0] && value < filter.values[0] ||\n filter.values[1] && value > filter.values[1])\n match = false\n\n break\n\n case 'date':\n //is it between given dates\n value = new Date(value)\n\n if (filter.values[0] && value < new Date(filter.values[0]) ||\n filter.values[1] && value > new Date(filter.values[1]))\n match = false\n\n break\n\n default:\n //this must be a select, straight matching\n if (value != filter.values[0])\n match = false\n }\n }\n }\n\n })\n\n return match\n }", "switchSelected(index) {\n\n if (typeof index == 'number') {\n this.current = index;\n return;\n }\n\n let nextInd = travelArray(this.items, this.current);\n\n if (this.items[nextInd].hidden)\n nextInd = travelArray(this.items, nextInd)\n\n this.current = nextInd;\n }", "function maybe_reveal_one_row(rows, goal) {\n console.log(\"maybe_reveal_one_row, \" + rows.length + \" row(s), \" + rows.not(\".hidden\").length + \" exposed, \" + goal + \" goal.\");\n if (goal === false || rows.not(\".hidden\").length < goal) {\n var next = rows.filter(\".hidden:last\");\n if (next.length > 0) {\n reveal_one_row(next.removeClass('hidden'));\n return true;\n }\n }\n return false;\n}", "gotoHit(index) {\n const me = this,\n grid = me.grid,\n nextHit = me.found[index];\n\n if (nextHit) {\n grid.focusCell({\n field: nextHit.field,\n id: nextHit.id\n });\n }\n\n return !!nextHit;\n }", "NextVisible() {}", "function shownoofRecord()\r\n\t{\r\n\t\t$scope.pageSize=$scope.shownoofrec;\r\n\t\tself.Filterreceipts=self.receipts.slice($scope.currentPage*$scope.pageSize);\r\n\t\tif(self.Filterreceipts.length<=$scope.pageSize)\r\n\t\t{\r\n\t\t\t$scope.previousDisabled=true;\r\n\t\t\t$scope.nextDisabled=true;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$scope.nextDisabled=false;\r\n\t\t}\r\n\t}", "function selectRow(target, index){\r\n\t\tvar grid = $.data(target, 'datagrid').grid;\r\n\t\tvar opts = $.data(target, 'datagrid').options;\r\n\t\tvar data = $.data(target, 'datagrid').data;\r\n\t\tvar selectedRows = $.data(target, 'datagrid').selectedRows;\r\n\r\n\r\n\t\tvar ck = $('.datagrid-body tr[datagrid-row-index='+index+'] .datagrid-cell-check input[type=checkbox]',grid);\r\n\t\tvar change= true;\r\n\t\tif(typeof(opts.onSelectChange)=='function'){\r\n\t\t\tvar c= opts.onSelectChange.call(target, index, data.rows[index],selectedRows);\r\n\t\t\tif(c===false) change=c;\r\n\t\t\tif(!change){\r\n\t\t\t\tck.attr('checked', false);\r\n\t\t\t\treturn ;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//see as focused if selectrow\r\n\t\t$(grid).data(\"focused\",true);\r\n\r\n\t\tvar tr = $('.datagrid-body tr[datagrid-row-index='+index+']',grid);\r\n\t\tif (opts.singleSelect == true){\r\n\t\t\tclearSelections(target);\r\n\t\t}\r\n\t\ttr.addClass('datagrid-row-selected');\r\n\t\tck.attr('checked', true);\r\n\r\n\t\tif (opts.idField){\r\n\t\t\tvar row = data.rows[index];\r\n\t\t\tfor(var i=0; i<selectedRows.length; i++){\r\n\t\t\t\tif (selectedRows[i][opts.idField] == row[opts.idField]){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tselectedRows.push(row);\r\n\t\t}\r\n\t\topts.onSelect.call(target, index, data.rows[index]);\r\n\t}", "function getRow(_row, _todo) {\n if (_row >= 0)\n setSelectedRow({ row: _row, todo: _todo });\n }", "hasNext() {\n //don't let the next display if there's (mandatory) choices to make\n if (this.hasChoices()) {return false;}\n let check = this.getNextLineIndex() || this.getNextDialogueIndex() || this.getNextSceneIndex();\n if (check) {return check;} else {return false;}\n }", "function selectNextItem(){\n var items = document.getElementById('searchresults').childNodes;\n selectIndex((selectedSearchIndex + 1) % items.length);\n }", "_handleCancelSelection() {\n const { _rows: oldRows, _searchString: searchString } = this;\n this._rows = this._rows.map((row) =>\n searchString && !doesRowMatchSearchString(row, searchString) ? row : { ...row, selected: false }\n );\n this.requestUpdate('_rows', oldRows);\n }", "function getNextAvailableSelectableRowIndex($container, index) {\r\n\t\tvar $rows = $container.getMultipleSelectBoxCachedRows();\r\n\t\tindex += 1;\r\n\t\tif (index < 0 || index >= $rows.length) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\tif (!$rows.eq(index).isMultipleSelectBoxRowSelectable()) {\r\n\t\t\treturn getNextAvailableSelectableRowIndex($container, index);\r\n\t\t}\r\n\t\treturn index;\r\n\t}", "function selectRow(target, step, state) {\n if (!state) state = $.data(target, 'combogrid');\n var opts = state.options;\n if (!state.grid) $(target).combo(\"panel\");\n var grid = state.grid;\n var rowCount = grid.datagrid('getRows').length;\n state.remainText = false;\n\n var index;\n var selections = grid.datagrid('getSelections');\n if (selections.length) {\n index = grid.datagrid('getRowIndex', selections[selections.length - 1][opts.idField]);\n index += step;\n if (index < 0) index = 0;\n if (index >= rowCount) index = rowCount - 1;\n } else if (step > 0) {\n index = 0;\n } else if (step < 0) {\n index = rowCount - 1;\n } else {\n index = -1;\n }\n if (index >= 0) {\n grid.datagrid('clearSelections');\n grid.datagrid('selectRow', index);\n if (step == 0) {//触发onclickrow事件\n opts.onClickRow.call(this, index, grid.datagrid('getRowByIndex', index));\n }\n }\n }", "row(row) {\n let courses = row[0].courses\n if( (courses.length === 1) && (courses[0].length === 1) ) {\n return lookup.get(courses[0][0]).isSelected\n }\n else {\n return handleConditionalRequirements(courses)\n }\n }", "gotoPrevHit() {\n let me = this,\n grid = me.grid,\n currentId = grid._focusedCell ? grid._focusedCell.id : grid.lastFocusedCell.id,\n currentIndex = grid.store.indexOf(currentId) || 0,\n found = me.found,\n prevHit;\n\n if (!found.length) return;\n\n for (let i = found.length - 1; i--; i >= 0) {\n if (found[i].index < currentIndex) {\n prevHit = found[i];\n break;\n }\n }\n\n if (prevHit) {\n grid.focusCell({\n columnId: me.columnId,\n id: prevHit.id\n });\n } else {\n me.gotoLastHit();\n }\n }", "function selectRow(target, index, notCheck){\r\n\t\tvar state = $.data(target, 'datagrid');\r\n\t\tvar dc = state.dc;\r\n\t\tvar opts = state.options;\r\n\t\tvar selectedRows = state.selectedRows;\r\n\t\t\r\n\t\tif (opts.singleSelect){\r\n\t\t\tunselectAll(target);\r\n\t\t\tselectedRows.splice(0, selectedRows.length);\r\n\t\t}\r\n\t\tif (!notCheck && opts.checkOnSelect){\r\n\t\t\tcheckRow(target, index, true);\t// don't select the row again\r\n\t\t}\r\n\t\t\r\n\t\tvar row = opts.finder.getRow(target, index);\r\n\t\tif (opts.idField){\r\n\t\t\taddArrayItem(selectedRows, opts.idField, row);\r\n\t\t}\r\n\t\topts.finder.getTr(target, index).addClass('datagrid-row-selected');\r\n\t\topts.onSelect.call(target, index, row);\r\n\t\tscrollTo(target, index);\r\n\t}", "function selectNext(addToSelection) {\n _computeFirstAndLastVisible();\n var selItem = selection.last();\n // No previous selection => select first visible\n if (selItem === undefined) {\n var uuid = selection.getFocus().next;\n if (!uuid) uuid = firstVisibleUUID;\n selection.add(uuid, addToSelection, 1);\n _moveTo(uuid);\n }\n else {\n // Previous selection was made with keyboard left arrow => revert selection\n if (selItem.direction === -1) {\n var uuid = selItem.uuid;\n selection.remove(uuid);\n }\n // Previous selection was made with keyboard right arrow => continue selecting to the right\n else {\n var uuid = fpCache.getNextUUID(selItem.uuid);\n selection.add(uuid, addToSelection, 1);\n _moveTo(uuid);\n }\n }\n updateSelectionUI(true);\n}", "_selectRow(e) {\n let allTr = this.shadowRoot.querySelector('tbody').querySelectorAll('tr');\n let len = allTr.length;\n while (len--) {\n allTr[len].setAttribute('selected', false);\n }\n\n if (e.target.parentElement.parentNode.rowIndex >= 0) {\n e.target.parentElement.parentNode.setAttribute('selected', true);\n this._selectedIndex = e.target.parentElement.parentNode.rowIndex - 1;\n\n if (e.type === 'click') {\n this.dispatchEvent(new CustomEvent('tablerow-selected', {\n detail: this._collection.rawEntity.entities[this._selectedIndex], bubbles: true, composed: true\n }));\n }\n } else if (e.target.nodeName === 'INPUT' && e.target.parentNode.parentElement.parentElement.rowIndex >= 0) {\n this._selectedIndex = e.target.parentNode.parentElement.parentElement.rowIndex - 1;\n }\n\n }", "selectRow() {\n if (!this.owner.enableSelection) {\n return;\n }\n this.selectTableRow();\n }", "function onBeforeSelection(et, selecteElm, e){\r\n\t\t\t\tvar row = et.defaultSelection != 'row' ? selecteElm.parentNode : selecteElm;\r\n\t\t\t\tif(o.paging){\r\n\t\t\t\t\tif(o.nbPages>1){\r\n\t\t\t\t\t\tet.nbRowsPerPage = o.pagingLength; //page length is re-assigned in case it has changed\r\n\t\t\t\t\t\tvar pagingEndRow = parseInt(o.startPagingRow) + parseInt(o.pagingLength);\r\n\t\t\t\t\t\tvar rowIndex = row.rowIndex;\r\n\t\t\t\t\t\tif((rowIndex == o.validRowsIndex[o.validRowsIndex.length-1]) && o.currentPageNb!=o.nbPages) o.SetPage('last');\r\n\t\t\t\t\t\telse if((rowIndex == o.validRowsIndex[0]) && o.currentPageNb!=1) o.SetPage('first');\r\n\t\t\t\t\t\telse if(rowIndex > o.validRowsIndex[pagingEndRow-1] && rowIndex < o.validRowsIndex[o.validRowsIndex.length-1]) o.SetPage('next');\r\n\t\t\t\t\t\telse if(rowIndex < o.validRowsIndex[o.startPagingRow] && rowIndex > o.validRowsIndex[0]) o.SetPage('previous');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}", "function selectRows(data) {\n \t\n }", "function Filter_TableRows() { // PR2019-06-09 PR2020-08-31 PR2022-03-03\n //console.log( \"===== Filter_TableRows=== \");\n //console.log( \"filter_dict\", filter_dict);\n\n // function filters by inactive and substring of fields\n // - iterates through cells of tblRow\n // - skips filter of new row (new row is always visible)\n // - if filter_name is not null:\n // - checks tblRow.cells[i].children[0], gets value, in case of select element: data-value\n // - returns show_row = true when filter_name found in value\n // - if col_inactive has value >= 0 and hide_inactive = true:\n // - checks data-value of column 'inactive'.\n // - hides row if inactive = true\n\n const data_inactive_field = null; // \"data-inactive\";\n for (let i = 0, tblRow, show_row; tblRow = tblBody_datatable.rows[i]; i++) {\n tblRow = tblBody_datatable.rows[i]\n show_row = t_Filter_TableRow_Extended(filter_dict, tblRow, data_inactive_field);\n add_or_remove_class(tblRow, cls_hide, !show_row);\n };\n }", "if (nextState.pageSize === rowCount && nextState.currentPage === 1) {\n return null;\n }", "gotoPrevHit() {\n let me = this,\n grid = me.grid,\n currentId = grid._focusedCell ? grid._focusedCell.id : grid.lastFocusedCell.id,\n currentIndex = grid.store.indexOf(currentId) || 0,\n found = me.found,\n prevHit;\n if (!found.length) return;\n\n for (let i = found.length - 1; i--; i >= 0) {\n if (found[i].index < currentIndex) {\n prevHit = found[i];\n break;\n }\n }\n\n if (prevHit) {\n grid.focusCell({\n columnId: me.columnId,\n id: prevHit.id\n });\n } else {\n me.gotoLastHit();\n }\n }", "function selectUp(e) {\n if (e.target.parentElement.id.startsWith(\"result-\")) {\n const index = parseInt(e.target.parentElement.id.substring(7));\n if (!isNaN(index) && (index > 0)) {\n const nextIndexStr = \"result-\" + (index - 1);\n const querySel = \"li[id$='\" + nextIndexStr + \"'\";\n const nextResult = document.querySelector(querySel);\n if (nextResult) {\n nextResult.firstChild.focus();\n }\n }\n }\n}", "function select_row_internal_fill_external(){\n // select row\n $(\"#internal_table tbody\").on('click', 'tr', function () {\n // if we click on row which is already selected. we desect it\n if($(this).hasClass('selected')){\n //row is deselected. that means there is no selected row in the table\n is_selected_internal = false;\n\n // remove supplier external product table content\n table_external.clear().draw();\n\n // deselect row\n $(this).removeClass('selected');\n\n sel_internal_table_row = null;\n // row is not selected. deselect selected row and select current\n }else{\n //row is selected\n is_selected_internal = true;\n\n table_internal.$('tr.selected').removeClass('selected');\n $(this).addClass('selected');\n\n var data = table_internal.row(this).data();\n // fill supplier external product table content\n fill_supplier_external_product_table(data);\n\n sel_internal_table_row = this;\n }\n });\n}", "function nextEntry() {\n selectEntry(g_cur_entry + 1, true);\n}", "function searchSelection(e) {\n if (e.code === \"ArrowDown\") {\n if (selected === null) {\n setSelected(0);\n } else {\n if (selected < searchResults.length - 1) {\n const newVal = selected + 1;\n setSelected(newVal);\n }\n }\n }\n if (e.code === \"ArrowUp\") {\n if (selected === 0) {\n setSelected(null);\n } else if (selected === null) {\n } else {\n const newVal = selected - 1;\n setSelected(newVal);\n }\n } else if (e.code === \"Enter\") {\n if (selected === null) {\n handleSubmit(e, e.target.value);\n } else {\n const selectedRow = document.querySelector(\"#selected > td\").innerText;\n const rowValues = selectedRow.split(\" \");\n if (rowValues[1] === \"account\") {\n handleSubmit(e, rowValues[0]);\n } else {\n selectSearchItem(e, rowValues[0]);\n }\n }\n }\n }", "function selectRow(target, index, notCheck, state) {\n if (!state) state = $.data(target, 'datagrid');\n var dc = state.dc;\n var opts = state.options;\n var data = state.data;\n var selectedRows = $.data(target, 'datagrid').selectedRows;\n\n //如果有cannot-select的class属性就不能select\n var tr = opts.finder.getTr(target, index, undefined, undefined, state)\n if(tr.hasClass('cannot-select'))return\n\n if (opts.singleSelect) {\n unselectAll(target, undefined, state);\n selectedRows.splice(0, selectedRows.length);\n }\n if (!notCheck && opts.checkOnSelect) {\n checkRow(target, index, true, state);\t// don't select the row again\n }\n\n if (opts.idField) {\n var row = opts.finder.getRow(target, index, state);\n if (!row[opts.idField]||indexOfRowId(selectedRows, opts.idField, row[opts.idField]) < 0)\n selectedRows.push(row);\n }\n\n opts.onSelect.call(target, index, data.rows[index]);\n\n //var tr = opts.finder.getTr(target, index, undefined, undefined, state).addClass('datagrid-row-selected');\n tr.addClass('datagrid-row-selected')\n if (tr.length) {\n var body2 = dc.body2;\n var top = tr.position().top;// - headerHeight;\n if (top <= 0) {\n body2.scrollTop(body2.scrollTop() + top);\n } else {\n var th = tr._outerHeight(), bh = body2[0].clientHeight;\n if (top + th > bh) {\n body2.scrollTop(body2.scrollTop() + top + th - bh);// - bh + 18\n }\n }\n }\n }", "function next() {\n if ($scope.options.index < pageCount - 1) {\n $scope.options.index++;\n }\n }", "function nextStates() {\n var maxEnd = moment.min(moment(filter.end).add(globalTime, globalTimeRange), moment(Date.now()));\n filter.end = maxEnd.format('YYYY-MM-DD HH:mm:ss');\n filter.start = maxEnd.subtract(globalTime, globalTimeRange).format('YYYY-MM-DD HH:mm:ss');\n $('#daterangepicker').data('daterangepicker').setStartDate(moment(filter.start).format('l[, ]LTS'));\n $('#daterangepicker').data('daterangepicker').setEndDate(moment(filter.end).format('l[, ]LTS'));\n refreshData();\n }", "function filterMyTable(row) {\n\n //Filters\n //Date Input. \n var filterOuput = (new Date(row.datetime)).getTime() >= (new Date(dateInput.property(\"value\"))).getTime();\n\n // City\n if (citySelector.property(\"value\") != \"Select Parameter\") {\n filterOuput = (filterOuput && (row.city === citySelector.property(\"value\")));\n };\n\n // State\n if (stateSelector.property(\"value\") != \"Select Parameter\") {\n filterOuput = (filterOuput && (row.state === stateSelector.property(\"value\")));\n };\n\n // Country\n if (countrySelector.property(\"value\") != \"Select Parameter\") {\n filterOuput = (filterOuput && (row.country === countrySelector.property(\"value\")));\n };\n\n // Shape\n if (shapeSelector.property(\"value\") != \"Select Parameter\") {\n filterOuput = (filterOuput && (row.shape === shapeSelector.property(\"value\")));\n };\n\n return filterOuput;\n}", "function handleSelect(event) {\n let currState = event.target.value;\n let rows = container.querySelectorAll('.table__row_visible');\n for (let row of rows) {\n row.style.display = \"table-row\";\n if (row.querySelector(\".state\").textContent !== currState) {\n row.style.display = \"none\";\n };\n }\n }", "function f_row_select_(grid_p, fila_p) {\n\t$('#' + grid_p).find('tr.selected').removeClass('selected');\n\t$('#' + grid_p + ' tbody tr:eq(' + fila_p + ')').addClass('selected');\n\t$('#' + grid_p + ' tbody tr:eq(' + fila_p + ') td:not(td:first-child)')[0].click();\n\n\tt1 = $('#' + grid_p).DataTable();\n\tvar rowSelected = t1.row().$('tr.selected');\n\t$('#' + grid_p).DataTable().row( $(rowSelected).closest('tr') ).select();\n}", "function isFieldDepsAndPageEntitlementsAfter_selectRow(gridId) {\r\n return true;\r\n}", "function filterInclusiveStart(rows, targetValue, index) {\n var indexFields = index.def.fields;\n for (var i = 0, len = rows.length; i < len; i++) {\n var row = rows[i];\n\n // shave off any docs at the beginning that are <= the\n // target value\n\n var docKey = getKeyFromDoc(row.doc, index);\n if (indexFields.length === 1) {\n docKey = docKey[0]; // only one field, not multi-field\n } else { // more than one field in index\n // in the case where e.g. the user is searching {$gt: {a: 1}}\n // but the index is [a, b], then we need to shorten the doc key\n while (docKey.length > targetValue.length) {\n docKey.pop();\n }\n }\n //ABS as we just looking for values that don't match\n if (Math.abs(Object(__WEBPACK_IMPORTED_MODULE_4_pouchdb_collate__[\"a\" /* collate */])(docKey, targetValue)) > 0) {\n // no need to filter any further; we're past the key\n break;\n }\n }\n return i > 0 ? rows.slice(i) : rows;\n}", "handlePageClick(data) {\n const selected = data.selected;\n const offset = Math.ceil(selected * this.state.perPage);\n\n this.setState({\n offset,\n currentPage: selected + 1,\n merchants: this.state.totalRows.slice(offset, offset + this.state.perPage),\n filteredRowsPaged: this.state.filteredRows.slice(offset, offset + this.state.perPage),\n }, () => {\n if (this.state.filteredRowsPaged.length > 0) {\n this.globalSelectorGroup(this.state.filteredRowsPaged);\n } else {\n this.globalSelectorGroup(this.state.merchants);\n }\n });\n }", "function firstGrid_selectRow(id) {\r\n var qpTransId = id;\r\n if(isEmpty(id)) {\r\n qpTransId = 0;\r\n }\r\n loadAllRiskCoverage(qpTransId);\r\n}", "_getNextItem(activeItemIndex) {\n const that = this,\n items = that._items,\n itemsCount = that._items.length;\n let index = Math.max(activeItemIndex + 1, 0);\n\n while (index < itemsCount) {\n const item = items[index];\n\n if (!item.disabled && !item.hidden && !item.grouped && !item.readonly) {\n return item;\n }\n\n index++;\n }\n\n return items[activeItemIndex];\n }", "selectStart() {\n\t\tvar first, items = this.getItemsArray();\n\t\tif (!_isEmpty(items) && (first = _arrFirst(items))) {\n\t\t\treturn first.setActiveState(true);\n\t\t}\n\t}", "function checkForAlreadySelectedContract()\n {\n $('#ContractTable tr').each(function(i, row)\n {\n if($(row).css(\"background-color\") === \"rgb(255, 0, 0)\")\n {\n\n $(row).css('background-color', 'rgb(0, 0, 0)');\n if(i%2 !== 0)\n {\n $(row).children().css({'background-color': '#dadada', 'color': '#332c28'}).find(\"a\").css({'color': 'blue'});\n }\n else\n {\n $(row).children().css({'background-color': '#cecece', 'color': '#332c28'}).find(\"a\").css({'color': 'blue'});\n }\n }\n });\n }", "_beforeSelect (data, preserve) {\n if (this.callEvent(\"onStartWith\", [data.row, \"0$\"]) ||\n data.column == 'action' ||\n data.column == 'edit' ||\n data.column == 'checkbox') {\n return false;\n }\n }", "focusFirstItem() {\n const fistNonDisabledItem = getFirstNonDisabledItem(this.props.items);\n this.focusItem(fistNonDisabledItem);\n }", "_selectRecord (receivedRecord, currentRecord, callback) {\n this._validator.select(receivedRecord, currentRecord, (err, res) => {\n if (err) {\n log.error(err)\n return callback(err)\n }\n\n // If the selected was the first (0), it should be stored (true)\n callback(null, res === 0)\n })\n }", "filterPredictions() {\n const rows = document.querySelectorAll('table.prediction tbody tr');\n let rowCounter = 0;\n rows.forEach((row) => {\n const displayRow = Object.keys(this.activeFilters_).every((parameter) => {\n const rowValue = row.getAttribute(parameter);\n return rowValue && this.activeFilters_[parameter][rowValue];\n });\n row.style.display = displayRow ? 'table-row' : 'none';\n rowCounter += displayRow;\n });\n this.setPredictionsListEmpty_(!rowCounter);\n }", "selectNext(loop = false) {\n\t\tvar following, items = this.getItemsArray();\n\t\tif (_isEmpty(items)) {\n\t\t\tif (_isFunction(loop)) {\n\t\t\t\tloop();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (this.current.active) {\n\t\t\tfollowing = _following(items, this.current.active, false/*length*/, loop);\n\t\t} else if (loop && (!_isFunction(loop) || loop(0))) {\n\t\t\tfollowing = _arrFirst(items);\n\t\t}\n\t\tif (following) {\n\t\t\treturn following.setActiveState(true);\n\t\t}\n\t}", "function nextHighlight(tr) {\n while (true) {\n //console.log(tr);\n tr = tr.next();\n if (!tr || tr.length === 0) {\n //endContinuousPlay();\n return null;\n }\n var te = trjs.events.lineGetCell(tr, trjs.data.TSCOL);\n if (te) // some time was found\n return tr;\n /*\n if (!te) // te === null or te === 0 or te === ''\n return null;\n else\n return tr;\n */\n }\n }", "function fnHighlightNextCell(element, errorClass, validClass) {\n\t//1. Highlight input or select element it self\n\tvar x=$(element);\n\tif ( $(element).is(\":radio\")) x=$(element).parent();\n\tx.addClass(errorClass).removeClass(validClass);\n\t//2. Highlight table cell\n\t$(element).closest(\"td\").next().addClass(errorClass).removeClass(validClass);\n}", "gotoPrevHit() {\n const me = this;\n if (!me.found || !me.found.length) return;\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell ? grid.store.indexOf(fromCell.id) : 0,\n found = me.found;\n\n for (let i = found.length - 1; i--; i >= 0) {\n const hit = found[i];\n\n if (hit.index < currentIndex) {\n me.gotoHit(i);\n break;\n }\n }\n }", "focusNextOption() {\n this.focused_option = this.getNextValue(this.focused_option);\n this.behave('focusCurrentOption');\n }", "function startNewRow (index, count) {\n console.log(index, count);\n return ((index) % count) === 0;\n }", "gotoNextHit(fromStart = false) {\n const me = this;\n if (!me.found || !me.found.length) return;\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell && !fromStart ? grid.store.indexOf(fromCell.id) : -1,\n nextHit = me.found.findIndex(hit => hit.index > currentIndex);\n\n if (nextHit !== -1) {\n me.gotoHit(nextHit);\n }\n }", "function filterInclusiveStart(rows, targetValue, index) {\n\t var indexFields = index.def.fields;\n\t for (var i = 0, len = rows.length; i < len; i++) {\n\t var row = rows[i];\n\n\t // shave off any docs at the beginning that are <= the\n\t // target value\n\n\t var docKey = getKeyFromDoc(row.doc, index);\n\t if (indexFields.length === 1) {\n\t docKey = docKey[0]; // only one field, not multi-field\n\t } else { // more than one field in index\n\t // in the case where e.g. the user is searching {$gt: {a: 1}}\n\t // but the index is [a, b], then we need to shorten the doc key\n\t while (docKey.length > targetValue.length) {\n\t docKey.pop();\n\t }\n\t }\n\t //ABS as we just looking for values that don't match\n\t if (Math.abs(collate$1(docKey, targetValue)) > 0) {\n\t // no need to filter any further; we're past the key\n\t break;\n\t }\n\t }\n\t return i > 0 ? rows.slice(i) : rows;\n\t}", "function showNextRow(current){\n if (document.getElementById('sh_' + current).value != '' ||\n document.getElementById('eh_' + current).value != '' || \n document.getElementById('sm_' + current).value != '' || \n document.getElementById('em_' + current).value != '' || \n document.getElementById('place_' + current).value != -1 || \n document.getElementById('title_es_' + current).value != '' || \n document.getElementById('title_en_' + current).value != '' || \n document.getElementById('title_eu_' + current).value != '' || \n document.getElementById('text_es_' + current).value != '' || \n document.getElementById('text_en_' + current).value != '' || \n document.getElementById('text_eu_' + current).value != ''\n ){\n document.getElementById('itinerary_row_' + (current + 1)).style.display = 'table-row';\n }\n else{\n document.getElementById('itinerary_row_' + (current + 1)).style.display = 'none';\n }\n}", "_onRowSelect(e) {\n let row = e.currentTarget;\n let range = this._range;\n let ord = Number.parseInt(row.getAttribute('data-ordinal'));\n if (!this._majorAvailable && (ord < 1 || ord > 14)) {\n return;\n }\n if (range.high === -1) {\n this._selectRangeRows(ord, ord)\n } else if (range.low == range.high) {\n this._selectRangeRows(range.low, ord);\n } else {\n this._clearRangeTable();\n this._selectRangeRows(ord, ord);\n }\n }", "function reselectGridRowsBackedBySelectedDataRows() {\n if (this.selectedData.length) { // any data row objects added from previous grid row selections?\n var selectionModel = this.grid.selectionModel,\n offset = this.grid.getHeaderRowCount(),\n filteredData = this.getFilteredData();\n\n selectionModel.clearRowSelection();\n\n this.selectedData.forEach(function(dataRow) {\n var index = filteredData.indexOf(dataRow);\n if (index >= 0) {\n selectionModel.selectRow(offset + index);\n }\n });\n }\n}", "function dap_previousRow()\n{\n\tthis.saveData(this.getCurrentRow());\n\tif (this.DynamicTable.previousRow() == true)\n\t{\n\t\tvar boolflag = this.DataSource[this.getRecordIndex(\n\t\t\t\tthis.getCurrentRow())][this.DataSource[0].length-1];\n\t\tthis.DynamicTable.disableRow(this.getCurrentRow(),\n\t\t\t\t(boolflag == constLoadStatus)||(boolflag == constUpdateStatus));\n\t}\n}", "selectNextOption() {\n if (!this.disabled && this.selectedIndex < this.options.length - 1) {\n this.selectedIndex += 1;\n }\n }", "highlightNext() {\n const $highlightOld = this.$autocompleteSuggests.find('tr.highlight');\n let $highlightNew = this.$autocompleteSuggests.find('tr').first();\n\n if ($highlightOld.length) {\n $highlightOld.removeClass('highlight');\n const $highlightOldNext = $highlightOld.next();\n\n if ($highlightOldNext.length) {\n $highlightNew = $highlightOldNext;\n }\n }\n\n $highlightNew.addClass('highlight');\n this.highlighted = $highlightNew.data('command');\n this._updateState(AUTOCOMPLETE_STATE.COMMANDS.HIGHLIGHT);\n }", "function validEditedCell(range) {\n column = range.getColumn();\n if (column === LOG_RECEIVED_I + 1 && range.isChecked()){\n return true;\n }\n else return false;\n}", "function selectFirstInvalidField() { // 950\n var ctx = ss.namedContext(formId); // 951\n if (!ctx.isValid()) { // 952\n _.every(template.findAll('[data-schema-key]'), function selectFirstInvalidFieldEvery(input) { // 953\n if (ctx.keyIsInvalid(input.getAttribute('data-schema-key'))) { // 954\n input.focus(); // 955\n return false; // 956\n } else { // 957\n return true; // 958\n } // 959\n }); // 960\n } // 961\n } // 962", "_updateActiveRows() {\n if (!this.changeMultiple) {\n this.activeRows = this.$element.find('tbody tr.active');\n this.$element.trigger('changed.zf.table.checkbox', [this.activeRows]);\n }\n }", "function nextRow( bSuccess )\n{\n // Clear highlighting\n $( '#bgt_table > tbody .' + g_sPendingClass ).removeClass( g_sPendingClass );\n $( '#bgt_table > tbody .' + g_sSuccessClass ).removeClass( g_sSuccessClass );\n\n // If current row contains new, live data, highlight it\n if ( bSuccess && ! g_tCachedValues )\n {\n $( '#row_' + g_iRow ).addClass( g_sSuccessClass );\n }\n\n // Advance row index\n if ( g_iRow < ( g_aRows.length - 1 ) )\n {\n // Advance to next row\n g_iRow ++;\n if ( ! g_tCachedValues )\n {\n enableRefreshButton( true );\n }\n }\n else\n {\n // Finished last row\n g_iRow = 0;\n g_tCachedValues = null;\n stopRefresh();\n enableRefreshButton( true );\n $( '.sortable' ).removeClass( 'sorter-false' );\n console.log( '=> View initialized in ' + ( Date.now() - g_iStartTime ) + ' ms' );\n }\n\n // Reinitialize variables\n g_iInstanceOffset = 2;\n g_aRowData = [];\n\n // Update tablesorter event handlers\n g_tTable.off( 'sortEnd' );\n g_tTable.off( 'filterEnd' );\n g_tTable.on( 'sortEnd', onSortEnd );\n g_tTable.on( 'filterEnd', onFilterEnd );\n g_tTable.on( 'tablesorter-ready', onTablesorterReady );\n\n // Trigger event to update tablesorter cache\n g_tTable.trigger( 'update' );\n}", "gotoPrevHit() {\n const me = this;\n\n if (!me.found || !me.found.length) return;\n\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell ? grid.store.indexOf(fromCell.id) : 0,\n found = me.found;\n\n for (let i = found.length - 1; i--; i >= 0) {\n let hit = found[i];\n if (hit.index < currentIndex) {\n me.gotoHit(i);\n break;\n }\n }\n }", "function selecionaLinha(div,actpos,cell){\n\tsetTimeout(\n\t\tfunction(){\n\t\t\t$(div + \" tr[posicao=\"+actpos+\"] input:eq(\"+cell+\") \").focus().select();\n\t\t},10\n\t);\n}", "function setSelection(){\r\n\t\t\tif (opts.idField){\r\n\t\t\t\tfor(var i=0; i<data.rows.length; i++){\r\n\t\t\t\t\tvar row = data.rows[i];\r\n\t\t\t\t\tif (contains(state.selectedRows, row)){\r\n\t\t\t\t\t\topts.finder.getTr(target, i).addClass('datagrid-row-selected');\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (contains(state.checkedRows, row)){\r\n\t\t\t\t\t\topts.finder.getTr(target, i).find('div.datagrid-cell-check input[type=checkbox]')._propAttr('checked', true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfunction contains(a,r){\r\n\t\t\t\tfor(var i=0; i<a.length; i++){\r\n\t\t\t\t\tif (a[i][opts.idField] == r[opts.idField]){\r\n\t\t\t\t\t\ta[i] = r;\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}", "function scroll_one_visible_row_of_standings() {\n do {\n var last_row = $(\".main_table tr[data-roundid]:last\").detach();\n last_row.insertAfter(\".main_table tr.headers\");\n if (last_row.not(\".hidden\")) {\n reveal_one_row(last_row);\n }\n } while ($(\".main_table tbody:first tr[data-roundid]:last\").is(\".hidden\"));\n}", "gotoNextHit(fromStart = false) {\n const me = this;\n\n if (!me.found || !me.found.length) return;\n\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell && !fromStart ? grid.store.indexOf(fromCell.id) : -1,\n nextHit = me.found.findIndex((hit) => hit.index > currentIndex);\n\n if (nextHit !== -1) {\n me.gotoHit(nextHit);\n }\n }", "function filterInclusiveStart(rows, targetValue, index) {\n var indexFields = index.def.fields;\n for (var i = 0, len = rows.length; i < len; i++) {\n var row = rows[i];\n\n // shave off any docs at the beginning that are <= the\n // target value\n\n var docKey = getKeyFromDoc(row.doc, index);\n if (indexFields.length === 1) {\n docKey = docKey[0]; // only one field, not multi-field\n } else { // more than one field in index\n // in the case where e.g. the user is searching {$gt: {a: 1}}\n // but the index is [a, b], then we need to shorten the doc key\n while (docKey.length > targetValue.length) {\n docKey.pop();\n }\n }\n //ABS as we just looking for values that don't match\n if (Math.abs(collate(docKey, targetValue)) > 0) {\n // no need to filter any further; we're past the key\n break;\n }\n }\n return i > 0 ? rows.slice(i) : rows;\n}", "function filterInclusiveStart(rows, targetValue, index) {\n var indexFields = index.def.fields;\n for (var i = 0, len = rows.length; i < len; i++) {\n var row = rows[i];\n\n // shave off any docs at the beginning that are <= the\n // target value\n\n var docKey = getKeyFromDoc(row.doc, index);\n if (indexFields.length === 1) {\n docKey = docKey[0]; // only one field, not multi-field\n } else { // more than one field in index\n // in the case where e.g. the user is searching {$gt: {a: 1}}\n // but the index is [a, b], then we need to shorten the doc key\n while (docKey.length > targetValue.length) {\n docKey.pop();\n }\n }\n //ABS as we just looking for values that don't match\n if (Math.abs(collate(docKey, targetValue)) > 0) {\n // no need to filter any further; we're past the key\n break;\n }\n }\n return i > 0 ? rows.slice(i) : rows;\n}" ]
[ "0.65768665", "0.64542824", "0.6219309", "0.6000595", "0.5976577", "0.58699024", "0.5802067", "0.5762353", "0.5749798", "0.56805384", "0.56790257", "0.5644844", "0.56419927", "0.5637537", "0.5635656", "0.56081593", "0.55816525", "0.55596024", "0.5552443", "0.55523646", "0.55387634", "0.55164355", "0.55030197", "0.54993534", "0.5498342", "0.54921716", "0.5488253", "0.54781497", "0.54720724", "0.54484576", "0.5445703", "0.54455274", "0.54454744", "0.54321927", "0.5428496", "0.54270667", "0.54163027", "0.5410295", "0.54086435", "0.5406828", "0.5380079", "0.5376845", "0.53725684", "0.53528726", "0.53411466", "0.5337424", "0.5326766", "0.5323959", "0.53222185", "0.5320489", "0.5315319", "0.5315253", "0.53122497", "0.53071797", "0.53032756", "0.5297797", "0.5286147", "0.5285494", "0.52824616", "0.52806145", "0.52726424", "0.5271239", "0.5267659", "0.52453166", "0.52426314", "0.52384174", "0.523802", "0.52326983", "0.5231516", "0.52270275", "0.52219415", "0.52189136", "0.5216144", "0.5214746", "0.52145314", "0.5206839", "0.5205333", "0.52021456", "0.5195684", "0.51946485", "0.51935685", "0.51856387", "0.5184828", "0.51831955", "0.51795346", "0.5168643", "0.51681125", "0.5167587", "0.5167575", "0.51641774", "0.5162767", "0.5159183", "0.5156404", "0.51473874", "0.5145033", "0.5141701", "0.5132434", "0.51317996", "0.5127966", "0.5127966" ]
0.6701543
0
Page navigation has to be enforced whenever selected row is out of the current page range
function onBeforeSelection(et, selecteElm, e){ var row = et.defaultSelection != 'row' ? selecteElm.parentNode : selecteElm; if(o.paging){ if(o.nbPages>1){ et.nbRowsPerPage = o.pagingLength; //page length is re-assigned in case it has changed var pagingEndRow = parseInt(o.startPagingRow) + parseInt(o.pagingLength); var rowIndex = row.rowIndex; if((rowIndex == o.validRowsIndex[o.validRowsIndex.length-1]) && o.currentPageNb!=o.nbPages) o.SetPage('last'); else if((rowIndex == o.validRowsIndex[0]) && o.currentPageNb!=1) o.SetPage('first'); else if(rowIndex > o.validRowsIndex[pagingEndRow-1] && rowIndex < o.validRowsIndex[o.validRowsIndex.length-1]) o.SetPage('next'); else if(rowIndex < o.validRowsIndex[o.startPagingRow] && rowIndex > o.validRowsIndex[0]) o.SetPage('previous'); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRowAcrossPages(row) {\n // Get the index for the selected row\n var index = row.childIndex;\n console.log(\"Row is at index: \"+index);\n\n // Find the \"relative\" row location for each page and remove rows\n // from page 1 onward\n index = index % pageSize;\n}", "handlePageClick(data) {\n const selected = data.selected;\n const offset = Math.ceil(selected * this.state.perPage);\n\n this.setState({\n offset,\n currentPage: selected + 1,\n merchants: this.state.totalRows.slice(offset, offset + this.state.perPage),\n filteredRowsPaged: this.state.filteredRows.slice(offset, offset + this.state.perPage),\n }, () => {\n if (this.state.filteredRowsPaged.length > 0) {\n this.globalSelectorGroup(this.state.filteredRowsPaged);\n } else {\n this.globalSelectorGroup(this.state.merchants);\n }\n });\n }", "function navigationHandler(ev){ \n if(!($(ev.target).hasClass(\"disable\")) && grid.getSelectionModel() && grid.getSelectedRows() && grid.getSelectedRows().length > 0){\n jConfirm(xenos.i18n.message.selection_discard, null, function(confirm) {\n if(!confirm) {\n return false;\n }\n else{\n \tgrid.setSelectedRows([]);\n ev.data.navigateFunc();\n \n }\n });\n }\n else{\n ev.data.navigateFunc();\n } \n }", "function pagechange(pagenum) {\n $('.pagination li').removeClass(\"active\");\n $('.pagination li').eq(pagenum-1).addClass(\"active\");\n show_rows((pagenum-1) * MAX_CRASH_PER_PAGE);\n}", "selectPageDown() {\n this.$moveByPage(1, true);\n }", "_onPaginationLabelTap() {\n this.self.setCurrentIndex(this.targetIndex);\n }", "function handlePagination(event) {\n event.stopPropagation();\n let target = $(\"li\").has(event.target);\n if (target.length) {\n switch (target.attr(\"id\")) {\n case \"left-arrow\": changePage(currentPage - 1); break;\n case \"right-arrow\": changePage(currentPage + 1); break;\n default: changePage(parseInt(target.attr(\"data-value\"))); break;\n }\n }\n}", "function handlePagination() {\n\n var numResults = rowsParent.childElementCount;\n\n //disable and enable buttons based on row count\n if (numResults <= 5){\n //do nothing\n }else if(numResults <= 10){\n createPaginationListElement(2);\n } else if(numResults <= 15){\n createPaginationListElement(2);\n createPaginationListElement(3);\n } else { //over 20\n createPaginationListElement(2);\n createPaginationListElement(3);\n createPaginationListElement(4);\n }\n\n //store all rows in an array\n tableContent = rowsParent.innerHTML;\n\n showSelectedChildren(0, 4)\n\n\n}", "selectPageUp() {\n this.$moveByPage(-1, true);\n }", "function theQwertyGrid_prevPage () {\n\t\t\t_theQwertyGrid_rowEnd = _theQwertyGrid_rowStart;\n\t\t\t_theQwertyGrid_rowStart = _theQwertyGrid_rowEnd - _theQwertyGrid_pageSize < 0 ?\n\t\t\t\t\t\t\t\t\t 0 : _theQwertyGrid_rowEnd - _theQwertyGrid_pageSize;\n\t\t\ttheQwertyGrid_setPageSize(_theQwertyGrid_pageSize);\n\t\t}", "function SetPageHandler(event)\n{\n var action = event.data.action;\n var offset = gSTATE.LAST;\n \n gSTATE.PAGE = (action == \"n\") ? gSTATE.PAGE + 1 : gSTATE.PAGE - 1;\n \n // Check for min.\n if (gSTATE.PAGE == 0) {\n gSTATE.PAGE = offset;\n } \n \n // Check for max.\n else if (gSTATE.PAGE == offset+1) {\n gSTATE.PAGE = 1;\n } \n \n ShowMediaTable(gSTATE.PAGE, gSTATE.SORT);\n}", "handlePrevPage() {\n if (this.props.start - 20 <= 0) {\n return;\n }\n this.props.getPrevPage(this.props.page - 1);\n }", "if (currentPage <= 6) {\n startPage = 1;\n endPage = totalPages;\n }", "function changeBookingListPage(event)\n{\n event.preventDefault();\n\n var value = $(this).data('page');\n if (value != '' & value != page) {\n page = value;\n\n getBookingListLimited();\n }\n}", "setSelectedIndex(value = 0) {\n if (this.$selectedIndex != value) {\n if (value > this.$pageIds.length - 1)\n throw new Error(`index out of range: ${value}`);\n this.$updating = true;\n this.$previousIndex = this.$selectedIndex;\n this.$selectedIndex = value;\n this.$parent.applyController(this);\n this.$updating = false;\n }\n }", "function previousPage() {\n var pageSelector = document.getElementById(\"page-select\");\n if (pageSelector.value > MIN_PAGE) {\n pageSelector.value--;\n goToPage();\n }\n}", "set allowBreakAcrossPages(value) {\n if (value === this.allowRowBreakAcrossPagesIn) {\n return;\n }\n this.allowRowBreakAcrossPagesIn = value;\n this.notifyPropertyChanged('allowBreakAcrossPages');\n }", "function handlePagination(e) {\n if (isModifiedEvent(e) || !isLeftClickEvent(e)) {\n return\n }\n e.stopPropagation();\n e.preventDefault();\n var url = $(this).attr(\"href \");\n if (url) handleNavigation(url, true)\n}", "previousHandler() {\n if (this.page > 1) {\n this.page = this.page - 1; //decrease page by 1\n this.displayRecordPerPage(this.page);\n }\n }", "function isNewPage(rowHeight) {\n var afterRowPos = cursor.y + rowHeight + settings.margin.bottom;\n return afterRowPos >= pageSize.height;\n }", "function previousPage(){\n if(currentPage > 1){\n currentPage--;\n loadTable(currentPage);\n }\n}", "select_page(n) {\n if (n === this.curpage || this.pagecount=== 0) return; // nothing to do\n if (n < 0 || n >= this.pagecount) {\n dkconsole.debug(\"PagerWidget.select_page: out of bounds \", n, this);\n return;\n }\n this.curpage = n;\n this.draw();\n this.trigger('select-page', n);\n }", "function setPageStatus( start, end, totalRows) {\r\n if (end > totalRows) { \r\n $(\"#RowEnd\").html(totalRows);\r\n } else {\r\n $(\"#RowEnd\").html(end + 1);\r\n }\r\n $(\"#TotalRows\").html(totalRows);\r\n \r\n var numPages = Math.ceil(totalRows / gblRowsPerPage);\r\n if ( numPages === 0) {\r\n numPages = 1;\r\n $(\"#RowStart\").html(0);\r\n } else {\r\n $(\"#RowStart\").html(start +1);\r\n } \r\n $('#numberPageSelection').bootpag({\r\n total: numPages\r\n }); \r\n}", "setRowPage(){\n var table = document.getElementById(`${this.state.config.tableId}_Body`);\n var tr = table.getElementsByTagName(\"tr\");\n for (var i = 0; i < tr.length; i++) {\n let page = parseInt(tr[i].getAttribute(\"page\"));\n if (page === this.state.currentPage){\n tr[i].classList.add(\"showIt\");\n tr[i].classList.remove(\"hideIt\");\n }else {\n tr[i].classList.add(\"hideIt\");\n tr[i].classList.remove(\"showIt\");\n }\n }\n }", "function onPageshow(e){\n\t\t\t\t\t\t\t\t\n\t\t\t\t//check selection\n\t\t\t\tcheckSelection(App.data.selection);\n\t\t\t\t\n\t\t\t}", "_onRowSelect(e) {\n let row = e.currentTarget;\n let range = this._range;\n let ord = Number.parseInt(row.getAttribute('data-ordinal'));\n if (!this._majorAvailable && (ord < 1 || ord > 14)) {\n return;\n }\n if (range.high === -1) {\n this._selectRangeRows(ord, ord)\n } else if (range.low == range.high) {\n this._selectRangeRows(range.low, ord);\n } else {\n this._clearRangeTable();\n this._selectRangeRows(ord, ord);\n }\n }", "prev() {\n const that = this;\n\n that.navigateTo(that.pageIndex - 1);\n }", "function previousPage(){\n if (page > 1)\n {\n setPage(page - 1);\n }\n else {\n // do nothing\n }\n }", "function goPrevPage(){\r\n // ensure page number is not less than 1\r\n if(page > 1){\r\n page -= 1;\r\n }\r\n}", "paginationChanged(pagination) {\n const isSyncGridSelectionEnabled = this.gridStateService && this.gridStateService.needToPreserveRowSelection() || false;\n if (!isSyncGridSelectionEnabled && (this.gridOptions.enableRowSelection || this.gridOptions.enableCheckboxSelector)) {\n this.gridService.setSelectedRows([]);\n }\n const { pageNumber, pageSize } = pagination;\n if (this.sharedService) {\n if (pageSize) {\n this.sharedService.currentPagination = { pageNumber, pageSize };\n }\n }\n this.gridStateService.onGridStateChanged.next({\n change: { newValues: { pageNumber, pageSize }, type: GridStateType.pagination },\n gridState: this.gridStateService.getCurrentGridState()\n });\n }", "function navigateToPage(selectedPage, numDisplay) {\n if (selectedPage < 1 || selectedPage > pageUtils.getLatest()) {\n // When user input page that is out of range, show error message\n alert(`Please select a number between 1 and ${pageUtils.getLatest()}`);\n } else {\n // Update the UI\n pageUtils.setPage(selectedPage);\n mainFunctions.setDisplay(numDisplay);\n }\n}", "function onPrevPage() {\n if (GridCurrentPageNumber > 0) {\n GridCurrentPageNumber--;\n }\n\tIsFromBackButton = true;\n loadRecordsDelayed();\n}", "function handleChangeRowsPerPage(event) {\n setRowsPerPage(parseInt(event.target.value, 10));\n setPage(0);\n }", "function isFieldDepsAndPageEntitlementsAfter_selectRow(gridId) {\r\n return true;\r\n}", "function newAssignmentPage(change) {\r\n //Variables\r\n ///The number of assignments on a page, determined by a select box\r\n var pageSize = $(\"#frm-assignment-page-num\").val();\r\n\r\n ///How many assignments to change by\r\n var changeBy = pageSize * change;\r\n\r\n ///How many assignments are now in previous pages\r\n var offset = userSession.assignmentPageOffset + changeBy;\r\n\r\n\r\n //Change page\r\n ///If the new offset is a valid number\r\n if(offset >= 0 || offset <= userSession.assignmentNum){\r\n ///Change the assignment page\r\n getAssignmentPage(offset); \r\n }\r\n}", "onPrevClick(){\n if(this.state.currentPage - 1 >= 1){\n this.changePage(this.state.currentPage - 1);\n }\n }", "function onClickNaviPrev(el) {\n if(curPageNumber <= 0) {\n return false;\n }\n curPageNumber = curPageNumber -1;\n refreshTable();\n debug('Prev button clicked. page number : ' + curPageNumber);\n }", "pageClickHandler(pageNumber) {\n if (pageNumber !== this.state.currentPage)\n this.update('currentPage', pageNumber);\n }", "function highlightSelection(page)\n{\n\tif(noofpagelinks==1)\n\t{\n\t$('#pagination-ifas > li.last').removeClass('last').addClass('last-off');\t\n\t$('#pagination-ifas > li.first').removeClass('first').addClass('first-off');\n\t$('#pagination-ifas > li.next').removeClass('next').addClass('next-off');\n\t$('#pagination-ifas > li.previous').removeClass('previous').addClass('previous-off');\t\n\t}\n\telse if(selectedItem==0 && noofpagelinks>1)\n\t{\n\t$('#pagination-ifas > li.last-off').removeClass('last-off').addClass('last');\n\t$('#pagination-ifas > li.first').removeClass('first').addClass('first-off');\n\t$('#pagination-ifas > li.next-off').removeClass('next-off').addClass('next');\n\t$('#pagination-ifas > li.previous').removeClass('previous').addClass('previous-off');\n\t}\n\telse if(selectedItem==(noofpagelinks-1))\n\t{\n\t$('#pagination-ifas > li.first-off').removeClass('first-off').addClass('first');\n\t$('#pagination-ifas > li.last').removeClass('last').addClass('last-off');\t\n\t$('#pagination-ifas > li.previous-off').removeClass('previous-off').addClass('previous');\n\t$('#pagination-ifas > li.next').removeClass('next').addClass('next-off');\n\t}\n\telse\n\t{\n\t$('#pagination-ifas > li.last-off').removeClass('last-off').addClass('last');\n\t$('#pagination-ifas > li.first-off').removeClass('first-off').addClass('first');\n\t$('#pagination-ifas > li.next-off').removeClass('next-off').addClass('next');\n\t$('#pagination-ifas > li.previous-off').removeClass('previous-off').addClass('previous');\n\t}\n\t$paginationdiv.find('li a').removeClass('active').eq(page).addClass('active');\n}", "function handlePageClick({ selected: selectedPage }) {\n setCurrentPage(selectedPage);\n window.scrollTo(0, 0);\n }", "function chooseSlide( event ) {\n var selected = $(this);\n var index = selected.index();\n var offset = index - selected.siblings(\".active\").index();\n\n for(var i = Math.abs(offset); i--; ) {\n var row = LG[ state.get() === \"info\" ? \"Info\" : \"List\" ].getCurrent();\n row[ offset < 0 ? \"previous\" : \"next\" ]( i !== 0 );\n }\n }", "function selectPage(target, step) {\n var state = $.data(target, 'combogrid');\n if (!state.grid) $(target).combo(\"panel\");\n var grid = state.grid;\n var gridopts = grid.datagrid(\"options\");\n if (!gridopts.pagination) return;\n var pagenum = gridopts.pageNumber;\n var pager;\n if (step < 0 && pagenum > 1) {\n pager = grid.datagrid(\"getPager\");\n pager.pagination(\"select\", pagenum - 1);\n } else if (step > 0) {\n pager = grid.datagrid(\"getPager\");\n var page = pager.pagination(\"getPageCount\");\n if (pagenum < page) pager.pagination(\"select\", pagenum + 1);\n }\n }", "up() {\r\n this.upAndDown = false;\r\n this.firstRowHighlight = false;\r\n if (this.selectedIndex === null) {\r\n this.selectedIndex = this.results.length - 1;\r\n return;\r\n }\r\n if (this.includeInputInList === false) {\r\n this.selectedIndex =\r\n this.selectedIndex === 0\r\n ? this.results.length - 1\r\n : this.selectedIndex - 1;\r\n } else {\r\n if (this.selectedIndex === 1) {\r\n this.selectedIndex = 0;\r\n } else if (this.selectedIndex === 0) {\r\n this.selectedIndex = null;\r\n } else {\r\n this.selectedIndex = this.selectedIndex - 1;\r\n }\r\n }\r\n }", "function shownoofRecord()\r\n\t{\r\n\t\t$scope.pageSize=$scope.shownoofrec;\r\n\t\tself.Filterreceipts=self.receipts.slice($scope.currentPage*$scope.pageSize);\r\n\t\tif(self.Filterreceipts.length<=$scope.pageSize)\r\n\t\t{\r\n\t\t\t$scope.previousDisabled=true;\r\n\t\t\t$scope.nextDisabled=true;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$scope.nextDisabled=false;\r\n\t\t}\r\n\t}", "function DoSelection(nextRowIndex){\r\n\t\t\t\t\tif(et.defaultSelection == 'row'){\r\n\t\t\t\t\t\tet.Selection.SelectRowByIndex(nextRowIndex);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tet.ClearSelections();\r\n\t\t\t\t\t\tvar cellIndex = selecteElm.cellIndex;\r\n\t\t\t\t\t\tvar row = o.tbl.rows[nextRowIndex];\r\n\t\t\t\t\t\tif(et.defaultSelection == 'both') et.Selection.SelectRowByIndex(nextRowIndex);\r\n\t\t\t\t\t\tif(row) et.Selection.SelectCell(row.cells[cellIndex]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//Table is filtered\r\n\t\t\t\t\tif(o.validRowsIndex.length != o.GetRowsNb()){\r\n\t\t\t\t\t\tvar row = o.tbl.rows[nextRowIndex];\r\n\t\t\t\t\t\tif(row) row.scrollIntoView(false);\r\n\t\t\t\t\t\tif(cell){\r\n\t\t\t\t\t\t\tif(cell.cellIndex==(o.GetCellsNb()-1) && o.gridLayout) o.tblCont.scrollLeft = 100000000;\r\n\t\t\t\t\t\t\telse if(cell.cellIndex==0 && o.gridLayout) o.tblCont.scrollLeft = 0;\r\n\t\t\t\t\t\t\telse cell.scrollIntoView(false);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "pageChanged() {\n if (!this.options.backendPagination) {\n return;\n }\n\n this.loadModels();\n }", "function previousPage () {\n var i, tab, elements = getElements();\n\n for (i = 0; i < elements.tabs.length; i++) {\n tab = elements.tabs[ i ];\n if (tab.offsetLeft + tab.offsetWidth >= ctrl.offsetLeft) break;\n }\n \n if (elements.canvas.clientWidth > tab.offsetWidth) {\n //Canvas width *greater* than tab width: usual positioning\n ctrl.offsetLeft = fixOffset(tab.offsetLeft + tab.offsetWidth - elements.canvas.clientWidth);\n } else {\n /**\n * Canvas width *smaller* than tab width: positioning at the *beginning* of current tab to let \n * pagination \"for loop\" to break correctly on previous tab when previousPage() is called again\n */\n ctrl.offsetLeft = fixOffset(tab.offsetLeft); \n }\n }", "function gotoPrevPage(){\n\tvar current_pagenum = getCurrentPagenum();\n\t\n\tif(checkPrevPages(current_pagenum) === true){\n\t\tvar isStartOfPagegroup = checkIsStartOfPagegroup(current_pagenum);\n\t\tvar prev_pagenum = current_pagenum - 1;\n\t\t\n\t\tif(isStartOfPagegroup === true){\n\t\t\tdecrementPagegroup();\n\t\t}\n\t\t\n\t\tgotoTargetPage(prev_pagenum);\n\t\t\n\t\t$('div#conceptcode_pagination_holder > ul.pagination').trigger(\"gotoPrevPageComplete.c2s_ui.pagination\", {oldPagenum: current_pagenum});\n\t}\n}", "function _check_arrow(max){\n $('.left_arrow, .right_arrow').removeClass('disabled');\n if(_page === 0 && _page != max){\n $('.left_arrow').addClass('disabled');\n }else if(_page === 0 && _page === max){\n $('.left_arrow, .right_arrow').addClass('disabled');\n }else if(_page === max){\n $('.right_arrow').addClass('disabled');\n }\n}", "function _check_arrow(max){\n $('.left_arrow, .right_arrow').removeClass('disabled');\n if(_page === 0 && _page != max){\n $('.left_arrow').addClass('disabled');\n }else if(_page === 0 && _page === max){\n $('.left_arrow, .right_arrow').addClass('disabled');\n }else if(_page === max){\n $('.right_arrow').addClass('disabled');\n }\n}", "prevPageClik() {\n this.currentPageNumber--;\n this.currentPageNumber < 0 ? this.currentPageNumber = (this.totalPageCount - 1) : '';\n this.props.changePage(this.currentPageNumber);\n }", "onChildrenPagesChanged() {\n if (this._childrenPagesChanged) {\n this._childrenPagesChanged.raise();\n }\n this.explorer.paginator.visible = this.explorer && this.childrenPages > 1;\n //log(\"Paginator visible: \" + (this.explorer && this.childrenPages > 1))\n }", "checkForEnd() {\n if (this.rightPage !== 50) {\n this.onLastPage = false;\n } else {\n this.onLastPage = true;\n }\n }", "onPageClick_() {\n this.pageClicks_++;\n this.lastSelection_ = this.win_.document.activeElement;\n }", "hasPreviousPage() {\n return this.pageIndex >= 1 && this.pageSize != 0;\n }", "function moveBack() {\n if (currentPage == 1) return;\n loadTaskList(--currentPage);\n}", "function pageselectCallback(page_index, jq)\n {\n // 从表单获取每页的显示的列表项数目\n var items_per_page = $(\"#items_per_page\").val();\n var max_elem = Math.min((page_index+1) * items_per_page, $(\"#hiddenresult .showing\").length);\n\n opts.focus_2.html(\"\");\n // 获取加载元素\n for(var i=page_index*items_per_page;i<max_elem;i++){\n opts.focus_2.append($(\"#hiddenresult .showing:eq(\"+i+\")\").clone());\n }\n //阻止单击事件\n return false;\n }", "function selectPage(new_current_page) {\r\n\t\t\t// update the link display of a all containers\r\n\t\t\tcontainers.data('current_page', new_current_page);\r\n\t\t\tlinks = renderer.getLinks(new_current_page, paginationClickHandler);\r\n\t\t\tcontainers.empty();\r\n\t\t\tlinks.appendTo(containers);\r\n\t\t\t// call the callback and propagate the event if it does not return false\r\n\t\t\tvar continuePropagation = opts.callback(new_current_page, containers);\r\n\t\t\treturn continuePropagation;\r\n\t\t}", "checkForBeginning() {\n if (this.leftPage !== 1) {\n this.onFirstPage = false;\n } else {\n this.onFirstPage = true;\n }\n }", "function changePage(n) {\n currentPage = Math.min(Math.max(1, n), totalPages);\n displayVenueList();\n}", "function changePage(e) {\r\n\te.preventDefault();\r\n\tif (e.target.classList.contains('previous')) {\r\n\t\tif (currentPage > 1) {\r\n\t\t\tcurrentPage = currentPage - 1\r\n\t\t\tshowPage(currentPage)\r\n\t\t}\r\n\r\n\t} else if (e.target.classList.contains('next')) {\r\n\t\tif ((currentPage * 3) < reviewLst.length) {\r\n\t\t\tcurrentPage = currentPage + 1\r\n\t\t}\r\n\t\tshowPage(currentPage)\t\t\r\n\t}\r\n}", "pageNavigate() {\n\n if (this.confirm_navigation_level == 2) {\n return;\n }\n\n if (this.confirm_navigation_level == 1) {\n this.openConfirmDialog(getTranslatedMessage(\"confirm_leave_page\"), [\"confirmPageNavigate\", \"abortPageNavigate\"]);\n } else {\n this.pageNavigateInner();\n }\n }", "function setAssignmentPage(pageNumber) {\r\n //Variables\r\n ///The number of assignments on a page, determined by a select box\r\n var pageSize = $(\"#frm-assignment-page-num\").val();\r\n\r\n ///The number of assignments now on previous pages\r\n var offset = pageSize * pageNumber;\r\n\r\n\r\n //Change Page\r\n ///If the new offset is a valid number\r\n if(offset >= 0 || offset <= userSession.assignmentUserNum){\r\n ///Change the assignment page\r\n getAssignmentPage(offset); \r\n }\r\n}", "onChange() {\n let numberOfPages = this.numberOfPages > 0 ? this.numberOfPages - 1 : 0\n if (this.currentPageNumber > numberOfPages) {\n this.currentPageNumber = numberOfPages;\n }\n this.updateData();\n }", "function next() {\n if ($scope.options.index < pageCount - 1) {\n $scope.options.index++;\n }\n }", "function _previousRange() {\n var focusedMultiRangeInlineEditor = _getFocusedMultiRangeInlineEditor();\n if (focusedMultiRangeInlineEditor) {\n focusedMultiRangeInlineEditor._selectPreviousRange();\n }\n }", "function previousPage () {\n var i, tab;\n for (i = 0; i < elements.tabs.length; i++) {\n tab = elements.tabs[ i ];\n if (tab.offsetLeft + tab.offsetWidth >= ctrl.offsetLeft) break;\n }\n ctrl.offsetLeft = fixOffset(tab.offsetLeft + tab.offsetWidth - elements.canvas.clientWidth);\n }", "function previousPage () {\n var i, tab;\n for (i = 0; i < elements.tabs.length; i++) {\n tab = elements.tabs[ i ];\n if (tab.offsetLeft + tab.offsetWidth >= ctrl.offsetLeft) break;\n }\n ctrl.offsetLeft = fixOffset(tab.offsetLeft + tab.offsetWidth - elements.canvas.clientWidth);\n }", "confirmPageNavigate() {\n this.confirm_navigation_level = 0;\n this.pageNavigate();\n }", "prevPage() {\n if (this.page > 1) {\n this.page--;\n this.search();\n }\n }", "function onPageshow(e){\n\t\t\t\t\t\t\t\t\n\t\t\t\t//check selected\n\t\t\t\tcheckSelected();\n\t\t\t\t\t\t\t\t\n\t\t\t}", "function pageing() {\r\n opts.actualPage = $(\"#ddPaging\").val();\r\n bindDatasource();\r\n }", "onRowBackToViewportRange(e, args) {\n if (args && args.item) {\n this._views.forEach((view) => {\n if (view[this.datasetIdPropName] === args.item[this.datasetIdPropName]) {\n this.redrawViewComponent(view);\n }\n });\n }\n }", "function disableMarkerPagesSelection() {\n\n\t\tvar $imCoordinatesTables = $('div.image_marker_main_wrapper table.InputfieldImageMarkers');\n\t\t\n\t\t$imCoordinatesTables.each(function () {\n\n\t\t\tvar $table = $(this);\n\t\t\tvar $parent = $table.parents('div.image_marker_main_wrapper');\n\t\t\tvar $allSelected = $table.find(\"input.marker_info\").map(function () {\n\t\t\t\treturn $(this).val();\n\t\t\t}).get();\n\n\t\t\t$parent.find(\".marker_add_infopages option:not(:selected):not([value='0'])\").each(function () {\n\t\t\t\tif ($.inArray($(this).val(), $allSelected) != -1) $(this).attr('selected', true);\n\t\t\t\t// @note: this will cause newly deleted items to be sent also as newly added since in $this, they will be marked as 'selected'\n\t\t\t\t// we deal with that server-side\n\t\t\t});\n\t\t\n\t\t});\n\n\n\t}", "loadProjectsPage(pageNumber, ev) {\n this.setState({\n activePage: pageNumber\n });\n ev.preventDefault();\n return false;\n }", "function setEvenItemPageNavigate(item, list) {\n item.addEventListener('click', function () {\n let ul = document.getElementById('itemPage');\n itempage = item.firstChild.innerHTML;\n tbody.innerHTML = '';\n setList(list, itempage);\n if (list.length % 10 == 0) {\n totaltemp = list.length / 10;\n } else {\n totaltemp = parseInt(list.length / 10) + 1;\n }\n if (totaltemp <= 5) {\n itemnavigate = 1;\n setPageNavigation(list);\n } else {\n if (itempage <= 3) {\n itemnavigate = 1;\n setPageNavigation(list);\n } else if (itempage >= totaltemp - 2) {\n itemnavigate = totaltemp - 4;\n setPageNavigation(list);\n } else {\n if (parseInt(ul.firstChild.firstChild.innerHTML) + 3 == itempage && parseInt(ul.lastChild.firstChild.innerHTML) - 1 == itempage) {\n itemnavigate = parseInt(ul.firstChild.firstChild.innerHTML) + 1;\n setPageNavigation(list);\n } else if (itempage == ul.lastChild.firstChild.innerHTML) {\n itemnavigate = parseInt(ul.firstChild.firstChild.innerHTML) + 2;\n setPageNavigation(list);\n } else if (itempage == ul.firstChild.firstChild.innerHTML) {\n itemnavigate = parseInt(ul.firstChild.firstChild.innerHTML) - 2;\n setPageNavigation(list);\n } else if (parseInt(ul.firstChild.firstChild.innerHTML) + 1 == itempage && parseInt(ul.lastChild.firstChild.innerHTML) - 3 == itempage) {\n itemnavigate = parseInt(ul.firstChild.firstChild.innerHTML) - 1;\n setPageNavigation(list);\n } else if (parseInt(ul.firstChild.firstChild.innerHTML) + 2 == itempage && parseInt(ul.lastChild.firstChild.innerHTML) - 2 == itempage) {\n itemnavigate = parseInt(ul.firstChild.firstChild.innerHTML);\n setPageNavigation(list);\n }\n }\n }\n });\n}", "function movePageleftTo(pageNumber) {\n\n}", "function select(selection) {\n\t\t\tswitch (selection) {\n\t\t\tcase 'last':\n\t\t\t\tselected = items.length - 1;\n\t\t\t\tbreak;\n\t\t\tcase 'next':\n\t\t\t\tselected++;\n\t\t\t\tif (selected > items.length - 1) {\n\t\t\t\t\tselected = 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'previous':\n\t\t\t\tselected--;\n\t\t\t\tif (selected < 0) {\n\t\t\t\t\tselected = items.length - 1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'nextPage':\n\t\t\t\tselected += maxItems;\n\t\t\t\tif (selected > items.length - 1) {\n\t\t\t\t\tselected = items.length - 1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'previousPage':\n\t\t\t\tselected -= maxItems;\n\t\t\t\tif (selected < 0) {\n\t\t\t\t\tselected = 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tselected = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\thighlightSelected();\n\t\t}", "function previousPage() {\n\t\tsetCurrentPage((page) => page - 1);\n\t}", "function navigateParcelDeliveryOrderPage(goto) {\n let goto_page = parseInt(goto);\n\n if (goto_page && goto_page > 0 &&\n goto_page < getPageCount(delivery_order_view_count, delivery_order_length) + 1) {\n\n let list_start_index = (goto_page * delivery_order_view_count) - delivery_order_view_count; //index to start from and list to view\n\n //create table row from list and append to table\n listParcelDeliveryOrder(list_start_index, delivery_order_view_count);\n\n current_page = goto_page; //set current page\n\n //update goto input value\n goto_input_elem.value = current_page;\n\n } else {\n //reset user entered number to previous number\n //code here\n\n //update goto input value\n goto_input_elem.value = current_page;\n }\n }", "function refresh_page(page_number, item_range_min, item_range_max)\n {\n items.hide();\n items.slice(item_range_min, item_range_max).show();\n }", "function handlePrev() {\n let tempPage = page - 1;\n if (tempPage < 1) {\n tempPage = 1;\n }\n setPage(tempPage);\n }", "function selectPage(new_current_page) {\n\t\t\t// update the link display of a all containers\n\t\t\tcontainers.data('current_page', new_current_page);\n\t\t\tlinks = renderer.getLinks(new_current_page, paginationClickHandler);\n\t\t\tcontainers.empty();\n\t\t\tlinks.appendTo(containers);\n\t\t\t// call the callback and propagate the event if it does not return false\n\t\t\tvar continuePropagation = opts.callback(new_current_page, containers);\n\t\t\treturn continuePropagation;\n\t\t}", "function selectPage(new_current_page) {\n\t\t\t// update the link display of a all containers\n\t\t\tcontainers.data('current_page', new_current_page);\n\t\t\tlinks = renderer.getLinks(new_current_page, paginationClickHandler);\n\t\t\tcontainers.empty();\n\t\t\tlinks.appendTo(containers);\n\t\t\t// call the callback and propagate the event if it does not return false\n\t\t\tvar continuePropagation = opts.callback(new_current_page, containers);\n\t\t\treturn continuePropagation;\n\t\t}", "limitInferiorPage(pageNumber) {\n if (pageNumber > 1)\n return <Button size=\"large\" variant=\"outlined\" color=\"primary\" onClick={this.goToPrevPage}><ArrowBackIcon /></Button>;\n else\n return <Button size=\"large\" disabled variant=\"outlined\" color=\"primary\"><ArrowBackIcon /></Button>;\n }", "function previous_page() {\n if(current_offset > 0) {\n current_offset -= 10;\n }\n let offset = \"offset=\"+current_offset;\n $.post('../php/sql_paging.php',offset,update_table);\n}", "function selectPage(new_current_page) {\n // update the link display of a all containers\n containers.data('current_page', new_current_page);\n links = renderer.getLinks(new_current_page, paginationClickHandler);\n containers.empty();\n links.appendTo(containers);\n // call the callback and propagate the event if it does not return false\n var continuePropagation = opts.callback(new_current_page, containers);\n return continuePropagation;\n }", "handlerForwardClick() {\n let dealers = this.state.delers;\n let rows = [];\n var count = 0;\n\n if (dealers.length < this.state.pointer + 10) {\n for (var i = this.state.pointer; i < dealers.length; i++) {\n rows[count] = dealers[i];\n count++;\n }\n this.state.page += 1;\n this.setState({\n rows: rows,\n forwardDisabled: true,\n backDisabled: false\n });\n } else {\n this.state.nextPointer = this.state.pointer + 10;\n for (var i = this.state.pointer; i < this.state.nextPointer; i++) {\n rows[count] = dealers[i];\n count++;\n }\n let pointer = this.state.pointer + 10;\n this.state.page += 1;\n this.setState({\n rows: rows,\n backDisabled: false,\n pointer: pointer\n });\n }\n }", "function Pagination(totalCount, pageIndex) {\n $('#tblPagination').html('');\n var table = document.getElementById(\"tblPagination\");\n var row = table.insertRow(0); row.setAttribute('id', 'trPagination')\n var id = 1;\n var totalRecord = totalCount;\n var currentPage = pageIndex;\n var pageSize = 10;\n var pageCount = totalRecord / pageSize;\n pageCount = Math.ceil(pageCount);\n if (pageCount > 10) {\n if (currentPage <= 10) {\n if (currentPage != 1) {\n var position = 0;\n var first = row.insertCell(position); var prevPage = currentPage - 1;\n first.innerHTML = \"First\"; first.setAttribute('onclick', \"PageClick('1');\"); first.setAttribute('id', id);\n if (currentPage > 1) {\n first.setAttribute(\"class\", \"Cursor\");\n } else {\n first.setAttribute(\"class\", \"CurrentPage\");\n }\n var prev = row.insertCell(position++);\n prev.innerHTML = \"Prev\"; prev.setAttribute('onclick', \"PageClick(\" + prevPage + \");\"); prev.setAttribute('id', id + 1);\n if (currentPage > 1) {\n prev.setAttribute(\"class\", \"Cursor\");\n } else {\n prev.setAttribute(\"class\", \"CurrentPage\");\n }\n }\n else {\n var id = 0;\n }\n\n for (var i = 1; i <= 10; i++) {\n\n position = position + 1; id = id + 1;\n var td = row.insertCell(position);\n td.innerHTML = i;\n td.setAttribute('onclick', \"PageClick(\" + i + \");\");\n td.setAttribute('id', id);\n if (i != currentPage) {\n td.setAttribute(\"class\", \"Cursor\");\n }\n else {\n td.setAttribute(\"class\", \"CurrentPage\");\n }\n }\n var next = row.insertCell(position++); id = id + 1; var nextpage = currentPage + 1;\n next.innerHTML = \"Next\"; next.setAttribute('onclick', \"PageClick(\" + nextpage + \");\");\n next.setAttribute('id', id);\n if (currentPage < pageCount) {\n next.setAttribute(\"class\", \"Cursor\");\n }\n else {\n next.setAttribute(\"class\", \"CurrentPage\");\n }\n var last = row.insertCell(position++);\n last.innerHTML = \"Last\"; last.setAttribute('onclick', \"PageClick(\" + pageCount + \");\"); id = id + 1;\n last.setAttribute('id', id);\n $(\"#trPagination > td\").tsort(\"\", { attr: \"id\" });\n if (currentPage < pageCount) {\n last.setAttribute(\"class\", \"Cursor\");\n }\n else {\n last.setAttribute(\"class\", \"CurrentPage\");\n }\n }\n else {\n var temp = pageCount - currentPage;\n if (temp > 10) {\n var position = 0;\n var first = row.insertCell(position); var prevPage = currentPage - 1;\n first.innerHTML = \"First\"; first.setAttribute('onclick', \"PageClick('1');\"); first.setAttribute('id', id);\n if (currentPage > 1) {\n first.setAttribute(\"class\", \"Cursor\");\n } else {\n first.setAttribute(\"class\", \"CurrentPage\");\n }\n var prev = row.insertCell(position++);\n prev.innerHTML = \"Prev\"; prev.setAttribute('onclick', \"PageClick(\" + prevPage + \");}\"); prev.setAttribute('id', id + 1);\n if (currentPage > 1) {\n prev.setAttribute(\"class\", \"Cursor\");\n } else {\n prev.setAttribute(\"class\", \"CurrentPage\");\n }\n var j = 1;\n for (var i = currentPage; j <= 10; i++) {\n position++; id++\n var td = row.insertCell(position);\n td.innerHTML = i;\n td.setAttribute('onclick', \"PageClick(\" + i + \");\");\n td.setAttribute('id', id);\n\n if (i != currentPage) {\n td.setAttribute(\"class\", \"Cursor\");\n }\n else {\n td.setAttribute(\"class\", \"CurrentPage\");\n }\n j++;\n }\n var next = row.insertCell(position++); id = id + 1; var nextpage = currentPage + 1;\n next.innerHTML = \"Next\"; next.setAttribute('onclick', \"PageClick(\" + nextpage + \");\");\n if (currentPage < pageCount) {\n next.setAttribute(\"class\", \"Cursor\");\n }\n else {\n next.setAttribute(\"class\", \"CurrentPage\");\n }\n var last = row.insertCell(position++); next.setAttribute('id', id);\n last.innerHTML = \"Last\"; last.setAttribute('onclick', \"PageClick(\" + pageCount + \");\"); id = id + 1;\n last.setAttribute('id', id);\n if (currentPage < pageCount) {\n last.setAttribute(\"class\", \"Cursor\");\n }\n else {\n last.setAttribute(\"class\", \"CurrentPage\");\n }\n $(\"#trPagination > td\").tsort(\"\", { attr: \"id\" });\n }\n else {\n var position = 0;\n var first = row.insertCell(position); var prevPage = currentPage - 1;\n first.innerHTML = \"First\"; first.setAttribute('onclick', \"PageClick('1');\"); first.setAttribute('id', id);\n if (currentPage > 1) {\n first.setAttribute(\"class\", \"Cursor\");\n } else {\n first.setAttribute(\"class\", \"CurrentPage\");\n }\n var prev = row.insertCell(position++);\n prev.innerHTML = \"Prev\"; prev.setAttribute('onclick', \"PageClick(\" + prevPage + \");\"); prev.setAttribute('id', id + 1);\n if (currentPage > 1) {\n prev.setAttribute(\"class\", \"Cursor\");\n } else {\n prev.setAttribute(\"class\", \"CurrentPage\");\n }\n var a = pageCount - currentPage;\n var b = 10 - a;\n var startingPoint = currentPage - b;\n var j = startingPoint;\n for (var i = startingPoint; i <= pageCount; i++) {\n position++; id++\n var td = row.insertCell(position);\n td.innerHTML = i;\n td.setAttribute('onclick', \"PageClick(\" + i + \");\");\n td.setAttribute('id', id);\n if (i != currentPage) {\n td.setAttribute(\"class\", \"Cursor\");\n }\n else {\n td.setAttribute(\"class\", \"CurrentPage\");\n }\n j++;\n }\n var next = row.insertCell(position++); id = id + 1; var nextpage = currentPage + 1;\n next.innerHTML = \"Next\"; next.setAttribute('onclick', \"PageClick(\" + nextpage + \");\");\n if (currentPage < pageCount) {\n next.setAttribute(\"class\", \"Cursor\");\n }\n else {\n next.setAttribute(\"class\", \"CurrentPage\");\n }\n var last = row.insertCell(position++); next.setAttribute('id', id);\n last.innerHTML = \"Last\"; last.setAttribute('onclick', \"PageClick(\" + pageCount + \");\"); id = id + 1;\n last.setAttribute('id', id);\n\n if (currentPage < pageCount) {\n last.setAttribute(\"class\", \"Cursor\");\n }\n else {\n last.setAttribute(\"class\", \"CurrentPage\");\n }\n $(\"#trPagination > td\").tsort(\"\", { attr: \"id\" });\n }\n }\n }\n else {\n var position = 0;\n var first = row.insertCell(position);\n first.innerHTML = \"First\"; first.setAttribute('onclick', \"PageClick('1');\"); first.setAttribute('id', id);\n if (currentPage > 1) {\n first.setAttribute(\"class\", \"Cursor\");\n } else {\n first.setAttribute(\"class\", \"CurrentPage\");\n }\n for (var i = 1; i <= pageCount; i++) {\n position++; id++\n var td = row.insertCell(position);\n td.innerHTML = i;\n td.setAttribute('onclick', \"PageClick(\" + i + \");\");\n td.setAttribute('id', id);\n if (i != currentPage) {\n td.setAttribute(\"class\", \"Cursor\");\n }\n else {\n td.setAttribute(\"class\", \"CurrentPage\");\n }\n }\n var last = row.insertCell(pageCount++); id = id + 1;\n last.innerHTML = \"Last\"; last.setAttribute('onclick', \"PageClick(\" + pageCount + \");\");\n last.setAttribute('id', id);\n if (currentPage < pageCount) {\n last.setAttribute(\"class\", \"Cursor\");\n }\n else {\n last.setAttribute(\"class\", \"CurrentPage\");\n }\n $(\"#trPagination > td\").tsort(\"\", { attr: \"id\" });\n }\n}", "previousPage() {\n if (this.getCurrentIndex() === 0) {\n if (this.isScrollLoop() && this.__pages.length > 1) {\n this._doScrollLoop();\n }\n } else {\n this.setCurrentIndex(this.getCurrentIndex() - 1);\n }\n }", "handleClickPaginator(event)\n {\n let text = event.toElement.id.replace(\"paginator\", \"\");\n this._page = text === \"\" ? null : text;\n this.getBooks();\n }", "async loadPreviousPages() {\n logger.debug('AnnotationListWidget#loadPreviousPages', this._loading);\n try {\n if (this._loading) {\n return;\n }\n this._loading = true;\n const minHeight = this._rootElem.height() * this._minContentRelativeHeight;\n const numPages = this._nav.getNumPages();\n let scrollHeight = this._rootElem[0].scrollHeight;\n\n for (let nextPage = this._nav.getActiveRange().startPage - 1;\n nextPage >= 0 && scrollHeight < minHeight;\n scrollHeight = this._rootElem[0].scrollHeight, --nextPage)\n {\n logger.debug('AnnotationListWidget#_loadPreviousPages nextPage:', nextPage, 'scrollHeight:', scrollHeight, 'minHeight:', minHeight);\n await this._loadPage(nextPage);\n }\n } catch (e) {\n logger.error('AnnotationListWidget#loadPreviousPages failed', e);\n } finally {\n this._loading = false;\n }\n }", "prevPage() {\n const { onChange, page, perPage } = this.props;\n onChange(page - 1, perPage);\n }", "handlePaging() {\n if (!this.settings.paging) {\n return;\n }\n\n this.element.addClass('paginated');\n this.tableBody.pager({\n componentAPI: this,\n dataset: this.settings.dataset,\n hideOnOnePage: this.settings.hidePagerOnOnePage,\n source: this.settings.source,\n pagesize: this.settings.pagesize,\n indeterminate: this.settings.indeterminate,\n rowTemplate: this.settings.rowTemplate,\n pagesizes: this.settings.pagesizes,\n pageSizeSelectorText: this.settings.groupable ? 'GroupsPerPage' : 'RecordsPerPage',\n showPageSizeSelector: this.settings.showPageSizeSelector,\n activePage: this.restoreActivePage ? parseInt(this.savedActivePage, 10) : 1\n });\n\n if (this.restoreActivePage) {\n this.savedActivePage = null;\n this.restoreActivePage = false;\n }\n }", "function togglePagination() {\n if (App.CurrentPage) {\n //reset pagination\n $('.pagination li').removeClass(\"active\").removeClass(\"disabled\");\n $('.pagination').find(\".page\" + App.CurrentPage).addClass(\"active\");\n if (App.CurrentPage === 1) {\n $('.prev').addClass(\"disabled\");\n } else if (App.CurrentPage === (App.TotalEntries / App.NumEntriesPerPage)) {\n $('.next').addClass(\"disabled\");\n }\n }\n}", "changePage(fieldPath) {\n const fieldPathArray = this.pathUtilService.toPathArray(fieldPath);\n const listPathArray = this.pathUtilService.getNearestOrRootArrayParentInPath(fieldPathArray, true);\n const listPath = this.pathUtilService.toPathString(listPathArray);\n if (this.pageChange$Map[listPath]) {\n const itemIndex = fieldPathArray[listPathArray.length];\n const itemsPerPage = this.itemsPerPageMap[listPath];\n const page = Math.floor((itemIndex / itemsPerPage) + 1);\n this.pageChange$Map[listPath].next(page);\n }\n }", "function changePage(data,page)\r\n {\r\n var btn_next = document.getElementById(\"btn_next\");\r\n var btn_prev = document.getElementById(\"btn_prev\");\r\n var page_span = document.getElementById(\"page\");\r\n const tableArr = (data)\r\n const tableMain = document.getElementById(\"GridBody\");\r\n showHeaders(data)\r\n \r\n // Validate page\r\n if (page < 1) page = 1;\r\n if (page > numPages()) page = numPages();\r\n \r\n tableMain.innerHTML = \"\";\r\n\r\n for (var i = (page-1) * records_per_page; i < (page * records_per_page) && i < tableArr.length; i++) {\r\n let tableRowEle = '<tr class=\"table-row\">'\r\n tableRowEle += '<td>'+`<input type=\"checkbox\" id=\"check${i}\" value=\"${tableArr[i].primkey}\" class=\"tick\" /><label class=\"sall_check\" for=\"check${i}\">`+'<img src=\"images/check_box_outline_blank-black-18dp.svg\" /></label></th>'\r\n Object.entries(tableArr[i]).slice(1).forEach(entry => {\r\n const [key,value] =entry \r\n tableRowEle += `<td class=\"${key}\">`+value+'</td>'\r\n })\r\n tableRowEle += '</tr>'\r\n tableMain.innerHTML += tableRowEle\r\n }\r\n page_span.innerHTML = page + \"/\" + numPages();\r\n\r\n if (page == 1) {\r\n btn_prev.style.visibility = \"hidden\";\r\n } else {\r\n btn_prev.style.visibility = \"visible\";\r\n }\r\n\r\n if (page == numPages()) {\r\n btn_next.style.visibility = \"hidden\";\r\n } else {\r\n btn_next.style.visibility = \"visible\";\r\n }\r\n }", "insertPageBreak() {\n if (!this.owner.isReadOnlyMode) {\n if (this.viewer.selection.start.paragraph.isInsideTable ||\n this.viewer.selection.start.paragraph.isInHeaderFooter) {\n return;\n }\n this.initComplexHistory('PageBreak');\n this.onEnter(true);\n if (this.editorHistory && this.editorHistory.currentHistoryInfo != null) {\n this.editorHistory.updateComplexHistory();\n }\n this.selection.checkForCursorVisibility();\n }\n }", "function onChangePageLimit(el) {\n curPageLimit = $(el).val();\n refreshTable();\n debug('Page limit changed : ' + curPageLimit);\n }", "function setEventButtonNavigation(listtemp) {\n let buttonprev = document.getElementById('buttonprev');\n let buttonnext = document.getElementById('buttonnext');\n buttonprev.addEventListener('click', function () {\n let ul = document.getElementById('itemPage');\n let active = document.getElementById('active');\n itempage = parseInt(active.firstChild.innerHTML) - 1;\n tbody.innerHTML = '';\n setList(listtemp, itempage);\n if (totaltemp <= 5) {\n itemnavigate = 1;\n setPageNavigation(listtemp);\n } else {\n if (itempage <= 3) {\n itemnavigate = 1;\n setPageNavigation(listtemp);\n } else if (itempage >= totaltemp - 2) {\n itemnavigate = totaltemp - 4;\n setPageNavigation(listtemp);\n } else {\n itemnavigate = parseInt(ul.firstChild.firstChild.innerHTML) - 1;\n setPageNavigation(listtemp);\n }\n }\n });\n buttonnext.addEventListener('click', function () {\n let ul = document.getElementById('itemPage');\n let active = document.getElementById('active');\n itempage = parseInt(active.firstChild.innerHTML) + 1;\n tbody.innerHTML = '';\n setList(listtemp, itempage);\n if (totaltemp <= 5) {\n itemnavigate = 1;\n setPageNavigation(listtemp);\n } else {\n if (itempage <= 3) {\n itemnavigate = 1;\n setPageNavigation(listtemp);\n } else if (itempage >= totaltemp - 2) {\n itemnavigate = totaltemp - 4;\n setPageNavigation(listtemp);\n } else {\n itemnavigate = parseInt(ul.firstChild.firstChild.innerHTML) + 1;\n setPageNavigation(listtemp);\n }\n }\n });\n}" ]
[ "0.643262", "0.6249248", "0.62237257", "0.6144744", "0.61430174", "0.6114298", "0.60750425", "0.598321", "0.5949296", "0.5937859", "0.59339607", "0.5927115", "0.59027886", "0.58865994", "0.58582413", "0.5851886", "0.58417", "0.5801387", "0.57899684", "0.57341385", "0.5728631", "0.57034737", "0.5703101", "0.5697118", "0.5695831", "0.5694889", "0.5690221", "0.56860363", "0.5672675", "0.5640174", "0.5634342", "0.5630258", "0.5616127", "0.5611682", "0.56093806", "0.5608259", "0.5597846", "0.5582386", "0.55661887", "0.5563386", "0.5559668", "0.55495745", "0.5547942", "0.55389154", "0.55362386", "0.5532274", "0.5530693", "0.5526926", "0.55151653", "0.55151653", "0.55125403", "0.551202", "0.55030257", "0.5502394", "0.55011797", "0.5497192", "0.54886717", "0.54878086", "0.54854065", "0.5478787", "0.5476195", "0.54758406", "0.54739", "0.5470177", "0.5467314", "0.5467078", "0.5462542", "0.5462542", "0.5456768", "0.5453358", "0.545198", "0.5447743", "0.5446582", "0.54461884", "0.544423", "0.5442774", "0.5439935", "0.543727", "0.54369193", "0.5435757", "0.5424671", "0.54245234", "0.5420967", "0.5420967", "0.5417882", "0.54135257", "0.5407174", "0.54069614", "0.54007643", "0.53986955", "0.5398595", "0.53907615", "0.53823406", "0.53759915", "0.5375769", "0.53738636", "0.5366414", "0.53619874", "0.53591967", "0.5358935" ]
0.62034035
3
Col elements are enough to keep column widths after sorting and filtering
function createColTags(o) { if(!o) return; for(var k=(o.nbCells-1); k>=0; k--) { var col = tf_CreateElm( 'col', ['id', o.id+'_col_'+k]); o.tbl.firstChild.parentNode.insertBefore(col,o.tbl.firstChild); col.style.width = o.colWidth[k]; o.gridColElms[k] = col; } o.tblHasColTag = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "recalculateColumnWidths(){if(!this._columnTree){return;// No columns\n}const cols=this._getColumns().filter(col=>!col.hidden&&col.autoWidth);this._recalculateColumnWidths(cols)}", "function getNewColDefs() {\n return [\n {headerName: \"Id\", field: \"id\", width: 50, filter: 'number'},\n {headerName: \"Interaction Type\", field: \"intType\", width: 150},\n {headerName: \"Int Tags\", field: \"intTag\", width: 100},\n {headerName: \"Note\", field: \"note\", width: 150, filter: 'text'},\n {headerName: \"Subject Kingdom\", field: \"subjKngdm\", width: 150},\n {headerName: \"Subject Taxon\", field: \"subjTaxon\", width: 200, filter: 'text'},\n {headerName: \"Object Kingdom\", field: \"objKngdm\", width: 150},\n {headerName: \"Object Taxon\", field: \"objTaxon\", width: 200, filter: 'text'},\n {headerName: \"Habitat Type\", field: \"habType\", width: 150},\n {headerName: \"Region\", field: \"region\", width: 150},\n {headerName: \"Country\", field: \"country\", width: 150},\n {headerName: \"Location Description\", field: \"locDesc\", width: 150, filter: 'text'},\n {headerName: \"Latitude\", field: \"lat\", width: 100, filter: 'number'},\n {headerName: \"Longitude\", field: \"long\", width: 100, filter: 'number'},\n {headerName: \"Elevation\", field: \"elev\", width: 100, filter: 'number'},\n {headerName: \"Elev. Max\", field: \"elevRangeMax\", width: 100, filter: 'number'},\n {headerName: \"Citation Short Description\", field: \"citShortDesc\", width: 300, filter: 'text'},\n {headerName: \"Title\", field: \"title\", width: 400, filter: 'text'},\n {headerName: \"Authors\", field: \"authors\", width: 300, filter: 'text'},\n {headerName: \"Publication\", field: \"pubTitle\", width: 500, filter: 'text'},\n {headerName: \"Publisher\", field: \"publisher\", width: 100, filter: 'text'},\n {headerName: \"Type\", field: \"pubType\", width: 100, filter: 'text'},\n {headerName: \"Vol.\", field: \"vol\", width: 50, filter: 'number'},\n {headerName: \"Issue\", field: \"issue\", width: 50, filter: 'number'},\n {headerName: \"Pages\", field: \"pgs\", width: 100, filter: 'number'},\n ];\n }", "_freezeColumnWidth() {\n this._forEachRowCell(this._containerHead, 0, (cell, columnIndex) => {\n const width = cell.width; // get current numeric width\n cell.width = width; // set width to style.width\n this._columns[columnIndex].width = cell.width; // fetch real width again and store it\n });\n }", "function setColWidths(el, maxCharsPerCol) {\n var maxCharsPerRow = 0;\n var tbody = $(el).find('tbody');\n var pixelsAvailable = tbody[0].clientWidth;\n var scrollbarWidth = tbody[0].offsetWidth - tbody[0].clientWidth;\n var scrollBarInnerWidth;\n var outerSpacing = $(el).find('.col-0').outerWidth() - $(el).find('.col-0').width();\n // Column resizing needs to be done manually when tbody has scroll bar.\n if (el.settings.tbodyHasScrollBar) {\n if (el.settings.responsive) {\n // Allow 14px space for responsive show + button.\n $(el).find('.footable-toggle-col').css('width', '14px');\n pixelsAvailable -= $(el).find('.footable-toggle-col').outerWidth();\n }\n if (el.settings.actions.length > 0) {\n // Allow 22px space for actions column.\n $(el).find('.col-actions').css('width', '22px');\n pixelsAvailable -= $(el).find('.col-actions').outerWidth();\n } else {\n $(el).find('.col-actions').css('width', 0);\n }\n // Space header if a scroll bar visible.\n if (tbody.find('tr').length > 0 && scrollbarWidth > 0) {\n scrollBarInnerWidth = scrollbarWidth - outerSpacing;\n $(el).find('.scroll-spacer').css('width', scrollBarInnerWidth + 'px');\n pixelsAvailable -= $(el).find('.scroll-spacer').outerWidth();\n } else {\n $(el).find('.scroll-spacer').css('width', 0);\n }\n $.each(el.settings.columns, function eachColumn(idx) {\n // Allow extra char per col for padding.\n maxCharsPerCol['col-' + idx] += 1;\n maxCharsPerRow += maxCharsPerCol['col-' + idx];\n });\n $.each(el.settings.columns, function eachColumn(idx) {\n $(el).find('.col-' + idx).css('width', (pixelsAvailable * (maxCharsPerCol['col-' + idx] / maxCharsPerRow) - outerSpacing) + 'px');\n });\n }\n }", "function fixColumnWidth(table) {\n if (table.config.widthFixed && $(table).find('colgroup').length === 0) {\n var colgroup = $('<colgroup>'),\n overallWidth = $(table).width();\n // only add col for visible columns - fixes #371\n $(table.tBodies[0]).find(\"tr:first\").children(\":visible\").each(function() {\n colgroup.append($('<col>').css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%'));\n });\n $(table).prepend(colgroup);\n }\n }", "function fixColumnWidth(table) {\n\t\t\t\tvar colgroup, overallWidth,\n\t\t\t\t\tc = table.config;\n\t\t\t\tif (c.widthFixed && c.$table.children('colgroup').length === 0) {\n\t\t\t\t\tcolgroup = $('<colgroup>');\n\t\t\t\t\toverallWidth = $(table).width();\n\t\t\t\t\t// only add col for visible columns - fixes #371\n\t\t\t\t\t$(table.tBodies).not('.' + c.cssInfoBlock).find(\"tr:first\").children(\":visible\").each(function() {\n\t\t\t\t\t\tcolgroup.append($('<col>').css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%'));\n\t\t\t\t\t});\n\t\t\t\t\tc.$table.prepend(colgroup);\n\t\t\t\t}\n\t\t\t}", "calculateColumns(){\n var columns = this.options.columns;\n this.columnsByPin = ColumnsByPin(columns);\n this.columnWidths = ColumnGroupWidths(this.columnsByPin, columns);\n }", "function columnLimit(width) {\n var limit = $scope.thead.length;\n if (width<520) {\n limit-=5;\n } else if (width<700) {\n limit-=4;\n } else if (width<780) {\n limit-=3;\n } else if (width<850) {\n limit-=2;\n } else if (width<940) {\n limit--;\n }\n return limit;\n }", "function fixWidth() {\n\t\tlet group;\n\t\tlet html = \"\";\n\t\tconst table = $(\"table.files\");\n\t\tconst tableWidth = getWidth(table);\n\t\tconst cells = $$(\"tbody:last-child tr:last-child td\", table);\n\t\tif (table && cells.length > 1 && !$(\"colgroup\", table)) {\n\t\t\tgroup = document.createElement(\"colgroup\");\n\t\t\ttable.insertBefore(group, table.childNodes[0]);\n\t\t\tcells.forEach(el => {\n\t\t\t\t// Keep two decimal point accuracy\n\t\t\t\tconst width = parseInt(getWidth(el) / tableWidth * 1e4, 10) / 100;\n\t\t\t\thtml += `<col style=\"width:${width}%\">`;\n\t\t\t});\n\t\t\tgroup.innerHTML = html;\n\t\t}\n\t}", "_updateColumnSizes() {\n if (this.$el.hasClass('diff-error')) {\n return;\n }\n\n let $parent = this._$parent;\n\n if (!$parent.is(':visible')) {\n /*\n * We're still in diff loading mode, and the parent is hidden. We\n * can get the width we need from the parent. It should be the same,\n * or at least close enough for the first stab at column sizes.\n */\n $parent = $parent.parent();\n }\n\n const fullWidth = $parent.width();\n\n if (fullWidth === this._prevFullWidth) {\n return;\n }\n\n this._prevFullWidth = fullWidth;\n\n /* Calculate the desired widths of the diff columns. */\n let contentWidth = fullWidth - this._colReservedWidths;\n\n if (this._numColumns === 4) {\n contentWidth /= 2;\n }\n\n /* Calculate the desired widths of the filename columns. */\n let filenameWidth = fullWidth - this._filenameReservedWidths;\n\n if (this._numFilenameColumns === 2) {\n filenameWidth /= 2;\n }\n\n this.$el.width(fullWidth);\n\n /* Update the minimum and maximum widths, if they've changed. */\n if (filenameWidth !== this._prevFilenameWidth) {\n this._$filenameRow.children('th').css({\n 'min-width': Math.ceil(filenameWidth * 0.66),\n 'max-width': Math.ceil(filenameWidth)\n });\n this._prevFilenameWidth = filenameWidth;\n }\n\n if (contentWidth !== this._prevContentWidth) {\n this._$revisionRow.children('.revision-col').css({\n 'min-width': Math.ceil(contentWidth * 0.66),\n 'max-width': Math.ceil(contentWidth)\n });\n this._prevContentWidth = contentWidth;\n }\n }", "fixCellWidths(rowElement, visibleColumns = null) {\n if (!visibleColumns) visibleColumns = this.columns.bottomColumns.filter(col => !col.hidden); // fix cell widths, no longer allowed in template because of CSP\n\n let cellElement = rowElement.firstElementChild,\n i = 0;\n\n while (cellElement) {\n const column = visibleColumns[i];\n\n if (column.minWidth) {\n DomHelper.setLength(cellElement, 'minWidth', column.minWidth);\n } // either flex or width, flex has precedence\n\n if (column.flex) {\n cellElement.style.flex = column.flex;\n cellElement.style.width = '';\n } else if (column.width) {\n // https://app.assembla.com/spaces/bryntum/tickets/8041\n // Although header and footer elements must be sized\n // using flex-basis to avoid the busting out problem,\n // grid cells MUST be sized using width since rows are absolutely\n // positioned and will not cause the busting out problem,\n // and rows will not stretch to shrinkwrap the cells\n // unless they are widthed with width.\n cellElement.style.flex = '';\n cellElement.style.width = DomHelper.setLength(column.width); // IE11 calculates flexbox container width based on min-width rather than actual width. When column\n // has width defined greater than minWidth, row may have incorrect width\n\n if (BrowserHelper.isIE11) {\n cellElement.style.minWidth = cellElement.style.width;\n }\n } else {\n cellElement.style.flex = cellElement.style.width = cellElement.style.minWidth = '';\n }\n\n cellElement = cellElement.nextElementSibling;\n i++;\n }\n }", "function colWidths(rows) {\n////the underscore arg is not used\n//colWidths builds up an array with one element for every column index\n//only takes first row because every row will have the same number of columns (which is 3)\n return rows[0].map(function(_, i) {\n ////reduce rows \n return rows.reduce(function(max, row) {\n \t//by returning the higher number of min width of a row\n \treturn Math.max(max, row[i].minWidth());\n }, 0);\n });\n}", "function columnwidth(){\n\t//this should affect whole page, so first we need to find every .row element\n\tlet allMyRows = document.querySelectorAll('.row');\n\t\n\t//we want a base minimum width for every column, I don't want them smaller than 150px\n\tlet baseWidth = 150;\n\t\n\t//loop through all of the rows \n\tallMyRows.forEach(function(e){\n\t\t//we need to know how wide the width is for the parent row\n\t\tlet myWidth = e.offsetWidth;\n\t\t\n\t\t//find direct children columns and how many there are\n\t\tlet allMyChildren = e.querySelectorAll(':scope >.column');//only selects the direct children of element\n\n\t\tlet myLength = allMyChildren.length;\n\t\t\n\t\t//find all the factors for my Length, take a number then try to divide it equally by every number smaller then itself, each success is a factor and can be put into an array.\n\t\tlet myFactors = [];\n\t\tfor (let num = myLength ; num > 0; num--){\t\n\t\t\tif (myLength % num === 0){\n\t\t\t\tmyFactors.push(num);//this array will have all positive factors, and will result in 2 length for primes.\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction setMinWidt(myarray,myvalue){\n\t\t\tfor (let i=0; i<myarray.length; i++){\n\t\t\t\tmyarray[i].style.minWidth = myvalue;\n\t\t\t}\n\t\t}\n\t\t//determine width of columns based on factors, baseWidth, and myWidth\n\t\t//first check if all columns will fit in space, if so do nothing\n\t\tif(baseWidth*myLength < myWidth){\n\t\t\tlet v = 150 + 'px'; //reset min width if enlarging\n\t\t\tsetMinWidt(allMyChildren,v); \n\t\t\t\n\t\t\t//do some different math for prime number of columns, lets set it up so that it tries to evenly spread the groups of columns, like a row of 6 then 5, or 2 rows of 4 then a row of 3, ect.\n\t\t} else if (myWidth <= 320){\n\t\t\tsetMinWidt(allMyChildren,'100%');\n\t\t} else if (myFactors.length === 2 ){\n\t\t\t\t for (let i=2; i < myLength; i++){\n\t\t\t\t\t let val = Math.ceil(Math.round(myLength/i));\n\t\t\t\t\t if (val*baseWidth < myWidth && val !== 1){ //if equal to one, let it default to normal widths/distributions\n\t\t\t\t\t\t let v = 100/val + '%';\n\t\t\t\t\t\t setMinWidt(allMyChildren,v);\n\t\t\t\t\t\t break;\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t \n\t\t} else { // here we determine how much space we have and divide columns accordingly\n\t\t\tfor (let value of myFactors){\n\t\t\t\tif (value*baseWidth < myWidth && myWidth > 320){ //if smaller than 320 only allow single columns\n\t\t\t\t\tlet v = 100/value + '%';\t\n\t\t\t\t\tsetMinWidt(allMyChildren,v);\n\t\t\t\t\tbreak; \n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t} \n\t\t\n\t});\n}//end of column width function", "function emptyColumnCheck() {\n\t\t\tvar data = grid.getData().getItems() || [];\n //Avoiding Resize functionality when there is no data.\n if (data.length === 0) {\n return;\n }\n var headerColumns = $('.slick-header-column', $(container));\n var flag = [];\n var updateGrid = false;\n for (i = 0; i < headerColumns.length; i++) {\n \tif(grid.getColumns()[i].hasOwnProperty('editor')){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n flag[i] = true;\n\t\t\t\tfor(j = 0; j < data.length; j++){\n\t\t\t\t\tif($.trim(data[j][grid.getColumns()[i].field])){\n\t\t\t\t\t\tflag[i] = false;\n if (grid.getColumns()[i].originalWidth)\n grid.getColumns()[i].width = grid.getColumns()[i].originalWidth;\n break;\n\t\t\t\t\t}\n\t\t\t\t}\n if (flag[i] && grid.getColumns()[i]) {\n grid.getColumns()[i].originalWidth = grid.getColumns()[i].width;\n // grid.getColumns()[i].width = 40;\n updateGrid = true;\n }\n }\n if (updateGrid) {\n grid.setColumns(grid.getColumns(), true);\n }\n }", "fixHeaderWidths() {\n this.fixCellWidths();\n }", "fixHeaderWidths() {\n this.fixCellWidths();\n }", "fixCellWidths(rowElement, visibleColumns = null) {\n if (!visibleColumns) visibleColumns = this.columns.bottomColumns.filter((col) => !col.hidden);\n\n // fix cell widths, no longer allowed in template because of CSP\n let cellElement = rowElement.firstElementChild,\n i = 0;\n\n while (cellElement) {\n const column = visibleColumns[i];\n\n if (column.minWidth) {\n DomHelper.setLength(cellElement, 'minWidth', column.minWidth);\n }\n\n // either flex or width, flex has precedence\n if (column.flex) {\n cellElement.style.flex = column.flex;\n cellElement.style.width = '';\n } else if (column.width) {\n // https://app.assembla.com/spaces/bryntum/tickets/8041\n // Although header and footer elements must be sized\n // using flex-basis to avoid the busting out problem,\n // grid cells MUST be sized using width since rows are absolutely\n // positioned and will not cause the busting out problem,\n // and rows will not stretch to shrinkwrap the cells\n // unless they are widthed with width.\n cellElement.style.flex = '';\n cellElement.style.width = DomHelper.setLength(column.width);\n\n // IE11 calculates flexbox container width based on min-width rather than actual width. When column\n // has width defined greater than minWidth, row may have incorrect width\n if (BrowserHelper.isIE11) {\n cellElement.style.minWidth = cellElement.style.width;\n }\n } else {\n cellElement.style.flex = cellElement.style.width = cellElement.style.minWidth = '';\n }\n\n cellElement = cellElement.nextElementSibling;\n i++;\n }\n }", "function getDataCells(el, doc, maxCharsPerCol) {\n var cells = [];\n var sourceSettings = el.settings.sourceObject.settings;\n $.each(el.settings.columns, function eachColumn(idx) {\n var value;\n var rangeValue;\n var classes = ['col-' + idx];\n var style = '';\n var colDef = el.settings.availableColumnInfo[this.field];\n var date;\n // Extra space in last col to account for tool icons.\n var extraSpace = idx === el.settings.columns.length - 1 && !el.settings.actions.length ? 2 : 0;\n var charWidth;\n // In compositeAggregation mode, fields are replaced by key names. We replace\n // . with - to avoid confusion when iterating down paths.\n var field = sourceSettings.mode === 'compositeAggregation' && $.inArray(this.field, sourceSettings.fields) > -1\n ? this.field.asCompositeKeyName() : this.field;\n value = indiciaFns.getValueForField(doc, field, colDef);\n if (colDef.rangeField) {\n rangeValue = indiciaFns.getValueForField(doc, colDef.rangeField);\n if (value !== rangeValue) {\n value = value + ' to ' + rangeValue;\n }\n }\n if (value && colDef.handler && colDef.handler === 'date') {\n date = new Date(value);\n value = date.toLocaleDateString();\n } else if (value && colDef.handler && colDef.handler === 'datetime') {\n date = new Date(value);\n value = date.toLocaleString();\n }\n if (value && typeof value === 'string' && value.match(/class=\"(single|multi)\"/)) {\n // Thumbnail(s) so give approx column size.\n charWidth = value.match(/class=\"single\"/) ? 8 : 14;\n maxCharsPerCol['col-' + idx] = Math.max(maxCharsPerCol['col-' + idx], extraSpace + charWidth);\n } else {\n maxCharsPerCol['col-' + idx] =\n Math.max(maxCharsPerCol['col-' + idx], longestWordLength($('<p>' + value + '</p>').text()) + extraSpace);\n }\n classes.push('field-' + this.field.replace(/\\./g, '--').replace(/_/g, '-'));\n // Copy across responsive hidden cols.\n if ($(el).find('table th.col-' + idx).css('display') === 'none') {\n style = ' style=\"display: none\"';\n }\n value = value === null ? '' : value;\n if (colDef.ifEmpty && value === '') {\n value = colDef.ifEmpty;\n }\n cells.push('<td class=\"' + classes.join(' ') + '\"' + style + '>' + value + '</td>');\n return true;\n });\n return cells;\n }", "function columnate(...columnGroupOpts) {\n const columnGroups = columnGroupOpts.map(([label, list]) => ({\n label,\n width: 0,\n list: list.reverse(),\n columns: [],\n }))\n\n while (!columnGroups.every(group => !group.list.length)) {\n columnGroups.forEach(group => {\n while (group.list.length) {\n const column = {\n width: 0,\n rows: [],\n }\n group.columns.push(column)\n\n // HEADER + SPACE\n for (let rowIndex = 0; rowIndex < tableHeight - 1 - PADDING_V; rowIndex++) {\n if (!group.list.length) break\n const item = group.list.pop()\n column.rows.push(item)\n if (item.length > column.width) column.width = item.length\n }\n\n group.width += column.width + PADDING_H\n }\n })\n }\n\n // print headers\n columnGroups.forEach(group => {\n // if label is wider than all this group's columns, add some space to the last column\n const labelOverhang = group.label.length + PADDING_H - group.width\n if (labelOverhang > 0) {\n group.width += labelOverhang\n group.columns[group.columns.length - 1].width += labelOverhang\n }\n\n // print label\n process.stdout.write(group.label)\n let remainingSpace = group.width - group.label.length\n while (remainingSpace-- > 0) process.stdout.write(' ')\n })\n const headerHeight = PADDING_V + 1\n for (let i = 0; i < headerHeight; i++) process.stdout.write('\\n')\n\n // print content\n for (let rowIndex = 0; rowIndex < tableHeight - headerHeight; rowIndex++) {\n columnGroups.forEach(group => group.columns.forEach((column, columnIndex) => {\n let remainingSpace = column.width + PADDING_H\n const cell = column.rows[rowIndex]\n if (cell) {\n process.stdout.write(cell || '')\n remainingSpace -= cell.length\n }\n while (remainingSpace-- > 0) process.stdout.write(' ')\n }))\n process.stdout.write('\\n')\n }\n}", "static updateColumns() {\n if (ftables.length === 0) {\n return;\n }\n for (const column of ftables[0]._columns.children) {\n if (column.value === \"\") {\n continue;\n }\n ftables[0]._tables.querySelectorAll(`.${column.value}`)\n .forEach(e => e.style.display = column.selected ? \"\" : \"none\");\n }\n\n // Reponsive table fix.\n fixResponsiveTh();\n }", "_handleFrozenColumnPositions() {\r\n const that = this,\r\n rightToLeft = that.rightToLeft,\r\n columns = that._columns;\r\n let frozenNear = [],\r\n frozenFar = [],\r\n selectionModifier = 0;\r\n\r\n function applyStyle(property, index, value, i, zIndex) {\r\n Array.from(that.$.tableContainer.querySelectorAll(`th:nth-child(${index + 1}), td:nth-child(${index + 1})`)).\r\n forEach(td => {\r\n td.style[property] = value + 'px';\r\n\r\n if (zIndex) {\r\n td.style.zIndex = 2 + i;\r\n }\r\n });\r\n }\r\n\r\n if (that.selection) {\r\n if (!rightToLeft) {\r\n frozenNear.push(0);\r\n }\r\n else {\r\n frozenFar.push(0);\r\n }\r\n\r\n selectionModifier = 1;\r\n }\r\n\r\n for (let i = 0 + selectionModifier; i < columns.length + selectionModifier; i++) {\r\n const column = columns[i - selectionModifier];\r\n\r\n if (!column.freeze) {\r\n continue;\r\n }\r\n\r\n if (!rightToLeft && column.freeze === 'far' ||\r\n rightToLeft && column.freeze !== 'far') {\r\n frozenFar.push(i);\r\n }\r\n else {\r\n frozenNear.push(i);\r\n }\r\n }\r\n\r\n if (frozenNear.length < 2 && frozenFar.length < 2) {\r\n return;\r\n }\r\n\r\n const headerCells = that.$.tableContainer.firstElementChild.querySelectorAll('th'),\r\n widths = [];\r\n\r\n for (let i = 0; i < headerCells.length; i++) {\r\n widths.push(headerCells[i].offsetWidth);\r\n }\r\n\r\n if (!rightToLeft) {\r\n for (let i = 1; i < frozenNear.length; i++) {\r\n const index = frozenNear[i];\r\n let left = 0;\r\n\r\n for (let j = 0; j < index; j++) {\r\n if (frozenNear.indexOf(j) !== -1) {\r\n left += widths[j];\r\n }\r\n }\r\n\r\n applyStyle('left', index, left, i, false);\r\n }\r\n\r\n for (let i = 0; i < frozenFar.length - 1; i++) {\r\n const index = frozenFar[i];\r\n let right = 0;\r\n\r\n for (let j = index + 1; j < widths.length; j++) {\r\n if (frozenFar.indexOf(j) !== -1) {\r\n right += widths[j];\r\n }\r\n }\r\n\r\n applyStyle('right', index, right, i, true);\r\n }\r\n\r\n return;\r\n }\r\n\r\n // right-to-left\r\n for (let i = 0; i < frozenNear.length - 1; i++) {\r\n const index = frozenNear[i];\r\n let left = 0;\r\n\r\n for (let j = index + 1; j < widths.length; j++) {\r\n if (frozenNear.indexOf(j) !== -1) {\r\n left += widths[j];\r\n }\r\n }\r\n\r\n applyStyle('left', index, left, i, true);\r\n }\r\n\r\n for (let i = 1; i < frozenFar.length; i++) {\r\n const index = frozenFar[i];\r\n let right = 0;\r\n\r\n for (let j = 0; j < index; j++) {\r\n if (frozenFar.indexOf(j) !== -1) {\r\n right += widths[j];\r\n }\r\n }\r\n\r\n applyStyle('right', index, right, i, false);\r\n }\r\n }", "static get COLUMN_WIDTH() { return _COLUMN_WIDTH; }", "renderHeader() {\r\n const hasCustomColumnsWidth = this.columnsWidth.length > 0;\r\n const dataColumns = this.getVisibleColumns().map((column) => {\r\n // filter\r\n let filter = null;\r\n if (this.showFilters) {\r\n let filterValue = '';\r\n if (this.filters && this.filters[column.name]) {\r\n filterValue = this.filters[column.name];\r\n }\r\n filter = (h(\"div\", null,\r\n h(\"kup-text-input\", { class: \"datatable-filter\", initialValue: filterValue, \"data-col\": column.name, onKetchupTextInputUpdated: (e) => {\r\n this.onFilterChange(e, column.name);\r\n } })));\r\n }\r\n // sort\r\n let sort = null;\r\n if (this.sortEnabled) {\r\n sort = (h(\"span\", { class: \"column-sort\" },\r\n h(\"span\", { role: \"button\", \"aria-label\": \"Sort column\" // TODO\r\n , class: 'mdi ' + this.getSortIcon(column.name), onClick: (e) => this.onColumnSort(e, column.name) })));\r\n }\r\n let thStyle = null;\r\n if (hasCustomColumnsWidth) {\r\n for (let i = 0; i < this.columnsWidth.length; i++) {\r\n const currentCol = this.columnsWidth[i];\r\n if (currentCol.column === column.name) {\r\n const width = currentCol.width.toString() + 'px';\r\n thStyle = {\r\n width,\r\n minWidth: width,\r\n maxWidth: width,\r\n };\r\n break;\r\n }\r\n }\r\n }\r\n const columnMenuItems = [];\r\n // adding grouping\r\n const group = this.getGroupByName(column.name);\r\n const groupLabel = group != null\r\n ? 'Disattiva raggruppamento'\r\n : 'Attiva raggruppamento';\r\n columnMenuItems.push(h(\"li\", { role: \"menuitem\", onClick: () => this.switchColumnGroup(group, column.name) },\r\n h(\"span\", { class: \"mdi mdi-book\" }),\r\n groupLabel));\r\n columnMenuItems.push(h(\"li\", { role: \"menuitem\", onClick: () => this.kupAddColumn.emit({ column: column.name }) },\r\n h(\"span\", { class: \"mdi mdi-table-column-plus-after\" }),\r\n \"Aggiungi colonna\"));\r\n let columnMenu = null;\r\n if (columnMenuItems.length !== 0) {\r\n const menuClass = this.openedMenu === column.name ? 'open' : 'closed';\r\n columnMenu = (h(\"div\", { class: `column-menu ${menuClass}` },\r\n h(\"ul\", { role: \"menubar\" }, columnMenuItems)));\r\n }\r\n // Check if columns are droppable and sets their handlers\r\n // TODO set better typing.\r\n let dragHandlers = {};\r\n if (this.enableSortableColumns) {\r\n // Reference for drag events and what they permit or not\r\n // https://html.spec.whatwg.org/multipage/dnd.html#concept-dnd-p\r\n dragHandlers = {\r\n draggable: true,\r\n onDragStart: (e) => {\r\n // Sets drag data and the type of drag\r\n e.dataTransfer.setData(KupDataTableColumnDragType, JSON.stringify(column));\r\n e.dataTransfer.effectAllowed = 'move';\r\n // Remember that the current target is different from the one print out in the console\r\n // Sets which element has started the drag\r\n e.target.setAttribute(this.dragStarterAttribute, '');\r\n this.theadRef.setAttribute(this.dragFlagAttribute, '');\r\n this.columnsAreBeingDragged = true;\r\n },\r\n onDragLeave: (e) => {\r\n if (e.dataTransfer.types.indexOf(KupDataTableColumnDragType) >= 0) {\r\n e.target.removeAttribute(this.dragOverAttribute);\r\n }\r\n },\r\n onDragOver: (e) => {\r\n if (e.dataTransfer.types.indexOf(KupDataTableColumnDragType) >= 0) {\r\n const overElement = e.target;\r\n overElement.setAttribute(this.dragOverAttribute, '');\r\n // If element can have a drop effect\r\n if (!overElement.hasAttribute(this.dragStarterAttribute) &&\r\n this.columnsAreBeingDragged) {\r\n e.preventDefault(); // Mandatory to allow drop\r\n e.dataTransfer.effectAllowed = 'move';\r\n }\r\n else {\r\n e.dataTransfer.effectAllowed = 'none';\r\n }\r\n }\r\n },\r\n onDragEnd: (e) => {\r\n // When the drag has ended, checks if the element still exists or it was destroyed by the JSX\r\n const dragStarter = e.target;\r\n if (dragStarter) {\r\n // IF it still exists, removes the attribute so that it can perform a new drag again\r\n dragStarter.removeAttribute(this.dragStarterAttribute);\r\n }\r\n this.theadRef.removeAttribute(this.dragFlagAttribute);\r\n this.columnsAreBeingDragged = false;\r\n },\r\n onDrop: (e) => {\r\n if (e.dataTransfer.types.indexOf(KupDataTableColumnDragType) >= 0) {\r\n const transferredData = JSON.parse(e.dataTransfer.getData(KupDataTableColumnDragType));\r\n e.preventDefault();\r\n e.target.removeAttribute(this.dragOverAttribute);\r\n // We are sure the tables have been dropped in a valid location -> starts sorting the columns\r\n this.handleColumnSort(column, transferredData);\r\n }\r\n },\r\n };\r\n }\r\n let columnClass = {};\r\n if (column.obj) {\r\n columnClass = {\r\n number: isNumber(column.obj),\r\n };\r\n }\r\n return (h(\"th\", Object.assign({ class: columnClass, style: thStyle, onMouseEnter: () => this.onColumnMouseEnter(column.name), onMouseLeave: () => this.onColumnMouseLeave(column.name) }, dragHandlers),\r\n h(\"span\", { class: \"column-title\" }, column.title),\r\n sort,\r\n filter,\r\n columnMenu));\r\n });\r\n let multiSelectColumn = null;\r\n if (this.multiSelection) {\r\n const style = {\r\n width: '30px',\r\n margin: '0 auto',\r\n };\r\n multiSelectColumn = (h(\"th\", { style: style },\r\n h(\"input\", { type: \"checkbox\", onChange: (e) => this.onSelectAll(e), title: `selectedRow: ${this.selectedRows.length} - renderedRows: ${this.renderedRows.length}`, checked: this.selectedRows.length > 0 &&\r\n this.selectedRows.length ===\r\n this.renderedRows.length })));\r\n }\r\n let groupColumn = null;\r\n if (this.isGrouping() && this.hasTotals()) {\r\n groupColumn = h(\"th\", null);\r\n }\r\n let actionsColumn = null;\r\n if (this.hasRowActions()) {\r\n actionsColumn = h(\"th\", null);\r\n }\r\n return [multiSelectColumn, groupColumn, actionsColumn, ...dataColumns];\r\n }", "fillupColumn() {\n let columns = this.get('columns');\n let tableWidth = this.get('_width');\n let sum = this.get('allColumnWidths');\n let tableResizeMode = this.get('tableResizeMode');\n\n if (sum !== tableWidth) {\n let delta = tableWidth - sum - 1;\n // Distribute the delta in pixel among columns according to the table fill up mode.\n if (tableResizeMode === TABLE_RESIZE_MODE_FIRST_COLUMN) {\n let [column] = columns;\n this.setColumnWidth(column, get(column, 'width') + delta);\n } else if (tableResizeMode === TABLE_RESIZE_MODE_EQUAL_COLUMN) {\n // Split delta by their proportion.\n let columnDelta = delta / columns.length;\n for (let i = 0; i < columns.length; i++) {\n let column = columns[i];\n this.setColumnWidth(column, get(column, 'width') + columnDelta);\n }\n } else if (tableResizeMode === TABLE_RESIZE_MODE_LAST_COLUMN) {\n // Add all delta to last column\n let lastColumn = columns[columns.length - 1];\n set(lastColumn, 'width', get(lastColumn, 'width') + delta);\n }\n }\n\n if (this.get('hasSubcolumns')) {\n columns.forEach((groupColumn) => {\n let subcolumns = get(groupColumn, 'subcolumns');\n if (subcolumns) {\n // Each subcolumn has equal width.\n let subcolumnWidth = get(groupColumn, 'width') / get(subcolumns, 'length');\n subcolumns.forEach((subcolumn) => {\n set(subcolumn, 'width', subcolumnWidth);\n });\n }\n });\n }\n }", "function adjustColumnWidths(allColumns, expectedWidth) {\n if (allColumns === void 0) { allColumns = []; }\n // if (allColumns && allColumns.length) {\n // allColumns = allColumns.filter(c => c.visible && !c.hidden);\n // }\n var hiddenColumns = [];\n allColumns.forEach(function (col) {\n col.hidden = false;\n var width = calcRealWidth(col);\n if (width !== null && width < 10) {\n hiddenColumns.push(col);\n col.hidden = true;\n if (!col.$$oldWidth) {\n col.$$oldWidth = col.width;\n }\n col.width = 0;\n }\n });\n allColumns = allColumns.filter(function (c) { return c.visible && !c.hidden; });\n var columnsWidth = (0, column_1.columnsTotalWidth)(allColumns);\n var totalFlexGrow = getTotalFlexGrow(allColumns);\n var colsByGroup = (0, column_1.columnsByPin)(allColumns);\n if (columnsWidth !== expectedWidth) {\n scaleColumns(colsByGroup, expectedWidth, totalFlexGrow);\n }\n}", "function fitColumnsWidth(gridTable) {\r\n\t\tvar opts = $d(gridTable, \"datagrid\").options;\r\n\t\tvar dc = $d(gridTable, \"datagrid\").dc;\r\n\r\n\t\tif (!opts.fitColumns) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar $view2Header = $c(\"div.datagrid-header\", dc.view2);\r\n\t\tvar fixedColumnsWidth = 0;\r\n\t\tvar lastColumn;\r\n\t\tvar fields = getColumnFields(gridTable, false);\r\n\t\tfor ( var i = 0; i < fields.length; i++) {\r\n\t\t\tvar col = getColumnOption(gridTable, fields[i]);\r\n\t\t\tif (_isFixedColumn(col)) {\r\n\t\t\t\tfixedColumnsWidth += col.width;\r\n\t\t\t\tlastColumn = col;\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar $view2HeaderInner = $c(\"div.datagrid-header-inner\", $view2Header).show();\r\n\t\tvar usableWidth = $w($view2Header) - $w($f(\"table\", $view2Header)) - opts.scrollbarSize;\r\n\t\tvar rate = usableWidth / fixedColumnsWidth;\r\n\t\tif (!opts.showHeader) {\r\n\t\t\t$view2HeaderInner.hide();\r\n\t\t}\r\n\t\tfor ( var i = 0; i < fields.length; i++) {\r\n\t\t\tvar col = getColumnOption(gridTable, fields[i]);\r\n\t\t\tif (_isFixedColumn(col)) {\r\n\t\t\t\tvar adjustWidth = Math.floor(col.width * rate);\r\n\t\t\t\t_adjustColumnWidth(col, adjustWidth);\r\n\t\t\t\tusableWidth -= adjustWidth;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (usableWidth && lastColumn) {\r\n\t\t\t_adjustColumnWidth(lastColumn, usableWidth);\r\n\t\t}\r\n\t\tfixColumnSize(gridTable);\r\n\r\n\t\tfunction _adjustColumnWidth(col, width) {\r\n\t\t\tcol.width += width;\r\n\t\t\tcol.boxWidth += width;\r\n\t\t\t$w(col.boxWidth, $f('td[field=\"' + col.field + '\"] div.datagrid-cell', $view2Header));\r\n\t\t}\r\n\r\n\t\tfunction _isFixedColumn(col) {\r\n\t\t\tif (!col.hidden && !col.checkbox && !col.auto) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}", "preservesDesiredColumn() {\n return false;\n }", "function _fnAjustColumnSizing(oSettings) {\n\t\t\t/*\n\t\t\t * Not interested in doing column width calculation if autowidth is\n\t\t\t * disabled\n\t\t\t */\n\t\t\tif (oSettings.oFeatures.bAutoWidth === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t_fnCalculateColumnWidths(oSettings);\n\t\t\tfor (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n\t\t\t\toSettings.aoColumns[i].nTh.style.width = oSettings.aoColumns[i].sWidth;\n\t\t\t}\n\t\t}", "col() {\n let element = document.createElement('div'),\n elementSortHelper = document.createElement('div');\n\n element.setAttribute('class', 'col col-editable');\n element.setAttribute('data-boxtype', 'col');\n element.setAttribute('data-colnum', 'auto');\n element.setAttribute('data-boxalign', 'center');\n\n element.classList.add('col-editable-initial');\n\n elementSortHelper.setAttribute('class', 'element-sort-helper-col');\n element.appendChild(elementSortHelper);\n\n return element;\n }", "function chooseColumnsToView(selectedCol){\n\t\n\t // find the grid\n\t var grid = dijit.byId(\"grid\");\n\t \n\t var z;\n\t var zz;\n\t \n\t for (z in grid.layout.cells) {\n\t \tif (grid.layout.cells[z].field === \"datetime\") {\n\t \t\tgrid.layout.setColumnVisibility(z, selectedCol.timestamp.length !== 0);\n\t \t} else if (grid.layout.cells[z].field === \"threadid\") {\n\t \t\tgrid.layout.setColumnVisibility(z,selectedCol.threadid.length !== 0);\t \t\t\n\t \t} else if (grid.layout.cells[z].field === \"logger\") {\n\t \t\tgrid.layout.setColumnVisibility(z, selectedCol.logger.length !== 0);\n\t \t} else if (grid.layout.cells[z].field === \"event\") {\t \t\t\n\t \t\tgrid.layout.setColumnVisibility(z, selectedCol.event.length !== 0);\n\t \t} else if (grid.layout.cells[z].field === \"message\") {\t \t\t\n\t \t\tgrid.layout.setColumnVisibility(z, selectedCol.message.length !== 0);\n\t \t\tif(grid.layout.cells[z].hidden) {\n for (zz in grid.layout.cells) {\n if (grid.layout.cells[zz].field === \"logger\") {\n grid.layout.cells[zz].width = '60em';\n }\n }\n } else {\n for (zz in grid.layout.cells) {\n if (grid.layout.cells[zz].field === \"logger\") {\n grid.layout.cells[zz].width = '55px';\n }\n }\n \t\n }\n\t \t} \n\t \t\n\t }\n\t \n\t}", "computeWidth () {\n this.div.style.width = 'auto'\n this.column.style.width = 'auto'\n\n var width = stringMeter.width(this.name, 12, 'Roboto-Medium')\n + 44 // padding with fix button\n + 28 // padding without fix button\n + 66 // sortDiv\n + 1 // error\n\n for (var p = 0, lp = this.pcm.products.length; p < lp; p++) {\n var divWidth = stringMeter.width(this.pcm.products[p].cellsByFeatureId[this.id].div.innerText, 13, 'Roboto-Regular') + 56 + 1 // 56 = padding, 1 for error\n if (divWidth > width) width = divWidth\n }\n\n this.div.style.width = width + 'px'\n this.column.style.width = width + 'px'\n }", "function getColumns() {\n if (countCols() === 4) {\n return [\n {'targets': 0, 'orderable': true},\n {'targets': 1, 'orderable': false},\n {'targets': 2, 'orderable': false, 'width': '120px', 'className': 'operation-column'},\n {'targets': 3, 'orderable': false, 'searchable': false, 'width': '73px', 'className': 'operation-column'}\n ];\n } else {\n return [\n {'targets': 0, 'orderable': true},\n {'targets': 1, 'orderable': false},\n {'targets': 2, 'orderable': false, 'width': '120px', 'className': 'operation-column'}\n ];\n }\n}", "fixWidths() {\n const me = this,\n { element, header, footer } = me;\n\n if (me.flex) {\n header.flex = me.flex;\n if (footer) {\n footer.flex = me.flex;\n }\n element.style.flex = me.flex;\n } else {\n // If width is calculated and no column is using flex, check if total width is less than width. If so,\n // recalculate width and bail out of further processing (since setting width will trigger again)\n if (\n me.hasCalculatedWidth &&\n !me.columns.some((col) => !col.hidden && col.flex) &&\n me.totalFixedWidth !== me.width\n ) {\n me.width = me.totalFixedWidth;\n // Setting width above clears the hasCalculatedWidth flag, but we want to keep it set to react correctly\n // next time\n me.hasCalculatedWidth = true;\n return;\n }\n\n let totalWidth = me.width;\n\n if (!totalWidth) {\n totalWidth = 0;\n\n // summarize column widths, needed as container width when not using flex widths and for correct\n // overflow check in Edge\n for (let col of me.columns) {\n if (!col.flex && !col.hidden) totalWidth += col.width;\n }\n }\n\n // rows are absolutely positioned, meaning that their width won't affect container width\n // hence we must set it, if not using flex\n element.style.width = `${totalWidth}px`;\n\n header.width = totalWidth;\n if (footer) {\n footer.width = totalWidth;\n }\n }\n\n me.syncScrollingPartners(false);\n }", "renderContent(comps) {\n let row = this,\n cols = [],\n colName = row.props.id + '-col-';\n lodash.forEach(comps, (comp, i) => {\n let { ISResizer } = inlineStyles,\n colId = colName + i,\n resizerId = colId + '-handler',\n colWidth = comp.props.colWidth || null;\n if ( (i > 0) && row.props.resizable === 'true' ) {\n cols.push(row.addResizer(resizerId, colName, i));\n }\n cols.push(row.addColumn(colId, colWidth, comp));\n });\n return cols;\n }", "function xColEqualizer()\r\n{\r\n var i, j, h = [];\r\n // get heights of columns' child elements\r\n for (i = 1, j = 0; i < arguments.length; i += 2, ++j)\r\n {\r\n h[j] = xHeight(arguments[i]);\r\n }\r\n h.sort(d);\r\n // set heights of column elements\r\n for (i = 0; i < arguments.length; i += 2)\r\n {\r\n xHeight(arguments[i], h[0]);\r\n }\r\n return h[0];\r\n // for a descending sort\r\n function d(a,b)\r\n {\r\n return b-a;\r\n }\r\n}", "function matchCellWidths(els){var maxInnerWidth=0;els.find('> *').each(function(i,innerEl){var innerWidth=$(innerEl).outerWidth();if(innerWidth>maxInnerWidth){maxInnerWidth=innerWidth;}});maxInnerWidth++;// sometimes not accurate of width the text needs to stay on one line. insurance\nels.width(maxInnerWidth);return maxInnerWidth;}", "_applySortableFields(fields) {\n if (fields && fields.length) {\n let sortableCols = fields.replace(/ /g, \"\").split(',');\n sortableCols.forEach((f)=>{\n let column = this.cols.filter(obj => {\n return obj.id === f;\n });\n column[0].sortable = true;\n });\n }\n }", "fixWidths() {\n const me = this,\n {\n element,\n header,\n footer\n } = me;\n\n if (!me.collapsed) {\n if (me.flex) {\n header.flex = me.flex;\n\n if (footer) {\n footer.flex = me.flex;\n }\n\n element.style.flex = me.flex;\n } else {\n // If width is calculated and no column is using flex, check if total width is less than width. If so,\n // recalculate width and bail out of further processing (since setting width will trigger again)\n if (me.hasCalculatedWidth && !me.columns.some(col => !col.hidden && col.flex) && me.totalFixedWidth !== me.width) {\n me.width = me.totalFixedWidth; // Setting width above clears the hasCalculatedWidth flag, but we want to keep it set to react correctly\n // next time\n\n me.hasCalculatedWidth = true;\n return;\n }\n\n let totalWidth = me.width;\n\n if (!totalWidth) {\n totalWidth = 0; // summarize column widths, needed as container width when not using flex widths and for correct\n // overflow check in Edge\n\n for (const col of me.columns) {\n if (!col.flex && !col.hidden) totalWidth += col.width;\n }\n } // rows are absolutely positioned, meaning that their width won't affect container width\n // hence we must set it, if not using flex\n\n element.style.width = `${totalWidth}px`;\n header.width = totalWidth;\n\n if (footer) {\n footer.width = totalWidth;\n }\n }\n\n me.syncScrollingPartners(false);\n }\n }", "lineupGetColumnWidth (name, col, fixed) {\n let width = col.width || 0;\n let colname = col.column || col.type;\n /* Get the column scaling based on the user settings, if available */\n if (this.lineupColumns && this.lineupColumns[name] && this.lineupColumns[name][colname]) {\n width = this.lineupColumns[name][colname] + fixed;\n }\n let colWidth = width < fixed ? 0 : (width - fixed);\n if (col === 'rank') { /* defined in LineUp */\n colWidth = this.lineupRankWidth;\n }\n col.widthBasis = colWidth;\n col.widthFixed = fixed;\n return col.widthBasis;\n }", "groupedColumns(type) {\n return this._cache('groupedColumns', () => {\n const _groupColumns = (columns, currentRow = 0, parentColumn = {}, rows = []) => {\n // track how many rows we got\n rows[currentRow] = rows[currentRow] || [];\n const grouped = [];\n const setRowSpan = column => {\n const rowSpan = rows.length - currentRow;\n if (column &&\n !column.children && // parent columns are supposed to be one row\n rowSpan > 1 &&\n (!column.rowSpan || column.rowSpan < rowSpan)\n ) {\n column.rowSpan = rowSpan;\n }\n };\n columns.forEach((column, index) => {\n let defaultOpt= {\n ifshow:true\n }\n if(!this.originWidth){\n defaultOpt.width = 200\n }\n //获取非固定列\n if(type=='nofixed' && column.fixed){\n return false;\n }\n const newColumn = { ...defaultOpt,...column };\n rows[currentRow].push(newColumn);\n parentColumn.colSpan = parentColumn.colSpan || 0;\n if (newColumn.children && newColumn.children.length > 0) {\n newColumn.children = _groupColumns(newColumn.children, currentRow + 1, newColumn, rows);\n parentColumn.colSpan = parentColumn.colSpan + newColumn.colSpan;\n } else {\n parentColumn.colSpan++;\n }\n // update rowspan to all same row columns\n for (let i = 0; i < rows[currentRow].length - 1; ++i) {\n setRowSpan(rows[currentRow][i]);\n }\n // last column, update rowspan immediately\n if (index + 1 === columns.length) {\n setRowSpan(newColumn);\n }\n grouped.push(newColumn);\n });\n return grouped;\n };\n return _groupColumns(this.columns);\n });\n }", "function updateColumns(e) {\n\t\tvar offset = parseInt(document.querySelector('input[name=\"filter_acct\"]:checked').value) + \n\t\t\tparseInt(document.querySelector('input[name=\"filter_rare\"]:checked').value);\n\t\t\n\t\tfor (var i = 0; i < 8; i++) {\n\t\t\tvar c = document.getElementsByClassName(\"cost_\" + i);\n\t\t\tfor(var j = 0; j < c.length; j++){\n\t\t\t\tif (i === offset || i === offset + 1) {\n\t\t\t\t\tc[j].style.display = \"table-cell\";\n\t\t\t\t} else {\n\t\t\t\t\tc[j].style.display = \"none\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tupdateDescription();\n\t}", "function columnize($putInHere, $pullOutHere, $parentColumn, height){\n while($parentColumn.height() < height &&\n $pullOutHere[0].childNodes.length){\n $putInHere.append($pullOutHere[0].childNodes[0]);\n }\n if($putInHere[0].childNodes.length == 0) return;\n\n // now we're too tall, undo the last one\n var kids = $putInHere[0].childNodes;\n var lastKid = kids[kids.length-1];\n $putInHere[0].removeChild(lastKid);\n var $item = jQuery(lastKid);\n\n\n if($item[0].nodeType == 3){\n // it's a text node, split it up\n var oText = $item[0].nodeValue;\n var counter2 = options.width / 18;\n if(options.accuracy)\n counter2 = options.accuracy;\n var columnText;\n var latestTextNode = null;\n while($parentColumn.height() < height && oText.length){\n if (oText.indexOf(' ', counter2) != '-1') {\n columnText = oText.substring(0, oText.indexOf(' ', counter2));\n } else {\n columnText = oText;\n }\n latestTextNode = document.createTextNode(columnText);\n $putInHere.append(latestTextNode);\n\n if(oText.length > counter2){\n oText = oText.substring(oText.indexOf(' ', counter2));\n }else{\n oText = \"\";\n }\n }\n if($parentColumn.height() >= height && latestTextNode != null){\n // too tall :(\n $putInHere[0].removeChild(latestTextNode);\n oText = latestTextNode.nodeValue + oText;\n }\n if(oText.length){\n $item[0].nodeValue = oText;\n }else{\n return false; // we ate the whole text node, move on to the next node\n }\n }\n\n if($pullOutHere.children().length){\n $pullOutHere.prepend($item);\n }else{\n $pullOutHere.append($item);\n }\n\n return $item[0].nodeType == 3;\n }", "function _fnAjustColumnSizing ( oSettings )\n\t\t{\n\t\t\t/* Not interested in doing column width calculation if autowidth is disabled */\n\t\t\tif ( oSettings.oFeatures.bAutoWidth === false )\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\t_fnCalculateColumnWidths( oSettings );\n\t\t\tfor ( var i=0 , iLen=oSettings.aoColumns.length ; i<iLen ; i++ )\n\t\t\t{\n\t\t\t\toSettings.aoColumns[i].nTh.style.width = oSettings.aoColumns[i].sWidth;\n\t\t\t}\n\t\t}", "innerWidthDependsOnChilds(){if(this.__controlStretchedWidth)return!0;if(this.__columnOptions)for(const columnOption of this.__columnOptions)if(\"Content\"===columnOption.widthMode)return!0;return super.innerWidthDependsOnChilds()}", "generateColumns() {\r\n this.columns = _(this.getColumns())\r\n .map(this.getColumnOptions)\r\n .filter(\r\n o => {\r\n return _.isFunction(o.hidden) ? !o.hidden(o) : !o.hidden;\r\n }\r\n )\r\n .sortBy([\r\n o => {\r\n return _.isFunction(o.order) ? o.order(o) : o.order;\r\n }\r\n ])\r\n .value();\r\n\r\n this.fireSlimGridEvent(\"onColumnsGenerated\", {});\r\n }", "function calibrateColWidth() {\r\n\t\t\t\t\r\n\tvar table = $.fn.dataTable.fnTables(true); // true = visible tables only\r\n\tif ( table.length > 0 ) {\r\n\t\t$(table).dataTable().fnAdjustColumnSizing(false); // fixes all tables\r\n\t}\r\n\r\n\tvar ttInstances = TableTools.fnGetMasters(); // Buttons needs resizing too\r\n\tfor (i in ttInstances) {\r\n\t\tif (ttInstances[i].fnResizeRequired()) ttInstances[i].fnResizeButtons();\r\n\t}\r\n}", "function colWidths(rows) {\n return rows[0].map((_, i) => {\n return rows.reduce((max, row) => {\n return Math.max(max, row[i].minWidth());\n }, 0);\n });\n}", "columns(defaultCol) {\n\t\treturn (this.width ? this.width : defaultCol);\n\t}", "applyWidth() {\n var columns = this.template.querySelectorAll('.dynamicColumn');\n for (var i = 0; i < columns.length; i++) {\n columns[i].style.width = this.percentage + \"%\";\n //columns[i].style.display = \"inline\";\n columns[i].style.textAlign = \"center\";\n //columns[i].style.border = \"1px solid #4CAF50\";\n }\n }", "_calcColumnWidths() {\n if (!this._container) {\n return;\n }\n\n const columnWidths = Array.prototype.slice.call(this._container.querySelectorAll('.md-panel-header'))\n .reduce((maxes, row) => {\n const columns = row.querySelectorAll('.md-panel-column');\n for (let i = 0; i < columns.length; i++) {\n // Only need to include the offsetWidth of the column because the child will really\n // determine the width of the column. Since it has already been defined at this point,\n // no additional work needs to be done.\n maxes[i] = Math.max(\n columns[i].offsetWidth,\n maxes[i] || 0\n );\n }\n\n return maxes;\n }, [0]);\n\n this.setState({ columnWidths });\n }", "function setWidths(evt) {\n let newColWidth = (resize.colStartWidth + evt.clientX - resize.startX),\n newSibWidth = (resize.sibStartWidth - evt.clientX + resize.startX),\n numToPercentString = (num) => {\n return num.toString() + '%';\n },\n percent = (width) => {\n return (width / resize.rowWidth * 100);\n },\n colWidthPercent = percent(newColWidth),\n sibWidthPercent = percent(newSibWidth);\n\n column.dataset.colWidth = numToPercentString(Math.round(colWidthPercent));\n sibling.dataset.colWidth = numToPercentString(Math.round(sibWidthPercent));\n\n column.style.width = numToPercentString(colWidthPercent);\n sibling.style.width = numToPercentString(sibWidthPercent);\n }", "fixCellWidths() {\n const me = this;\n let hasFlex = false,\n flexBasis; // single header \"cell\"\n\n me.columns.traverse(column => {\n const cellEl = me.getBarCellElement(column.id),\n domWidth = DomHelper.setLength(column.width),\n domMinWidth = DomHelper.setLength(column.minWidth);\n\n if (cellEl) {\n // We have to work round the IE11 bug that flex-basis affects the content-box\n // and any padding is added as extra.\n // TODO: Remove this when IE11 retires.\n if (BrowserHelper.isIE11) {\n flexBasis = `calc(${domWidth} - ${me.getLrPadding(cellEl)}px)`;\n } else {\n flexBasis = domWidth;\n }\n\n hasFlex = hasFlex || Boolean(column.flex); // Parent column without any specified width and flex should have flex calculated if any child has flex\n\n if (column.isParent && column.width == null && column.flex == null) {\n const flex = column.children.reduce((result, child) => result += !child.hidden && child.flex || 0, 0); // Do not want to store this flex value on the column since it is always calculated\n\n cellEl.style.flex = flex > 0 ? `${flex} 0 auto` : '';\n\n if (flex > 0) {\n // TODO: Figure out a better way of handling this, minWidth on the columns breaks the flexbox\n // calculation compared to cells, making them misalign\n column.traverse(col => col.data.minWidth = null);\n }\n } // Normal case, set flex, width etc.\n else {\n if (parseInt(column.minWidth) >= 0) {\n cellEl.style.minWidth = domMinWidth;\n } // Clear all the things we might have to set to correct cell widths\n\n cellEl.style.flex = cellEl.style.flexBasis = cellEl.style.width = '';\n\n if (column.flex) {\n // If column has children we need to give it\n // flex-shrink: 0, flex-basis: auto so that it always\n // shrinkwraps its children without shrinking\n if (!isNaN(parseInt(column.flex)) && column.children) {\n cellEl.style.flex = `${column.flex} 0 auto`;\n } else {\n cellEl.style.flex = column.flex;\n }\n } else if (parseInt(column.width) >= 0) {\n const parent = column.parent; // Only grid header bar has a notion of group headers\n // Column is a child of an unwidthed group. We have to use width\n // to stretch it.\n\n if (me.isHeader && !parent.isRoot && !parent.width) {\n cellEl.style.width = domWidth;\n } else {\n // https://app.assembla.com/spaces/bryntum/tickets/8041\n // Column header widths must be set using flex-basis.\n // Using width means that wide widths cause a flexed SubGrid\n // to bust the flex rules.\n // TODO: When IE11 retires, remove calc() hacks to overcome its flexbox bugs.\n // Note that grid in Grid#onColumnsResized and SubGrid#fixCellWidths,\n // cells MUST still be sized using width since rows\n // are absolutely positioned and will not cause the busting out\n // problem, and rows will not stretch to shrinkwrap the cells\n // unless they are widthed with width.\n cellEl.style.flexBasis = flexBasis;\n }\n }\n }\n\n if (column.height >= 0) {\n cellEl.style.height = DomHelper.setLength(column.height);\n }\n }\n });\n me.element.classList[hasFlex ? 'add' : 'remove']('b-has-flex');\n }", "function default_col2x(default_col2x) {\r\n\t\t\t//var col_count = $('.r-w-g').length;\r\n\t\t\t//if (parseInt(col_count) == 2) {\r\n\t\t\tvar col_count = $('.round-domestk').length;\r\n\t\t\tif (parseInt(col_count) >= 1) {\r\n\t\t\t\t$('#clone-list-container').addClass('hide');\r\n\t\t\t\t$('#multi-flight-summary-container').removeClass('hide');\r\n\t\t\t\tupdate_col2x_flight($('#t-w-i-1 .r-r-i:first'), 't-w-i-1');\r\n\t\t\t\tupdate_col2x_flight($('#t-w-i-2 .r-r-i:first'), 't-w-i-2');\r\n\t\t\t} else {\r\n\t\t\t\t//remove double filter\r\n\t\t\t\t$('#top-sort-list-wrapper #top-sort-list-2').remove();\r\n\t\t\t\t$('#top-sort-list-wrapper').removeClass('addtwofilter');\r\n\t\t\t}\r\n\t\t}", "function columnize(\n $putInHere, $pullOutHere, $parentColumn, targetHeight) {\n //\n // add as many nodes to the column as we can,\n // but stop once our height is too tall\n while ((manualBreaks || $parentColumn.height() < targetHeight) &&\n $pullOutHere[0].childNodes.length) {\n var node = $pullOutHere[0].childNodes[0];\n //\n // Because we're not cloning, jquery will actually move the element\"\n // http://welcome.totheinter.net/2009/03/19/the-undocumented-life-of-jquerys-append/\n if ($(node).find(prefixTheClassName('columnbreak', true)).length) {\n //\n // our column is on a column break, so just end here\n return;\n }\n if ($(node).hasClass(prefixTheClassName('columnbreak'))) {\n //\n // our column is on a column break, so just end here\n return;\n }\n appendSafe($putInHere, $(node));\n }\n if ($putInHere[0].childNodes.length === 0) return;\n\n // now we're too tall, so undo the last one\n var kids = $putInHere[0].childNodes;\n var lastKid = kids[kids.length - 1];\n $putInHere[0].removeChild(lastKid);\n var $item = $(lastKid);\n\n // now lets try to split that last node\n // to fit as much of it as we can into this column\n if ($item[0].nodeType == 3) {\n // it's a text node, split it up\n var oText = $item[0].nodeValue;\n var counter2 = options.width / 18;\n if (options.accuracy)\n counter2 = options.accuracy;\n var columnText;\n var latestTextNode = null;\n while ($parentColumn.height() < targetHeight && oText.length) {\n //\n // it's been brought up that this won't work for chinese\n // or other languages that don't have the same use of whitespace\n // as english. This will need to be updated in the future\n // to better handle non-english languages.\n //\n // https://github.com/adamwulf/Columnizer-jQuery-Plugin/issues/124\n var indexOfSpace = oText.indexOf(' ', counter2);\n if (indexOfSpace != -1) {\n columnText = oText.substring(0, indexOfSpace);\n } else {\n columnText = oText;\n }\n latestTextNode = document.createTextNode(columnText);\n appendSafe($putInHere, $(latestTextNode));\n\n if (oText.length > counter2 && indexOfSpace != -1) {\n oText = oText.substring(indexOfSpace);\n } else {\n oText = '';\n }\n }\n if ($parentColumn.height() >= targetHeight && latestTextNode !==\n null) {\n // too tall :(\n $putInHere[0].removeChild(latestTextNode);\n oText = latestTextNode.nodeValue + oText;\n }\n if (oText.length) {\n $item[0].nodeValue = oText;\n } else {\n return false; // we ate the whole text node, move on to the next node\n }\n }\n\n if ($pullOutHere.contents().length) {\n $pullOutHere.prepend($item);\n } else {\n appendSafe($pullOutHere, $item);\n }\n\n return $item[0].nodeType == 3;\n }", "function setVarianceTypeIconColumnWidths() {\n var maxVarianceIconCount = 0;\n $.each($(\".pageRow\"), function () {\n var iconCount = $(this).children(\".details\").children(\".varianceTypeIcon\").children(\"img\").size();\n if (iconCount > maxVarianceIconCount) {\n maxVarianceIconCount = iconCount;\n }\n });\n\n var $pageRows = $(\".pageRow\");\n $.each($pageRows.children(\".details\").children(\".varianceTypeIcon\"), function () {\n $(this).css(\"width\", maxVarianceIconCount * varianceIconWidth);\n });\n\n $.each($pageRows.children(\".pageRowChild\").children(\".details\").children(\".varianceTypeIcon\"), function () {\n $(this).css(\"width\", ((maxVarianceIconCount + 1) * varianceIconWidth) + 2);\n });\n }", "function syncFields(){\r\n var cm = grid.getColumnModel();\r\n ntTitle.setSize(cm.getColumnWidth(1)-2);\r\n ntCat.setSize(cm.getColumnWidth(2)-4);\r\n ntDue.setSize(cm.getColumnWidth(3)-4);\r\n }", "__$$getHeaderColumns() {\n\t\tconst thead = _.chain(arrify(this.props.children))\n\t\t\t.filter(c => c.type == 'thead')\n\t\t\t.last()\n\t\t\t.value() || <thead></thead>\n\n\t\tconst theadRow = _.chain(arrify(thead.props.children))\n\t\t\t.filter(c => c.type == 'tr')\n\t\t\t.last()\n\t\t\t.value() || <tr></tr>\n\n\t\tconst headerColumns = _.chain(arrify(theadRow.props.children))\n\t\t\t.filter(c => c.type == 'th' || c.type == 'td')\n\t\t\t.value()\n\t\t\t.slice() // copy\n\n\t\theaderColumns.splice(0, 0, <th key=\"selectable-table-checkbox\" style={{ textAlign: 'left' }}>\n\t\t\t<input ref=\"headerCheckbox\" type=\"checkbox\" checked={_.some(this.state.selected)} onClick={this.__$$onSelectAll.bind(this)} />\n\t\t</th>)\n\t\treturn headerColumns\n\t}", "function colWidths(rows) {\n return rows[0].map(function(_, i) {\n return rows.reduce(function(max, row) {\n return Math.max(max, row[i].minWidth());\n }, 0);\n });\n}", "function colWidths(rows) {\n return rows[0].map(function(_, i) {\n return rows.reduce(function(max, row) {\n return Math.max(max, row[i].minWidth());\n }, 0);\n });\n}", "function colWidths(rows) {\n return rows[0].map(function(_, i) {\n return rows.reduce(function(max, row) {\n return Math.max(max, row[i].minWidth());\n }, 0);\n });\n}", "function adjustColumnWidths(allColumns, expectedWidth) {\r\n var columnsWidth = column_1.columnsTotalWidth(allColumns);\r\n var totalFlexGrow = getTotalFlexGrow(allColumns);\r\n var colsByGroup = column_1.columnsByPin(allColumns);\r\n if (columnsWidth !== expectedWidth) {\r\n scaleColumns(colsByGroup, expectedWidth, totalFlexGrow);\r\n }\r\n}", "function setupColResizing($table) {\n\t// var count = $table.find ('td').length;\n\t// $table.find ('td').each (function(){\n\t// \t$(this).percentWidth (100.0/count);\n\t// });\n\n\t// if($table.data('x2-gridResizing') !== undefined) {\n\t\t// $table.gridResizing(\"destroy\");\n\t// }\n\t// $table.gridResizing({\n\t\t// onResize:function(){ window.layoutChanged = true; },\n\t// });\n\t$table.colResizable({disable:true})\t// remove old colResizable class, if it exists\n\t\t.colResizable({\n\t\t\tliveDrag:true,\n\t\t\tdraggingClass:'colResizableDragging',\n\t\t\tonResize:function() { \n\t\t\t\twindow.layoutChanged = true; \n\t\t\t}\n\t\t});\n}", "filterRows(r) {\n rows = [];\n if (arguments.length) {\n each(r, function(i) {\n rows.push(origRows[i]);\n });\n } else {\n rows = origRows.slice(0);\n }\n column.length = rows.length;\n // invalidate valueRange and total\n valueRange = sum = mean = median = undefined;\n return column;\n }", "function syncFields(){\n var cm = grid.getColumnModel();\n ntTitle.setSize(cm.getColumnWidth(1)-2);\n ntCat.setSize(cm.getColumnWidth(2)-4);\n ntDue.setSize(cm.getColumnWidth(3)-4);\n }", "_configureColumnHeader (column) {\n if (column.action) {\n return column.title;\n }\n var result = [];\n /*var filterView;\n for (var type in this.dataTypeToFilterTypeMapping) {\n if (type === column.dataType) {\n filterView = this.dataTypeToFilterTypeMapping[type];\n }\n }*/\n\n /*if (column.groupText) {\n result[0] = { content:\"columnGroup\", closed:true, batch: column.batch, groupText: column.groupText, colspan:12};\n }*/\n result[result.length] = column.title;\n\n return result;\n }", "function fixColumnSize(target, field, state) {\n if (!state) state = $.data(target, 'datagrid');\n var dc = state.dc;\n var table = dc.view.find('table.datagrid-btable,table.datagrid-ftable');\n table.css('table-layout', 'fixed');\n if (field) {\n fix(target, state, field);\n } else {\n var ff = getColumnFields(target, true, state).concat(getColumnFields(target, false, state));\t// get all fields\n for (var i = 0; i < ff.length; i++) {\n fix(target, state, ff[i]);\n }\n }\n table.css('table-layout', 'auto');\n fixMergedSize(target, state);\n\n var gridId = $(target).attr('id');\n setTimeout(function () {\n var target = $('#' + gridId)[0];\n var state = $.data(target, 'datagrid');\n fixRowHeight(target, undefined, undefined, state);\n fixEditableSize(target, state);\n }, 0);\n\n function fix(target, state, field) {\n var dc = state.dc;\n var col = getColumnOption(target, field, state);\n if (col.checkbox) return;\n\n var style = dc.view.children('style')[0];\n var styleSheet = style.styleSheet ? style.styleSheet : (style.sheet || document.styleSheets[document.styleSheets.length - 1]);\n var rules = styleSheet.cssRules || styleSheet.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule = rules[i];\n if (rule.selectorText.toLowerCase() == col.cellSelector.toLowerCase()) {\n rule.style['width'] = col.boxWidth ? col.boxWidth + 'px' : 'auto';\n break;\n }\n }\n }\n }", "function fixme() {\n var table = $.fn.dataTable.fnTables();\n if ( table.length > 0 ) {\n setTimeout(function () {\n for(var i=0;i<table.length;i++){\n $(table[i]).dataTable().fnAdjustColumnSizing();\n }\n }, 200);\n }\n }", "renderRows() {\n let tableHtml = '';\n let tableHtmlLeft = '';\n let tableHtmlRight = '';\n let j = 0;\n const self = this;\n const s = self.settings;\n const body = self.table.find('tbody');\n let activePage = 1;\n if (self.pagerAPI) {\n const pagerState = self.pagerAPI.state;\n if (pagerState.filteredActivePage) {\n activePage = pagerState.filteredActivePage;\n } else {\n activePage = pagerState.activePage;\n }\n }\n self.bodyColGroupHtmlLeft = '<colgroup>';\n self.bodyColGroupHtml = '<colgroup>';\n self.bodyColGroupHtmlRight = '<colgroup>';\n self.triggerDestroyCell(); // Trigger Destroy on previous cells\n\n if (!self.settings.columns || self.settings.columns.length === 0) {\n self.settings.columns.push({ id: 'blank', value: '', field: '' });\n }\n\n this.currentPageRows = [];\n\n for (j = 0; j < self.settings.columns.length; j++) {\n const col = self.settings.columns[j];\n const container = self.getContainer(col.id);\n const colWidth = self.columnWidth(col, j);\n\n switch (container) {\n case 'left':\n self.bodyColGroupHtmlLeft += `<col${colWidth}${col.hidden ? ' class=\"is-hidden\"' : ''}></col>`;\n break;\n case 'right':\n self.bodyColGroupHtmlRight += `<col${colWidth}${col.hidden ? ' class=\"is-hidden\"' : ''}></col>`;\n break;\n default:\n self.bodyColGroupHtml += `<col${colWidth}${col.hidden ? ' class=\"is-hidden\"' : ''}></col>`;\n }\n\n if (col.colspan) {\n self.hasColSpans = true;\n }\n }\n\n // Prevent flashing message area on filter / reload\n if (self.emptyMessageContainer) {\n self.emptyMessageContainer.hide();\n }\n\n if (body.length === 0) {\n if (self.hasLeftPane) {\n self.tableBodyLeft = $('<tbody role=\"rowgroup\"></tbody>');\n self.tableLeft.append(self.tableBodyLeft);\n }\n self.tableBody = $('<tbody role=\"rowgroup\"></tbody>');\n self.table.append(self.tableBody);\n if (self.hasRightPane) {\n self.tableBodyRight = $('<tbody role=\"rowgroup\"></tbody>');\n self.tableRight.append(self.tableBodyRight);\n }\n }\n\n self.groupArray = [];\n\n self.recordCount = 0;\n self.filteredCount = 0;\n self.runningCount = 0;\n\n // Reset recordCount for paging\n if (s.treeGrid && s.paging && !s.source && activePage > 1) {\n self.recordCount = s.treeRootNodes[(s.pagesize * activePage) - s.pagesize].idx - 1;\n }\n\n if (this.restoreSortOrder) {\n this.sortDataset();\n }\n let rowStatusTooltip = false;\n\n if (self.originalDataset && (!s.groupable && s.dataset.length > 0)) {\n s.dataset = self.originalDataset;\n }\n\n for (let i = 0; i < s.dataset.length; i++) {\n // For better performance dont render out of page\n if (s.paging && !s.source) {\n if (activePage === 1 && (i - this.filteredCount) >= s.pagesize) {\n if (!s.dataset[i]._isFilteredOut) {\n this.recordCount++;\n } else {\n this.filteredCount++;\n }\n continue; //eslint-disable-line\n }\n\n if (activePage > 1 && !((i - this.filteredCount) >= s.pagesize * (activePage - 1) &&\n (i - this.filteredCount) < s.pagesize * activePage)) {\n if (!s.dataset[i]._isFilteredOut) {\n if (this.filteredCount) {\n this.recordCount++;\n }\n } else {\n this.filteredCount++;\n }\n continue; //eslint-disable-line\n }\n }\n\n if (s.virtualized) {\n if (!this.isRowVisible(this.recordCount)) {\n this.recordCount++;\n continue; //eslint-disable-line\n }\n }\n\n // Exclude Filtered Rows\n if ((!s.treeGrid && s.dataset[i])._isFilteredOut) {\n this.filteredCount++;\n continue; //eslint-disable-line\n }\n\n // Handle Grouping\n if (this.settings.groupable) {\n // Filter and sorted\n if (s.dataset[i].values) {\n const thisLength = s.dataset[i].values.length;\n let thisFilterCount = 0;\n for (let k = 0; k < thisLength; k++) {\n if (s.dataset[i].values[k]._isFilteredOut) {\n thisFilterCount++;\n }\n }\n if (thisFilterCount === thisLength) {\n continue; //eslint-disable-line\n }\n }\n\n // First push group row\n if (!this.settings.groupable.suppressGroupRow) {\n // Show the grouping row\n const groupHtml = self.rowHtml(s.dataset[i], this.recordCount, i, true);\n\n if (this.hasLeftPane && groupHtml.left) {\n tableHtmlLeft += groupHtml.left;\n }\n if (groupHtml.center) {\n tableHtml += groupHtml.center;\n }\n if (this.hasRightPane && groupHtml.right) {\n tableHtmlRight += groupHtml.right;\n }\n }\n\n if (this.settings.groupable.showOnlyGroupRow && s.dataset[i].values[0]) {\n const rowData = s.dataset[i].values[0];\n\n if (s.dataset[i].list) {\n rowData.list = s.dataset[i].list;\n }\n\n rowData.values = s.dataset[i].values;\n const groupHtml = self.rowHtml(rowData, this.recordCount, i);\n if (this.hasLeftPane && groupHtml.left) {\n tableHtmlLeft += groupHtml.left;\n }\n if (groupHtml.center) {\n tableHtml += groupHtml.center;\n }\n if (this.hasRightPane && groupHtml.right) {\n tableHtmlRight += groupHtml.right;\n }\n\n this.recordCount++;\n self.groupArray.push({ group: i, node: 0 });\n continue; //eslint-disable-line\n }\n\n // Now Push Groups\n for (let k = 0; k < s.dataset[i].values.length; k++) {\n if (!s.dataset[i].values[k]._isFilteredOut) {\n const rowHtml = self.rowHtml(\n s.dataset[i].values[k],\n this.recordCount,\n s.dataset[i].values[k].idx\n );\n if (self.hasLeftPane && rowHtml.left) {\n tableHtmlLeft += rowHtml.left;\n }\n if (rowHtml.center) {\n tableHtml += rowHtml.center;\n }\n if (self.hasRightPane && rowHtml.right) {\n tableHtmlRight += rowHtml.right;\n }\n this.recordCount++;\n self.groupArray.push({ group: i, node: k });\n }\n }\n\n // Now Push summary rowHtml\n if (this.settings.groupable.groupFooterRow) {\n const rowHtml = self.rowHtml(s.dataset[i], this.recordCount, i, true, true);\n if (self.hasLeftPane && rowHtml.left) {\n tableHtmlLeft += rowHtml.left;\n }\n if (rowHtml.center) {\n tableHtml += rowHtml.center;\n }\n if (self.hasRightPane && rowHtml.right) {\n tableHtmlRight += rowHtml.right;\n }\n }\n\n continue; //eslint-disable-line\n }\n\n let currentCount = i;\n if (s.treeGrid) {\n currentCount = this.recordCount;\n }\n\n self.runningCount++;\n const rowHtml = self.rowHtml(s.dataset[i], currentCount, i);\n if (self.hasLeftPane && rowHtml.left) {\n tableHtmlLeft += rowHtml.left;\n }\n if (rowHtml.center) {\n tableHtml += rowHtml.center;\n\n if (s.treeGrid && this.filterExpr?.length) {\n if ($(`<table>${rowHtml.center}</table>`).find('tr:first').is('.is-hidden')) {\n this.filteredCount++;\n }\n }\n }\n if (self.hasRightPane && rowHtml.right) {\n tableHtmlRight += rowHtml.right;\n }\n\n if (!s.dataset[i]?._isFilteredOut) {\n this.recordCount++;\n }\n this.visibleRowCount = currentCount + 1;\n\n if (s.dataset[i]?.rowStatus) {\n rowStatusTooltip = true;\n }\n }\n\n // Append a Summary Row\n if (this.settings.summaryRow) {\n self.element.addClass('has-summary-row');\n\n const totals = self.calculateTotals();\n const summaryRowHtml = self.rowHtml(totals, this.recordCount, null, false, true);\n if (self.hasLeftPane && summaryRowHtml.left) {\n tableHtmlLeft += summaryRowHtml.left;\n }\n if (summaryRowHtml.center) {\n tableHtml += summaryRowHtml.center;\n }\n if (self.hasRightPane && summaryRowHtml.right) {\n tableHtmlRight += summaryRowHtml.right;\n }\n }\n\n if (self.bodyColGroupHtml !== '<colgroup>') {\n if (this.settings.spacerColumn) {\n self.bodyColGroupHtml += '<col style=\"width: 100%\">';\n }\n self.bodyColGroupHtmlLeft += '</colgroup>';\n self.bodyColGroupHtml += '</colgroup>';\n self.bodyColGroupHtmlRight += '</colgroup>';\n\n if (self.bodyColGroupLeft) {\n self.bodyColGroupLeft.remove();\n }\n\n if (self.bodyColGroup) {\n self.bodyColGroup.remove();\n }\n\n if (self.bodyColGroupRight) {\n self.bodyColGroupRight.remove();\n }\n\n if (self.hasLeftPane) {\n self.bodyColGroupLeft = $(self.bodyColGroupHtmlLeft);\n (self.tableBodyLeft || self.headerRowLeft).before(self.bodyColGroupLeft);\n }\n\n self.bodyColGroup = $(self.bodyColGroupHtml);\n (self.headerRow || self.tableBody).before(self.bodyColGroup);\n\n if (self.hasRightPane) {\n self.bodyColGroupRight = $(self.bodyColGroupHtmlRight);\n (self.tableBodyRight || self.headerRowRight).before(self.bodyColGroupRight);\n }\n }\n\n if (self.hasLeftPane) {\n DOM.html(self.tableBodyLeft, tableHtmlLeft, '*');\n }\n\n DOM.html(self.tableBody, tableHtml, '*');\n\n if (self.hasRightPane) {\n DOM.html(self.tableBodyRight, tableHtmlRight, '*');\n }\n\n self.setVirtualHeight();\n self.setScrollClass();\n self.setupTooltips(rowStatusTooltip);\n self.afterRender();\n }", "function combineColumns(){\n //group all selected columns\n var colGroups = groupSelectedColumns();\n //combine columns horizontaly\n combineColumnsHorizontal(colGroups);\n\n}", "function addColumnHeadings(el, header) {\n var headerRow = $('<tr/>').appendTo(header);\n var breakpointsByIdx = [];\n var srcSettings = el.settings.sourceObject.settings;\n var aggInfo = srcSettings.aggregation;\n if (el.settings.autoResponsiveCols) {\n // Build list of breakpoints to use by column position.\n $.each(el.settings.responsiveOptions.breakpoints, function eachPoint(name, point) {\n var i;\n for (i = Math.round(point / 100); i < el.settings.columns.length; i++) {\n while (breakpointsByIdx.length < i + 1) {\n breakpointsByIdx.push([]);\n }\n breakpointsByIdx[i].push(name);\n }\n });\n }\n if (el.settings.responsive) {\n $('<th class=\"footable-toggle-col\" data-sort-ignore=\"true\"></th>').appendTo(headerRow);\n }\n $.each(el.settings.columns, function eachColumn(idx) {\n var colDef = el.settings.availableColumnInfo[this.field];\n var heading = colDef.caption;\n var footableExtras = '';\n var sortableField = false;\n // Tolerate hyphen or camelCase.\n var hideBreakpoints = colDef.hideBreakpoints || colDef['hide-breakpoints'];\n var dataType = colDef.dataType || colDef['data-type'];\n if (srcSettings.mode === 'docs') {\n // Either a standard field, or a special field which provides an\n // associated sort field.\n sortableField = (indiciaData.esMappings[this.field] && indiciaData.esMappings[this.field].sort_field) ||\n indiciaData.fieldConvertorSortFields[this.field.simpleFieldName()];\n } else if (srcSettings.mode === 'compositeAggregation') {\n // CompositeAggregation can sort on any field column, not aggregations.\n sortableField = !(aggInfo[this.field] || this.field === 'doc_count');\n } else if (srcSettings.mode === 'termAggregation') {\n // Term aggregations allow sort on the aggregation cols, or fields if\n // numeric or date, but not normal text fields.\n sortableField = aggInfo[this.field] || this.field === 'doc_count' ||\n (indiciaData.esMappings[this.field] && !indiciaData.esMappings[this.field].type.match(/^(text|keyword)$/));\n }\n if (el.settings.sortable !== false && sortableField) {\n heading += '<span class=\"sort fas fa-sort\"></span>';\n }\n // Extra data attrs to support footable.\n if (el.settings.autoResponsiveCols) {\n footableExtras = ' data-hide=\"' + breakpointsByIdx[idx].join(',') + '\"';\n } else if (hideBreakpoints) {\n footableExtras = ' data-hide=\"' + hideBreakpoints + '\"';\n }\n if (dataType) {\n footableExtras += ' data-type=\"' + dataType + '\"';\n }\n $('<th class=\"col-' + idx + '\" data-field=\"' + this.field + '\"' + footableExtras + '>' + heading + '</th>')\n .appendTo(headerRow);\n });\n if (el.settings.actions.length) {\n $('<th class=\"col-actions\"></th>').appendTo(headerRow);\n }\n if (el.settings.tbodyHasScrollBar) {\n // Spacer in header to allow for scrollbar in body.\n $('<th class=\"scroll-spacer\"></th>').appendTo(headerRow);\n }\n }", "function calculateWidths(table) {\n // TODO Handle these cases\n var columnMinWidth = 10 / state_1.default().scaleFactor();\n if (columnMinWidth * table.columns.length > table.width) {\n console.error('Columns could not fit on page');\n }\n else if (table.minWidth > table.width) {\n console.error(\"Column widths to wide and can't fit page\");\n }\n var copy = table.columns.slice(0);\n var diffWidth = table.width - table.wrappedWidth;\n distributeWidth(copy, diffWidth, table.wrappedWidth);\n applyColSpans(table);\n fitContent(table);\n applyRowSpans(table);\n}", "function calculateWidths(table) {\n // TODO Handle these cases\n var columnMinWidth = 10 / state_1.default().scaleFactor();\n if (columnMinWidth * table.columns.length > table.width) {\n console.error('Columns could not fit on page');\n }\n else if (table.minWidth > table.width) {\n console.error(\"Column widths to wide and can't fit page\");\n }\n var copy = table.columns.slice(0);\n var diffWidth = table.width - table.wrappedWidth;\n distributeWidth(copy, diffWidth, table.wrappedWidth);\n applyColSpans(table);\n fitContent(table);\n applyRowSpans(table);\n}", "reflow () {\n var last = []\n var cols = [...this.element.querySelectorAll('.js-col')]\n\n for (let i = 0, len = cols.length, col; i < len; i++) {\n col = cols[i]\n last.push(...Array.prototype.slice.call(col.childNodes, -2))\n if (col.childElementCount) col.removeChild(col.lastElementChild)\n if (col.childElementCount) col.removeChild(col.lastElementChild)\n }\n\n for (let i = 0, len = last.length; i < len; i++) {\n var shortest = cols.reduce((min, el) => {\n var height = el.offsetHeight\n return !min || height < min.height ? {el, height} : min\n }, null)\n shortest.el.appendChild(last[i])\n }\n }", "resizeColumns(event) {\n event.api.sizeColumnsToFit();\n }", "function BrowserColumn() {}", "function BrowserColumn() {}", "function getColumnsCount() {\r\n}", "function arangeGrid()\n{\n if ($('.datagrid .tbl_grid').hasClass('no-data-to-display'))\n return;\n\n $('.datagrid .tbl_grid_head_container .tbl_grid_head').each(function() {\n\n var sourceOuterWidth = $(this).outerWidth();\n var col = $(this).index();\n\n\n\n\n /*<<=============== Setting the width of footer colums =============================================>>*/\n\n // Getting target column and widths.\n var target = $(this).closest('.datagrid').find('.auto_set_width .tbl_grid_head').eq(col);\n var targetWidth = target.width();\n var targetOuterWidth = target.outerWidth();\n var targetExtraWidth = targetOuterWidth - targetWidth;\n\n // Calculating new width for the target column.\n var newWidth = sourceOuterWidth - targetExtraWidth;\n\n // Resetting targetWidth.\n target.width(newWidth);\n /*<<================================================================================================>>*/\n\n //alert('col:'+col+'\\n'+'SourceWidth: '+$(this).width()+'\\n'+'sourceOuterWidth:'+sourceOuterWidth+'\\n'+'targetExtraWidth:'+ targetExtraWidth +'\\n'+'targetWidth:'+targetWidth +'\\n'+'targetOuterWidth:'+targetOuterWidth+'\\n'+'New Width: '+target.width()+'\\n'+'NewOuterWidth:'+target.outerWidth());\n\n\n\n /*<<=============== Setting the width of tbody <td> colums =========================================>>*/\n\n // Getting the index of the last target column.\n var lastCol = $(this).closest('.datagrid').find('.tbl_grid tbody tr:first td:last').index();\n\n // Leaving the last column idle. Otherwise our aim will fail.\n if (col == lastCol)\n {\n var lastFooterColumn = $(this).closest('.datagrid').find('.auto_set_width .tbl_grid_head').eq(col);\n var lastTbodyColumn = $(this).closest('.datagrid').find('.tbl_grid tbody tr:first td').eq(col);\n var lastTbodyColumnOuterWidth = lastTbodyColumn.outerWidth();\n var lastFooterColumnWidth = lastFooterColumn.width();\n var lastFooterColumnOuterWidth = lastFooterColumn.outerWidth();\n var lastFooterColumnExtraWidth = lastFooterColumnOuterWidth - lastFooterColumnWidth;\n\n // Calculating new width for the target column.\n var lastFooterColumnNewWidth = lastTbodyColumnOuterWidth - lastFooterColumnExtraWidth;\n\n // Resetting targetWidth.\n lastFooterColumn.width(lastFooterColumnNewWidth);\n\n return;\n }\n\n // Getting target column and widths.\n target = $(this).closest('.datagrid').find('.tbl_grid tbody tr:first td').eq(col);\n targetWidth = target.width();\n targetOuterWidth = target.outerWidth();\n targetExtraWidth = targetOuterWidth - targetWidth;\n\n // Calculating new width for the target column.\n newWidth = sourceOuterWidth - targetExtraWidth;\n\n // Resetting targetWidth.\n target.width(newWidth);\n\n /*<<================================================================================================>>*/\n\n });\n}", "_precalculateContentWidths() {\n let cellPadding = 0;\n\n if (!this.$el.hasClass('diff-error') && this._$revisionRow.length > 0) {\n const containerExtents = this.$el.getExtents('p', 'lr');\n\n /* Calculate the widths and state of the diff columns. */\n let $cells = $(this._$revisionRow[0].cells);\n cellPadding = $(this.el.querySelector('pre'))\n .parent().addBack()\n .getExtents('p', 'lr');\n\n this._colReservedWidths = $cells.eq(0).outerWidth() + cellPadding +\n containerExtents;\n this._numColumns = $cells.length;\n\n if (this._numColumns === 4) {\n /* There's a left-hand side and a right-hand side. */\n this._colReservedWidths += $cells.eq(2).outerWidth() +\n cellPadding;\n }\n\n /* Calculate the widths and state of the filename columns. */\n $cells = $(this._$filenameRow[0].cells);\n this._numFilenameColumns = $cells.length;\n this._filenameReservedWidths = containerExtents +\n 2 * this._numFilenameColumns;\n } else {\n this._colReservedWidths = 0;\n this._filenameReservedWidths = 0;\n this._numColumns = 0;\n this._numFilenameColumns = 0;\n }\n }", "fixCellWidths() {\n const me = this;\n\n let hasFlex = false,\n flexBasis;\n\n // single header \"cell\"\n me.columns.traverse((column) => {\n const cellEl = me.getBarCellElement(column.id),\n domWidth = DomHelper.setLength(column.width),\n domMinWidth = DomHelper.setLength(column.minWidth);\n\n if (cellEl) {\n // We have to work round the IE11 bug that flex-basis affects the content-box\n // and any padding is added as extra.\n // TODO: Remove this when IE11 retires.\n if (BrowserHelper.isIE11) {\n flexBasis = `calc(${domWidth} - ${me.getLrPadding(cellEl)}px)`;\n } else {\n flexBasis = domWidth;\n }\n\n hasFlex = hasFlex || Boolean(column.flex);\n\n // Parent column without any specified width and flex should have flex calculated if any child has flex\n if (column.isParent && column.width == null && column.flex == null) {\n const flex = column.children.reduce((result, child) => (result += (!child.hidden && child.flex) || 0), 0);\n\n // Do not want to store this flex value on the column since it is always calculated\n cellEl.style.flex = flex > 0 ? `${flex} 0 auto` : '';\n\n if (flex > 0) {\n // TODO: Figure out a better way of handling this, minWidth on the columns breaks the flexbox\n // calculation compared to cells, making them misalign\n column.traverse((col) => (col.data.minWidth = null));\n }\n }\n // Normal case, set flex, width etc.\n else {\n if (parseInt(column.minWidth) >= 0) {\n cellEl.style.minWidth = domMinWidth;\n }\n\n // Clear all the things we might have to set to correct cell widths\n cellEl.style.flex = cellEl.style.flexBasis = cellEl.style.width = '';\n\n if (column.flex) {\n // If column has children we need to give it\n // flex-shrink: 0, flex-basis: auto so that it always\n // shrinkwraps its children without shrinking\n if (!isNaN(parseInt(column.flex)) && column.children) {\n cellEl.style.flex = `${column.flex} 0 auto`;\n } else {\n cellEl.style.flex = column.flex;\n }\n } else if (parseInt(column.width) >= 0) {\n const parent = column.parent;\n\n // Only grid header bar has a notion of group headers\n // Column is a child of an unwidthed group. We have to use width\n // to stretch it.\n if (me.isHeader && !parent.isRoot && !parent.width) {\n cellEl.style.width = domWidth;\n } else {\n // https://app.assembla.com/spaces/bryntum/tickets/8041\n // Column header widths must be set using flex-basis.\n // Using width means that wide widths cause a flexed SubGrid\n // to bust the flex rules.\n // TODO: When IE11 retires, remove calc() hacks to overcome its flexbox bugs.\n // Note that grid in Grid#onColumnsResized and SubGrid#fixCellWidths,\n // cells MUST still be sized using width since rows\n // are absolutely positioned and will not cause the busting out\n // problem, and rows will not stretch to shrinkwrap the cells\n // unless they are widthed with width.\n cellEl.style.flexBasis = flexBasis;\n }\n }\n }\n\n if (column.height >= 0) {\n cellEl.style.height = DomHelper.setLength(column.height);\n }\n }\n });\n\n me.element.classList[hasFlex ? 'add' : 'remove']('b-has-flex');\n }", "function set_column_tool_order() {\n $('#showColumnList').each(function() {\n var col_array = data_local;\n var tr = $(this);\n for(var b = col_array.length-1; b >= 1; b--){\n var a = b-1;\n var tda = tr.find($('.'+col_array[a]));\n var tdb = tr.find($('.'+col_array[b]));\n tda.detach().insertBefore(tdb);\n }\n });\n set_column_short_order();\n}", "function calcNestColWidth(){\n var windowWidth = $window.width();\n if (windowWidth > 1024) {\n return windowWidth / 14;\n } else if (windowWidth < 768) {\n return windowWidth / 4;\n } else {\n return windowWidth / 9;\n }\n }", "addColumn(id, width, comp) {\n return (\n <UIColumn key={id} ref={id} colWidth={width}>\n { comp }\n </UIColumn>\n );\n }", "function fitColumns(target){\r\n\t\tvar state = $.data(target, 'datagrid');\r\n\t\tvar opts = state.options;\r\n\t\tvar dc = state.dc;\r\n\t\tdc.body2.css('overflow-x', opts.fitColumns?'hidden':'');\r\n\t\tif (!opts.fitColumns){return;}\r\n\t\tif (!state.leftWidth){state.leftWidth = 0;}\r\n\t\t\r\n\t\tvar header = dc.view2.children('div.datagrid-header');\r\n\t\tvar fieldWidths = 0;\r\n\t\tvar lastColumn;\r\n\t\tvar fields = getColumnFields(target, false);\r\n\t\tfor(var i=0; i<fields.length; i++){\r\n\t\t\tvar col = getColumnOption(target, fields[i]);\r\n\t\t\tif (canResize(col)){\r\n\t\t\t\tfieldWidths += col.width;\r\n\t\t\t\tlastColumn = col;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (!fieldWidths){return}\r\n\t\tif (lastColumn){\r\n\t\t\taddHeaderWidth(lastColumn, -state.leftWidth);\r\n\t\t}\r\n\t\tvar headerInner = header.children('div.datagrid-header-inner').show();\r\n\t\tvar leftWidth = header.width() - header.find('table').width() - opts.scrollbarSize + state.leftWidth;\r\n\t\tvar rate = leftWidth / fieldWidths;\r\n\t\tif (!opts.showHeader){headerInner.hide();}\r\n\t\tfor(var i=0; i<fields.length; i++){\r\n\t\t\tvar col = getColumnOption(target, fields[i]);\r\n\t\t\tif (canResize(col)){\r\n\t\t\t\tvar width = parseInt(col.width * rate);\r\n\t\t\t\taddHeaderWidth(col, width);\r\n\t\t\t\tleftWidth -= width;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tstate.leftWidth = leftWidth;\r\n\t\tif (lastColumn){\r\n\t\t\taddHeaderWidth(lastColumn, state.leftWidth);\r\n\t\t}\r\n\t\tfixColumnSize(target);\r\n\t\t\r\n\t\tfunction addHeaderWidth(col, width){\r\n\t\t\tcol.width += width;\r\n\t\t\tcol.boxWidth += width;\r\n\t\t}\r\n\t\tfunction canResize(col){\r\n\t\t\tif (!col.hidden && !col.checkbox && !col.auto && !col.fixed) return true;\r\n\t\t}\r\n\t}", "function resizableGrid(table) {\n var row = table.getElementsByTagName('tr')[0],\n cols = row ? row.children : undefined;\n if (!cols)\n return;\n\n table.style.overflow = 'hidden';\n\n var tableHeight = table.offsetHeight;\n\n for (var i = 0; i < cols.length; i++) {\n var div = createDiv(tableHeight);\n cols[i].appendChild(div);\n cols[i].style.position = 'relative';\n setListeners(div);\n }\n\n function setListeners(div) {\n var pageX, curCol, nxtCol, curColWidth, nxtColWidth;\n\n div.addEventListener('mousedown', function (e) {\n curCol = e.target.parentElement;\n nxtCol = curCol.nextElementSibling;\n pageX = e.pageX;\n\n var padding = paddingDiff(curCol);\n\n curColWidth = curCol.offsetWidth - padding;\n if (nxtCol)\n nxtColWidth = nxtCol.offsetWidth - padding;\n });\n\n div.addEventListener('mouseover', function (e) {\n e.target.style.borderRight = '2px solid black';\n });\n\n div.addEventListener('mouseout', function (e) {\n e.target.style.borderRight = '';\n });\n\n document.addEventListener('mousemove', function (e) {\n if (curCol) {\n var diffX = e.pageX - pageX;\n\n if (nxtCol)\n nxtCol.style.width = (nxtColWidth - (diffX)) + 'px';\n\n curCol.style.width = (curColWidth + diffX) + 'px';\n }\n });\n\n document.addEventListener('mouseup', function (e) {\n curCol = undefined;\n nxtCol = undefined;\n pageX = undefined;\n nxtColWidth = undefined;\n curColWidth = undefined;\n });\n }\n\n function createDiv(height) {\n var div = document.createElement('div');\n div.style.top = 0;\n div.style.right = 0;\n div.style.width = '5px';\n div.style.position = 'absolute';\n div.style.cursor = 'col-resize';\n div.style.userSelect = 'none';\n div.style.height = height + 'px';\n return div;\n }\n\n function paddingDiff(col) {\n\n if (getStyleVal(col, 'box-sizing') === 'border-box') {\n return 0;\n }\n\n var padLeft = getStyleVal(col, 'padding-left');\n var padRight = getStyleVal(col, 'padding-right');\n return (parseInt(padLeft) + parseInt(padRight));\n\n }\n\n function getStyleVal(elm, css) {\n return (window.getComputedStyle(elm, null).getPropertyValue(css));\n }\n}", "function adjustColumnWidths(allColumns, expectedWidth) {\n var columnsWidth = column_1.columnsTotalWidth(allColumns);\n var totalFlexGrow = getTotalFlexGrow(allColumns);\n var colsByGroup = column_1.columnsByPin(allColumns);\n if (columnsWidth !== expectedWidth) {\n scaleColumns(colsByGroup, expectedWidth, totalFlexGrow);\n }\n}", "function _fnCalculateColumnWidths(oSettings) {\n\t\t\tvar iTableWidth = oSettings.nTable.offsetWidth;\n\t\t\tvar iUserInputs = 0;\n\t\t\tvar iTmpWidth;\n\t\t\tvar iVisibleColumns = 0;\n\t\t\tvar iColums = oSettings.aoColumns.length;\n\t\t\tvar i;\n\t\t\tvar oHeaders = $('th', oSettings.nTHead);\n\n\t\t\t/* Convert any user input sizes into pixel sizes */\n\t\t\tfor (i = 0; i < iColums; i++) {\n\t\t\t\tif (oSettings.aoColumns[i].bVisible) {\n\t\t\t\t\tiVisibleColumns++;\n\n\t\t\t\t\tif (oSettings.aoColumns[i].sWidth !== null) {\n\t\t\t\t\t\tiTmpWidth = _fnConvertToWidth(\n\t\t\t\t\t\t\t\toSettings.aoColumns[i].sWidthOrig,\n\t\t\t\t\t\t\t\toSettings.nTable.parentNode);\n\t\t\t\t\t\tif (iTmpWidth !== null) {\n\t\t\t\t\t\t\toSettings.aoColumns[i].sWidth = _fnStringToCss(iTmpWidth);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tiUserInputs++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * If the number of columns in the DOM equals the number that we\n\t\t\t * have to process in DataTables, then we can use the offsets that\n\t\t\t * are created by the web-browser. No custom sizes can be set in\n\t\t\t * order for this to happen, nor scrolling used\n\t\t\t */\n\t\t\tif (iColums == oHeaders.length && iUserInputs === 0\n\t\t\t\t\t&& iVisibleColumns == iColums\n\t\t\t\t\t&& oSettings.oScroll.sX === \"\"\n\t\t\t\t\t&& oSettings.oScroll.sY === \"\") {\n\t\t\t\tfor (i = 0; i < oSettings.aoColumns.length; i++) {\n\t\t\t\t\tiTmpWidth = $(oHeaders[i]).width();\n\t\t\t\t\tif (iTmpWidth !== null) {\n\t\t\t\t\t\toSettings.aoColumns[i].sWidth = _fnStringToCss(iTmpWidth);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t/*\n\t\t\t\t * Otherwise we are going to have to do some calculations to get\n\t\t\t\t * the width of each column. Construct a 1 row table with the\n\t\t\t\t * widest node in the data, and any user defined widths, then\n\t\t\t\t * insert it into the DOM and allow the browser to do all the\n\t\t\t\t * hard work of calculating table widths.\n\t\t\t\t */\n\t\t\t\tvar nCalcTmp = oSettings.nTable.cloneNode(false), nBody = document\n\t\t\t\t\t\t.createElement('tbody'), nTr = document\n\t\t\t\t\t\t.createElement('tr'), nDivSizing;\n\n\t\t\t\tnCalcTmp.removeAttribute(\"id\");\n\t\t\t\tnCalcTmp.appendChild(oSettings.nTHead.cloneNode(true));\n\t\t\t\tif (oSettings.nTFoot !== null) {\n\t\t\t\t\tnCalcTmp.appendChild(oSettings.nTFoot.cloneNode(true));\n\t\t\t\t\t_fnApplyToChildren(function(n) {\n\t\t\t\t\t\tn.style.width = \"\";\n\t\t\t\t\t}, nCalcTmp.getElementsByTagName('tr'));\n\t\t\t\t}\n\n\t\t\t\tnCalcTmp.appendChild(nBody);\n\t\t\t\tnBody.appendChild(nTr);\n\n\t\t\t\t/* Remove any sizing that was previously applied by the styles */\n\t\t\t\tvar jqColSizing = $('thead th', nCalcTmp);\n\t\t\t\tif (jqColSizing.length === 0) {\n\t\t\t\t\tjqColSizing = $('tbody tr:eq(0)>td', nCalcTmp);\n\t\t\t\t}\n\t\t\t\tjqColSizing\n\t\t\t\t\t\t.each(function(i) {\n\t\t\t\t\t\t\tthis.style.width = \"\";\n\n\t\t\t\t\t\t\tvar iIndex = _fnVisibleToColumnIndex(oSettings, i);\n\t\t\t\t\t\t\tif (iIndex !== null\n\t\t\t\t\t\t\t\t\t&& oSettings.aoColumns[iIndex].sWidthOrig !== \"\") {\n\t\t\t\t\t\t\t\tthis.style.width = oSettings.aoColumns[iIndex].sWidthOrig;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t/* Find the biggest td for each column and put it into the table */\n\t\t\t\tfor (i = 0; i < iColums; i++) {\n\t\t\t\t\tif (oSettings.aoColumns[i].bVisible) {\n\t\t\t\t\t\tvar nTd = _fnGetWidestNode(oSettings, i);\n\t\t\t\t\t\tif (nTd !== null) {\n\t\t\t\t\t\t\tnTd = nTd.cloneNode(true);\n\t\t\t\t\t\t\tnTr.appendChild(nTd);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Build the table and 'display' it */\n\t\t\t\tvar nWrapper = oSettings.nTable.parentNode;\n\t\t\t\tnWrapper.appendChild(nCalcTmp);\n\n\t\t\t\t/*\n\t\t\t\t * When scrolling (X or Y) we want to set the width of the table\n\t\t\t\t * as appropriate. However, when not scrolling leave the table\n\t\t\t\t * width as it is. This results in slightly different, but I\n\t\t\t\t * think correct behaviour\n\t\t\t\t */\n\t\t\t\tif (oSettings.oScroll.sX !== \"\"\n\t\t\t\t\t\t&& oSettings.oScroll.sXInner !== \"\") {\n\t\t\t\t\tnCalcTmp.style.width = _fnStringToCss(oSettings.oScroll.sXInner);\n\t\t\t\t} else if (oSettings.oScroll.sX !== \"\") {\n\t\t\t\t\tnCalcTmp.style.width = \"\";\n\t\t\t\t\tif ($(nCalcTmp).width() < nWrapper.offsetWidth) {\n\t\t\t\t\t\tnCalcTmp.style.width = _fnStringToCss(nWrapper.offsetWidth);\n\t\t\t\t\t}\n\t\t\t\t} else if (oSettings.oScroll.sY !== \"\") {\n\t\t\t\t\tnCalcTmp.style.width = _fnStringToCss(nWrapper.offsetWidth);\n\t\t\t\t}\n\t\t\t\tnCalcTmp.style.visibility = \"hidden\";\n\n\t\t\t\t/* Scrolling considerations */\n\t\t\t\t_fnScrollingWidthAdjust(oSettings, nCalcTmp);\n\n\t\t\t\t/*\n\t\t\t\t * Read the width's calculated by the browser and store them for\n\t\t\t\t * use by the caller. We first of all try to use the elements in\n\t\t\t\t * the body, but it is possible that there are no elements\n\t\t\t\t * there, under which circumstances we use the header elements\n\t\t\t\t */\n\t\t\t\tvar oNodes = $(\"tbody tr:eq(0)>td\", nCalcTmp);\n\t\t\t\tif (oNodes.length === 0) {\n\t\t\t\t\toNodes = $(\"thead tr:eq(0)>th\", nCalcTmp);\n\t\t\t\t}\n\n\t\t\t\tvar iIndex, iCorrector = 0, iWidth;\n\t\t\t\tfor (i = 0; i < oSettings.aoColumns.length; i++) {\n\t\t\t\t\tif (oSettings.aoColumns[i].bVisible) {\n\t\t\t\t\t\tiWidth = $(oNodes[iCorrector]).outerWidth();\n\t\t\t\t\t\tif (iWidth !== null && iWidth > 0) {\n\t\t\t\t\t\t\toSettings.aoColumns[i].sWidth = _fnStringToCss(iWidth);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tiCorrector++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\toSettings.nTable.style.width = _fnStringToCss($(nCalcTmp)\n\t\t\t\t\t\t.outerWidth());\n\t\t\t\tnCalcTmp.parentNode.removeChild(nCalcTmp);\n\t\t\t}\n\t\t}", "function defineColumns() {\r\n // Create a style element\r\n var styleSheet = document.createElement(\"style\");\r\n // Add that element to the head.\r\n document.head.appendChild(styleSheet);\r\n\r\n // Insert the following rule into the stylesheet:\r\n styleSheet.sheet.insertRule(\r\n \"table.sortable thead tr th { \\\r\n cursor: pointer;\\\r\n }\", 0);\r\n\r\n // Insert the following rule into the stylesheet:\r\n styleSheet.sheet.insertRule(\r\n \"table.sortable thead tr th::after { \\\r\n content: '\\\\00a0';\\\r\n font-family: monospace;\\\r\n margin-left: 5px;\\\r\n }\", 1);\r\n\r\n // Insert the following rule into the stylesheet:\r\n styleSheet.sheet.insertRule(\r\n \"table.sortable thead tr th:nth-of-type(1)::after {\\\r\n content: '\\\\25b2';\\\r\n }\", 2);\r\n\r\n // Get all of the table headers\r\n var thHeadings = document.querySelectorAll(\"table.sortable thead th\");\r\n // Loop through the headers\r\n for (var i = 0; i < thHeadings.length; i++) {\r\n // Add the heading text content to the dataCategories array.\r\n dataCategories.push(thHeadings[i].textContent);\r\n // Add the onclick handler to the header that calls the columnSort function.\r\n thHeadings[i].onclick = columnSort;\r\n }\r\n}", "_changeColumnsHandler( e ) {\n\t\te.preventDefault();\n\n\t\tlet button = $( e.target );\n\t\tlet columns_count = button.data('columns');\n\t\tlet cols = Math.floor( 12 / parseInt( columns_count ) );\n\t\tlet screen = this.row.get( 'screen' );\n\t\tlet screens = [ 'lg', 'md', 'sm', 'xs' ];\n\n\t\tlet newColumnsObject = [];\n\t\tfor ( let i = 0; i < columns_count; i++ ) {\n\t\t\tnewColumnsObject.push({\n\t\t\t\tcols: cols\n\t\t\t});\n\t\t}\n\n\t\tif ( newColumnsObject.length >= this.row.get( 'columns' ).length ) {\n\t\t\t// current columns < columns number selected\n\t\t\tfor ( let i = 0; i < newColumnsObject.length; i++ ) {\n\t\t\t\tlet model = this.row.get( 'columns' ).at( i );\n\t\t\t\tif ( typeof model !== 'undefined' ) {\n\t\t\t\t\tlet responsive = { ...model.get( 'responsive' ) };\n\n\t\t\t\t\t_.map( screens, ( sc ) => {\n\t\t\t\t\t\tif ( responsive[sc].styles !== undefined && responsive[sc].styles.width !== undefined ) {\n\t\t\t\t\t\t\tdelete responsive[sc].styles.width;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresponsive[sc].cols = cols;\n\t\t\t\t\t} );\n\t\t\t\t\tmodel.set( 'responsive', responsive );\n\t\t\t\t\tmodel.set( 'reRender', true );\n\t\t\t\t} else {\n\t\t\t\t\tlet newModel = {\n\t\t\t\t\t\tsettings: {\n\t\t\t\t\t\t\telements: []\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tnewModel.responsive = {};\n\t\t\t\t\t_.map( screens, ( sc ) => {\n\t\t\t\t\t\tnewModel.responsive[sc] = {\n\t\t\t\t\t\t\tcols: cols\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\tthis.row.get( 'columns' ).add( newModel );\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// current columns > columns number selected\n\t\t\tvar elements = [];\n\t\t\tvar lastest_column_index = false;\n\t\t\tthis.row.get( 'columns' ).map( ( model, index ) => {\n\t\t\t\tif ( typeof newColumnsObject[index] !== 'undefined' ) {\n\t\t\t\t\tlet responsive = { ...model.get( 'responsive' ) };\n\n\t\t\t\t\t_.map( screens, ( sc ) => {\n\t\t\t\t\t\tresponsive[sc].cols = newColumnsObject[index].cols;\n\t\t\t\t\t\t// delete width style\n\t\t\t\t\t\tif ( responsive[sc].styles !== undefined && responsive[sc].styles.width != undefined ) {\n\t\t\t\t\t\t\tdelete responsive[sc].styles.width;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t\tmodel.set( 'responsive', responsive );\n\t\t\t\t\tmodel.set( 'reRender', true );\n\n\t\t\t\t\t// lastest index if columns collection\n\t\t\t\t\tlastest_column_index = index;\n\t\t\t\t} else if ( lastest_column_index !== false ) {\n\t\t\t\t\tnew Promise( ( resolve, reject ) => {\n\t\t\t\t\t\tvar cloneModel = model;\n\t\t\t\t\t\t// check elements inside column if > 0, we will add it to lastest column\n\t\t\t\t\t\tif ( typeof cloneModel.get( 'elements' ) !== 'undefined' && cloneModel.get( 'elements' ).length > 0 ) {\n\t\t\t\t\t\t\tlet settings = cloneModel.get( 'elements' ).toJSON();\n\t\t\t\t\t\t\telements.push( settings );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( index == lastest_column_index ) {\n\t\t\t\t\t\t\tthis.row.get( 'columns' ).at( lastest_column_index ).set( 'elements', elements );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// call destroy method after update columns collection\n\t\t\t\t\t\tresolve();\n\t\t\t\t }).then( () => {\n\t\t\t\t \tmodel.destroy();\n\t\t\t\t });\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\treturn false;\n\t}", "function showColumns(){\n\t\n\t//loop through the column filter inputs to determine which ones are checked or not to display the areas\n\tjQuery(\"#column_filter\").children('ul').children('li').each(function(){\n\t\tinitColumn(jQuery(this).children('input').attr('id'));\n\t});\t\n}", "function calculateWidths(doc, pageWidth) {\n // Column and table content width\n var tableContentWidth = 0;\n table.columns.forEach(function (column) {\n column.contentWidth = table.headerRow.cells[column.dataKey].contentWidth;\n table.rows.forEach(function (row) {\n var cellWidth = row.cells[column.dataKey].contentWidth;\n if (cellWidth > column.contentWidth) {\n column.contentWidth = cellWidth;\n }\n });\n column.width = column.contentWidth;\n tableContentWidth += column.contentWidth;\n });\n table.contentWidth = tableContentWidth;\n\n var maxTableWidth = pageWidth - settings.margin.left - settings.margin.right;\n var preferredTableWidth = maxTableWidth; // settings.tableWidth === 'auto'\n if (typeof settings.tableWidth === 'number') {\n preferredTableWidth = settings.tableWidth;\n } else if (settings.tableWidth === 'wrap') {\n preferredTableWidth = table.contentWidth;\n }\n table.width = preferredTableWidth < maxTableWidth ? preferredTableWidth : maxTableWidth;\n\n // To avoid subjecting columns with little content with the chosen overflow method,\n // never shrink a column more than the table divided by column count (its \"fair part\")\n var dynamicColumns = [];\n var dynamicColumnsContentWidth = 0;\n var fairWidth = table.width / table.columns.length;\n var staticWidth = 0;\n table.columns.forEach(function (column) {\n var colStyles = Config.styles([themes[settings.theme].table, settings.styles, column.styles]);\n if (colStyles.columnWidth === 'wrap') {\n column.width = column.contentWidth;\n } else if (typeof colStyles.columnWidth === 'number') {\n column.width = colStyles.columnWidth;\n } else if (colStyles.columnWidth === 'auto' || true) {\n if (column.contentWidth <= fairWidth && table.contentWidth > table.width) {\n column.width = column.contentWidth;\n } else {\n dynamicColumns.push(column);\n dynamicColumnsContentWidth += column.contentWidth;\n column.width = 0;\n }\n }\n staticWidth += column.width;\n });\n\n // Distributes extra width or trims columns down to fit\n distributeWidth(dynamicColumns, staticWidth, dynamicColumnsContentWidth, fairWidth);\n\n // Row height, table height and text overflow\n table.height = 0;\n var all = table.rows.concat(table.headerRow);\n all.forEach(function (row, i) {\n var lineBreakCount = 0;\n table.columns.forEach(function (col) {\n var cell = row.cells[col.dataKey];\n applyStyles(cell.styles);\n var textSpace = col.width - cell.styles.cellPadding * 2;\n if (cell.styles.overflow === 'linebreak') {\n // Add one pt to textSpace to fix rounding error\n try {\n cell.text = doc.splitTextToSize(cell.text, textSpace + 1, { fontSize: cell.styles.fontSize });\n } catch (e) {\n if (e instanceof TypeError && Array.isArray(cell.text)) {\n cell.text = doc.splitTextToSize(cell.text.join(' '), textSpace + 1, { fontSize: cell.styles.fontSize });\n } else {\n throw e;\n }\n }\n } else if (cell.styles.overflow === 'ellipsize') {\n cell.text = ellipsize(cell.text, textSpace, cell.styles);\n } else if (cell.styles.overflow === 'visible') {\n // Do nothing\n } else if (cell.styles.overflow === 'hidden') {\n cell.text = ellipsize(cell.text, textSpace, cell.styles, '');\n } else if (typeof cell.styles.overflow === 'function') {\n cell.text = cell.styles.overflow(cell.text, textSpace);\n } else {\n console.error(\"Unrecognized overflow type: \" + cell.styles.overflow);\n }\n var count = Array.isArray(cell.text) ? cell.text.length - 1 : 0;\n if (count > lineBreakCount) {\n lineBreakCount = count;\n }\n });\n\n row.heightStyle = row.styles.rowHeight;\n // TODO Pick the highest row based on font size as well\n row.height = row.heightStyle + lineBreakCount * row.styles.fontSize * FONT_ROW_RATIO;\n table.height += row.height;\n });\n }", "function resizeAroundColumn(col) {\n // Get this column's render container\n var renderContainer = col.getRenderContainer();\n\n renderContainer.visibleColumnCache.forEach(function (column) {\n // Skip the column we just resized\n if (column === col) { return; }\n \n var colDef = column.colDef;\n if (!colDef.width || (angular.isString(colDef.width) && (colDef.width.indexOf('*') !== -1 || colDef.width.indexOf('%') !== -1))) {\n column.width = column.drawnWidth;\n }\n });\n }", "setColumnWidth(column, newWidth) {\n let minWidth = get(column, 'minWidth') || 0;\n set(column, 'width', Math.max(newWidth, minWidth));\n }", "function _setColumnsHeights() {\n setColumnsHeights ('.search-results', '.item');\n }", "function renderColumnFilter(col, status, colname) {\n str = \"<div>\";\n if (status) {\n str += \"<input id='\" + colname + \"_\" + col + \"' type='checkbox' checked onchange='myTable.toggleColumn(\\\"\" + col + \"\\\")'>\"\n str += \"<label for='\" + colname + \"_\" + col + \"'>\" + colname + \"</label>\";\n } else {\n str += \"<input id='\" + colname + \"_\" + col + \"' type='checkbox' onchange='myTable.toggleColumn(\\\"\" + col + \"\\\")'>\"\n str += \"<label for='\" + colname + \"_\" + col + \"'>\" + colname + \"</label>\";\n }\n str += \"</div>\";\n\n return str;\n}", "layout()\n {\n // Do not attempt to use offsets if we're not attached to the document tree yet.\n if (!this._columnWidthsInitialized && this.element.offsetWidth) {\n // Give all the columns initial widths now so that during a resize,\n // when the two columns that get resized get a percent value for\n // their widths, all the other columns already have percent values\n // for their widths.\n var headerTableColumnElements = this._headerTableColumnGroupElement.children;\n var tableWidth = this._dataTableElement.offsetWidth;\n var numColumns = headerTableColumnElements.length;\n for (var i = 0; i < numColumns; i++) {\n var headerCellElement = this._headerTableBodyElement.rows[0].cells[i]\n if (this._isColumnVisible(headerCellElement.columnIdentifier)) {\n var columnWidth = headerCellElement.offsetWidth;\n var percentWidth = ((columnWidth / tableWidth) * 100) + \"%\";\n this._headerTableColumnGroupElement.children[i].style.width = percentWidth;\n this._dataTableColumnGroupElement.children[i].style.width = percentWidth;\n } else {\n this._headerTableColumnGroupElement.children[i].style.width = 0;\n this._dataTableColumnGroupElement.children[i].style.width = 0;\n }\n }\n\n this._columnWidthsInitialized = true;\n }\n\n this._positionResizerElements();\n }", "function applyFixedColGridWidth() {\n var fixedColContainerEl = _fixedColGrid.getContainerNode(),\n innerWrapper = fixedColContainerEl.parentNode,\n width = parseInt(_fixedColGrid.getCanvasNode().style.width, 10);\n\n innerWrapper.style.width = width + 'px';\n fixedColContainerEl.style.width = width + _scrollbarDim.width + _containerBorderDim.left + _containerBorderDim.right + 'px';\n }", "onResize({\n context\n }) {\n const {\n grid\n } = this,\n {\n column\n } = context;\n grid.element.classList.remove('b-column-resizing');\n\n if (context.valid) {\n if (this.liveResize) {\n grid.resizingColumns = false;\n grid.afterColumnsResized();\n } else {\n column.width = context.newWidth;\n } // In case of IE 11 we should calculate flex basis to fix header width\n // covered by ColumnResize.t\n\n if (BrowserHelper.isIE11 && column.parent && column.parent.flex) {\n const parent = column.parent,\n headerEl = grid.getHeaderElement(parent.id);\n headerEl.style.flexBasis = parent.children.reduce((result, column) => {\n return result + grid.getHeaderElement(column.id).offsetWidth;\n }, 0) + 'px';\n }\n }\n }", "_updateSizeRowsCols() {\n const that = this;\n\n that.$.container.removeAttribute('style');\n\n setTimeout(function () {\n if ((that.horizontalScrollBarVisibility === 'disabled' || that.horizontalScrollBarVisibility === 'hidden') && (that.verticalScrollBarVisibility === 'disabled' || that.verticalScrollBarVisibility === 'hidden')) {\n return;\n }\n\n const rectObject = that.getBoundingClientRect();\n\n that.$.container.style.width = rectObject.width + 'px';\n that.$.container.style.height = rectObject.height + 'px';\n }, 0);\n }", "function LayoutColumn(desc) {\n\t var that = this;\n\t this.columnWidth = desc.width || 100;\n\t this.id = _.uniqueId(\"Column_\");\n\t this.filter = desc.filter;\n\n\t this.parent = desc.parent || null; // or null\n\t this.columnBundle = \"primary\";\n\t //define it here to have a dedicated this pointer\n\t this.sortBy = function (a, b) {\n\t a = that.getValue(a);\n\t b = that.getValue(b);\n\t return that.safeSortBy(a, b);\n\t };\n\t }" ]
[ "0.72377944", "0.6704", "0.667537", "0.65788454", "0.65455425", "0.6504886", "0.6488202", "0.64539695", "0.6441284", "0.63467854", "0.6333013", "0.6318571", "0.6317491", "0.62882817", "0.62797755", "0.62797755", "0.6240189", "0.6230854", "0.6179183", "0.6158125", "0.6153481", "0.61414665", "0.6129863", "0.61256564", "0.6111184", "0.61072177", "0.60888326", "0.60723096", "0.60681295", "0.6065391", "0.6064983", "0.60428864", "0.603572", "0.60293216", "0.602223", "0.602045", "0.60074455", "0.5993269", "0.59852713", "0.59836656", "0.59462416", "0.5941727", "0.593596", "0.59323734", "0.5927453", "0.5906963", "0.59033763", "0.5901618", "0.5892056", "0.58911574", "0.58776957", "0.5877177", "0.5867493", "0.58665425", "0.58471614", "0.584345", "0.58428633", "0.58345026", "0.58345026", "0.58345026", "0.5830858", "0.5827224", "0.58208656", "0.5820616", "0.581776", "0.58124244", "0.581077", "0.5805251", "0.57996106", "0.57990104", "0.5778286", "0.5778286", "0.5776778", "0.577673", "0.5765647", "0.5765647", "0.57606244", "0.5758389", "0.57551134", "0.57549524", "0.57535416", "0.57521087", "0.5745968", "0.57451963", "0.5743033", "0.57421815", "0.57370996", "0.57267773", "0.5726711", "0.5724008", "0.57230157", "0.5719678", "0.57193273", "0.57099277", "0.57093155", "0.5690012", "0.56864744", "0.56845707", "0.56837016", "0.5683249" ]
0.58373374
57
looks for search argument in current row
function hasArg(sA,cell_data,j) { var occurence; //Search arg operator tests var hasLO = re_l.test(sA), hasLE = re_le.test(sA); var hasGR = re_g.test(sA), hasGE = re_ge.test(sA); var hasDF = re_d.test(sA), hasEQ = re_eq.test(sA); var hasLK = re_lk.test(sA), hasAN = re_an.test(sA); var hasST = re_st.test(sA), hasEN = re_en.test(sA); var hasEM = (re_em == sA), hasNM = (re_nm == sA); var hasRE = re_re.test(sA); //Search arg dates tests var isLDate = (hasLO && tf_IsValidDate(sA.replace(re_l,''),dtType)); var isLEDate = (hasLE && tf_IsValidDate(sA.replace(re_le,''),dtType)); var isGDate = (hasGR && tf_IsValidDate(sA.replace(re_g,''),dtType)); var isGEDate = (hasGE && tf_IsValidDate(sA.replace(re_ge,''),dtType)); var isDFDate = (hasDF && tf_IsValidDate(sA.replace(re_d,''),dtType)); var isEQDate = (hasEQ && tf_IsValidDate(sA.replace(re_eq,''),dtType)); if(tf_IsValidDate(cell_data,dtType)) {//dates var dte1 = tf_FormatDate(cell_data,dtType); if(isLDate) {// lower date var dte2 = tf_FormatDate(sA.replace(re_l,''),dtType); occurence = (dte1 < dte2); } else if(isLEDate) {// lower equal date var dte2 = tf_FormatDate(sA.replace(re_le,''),dtType); occurence = (dte1 <= dte2); } else if(isGEDate) {// greater equal date var dte2 = tf_FormatDate(sA.replace(re_ge,''),dtType); occurence = (dte1 >= dte2); } else if(isGDate) {// greater date var dte2 = tf_FormatDate(sA.replace(re_g,''),dtType); occurence = (dte1 > dte2); } else if(isDFDate) {// different date var dte2 = tf_FormatDate(sA.replace(re_d,''),dtType); occurence = (dte1.toString() != dte2.toString()); } else if(isEQDate) {// equal date var dte2 = tf_FormatDate(sA.replace(re_eq,''),dtType); occurence = (dte1.toString() == dte2.toString()); } else if(re_lk.test(sA)) // searched keyword with * operator doesn't have to be a date {// like date occurence = o.__containsStr(sA.replace(re_lk,''),cell_data,null,false); } else if(tf_IsValidDate(sA,dtType)) { var dte2 = tf_FormatDate(sA,dtType); occurence = (dte1.toString() == dte2.toString()); } else if(hasEM) //empty occurence = (cell_data.tf_Trim()=='' ? true : false); else if(hasNM) //non-empty occurence = (cell_data.tf_Trim()!='' ? true : false); } else { //first numbers need to be formated if(o.hasColNbFormat && o.colNbFormat[j]!=null) { num_cell_data = tf_RemoveNbFormat(cell_data,o.colNbFormat[j]); nbFormat = o.colNbFormat[j]; } else { if(o.thousandsSeparator==',' && o.decimalSeparator=='.') { num_cell_data = tf_RemoveNbFormat(cell_data,'us'); nbFormat = 'us'; } else { num_cell_data = tf_RemoveNbFormat(cell_data,'eu'); nbFormat = 'eu'; } } // first checks if there is any operator (<,>,<=,>=,!,*,=,{,},rgx:) if(hasLE) //lower equal occurence = num_cell_data <= tf_RemoveNbFormat(sA.replace(re_le,''),nbFormat); else if(hasGE) //greater equal occurence = num_cell_data >= tf_RemoveNbFormat(sA.replace(re_ge,''),nbFormat); else if(hasLO) //lower occurence = num_cell_data < tf_RemoveNbFormat(sA.replace(re_l,''),nbFormat); else if(hasGR) //greater occurence = num_cell_data > tf_RemoveNbFormat(sA.replace(re_g,''),nbFormat); else if(hasDF) //different occurence = o.__containsStr(sA.replace(re_d,''),cell_data) ? false : true; else if(hasLK) //like occurence = o.__containsStr(sA.replace(re_lk,''),cell_data,null,false); else if(hasEQ) //equal occurence = o.__containsStr(sA.replace(re_eq,''),cell_data,null,true); else if(hasST) //starts with occurence = cell_data.indexOf(sA.replace(re_st,''))==0 ? true : false; else if(hasEN) //ends with { var searchArg = sA.replace(re_en,''); occurence = cell_data.lastIndexOf(searchArg,cell_data.length-1)==(cell_data.length-1)-(searchArg.length-1) && cell_data.lastIndexOf(searchArg,cell_data.length-1) > -1 ? true : false; } else if(hasEM) //empty occurence = (cell_data.tf_Trim()=='' ? true : false); else if(hasNM) //non-empty occurence = (cell_data.tf_Trim()!='' ? true : false); else if(hasRE){ //regexp try{ //in case regexp fires an exception var searchArg = sA.replace(re_re,''); //operator is removed var rgx = new RegExp(searchArg); occurence = rgx.test(cell_data); } catch(e) { occurence = false; } } else occurence = o.__containsStr(sA,cell_data,(f['col_'+j]==undefined) ? this.fltTypeInp : f['col_'+j]); }//else return occurence; }//fn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function search(thing, column, isReturned) {\n var result = [];\n var doc = SpreadsheetApp.openById(SCRIPT_PROP.getProperty(\"key\"));\n var sheet = doc.getSheetByName('record');\n var data = sheet.getDataRange().getValues();\n //var data = SpreadsheetApp.getActiveSheet().getDataRange().getValues();\n for (var i = 0; i < data.length; i++) {\n //if (data[i][column] == thing && isReturned ^ !data[i][4]) {\n if (data[i][column] == thing && !data[i][4]) {\n if (isReturned) {\n sheet.getRange(i+1,5).setValue(\"TRUE\");\n data = sheet.getDataRange().getValues();\n }\n result.push(data[i]);\n }\n }\n return result;\n}", "function search(parameter) {\n let currentTableData = [];\n\n initialData.forEach(item => {\n if (item[parameter].toLowerCase().indexOf($(this).val().toLowerCase()) !== -1 && !currentTableData.includes(item)) {\n currentTableData.push(item);\n }\n });\n\n if (currentTableData.length === 0) {\n table.fnClearTable();\n table.fnDraw();\n return;\n }\n\n table.fnClearTable();\n table.fnAddData(currentTableData);\n table.fnDraw();\n}", "function search(dataSet, searchWord) {\r\n\r\n //if is not email, capitalize name\r\n if ( !searchWord.includes(\"@\") ) {\r\n searchWord = capitalize(searchWord);\r\n }\r\n\r\n for(let row of dataSet) {\r\n for(let item in row) {\r\n let position = row[item].indexOf( searchWord );\r\n\r\n //if nothing is found returns -1\r\n if(position > -1) {\r\n return row;\r\n }\r\n }\r\n }\r\n}", "function getRow(sheet, column, name){\n var curSheet = ss.getSheetByName(sheet);\n var headers = curSheet.getRange(1,1,1,curSheet.getLastColumn()).getValues();\n console.log(headers);\n var column = headers[0].map().indexOf(name)+1;\n console.log(headers);\n var newRow = 0;\n console.log(column);\n if(column >= 1){\n var searchRange = curSheet.getRange(1,column,curSheet.getLastRow(),1).getValues();\n for(var i = 0; i<searchRange.length ; i++){\n if (searchRange[i][0] == name){\n console.log(searchRange[i][0]);\n newRow = i + 1;\n return newRow\n }\n }\n \n }else{\n messageUser(\"Supplier Code not indexed\",\"Supplier Code\")\n return curSheet.getLastRow()\n }\n}", "function onSearch(sheetName, searchString, searchTargetCol) {\n var values = sheetName.getDataRange().getValues();\n for(var i=0; i<values.length; i++) {\n if(values[i][searchTargetCol] == searchString) {return i}\n }\n}", "function search(current){\n\n}", "function doubleSearch () {}", "function onSearchTypeDemandeWithLabel(label) {\n if(label===undefined ) throw 'null label';\n \n var column ={TypeDemande:-1}, out='';\n var params = SpreadsheetApp.openById(CLSID)\n .getSheetByName(SHEET_PARAMS)\n .getDataRange()\n .getValues();\n \n for( var i=0;i< params[0].length;i++){\n if(params[0][i]==COLUMN_TYPE2DEMANDE ) {column.TypeDemande=i;break;}\n } \n if(column.TypeDemande==-1 ) {\n Log_Severe(\"onSearchTypeDemandeWithLabel\", Utilities.formatString(\"Column [%s] not defined.\",COLUMN_TYPE2DEMANDE));\n throw \"no params\";\n }\n for( var i=0;i<params.length;i++){\n if( params[i][column.TypeDemande]==label) { out = params[i][column.TypeDemande+1]; break;}\n }\n return out;\n}", "function ROW()\n{\n if(arguments.length==0)\n {\n alert(\"please enter parameter into function \");\n return \"=ROWS()\";\n }\n \n var valuesearchy=window.cell($(\"#\"+passedid[0])).getindex().y;\n return valuesearchy;\n}", "function ROWS()\n{\n if(arguments.length==0)\n {\n alert(\"please enter parameter into function \");\n return \"=ROWS()\";\n }\n \n var valuesearchy=window.cell($(\"#\"+passedid[arguments.length-1])).getindex().y;\n return valuesearchy;\n}", "function search() {\n\t\n}", "function search() {\n restartSearch();\n if (searchField.val()) {\n dt.search(searchField.val()).draw();\n }\n if (searchSelect.val()) {\n dt.columns(2).search(searchSelect.val()).draw();\n }\n}", "function searchRow(rowProp, string) {\n\tif (rowProp) {\n\t\treturn (rowProp.value.toLowerCase().indexOf(string) > -1);\n\t} else { return false; }\n}", "function search(table,column,identifier,search,searchtemp,id,action,exact,searchtype){\n\texact = typeof(exact) != 'undefined' ? exact : 0;\n\tsearchtype = typeof(searchtype) != 'undefined' ? searchtype : 0;\n searchrequest=\"../asearch.php?table=\"+table+\"&column=\"+column+\"&identifier=\"+identifier+\"&search=\"+search+\"&searchtemp=\"+searchtemp+\"&div=\"+id+\"&exact=\"+exact+\"&searchtype=\"+searchtype;\n eventfetch(searchrequest,id,action);\n}", "function searchTerm(){\n \n }", "function searchTimeoutMulti(column, target) {\r\n if (column.search() !== target.value) {\r\n column.search(target.value).draw();\r\n }\r\n }", "function editRow(contact) {\r\n if (searchRow(contact.id, 0, tableContent.children.length-1, contact)){\r\n console.log(\"found!\");\r\n }\r\n}", "function findOpt(data, searchon, searchval, retrieve){\n for (i=0; i<data.length; i++) { \n if (data[i][searchon] == searchval){\n return data[i][retrieve];\n }\n }\n}", "function doFind() {\n //Set the search text to the value in the box\n if (this.id == 'search') {\n findParams.searchText = dom.byId(\"roadName\").value;\n whichSearch = \"grid\";\n } else if (this.id == 'search2') {\n findParams.searchText = dom.byId(\"parcelInfo\").value;\n whichSearch = \"grid1\";\n }\n findTask.execute(findParams, showResults);\n }", "function searchSelection(e) {\n if (e.code === \"ArrowDown\") {\n if (selected === null) {\n setSelected(0);\n } else {\n if (selected < searchResults.length - 1) {\n const newVal = selected + 1;\n setSelected(newVal);\n }\n }\n }\n if (e.code === \"ArrowUp\") {\n if (selected === 0) {\n setSelected(null);\n } else if (selected === null) {\n } else {\n const newVal = selected - 1;\n setSelected(newVal);\n }\n } else if (e.code === \"Enter\") {\n if (selected === null) {\n handleSubmit(e, e.target.value);\n } else {\n const selectedRow = document.querySelector(\"#selected > td\").innerText;\n const rowValues = selectedRow.split(\" \");\n if (rowValues[1] === \"account\") {\n handleSubmit(e, rowValues[0]);\n } else {\n selectSearchItem(e, rowValues[0]);\n }\n }\n }\n }", "function search(value) {\n try {\n $('table.searchable > tbody > tr').show();\n // split on \", \"\n var params = value.split(\", \");\n for (var param = 0; param < params.length; param++) {\n if (params[param] != \"\") {\n var $rows = $('table.searchable > tbody > tr').filter(\":visible\");\n for (var i = 0; i < $rows.length; i++) {\n var $dataValue = $rows.eq(i).children();\n var match = false;\n for (var data = 0; data < $dataValue.length; data++) {\n var $dataHtml = $.trim($dataValue.eq(data).html());\n if ($dataHtml.toLowerCase() === params[param].toLowerCase()) {\n match = true;\n }\n // check if there is a \",\" after the word but no space\n else if (params[param].toLowerCase().charAt(params[param].length-1) === ',') {\n if (params[param].toLowerCase().substring(0, params[param].length-1) === $dataHtml.toLowerCase()) {\n match = true;\n }\n if($dataHtml.toLowerCase().includes(params[param].toLowerCase())) {\n match = true;\n }\n }\n else if (param === params.length-1){\n if($dataHtml.toLowerCase().includes(params[param].toLowerCase())) {\n match = true;\n }\n }\n }\n if (!match) {\n $rows.eq(i).hide();\n }\n else {\n $rows.eq(i).show();\n }\n }\n }\n }\n }\n catch (err) {\n console.log(err);\n // LogErrorScript(err.message, \"SearchScript.search\")\n }\n}", "function findHSIF_row_ByDate(date)\n{\n\t// var searchString = \"180112\";\n\tvar searchString = date;\n\tvar sheet = getSheetByName(\"HSIF\"); \n\tvar column =1; //column Index \n\tvar columnValues = sheet.getRange(2, column, sheet.getLastRow()).getValues(); //1st is header row\n\tvar searchResult = columnValues.findListListIndex(searchString) + 2; //Row Index - 2\n\n\t//return searchResult;\n\n\tif(searchResult != -1){\n //searchResult + 2 is row index.\n //setActiveRange(sheet.getRange(searchResult, 1))\n\t}\n}", "searchQuery(value) {\n let result = this.tableData;\n if (value !== '') {\n result = this.fuseSearch.search(this.searchQuery);\n }\n this.searchedData = result;\n }", "function findInColumn(sheet, col, data) {\n var column = sheet.getRange(col + \":\" + col); // like A:A\n var values = column.getValues(); \n var row = 0;\n while ( values[row] && values[row][0] !== data ) { row++ }\n if (values[row][0] === data) { return row+1 } else { return -1 } \n}", "function getRowIndex(target, row){\r\n\t\tvar state = $.data(target, 'datagrid');\r\n\t\tvar opts = state.options;\r\n\t\tvar rows = state.data.rows;\r\n\t\tif (typeof row == 'object'){\r\n\t\t\treturn indexOfArray(rows, row);\r\n\t\t} else {\r\n\t\t\tfor(var i=0; i<rows.length; i++){\r\n\t\t\t\tif (rows[i][opts.idField] == row){\r\n\t\t\t\t\treturn i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t}", "_lineSearch(lineString, forwardSearch, backwardSearch) {\r\n let forward = lineString.indexOf(forwardSearch);\r\n let backward = lineString.indexOf(backwardSearch);\r\n if (forward >= 0 ){\r\n return forward;\r\n } else if (backward >= 0) {\r\n return backward;\r\n } else {\r\n return -1;\r\n }\r\n }", "function sortedMatrixSearch(matrix, value) {\n if (matrix.length < 1) return -1\n const row = getTargetRow(matrix, value, 0, matrix.length - 1)\n // console.log(row)\n if (row === -1) return -1\n // binary search on this row\n return binarySearch(matrix, value, row, 0, matrix[row].length - 1)\n}", "function indexOf(arr, searchItem) {\n // code here\n}", "function indexOf(arr, searchItem) {\n // code here\n}", "function findCell(PID) {\n var compliance = complianceSheet.getSheets()[0];\n var dataRange = compliance.getDataRange();\n var values = dataRange.getValues();\n for (var i = 2; i < values.length; i++) {\n var row = \"\";\n for (var j = 0; j < 1; j++) { \n if (values[i][j] == PID) {\n row = i + 1;\n return row; \n break;\n }\n } \n } \n}", "function buscar(arg){\n\tquery = \"SELECT * FROM tabla WHERE nombre LIKE '%\"+arg+\"%' OR apellido LIKE '%\"+arg+\"%'\";\n\tloadData(query);\n}", "function SearchEmployee(){\n // Get value of search bar\n var searchInput = document.getElementById(\"searchText\").value;\n var rowIds = [];\n // Do nothing if no input\n if (searchInput != \"\") {\n for (var i=0; i<tableRows.length; i++) {\n // Hiding all rows\n tableRows.item(i).style.display = \"none\"; \n // Displaying row if matches search bar input \n rowIds.push(tableRows.item(i).id)\n }\n if (rowIds.includes(searchInput)) {\n tableRows.item(rowIds.indexOf(searchInput)).style.display = \"table-row\";\n } \n else {\n alert(\"No matching record found.\")\n ClearSearch();\n }\n }\n}", "function checkParamRowTxt(thisTxt, attrName){\n\t\tvar lastIdx = 0;\n\t\tvar lastObj;\n\t\t//Get the last param text index \n\t\t$(\":text\").each(function (index){\n\t\t\t//if($(this).attr(\"name\") == \"paramKeyTxtName[]\"){\n\t\t\tif($(this).attr(\"name\") == attrName){\t\n\t\t\t\tlastIdx = index;\t\n\t\t\t\tlastObj = $(this);\t\n\t\t\t}\n\t\t})\n\t\t\n\t\t//If the last index object is the same object comparing with the target focus object. Create a new row.\n\t\t$(\":text\").each(function (index){\n\t\t\tif($(this).attr(\"name\") == attrName){\t\n\t\t\t\t//console.log( index + \": \" + $( this ).val() +\" - \"+ $(this).attr(\"name\") + \" - \" + $(this).prop(\"name\") );\t\n\t\t\t\tif(lastIdx == index){\n\t\t\t\t\tif($(thisTxt).is($(this))){\n\t\t\t\t\t\taddParamRow(\"\",\"\");\t\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t}\n\t\t})\n\t\t\n\t\t//Update the last index\n\t\t$(\":text\").each(function (index){\n\t\t\tif($(this).attr(\"name\") == attrName){\t\n\t\t\t\tlastIdx = index;\t\t\n\t\t\t}\n\t\t})\n\t\t\n\t\t//Focus on the last one key text\n\t\t$(\":text\").each(function (index){\n\t\t\tif($(this).attr(\"name\") == attrName){\t\n\t\t\t\tif(lastIdx == index){\n\t\t\t\t\tif($(this).is($(thisTxt))){\n\t\t\t\t\t\t//setHighlight($(this));\n\t\t\t\t\t\t$(this).addClass(\"txtFocusClass\");\n\t\t\t\t\t\t$(this).focus();\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//setHighlight($(thisTxt));\n\t\t\t\t\t\t$(thisTxt).addClass(\"txtFocusClass\");\n\t\t\t\t\t\t$(thisTxt).focus();\n\t\t\t\t\t}\t\n\t\t\t\t}\t\n\t\t\t}\n\t\t})\n\t}", "function search4location(inLat,inLng){\n //console.log(input + \" \" + typeof input)\n //console.log(tableData)\n let key = 0;\n let outputRows = [];\n\n for(key = 0; key < grid.getDataLength(); key++){\n if((inLat==grid.getDataItem(key).lat) && (inLng==grid.getDataItem(key).lng)){\n outputRows.push(key)\n }\n /* if(((grid.getDataItem(key).user_location).localeCompare(input))== 0){\n console.log(\"Found it. Key = \" + key)\n break;\n }*/\n }\n\n return outputRows;\n}", "function search4location(inLat,inLng){\n //console.log(input + \" \" + typeof input)\n //console.log(tableData)\n let key = 0;\n let outputRows = [];\n\n for(key = 0; key < grid.getDataLength(); key++){\n if((inLat==grid.getDataItem(key).lat) && (inLng==grid.getDataItem(key).lng)){\n outputRows.push(key)\n }\n /* if(((grid.getDataItem(key).user_location).localeCompare(input))== 0){\n console.log(\"Found it. Key = \" + key)\n break;\n }*/\n }\n\n return outputRows;\n}", "search (input) {\n\t\tlet head = this.head;\n\t\tfor (let i = 0; i < this.length; i++) {\n\t\t\tif (head.data === input) {\n\t\t\t\treturn i;\n\t\t\t} else {\n\t\t\t\thead = head.next;\n\t\t\t}\n\t\t}\n\t\tthrow new Error('Value not found');\n\t}", "function edit_query_arg() {\n var query_arg = $(this).parent(\"span.query-arg\").data(\"query_arg\");\n // select the searchlet\n $(\"a.search-section[searchlet='\" + query_arg.attr + \"']\", container).click();\n // select the query type\n searchlets[query_arg.attr].select(query_arg);\n\n $(\"a\", query).removeClass(\"editing\");\n $(this).children(\"a\").addClass(\"editing\");\n if (settings.debug) dump_query_args(\"edit_query_arg\");\n return false;\n }", "function rowLookup(sheet, value, column) {\n var columnValues = sheet.getRange(1,column,sheet.getLastRow()).getValues();\n for (var i=0; i<columnValues.length; i++) {\n if (columnValues[i] == value) {\n var rowNum = i+1;\n return rowNum;\n }\n }\n return columnValues;\n}", "function openSearchDialog(column, $header, provider) {\n var popup = makePopup($header, 'Search', '<input type=\"text\" size=\"15\" value=\"\" required=\"required\" autofocus=\"autofocus\"><br><label><input type=\"checkbox\">RegExp</label><br>');\n popup.select('input[type=\"text\"]').on('input', function () {\n var search = this.value;\n if (search.length >= 3) {\n var isRegex = popup.select('input[type=\"checkbox\"]').property('checked');\n if (isRegex) {\n search = new RegExp(search);\n }\n provider.searchAndJump(search, column);\n }\n });\n function updateImpl() {\n var search = popup.select('input[type=\"text\"]').property('value');\n var isRegex = popup.select('input[type=\"text\"]').property('checked');\n if (search.length > 0) {\n if (isRegex) {\n search = new RegExp(search);\n }\n provider.searchAndJump(search, column);\n }\n popup.remove();\n }\n popup.select('input[type=\"checkbox\"]').on('change', updateImpl);\n popup.select('.ok').on('click', updateImpl);\n popup.select('.cancel').on('click', function () {\n popup.remove();\n });\n}", "function fieldTest(row,index){\r\n // if field is boolean, search by true/false or yes/no\r\n if(typeof row[fieldName] === 'boolean'){\r\n if(row[fieldName] && ( inputVal === 'true' || inputVal === 'yes' )){\r\n return true;\r\n } else if (!row[fieldName] && ( inputVal === 'false' || inputVal === 'no' )){\r\n return true;\r\n } else {\r\n return true;\r\n }\r\n } else {\r\n return row[fieldName].toLowerCase().indexOf(inputVal.toLowerCase()) > -1;\r\n }\r\n }", "search(find, columnFieldOrId = this.columnId) {\n let me = this,\n column = me.grid.columns.getById(columnFieldOrId) || me.grid.columns.get(columnFieldOrId),\n found = me.store.findByField(column.field, find),\n i = 1,\n grid = me.grid;\n\n Object.assign(me, {\n foundMap: {},\n prevFound: me.found,\n found: found,\n find: find,\n columnId: column.id\n });\n\n if (find) {\n me.showQuickFind();\n } else {\n me.hideQuickFind();\n }\n\n // reset column to use its normal settings for htmlEncoding\n if (me.currentColumn && me.currentColumn !== column) me.currentColumn.disableHtmlEncode = false;\n\n // clear old hits\n for (let cell of DomHelper.children(grid.element, '.b-quick-hit')) {\n //IE11 doesnt support this\n //cell.classList.remove('b-quick-hit', 'b-quick-hit-cell');\n cell.classList.remove('b-quick-hit');\n cell.classList.remove('b-quick-hit-cell');\n\n // rerender cell to remove quick-hit-text\n let row = DomDataStore.get(cell).row;\n row.renderCell(cell);\n }\n\n // want to set innerHTML each time for cell decoration to work\n column.disableHtmlEncode = true;\n me.currentColumn = column;\n\n if (!found) return;\n\n if (found.length > 0) {\n me.gotoClosestHit(grid.focusedCell, found);\n }\n\n // highlight hits for visible cells\n for (let hit of found) {\n me.foundMap[hit.id] = i++;\n\n let row = grid.getRowById(hit.data.id);\n if (row) {\n row.renderCell(row.getCell(column.id));\n }\n\n // limit highlighted hits\n if (i > 1000) break;\n }\n\n me.grid.trigger('quickFind', { find, found });\n }", "function matchAndFill(node) {\n var nodeId = node.getAttribute(\"id\");\n var strToMatch = XXH(node.value);\n var arrToSearch = G_OBJROWINDICES[nodeId];\n var intStartIndex = arrToSearch.length;\n\n var intIndex = arrToSearch.lastIndexOf(strToMatch, intStartIndex);\n while (intIndex != -1) {\n objRow = objTable.rows[intIndex + 1];\n objNameColumn = objRow.cells[1];\n if (objNameColumn.firstChild) {\n strName = objNameColumn.firstChild.nodeValue;\n if (true == confirm(\"Found '\" + strName + \n \"'.\\nSelect 'OK' to keep this choice.\" +\n \"\\n'Cancel' to see next choice (or search ends if no more matches).\") ) {\n fillFormFromRow(objRow);\n if (typeof checkinhelp != 'undefined') { checkinhelp.toggleForm(1);}\n return false;\n }\n }\n intStartIndex = intIndex - 1;\n intIndex = arrToSearch.lastIndexOf(strToMatch, intStartIndex);\n\n } // end while looking through array backwards\n return false;\n}", "function dm_search(d_o1,ev,smId){var s=d_o1.value;d_ce=_dmvi(smId);var fromItem=null;if(ev.keyCode==13){fromItem=d_o1.prevItem;}if(!d_ce||s==\"-\"||d_o1.frase==s&&!fromItem){return;}_dmOOa(d_ce);d_o1.style.backgroundColor=\"\";d_o1.frase=s;if(!s){return;}d_iv=_dmlO(d_ce,s,dmSearch==2,fromItem);if(d_iv&&d_iv==fromItem){d_iv=_dmlO(d_ce,s,dmSearch==2,null);}if(d_iv){_dIO(d_iv);d_o1.prevItem=d_iv;}else{d_o1.style.backgroundColor=\"red\";d_o1.prevItem=null;}}", "function search(x, arr) {\n return null; \n}", "function getColumnMatches(column, query) {\nfor (i = 0; i < column.length; i++){\n if (column[i].toLowerCase().indexOf(query) >= 0){\n matchIndexes.push(i)\n }\n}\n}", "function MATCH()\n{\n if(arguments.length==0)\n {\n alert(\"please enter parameter into function \");\n return \"=MATCH()\";\n }\n \n for(var i=1;i<arguments.length-1;i++)\n {\n \n if(arguments[0]==arguments[i])\n\n {\n return i;\n }\n \n \n }\n\n \n\n return \"#NAME?\";\n\n}", "function matchDiplom(params, data) {\n params.term = params.term || '';\n // If there are no search terms, return all of the data\n if (params.term.replace(/\\s+/g, '') === '') {\n return data;\n }\n // Do not display the item if there is no 'text' property\n if (typeof data.text === 'undefined') {\n return null;\n }\n if (data.text.toUpperCase().replace(/\\s+/g, '').indexOf(params.term.toUpperCase().replace(/\\s+/g, '')) > -1) {\n return data;\n }\n return null;\n}", "function runSearch(argument, search) {\n switch (argument) {\n case \"spotify-this-song\":\n spotifySearch(search);\n break;\n\n case \"movie-this\":\n omdbSearch(search);\n break;\n\n case \"concert-this\":\n bandsSearch(search);\n break;\n\n case \"do-what-it-says\":\n readFile(search);\n break;\n\n case \"help\":\n help();\n break;\n\n default:\n nullCase();\n }\n}", "_retrieveSearchData(data: List<Object>, fields: List<string>, needle: string) {\n // Retrieving all records that have the search string\n return data.filter(row => {\n // Searching for search string in all fields\n for (let f = 0; f < fields.size; f++) {\n // Asserting current field has search string, if yes return true and if no \n // continue searching\n if (row[fields.get(f)].toString().toLowerCase().indexOf(needle) > -1) {\n return true;\n }\n }\n\n // Declaring search string was not found in any field\n return false;\n });\n }", "search(find, columnFieldOrId = this.columnId) {\n let me = this,\n column = me.grid.columns.getById(columnFieldOrId) || me.grid.columns.get(columnFieldOrId),\n found = me.store.findByField(column.field, find),\n i = 1,\n grid = me.grid;\n Object.assign(me, {\n foundMap: {},\n prevFound: me.found,\n found: found,\n find: find,\n columnId: column.id\n });\n\n if (find) {\n me.showQuickFind();\n } else {\n me.hideQuickFind();\n } // reset column to use its normal settings for htmlEncoding\n\n if (me.currentColumn && me.currentColumn !== column) me.currentColumn.disableHtmlEncode = false; // clear old hits\n\n for (let cell of DomHelper.children(grid.element, '.b-quick-hit')) {\n //IE11 doesnt support this\n //cell.classList.remove('b-quick-hit', 'b-quick-hit-cell');\n cell.classList.remove('b-quick-hit');\n cell.classList.remove('b-quick-hit-cell'); // rerender cell to remove quick-hit-text\n\n let row = DomDataStore.get(cell).row;\n row.renderCell(cell);\n } // want to set innerHTML each time for cell decoration to work\n\n column.disableHtmlEncode = true;\n me.currentColumn = column;\n if (!found) return;\n\n if (found.length > 0) {\n me.gotoClosestHit(grid.focusedCell, found);\n } // highlight hits for visible cells\n\n for (let hit of found) {\n me.foundMap[hit.id] = i++;\n let row = grid.getRowById(hit.data.id);\n\n if (row) {\n row.renderCell(row.getCell(column.id));\n } // limit highlighted hits\n\n if (i > 1000) break;\n }\n\n me.grid.trigger('quickFind', {\n find,\n found\n });\n }", "function searchRowsEtc() {\n var checking;\n var result = false;\n for (var i = 0; i < toCheck.length; i) {\n console.log(toCheck[0][0] + \",\" + toCheck[0][1])\n checking = toCheck.shift();\n switch (checking[0]) {\n case 0:\n if (checkRow(checking[1])) {\n result = true;\n }\n break;\n case 1:\n if (checkCol(checking[1])) {\n result = true;\n }\n break;\n case 2:\n if (checkSector(checking[1])) {\n result = true;\n }\n break;\n }\n }\n //returns true if any soluntions were found\n return result;\n}", "search(val) {\n let found = this.root.search(val);\n return found;\n }", "function search4row(userName){\n let outputRows = [];\n let key = 0;\n\n for(key = 0; key < grid.getDataLength(); key++){\n if(((grid.getDataItem(key).user_name).localeCompare(userName))== 0){\n outputRows.push(key); //if user found save row number\n }\n }\n\n return outputRows;\n}", "function search4row(userName){\n let outputRows = [];\n let key = 0;\n\n for(key = 0; key < grid.getDataLength(); key++){\n if(((grid.getDataItem(key).user_name).localeCompare(userName))== 0){\n outputRows.push(key); //if user found save row number\n }\n }\n\n return outputRows;\n}", "search(e: Event) {\n // Retrieving input html element with the search string\n const target = ((e.target: any): HTMLInputElement);\n\n // Retrieving search string\n const needle: string = target.value.toLowerCase();\n\n // Asserting search was initialized\n invariant(this._preSearchData && this._preSearchData != null, \"CRUDActions.search: search wasn't initialized\");\n\n // If search string wasn't retrieved successfully or it is an empty string, stop search\n if (!needle) {\n this.crudStore.setData(this._preSearchData);\n return;\n }\n\n // Retrieving fields of data\n const fields: List<string> = this.crudStore.getSchema().map(item => item.id);\n\n // Retrieving all records that have the search string\n let searchData;\n if (this._preSearchData && this._preSearchData != null) {\n searchData = this._retrieveSearchData(this._preSearchData, fields, needle)\n\n // Updating data in store without committing since this update is temporary until\n // search in finished\n this.crudStore.setData(searchData);\n }\n }", "function search(x, y, list) {\n for (var i = 0; i < list.length; i++) {\n if (list[i][0] == x && list[i][1] == y) {\n return i;\n }\n }\n return -1;\n}", "function handleSearch() {\n triggerSearch({}); // need empty braces here\n }", "callbackSearchEvent(event, args) {\n if (args) {\n const searchTerm = ((event && event.target) ? event.target.value : undefined);\n const searchTerms = (args.searchTerms && Array.isArray(args.searchTerms)) ? args.searchTerms : (searchTerm ? [searchTerm] : undefined);\n const columnDef = args.columnDef || null;\n const columnId = columnDef && columnDef.id || '';\n const operator = args.operator || undefined;\n const hasSearchTerms = searchTerms && Array.isArray(searchTerms);\n const termsCount = hasSearchTerms && searchTerms && searchTerms.length;\n const oldColumnFilters = Object.assign({}, this._columnFilters);\n if (columnDef && columnId) {\n if (!hasSearchTerms || termsCount === 0 || (termsCount === 1 && Array.isArray(searchTerms) && searchTerms[0] === '')) {\n // delete the property from the columnFilters when it becomes empty\n // without doing this, it would leave an incorrect state of the previous column filters when filtering on another column\n delete this._columnFilters[columnId];\n }\n else {\n const colId = '' + columnId;\n const colFilter = {\n columnId: colId,\n columnDef,\n searchTerms,\n };\n if (operator) {\n colFilter.operator = operator;\n }\n this._columnFilters[colId] = colFilter;\n }\n }\n // event might have been created as a CustomEvent (e.g. CompoundDateFilter), without being a valid Slick.EventData,\n // if so we will create a new Slick.EventData and merge it with that CustomEvent to avoid having SlickGrid errors\n const eventData = (event && typeof event.isPropagationStopped !== 'function') ? $.extend({}, new Slick.EventData(), event) : event;\n // trigger an event only if Filters changed or if ENTER key was pressed\n const eventKeyCode = event && event.keyCode;\n if (eventKeyCode === KeyCode.ENTER || !isequal(oldColumnFilters, this._columnFilters)) {\n this._onSearchChange.notify({\n clearFilterTriggered: args.clearFilterTriggered,\n shouldTriggerQuery: args.shouldTriggerQuery,\n columnId,\n columnDef,\n columnFilters: this._columnFilters,\n operator,\n searchTerms,\n grid: this._grid\n }, eventData);\n }\n }\n }", "function dfSearch(node, target) {}", "function VLOOKUP()\n{\n if(arguments.length==0)\n {\n alert(\"please enter parameter into function \");\n return \"=VLOOKUP()\";\n }\n var j=1;\n var position=arguments[arguments.length-2];\n for(var i=1;i<arguments.length-2;i++)\n {\n if(arguments[0]==arguments[i])\n while(j<position)\n {\n j++,i++;\n if(j==position)\n return arguments[i];\n }\n }\n return \"#NAME?\";\n}", "function search() {\n let search_text = $search_text.value;\n decide_search(search_text)\n}", "onSearchChange(searchText, colInfos, multiColumnSearch) {\n const currentIndex = (this.state.currentPage - 1) * this.state.sizePerPage;\n const text = searchText.trim();\n if (text === '') {\n this.setState({\n data: this.props.targets.slice(currentIndex, currentIndex + this.state.sizePerPage),\n });\n return;\n }\n\n let searchTextArray = [];\n if (multiColumnSearch) {\n searchTextArray = text.split(' ');\n } else {\n searchTextArray.push(text);\n }\n\n const result = this.props.targets.filter((product) => {\n const keys = Object.keys(product);\n let valid = false;\n for (let i = 0, keysLength = keys.length; i < keysLength; i++) {\n const key = keys[i];\n if (colInfos[key] && product[key]) {\n const { format, filterFormatted, formatExtraData, searchable, hidden } = colInfos[key];\n let targetVal = product[key];\n if (!hidden && searchable) {\n if (filterFormatted && format) {\n targetVal = format(targetVal, product, formatExtraData);\n }\n for (let j = 0, textLength = searchTextArray.length; j < textLength; j++) {\n const filterVal = searchTextArray[j].toLowerCase();\n if (targetVal.toString().toLowerCase().indexOf(filterVal) !== -1) {\n valid = true;\n break;\n }\n }\n }\n }\n }\n return valid;\n });\n this.setState(() => ({\n data: result.slice(currentIndex, currentIndex + this.state.sizePerPage),\n totalSize: result.length,\n }));\n }", "search(query, action) {\n\n if (query == \"\") {\n return;\n }\n //return if another search is ongoing\n if (this.searching) {\n return;\n }\n //make searchin current screen data first\n // if not found any matching go for backend.\n\n let lastSearchedIndex = this.state.lastSearchedIndex,\n regEx = new RegExp(query, \"gi\"),\n fields = this.state.fields,\n selectedRow = [],\n localIndex;\n let direction = '';\n switch (action) {\n case \"next\": {\n localIndex = this.state.mainTableData.findIndex((row, index) => {\n if (index > lastSearchedIndex)\n for (let i = 0; i < fields.length; i++) {\n if (row[fields[i]] && row[fields[i]].toString().match(regEx) != null) {\n selectedRow.push(row.EZID);\n return true;\n }\n }\n });\n direction = \"N\"\n }\n break;\n case \"previous\": {\n let reverserMainTableData = this.state.mainTableData.concat([]).reverse();\n let reverseLastSearchedIndex = reverserMainTableData.length - lastSearchedIndex;\n let reversedLocalIndex = reverserMainTableData.findIndex((row, index) => {\n if (index >= reverseLastSearchedIndex)\n for (let i = 0; i < fields.length; i++) {\n if (row[fields[i]].toString().match(regEx) != null) {\n selectedRow.push(row.EZID);\n return true;\n }\n }\n });\n\n localIndex = reversedLocalIndex > -1 ? reverserMainTableData.length - reversedLocalIndex - 1 : -1;\n direction = \"P\"\n }\n break;\n case \"search\": {\n localIndex = this.state.mainTableData.findIndex((row, index) => {\n for (let i = 0; i < fields.length; i++) {\n if (row[fields[i]].toString().match(regEx) != null) {\n selectedRow.push(row.EZID);\n return true;\n }\n }\n });\n }\n\n }\n\n //if valid searched data is found.\n if (localIndex > -1) {\n this.setState({\n lastSearchedIndex: localIndex,\n selectedRow: selectedRow,\n searchedText: query\n });\n }\n else {\n\n\n this.searching = true;\n this.setState({\n searchedText: query\n });\n this.fetchData({type: \"SEARCH_RECORD\", data: {query: query, direction: direction}})\n }\n }", "function searchEditKey(parKey) {\n var keyVal = parKey[0];\n var cmp = $(\"div[functEdit='\" + parKey[1] + \"']\")[0];\n var datos = new Array();\n //var par = customSearchObject['customFunction'](parKey[1]);\n var par;\n if (cmp.getAttribute(\"table\") && cmp.getAttribute(\"camposamostrar\")) {\n datos[0] = cmp.getAttribute(\"table\");\n datos[1] = JSON.parse(cmp.getAttribute(\"camposamostrar\"));\n datos[2] = $(cmp).attr(\"dataedit\");\n par = customSearchObject['customFunction'](parKey[1], datos);\n } else {\n par = customSearchObject['customFunction'](parKey[1]);\n }\n par.query.camposWhere.push(par.mainFiltersEdit.showKey);\n par.query.valoresWhere.push(keyVal);\n var getVal = searchRanges(-1, par, true);\n var editFather = $(\"div[functEdit='\" + parKey[1] + \"']\");\n if (getVal === -1) {\n getVal = undefined;\n\n } else {\n getVal = getVal[0][0];\n }\n\n if (getVal === undefined) {\n editFather.children(\".editKey\").val(\"\");\n editFather.children(\".editBrief\").val(\"\");\n editFather.removeAttr(\"value\");\n /*editFather.removeAttr(\"extravalues\");*/\n showObjectEdit(null, parKey[1]);\n alert(\"Esta clave no existe\");//99\n } else {\n var dataShow = par.query.camposMostrar;\n var foundID = dataShow.findIndex(x => x === \"id\");\n var foundKey = dataShow.findIndex(x => x === par.mainFiltersEdit.showKey);\n var foundBrief = null;\n if (par.mainFiltersEdit.showBrief) {\n if (par.mainFiltersEdit.showBrief.includes(\"@\")) {\n var variable = par.mainFiltersEdit.showBrief.toString().replace(\"@\", \"\");\n var camposConcat = variable.split(\",\");\n foundBrief = new Array();\n for (var i = 0; i < camposConcat.length; i++) {\n foundBrief[foundBrief.length] = dataShow.findIndex(x => x === camposConcat[i]);\n }\n } else {\n foundBrief = dataShow.findIndex(x => x === par.mainFiltersEdit.showBrief);\n }\n }\n\n\n var idEl = null;\n\n getVal.forEach(function (item, index) {\n if (index === foundID) {\n $(\"[dataEdit=\" + par.mainFiltersEdit.dataEdit + \"]\").attr(\"value\", item);\n idEl = item;\n }\n if (index === foundKey) {\n editFather.children(\".editKey\").val(item);\n } else if (index === foundBrief) {\n editFather.children(\".editBrief\").val(item);\n } else if (Array.isArray(foundBrief)) {\n if (foundBrief.includes(index)) {\n var brief = \"\";\n foundBrief.forEach(element => brief += getVal[element] + \" \");\n editFather.children(\".editBrief\").val(brief);\n }\n }\n });\n\n //editFather.children(\".editBrief\").val(brief);\n\n if (par.showColumns == null) {\n showObjectEdit(idEl, parKey[1]);\n } else if (par.identificador !== \"\") {\n if (par.camposWhereEsp != null && par.valoresWhereEsp != null) {\n par.camposWhereEsp.push(par.mainFiltersEdit.showKey);\n par.valoresWhereEsp.splice(par.camposWhereEsp.length - 1, 0, keyVal);\n } else {\n if (par.valoresWhereEsp != null) {\n par.camposWhereEsp = new Array();\n par.camposWhereEsp.push(par.mainFiltersEdit.showKey);\n par.valoresWhereEsp.unshift(keyVal);\n }\n }\n getEditObjectSelectedEsp(par, parKey[1]);\n } else {\n getEditObjectSelected(par, editFather.attr(\"dataedit\"));\n }\n }\n}", "searchByData(data) {\n debug(`\\nLOG: search for the data inside the array`);\n \n const foundIndex = this.array.indexOf(data);\n if (foundIndex !== -1) {\n return `Info: found the ${data} in the array at ${foundIndex}`;\n }\n\n return `Info: didn't found the ${data} in the array`;\n }", "function search(el, direct) {\n var query;\n if (!direct) {\n el = $(el);\n query = el.parent().parent().children('input').val()\n }\n else\n query = direct;\n\n if (!query)\n return;\n\n window.location = '/list?query=' + query;\n}", "function search(arr, item) {\n return arr.indexOf(item)\n }", "function searchtb(table,fields)\n {\n \n \n }", "function findIdx(table, val) {\n }", "function searchRows(){\n\tvar $rows = $('.UpdateStageData');\n\t$('#updateStageSearch').keyup(function() {\n\t var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();\n\t \n\t $rows.show().filter(function() {\n\t var text = $(this).text().replace(/\\s+/g, ' ').toLowerCase();\n\t return !~text.indexOf(val);\n\t }).hide();\n\t});\n}", "checkSearchParam(search) {\n check(search, String);\n }", "function search(array,item) {\n for (var j=0; j<array.length; j++) {\n if (array[j][0].match(item)) return j;\n }\n return -1;\n}", "function doSearch() {\n var tableReg = document.getElementById('datos');\n var searchText = document.getElementById('searchTerm').value.toLowerCase();\n var cellsOfRow = \"\";\n var found = false;\n var compareWith = \"\";\n\n // Recorremos todas las filas con contenido de la tabla\n for (var i = 1; i < tableReg.rows.length; i++) {\n cellsOfRow = tableReg.rows[i].getElementsByTagName('td');\n found = false;\n // Recorremos todas las celdas\n for (var j = 0; j < cellsOfRow.length && !found; j++) {\n compareWith = cellsOfRow[j].innerHTML.toLowerCase();\n // Buscamos el texto en el contenido de la celda\n if (searchText.length == 0 || (compareWith.indexOf(searchText) > -1)) {\n found = true;\n }\n }\n if (found) {\n tableReg.rows[i].style.display = '';\n }\n else {\n // si no ha encontrado ninguna coincidencia, esconde la\n // fila de la tabla\n tableReg.rows[i].style.display = 'none';\n }\n }\n}", "renderCell({\n cellElement,\n column,\n record,\n value,\n cellContent\n }) {\n const me = this,\n hitIndex = me.foundMap && me.foundMap[column.field + '-' + record.id]; // clear search stuff from cell, might not be done by rendering since it does not always set innerHTML any longer\n //if (me.hitElements.includes(cellElement)) {\n // const textElement = cellElement.querySelector('.b-search-hit-text'),\n // badgeElement = cellElement.querySelector('.b-search-hit-cell-badge');\n //\n // textElement && textElement.remove();\n // badgeElement && badgeElement.remove();\n //\n // cellElement.classList.remove('b-search-hit');\n // cellElement.classList.remove('b-search-hit-cell');\n //\n // me.hitElements.splice(me.hitElements.indexOf(cellElement), 1);\n //}\n\n if (hitIndex) {\n // highlight cell\n cellElement.classList.add('b-search-hit'); // highlight in cell if found in innerHTML\n\n const inner = DomHelper.down(cellElement, '.b-grid-cell-value') || cellElement,\n find = String(me.find).toLowerCase();\n\n if (String(value).toLowerCase() === find) {\n inner.innerHTML = `<span class=\"b-search-hit-text\">${cellContent}</span><div class=\"b-search-hit-cell-badge\">${hitIndex}</div>`;\n } else {\n const find = String(me.find).toLowerCase(),\n where = cellContent && cellContent.toLowerCase().indexOf(find);\n\n if (where > -1) {\n const end = where + find.length,\n casedFind = cellContent.slice(where, end);\n inner.innerHTML = `${cellContent.slice(0, where)}<span class=\"b-search-hit-text\">${casedFind}</span>${cellContent.slice(end)}<div class=\"b-search-hit-cell-badge\">${hitIndex}</div>`;\n } else {\n cellElement.classList.add('b-search-hit-cell');\n }\n }\n\n me.hitEls.push(cellElement);\n }\n }", "function searchThis(e) {\n $('#searchbox').val($(e).text());\n FJS.filter();\n}", "filterKeywordSearch() {\n const self = this;\n let dataset;\n let isFiltered;\n let i;\n let len;\n let filterExpr = self.filterExpr;\n\n const checkRow = function (data, row) {\n let isMatch = false;\n\n const checkColumn = function (columnId) {\n const column = self.columnById(columnId)[0];\n\n const fieldValue = self.fieldValue(data, column.field);\n let value;\n const cell = self.settings.columns.indexOf(column);\n\n // Use the formatted value (what the user sees in the cells)\n // since it's a more reliable match\n value = self.formatValue(column.formatter, row, cell, fieldValue, column, data, self);\n value = value.toLowerCase();\n\n // Strip any html markup that might be in the formatted value\n value = value.replace(/(<([^>]+)>)|(amp;)|(&lt;([^>]+)&gt;)/ig, '');\n\n return value.indexOf(xssUtils.escapeHTML(filterExpr.value)) > -1;\n };\n\n // Check in all visible columns\n if (filterExpr.column === 'all') {\n self.element.find('th:visible').each(function () { //eslint-disable-line\n const th = $(this);\n const columnId = th.attr('data-column-id');\n\n if (columnId) {\n isMatch = checkColumn(columnId);\n if (isMatch) {\n return false;\n }\n }\n });\n } else if (filterExpr.columnId) { // Check in only one column, given by columnId\n isMatch = checkColumn(filterExpr.columnId);\n }\n return isMatch;\n };\n\n // Make sure not more/less than one filter expr\n if (!filterExpr || filterExpr.length !== 1) {\n return;\n }\n filterExpr = filterExpr[0];\n\n // Check in dataset\n if (self.settings.treeGrid) {\n dataset = self.settings.treeDepth;\n for (i = 0, len = dataset.length; i < len; i++) {\n isFiltered = filterExpr.value === '' ? false : !checkRow(dataset[i].node, i);\n dataset[i].node._isFilteredOut = isFiltered;\n }\n } else {\n dataset = self.settings.dataset;\n for (i = 0, len = dataset.length; i < len; i++) {\n isFiltered = filterExpr.value === '' ? false : !checkRow(dataset[i], i);\n dataset[i]._isFilteredOut = isFiltered;\n }\n }\n }", "function searchInSortedMatrix(matrix, target) {\n // Write your code here.\n\tlet row = 0; \n\tlet col = matrix[0].length - 1; \n\twhile(row < matrix.length && col >= 0) {\n\t\tif(matrix[row][col] > target) {\n\t\t\tcol -= 1;\n\t\t} else if(matrix[row][col] < target) {\n\t\t\trow += 1;\n\t\t} else {\n\t\t\treturn [row, col]; \n\t\t}\n\t}\n\treturn [-1,-1]; \n}", "function search(arr, item) {\n return arr.indexOf(item);\n }", "if (arr[left] == search_Element)\n\t\t{\n\t\t\tposition = left;\n\t\t\tdocument.write(\n\t\t\t\t\"Element found in Array at \" +\n\t\t\t\t(position + 1) + \" Position with \" +\n\t\t\t\t\t(left + 1) + \" Attempt\");\n\t\t\tbreak;\n\t\t}", "searchByHairColor( hairColorToSearch ) {\n let itemId = this.ItemNotFound;\n let list = this.state[this.townName];\n \n for( let indx=0; indx<list.length; ++indx ) {\n if( list[indx].hair_color.toLowerCase() === hairColorToSearch.toLowerCase() ) {\n itemId = list[indx].id;\n break;\n }\n }\n console.log('searchByHairColor :',itemId);\n\n return itemId;\n }", "function matrixSearch(matrix,search){\n for(let i = 0; i < matrix.length; i++){\n for(let j = 0; j < matrix[0].length; j++){\n if(matrix[i][j] == search[0][0]){\n console.log(\"We found the start of a match!\");\n let match = true;\n //Now we need to search through the \n //matched sections to see if they still match\n for(let x = 0; x < search.length; x++){\n for(let z = 0; z < search[0].length; z++){\n if(matrix[x+i][z+j] == search[x][z]){\n console.log(\"It's still matching!\");\n // We're good, keep going\n } else {\n // We're not good, need to break out\n match = false;\n }\n }\n }\n if (match) return [i, j];\n }\n }\n }\n return [-1,-1]\n}", "arrayLikeSearch() {\r\n this.setEventListener();\r\n if (!this.display || this.display == this.selectedDisplay) {\r\n this.setEmptyTextResults();\r\n \r\n return true;\r\n }\r\n this.resultslength = this.results.length;\r\n this.$emit(\"results\", { results: this.results });\r\n this.load = false;\r\n\r\n if (this.display != this.selectedDisplay) {\r\n this.results = this.source.filter((item) => {\r\n return this.formatDisplay(item)\r\n .toLowerCase()\r\n .includes(this.display.toLowerCase())&& !item.invisible;\r\n });\r\n \r\n \r\n }\r\n }", "function doSearch(){\n var tableReg = document.getElementById('datos');\n var searchText = document.getElementById('searchTerm').value.toLowerCase();\n var cellsOfRow=\"\";\n var found=false;\n var compareWith=\"\";\n // Recorremos todas las filas con contenido de la tabla\n for (var i = 1; i < tableReg.rows.length; i++)\n {\n cellsOfRow = tableReg.rows[i].getElementsByTagName('td');\n found = false;\n // Recorremos todas las celdas\n for (var j = 0; j < cellsOfRow.length && !found; j++)\n {\n compareWith = cellsOfRow[j].innerHTML.toLowerCase();\n // Buscamos el texto en el contenido de la celda\n if (searchText.length == 0 || (compareWith.indexOf(searchText) > -1))\n {\n found = true;\n }\n }\n if(found)\n {\n tableReg.rows[i].style.display = '';\n } else {\n // si no ha encontrado ninguna coincidencia, esconde la\n // fila de la tabla\n tableReg.rows[i].style.display = 'none';\n }\n }\n}", "function search(e) {\n const input = e.currentTarget.value.toLocaleLowerCase();\n const search_div = document.querySelector('#activity #filter-search');\n const cards_div = document.querySelector('#activity #filter-cards');\n const filter_container = document.querySelector('#activity .filter-container');\n\n if (input.length === 0) {\n clearSearch(e);\n } else {\n if (search_div.dataset.visible !== 'visible') {\n search_div.dataset.visible = 'visible';\n cards_div.dataset.visible = 'hidden';\n filter_container.dataset.visible = 'hidden';\n }\n for (let key of search_div.querySelectorAll('.activity-row .agent')) {\n if (key.textContent.toLocaleLowerCase().includes(input)) {\n key.closest('.activity-row').dataset.active = 'true';\n } else key.closest('.activity-row').dataset.active = 'false';\n }\n }\n}", "function searchUtil(item,toSearch)\n{\n /* Search Text in all 3 fields */\n return ( item.name.toLowerCase().indexOf(toSearch.toLowerCase()) > -1 || item.Email.toLowerCase().indexOf(toSearch.toLowerCase()) > -1 || item.EmpId == toSearch\n ) \n ? true : false ;\n}", "function buttonPressed()\n{\n // get the input text field\n var inputVal = document.getElementById( \"inputVal\" );\n\n // get the result paragraph\n var result = document.getElementById( \"result\" );\n\n // get the search key from the input text field the perform the search\n var searchKey = parseInt( inputVal.value );\n var element = a.indexOf( searchKey );\n\n if ( element != -1 )\n {\n result.innerHTML = \"Found value in element \" + element;\n } // end if\n else\n {\n result.innerHTML = \"Value not found\";\n } // end else\n} // end function buttonPressed", "function search(nameKey, myArray){\n for (var i=0; i < myArray.length; i++) {\n if (myArray[i][0].beer_id == nameKey) {\n return i;\n }\n\n }\n return -1;\n }", "renderCell({ cellElement, column, record, value, cellContent }) {\n const me = this,\n hitIndex = me.foundMap && me.foundMap[column.field + '-' + record.id];\n\n // clear search stuff from cell, might not be done by rendering since it does not always set innerHTML any longer\n //if (me.hitElements.includes(cellElement)) {\n // const textElement = cellElement.querySelector('.b-search-hit-text'),\n // badgeElement = cellElement.querySelector('.b-search-hit-cell-badge');\n //\n // textElement && textElement.remove();\n // badgeElement && badgeElement.remove();\n //\n // cellElement.classList.remove('b-search-hit');\n // cellElement.classList.remove('b-search-hit-cell');\n //\n // me.hitElements.splice(me.hitElements.indexOf(cellElement), 1);\n //}\n\n if (hitIndex) {\n // highlight cell\n cellElement.classList.add('b-search-hit');\n\n // highlight in cell if found in innerHTML\n const inner = DomHelper.down(cellElement, '.b-grid-cell-value') || cellElement,\n find = String(me.find).toLowerCase();\n\n if (String(value).toLowerCase() === find) {\n inner.innerHTML = `<span class=\"b-search-hit-text\">${cellContent}</span><div class=\"b-search-hit-cell-badge\">${hitIndex}</div>`;\n } else {\n const find = String(me.find).toLowerCase(),\n where = cellContent && cellContent.toLowerCase().indexOf(find);\n\n if (where > -1) {\n let end = where + find.length,\n casedFind = cellContent.slice(where, end);\n\n inner.innerHTML = `${cellContent.slice(\n 0,\n where\n )}<span class=\"b-search-hit-text\">${casedFind}</span>${cellContent.slice(\n end\n )}<div class=\"b-search-hit-cell-badge\">${hitIndex}</div>`;\n } else {\n cellElement.classList.add('b-search-hit-cell');\n }\n }\n\n me.hitEls.push(cellElement);\n }\n }", "function onRowClickHandler(evt) {\n var clickedGridRow, selectedFeature;\n if (whichSearch == \"grid\") {\n clickedGridRow = evt.grid.getItem(evt.rowIndex).OBJECTID;\n selectedFeature = arrayUtil.filter(map.graphics.graphics, function (graphic) {\n return ((graphic.attributes) && graphic.attributes.OBJECTID === clickedGridRow);\n });\n } else if (whichSearch == \"grid1\") {\n clickedGridRow = evt.grid.getItem(evt.rowIndex).ACCTID;\n selectedFeature = arrayUtil.filter(map.graphics.graphics, function (graphic) {\n return ((graphic.attributes) && graphic.attributes.ACCTID === clickedGridRow);\n });\n }\n if (selectedFeature.length) {\n map.setExtent(selectedFeature[0].geometry.getExtent(), true);\n }\n }", "function manualSearch(e) {\n let term = document.querySelector(\"#searchTerm\").value;\n term = term.trim();\n if (term.length < 1) return;\n manualSearchData(term.toLowerCase());\n}", "function Search_Index_In_Add_Ary( student_name, student_className )\r\r\n{\r\r\n\tvar count = Student_Add_Ary[0].length;\r\r\n\r\r\n\tfor( i=0; i<count; i++ )\r\r\n\t{\r\r\n\t\tif( Student_Add_Ary[1][i]==student_name && Student_Add_Ary[3][i]==student_className )\r\r\n\t\t\treturn i;\r\r\n\t}\r\r\n\treturn -1;\r\r\n}", "function searchResults(results,columns,filterBy,filterColumn){\n\t\t\tvar resultIndex = 0;\n\t\t\tif(filterBy && filterColumn){\n\t\t\t\tresultIndex = filterResults(results,filterBy,filterColumn);\n\t\t\t}\n\n \t\t\tif(results.length > 0){\n \t\t\t\t\n \t\t\t\tvar data = '';\n \t\t\t\tvar internalid;\n\t\t\t\tfor (var k = 0; k < columns.length; k++) {\n\t\t\t\t\tvar columnData = results[resultIndex].getValue({\n\t \t\tname:columns[k]\n\t \t});\n\n \t\tdata = data + columnData + '|';\n \n \tif(columns[k].name === 'internalid'){\n\t \t\tlog.debug({\n\t\t\t title: 'Found internalid',\n\t\t\t details: columnData\n\t\t\t \t});\n\t\t\t\t\t\tinternalid = columnData;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t \tlog.debug({\n\t title: 'Data',\n\t details: data\n\t \t});\n\n\t \treturn internalid; \n\n\t \t\t}\n\n\t \t\telse{\n\t \t\t\treturn false;\n\t \t\t}\n \t\t}", "function getRowIndex(target, row, state) {\n if (!state) state = $.data(target, 'datagrid');\n var opts = state.options;\n var rows = state.data.rows;\n if (typeof row == 'object') {\n return indexOfArray(rows, row);\n } else {\n return indexOfRowId(rows, opts.idField, row);\n }\n }", "function search(input){\r\n console.log(data);\r\n for(var i=0; i<data.length; i++){\r\n //ith reaction\r\n //array of elts\r\n console.log(i);\r\n var elt = data[i].elt.split(\",\");\r\n var elt_en = data[i].elt_en.split(\",\");\r\n var res = 1;\r\n for(var j=0; j<input.length; j++){\r\n //check jth input\r\n var find = 0; //not find\r\n for(var m=0; m<elt.length; m++){\r\n if(input[j].trim().localeCompare(elt[m].toLowerCase().trim())==0){\r\n find = 1;\r\n break;\r\n }\r\n }\r\n for(var m=0; m<elt_en.length; m++){\r\n if(input[j].trim().localeCompare(elt_en[m].toLowerCase().trim())==0){find = 1;break;}}\r\n if(find == 0){\r\n res = 0;break;}\r\n }\r\n if(res == 1){\r\n results.push(data[i].id);\r\n } \r\n }\r\n}", "function searchMatches( numpoint, numrow, numcol, direction, direction2){\n while(true) {\n //searches through array depending on the direction increment given [0 no moves, 1 moves forward, -1 moves backward]\n numrow += direction;\n numcol += direction2;\n //return if enough matches found;\n if(numpoint == match){\n break;\n }\n //make sure its still in array boundary;\n else if(numrow > board.length - 1 || numrow < 0 || numcol > board.length - 1 || numcol < 0){\n break;\n }\n //check if no match found\n else if( marker != board[numrow][numcol]){\n break;\n }\n //check if match found could be default else\n else if (marker == board[numrow][numcol]){\n numpoint++;\n }\n }\n //return points after loop is done\n return numpoint;\n }", "function search(keyevent) {\n // called on keyup for search_entry, could be Search or Reverse-search,\n // key is new letter or opt-s/r (search for next) or del \n\n if (keyevent.code == \"Escape\") {\n $(\"tr.selected\").removeClass(\"selected\");\n $(\"#search_entry\").blur();\n return;\n }\n \n let sstr = $(\"#search_entry\").val();\n let next = false;\n if (ExtendedSearchCB) // clear timeout if not executed\n\t clearTimeout(ExtendedSearchCB);\n\n // are we done?\n if (keyevent.key == 'Enter' || keyevent.key == 'Tab') {\n\t keyevent.buttonNotKey || keyevent.stopPropagation();\n\t keyevent.buttonNotKey || keyevent.preventDefault(); // stop keyHandler from getting it\n\t $(\"#search_entry\").blur(); // will call disableSearch\n\t return false;\n }\n\n // opt-s/r : drop that char code and go to next match\n if (keyevent.altKey && (keyevent.code == \"KeyS\" || keyevent.code == \"KeyR\")) {\n\t next = true;\n\t ReverseSearch = (keyevent.code == \"KeyR\");\n\t keyevent.buttonNotKey || keyevent.stopPropagation();\n\t keyevent.buttonNotKey || keyevent.preventDefault(); // stop opt key from displaying\n }\n const inc = ReverseSearch ? -1 : 1; // forward or reverse\n\n // undo effects of any previous hit\n $(\"span.highlight\").contents().unwrap();\n $(\"td\").removeClass('search');\n \n if (sstr.length < 1) return; // don't search for nothing!\n\n // Find where we're starting from (might be passed in from backspace key handling\n let row = (ReverseSearch) ? 'last' : 'first';\n let currentSelection = $(\"tr.selected\")[0] || $('#content').find('tr:visible:'+row)[0];\n let nodeId = keyevent.startId || parseInt($(currentSelection).attr('data-tt-id'));\n \n let prevNodeId = nodeId;\n if (next) {\n\t AllNodes[nodeId].redisplay();\n\t nodeId = nodeId + inc; // find next hit, forward/reverse\n }\n if ($(\"#search_entry\").hasClass('failed'))\n\t // restart at top or bottom (reverse)\n\t nodeId = ReverseSearch ? AllNodes.length - 1 : 1; \n\n // Do the search starting from nodeId\n let node = AllNodes[nodeId];\n while(nodeId > 0 && nodeId < AllNodes.length) {\n\t node = AllNodes[nodeId];\n\t nodeId = nodeId + inc;\n\t if (!node) continue; // AllNodes is sparse\n\t if (node.search(sstr)) break;\n\t node = null;\n }\n \n if (node) {\n\t if (prevNodeId != node.id)\n\t AllNodes[prevNodeId].redisplay(); // remove search formating if moving on\n\t $(\"tr.selected\").removeClass('selected');\n\t $(node.getDisplayNode()).addClass('selected');\n\t node.showForSearch(); // unfold tree etc as needed\n\t let highlight = $(node.getDisplayNode()).find(\"span.highlight\")[0];\n\t if (highlight) highlight.scrollIntoView({'inline' : 'center'});\n\t node.getDisplayNode().scrollIntoView({block: 'center'});\n \n\t $(\"#search_entry\").removeClass('failed');\n\t $(\"td\").removeClass('searchLite');\n\t ExtendedSearchCB = setTimeout(() => extendedSearch(0, sstr, node), 200);\n } else {\n\t $(\"#search_entry\").addClass('failed');\n\t $(\"tr.selected\").removeClass('selected');\n }\n \n return (!next); // ret false to prevent entry\n}", "function selectItemOnMatch(){var searchText=$scope.searchText,matches=ctrl.matches,item=matches[0];if(matches.length===1)getDisplayValue(item).then(function(displayValue){var isMatching=searchText==displayValue;if($scope.matchInsensitive&&!isMatching){isMatching=searchText.toLowerCase()==displayValue.toLowerCase();}if(isMatching)select(0);});}", "function search() {\n //Get the user input text -> convert to lower case\n var txt = $.trim($txt.val()).toLowerCase();\n\n //If the text is empty then complete clear the search and exit the function\n if (txt.length == 0) {\n console.log(\"clear\");\n clear();\n return;\n }\n \n //Create an array of the user input keywords (delimited by a space)\n //We will ensure each keyword exists in the record\n var arr = txt.split(\" \");\n \n //Variable b will determine if the record meets all keyword criteria\n var b = 0; \n \n //Create an empty tr variable to represent the full text of the record in question\n var tr;\n \n //Search through each <tr> in the tbody of the table\n $tbl.children(\"tbody\").find(\"tr\").each(function() {\n \n //Set the initial check value to 1\n b = 1;\n \n //Get the record text => convert to lower-case\n tr = $.trim($(this).text()).toLowerCase();\n \n //Loop through the keywords and check to see if tr contains ALL keywords in question. \n for (var i = 0; i < arr.length; i++) {\n //If any keyword does NOT match the record, b will be 0 and will remain 0 until the next record is searched\n b *= (tr.indexOf(arr[i]) >= 0) ? 1 : 0;\n } \n \n //If b is NOT 0 then the record meets all search criteria - show it, else hide it\n if (b > 0) {\n $(this).show();\n }\n else {\n $(this).hide();\n }\n }); \n }", "function search(index) {\n var data = this.data;\n return loop.call(this, data, 0, data.length - 1, index, this.valpos);\n}", "function search(index) {\n var data = this.data;\n return loop.call(this, data, 0, data.length - 1, index, this.valpos);\n}" ]
[ "0.64562154", "0.6405934", "0.6330053", "0.62250173", "0.6199402", "0.6177251", "0.60919714", "0.60877687", "0.6038497", "0.59825706", "0.5955942", "0.5870263", "0.58612657", "0.5821648", "0.57716537", "0.57626635", "0.5760286", "0.5745494", "0.57413185", "0.56957245", "0.5675471", "0.56447965", "0.5620581", "0.56174433", "0.5611695", "0.56115276", "0.5611276", "0.56102103", "0.56102103", "0.5608953", "0.5598926", "0.55987763", "0.55576634", "0.5554562", "0.5554562", "0.5553507", "0.55282044", "0.55234146", "0.5522844", "0.55204004", "0.5512434", "0.5510446", "0.54973936", "0.5490314", "0.5482531", "0.5480085", "0.54716194", "0.5440763", "0.54337406", "0.5431736", "0.5389503", "0.53839445", "0.5380667", "0.5380667", "0.5377952", "0.5369034", "0.5356412", "0.53400123", "0.5337474", "0.53354234", "0.5333486", "0.5322492", "0.53134114", "0.53079474", "0.530195", "0.5301447", "0.53006303", "0.52935505", "0.52882534", "0.5287128", "0.5285622", "0.52778745", "0.52743244", "0.5274063", "0.5270058", "0.52680147", "0.52663803", "0.5264307", "0.5264089", "0.5262297", "0.5260684", "0.525349", "0.5247293", "0.52456266", "0.52419275", "0.5241827", "0.5240625", "0.5237175", "0.523589", "0.5234599", "0.52332276", "0.5231737", "0.5222421", "0.5219342", "0.521763", "0.5210576", "0.5209195", "0.5205972", "0.5204285", "0.5204285" ]
0.5736212
19
ie bug workaround, filters need to be regenerated since row is empty; insertBefore method doesn't seem to work properly with previously generated DOM nodes modified by innerHTML
function refreshFilters(o){ o.tbl.deleteRow(o.filtersRowIndex); o.RemoveGrid(); o.fltIds = []; o.isFirstLoad = true; if(o.popUpFilters) o.RemovePopupFilters(); o._AddGrid(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_createFilterRow(existingFilterRow) {\r\n const that = this;\r\n\r\n if (!that.filtering || !that.filterRow) {\r\n return;\r\n }\r\n\r\n if (existingFilterRow) {\r\n that.$.tableContainer.children[1].insertBefore(existingFilterRow, that.$.tableContainer.children[1].firstElementChild);\r\n return;\r\n }\r\n\r\n const row = document.createElement('tr'),\r\n animation = ` animation=\"${that.animation}\" `,\r\n rightToLeft = that.rightToLeft ? ' right-to-left' : '';\r\n let content = '';\r\n\r\n row.className = 'smart-table-filter-row';\r\n\r\n if (that.selection) {\r\n content += '<td></td>';\r\n }\r\n\r\n for (let i = 0; i < that._columns.length; i++) {\r\n const column = that._columns[i],\r\n classes = [];\r\n let dataSource, inputType, className, value;\r\n\r\n if (column.dataType === 'string') {\r\n dataSource = that._filterInfo.stringConditions;\r\n inputType = 'string';\r\n className = 'string-filter';\r\n value = that.localize('CONTAINS');\r\n }\r\n else {\r\n dataSource = that._filterInfo.numberAndDateConditions;\r\n inputType = column.dataType;\r\n className = 'num-date-filter';\r\n value = that.localize('EQUAL');\r\n }\r\n\r\n if (column.freeze) {\r\n classes.push('freeze-' + (column.freeze === 'far' ? 'far' : 'near'));\r\n }\r\n\r\n if (column.responsivePriority) {\r\n classes.push('priority-' + column.responsivePriority);\r\n }\r\n\r\n if (column.allowFilter === false) {\r\n classes.push('no-filter');\r\n }\r\n\r\n content += `<td${classes.length ? ' class=\"' + classes.join(' ') + '\"' : ''} filter-for=\"${column.dataField}\">\r\n <div>\r\n <input type=\"${inputType}\" class=\"filter-value\" aria-label=\"Filter value\" />\r\n <smart-input class=\"${className}${animation}data-source='${JSON.stringify(dataSource)}' drop-down-button-position=\"right\" drop-down-width=\"auto\" readonly${rightToLeft} value=\"${value}\" title=\"${that.localize('filterCondition')}\" aria-label=\"Filter condition\"></smart-input>\r\n <smart-button class=\"smart-hidden\" title=\"${that.localize('clearFilter')}\"${animation}${rightToLeft} aria-label=\"Clear filter\"></smart-button>\r\n </div>\r\n </td>`;\r\n }\r\n\r\n row.innerHTML = content;\r\n\r\n that.$.tableContainer.children[1].insertBefore(row, that.$.tableContainer.children[1].firstElementChild);\r\n }", "insertRowBefore() {\n this.insertRow();\n }", "function onInsertRowBefore() {\n onInsertRow(0);\n }", "function PostProcessing_CreateFilterRow(row, addRename, property, value) {\n if (addRename === void 0) { addRename = false; }\n if (property === void 0) { property = null; }\n if (value === void 0) { value = null; }\n row.innerHTML = \"\";\n row.insertCell(0);\n row.cells[0].appendChild(PostProcessing_createSelection());\n if (property)\n row.cells[0].getElementsByTagName(\"select\")[0].value = property;\n row.insertCell(1);\n var input = document.createElement(\"input\");\n input.type = \"text\";\n input.value = value ? value : \"filter value\";\n var label = document.createElement(\"label\");\n label.innerHTML = \"value\";\n row.cells[1].appendChild(label);\n row.cells[1].appendChild(input);\n if (addRename) {\n row.insertCell(2);\n var rename = document.createElement(\"input\");\n rename.type = \"text\";\n rename.value = input.value;\n var renameLabel = document.createElement(\"label\");\n renameLabel.innerHTML = \"rename to\";\n row.cells[2].appendChild(renameLabel);\n row.cells[2].appendChild(rename);\n }\n row.insertCell(addRename ? 3 : 2);\n var rm = document.createElement(\"button\");\n rm.innerHTML = \"-\";\n rm.onclick = PostProcessing_RemoveFilter;\n row.cells[addRename ? 3 : 2].appendChild(rm);\n }", "_reorderRows(){const body=this.$.items,items=body.querySelectorAll(\"tr\");if(!items.length){return}const adjustedVirtualStart=this._virtualStart+this._vidxOffset,targetRow=this._rowWithFocusedElement||Array.from(items).filter(row=>!row.hidden)[0];// Which row to use as a target?\nif(!targetRow){// All rows are hidden, don't reorder\nreturn}// Where the target row should be?\nconst targetPhysicalIndex=targetRow.index-adjustedVirtualStart,delta=Array.from(items).indexOf(targetRow)-targetPhysicalIndex;// Reodrer the DOM elements to keep the target row at the target physical index\nif(0<delta){for(let i=0;i<delta;i++){body.appendChild(items[i])}}else if(0>delta){for(let i=items.length+delta;i<items.length;i++){body.insertBefore(items[i],items[0])}}}", "function add_row() {\n // var new_row = document.createElement('div');\n var ui = document.querySelector(\"#UI\");\n var divs = document.querySelectorAll('#UI > div');\n var index;\n if (divs.length < 2){\n index = 0;\n }\n else {\n index = parseInt(divs[divs.length - 2].id.split(\"row\")[1]);\n index++;\n }\n\n\n //TODO: function that g\n var new_rows = template([getBlank()]);\n var parser = new DOMParser();\n new_rows = parser.parseFromString(new_rows, \"text/html\").querySelector(\"#row0\");\n // console.log(new_rows);\n new_rows.id = \"row\" + index;\n\n ui.insertBefore(new_rows, divs[divs.length - 1]);\n fixNewRow(new_rows.id);\n}", "function insertElement(eltFunc) {\n var elt;\n if (foster_parent_mode && isA(stack.top, tablesectionrowSet)) {\n elt = fosterParent(eltFunc);\n }\n else if (stack.top instanceof impl.HTMLTemplateElement) {\n // \"If the adjusted insertion location is inside a template element,\n // let it instead be inside the template element's template contents\"\n elt = eltFunc(stack.top.content.ownerDocument);\n stack.top.content._appendChild(elt);\n } else {\n elt = eltFunc(stack.top.ownerDocument);\n stack.top._appendChild(elt);\n }\n\n stack.push(elt);\n return elt;\n }", "_createCustomHeaderRow() {\r\n const that = this,\r\n headerRow = that.headerRow;\r\n\r\n if (!headerRow) {\r\n return;\r\n }\r\n\r\n const potentialHTMLTemplate = document.getElementById(headerRow);\r\n\r\n if (potentialHTMLTemplate && potentialHTMLTemplate instanceof HTMLTemplateElement) {\r\n const templateContent = document.importNode(potentialHTMLTemplate.content, true);\r\n\r\n that.$.tableContainer.firstElementChild.appendChild(templateContent);\r\n }\r\n else {\r\n that.headerRow = null;\r\n }\r\n }", "insertEmptySplittedCellWidget(currentRow, tableCollection, left, index, previousRowIndex) {\n let tableWidget = tableCollection[tableCollection.length - 1];\n for (let i = previousRowIndex; i >= 0; i--) {\n let rowWidget = tableWidget.childWidgets[i];\n let previousLeft = rowWidget.x;\n for (let j = 0; j < rowWidget.childWidgets.length; j++) {\n let rowSpan = 1;\n let cellWidget = rowWidget.childWidgets[j];\n if (Math.round(left) === Math.round(previousLeft)) {\n rowSpan = (isNullOrUndefined(cellWidget) || isNullOrUndefined(cellWidget.cellFormat)) ? rowSpan :\n cellWidget.cellFormat.rowSpan;\n if (rowSpan > 1) {\n let emptyCellWidget = this.createCellWidget(cellWidget);\n currentRow.childWidgets.splice(index, 0, emptyCellWidget);\n emptyCellWidget.containerWidget = currentRow;\n }\n return;\n }\n previousLeft += cellWidget.margin.left + cellWidget.width + cellWidget.margin.right;\n }\n }\n }", "function result_element_prepend(parent, child, next)\n{\n if(next == null)\n result_element_append(parent, child);\n else\n if(parent != null && child != null)\n {\n // insert child node before the next node:\n for(var i = 0; i < parent.content.length; i++)\n {\n if(parent.content[i] == next)\n {\n parent.content.splice(i, 0, child);\n return;\n }\n }\n }\n}", "addNewRowElement() {\n const rowElement = DomHelper.append(this.element, this.rowTemplate());\n this.fixCellWidths(rowElement);\n return rowElement;\n }", "function addRow(){\n \n \n $('#filters-container').append( $('<div/>').html($('#filter').html()) );\n \n $('.span_delete').click(function(e) {\n $(this).parent().parent().parent('div').remove();\n\n $('.dropdown_relation').last().hide();\n $('.span_add').last().show();\n\n return false;\n });\n \n $('.span_add').last().click(function(e){\n e.preventDefault();\n addRow();\n });\n $('.span_add').hide().last().show();\n $('.span_delete').last().show();\n $('.dropdown_relation').show();\n $('.dropdown_relation').last().hide();\n $(\".dropdown_filter\").last().change(changeFilter);\n $(\".dropdown_filter\").last().change();\n\n\t\n}", "function addExtraRow(){\n var table = document.getElementById(\"tbl1\")\n cl(table.insertRow(0));\n}", "function makeFilterElements() {\n\tvar filter = document.createElement('div');\n\tfilter.id = 'select-column';\n\n\tvar divContainer = document.getElementById(\"filter\");\n divContainer.innerHTML = \"\";\n divContainer.appendChild(filter);\n\t\n\tmakeFilter();\n}", "addNewRowElement() {\n const rowElement = DomHelper.append(this.element, this.rowTemplate());\n\n this.fixCellWidths(rowElement);\n\n return rowElement;\n }", "function prependSearches() {\n database.ref(\"/search\").limitToLast(5).on(\"child_added\", function(childSnapshot, prevChildKey) {\n\n var searchList = childSnapshot.val().search;\n var tableBody = $(\"#recent-searches > tbody\");\n var tr = $(\"<tr>\");\n var tdSearches = $(\"<td>\").text(searchList);\n tr.prepend(tdSearches);\n tableBody.prepend(tr);\n });\n }", "function addRestriction(){\n var fieldValue = $('fieldValue').value;\n fieldValue = fieldValue.replace(\"&\", \"&amp;\");\n \n var operator = $('operator');\n var fieldName = $('fieldName').value;\n var conjunction = $('conjunction');\n \n if (fieldName == \"\") {\n alert(getMessage(\"noFieldName\"));\n }\n else \n if ((fieldValue == \"\") && (operator.value != \"IS NULL\") && (operator.value != \"IS NOT NULL\")) {\n alert(getMessage(\"noFieldValue\"));\n }\n else {\n var summTableName = \"restrictionSummary\";\n var summTable = $(summTableName);\n var summtBody = summTable.tBodies[0];\n var new_tr = document.createElement('tr');\n \n for (var j = 0; j < 5; j++) {\n var new_td = document.createElement('td');\n new_tr.appendChild(new_td);\n }\n \n summtBody.appendChild(new_tr);\n \n var rowIndex = summtBody.rows.length - 1;\n new_tr.id = 'row' + rowIndex;\n \n summtBody.rows[rowIndex].cells[0].innerHTML = conjunction.options[conjunction.selectedIndex].innerHTML;\n var conjFld = createHiddenField('conjunctionHid', conjunction.value);\n summtBody.rows[rowIndex].cells[0].appendChild(conjFld);\n summtBody.rows[rowIndex].cells[1].innerHTML = fieldName;\n\n summtBody.rows[rowIndex].cells[2].innerHTML = operator.value;\n\t\t\t// operator.options[operator.selectedIndex].innerHTML;\n\t\t\tif (operator.value == \"<\") {\n\t\t\t\tsummtBody.rows[rowIndex].cells[2].innerHTML = \"&lt;\";\n\t\t\t\t// operator.value = '&lt;';\n\t\t\t}\n\n\t\t\t\t\t\t \n var operatorFld = createHiddenField('operatorHid', summtBody.rows[rowIndex].cells[2].innerHTML);\n summtBody.rows[rowIndex].cells[2].appendChild(operatorFld);\n summtBody.rows[rowIndex].cells[3].innerHTML = fieldValue;\n \n summtBody.rows[rowIndex].cells[4].setAttribute(\"nowrap\", \"nowrap\"); \n createButton(\"Remove\", \"removeRow\", getMessage(\"remove\"), \"restrictionSummary\", summtBody.rows[rowIndex].cells[4]);\n createButton(\"Up\", \"moveUp\", getMessage(\"up\"), \"restrictionSummary\", summtBody.rows[rowIndex].cells[4]);\n createButton(\"Down\", \"moveDown\", getMessage(\"dn\"), \"restrictionSummary\", summtBody.rows[rowIndex].cells[4]);\n saveRestrictions();\n $('fieldValue').value = '';\n }\n}", "function appendRow(data) {\n var tr = document.createElement(\"tr\"),\n phrase = makeTD(\"text\", data.from),\n replace = makeTD(\"text\", data.to),\n case_box = makeTD(\"checkbox\", null, data.ic),\n whole_box = makeTD(\"checkbox\", null, data.mw),\n moveup = makeSpan('moveup', '▲'),\n movetop = makeSpan('movetop', 'T'),\n delrow = makeSpan('delrow', '☓');\n moveup.style.float = 'right';\n movetop.style.float = 'right';\n delrow.style.float = 'right';\n whole_box.appendChild(delrow);\n whole_box.appendChild(movetop);\n whole_box.appendChild(moveup);\n tr.appendChild(phrase);\n tr.appendChild(replace);\n tr.appendChild(case_box);\n tr.appendChild(whole_box);\n table.appendChild(tr);\n attachDelRowListener(tr.querySelector(\".delrow\"));\n attachMoveTopListener(tr.querySelector(\".movetop\"));\n attachMoveUpListener(tr.querySelector(\".moveup\"));\n}", "function dtFilterHtml(appendHtmlId, customfilterSelectUrl) {\n var filterHtml = '';\n customfilterSelectUrl = customfilterSelectUrl;\n filterHtml += '<div class=\"col-md-12 col-lg-12 col-sm-12 col-xs-12 \">';\n filterHtml += '<span class=\"filterText\">Filters</span>';\n filterHtml += '<a href=\"javascript:;\" class=\"clearAll pull-right\" aria-label=\"close\">CLEAR ALL</a>';\n filterHtml += '</div>';\n filterHtml += '<br/>';\n\n filterHtml += '<div class=\"col-md-12 col-lg-12 col-sm-12 col-xs-12 filterdData wrapper\">';\n filterHtml += '</div>';\n filterHtml += '<div class=\"ln-solid col-md-12 col-lg-12 col-sm-12 col-xs-12\"></div>';\n filterHtml += '<div class=\"item form-group col-lg-12 col-md-12 col-sm-12 col-xs-12\"></div>';\n\n filterHtml += '<div class=\"col-md-3 col-lg-3 col-sm-3 col-xs-12\">';\n filterHtml += '<div class=\"item form-group\">'\n filterHtml += '<select class=\"form-control\" id=\"customFilterSelect\">';\n filterHtml += '<option></option>';\n filterHtml += '</select>';\n filterHtml += '</div>';\n filterHtml += '</div>';\n\n filterHtml += '<div class=\"col-md-3 col-lg-3 col-sm-3 col-xs-12 filteredInput\" >';\n filterHtml += '<input type=\"text\" class=\"form-control\" id=\"inputType\" placeholder=\"Enter value...\" />';\n filterHtml += '</div>';\n\n filterHtml += '<div class=\"col-md-6 col-lg-6 col-sm-6 col-xs-12 filteredNumber\" style=\"display:none;\">';\n filterHtml += '<div class=\"col-md-6 col-lg-6 col-sm-6 col-xs-12 \" >';\n filterHtml += '<input type=\"number\" class=\"form-control\" id=\"minNumber\" placeholder=\"Enter min value...\" />';\n filterHtml += '</div>';\n filterHtml += '<div class=\"col-md-6 col-lg-6 col-sm-6 col-xs-12 \" >';\n filterHtml += '<input type=\"number\" class=\"form-control\" id=\"maxNumber\" placeholder=\"Enter max value...\" />';\n filterHtml += '</div>';\n filterHtml += '</div>';\n\n filterHtml += '<div class=\"col-md-3 col-lg-3 col-sm-3 col-xs-12 divDateRange\" style=\"display:none;\" >';\n filterHtml += '<div id=\"dateRange\" style=\"background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%\">';\n filterHtml += ' <i class=\"fa fa-calendar\"></i>&nbsp;';\n filterHtml += '<span class=\"dataRangeVal\"></span> <i class=\"fa fa-caret-down\"></i>';\n filterHtml += '</div>';\n filterHtml += '</div>';\n\n filterHtml += '<div class=\"col-md-3 col-lg-3 col-sm-3 col-xs-12 filteredSelect\" style=\"display:none;\">';\n filterHtml += '<div class=\"item form-group\">';\n filterHtml += '<select class=\"form-control\" id=\"filteredSelect\">';\n filterHtml += '</select>';\n filterHtml += '</div>';\n filterHtml += '</div>';\n\n filterHtml += '<div class=\"col-md-3 col-lg-3 col-sm-3 col-xs-12 filteredMultiSelect\" style=\"display:none;\">';\n filterHtml += '<div class=\"item form-group\">';\n filterHtml += '<select class=\"form-control\" id=\"customMultiSelect\">';\n filterHtml += '</select>';\n filterHtml += '</div>';\n filterHtml += '</div>';\n\n filterHtml += '<div class=\"col-md-3 col-lg-3 col-sm-3 col-xs-12\">';\n filterHtml += '<button class=\"btn btn-mg btn-success\"id=\"tblSearch\">Search</button>';\n filterHtml += '</div>';\n $(\"#\" + appendHtmlId + \"\").html(filterHtml);\n customFilterSelect(customfilterSelectUrl);\n}", "function sortByOnlineSales(){\n var sortColumn = 4;\n var tableData = document.getElementById(\"bookdata\").getElementsByTagName('tbody').item(0);\n var rowData = tableData.getElementsByTagName('tr'); \n for(var i = 0; i < rowData.length - 1; i++){\n for(var j = 0; j < rowData.length - (i + 1); j++){\n if(Number(rowData.item(j).getElementsByTagName('td').item(sortColumn).innerHTML === 'N')){\n tableData.insertBefore(rowData.item(j+1),rowData.item(j));\n }\n }\n }\n }", "function insertBefore(targetElement, targetScope) {\n // Ensure the placeholder is visible in the target (unless it's a table row)\n if (placeHolder.css('display') !== 'table-row') {\n placeHolder.css('display', 'block');\n }\n if (!targetScope.sortableScope.options.clone) {\n targetElement[0].parentNode.insertBefore(placeHolder[0], targetElement[0]);\n dragItemInfo.moveTo(targetScope.sortableScope, targetScope.index());\n }\n }", "insertBefore() {\n this.insertElementAdjacentToChild('before');\n }", "function createRow() {\n\n var table = document.getElementById(\"main\");\n // var tbody = document.getElementById(\"main1\");\n var new_row = table.rows[1].cloneNode(true);\n\n var len = table.rows.length;\n new_row.cells[0].innerHTML = len;\n\n var inp1 = new_row.cells[1].getElementsByTagName('select')[0];\n\n\n // console.log(new_row.children[4]);\n\n new_row.children[5].style.display = \"block\";\n for (var i = 1; i < table.tBodies[0].children.length; i++) {\n table.tBodies[0].children[i].children[0].innerHTML = i + 1;\n }\n\n\n table.tBodies[0].appendChild(new_row);\n table.tBodies[0].children[len - 1].children[1].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[2].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[3].children[0].value = \"\";\n gadgets.window.adjustHeight();\n}", "addRow() {\n let newAlt = new AltColumnFilters(this.holder, this.paneOb)\n newAlt.id = this.idCount\n this.idCount++\n // add to the pane collection for export as well\n this.paneOb.altFiltersState[newAlt.id] = { colname: \"\", op: \"\", val: \"\" }\n newAlt.init()\n // add the removal function to take it from the list too\n\n newAlt.removeFromList = this.removeFromList.bind(this)\n\n this.altfilters.push(newAlt)\n this.holder.addEventListener(\"altchange\", this.filter.bind(this))\n\n\n }", "onBeforeRenderRow({\n row,\n record\n }) {\n // row.id contains previous record id on before render\n const oldRecord = row.grid.store.getById(row.id); // force update of inner html if this row used for group data\n\n row.forceInnerHTML = row.forceInnerHTML || oldRecord && 'groupRowFor' in oldRecord.meta;\n }", "function addItem(evt){\n var self = evt.target;\n var template = dom.closest(self, 'wb-row');\n // we want to clone the row and it's children, but not their contents\n var newItem = template.cloneNode(true);\n template.parentElement.insertBefore(newItem, template.nextElementSibling);\n}", "function createRow1() {\n\n var table = document.getElementById(\"ProfileSync\");\n// var tbody = document.getElementById(\"ProfileSync1\");\n var new_row = table.rows[1].cloneNode(true);\n // console.log(new_row);\n var len = table.rows.length;\n new_row.cells[0].innerHTML = len;\n\n var inp1 = new_row.cells[1].getElementsByTagName('select')[0];\n //new_row.id = \"row\" + len;\n //inp1.id += len;\n// inp1.value = '';\n // console.log(new_row.children[4]);\n new_row.children[5].style.display = \"block\";\n for (var i = 1; i < table.tBodies[0].children.length; i++) {\n table.tBodies[0].children[i].children[0].innerHTML = i + 1;\n }\n\n\n table.tBodies[0].appendChild(new_row);\n table.tBodies[0].children[len - 1].children[1].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[2].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[3].children[0].value = \"\";\n gadgets.window.adjustHeight();\n}", "createDomElement(filterTemplate, searchTerm) {\n const fieldId = this.columnDef && this.columnDef.id;\n const $headerElm = this.grid.getHeaderRowColumn(fieldId);\n $($headerElm).empty();\n // create the DOM element & add an ID and filter class\n const $filterElm = $(filterTemplate);\n const searchTermInput = (searchTerm || '');\n $filterElm.val(searchTermInput);\n $filterElm.data('columnId', fieldId);\n if (searchTermInput) {\n this._currentValues = [searchTermInput];\n }\n // append the new DOM element to the header row\n if ($filterElm && typeof $filterElm.appendTo === 'function') {\n $filterElm.appendTo($headerElm);\n }\n return $filterElm;\n }", "function swapRows(a, b) {\n b.parentNode.insertBefore(b, a);\n}", "function addRow(thisFieldNum) {\r\n\tif ($('#dropdown-operator_'+thisFieldNum).length) {\r\n\t\tif ($('#dropdown-operator_'+thisFieldNum).prop('disabled')) {\r\n\t\t\tdocument.getElementById('num_query_fields').value++; \r\n\t\t\tdocument.getElementById('query_table').innerHTML = document.getElementById('query_table').innerHTML.substring(0,document.getElementById('query_table').innerHTML.length-16) + new_row.replace(/{__fieldnum__}/ig,document.getElementById('num_query_fields').value) + '</tbody></table>'; \r\n\t\t\tfor (var b = 1; b <= document.getElementById('num_query_fields').value; b++) {\r\n\t\t\t\tdocument.getElementById('dropdown-field_'+b).value = document.getElementById('allfield_'+b).value;\r\n\t\t\t\tdocument.getElementById('dropdown-operator_'+b).value = document.getElementById('operator_'+b).value;\r\n\t\t\t\tdocument.getElementById('visible-condvalue_'+b).value = document.getElementById('condvalue_'+b).value;\r\n\t\t\t} \r\n\t\t\tdocument.getElementById('visible-TITLE').value = document.getElementById('__TITLE__').value;\r\n\t\t}\r\n\t}\r\n}", "redraw() {\n while (this.tbody.firstChild) {\n this.tbody.removeChild(this.tbody.firstChild);\n }\n var filteredRows = this.filterRows();\n var orderedRows = this.sortRows(filteredRows);\n orderedRows.forEach(row => {\n this.tbody.appendChild(row);\n });\n }", "function loadTableWithFilters()\n{\n var myContainer = document.querySelector(\"#main-table-body\");\n myContainer.innerHTML = \"\";\n\n //loop through petData array\n for(var i = 0; i <petData.length; i++)\n {\n if ((filterType === \"dog\" && petData[i].type === \"dog\") || \n (filterType === \"cat\" && petData[i].type === \"cat\") || \n (filterType === \"bird\" && petData[i].type === \"bird\") || \n (filterType === \"\"))\n {\n if (petData[i].age >= filterAgeMin && petData[i].age <= filterAgeMax)\n {\n var tr = document.createElement(\"tr\");\n var td = document.createElement(\"td\");\n var img = document.createElement(\"img\");\n img.src = petData[i].image.src;\n img.alt = petData[i].image.alt;\n img.height = petData[i].image.height;\n img.width = petData[i].image.width;\n td.appendChild(img);\n var td_a = document.createElement(\"td\");\n var h4 = document.createElement(\"h4\");\n var h4_text = document.createTextNode(petData[i].name);\n h4.appendChild(h4_text);\n var p = document.createElement(\"p\");\n p.innerHTML = petData[i].description;\n var span = document.createElement(\"span\");\n var span_text = document.createTextNode(\"Age: \");\n var span_texta = document.createTextNode(petData[i].age);\n var span_textb = document.createTextNode(\" years old.\");\n span.appendChild(span_text);\n span.appendChild(span_texta);\n span.appendChild(span_textb);\n\n td_a.appendChild(h4);\n td_a.appendChild(p);\n td_a.appendChild(span);\n\n tr.appendChild(td);\n tr.appendChild(td_a);\n\n myContainer.appendChild(tr);\n\n \n }\n }\n\n }\n}", "function addRow() {\n // CLONE THE COMBO BOX + BUTTONS\n const original = _('condition-example');\n const clone = original.cloneNode(true);\n clone.id = 'condition-row' + ++indexClone;\n clone.getElementsByTagName('label')[0].innerHTML = 'Optional Condition '+indexClone+' : ';\n clone.getElementsByTagName('label')[0].htmlFor = 'cond-select'+indexClone;\n clone.getElementsByTagName('select')[0].id = 'cond-select'+indexClone;\n clone.hidden = false;\n // MODIFY BUTTONS\n clone.getElementsByTagName('span')[0].onclick = removeRow;\n if (indexClone >= cloneLimit)\n clone.getElementsByTagName('span')[1].hidden = true;\n else\n clone.getElementsByTagName('span')[1].onclick = addRow;\n // ADD THE CLONE TO THE DESTINATION DIV\n const destination = _('condition-rows');\n destination.appendChild(clone);\n // HIDE THE BUTTONS OF THE PREVIOUS SELECT\n if (indexClone > 1) {\n const previousClone = _('condition-row' + (indexClone - 1));\n previousClone.getElementsByTagName('span')[0].hidden = true;\n previousClone.getElementsByTagName('span')[1].hidden = true;\n }\n}", "function onInsertRowAfter() {\n onInsertRow(1);\n }", "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}", "createDomElement(filterTemplate, searchTerm) {\n const fieldId = this.columnDef && this.columnDef.id;\n const minValue = this.filterProperties.hasOwnProperty('minValue') ? this.filterProperties.minValue : DEFAULT_MIN_VALUE$1;\n const startValue = this.filterParams.hasOwnProperty('sliderStartValue') ? this.filterParams.sliderStartValue : minValue;\n const $headerElm = this.grid.getHeaderRowColumn(fieldId);\n $($headerElm).empty();\n // create the DOM element & add an ID and filter class\n const $filterElm = $(filterTemplate);\n let searchTermInput = (searchTerm || '0');\n if (+searchTermInput < minValue) {\n searchTermInput = `${minValue}`;\n }\n if (+searchTermInput < startValue) {\n searchTermInput = `${startValue}`;\n }\n this._currentValue = +searchTermInput;\n $filterElm.children('input').val(searchTermInput);\n $filterElm.children('div.input-group-addon.input-group-append').children().html(searchTermInput);\n $filterElm.data('columnId', fieldId);\n // if there's a search term, we will add the \"filled\" class for styling purposes\n if (searchTerm) {\n $filterElm.addClass('filled');\n }\n // append the new DOM element to the header row\n if ($filterElm && typeof $filterElm.appendTo === 'function') {\n $filterElm.appendTo($headerElm);\n }\n return $filterElm;\n }", "function appendUpRow(x)\n{\n\tvar tb1 = document.getElementById('qis');\n\tvar row = tb1.insertRow(x); //localizar el ultimo renglon de la tabla para añadir uno nuevo\n\tvar i = 0;\n\tfor(i = 0; i < tb1.rows[0].cells.length; i++)//conocer cuantas celdas hay en los renglones para añadirlos al nuevo renglon.\n\t{\n\t\tcreateCell(row.insertCell(i),i,0);\n\t}\n}", "function addRow(gui, dom, liBefore) {\n\t var li = document.createElement('li');\n\t if (dom) li.appendChild(dom);\n\t if (liBefore) {\n\t gui.__ul.insertBefore(li, params.before);\n\t } else {\n\t gui.__ul.appendChild(li);\n\t }\n\t gui.onResize();\n\t return li;\n\t }", "function copyHidedSearchFilds(){\n $(\"tfoot > tr\").after('<tr class=\"child\"> <td class=\"child\" colspan=\"100%\"> <div class=\"change_me\"></div> </td> </tr> ');\n $(\".search_element\").each(function(index){\n if($(this).css('display') == 'none'){\n var element = $(this).clone();\n // delete NONE attr, and add css\n element.removeAttr('style');\n element.css('clear', 'both');\n element.css('float', 'left');\n element.toggleClass(\"search_element\");\n // change id for each input field, x - extended menu\n element.find('input, select').each(function(index,elem){\n var id = elem.getAttribute('id'); \n elem.setAttribute('id',id+\"x\");\n });\n // apply\n $(\".change_me\").append(element);\n }\n });\n toggle = false;\n}", "function insertBeforeEnd(node,html)\r\n{\r\n\r\n\tif(node.insertAdjacentHTML)\r\n\t{\r\n\t\tnode.insertAdjacentHTML('beforeEnd', html);\t\t\r\n\t}\r\n\telse\r\n\t{\r\n\t\t//--\r\n\t\t//-- netscape way of inserting html ()\r\n\t\tvar r = node.ownerDocument.createRange();\r\n\t\tr.setStartBefore(node);\r\n\t\tvar parsedHTML = r.createContextualFragment(html);\r\n\t\tnode.appendChild(parsedHTML);\r\n\t}\r\n\r\n\treturn node.lastChild;\r\n}", "_applyRowFilters() {\r\n const that = this;\r\n\r\n if (!that.filtering || !that.filterRow) {\r\n return;\r\n }\r\n\r\n const filterRow = that.$.tableContainer.querySelector('.smart-table-filter-row'),\r\n selectionColumnCorrection = that.selection ? 1 : 0,\r\n filters = [];\r\n\r\n for (let i = 0; i < that._columns.length; i++) {\r\n const dataField = that._columns[i].dataField,\r\n dataType = that._columns[i].dataType,\r\n container = filterRow.children[i + selectionColumnCorrection].firstElementChild,\r\n button = container.children[2];\r\n let filterValue = container.firstElementChild.value,\r\n filterCondition = container.children[1].value;\r\n\r\n if (dataType === 'string') {\r\n filterCondition = that._filterInfo.stringConditions.find(condition => condition.label === filterCondition).value;\r\n\r\n }\r\n else {\r\n filterCondition = that._filterInfo.numberAndDateConditions.find(condition => condition.label === filterCondition).value;\r\n\r\n if (filterValue !== '') {\r\n if (dataType === 'number') {\r\n filterValue = parseFloat(filterValue);\r\n\r\n if (isNaN(filterValue)) {\r\n container.firstElementChild.value = '';\r\n filterValue = '';\r\n }\r\n }\r\n else if (dataType === 'date') {\r\n filterValue = new Date(filterValue);\r\n filterValue.setHours(0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n const conditionWithEmptyValue = ['EMPTY', 'NOT_EMPTY', 'NULL', 'NOT_NULL'].indexOf(filterCondition) !== -1;\r\n\r\n if (filterValue !== '' || conditionWithEmptyValue) {\r\n const filterGroup = new Smart.Utilities.FilterGroup(),\r\n filterObject = filterGroup.createFilter(dataType, filterValue, filterCondition);\r\n\r\n filterGroup.addFilter('or', filterObject);\r\n filters.push([dataField, filterGroup]);\r\n\r\n button.classList.remove('smart-hidden');\r\n }\r\n else {\r\n button.classList.add('smart-hidden');\r\n }\r\n\r\n if (conditionWithEmptyValue) {\r\n container.firstElementChild.setAttribute('disabled', true);\r\n }\r\n else {\r\n container.firstElementChild.removeAttribute('disabled');\r\n }\r\n }\r\n\r\n if (filters.length > 0) {\r\n if (!that.dataSource.virtualDataSource) {\r\n that.dataSource._filter(filters, 'and');\r\n }\r\n\r\n that._filterInfo.rowFilters = filters;\r\n delete that._filterInfo.appliedFilters;\r\n that._fullRefresh('filter');\r\n that.$.fireEvent('filter', { action: 'add', filters: filters });\r\n }\r\n else if (that._filterInfo.rowFilters) {\r\n that.clearFilters();\r\n }\r\n }", "function classification_add_row(evt) {\n var remove = el(\"div.remove\", [\"✖\"])\n var confirm = el(\"div.remove\", ['\\u2714'])\n input = el(\"input#input\")\n remove.addEventListener('click', classification_remove_row) \n confirm.addEventListener('click', classification_append_row) \n evt.parentNode.appendChild(el('div.entity-sample', [\n input,\n remove,\n el(\"div.divider\"),\n confirm\n ]))\n}", "function addRow(gui, dom, liBefore) {\n var li = document.createElement('li');\n if (dom) li.appendChild(dom);\n if (liBefore) {\n gui.__ul.insertBefore(li, params.before);\n } else {\n gui.__ul.appendChild(li);\n }\n gui.onResize();\n return li;\n }", "function addRow(gui, dom, liBefore) {\n var li = document.createElement('li');\n if (dom) li.appendChild(dom);\n if (liBefore) {\n gui.__ul.insertBefore(li, params.before);\n } else {\n gui.__ul.appendChild(li);\n }\n gui.onResize();\n return li;\n }", "function addRow(gui, dom, liBefore) {\n var li = document.createElement('li');\n if (dom) li.appendChild(dom);\n if (liBefore) {\n gui.__ul.insertBefore(li, params.before);\n } else {\n gui.__ul.appendChild(li);\n }\n gui.onResize();\n return li;\n }", "function addRow(gui, dom, liBefore) {\n var li = document.createElement('li');\n if (dom) li.appendChild(dom);\n if (liBefore) {\n gui.__ul.insertBefore(li, params.before);\n } else {\n gui.__ul.appendChild(li);\n }\n gui.onResize();\n return li;\n }", "function addRow(gui, dom, liBefore) {\n var li = document.createElement('li');\n if (dom) li.appendChild(dom);\n if (liBefore) {\n gui.__ul.insertBefore(li, params.before);\n } else {\n gui.__ul.appendChild(li);\n }\n gui.onResize();\n return li;\n }", "function addRow(gui, dom, liBefore) {\n var li = document.createElement('li');\n if (dom) li.appendChild(dom);\n if (liBefore) {\n gui.__ul.insertBefore(li, params.before);\n } else {\n gui.__ul.appendChild(li);\n }\n gui.onResize();\n return li;\n }", "function addRow(gui, dom, liBefore) {\n var li = document.createElement('li');\n if (dom) li.appendChild(dom);\n if (liBefore) {\n gui.__ul.insertBefore(li, params.before);\n } else {\n gui.__ul.appendChild(li);\n }\n gui.onResize();\n return li;\n }", "function insertBefore(targetElement, targetScope) {\n targetElement[0].parentNode.insertBefore(placeHolder[0], targetElement[0]);\n dragItemInfo.moveTo(targetScope.sortableScope, targetScope.index());\n }", "function insertBefore(targetElement, targetScope) {\n targetElement[0].parentNode.insertBefore(placeHolder[0], targetElement[0]);\n dragItemInfo.moveTo(targetScope.sortableScope, targetScope.index());\n }", "function insertBefore(targetElement, targetScope) {\n targetElement[0].parentNode.insertBefore(placeHolder[0], targetElement[0]);\n dragItemInfo.moveTo(targetScope.sortableScope, targetScope.index());\n }", "function sortByType(){\n var sortColumn = 4;\n var tableData = document.getElementById(\"bookdata\").getElementsByTagName('tbody').item(0);\n var rowData = tableData.getElementsByTagName('tr'); \n for(var i = 0; i < rowData.length - 1; i++){\n for(var j = 0; j < rowData.length - (i + 1); j++){\n if(Number(rowData.item(j).getElementsByTagName('td').item(sortColumn).innerHTML === 'Y')){\n tableData.insertBefore(rowData.item(j+1),rowData.item(j));\n }\n }\n }\n }", "wrap(wrapper){wrapper.appendChild(this.range.extractContents());this.range.insertNode(wrapper)}", "function buildPage(input){\n document.getElementById(\"ufo-table\").getElementsByTagName('tbody')[0].innerHTML = \"\";\n input.forEach((element,index)=>{\n\n // Peruse the dataset to filter all elements with id=\"ufo-table\":\n let table = document.getElementById(\"ufo-table\").getElementsByTagName('tbody')[0];\n let row = table.insertRow(index);\n let cell1 = row.insertCell(0);\n let cell2 = row.insertCell(1);\n let cell3 = row.insertCell(2);\n let cell4 = row.insertCell(3);\n let cell5 = row.insertCell(4);\n let cell6 = row.insertCell(5);\n let cell7 = row.insertCell(6);\n\n // Add HTML contents of the corresponding elements:\n cell1.innerHTML = element.datetime;\n cell2.innerHTML = element.city;\n cell3.innerHTML = element.state;\n cell4.innerHTML = element.country;\n cell5.innerHTML = element.shape;\n cell6.innerHTML = element.durationMinutes;\n cell7.innerHTML = element.comments;\n\n index++;\n });\n}", "createDomElement(searchTerm) {\n const fieldId = this.columnDef && this.columnDef.id;\n const minValue = this.filterProperties.hasOwnProperty('minValue') ? this.filterProperties.minValue : DEFAULT_MIN_VALUE;\n const startValue = this.filterParams.hasOwnProperty('sliderStartValue') ? this.filterParams.sliderStartValue : minValue;\n const $headerElm = this.grid.getHeaderRowColumn(this.columnDef.id);\n $($headerElm).empty();\n let searchTermInput = (searchTerm || '0');\n if (+searchTermInput < minValue) {\n searchTermInput = `${minValue}`;\n }\n if (+searchTermInput < startValue) {\n searchTermInput = `${startValue}`;\n }\n this._currentValue = +searchTermInput;\n // create the DOM Select dropdown for the Operator\n this.$selectOperatorElm = $(this.buildSelectOperatorHtmlString());\n this.$filterInputElm = $(this.buildTemplateHtmlString());\n const $filterContainerElm = $(`<div class=\"form-group slider-container search-filter filter-${fieldId}\"></div>`);\n this.$containerInputGroupElm = $(`<div class=\"input-group search-filter filter-${fieldId}\"></div>`);\n const $operatorInputGroupAddon = $(`<span class=\"input-group-addon input-group-prepend operator\"></span>`);\n /* the DOM element final structure will be\n <div class=\"input-group\">\n <div class=\"input-group-addon input-group-prepend operator\">\n <select class=\"form-control\"></select>\n </div>\n <input class=\"form-control\" type=\"text\" />\n <div class=\"input-group-addon input-group-prepend rangeOuput_percentComplete\"><span class=\"input-group-text\">0</span></div>\n </div>\n */\n $operatorInputGroupAddon.append(this.$selectOperatorElm);\n this.$containerInputGroupElm.append($operatorInputGroupAddon);\n this.$containerInputGroupElm.append(this.$filterInputElm);\n if (!this.filterParams.hideSliderNumber) {\n const $sliderTextInputAppendAddon = $(this.buildTemplateSliderTextHtmlString());\n $sliderTextInputAppendAddon.children().html(searchTermInput);\n this.$containerInputGroupElm.append($sliderTextInputAppendAddon);\n }\n // create the DOM element & add an ID and filter class\n $filterContainerElm.append(this.$containerInputGroupElm);\n this.$filterInputElm.val(searchTermInput);\n this.$filterInputElm.data('columnId', fieldId);\n if (this.operator) {\n this.$selectOperatorElm.val(this.operator);\n }\n // if there's a search term, we will add the \"filled\" class for styling purposes\n if (searchTerm !== '') {\n $filterContainerElm.addClass('filled');\n }\n // append the new DOM element to the header row\n if ($filterContainerElm && typeof $filterContainerElm.appendTo === 'function') {\n $filterContainerElm.appendTo($headerElm);\n }\n return $filterContainerElm;\n }", "function insertRowData(tableID, itemQuantity, itemName){\n $(tableID).prepend(`\n <tr class=\"table-row\">\n <td class=\"px-3 red-line\"><input type=\"checkbox\" aria-label=\"item checkbox\" class=\"item-check\"></td>\n <td class=\"px-3 quantity-field\"><span aria-label=\"item quantity\" class=\"quantity-number\">${itemQuantity}x</span></td>\n <td class=\"item-field w-75 text-left\" aria-label=\"item name\">${itemName}</td>\n <td class=\"px-2\"><button class=\"remove-field\" aria-label=\"remove item\"><i class=\"far fa-trash-alt\"></i></button></td>\n </tr>\n `);\n updateHeaderQuantity(tableID);\n updateTableBanner(tableID);\n}", "function createFieldMappingRow() {\n var table = document.getElementById(\"mapping\");\n// var tbody = document.getElementById(\"ProfileSync1\");\n var new_row = table.rows[2].cloneNode(true);\n // console.log(new_row);\n var len = table.rows.length;\n new_row.cells[0].innerHTML = len;\n\n var inp1 = new_row.cells[1].getElementsByTagName('select')[0];\n //new_row.id = \"row\" + len;\n //inp1.id += len;\n// inp1.value = '';\n// console.log(new_row.children[4]);\n new_row.children[3].style.display = \"block\";\n for (var i = 1; i < table.tBodies[0].children.length; i++) {\n table.tBodies[0].children[i].children[0].innerHTML = i + 1;\n }\n\n\n table.tBodies[0].appendChild(new_row);\n table.tBodies[0].children[len - 1].children[1].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[2].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[3].children[0].value = \"\";\n gadgets.window.adjustHeight();\n}", "insertColumnBefore() {\n this.insertColumn();\n }", "function changeHTMLtoLive(table) {\n var tableRows = table.find(\"tbody\").children('tr');\n var newRows = $('<tbody>');\n for(var row in tableRows) {\n if(!$.isNumeric(row)) break;\n if(row == movingNewPosition) {\n newRows.append(movingRow.clone());\n newRows.append($(tableRows[row]).clone());\n } else if(row !== movingPosition) {\n newRows.append($(tableRows[row]).clone());\n }\n }\n table = table.find(\"tbody\").replaceWith(newRows);\n return table;\n}", "createDomElement(filterTemplate, searchTerm) {\n const fieldId = this.columnDef && this.columnDef.id;\n const $headerElm = this.grid.getHeaderRowColumn(fieldId);\n $($headerElm).empty();\n // create the DOM element & add an ID and filter class\n const $filterElm = $(filterTemplate);\n $filterElm.val(searchTerm);\n $filterElm.data('columnId', fieldId);\n // if there's a search term, we will add the \"filled\" class for styling purposes\n if (searchTerm) {\n $filterElm.addClass('filled');\n }\n // append the new DOM element to the header row\n if ($filterElm && typeof $filterElm.appendTo === 'function') {\n $filterElm.appendTo($headerElm);\n }\n return $filterElm;\n }", "insertBefore(node) {\n if (this.fragment.hasChildNodes()) {\n node.parentNode.insertBefore(this.fragment, node);\n } else {\n const parentNode = node.parentNode;\n const end = this.lastChild;\n let current = this.firstChild;\n let next;\n\n while (current !== end) {\n next = current.nextSibling;\n parentNode.insertBefore(current, node);\n current = next;\n }\n\n parentNode.insertBefore(end, node);\n }\n }", "function add_blacklist_to_table(i, bl) {\n document.getElementById(\"bl_body\").insertAdjacentHTML('beforeend', `\n <tr id=\"bl_line\">\n <td>${i}</td>\n <td>${bl}</td>\n <td><input class=\"uk-checkbox\" type=\"checkbox\" name=\"bl_cb\"></td>\n </tr>\n `);\n}", "insertRowAfter() {\n this.insertRow(1);\n }", "addRow () {\n const bottomRow = document.getElementById(\"bottomRow\")\n const numChildren = bottomRow.getElementsByTagName('th').length\n const newRow = document.createElement('tr')\n newRow.innerHTML =\n '<th class=\"redips-mark\">' + '<td></td>'.repeat(numChildren-1)\n bottomRow.parentNode.insertBefore(newRow, bottomRow)\n }", "function createFieldMappingRow1() {\n var table = document.getElementById(\"userMapping\");\n// var tbody = document.getElementById(\"ProfileSync1\");\n var new_row = table.rows[4].cloneNode(true);\n // console.log(new_row);\n var len = table.rows.length;\n new_row.cells[0].innerHTML = len;\n\n var inp1 = new_row.cells[1].getElementsByTagName('select')[0];\n //new_row.id = \"row\" + len;\n //inp1.id += len;\n// inp1.value = '';\n// console.log(new_row.children[4]);\n new_row.children[4].style.display = \"block\";\n for (var i = 1; i < table.tBodies[0].children.length; i++) {\n table.tBodies[0].children[i].children[0].innerHTML = i + 1;\n }\n\n\n table.tBodies[0].appendChild(new_row);\n table.tBodies[0].children[len - 1].children[1].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[2].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[3].children[0].value = \"\";\n gadgets.window.adjustHeight();\n}", "function applyToDOM(){\n\t\t\tvar bAllSorted = aoSort.length===aoFull.length;\n\t\t\tif (bSameParent&&bAllSorted) {\n\t\t\t\taoSort.forEach(function(elmObj){\n\t\t\t\t\tmFragment.appendChild(elmObj.elm);\n\t\t\t\t});\n\t\t\t\tmParent.appendChild(mFragment);\n\t\t\t} else {\n\t\t\t\taoSort.forEach(function(elmObj) {\n\t\t\t\t\tvar mElm = elmObj.elm\n\t\t\t\t\t\t,mGhost = doc.createElement('div')\n\t\t\t\t\t;\n\t\t\t\t\telmObj.ghost = mGhost;\n\t\t\t\t\tmElm.parentNode.insertBefore(mGhost,mElm);\n\t\t\t\t});\n\t\t\t\taoSort.forEach(function(elmObj,i) {\n\t\t\t\t\tvar mGhost = aoSortBeforeSort[i].ghost;\n\t\t\t\t\tmGhost.parentNode.insertBefore(elmObj.elm,mGhost);\n\t\t\t\t\tmGhost.parentNode.removeChild(mGhost);\n\t\t\t\t});\n\t\t\t}\n\t\t}", "function addFilterButton() {\r\n var rows = document.evaluate(\"//a[@id='contactLink']\", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n for (var i=0;i<rows.snapshotLength;i++) {\r\n if (in_array(pageIDs[i],hiddenIDs)) { // hidden property\r\n debug(pageIDs[i]+' is hidden, no filter button added');\r\n continue;\r\n }\r\n var li = document.createElement('span'),\r\n a = document.createElement('a');\r\n li.setAttribute('class','imFilter');\r\n li.setAttribute('style','margin-left:10px;');\r\n a.innerHTML = lang('Filter');\r\n a.setAttribute('href','javaScript:openFilterDiv('+pageIDs[i]+')');\r\n a.id = 'filterref'+pageIDs[i];\r\n li.appendChild(a);\r\n var div = document.createElement('div');\r\n div.id = 'filter'+pageIDs[i];\r\n div.setAttribute('style','z-index:100;display:none;');\r\n var lfid = document.createElement('span'),\r\n afid = document.createElement('a');\r\n afid.innerHTML = lang('AddFilterById');\r\n afid.setAttribute('href','#');\r\n afid.addEventListener('click',function(e) {addFilter('id',this.parentNode.parentNode.id.substring(6));}, false);\r\n lfid.appendChild(afid);\r\n lfid.setAttribute('style','outline:1px solid #326EA1;margin: 0 2px 0 2px;padding-right:2px;');\r\n div.appendChild(lfid);\r\n var ltit = document.createElement('span'),\r\n atit = document.createElement('a');\r\n atit.innerHTML = lang('AddFilterByTitle');\r\n atit.setAttribute('href','#');\r\n atit.addEventListener('click',function(e) {addFilter('title',this.parentNode.parentNode.id.substring(6));}, false);\r\n ltit.appendChild(atit);\r\n ltit.setAttribute('style','outline:1px solid #326EA1;margin: 0 2px 0 2px;padding-right:2px;');\r\n div.appendChild(ltit);\r\n var lloc = document.createElement('span'),\r\n aloc = document.createElement('a');\r\n aloc.innerHTML = lang('AddFilterByLocation');\r\n aloc.setAttribute('href','javascript:addFilterLocation('+pageLocations[i]+')');\r\n aloc.addEventListener('click',function(e) {addFilter('location',this.parentNode.parentNode.id.substring(6));}, false);\r\n lloc.appendChild(aloc);\r\n lloc.setAttribute('style','outline:1px solid #326EA1;margin: 0 2px 0 2px;padding-right:2px;');\r\n div.appendChild(lloc);\r\n li.appendChild(div);\r\n rows.snapshotItem(i).parentNode.appendChild(li);\r\n }\r\n}", "function insert_row(data, table) {\n let table_row = $(`<tr>`).append(create_transaction_row(data[0]));\n table.prepend(table_row);\n}", "function insertIntoHeader(){\n var parent = this.parentElement.tagName.toLowerCase();\n if (parent === 'header' || parent === 'wb-row') return;\n var block = dom.closest(this, 'wb-step, wb-context, wb-expression');\n var head = setDefaultByTag(block, 'header');\n head.appendChild(this, true);\n}", "function jsonPrepareContent(Json, filter){\n \n var trHTML = '';\n\n if (filter != \"\"){\n\n var category = \"\";\n\n Json = Json.filter(\n data => { \n\n if (category != data.category.name){\n\n category = filter.find(function (element){\n return element == data.category.name;\n \n });\n\n }\n \n if (category != undefined){\n return data;\n }\n \n }\n \n );\n\n }\n\n $.each(Json, function (key, value) {\n trHTML += '<tr><td style=\"background-color: #F0F0F0; vertical-align: middle; word-wrap: break-word\"><b>' + value.category.name + '</b></td>';\n trHTML += '<td style=\"background-color: #F0F0F0; vertical-align: middle; word-wrap: break-word\"><b>' + value.service.name + ' <a href=\"' + value.service.ref + '\" class=\"glyphicon glyphicon-link hidden-print\" target=\"_blank\"></a></b></td>';\n trHTML += dataProcessor(value.corda, 'corda');\n trHTML += dataProcessor(value.fabric, 'fabric');\n trHTML += dataProcessor(value.multichain, 'multichain');\n trHTML += dataProcessor(value.quorum, 'quorum');\n });\n \n if (filter != \"\"){\n $('tbody').remove(\"tr\").empty();\n }\n\n var $table = $('#comparetable');\n\n $table.append(trHTML);\n $('body').css(\"display\",\"block\");\n \n if (filter != \"\"){\n $table.trigger('reflow');\n }\n else {\n $table.floatThead(); \n }\n \n \n RemoveEmptyAHref();\n\n }", "function insertarCampoEspejo(fila_original, columna_original, text_original, myTbody){\n var fila_espejo = columna_original - 1;\n var columna_espejo = fila_original + 1;\n var text_espejo = text_original.split('').reverse().join('')\n var my_trs = myTbody.childNodes; \n my_trs[fila_espejo].getElementsByTagName(\"td\")[columna_espejo].innerText = text_espejo; \n}", "_addRow() {\n const indicativeRow = this._hoveredCell.closest('TR');\n let index = this._getHoveredSideOfContainer();\n\n if (index === 1) {\n index = indicativeRow.sectionRowIndex;\n // if inserting after hovered cell\n index = index + this._isBottomOrRight();\n }\n\n this._table.addRow(index);\n }", "function insertCursorFront(elem) { //insert element before element's firstChild\r\n\telem.focus();\t//focus for next input\r\n\tif (elem.firstChild == null)\r\n\t\telem.appendChild(createCursor());\r\n\telse\r\n\t\tinsertBefore(createCursor(), elem.firstChild);\r\n}", "function adjustDOM(e, se, c) {\n var elem;\n for (var j = 0;j < e.length;j++) {\n if (!se[j]) {\n elem = document.getElementById(e[j].id);\n c.appendChild(elem.parentElement);\n }\n else {\n handleInsert(e[j].id, se[j].id, c, j);\n }\n }\n }", "function addCheckToRow(){ \n // console.log(\"doesnt contain span \", studentName, studentName.search(\"span\") === -1);\n // search return -1 is the string is not found\n if(studentName.search(\"span\") !== -1){\n return;\n }\n //T_T why no immutable strings\n // var studentNameRow = studentName + '<span style=\"float: right; color: green;\" class=\"glyphicon glyphicon-ok\"> </span>';\n\n var $studentTable = $('#student-table-javascript').bootstrapTable();\n //todo: check if name has tags and then return\n $studentTable.bootstrapTable('updateRow', {\n index: studentRowIndex,\n row: {\n student_name: studentName + '<span style=\"float: right; color: green;\" class=\"glyphicon glyphicon-ok\"> </span>',\n }\n });\n }", "function replaceHtmlTR( row ){\n\n var s = \"\\n\", c, cell;\n\n for(c=0; (cell = row.cells[c]); c++){\n\n s += ( cell.tagName.test( /th/i ) ? \"||\" : \"|\") +\n ( cell.textContent.trim() || '&nbsp;');\n// ( cell.textContent.trim().replace(/\\|/g, '~|') || '&nbsp;');\n }\n replaceNodeByText(row, s );\n}", "function insertNewHTMLRow(firstName,lastName,phone,email,gender,age,id)\n{\n var insert_index = $(\"contacts_table\").rows.length;\n var newRow = $(\"contacts_table\").insertRow(insert_index);\n\n (newRow.insertCell(FIRST_NAME_INDEX)).innerHTML = firstName;\n (newRow.insertCell(LAST_NAME_INDEX)).innerHTML = lastName;\n (newRow.insertCell(PHONE_INDEX)).innerHTML = phone;\n (newRow.insertCell(EMAIL_INDEX)).innerHTML = email;\n (newRow.insertCell(GENDER_INDEX)).innerHTML = gender;\n (newRow.insertCell(AGE_INDEX)).innerHTML = age;\n (newRow.insertCell(ID_INDEX)).innerHTML = id;\n\n // add the event listeners to the new row element\n newRow.setAttribute(\"onclick\", \"onClickTableRow(event)\");\n newRow.setAttribute(\"onMouseOver\", \"addRowHighlight(event)\");\n newRow.setAttribute(\"onMouseOut\", \"removeRowHighlight(event)\");\n\n return newRow;\n}", "createDomElement(searchTerm) {\n const fieldId = this.columnDef && this.columnDef.id;\n const $headerElm = this.grid.getHeaderRowColumn(fieldId);\n $($headerElm).empty();\n // create the DOM Select dropdown for the Operator\n this.$selectOperatorElm = $(this.buildSelectOperatorHtmlString());\n this.$filterInputElm = $(this.buildInputHtmlString());\n const $filterContainerElm = $(`<div class=\"form-group search-filter filter-${fieldId}\"></div>`);\n const $containerInputGroup = $(`<div class=\"input-group\"></div>`);\n const $operatorInputGroupAddon = $(`<div class=\"input-group-addon input-group-prepend operator\"></div>`);\n /* the DOM element final structure will be\n <div class=\"input-group\">\n <div class=\"input-group-addon input-group-prepend operator\">\n <select class=\"form-control\"></select>\n </div>\n <input class=\"form-control compount-input\" type=\"text\" />\n </div>\n */\n $operatorInputGroupAddon.append(this.$selectOperatorElm);\n $containerInputGroup.append($operatorInputGroupAddon);\n $containerInputGroup.append(this.$filterInputElm);\n // create the DOM element & add an ID and filter class\n $filterContainerElm.append($containerInputGroup);\n this.$filterInputElm.val(searchTerm);\n this.$filterInputElm.data('columnId', fieldId);\n if (this.operator) {\n this.$selectOperatorElm.val(this.operator);\n }\n // if there's a search term, we will add the \"filled\" class for styling purposes\n if (searchTerm) {\n $filterContainerElm.addClass('filled');\n }\n // append the new DOM element to the header row\n if ($filterContainerElm && typeof $filterContainerElm.appendTo === 'function') {\n $filterContainerElm.appendTo($headerElm);\n }\n return $filterContainerElm;\n }", "function thingie(table, parent, nextSibling, i) {\r\n var j, row, rowTuple;\r\n\r\n var tableBody = table.tBodies[0];\r\n \r\n // Clear data rows, which might belong in a subsequent table.\r\n for (j = 0; row = tableBody.rows[j]; ++j)\r\n {\r\n if (row.cells[0].tagName == \"TD\") {\r\n --j;\r\n tableBody.removeChild(row); \r\n }\r\n }\r\n \r\n \r\n // Add the children that belong here.\r\n \r\n // Toss the rows into tables, one tablefull (BUGS_PER_TABLE) at a time.\r\n // Unfortunately, DOM 2 HTML insertRow is for creating *new* rows, so use DOM 2 Core.\r\n \r\n for (j = i * BUGS_PER_TABLE; (j < (i+1) * BUGS_PER_TABLE) && (rowTuple = rows[j]); ++j) {\r\n row = rowTuple[2];\r\n \r\n if (j % 2)\r\n row.className = row.className.replace(/bz_odd/, \"bz_even\");\r\n else\r\n row.className = row.className.replace(/bz_even/, \"bz_odd\");\r\n \r\n tableBody.appendChild(row);\r\n }\r\n \r\n // Put it back into the document. \r\n parent.insertBefore(table, nextSibling);\r\n }", "createDomElement(searchTerm) {\n const fieldId = this.columnDef && this.columnDef.id;\n const $headerElm = this.grid.getHeaderRowColumn(fieldId);\n $($headerElm).empty();\n // create the DOM Select dropdown for the Operator\n this.$selectOperatorElm = $(this.buildSelectOperatorHtmlString());\n this.$filterInputElm = this.buildDatePickerInput(searchTerm);\n const $filterContainerElm = $(`<div class=\"form-group search-filter filter-${fieldId}\"></div>`);\n const $containerInputGroup = $(`<div class=\"input-group flatpickr\"></div>`);\n const $operatorInputGroupAddon = $(`<div class=\"input-group-addon input-group-prepend operator\"></div>`);\n /* the DOM element final structure will be\n <div class=\"input-group\">\n <div class=\"input-group-addon input-group-prepend operator\">\n <select class=\"form-control\"></select>\n </div>\n <div class=flatpickr>\n <input type=\"text\" class=\"form-control\" data-input>\n </div>\n </div>\n */\n $operatorInputGroupAddon.append(this.$selectOperatorElm);\n $containerInputGroup.append($operatorInputGroupAddon);\n $containerInputGroup.append(this.$filterInputElm);\n // create the DOM element & add an ID and filter class\n $filterContainerElm.append($containerInputGroup);\n this.$filterInputElm.data('columnId', fieldId);\n if (this.operator) {\n this.$selectOperatorElm.val(this.operator);\n }\n // if there's a search term, we will add the \"filled\" class for styling purposes\n if (searchTerm && searchTerm !== '') {\n this.$filterInputElm.addClass('filled');\n this._currentDate = searchTerm;\n this._currentValue = searchTerm;\n }\n // append the new DOM element to the header row\n if ($filterContainerElm && typeof $filterContainerElm.appendTo === 'function') {\n $filterContainerElm.appendTo($headerElm);\n }\n return $filterContainerElm;\n }", "function manipulationTarget(elem, content) {\n return jQuery.nodeName(elem, \"table\") && jQuery.nodeName(content.nodeType !== 11 ? content : content.firstChild, \"tr\") ? elem.getElementsByTagName(\"tbody\")[0] || elem.appendChild(elem.ownerDocument.createElement(\"tbody\")) : elem;\n } // Replace/restore the type attribute of script elements for safe DOM manipulation", "function insertLineToTable() {\n $(bindHandlerToLine(makeLine())).insertBefore($('#add-new-line'));\n}", "function startTagInRow(p, token) {\n switch (token.tagID) {\n case TAG_ID.TH:\n case TAG_ID.TD: {\n p.openElements.clearBackToTableRowContext();\n p._insertElement(token, NS.HTML);\n p.insertionMode = InsertionMode.IN_CELL;\n p.activeFormattingElements.insertMarker();\n break;\n }\n case TAG_ID.CAPTION:\n case TAG_ID.COL:\n case TAG_ID.COLGROUP:\n case TAG_ID.TBODY:\n case TAG_ID.TFOOT:\n case TAG_ID.THEAD:\n case TAG_ID.TR: {\n if (p.openElements.hasInTableScope(TAG_ID.TR)) {\n p.openElements.clearBackToTableRowContext();\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_TABLE_BODY;\n startTagInTableBody(p, token);\n }\n break;\n }\n default: {\n startTagInTable(p, token);\n }\n }\n}", "function insert_Row() {\n const table = document.getElementById('sampleTable');\n let rowNumber = table.children.length+1;\n \n const newElement = `\n <tr><td>Row${rowNumber} cell1</td>\n <td>Row${rowNumber} cell2</td></tr>`\n ;\n table.innerHTML += newElement;\n}", "function manipulationTarget(elem, content) {\n return jQuery.nodeName(elem, \"table\") &&\n jQuery.nodeName(content.nodeType !== 11 ? content : content.firstChild, \"tr\") ?\n elem.getElementsByTagName(\"tbody\")[0] ||\n elem.appendChild(elem.ownerDocument.createElement(\"tbody\")) :\n elem;\n }", "function manipulationTarget(elem,content){return jQuery.nodeName(elem,\"table\") && jQuery.nodeName(content.nodeType !== 11?content:content.firstChild,\"tr\")?elem.getElementsByTagName(\"tbody\")[0] || elem.appendChild(elem.ownerDocument.createElement(\"tbody\")):elem;} // Replace/restore the type attribute of script elements for safe DOM manipulation", "function wrapNodesBefore(nodes, tagName, referenceNode) {\n const wrappingNode = tree.createElement(tagName, ns.html, []);\n\n const parent = tree.getParentNode(referenceNode);\n tree.insertBefore(parent, wrappingNode, referenceNode);\n nodes.forEach((node) => {\n tree.detachNode(node);\n tree.appendChild(wrappingNode, node);\n });\n return wrappingNode;\n}", "function sortTableRow(){\n let tbody = document.getElementById(\"rows\");\n let row, lastPrice, lastName, nextPrice, nextName;\n // check each rows\n for (let i = 0; row = tbody.rows[i]; i++) {\n // remove element after 30 sec time\n checkExitingEleAndRemove(tbody.rows[i].cells[0].innerText);//bidName\n // compare data with each row\n for (let j = 0; j < tbody.rows.length-i-1; j++) {\n\n lastPrice = tbody.rows[j].cells[6].innerText;\n lastName = tbody.rows[j].cells[0].innerText;\n nextPrice = tbody.rows[j+1].cells[6].innerText;\n nextName = tbody.rows[j+1].cells[0].innerText;\n if(sortOrder==\"ASC\"){\n if(lastPrice < nextPrice){\n let parent = document.getElementById(nextName).parentNode;\n parent.insertBefore(document.getElementById(lastName), document.getElementById(nextName).nextSibling);\n }\n }else{\n if(lastPrice > nextPrice){\n let parent = document.getElementById(nextName).parentNode;\n parent.insertBefore(document.getElementById(lastName), document.getElementById(nextName).nextSibling);\n }\n }\n }\n }\n\n}", "function insertRowBefore(sheet, rowIndex, rowData) {\n sheet.insertRowBefore(rowIndex);\n sheet.getRange(rowIndex, 1, 1, rowData.length).setValues([rowData]);\n}", "function insertCursorFront(elem) { //insert element before element's firstChild\n\tcheckClassName(elem);\t//because cursor changed, so the className should be changed\n\telem.focus();\t//focus for next input\n\tif (elem.firstChild == null)\n\t\telem.appendChild(createCursor());\n\telse\n\t\tinsertBefore(createCursor(), elem.firstChild);\n}", "function manipulationTarget(elem,content){return jQuery.nodeName(elem,\"table\")&&jQuery.nodeName(content.nodeType!==11?content:content.firstChild,\"tr\")?elem.getElementsByTagName(\"tbody\")[0]||elem.appendChild(elem.ownerDocument.createElement(\"tbody\")):elem;} // Replace/restore the type attribute of script elements for safe DOM manipulation", "function manipulationTarget(elem,content){return jQuery.nodeName(elem,\"table\")&&jQuery.nodeName(content.nodeType!==11?content:content.firstChild,\"tr\")?elem.getElementsByTagName(\"tbody\")[0]||elem.appendChild(elem.ownerDocument.createElement(\"tbody\")):elem;} // Replace/restore the type attribute of script elements for safe DOM manipulation", "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 }", "function prepareList() {\n\t\t// find td of first entry, make it to a template\n\t\tlistNode = document.querySelector('.object-list tbody tr');\n\t\tif (listNode && listNode.parentElement) {\n\t\t\tlistStart = listNode.parentElement;\n\t\t\tlistNode.parentElement.removeChild(listNode);\n\t\t} else {\n\t\t\tconsole.error('No listitem found, could not load objects list.');\n\t\t\treturn;\n\t\t}\n\t}", "function cmdEditInsertBefore()\n{\n this.originalNode = viewer.currentNode;\n}", "function _containerInsertBefore(nodes) {\n\t return this._containerInsert(this.key, nodes);\n\t}", "function _containerInsertBefore(nodes) {\n\t return this._containerInsert(this.key, nodes);\n\t}", "function mod_change_records() {\n //\n document.getElementById('content-div').removeAll();\n document.getElementById('modify-header').removeAll();\n document.getElementById('input-div').removeAll();\n //\n //\n var head_elements = Array(\n {'elm' : 'H4','textNode' : 'Click on a record in the table to modify it.'},\n {'elm' : 'LABEL', 'className' : 'label', 'textNode' : 'Show Deleted Records'},\n {'elm' : 'INPUT', 'id' : 'show-deleted', 'type' : 'checkbox', 'events' : [{'event' : 'click', 'function' : gen_stock_table.bind(null,1,'creation_timestamp','DESC')}]},\n {'elm' : 'BR'},\n {'elm' : 'LABEL', 'className' : 'label-12em', 'textNode' : 'Narrow by Item Number:'},\n {'elm' : 'INPUT', 'id' : 'search-item-number', 'type' : 'text', 'events' : [{'event' : 'keyup', 'function' : gen_stock_table.bind(null,1,'creation_timestamp','DESC')}]}\n );\n //\n addChildren(document.getElementById('input-div'),head_elements);\n //\n gen_stock_table(1,'creation_timestamp','DESC');\n}", "function manipulationTarget(elem,content){return jQuery.nodeName(elem,\"table\")&&jQuery.nodeName(content.nodeType!==11?content:content.firstChild,\"tr\")?elem.getElementsByTagName(\"tbody\")[0]||elem.appendChild(elem.ownerDocument.createElement(\"tbody\")):elem;}// Replace/restore the type attribute of script elements for safe DOM manipulation", "function prepareMyDataTables() {\r\n var countriesTable = \"//b[text()='Mis votos por país']/ancestor::*[position()=5]\".findNode();\r\n var votesTable = \"//b[text()='Mis votos por valor']/ancestor::*[position()=5]\".findNode();\r\n var genTable = \"//b[text()='Mis votos por género']/ancestor::*[position()=5]\".findNode();\r\n var statsTable = \"//td[text()='Nº de críticas validadas:']/ancestor::*[position()=3]\".findNode();\r\n var persTable = \"//b[text()='Datos personales']/ancestor::*[position()=5]\".findNode();\r\n\r\n var clonPaises = countriesTable.cloneNode(true);\r\n clonPaises.style.marginTop = \"10\";\r\n votesTable.parentNode.appendChild(clonPaises);\r\n countriesTable.parentNode.removeChild(countriesTable);\r\n clonPaises.width = \"100%\";\r\n\r\n var clonGen = genTable.cloneNode(true);\r\n clonGen.style.marginTop = \"10\";\r\n statsTable.parentNode.appendChild(clonGen);\r\n genTable.parentNode.removeChild(genTable);\r\n clonGen.width = \"100%\";\r\n }" ]
[ "0.6603204", "0.62993956", "0.62365973", "0.5883171", "0.5858068", "0.5838278", "0.5747183", "0.57300496", "0.57079357", "0.5700026", "0.5624318", "0.5618044", "0.5611098", "0.5608529", "0.55819273", "0.5571706", "0.5564116", "0.55370295", "0.55263513", "0.55051196", "0.54921365", "0.5486296", "0.5476352", "0.544254", "0.5436909", "0.5435122", "0.5417949", "0.54156595", "0.5415359", "0.5407526", "0.5393777", "0.53867424", "0.53818905", "0.5376277", "0.5372876", "0.5370479", "0.5370143", "0.5367948", "0.53632563", "0.53562784", "0.53506106", "0.53475237", "0.5345857", "0.5345857", "0.5345857", "0.5345857", "0.5345857", "0.5345857", "0.5345857", "0.53383666", "0.53383666", "0.53383666", "0.5338332", "0.53298104", "0.5321823", "0.5321163", "0.53195006", "0.531706", "0.53116816", "0.53061295", "0.5297862", "0.5295088", "0.52853787", "0.5285198", "0.5278351", "0.52775997", "0.5273534", "0.5273319", "0.52721596", "0.52632195", "0.5260642", "0.5254056", "0.5233521", "0.5233255", "0.52299196", "0.52296877", "0.5224212", "0.5220404", "0.5216432", "0.52059436", "0.5200795", "0.5198797", "0.51938707", "0.5190119", "0.51862735", "0.5177193", "0.516579", "0.5165565", "0.5164879", "0.5163977", "0.51639575", "0.5160325", "0.5160325", "0.51595056", "0.5154258", "0.5153664", "0.5151704", "0.5151704", "0.5151554", "0.5149287", "0.5149243" ]
0.0
-1
/==================================================== General TF utility fns below =====================================================
function tf_GetNodeText(n) /*==================================================== - returns text + text of child nodes of a node =====================================================*/ { var s = n.textContent || n.innerText || n.innerHTML.replace(/\<[^<>]+>/g, ''); s = s.replace(/^\s+/, '').replace(/\s+$/, '')/*.tf_Trim()*/; return s.tf_Trim(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function TF(key) {\n this.tf = createTwofish();\n this.tf.open(Array.from(key), 0);\n\n this.encrypt = function(block) {\n return this.tf.encrypt(Array.from(block), 0);\n };\n}", "function TF(key) {\n this.tf = createTwofish();\n this.tf.open(Array.from(key), 0);\n\n this.encrypt = function(block) {\n return this.tf.encrypt(Array.from(block), 0);\n };\n}", "function TF(key) {\n this.tf = createTwofish();\n this.tf.open(Array.from(key), 0);\n\n this.encrypt = function (block) {\n return this.tf.encrypt(Array.from(block), 0);\n };\n}", "function TF(key) {\n this.tf = createTwofish();\n this.tf.open((0, _from2.default)(key), 0);\n\n this.encrypt = function (block) {\n return this.tf.encrypt((0, _from2.default)(block), 0);\n };\n}", "model(inputNames,outputNames){\n var i;\n if(inputNames && !Array.isArray(inputNames))\n inputNames=[inputNames];\n if(outputNames && !Array.isArray(outputNames))\n outputNames=[outputNames];\n\n if(inputNames)\n for (i in inputNames)\n inputNames[i]=this.get(inputNames[i]);\n else\n inputNames=[this.get(0)];\n if(outputNames)\n for (i in outputNames)\n outputNames[i]=this.apply(outputNames[i]);\n else\n outputNames=[this.apply()];\n\n return tf.model({inputs:inputNames,outputs:outputNames});\n \n }", "function encode_tf(){\n let data=[];\n let data_image=[];\n const labels = get_nonnull_labels();\n // for each label\n for (let numberLabel = 0; numberLabel < array_length(labels); numberLabel = numberLabel+1){\n const label = labels[numberLabel];\n const images_label = get_images(label);\n // for each image in label\n for (let j = 0; j < array_length(images_label); j = j+1){\n data_image=[];\n const image = images_label[j];\n const detections = encode_image(image);\n array_push(data_image,detections);\n array_push(data_image,numberLabel);\n array_push(data,data_image);\n }\n }\n return data;\n }", "function canTensorify(obj) {\n return obj == null || isPrimitive(obj) || Array.isArray(obj) ||\n (typeof obj === 'object' && (obj instanceof _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"Tensor\"])) ||\n _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].isTypedArray(obj);\n}", "makeTestFunction() {\n this.testFunction = (data) => {\n return _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"](() => {\n const valOutputs = [];\n let totalLoss;\n const inputs = data.slice(0, this.inputs.length);\n const targets = data.slice(this.inputs.length, this.inputs.length + this.outputs.length);\n const feeds = [];\n for (let i = 0; i < this.inputs.length; ++i) {\n feeds.push({ key: this.inputs[i], value: inputs[i] });\n }\n const feedDict = new _executor__WEBPACK_IMPORTED_MODULE_15__[\"FeedDict\"](feeds);\n const outputs = Object(_executor__WEBPACK_IMPORTED_MODULE_15__[\"execute\"])(this.outputs, feedDict);\n // Compute total loss.\n for (let i = 0; i < this.lossFunctions.length; ++i) {\n const lossFunction = this.lossFunctions[i];\n // TODO(cais): Add sample weighting and replace the simple\n // averaging.\n const loss = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mean\"](lossFunction(targets[i], outputs[i]));\n if (i === 0) {\n totalLoss = loss;\n }\n else {\n totalLoss = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"add\"](totalLoss, loss);\n }\n valOutputs.push(totalLoss);\n }\n // Compute the metrics.\n for (let i = 0; i < this.metricsTensors.length; ++i) {\n const metric = this.metricsTensors[i][0];\n const outputIndex = this.metricsTensors[i][1];\n // TODO(cais): Replace K.mean() with a proper weighting function.\n const meanMetric = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mean\"](metric(targets[outputIndex], outputs[outputIndex]));\n valOutputs.push(meanMetric);\n }\n return valOutputs;\n });\n };\n }", "function canTensorify(obj) {\n return obj == null || isPrimitive(obj) || Array.isArray(obj) ||\n (typeof obj === 'object' && (obj instanceof tf.Tensor)) ||\n tf.util.isTypedArray(obj);\n}", "function Tf(a,b,c,d){this.type=a;this.name=b;this.A=c;this.qa=d;this.yb=[];this.align=-1;this.ab=!0}", "function svm(){\n // private object \n let model = {\n weights : tf.tensor([]),\n bias:tf.tensor([]),\n legrangeMultipliers : tf.tensor([]),\n supportVectors: {x: tf.tensor([]),y: tf.tensor([])},\n kernel: (x,y)=>{return x.matMul(y)}\n };\n\n this.getParams = function(){\n return {weights: model.weights, bias: model.bias};\n };\n\n this.getLegrangeMultipliers = function(){\n return model.legrangeMultipliers;\n \n }\n\n this.kernelFactory = function(type) {\n if (type === 'linear')return function(x_i, x_j, params={}){\n return tf.matMul( x_i, x_j.transpose());\n\n };\n if (type === 'quadratic')return function(x_i, x_j, params={}){\n return tf.dot(x_i, x_j.transpose()).pow(2);\n };\n if(type ==='rbf') return function (x_i,x_j, params={sigma: -1, smoothness : 1}){\n params.sigma = tf.tensor(1)|| params.sigma;\n\n const sqdist = tf.sum(x_i.pow(2),axis=1).expandDims(1).transpose()\n .add( tf.sum(x_j.pow(2), axis=1).expandDims(1) )\n .add( \n tf.dot(x_i, x_j.transpose() ).transpose()\n .mul(-2)\n );\n return params.sigma.pow(2).mul( tf.exp( sqdist.mul( (-0.5/ (params.smoothness**2) ) )))\n\n }\n }\n\n\n // this function generate the equation for our hyperplane\n // and returns a function that take an arbitray value 'x'\n // which inturn spits out our predicted 'y' value -,+ or 0\n this.hyperplaneFn = function (weights, bias) {\n return function (x){\n \n return tf.matMul(x, weights.transpose() ).add(bias);\n\n }\n }\n\n this.fit = (data, params = {threshold: 0.00, tollerance: 0, epoch: 2, }) => {\n\n function linearKernel(xI,xJ){\n // tackling the rectangular matrix\n // lets make xI.shape <= xJ alaways.. if it is not, then swap it\n if ((xJ.shape[0]) < (xI.shape[0])){\n const tmp = xJ;\n xJ = xI;\n xI = tmp;\n\n console.log('xJ.shape[0] < xI.shape[0]');\n }\n // this trims the bigger matrix xJ to xI.shape and mimiking np.diag functionality\n // xJ = xJ.slice([0, 0], [xI.shape[0], -1]); \n return tfDiag( tf.matMul(xI, xJ, 0, 1)); \n }\n\n \n function polyKernel(xI,xJ, params={degree: 3}){\n if ((xJ.shape[0]) < (xI.shape[0])){\n const tmp = xJ;\n xJ = xI;\n xI = tmp;\n\n console.log('xJ.shape[0] < xI.shape[0]');\n }\n let {degree = 10} = params;\n // return xI.mul(xJ).pow(degree).sum(1).expandDims().transpose()\n\n // return xI.matMul(xJ)\n\n return xI.reshape([xI.shape[0],1,xI.shape[1]]).matMul(xJ.reshape([xJ.shape[0], xJ.shape[1], 1])).add(0).pow(degree).reshape([xI.shape[0], 1])\n }\n\n function rbfKernel(xI, xJ, params={sigma: 8}){\n\n let sigma = params.sigma || 1.0;\n\n let s = tf.norm(xI.sub(xJ),ord=2,axis=1).pow(2);\n\n return tf.exp(s.mul(-1).div(sigma**2)).expandDims().transpose();\n\n }\n\n function tfFilter(x, filter){\n\n const xArray = x.arraySync();\n filter = filter.flatten().arraySync();\n\n const filteredX = [];\n for(let i=0;i< xArray.length;i++){\n if(filter[i])filteredX.push(xArray[i]);\n }\n\n return tf.tensor(filteredX);\n \n }\n\n // user params:-\n let {\n threshold=0.01,\n tollerance = tf.tensor(.01).reshape([1, 1]), // how much you want to loose the \"hard\"-margin...\n epoch = 2,\n verbose=true,\n } = params;\n \n\n tollerance = (typeof tollerance === 'number' )? tf.tensor(tollerance).reshape([1,1]) : tollerance;\n \n let legrangeMultipliers = tf.randomUniform([data.x.shape[0], 1]).mul(2).sub(1);\n\n console.log(\"before Optimization:-\", legrangeMultipliers.shape);\n legrangeMultipliers.print();\n\n if (verbose){\n console.log(\"input Data:-\")\n data.x.print();\n data.y.print();\n\n }\n\n // calculating weights from 15 \n let weights = model.weights;\n let bias = model.bias;\n\n\n weights = tf.sum( legrangeMultipliers.mul(data.y).mul(data.x), axis=0).expandDims();\n bias = tf.mean(\n data.y.sub( (weights.matMul(data.x.transpose()) ) )\n );\n\n weights.print();\n bias.print();\n\n\n // initializing for shuffling..\n let dataX = data.x;\n let dataY = data.y;\n\n const oldIndex = tf.linspace(0, data.x.shape[0]-1, data.x.shape[0]).expandDims(1);\n let shuffledIndex = oldIndex;\n\n // commiting params and legrangeMultipliers to our model object for further access\n model.weights = weights;\n model.bias = bias;\n\n\n model.legrangeMultipliers = legrangeMultipliers; \n\n const calcLegrangeMultipliers = legrangeMultipliers.flatten().arraySync();\n const supportVectors = {x: tf.tensor([]), y: tf.tensor([]), alpha: tf.tensor([])};\n\n \n for(let i=0;i< dataX.shape[0];i++){\n\n if (calcLegrangeMultipliers[i] > 0){\n supportVectors.x = supportVectors.x.concat(dataX.slice([i,0],[1,-1]));\n supportVectors.y = supportVectors.y.concat(dataY.slice([i,0],[1,-1]));\n supportVectors.alpha = supportVectors.alpha.concat( legrangeMultipliers.slice([i,0],[1,-1]) );\n }\n }\n\n model.supportVectors = supportVectors;\n\n model.kernel = rbfKernel;\n\n // const kernel = linearKernel;\n const kernel = model.kernel;\n\n let cont = 0;\n for(let e=0;e<epoch;e++){\n\n // combining data.x, data.y, legrangeMultipliers and previousIndex so that they can be manipulated together..\n let combinedMatrix = dataX.concat(dataY, axis=1).concat(legrangeMultipliers, axis=1).concat( shuffledIndex, axis=1).arraySync();\n\n // make sure that there will be no i == j\n let foundPerfectPairs = 0;\n\n // shuffling the points randomly\n tf.util.shuffle(combinedMatrix);\n\n\n combinedMatrix = tf.tensor(combinedMatrix);\n\n // copying the original combined matrix for later use..\n const originalCombinedMatrix = combinedMatrix.slice([0,0],[-1,-1]);\n\n // the data point that is not beeing considered in this epoch ( because, later we only use the n-1 data points if n is odd... in order to ease out the computation. )\n const removedCombinedMatrix = combinedMatrix.slice([combinedMatrix.shape[0]-1, 0], [-1, -1]);\n\n // NOTE: here, pop one of the data points if data is odd numbered\n // because according to SMO the smallest pair we can optimize together is '2' so, later we will split our data points and variables into 2 groups\n // which if we have odd numbered data points then we have 1 extra point which doesn't have a corresponding point to make a pair\n // thats why, at each epoch we simply dropped one of the data point randomly and update the rest which stops us from any biased removal and overtime they converges...\n if ((data.x.shape[0] % 2) ){\n combinedMatrix = combinedMatrix.slice([0, 0], [combinedMatrix.shape[0] -1 , -1]);\n }\n\n console.log('combinedMatrix.Shape: '+ combinedMatrix.shape);\n\n // logging the starting and ending position of every matrices inside our combinedMatrix.. for better referencing.\n const dataXColBlock = [0 , dataX.shape[1]];\n const dataYColBlock = [dataXColBlock[1] , dataY.shape[1]];\n const legrangeMultipliersColBlock = [dataYColBlock[1] + dataYColBlock[0] , legrangeMultipliers.shape[1]];\n const shuffledIndexColBlock = [legrangeMultipliersColBlock[0] + legrangeMultipliersColBlock[1], shuffledIndex.shape[1]];\n\n // reassigning the matrices after shuffling...\n dataX = combinedMatrix.slice([0, 0], [-1, dataXColBlock[1]]);\n dataY = combinedMatrix.slice([0, dataYColBlock[0]], [-1, dataYColBlock[1]]);\n legrangeMultipliers = combinedMatrix.slice([0, legrangeMultipliersColBlock[0]], [-1, legrangeMultipliersColBlock[1]]);\n shuffledIndex = combinedMatrix.slice([0, shuffledIndexColBlock[0]], [-1, shuffledIndexColBlock[1] ]);\n\n\n /* splitting the data into 2 random groups and each elem of both the group gets optimized jointly using tensor version of SMO algorithm */\n let x1 = dataX.slice([0,0],[Math.floor(dataX.shape[0]/2), -1]);\n let x2 = dataX.slice([Math.floor(dataX.shape[0]/2), 0],[-1, -1]);\n\n let y1 = dataY.slice([0,0],[Math.floor(dataY.shape[0]/2), -1]);\n let y2 = dataY.slice([Math.floor(dataY.shape[0]/2), 0],[-1, -1]);\n\n const predY1 = this.margin(x1);\n const predY2 = this.margin(x2);\n\n console.log(\"epoch: \"+ e);\n\n let Error1 = predY1.sub(y1);\n let Error2 = predY2.sub(y2);\n\n const residual1 = Error1.mul(y1);\n const residual2 = Error2.mul(y2);\n\n let tol = 1e-4;\n\n \n\n\n\n // initializing alphas...\n let alpha1 = legrangeMultipliers.slice([0,0],[Math.floor(legrangeMultipliers.shape[0]/2), -1]);\n let alpha2 = legrangeMultipliers.slice([Math.floor(legrangeMultipliers.shape[0]/2), 0],[-1, -1]);\n\n let oldAlpha1 = alpha1;\n let oldAlpha2 = alpha2;\n\n // if( (labels[i]*Ei < -tol && this.alpha[i] < C) || (labels[i]*Ei > tol && this.alpha[i] > 0) )\n const booleanMask = residual1.less(-tol).mul(alpha1.less(tollerance)).add( residual1.greater(tol).mul(alpha1.greater(0)) );\n\n\n if (verbose){\n console.log('x1.shape', x1.shape, 'x2.shape', x2.shape);\n console.log(kernel(x1,x1).shape, kernel(x2,x2).shape, kernel(x1,x2).shape);\n }\n\n\n\n\n\n /* \n Calculating LowerBound:-\n if the target y_1 == y_2 then use lB2 otherwise use lB1 \n */\n\n // calculating different lower bounds for both the cases..\n const lB1 = tf.maximum(0, alpha2.sub(alpha1));\n const lB2 = tf.maximum(0, alpha2.add(alpha1)).sub(tollerance);\n\n // using filters instead of conditional statements\n const lB1Filter = y1.notEqual(y2).mul(1);\n const lB2Filter = y1.equal(y2).mul(1);\n\n // applying filters...\n const lB1Filtered = lB1.mul(lB1Filter);\n const lB2Filtered = lB2.mul(lB2Filter);\n let lowerBound = lB1Filtered.add(lB2Filtered);\n\n /* \n Calculating UpperBound:-\n if the target y_1 == y_2 then use uB2 otherwise use uB1 \n */\n\n // calculating different lower bounds for both the cases..\n const uB1 = tf.minimum( tollerance, tollerance.sub((alpha1).add(alpha2)) );\n const uB2 = tf.minimum(tollerance, alpha1.add(alpha2));\n\n // using filters instead of conditional statements\n const uB1Filter = y1.notEqual(y2).mul(1);\n const uB2Filter = y1.equal(y2).mul(1);\n\n // applying filters...\n const uB1Filtered = uB1.mul(uB1Filter);\n const uB2Filtered = uB2.mul(uB2Filter);\n let upperBound = uB1Filtered.add(uB2Filtered);\n\n\n // if (Math.abs(L-H) < 1e-4)continue;\n const booleanMask2 = tf.abs(lowerBound.sub(upperBound)).greater(1e-4);\n\n\n // var eta = 2*this.kernelResult(i,j) - this.kernelResult(i,i) - this.kernelResult(j,j);\n\n // derivative of our quadratic optimization function..\n let objectiveFnDx = kernel(x1,x2).mul(2).sub( kernel(x1, x1)).sub(kernel(x2,x2))\n\n // if(eta >= 0) continue;\n const booleanMask3 = objectiveFnDx.less(0).mul(1);\n\n let combinedMask = booleanMask.mul(booleanMask2).mul(booleanMask3);\n\n\n if(combinedMask.sum().dataSync()[0] === 0){\n\n console.log('found all the legrange mulipliers', combinedMask.print())\n console.log('error:-', Error1.print(), Error2.print())\n model.supportVectors.alpha.print();\n // break;\n\n }\n\n /* filter out all the points and work with only those points that satisfies all 3 boolean Mask/conditionals */\n\n // filtering out those points and there corresponding alphas which are already being optimized.. (i.e, whose derivatives are already == 0)\n x1 = tfFilter(x1, combinedMask);\n x2 = tfFilter(x2, combinedMask);\n\n y1 = tfFilter(y1, combinedMask);\n y2 = tfFilter(y2, combinedMask);\n\n alpha1 = tfFilter(alpha1, combinedMask);\n alpha2 = tfFilter(alpha2, combinedMask);\n\n lowerBound = tfFilter(lowerBound, combinedMask);\n upperBound = tfFilter(upperBound, combinedMask);\n\n Error1 = tfFilter(Error1, combinedMask);\n Error2 = tfFilter(Error2, combinedMask);\n\n objectiveFnDx = tfFilter(objectiveFnDx, combinedMask);\n\n // // using only the non-optimal derivatives..\n // objectiveFnDx = tfFilter(objectiveFnDx, nonOptimalXFilter);\n\n\n // calculate alpha2 \n let newAlpha2 = alpha2.sub(\n (y2.mul(Error1.sub(Error2))\n .div(objectiveFnDx))\n );\n\n \n newAlpha2 = tf.maximum(newAlpha2, lowerBound); // if (newAlpha2 < lowerBound) newAlpha2 = lowerBound;\n newAlpha2 = tf.minimum(newAlpha2, upperBound); // if (newAlpha2 > upperBound) newAlpha2 = upperBound;\n\n // if(Math.abs(aj - newaj) < 1e-4) continue;\n let booleanMask4 = tf.abs(alpha2.sub(newAlpha2)).greater(1e-4);\n\n /* Combining booleanMask4 and original combineMask :- */\n const combinedMaskArray = combinedMask.flatten().arraySync();\n const bMask4Array = booleanMask4.flatten().arraySync();\n\n const newCombinedMask = combinedMaskArray.slice();\n\n let bMask4Index = 0;\n for(let i=0;i<combinedMaskArray.length;i++){\n\n if (combinedMaskArray[i]){\n newCombinedMask[i] = (bMask4Array[bMask4Index])\n bMask4Index++;\n }\n }\n\n combinedMask = tf.tensor(newCombinedMask).expandDims().transpose();\n\n\n console.log(\"combinedMask: \", combinedMask.print());\n\n x1 = tfFilter(x1, booleanMask4);\n x2 = tfFilter(x2, booleanMask4);\n\n y1 = tfFilter(y1, booleanMask4);\n y2 = tfFilter(y2, booleanMask4);\n\n alpha1 = tfFilter(alpha1, booleanMask4);\n alpha2 = tfFilter(alpha2, booleanMask4);\n\n newAlpha2 = tfFilter(newAlpha2, booleanMask4);\n\n Error1 = tfFilter(Error1, combinedMask);\n Error2 = tfFilter(Error2, combinedMask);\n\n // calculating the new alpha1 using the value of alpha2\n const s = y1.mul(y2);\n const newAlpha1 = alpha1.add(s.mul(newAlpha2.sub(alpha2)));\n\n\n console.log('printing alpha', newAlpha1.print(), newAlpha2.print())\n\n\n // update the bias term\n // var b1 = this.b - Ei - labels[i]*(newai-ai)*this.kernelResult(i,i)\n // - labels[j]*(newaj-aj)*this.kernelResult(i,j);\n\n // var b2 = this.b - Ej - labels[i]*(newai-ai)*this.kernelResult(i,j)\n // - labels[j]*(newaj-aj)*this.kernelResult(j,j);\n\n // this.b = 0.5*(b1+b2);\n\n\n \n for(let i=0;i < Error1.shape[0];i++){\n b1 = bias.sub(Error1.slice([i, 0],[1, -1]))\n .sub( \n y1.slice([i, 0],[1, -1])\n .mul(\n newAlpha1.slice([i, 0],[1, -1])\n .sub(alpha1.slice([i, 0],[1, -1]))\n )\n .mul(\n kernel(x1.slice([i, 0],[1, -1]), x1.slice([i, 0],[1, -1])))\n ).sub(\n y2.slice([i, 0],[1, -1])\n .mul(\n newAlpha2.slice([i, 0],[1, -1])\n .sub(alpha2.slice([i, 0],[1, -1]))\n ).mul(kernel(x1.slice([i, 0],[1, -1]),x2.slice([i, 0],[1, -1])))\n );\n\n b2 = bias.sub(Error2.slice([i, 0],[1, -1]))\n .sub( \n y2.slice([i, 0],[1, -1])\n .mul(\n newAlpha1.slice([i, 0],[1, -1])\n .sub(alpha1.slice([i, 0],[1, -1]))\n )\n .mul(\n kernel(x1.slice([i, 0],[1, -1]), x2.slice([i, 0],[1, -1])))\n ).sub(\n y2.slice([i, 0],[1, -1])\n .mul(\n newAlpha2.slice([i, 0],[1, -1])\n .sub(alpha2.slice([i, 0],[1, -1]))\n ).mul(kernel(x2.slice([i, 0],[1, -1]),x2.slice([i, 0],[1, -1])))\n );\n\n bias = b1.add(b2).mul(0.5)\n\n const newa1 = newAlpha1.slice([i, 0],[1, -1]).arraySync()[0];\n const newa2 = newAlpha2.slice([i, 0],[1, -1]).arraySync()[0];\n\n if (newa1 > 0 && newa1 < tollerance )bias = b1;\n if (newa2 > 0 && newa2 < tollerance )bias = b1;\n }\n\n let newLegrangeMultipliers = [];\n\n let newAlphaIndex = 0;\n let oldAlphaIndex = 0;\n\n // combining the optimal alphas with non-optimal new Alphas to form our full legrange multipliers matrix\n const combinedBooleanMaskArray = combinedMask.mul(1).flatten().arraySync();\n for(let i=0; i< combinedBooleanMaskArray.length; i++){\n \n const i2 = i+ dataX.shape[0]/2;\n if (combinedBooleanMaskArray[i]){\n // update the new alphas for the non-optimal points..\n newLegrangeMultipliers[i] = newAlpha1.flatten().arraySync()[newAlphaIndex];\n newLegrangeMultipliers[i2] = newAlpha2.flatten().arraySync()[newAlphaIndex];\n\n newAlphaIndex++;\n }else{\n // if the points is already optimized then leave it as it is..\n newLegrangeMultipliers[i] = oldAlpha1.flatten().arraySync()[i];\n newLegrangeMultipliers[i2] = oldAlpha2.flatten().arraySync()[i];\n }\n\n }\n\n newLegrangeMultipliers = tf.tensor(newLegrangeMultipliers).expandDims(1);\n\n // console.log('(newLegrangeMultipliers.shape): ',newLegrangeMultipliers.shape, nonOptimalFilterArray.length);\n\n\n // pop one of the data points if data is odd numbered (don't worry, we will use that point later in the next epoch {because these points are being chosen randomly})\n if ((data.x.shape[0] % 2) ){\n\n // reassigning the shuffled matrices.\n const removedDataX = removedCombinedMatrix.slice([0, 0], [-1, dataXColBlock[1]]);\n const removedDataY = removedCombinedMatrix.slice([0, dataYColBlock[0]], [-1, dataYColBlock[1]]);\n const removedLegrangeMultipliers = removedCombinedMatrix.slice([0, legrangeMultipliersColBlock[0]], [-1, legrangeMultipliersColBlock[1]]);\n const removedShuffledIndex = removedCombinedMatrix.slice([0, shuffledIndexColBlock[0]], [-1, shuffledIndexColBlock[1] ]);\n\n\n // reforming the matrices by adding the removed data point's matrices.\n dataX = dataX.concat(removedDataX, axis=0);\n dataY = dataY.concat(removedDataY, axis=0);\n newLegrangeMultipliers = newLegrangeMultipliers.concat( removedLegrangeMultipliers, axis=0);\n legrangeMultipliers = legrangeMultipliers.concat(removedLegrangeMultipliers, axis=0);\n shuffledIndex = shuffledIndex.concat(removedShuffledIndex, axis=0);\n }\n\n console.log(dataX.shape);\n\n // updating weights and bias from this new Legrange multipliers..\n // weights = tf.sum( newLegrangeMultipliers.mul(dataY).mul(dataX), axis=0).expandDims();\n // bias = tf.mean(\n // dataY.sub( (weights.matMul(dataX.transpose()) ) )\n // );\n\n // calculating accuracy:-\n // const updatedCalcPredY= this.hyperplaneFn(weights, bias);\n // const predY = updatedCalcPredY(dataX);\n\n // const correct = (\n // predY.greater(0).equal(dataY.greater(0)).mul(1).sum()\n // .div(dataX.shape[0])\n // .flatten().arraySync()[0]);\n\n // console.log(\"accuracy: \", (correct) );\n\n // const alphaDiff = (tf.sum(newLegrangeMultipliers.sub(legrangeMultipliers).pow(2)).flatten().arraySync()[0]);\n // console.log(\"oldALphas - newAlphas: \"+alphaDiff)\n\n // updating the legrange multipliers\n legrangeMultipliers = newLegrangeMultipliers;\n\n // updating bias:-\n model.bias = bias;\n\n\n // unshuffle the legrangeMultipliers :-\n // const unShuffledLegrangeMultipliers = [];\n // for(let i=0;i< legrangeMultipliers.shape[0]; i++){\n\n // const currShuffledIndex = shuffledIndex.flatten().arraySync()[i];\n // unShuffledLegrangeMultipliers[currShuffledIndex] = legrangeMultipliers.flatten().arraySync()[currShuffledIndex];\n // }\n\n model.legrangeMultipliers = legrangeMultipliers; \n\n const calcLegrangeMultipliers = legrangeMultipliers.flatten().arraySync();\n const supportVectors = {x: tf.tensor([]), y: tf.tensor([]), alpha: tf.tensor([])};\n\n \n for(let i=0;i< dataX.shape[0];i++){\n\n if (calcLegrangeMultipliers[i] > 0){\n\n supportVectors.x = supportVectors.x.concat(dataX.slice([i,0],[1,-1]));\n supportVectors.y = supportVectors.y.concat(dataY.slice([i,0],[1,-1]));\n supportVectors.alpha = supportVectors.alpha.concat( legrangeMultipliers.slice([i,0],[1,-1]) );\n }\n }\n\n\n model.supportVectors = supportVectors;\n\n // model.kernel = polyKernel;\n\n\n }\n\n\n\n return this;\n\n },\n\n this.margin = (data) =>{\n\n const nSupportVectors = model.supportVectors.x.shape[0];\n\n let output = model.legrangeMultipliers.slice([0, 0],[1, -1])\n .mul(model.supportVectors.y.slice([0, 0], [1, -1]))\n .mul(\n model.kernel(\n model.supportVectors.x.slice([0,0],[1,-1]).tile([data.shape[0], 1]), \n data\n )\n )\n for(let i=1;i<nSupportVectors;i++){\n\n const currOutput = model.legrangeMultipliers.slice([i, 0],[1, -1])\n .mul(model.supportVectors.y.slice([i, 0], [1, -1]))\n .mul(\n model.kernel(\n model.supportVectors.x.slice([0,0],[1,-1]).tile([data.shape[0], 1]) , \n data\n )\n )\n\n // adding the influence of current support vector\n output = output.add(currOutput);\n }\n\n return output.add(model.bias);\n }\n this.test = (testDataX) =>{\n // return the prediction\n\n\n\n // def predict_score(self, x):\n // return np.dot(self.alphas * self.sv_y, self._kernel(self.sv_x, x)) + self.b\n\n\n // const predScore = tf.dot(modelParams.legrangeMultipliers.mul(modelParams.supportVectors.y), modelParams.kernel(modelParams.supportVectors.x, testDataX).add(modelParams.bias))\n\n output = this.margin(testDataX);\n\n return output.greater(0).mul(2).sub(1);\n }\n\n\n\n}", "async function tf_main_sharded(){ \n const modelPath = argv.model;\n const outputPath = argv.output;\n const dcpify = argv.dcpify;\n\n let pkgInfo = outputPath.split('/');\n assert(pkgInfo.length < 3);\n let packageName = pkgInfo[0];\n let packageFile = pkgInfo[1];\n\n\n const modelArtifacts = await tfn.io.fileSystem(modelPath).load();\n\n modelArtifacts.weightData = abtostr(modelArtifacts.weightData);\n \n let modelSerial = JSON.stringify(modelArtifacts);\n let _atobSTRING = _atob.toString();\n let strtoabSTRING = strtoab.toString(); \n let lazyloaderSTRING = lazy_loader.toString();\n\n let outString =`let tf = require('@tensorflow/tfjs');\\n`;\n if (argv.dcpify){\n outString =`let tf = require('tfjs');\\n`; //on dcp, we get it by the filename 'tfjs'\n }\n\n outString += `\\n\\n` + lazyloaderSTRING + `\\n\\n`;\n\n let modelSerialShards = await shard(modelSerial);\n outString += `\\nlet dataPaths = [];\\n`;\n\n for (let ind=0; ind < modelSerialShards.length; ind++){\n console.log(\"Publishing shard \", ind+1);\n await publish_shard(ind+1, modelSerialShards[ind], outputPath);\n\n outString += `\\ndataPaths.push(\\`` + pkgInfo[0]+'_'+ (ind+1).toString() + '/data.js\\`);';\n }\n\n outString +=`\\n\\n\\n${_atobSTRING}\\n\\n`;\n outString +=`\\n${strtoabSTRING}\\n\\n`;\n outString +=`\nasync function getModel(){\n \n let modelSerial = '';\n await lazy_loader(dataPaths);\n for (let i=0; i<dataPaths.length;i++){\n modelSerial += require(dataPaths[i]).data;\n }\n\n\n let modelArtifacts = JSON.parse(modelSerial);\n const weightData = strtoab(modelArtifacts.weightData);\n modelArtifacts.weightData = weightData;\n\n var model;\n try{\n model = await tf.loadLayersModel( tf.io.fromMemory(modelArtifacts) );\n }catch(err1){\n try{\n model = await tf.loadGraphModel( tf.io.fromMemory(modelArtifacts) );\n }catch(err2){\n throw err1 + err2;\n };\n };\n return model;\n};\\n\\n`;\n\n outString +=`exports.getModel = getModel;\\n\\n`;\n \n outString = `//This module was created by the tfjs_util library from AITF\\nmodule.declare(['aistensorflow/tfjs'], function(require, exports, module) {\\n` + outString;\n outString+= `});//this concludes module definition\\n`;\n\n let tempFileName = require('crypto').randomBytes(64).toString('hex') + '.js';\n let tempFilePath = '/tmp/' + tempFileName;\n\n fs.writeFileSync(tempFilePath, outString);\n \n let pkg = {\n name: `${packageName}`,\n version: argv.packageVersion,\n files: {}\n };\n\n pkg.files[tempFilePath] = packageFile; \n\n await require('dcp/publish').publish(Object.assign({}, pkg));\n console.log(\"Module published at : \", pkg.name + '/' + pkg.files[tempFilePath]);\n fs.unlinkSync(tempFilePath); \n}", "function myMake(){\n\n\nlet rawdata1 = fs.readFileSync('tfjs-layer-0.txt', 'utf8'); \nlet rawdata2 = fs.readFileSync('tfjs-layer-1.txt', 'utf8'); \n//let layer01 = JSON.parse(rawdata1); \n\n\n\n\n\n\n\n\n\nvar myHTML = ` \n<script src=\"https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]\"> </script> \n\n \n\n<input id=\"myButton5858\" type=\"button\" value=\"Load pre-saved weights from textarea 10,000 batches\" onclick=\"{\n\n //const weightsJSON = JSON.parse(document.getElementById('myJsonArea').value)\n const startTime = performance.now();\n document.getElementById('myDiv5858').innerHTML = '<br>'\n document.getElementById('myButton5858').style.backgroundColor = 'red' \n \n async function myGo() {\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t \n model = tf.sequential();\n model.add(tf.layers.dense({ units: 3, name: 'hiddenLayer', activation: 'sigmoid' , inputShape: [2] }) ); \n model.add(tf.layers.dense({ units: 1, name: 'outputLayer', activation: 'sigmoid' }) ); \n\n\n \n // model.loadWeights(weightsJSON);\n \n \n // here we load all the layers\n \n let myLayerArray1 = document.getElementById('name1').value.split('!...!')\n let myLayerWeights1 = myLayerArray1[0].split(',') \n let myLayerBias1 = myLayerArray1[1].split(',') \n\n model.layers[0].setWeights([tf.tensor2d(myLayerWeights1, shape=[2,3]), tf.tensor1d(myLayerBias1)])\n \n \n let myLayerArray2 = document.getElementById('name2').value.split('!...!')\n let myLayerWeights2 = myLayerArray2[0].split(',') \n let myLayerBias2 = myLayerArray2[1].split(',') \n\n model.layers[1].setWeights([tf.tensor2d(myLayerWeights2, shape=[3,1]), tf.tensor1d(myLayerBias2)])\n \n \n \n \n // model.layers[0].setWeights(JSON.parse(document.getElementById('name1').value))\n // model.layers[1].setWeights(JSON.parse(document.getElementById('name2').value))\n \n // model.layers[0].setWeights(document.getElementById('name1').value)\n // model.layers[1].setWeights(document.getElementById('name2').value)\n \n // console.log(document.getElementById('name1').value)\n // model.layers[1].setWeights(document.getElementById('name2').value)\n \n \n \n\n const training_data2 = tf.tensor2d([[0,0],[0,1],[1,0],[1,1]]); // array defines shape\n const myPredictArray2 = await model.predict(training_data2).data()\n\n document.getElementById('myDiv5858').innerHTML += '[0,0] = ' + myPredictArray2[0].toFixed(4) +'<br>'\n document.getElementById('myDiv5858').innerHTML += '[1,0] = ' + myPredictArray2[1].toFixed(4) +'<br>'\n document.getElementById('myDiv5858').innerHTML += '[0,1] = ' + myPredictArray2[2].toFixed(4) +'<br>'\n document.getElementById('myDiv5858').innerHTML += '[1,1] = ' + myPredictArray2[3].toFixed(4) +'<br>'\n\n const endTime = performance.now();\n document.getElementById('myDiv5858').innerHTML += 'Duration ' + (endTime-startTime).toFixed(4) +'ms <br>'\t\t\t\t\t\t\t\t\t\t\t\t \n document.getElementById('myButton5858').style.backgroundColor = 'lightgrey' \n }\n\n setTimeout(function(){ myGo() }, 10); // wait a bit for the GUI to update\n\n}\"><br><br><br>\n\n<input type=button value=\"train\" onclick=\"{\n \n const myOptimizer = tf.train.sgd(0.5); \n model.compile({optimizer: myOptimizer, loss: 'meanSquaredError'}); \n \n const xTrainingData = tf.tensor2d([[0,0], [0,1], [1,0], [1,1]]); // array defines shape\n const yTrainingTarget = tf.tensor2d([0,1,1,0], shape=[4,1]); // needs shape defined\n \n \n \n (async function () { \n var myFit = await model.fit(xTrainingData, yTrainingTarget, {\n batchSize : 4,\n epochs : 400, \n callbacks: { \n onEpochEnd: async (epoch, logs) => { \n document.getElementById('myDiv123').innerHTML = 'Epoch # ' + (epoch+1) + '/400, Loss: ' + logs.loss + '<br><br>'\n\n } // end onEpochEnd callback \n } // end all callbacks \n }) // end model.fit \n \n \n const training_data2 = tf.tensor2d([[0,0],[0,1],[1,0],[1,1]]); // array defines shape\n const myPredictArray2 = await model.predict(training_data2).data()\n \n document.getElementById('myDiv5858').innerHTML += '[0,0] = ' + myPredictArray2[0].toFixed(4) +'<br>'\n document.getElementById('myDiv5858').innerHTML += '[1,0] = ' + myPredictArray2[1].toFixed(4) +'<br>'\n document.getElementById('myDiv5858').innerHTML += '[0,1] = ' + myPredictArray2[2].toFixed(4) +'<br>'\n document.getElementById('myDiv5858').innerHTML += '[1,1] = ' + myPredictArray2[3].toFixed(4) +'<br>' \n \n //document.getElementById('myWeightsToSend').value = JSON.stringify(model.layers[0].getWeights(), null, 4)\n // document.getElementById('myWeightsToSend').value = model.layers[0].getWeights()\n // document.getElementById('myWeightsToSend').value += model.layers[1].getWeights()\n \n \n // console.log(model.layers[0].getWeights()[0].dataSync())\n // console.log(model.layers[0].getWeights()[1].dataSync())\n // console.log(model.layers[1].getWeights()[0].dataSync())\n // console.log(model.layers[1].getWeights()[1].dataSync())\n\n \n document.getElementById('myWeightsToSend').value = \n model.layers[parseInt(document.getElementById('myLevel').value)].getWeights()[0].dataSync() + '!...!'+\n model.layers[parseInt(document.getElementById('myLevel').value)].getWeights()[1].dataSync() \n \n \n // for first layer\n // document.getElementById('myWeightsToSend').value = \n // model.layers[0].getWeights()[0].dataSync() + '!...!'+\n // model.layers[0].getWeights()[1].dataSync() \n \n \n // for second layer \n // document.getElementById('myWeightsToSend').value = \n // model.layers[1].getWeights()[0].dataSync() + '!...!'+\n // model.layers[1].getWeights()[1].dataSync() \n \n \n \n // document.getElementById('myWeightsToSend').value = new TextDecoder().decode(myDataView)\n //document.getElementById('myWeightsToSend').value = myDataView\n \n \n\n\n \n \n })() \n \n}\">\n\n<div id='myDiv123'>...</div><br>\n<div id='myDiv5858'>...</div><br>\n\n\n\n\n<h3>Read from file All json weights</h3>\n <label for=\"name\">Jason Weights:</label><br>\n \n\n <textarea id=\"name1\" name=\"name1\" rows=3 cols=130 placeholder=\"Enter the JSON Weights\" >`+\n rawdata1+\n `</textarea><br><br>\n <textarea id=\"name2\" name=\"name2\" rows=3 cols=130 placeholder=\"Enter the JSON Weights\" >`+\n rawdata2+\n `</textarea><br><br>\n<h3>Write to file a single set of json weights</h3>\n<form action=\"https://blank-node-rocksetta.c9users.io/myaction\" method=\"post\">\n <input type=\"submit\" value=\"Send Data\" /><br>\n <label for=\"name\">Jason Weights:</label><br>\n <textarea id=\"myWeightsToSend\" name=\"myWeightsToSend\" rows=3 cols=130 placeholder=\"Enter the JSON Weights\" ></textarea><br> \n Choose a layer to save, before training\n <select id=\"myLevel\" name=\"myLevel\">\n <option value=0>0\n <option value=1>1\n </select>\n Password (needs localstorage here) <input type=password id=\"myPass\" name=\"myPass\">\n <input type=\"submit\" value=\"Send Data\" />\n</form>\n\n\n\n\n\n\n\n\n\n\n\n\n`;\n\nreturn myHTML;\n\n\n}", "apply(x) {\n return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"])(() => {\n let regularization = Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"zeros\"])([1]);\n if (this.hasL1) {\n regularization = Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"add\"])(regularization, Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"sum\"])(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mul\"](this.l1, Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"abs\"])(x))));\n }\n if (this.hasL2) {\n regularization =\n Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"add\"])(regularization, Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"sum\"])(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mul\"](this.l2, _backend_tfjs_backend__WEBPACK_IMPORTED_MODULE_1__[\"square\"](x))));\n }\n return regularization.asScalar();\n });\n }", "function computeTF(articleConfourdance) {\n var words = [];\n //loop through the words in each article.\n Object.keys(articleConfourdance).forEach(function(key) {\n //name\n let term = key;\n //value\n let tf = articleConfourdance[key];\n \n //calculate df for the word with a function\n let df = computeDF(term);\n \n //adding those to the value object\n if (10===10) {\n let values = {\n //the word itself\n wordString : term,\n //the term freq\n tf : tf,\n //the document freq\n df : df,\n //the tfidf, which hasn't been calculated yet\n tfidf : 0\n };\n //add these words to the words array\n words.push(values);\n }\n });\n //add the whole article of words to the value array\n valueArray.push(words); \n}", "async function init(){\r\n\tawait webcam.setup();\r\n\tmobilenet = await loadMobilenet();\r\n\ttf.tidy(() => mobilenet.predict(webcam.capture()));\t\t\r\n}", "makeTrainFunction() {\n return (data) => {\n const lossValues = [];\n const inputs = data.slice(0, this.inputs.length);\n const targets = data.slice(this.inputs.length, this.inputs.length + this.outputs.length);\n const sampleWeights = data.slice(this.inputs.length + this.outputs.length, this.inputs.length + this.outputs.length * 2);\n const metricsValues = [];\n // Create a function that computes the total loss based on the\n // inputs. This function is used for obtaining gradients through\n // backprop.\n const totalLossFunction = () => {\n const feeds = [];\n for (let i = 0; i < this.inputs.length; ++i) {\n feeds.push({ key: this.inputs[i], value: inputs[i] });\n }\n const feedDict = new _executor__WEBPACK_IMPORTED_MODULE_15__[\"FeedDict\"](feeds);\n const outputs = Object(_executor__WEBPACK_IMPORTED_MODULE_15__[\"execute\"])(this.outputs, feedDict, { 'training': true });\n // TODO(cais): Take care of the case of multiple outputs from a\n // single layer?\n let totalLoss;\n for (let i = 0; i < this.lossFunctions.length; ++i) {\n const lossFunction = this.lossFunctions[i];\n let loss = lossFunction(targets[i], outputs[i]);\n if (sampleWeights[i] != null) {\n loss = Object(_training_utils__WEBPACK_IMPORTED_MODULE_18__[\"computeWeightedLoss\"])(loss, sampleWeights[i]);\n }\n // TODO(cais): push Scalar instead.\n const meanLoss = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mean\"](loss);\n // TODO(cais): Use a scope() instead, to avoid ownership.\n lossValues.push(meanLoss);\n if (i === 0) {\n totalLoss = loss;\n }\n else {\n totalLoss = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"add\"](totalLoss, loss);\n }\n }\n // Compute the metrics.\n // TODO(cais): These should probably be calculated outside\n // totalLossFunction to benefit speed?\n for (let i = 0; i < this.metricsTensors.length; ++i) {\n let weightedMetric;\n if (this.outputs.length > 1 && i < this.outputs.length) {\n weightedMetric = lossValues[i];\n }\n else {\n const metric = this.metricsTensors[i][0];\n const outputIndex = this.metricsTensors[i][1];\n weightedMetric =\n _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mean\"](metric(targets[outputIndex], outputs[outputIndex]));\n }\n _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"keep\"](weightedMetric);\n // TODO(cais): Use a scope() instead, to avoid ownership.\n metricsValues.push(weightedMetric);\n }\n totalLoss = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mean\"](totalLoss);\n // Add regularizer penalties.\n this.calculateLosses().forEach(regularizerLoss => {\n totalLoss = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"add\"](totalLoss, regularizerLoss);\n });\n return totalLoss;\n };\n const variables = this.collectedTrainableWeights.map(param => param.read());\n const returnCost = true;\n const totalLossValue = this.optimizer_.minimize(totalLossFunction, returnCost, variables);\n return [totalLossValue].concat(metricsValues);\n };\n }", "call(inputs, kwargs) {\n return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"])(() => {\n inputs = inputs;\n if (inputs.length !== 2) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_6__[\"ValueError\"](`SimpleRNNCell expects 2 input Tensors, got ${inputs.length}.`);\n }\n let prevOutput = inputs[1];\n inputs = inputs[0];\n const training = kwargs['training'] == null ? false : kwargs['training'];\n if (0 < this.dropout && this.dropout < 1 && this.dropoutMask == null) {\n this.dropoutMask = generateDropoutMask({\n ones: () => _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"onesLike\"](inputs),\n rate: this.dropout,\n training\n });\n }\n if (0 < this.recurrentDropout && this.recurrentDropout < 1 &&\n this.recurrentDropoutMask == null) {\n this.recurrentDropoutMask = generateDropoutMask({\n ones: () => _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"onesLike\"](prevOutput),\n rate: this.recurrentDropout,\n training\n });\n }\n let h;\n const dpMask = this.dropoutMask;\n const recDpMask = this.recurrentDropoutMask;\n if (dpMask != null) {\n h = _backend_tfjs_backend__WEBPACK_IMPORTED_MODULE_2__[\"dot\"](_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mul\"](inputs, dpMask), this.kernel.read());\n }\n else {\n h = _backend_tfjs_backend__WEBPACK_IMPORTED_MODULE_2__[\"dot\"](inputs, this.kernel.read());\n }\n if (this.bias != null) {\n h = _backend_tfjs_backend__WEBPACK_IMPORTED_MODULE_2__[\"biasAdd\"](h, this.bias.read());\n }\n if (recDpMask != null) {\n prevOutput = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mul\"](prevOutput, recDpMask);\n }\n let output = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"add\"](h, _backend_tfjs_backend__WEBPACK_IMPORTED_MODULE_2__[\"dot\"](prevOutput, this.recurrentKernel.read()));\n if (this.activation != null) {\n output = this.activation.apply(output);\n }\n // TODO(cais): Properly set learning phase on output tensor?\n return [output, output];\n });\n }", "function imgToTensor(img) {\n if (!img) { alert('imgToTensor: missing image'); }\n return tf.browser.fromPixels(img).toFloat().div(tf.scalar(255)).expandDims();\n}", "function tf(a){tf.Z.constructor.call(this,a);this.ae()}", "function dataToTensor(data) {\n\tlet inputData = [];\n\n\tfor (let i = 0; i < data.feature.length; i++) {\n\t\tinputData.push({\n\t\t\tx: data.feature[i],\n\t\t\ty: data.label[i],\n\t\t});\n\t}\n\n\treturn tf.tidy(() => {\n\t\t// shuffle data\n\t\ttf.util.shuffle(inputData);\n\n\t\t// convert data to tensors\n\t\tconst features = inputData.map((d) => d.x);\n\t\tconst labels = inputData.map((d) => d.y);\n\t\tconst featureTensor = tf.tensor2d(features);\n\t\tconst labelTensor = tf.tensor1d(labels);\n\n\t\treturn {\n\t\t\tinputs: featureTensor,\n\t\t\tlabels: labelTensor,\n\t\t};\n\t});\n}", "async function predict(){\n var randomness = randomnessElem.value;\n var new_character;\n var token_wordstart = coder_specs[models.active].start_token + wordStartElem.value\n for (var k=0; k<coder_specs[models.active].max_word_size - wordStartElem.value.length; k++){\n var input_tensor = tf.tensor(encode(token_wordstart));\n var output_tensor = await models[models.active].predict(input_tensor);\n var output_ar = await output_tensor.array();\n new_character = decodeCharacter(output_ar[0][token_wordstart.length-1], randomness);\n if (new_character==coder_specs[models.active].end_token){\n break;\n }\n else{\n token_wordstart=token_wordstart+new_character\n }\n }\n console.log(token_wordstart.substring(1))\n outputElem.innerHTML = token_wordstart[1].toUpperCase() + token_wordstart.substring(2)\n}", "async function run() {\n // Create a sequential model (outputs of one layer are the inputs to the next layer)\n const model = tf.sequential();\n model.add(tf.layers.dense({units: 1, inputShape: [1]}));\n\n // Prepare the model for training, specifying the loss and optimizer functions\n model.compile({loss: 'meanSquaredError', optimizer: 'sgd'});\n\n // Create synthetic training data (y = 2x - 1)\n const xs = tf.tensor2d([-1, 0, 1, 2, 3, 4], [6, 1]);\n const ys = tf.tensor2d([-3, -1, 1, 3, 5, 7], [6, 1]);\n\n // Train the model\n await model.fit(xs, ys, {epochs: 250});\n\n function foo(x) {\n return x;\n }\n\n // Predict outputs for training inputs\n trainingInputs = [-1, 0, 1, 2, 3, 4];\n const trainingOutputs = trainingInputs.map(input =>\n model.predict(tf.tensor2d([input], [1, 1]))\n );\n\n // Predict outputs for a set of test inputs\n const testInputs = [3, 14, 25, 43, 56, 72];\n const testOutputs = testInputs.map(input =>\n model.predict(tf.tensor2d([input], [1, 1]))\n );\n\n // Display training data in tabular format\n var trainingDataTabular = [['x', 'y']];\n for (var i = 0; i < Math.min(xs.size, ys.size); i++) {\n trainingDataTabular.push([xs.get(i, 0), ys.get(i, 0)]);\n }\n console.log('========================================');\n console.log('Training Data');\n console.log('========================================');\n console.log(table(trainingDataTabular));\n // Display training prediction results in tabular format\n var trainingInferencingResultsTabular = [['x', 'y inferenced', 'y calculated']];\n for (var i = 0; i < Math.min(trainingInputs.length, trainingOutputs.length); i++) {\n trainingInferencingResultsTabular.push([\n trainingInputs[i],\n trainingOutputs[i].dataSync(),\n 2 * trainingInputs[i] - 1\n ]);\n }\n console.log('========================================');\n console.log('Prediction Results on Training Data');\n console.log('========================================');\n console.log(table(trainingInferencingResultsTabular));\n // Display prediction results in tabular format\n var testInferencingResultsTabular = [['x', 'y inferenced', 'y calculated']];\n for (var i = 0; i < Math.min(testInputs.length, testOutputs.length); i++) {\n testInferencingResultsTabular.push([\n testInputs[i],\n testOutputs[i].dataSync(),\n 2 * testInputs[i] - 1\n ]);\n }\n console.log('========================================');\n console.log('Prediction Results on Test Data');\n console.log('========================================');\n console.log(table(testInferencingResultsTabular));\n}", "function generateData() {\n let inputs = [];\n let outputs = [];\n\n for (let i = 0; i < 10000; i++) {\n let tempIn = [];\n let tempOut = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n\n for (let j = 0; j < 10; j++) {\n tempIn.push(Math.random());\n }\n\n tempOut[maxIndex(tempIn)] = 1;\n\n inputs.push(tempIn);\n outputs.push(tempOut);\n }\n\n let testInputs = [];\n let testOutputs = [];\n\n for (let i = 0; i < 1000; i++) {\n let tempIn = [];\n let tempOut = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n\n for (let j = 0; j < 10; j++) {\n tempIn.push(Math.random());\n }\n\n tempOut[maxIndex(tempIn)] = 1;\n\n testInputs.push(tempIn);\n testOutputs.push(tempOut);\n }\n\n const input = tf.tensor2d(inputs);\n const output = tf.tensor2d(outputs);\n const testInput = tf.tensor2d(inputs);\n const testOutput = tf.tensor2d(outputs);\n\n return { \n train: {\n input: input, \n output: output\n },\n test: {\n input: testInput,\n output: testOutput\n }\n };\n}", "processFeatures(features) {\n //step 1: Constructor to make \"features\" into tensors\n features = tf.tensor(features);\n //step 2: Standardization \n /* not first time */\n if (this.mean && this.variance) {\n features = features.sub(this.mean).div(this.variance.pow(0.5))\n } else {\n /* first time only */\n features = this.standardize(features)\n }\n //step 3: Append a column of 1's to the \"features\" tensor\n features = tf.ones([features.shape[0], 1]).concat(features, 1)\n return features\n }", "constructor() {\n const ops = [\n _op_list_arithmetic__WEBPACK_IMPORTED_MODULE_4__, _op_list_basic_math__WEBPACK_IMPORTED_MODULE_5__, _op_list_control__WEBPACK_IMPORTED_MODULE_6__, _op_list_convolution__WEBPACK_IMPORTED_MODULE_7__, _op_list_creation__WEBPACK_IMPORTED_MODULE_8__, _op_list_dynamic__WEBPACK_IMPORTED_MODULE_9__,\n _op_list_evaluation__WEBPACK_IMPORTED_MODULE_10__, _op_list_logical__WEBPACK_IMPORTED_MODULE_14__, _op_list_image__WEBPACK_IMPORTED_MODULE_13__, _op_list_graph__WEBPACK_IMPORTED_MODULE_11__, _op_list_matrices__WEBPACK_IMPORTED_MODULE_15__, _op_list_normalization__WEBPACK_IMPORTED_MODULE_16__, _op_list_reduction__WEBPACK_IMPORTED_MODULE_17__,\n _op_list_slice_join__WEBPACK_IMPORTED_MODULE_18__, _op_list_spectral__WEBPACK_IMPORTED_MODULE_19__, _op_list_transformation__WEBPACK_IMPORTED_MODULE_20__, _op_list_hash_table__WEBPACK_IMPORTED_MODULE_12__\n ];\n const mappersJson = [].concat(...ops.map(op => op.json));\n this.opMappers = mappersJson.reduce((map, mapper) => {\n map[mapper.tfOpName] = mapper;\n return map;\n }, {});\n }", "function tf(b,d){this.Hi=[];this.Bp=b;this.Fo=d||null;this.ug=this.le=!1;this.qd=void 0;this.rl=this.Ss=this.lk=!1;this.Si=0;this.oc=null;this.nk=0}", "predict(rawImage) {\n const out = ms.tf.tidy(() => {\n const x = ms.tf.tensor4d(rawImage, [1, 64, 64, 1]);\n let h = ms.tf.conv2d(x, this.conv1Kernel, 2, 'valid');\n h = ms.tf.add(h, this.conv1Bias);\n h = ms.tf.relu(h);\n\n h = ms.tf.conv2d(h, this.conv2Kernel, 2, 'valid');\n h = ms.tf.add(h, this.conv2Bias);\n h = ms.tf.relu(h);\n\n h = ms.tf.conv2d(h, this.conv3Kernel, 2, 'valid');\n h = ms.tf.add(h, this.conv3Bias);\n h = ms.tf.relu(h);\n\n h = ms.tf.conv2d(h, this.conv4Kernel, 2, 'valid');\n h = ms.tf.add(h, this.conv4Bias);\n h = ms.tf.relu(h);\n\n const final = ms.tf.reshape(h, [1, 2*2*256]);\n const logits = ms.tf.add(ms.tf.matMul(final, this.outputKernel),\n this.outputBias).squeeze();\n\n return ms.tf.softmax(logits);\n\n });\n const probVector = new Float32Array(out.dataSync());\n out.dispose();\n return probVector;\n }", "makeTensor(values, shape, dtype, backend) {\n if (values == null) {\n throw new Error('Values passed to engine.makeTensor() are null');\n }\n dtype = dtype || 'float32';\n backend = backend || this.backend;\n let backendVals = values;\n if (dtype === 'string' && _util__WEBPACK_IMPORTED_MODULE_9__[\"isString\"](values[0])) {\n backendVals = values.map(d => _util__WEBPACK_IMPORTED_MODULE_9__[\"encodeString\"](d));\n }\n const dataId = backend.write(backendVals, shape, dtype);\n const t = new _tensor__WEBPACK_IMPORTED_MODULE_7__[\"Tensor\"](shape, dtype, dataId, this.nextTensorId());\n this.trackTensor(t, backend);\n // Count bytes for string tensors.\n if (dtype === 'string') {\n const info = this.state.tensorInfo.get(dataId);\n const newBytes = Object(_util__WEBPACK_IMPORTED_MODULE_9__[\"bytesFromStringArray\"])(backendVals);\n this.state.numBytes += newBytes - info.bytes;\n info.bytes = newBytes;\n }\n return t;\n }", "function readFiles(evt) {\n let label = 0;\n let target = evt.target.id;\n //decide the label of the selected images based on the file chooser\n if(target == \"college_female\") {\n label = 0;\n } else if(target == \"college_male\") {\n label = 1;\n } else if(target == \"sh_female\") {\n label = 2;\n } else if(target == \"sh_male\") {\n label = 3;\n } else if(target == \"unknown\") {\n label = 2;\n }\n\n //read multiple images\n var files = evt.target.files;\n\n for(let i = 0; i < files.length; i++) {\n setTimeout(()=>{\n let img = new Image();\n\n let fr = new FileReader();\n fr.onload = function () {\n img.src = fr.result;\n //set image size to 224 x 224 to match input tensor to mobilenet\n img.width = 224;\n img.height = 224;\n }\n\n //TODO this must be synchronous\n img.onload = function() {\n tf.tidy(()=> {\n //convert to tensor\n const tf_img = cropImage(tf.fromPixels(img));\n const tf_img_batched = tf_img.expandDims(0);\n const tf_final_img_batched = tf_img_batched.toFloat().div(tf.scalar(127)).sub(tf.scalar(1));\n\n addTrainingImage(mobilenet.predict(tf_final_img_batched), label);\n });\n };\n\n fr.readAsDataURL(files[i]);\n }, 500);\n }\n}", "makeTensorInfo(shape, dtype, values) {\n let outId;\n if (dtype === 'string' && values != null && values.length > 0 &&\n _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].isString(values[0])) {\n const encodedValues = values.map(d => _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].encodeString(d));\n outId = this.write(encodedValues, shape, dtype);\n }\n else {\n outId = this.write(values, shape, dtype);\n }\n return { dataId: outId, shape, dtype };\n }", "function TfLoader( model, config ) {\n\n\t// \"TfLoader\" inherits from abstract Loader \"Loader\".\n\n\tLoader.call( this, model, config );\n\n\t/**\n\t * tensorflow model's url (.pb file's url).\n\t * Important parameter for TfLoader to get tensorflow model.\n\t *\n\t * @type { url }\n\t */\n\n\tthis.modelUrl = undefined;\n\n\t/**\n\t * tensorflow weight's url (.json file's url).\n\t * Important parameter for TfLoader to get tensorflow model.\n\t *\n\t * @type { url }\n\t */\n\n\tthis.weightUrl = undefined;\n\n\t/**\n\t * User's predefined outputsName list.\n\t * If set, TfLoader will set this name list to TfPredictor.\n\t *\n\t * @type { Array }\n\t */\n\n\tthis.outputsName = undefined;\n\n\t// Load TfLoader's configuration.\n\n\tthis.loadTfConfig( config );\n\n\tthis.loaderType = \"TfLoader\";\n\n}", "async function initialize() {\r\n let status = document.querySelector('.init_status')\r\n status.innerHTML = 'Loading Model .... <span class=\"fa fa-spinner fa-spin\"></span>'\r\n model = await tf.loadLayersModel('../tfjs_target_/model.json');\r\n console.log(model);\r\n status.innerHTML = 'Model Loaded Successfully <span class=\"fa fa-check\"></span>'\r\n }", "function getModel(){\n const model=tf.sequential();\n\n//Each image is 28x28 in size and have 1 color channel as a grayscale image.\n const IMAGE_WIDTH=28;\n const IMAGE_HEIGHT=28;\n const IMAGE_CHANNELS=1;\n\n//here we are adding conv2d layer instead of fully connected layers\n//kernels are small input matrix used in cnn to extract features,which refers to the width height of the filter mask\n//filter size refers to the dimension of the filter in cnn\n//strides define the number of pixels shift over the input matrix.\n//kernel initializing method is for randomly initializing the model weights\nmodel.add(tf.layers.conv2d({\n inputShape: [IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_CHANNELS],\n kernelSize: 5,\n filters: 8,\n strides: 1,\n activation: 'relu',\n kernelInitializer: 'varianceScaling'\n }));\n/*Usually pooling will be used to remove the negative values\n*maxpooling will reduce the amount of computations\n*will sent only important data to the next layer\n*takes only larger value pixels among all pixels*/\n\nmodel.add(tf.layers.maxPooling2d({poolSize: [2, 2], strides: [2, 2]}))\n\n//we are adding more filters because cnn wil have number of filters\n\nmodel.add(tf.layers.conv2d({\n kernelSize: 5,\n filters: 16,\n strides: 1,\n activation: 'relu',\n kernelInitializer: 'varianceScaling'\n }));\n model.add(tf.layers.maxPooling2d({poolSize: [2, 2], strides: [2, 2]}));\n//flatten layer converts 2d image to 1d\n model.add(tf.layers.flatten());\n const NUM_OUTPUT_CLASSES = 10;\n model.add(tf.layers.dense({\n units: NUM_OUTPUT_CLASSES,\n kernelInitializer: 'varianceScaling',\n activation: 'softmax'\n }));\n const optimizer = tf.train.adam();\n model.compile({\n optimizer: optimizer,\n\n//Categoricalcrossentropy loss is used because here we are using 10 classes\n loss: 'categoricalCrossentropy',\n metrics: ['accuracy'],\n });\n\n return model;\n\n\n}", "apply(x) {\n return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"])(() => _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mul\"](x, _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tanh\"](_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"softplus\"](x))));\n }", "async function load_tf_model() {\n const m = await tf.loadLayersModel('https://pedagogy-ai.github.io/model_js/model.json');\n console.log(\"tf_loading\");\n\n return m;\n}", "function convert(tfs, precision, tfPrecision) {\n\n\tconst tf = tfs.length>1 ? transformsMultiply(tfs) : tfs[0];\n\n\tconst decomposed = matrixToTransform(tf);\n\n\tconst tfs2 = stringifyTransform(decomposed, precision, tfPrecision).length<=stringifyTransform([tf], precision, tfPrecision).length ? decomposed : [tf];\n\n\treturn removeUseless(tfs2, precision);\n}", "constructor(shapes) {\n this.outputShape = [];\n this.outputShape = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].computeOutShape(shapes, 1 /* axis */);\n this.variableNames = shapes.map((_, i) => `T${i}`);\n const offsets = new Array(shapes.length - 1);\n offsets[0] = shapes[0][1];\n for (let i = 1; i < offsets.length; i++) {\n offsets[i] = offsets[i - 1] + shapes[i][1];\n }\n const snippets = [`if (yC < ${offsets[0]}) setOutput(getT0(yR, yC));`];\n for (let i = 1; i < offsets.length; i++) {\n const shift = offsets[i - 1];\n snippets.push(`else if (yC < ${offsets[i]}) ` +\n `setOutput(getT${i}(yR, yC-${shift}));`);\n }\n const lastIndex = offsets.length;\n const lastShift = offsets[offsets.length - 1];\n snippets.push(`else setOutput(getT${lastIndex}(yR, yC-${lastShift}));`);\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n ${snippets.join('\\n ')}\n }\n `;\n }", "function preprocess(data){\n\treturn tf.tidy(() =>{\n\t\t// step 1 - shuffle the data\n\t\ttf.util.shuffle(data);\n\t\t\n\t\t// step 2 - converting data to tensors\n\t\tconst x = data.map(d=>d.hp)\n\t\tconst y = data.map(d=>d.mpg)\n\t\t\n\t\tconst xtensor = tf.tensor2d(x, [x.length,1]);\n\t\tconst ytensor = tf.tensor2d(y, [y.length,1]);\n\t\t\n\t\t// step3 - data normalizing using MinMaxscaling\n\t\t\n\t\tconst xmin = xtensor.min();\n\t\tconst xmax = xtensor.max();\n\t\tconst ymin = ytensor.min();\n\t\tconst ymax = ytensor.max();\n\t\t\n\t\tconst xnorm = xtensor.sub(xmin).div(xmax.sub(xmin));\n\t\tconst ynorm = ytensor.sub(ymin).div(ymax.sub(ymin));\n\t\t\n\t\treturn {\n\t\t\tinputs:xnorm,\n\t\t\toutputs:ynorm,\n\t\t\txmin,xmax,ymin,ymax,\n\t\t}\n\t\t});\n}", "function getTermWeight(term, tfIdfDocument)\n{\n for(var i = 0; i < tfIdfDocument.terms.length; i++)\n {\n var tfIdfTerm = tfIdfDocument.terms[i];\n if(tfIdfTerm.term == term)\n {\n return tfIdfTerm.tfIdf;\n }\n else\n {\n continue;\n }\n }\n return 0.0;\n}", "function op(f) {\n const keys = Object.keys(f);\n if (keys.length !== 1) {\n throw new Error(`Please provide an object with a single key ` +\n `(operation name) mapping to a function. Got an object with ` +\n `${keys.length} keys.`);\n }\n let opName = keys[0];\n const fn = f[opName];\n // Strip the underscore from the end of the function name.\n if (opName.endsWith('_')) {\n opName = opName.substring(0, opName.length - 1);\n }\n // add an __op suffix to distinguish ops from kernels in tf.profile\n opName = opName + OP_SCOPE_SUFFIX;\n // tslint:disable-next-line:no-any\n const f2 = (...args) => {\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"ENGINE\"].startScope(opName);\n try {\n const result = fn(...args);\n if (Object(_util__WEBPACK_IMPORTED_MODULE_1__[\"isPromise\"])(result)) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"ENGINE\"].endScope(result);\n return result;\n }\n catch (ex) {\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"ENGINE\"].endScope(null);\n throw ex;\n }\n };\n Object.defineProperty(f2, 'name', { value: opName, configurable: true });\n // tslint:disable-next-line:no-any\n return f2;\n}", "updateGameState(currentBoard, currentPlayerPosition) {\n /**\n * if using mladventures-v0, create tensorArray for prediction like so:\n * const tensorArray = [].concat.apply([], currentBoard);\n * tensorArray.push(currentPlayerPosition);\n * if using mladventures-nextrowonly, create tensorArray for prediction like so:\n * const tensorArray = [...currentBoard[1]];\n * tensorArray.push(currentPlayerPosition);\n */\n tf.tidy(() => {\n //in ML model make prediction here - probably needs await\n console.log(currentBoard);\n // set to this.nextAction for consistency\n // flatten board to one array and add player position\n\n // const tensorArray = [].concat.apply([], currentBoard);\n\n //board is 10x10 - get 5x5 to pass in tensor array\n const tensorArray = [].concat.apply([],this._createMiniBoard(currentBoard, currentPlayerPosition));\n\n // console.log(tensorArray);\n tensorArray.push(currentPlayerPosition);\n // console.log(tensorArray);\n // console.log('hi ', tensorArray);\n\n const logits = this.model.predict(tf.tensor2d([tensorArray]));\n const leftProb = tf.sigmoid(logits);\n // const leftRightProbs = tf.concat([leftProb, tf.sub(1, leftProb)], 1);\n // const actions = tf.randomNormal([2, 2]);//tf.multinomial(leftRightProbs, 1, null, true);\n // console.log(`leftprob: `, leftProb);\n // console.log(`lrprob: `, leftRightProbs);\n console.log(logits.dataSync());\n console.log('left prob: ',leftProb.dataSync());\n // console.log(`leftright: `, leftRightProbs.dataSync());\n if (leftProb.dataSync()[0] <= 0) {\n this.nextAction = 'left';\n } else {\n this.nextAction = 'right';\n }\n // else {\n // this.nextAction = 'none';\n // }\n\n // if (action > 0) {\n // this.playerPosition = this.moveRight(this.playerPosition);\n // } else {\n // this.playerPosition = this.moveLeft(this.playerPosition);\n // } \n }); \n }", "function WCVTF(state) {\n const stack = state.stack;\n const v = stack.pop();\n const l = stack.pop();\n\n if (exports.DEBUG) console.log(state.step, 'WCVTF[]', v, l);\n\n state.cvt[l] = v * state.ppem / state.font.unitsPerEm;\n}", "function training_selector(ft_array)\n{ \n var index;\n var merge_ft = ft_array[0];\n for (index = 1; index < ft_array.length; index++) \n {\n merge_ft = merge_ft.merge(ft_array[index]);\n }\n \n return merge_ft;\n}", "mutate(m) {\n if (m != 0) {\n // console.log(\"mutating\");\n // this.model.layers[0].getWeights()[0].print();\n\n //super big thanks to Shanqing Cai for help with weights and bias:\n //https://groups.google.com/a/tensorflow.org/forum/#!topic/tfjs/ORkUHg_k_fU\n tf.tidy(() => {\n //get weights and biases as tensor\n const ih_weights = this.model.layers[0].getWeights()[0]; //tensor shape 2 [5,8]\n const ho_weights = this.model.layers[1].getWeights()[0]; //tensor shape 2 [8,2]\n const h_bias = this.model.layers[0].getWeights()[1]; //tensor shape [8]\n const o_bias = this.model.layers[1].getWeights()[1]; //tensor shape [2]\n\n //mutate by adding scalar to each tensor\n // const mutationTensor = tf.scalar(mutationScalar); //needs to be number\n //have to do weird 1d tensor because can't make tf.scalar with a variable ***\n\n //mutate ih_weights and h_bias\n let hidden_array = [];\n for (let i = 0; i < this.hidden_nodes; i++) {\n hidden_array.push(m);\n }\n const hidden_mutationTensor = tf.tensor1d(hidden_array);\n const ih_w_mutated = ih_weights.add(hidden_mutationTensor);\n const h_b_mutated = h_bias.add(hidden_mutationTensor);\n //mutate ho_weights and o_bias;\n let output_array = [];\n for (let i = 0; i < this.output_nodes; i++) {\n output_array.push(m);\n }\n const output_mutationTensor = tf.tensor1d(output_array);\n const ho_w_mutated = ho_weights.add(output_mutationTensor);\n const o_b_mutated = o_bias.add(output_mutationTensor);\n //\n // console.log('weights');\n // ih_weights.print();\n // ih_w_mutated.print();\n // console.log('bias');\n // h_bias.print();\n // h_b_mutated.print();\n\n //now set the weights and bias of layers\n this.model.layers[0].setWeights([ih_w_mutated, h_b_mutated]);\n this.model.layers[1].setWeights([ho_w_mutated, o_b_mutated]);\n\n // console.log('done mutating');\n // this.model.layers[0].getWeights()[0].print();\n\n });\n }\n // else {\n // console.log('not mutating');\n // }\n\n }", "function convertToTensor(data) {\n // Wrapping these calculations in a tidy will dispose any \n // intermediate tensors.\n \n return tf.tidy(() => {\n // Step 1. Shuffle the data \n tf.util.shuffle(data);\n\n // Step 2. Convert data to Tensor 2d tensor/2d object\n const inputs = data.map(d => d.Displacement)\n const labels = data.map(d => d.mpg);\n\n const inputTensor = tf.tensor2d(inputs, [inputs.length, 1]);\n const labelTensor = tf.tensor2d(labels, [labels.length, 1]);\n\n //Step 3. Normalize the data to the range 0 - 1 using min-max scaling\n /*\n Here we normalize the data into the numerical range 0-1 using min-max scaling. Normalization is important because the internals of many machine learning models you will build with tensorflow.js are designed to work with numbers that are not too big. Common ranges to normalize data to include 0 to 1 or -1 to 1. You will have more success training your models if you get into the habit of normalizing your data to some reasonable range.\n */\n const inputMax = inputTensor.max();\n const inputMin = inputTensor.min(); \n const labelMax = labelTensor.max();\n const labelMin = labelTensor.min();\n\n const normalizedInputs = inputTensor.sub(inputMin).div(inputMax.sub(inputMin));\n const normalizedLabels = labelTensor.sub(labelMin).div(labelMax.sub(labelMin));\n\n return {\n inputs: normalizedInputs,\n labels: normalizedLabels,\n // Return the min/max bounds so we can use them later. (used to un normalize output)\n inputMax,\n inputMin,\n labelMax,\n labelMin,\n }\n }); \n}", "function loadGLTF(gltfName, modelName){\n const gltfLoader = new GLTFLoader();\n gltfLoader.load(gltfName, (gltf) => {\n/*\t\t\t//???\n\t\t\tgltf.scene.traverse( function \t( child ) {\n\t\t\t\t\t\t\t\tif ( child.isMesh ) {\n\t\t\t\t\t\t\t\t\troughnessMipmapper.generateMipmaps( child.material );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n*/\t\t\t\t\t\t\t\n\t\tlet root=gltf.scene;\n \tconsole.log(root.name);\n \t//console.log(dumpObject(root).join('\\n'));\n \t//console.log(dumpObject(scene).join('\\n'));\n \tscene.add(gltf.scene); //TODO 20210710: seem repeat what is coming?? \n\n\t\t//let modelObj = scene.getObjectByName(\"asian_female_teen\", true);\n\t\tmodelObj = scene.getObjectByName(modelName, true);\n\t\tjlObjs.add(modelObj);\n\n\t // compute the box that contains all the stuff\n\t // from root and below\n\t const box = new THREE.Box3().setFromObject(root);\n\t\n\t const boxSize = box.getSize(new THREE.Vector3()).length();\n\t const boxCenter = box.getCenter(new THREE.Vector3());\n\t\n\t // set the camera to frame the box\n\t frameArea(boxSize * 0.5, boxSize, boxCenter, camera);\n\n initModelCtrl(); //leave it here for now, because I don't know how to synchronously load model\n\t // update the Trackball controls to handle the new size\n orbitCtrl.maxDistance = boxSize * 10;\n\t orbitCtrl.target.copy(boxCenter);\n\t orbitCtrl.update();\n });\n //2021.06.10: becaue I disabled animation...\n render(e=>{d=new Date();return d.getTime();});\n}", "function WCVTF(state) {\n var stack = state.stack;\n var v = stack.pop();\n var l = stack.pop();\n\n if (DEBUG) console.log(state.step, 'WCVTF[]', v, l);\n\n state.cvt[l] = v * state.ppem / state.font.unitsPerEm;\n}", "function generateCaseInputs(totalSizeTensor, totalSizeFilter) {\n var inp = new Array(totalSizeTensor);\n var filt = new Array(totalSizeFilter);\n for (var i = 0; i < totalSizeTensor; i++) {\n inp[i] = (i + 1) / totalSizeTensor;\n }\n for (var i = 0; i < totalSizeFilter; i++) {\n filt[i] = (i + 1) / totalSizeFilter;\n }\n return { input: inp, filter: filt };\n}", "testLoop(f, ins, batchSize, verbose = 0, steps) {\n return _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"](() => {\n const numSamples = this.checkNumSamples(ins, batchSize, steps, 'steps');\n const outs = [];\n if (verbose > 0) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_3__[\"NotImplementedError\"]('Verbose mode is not implemented yet.');\n }\n // TODO(cais): Use `indicesForConversionToDense' to prevent slow down.\n if (steps != null) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_3__[\"NotImplementedError\"]('steps mode in testLoop() is not implemented yet');\n }\n else {\n const batches = Object(_training_tensors__WEBPACK_IMPORTED_MODULE_17__[\"makeBatches\"])(numSamples, batchSize);\n const indexArray = Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tensor1d\"])(Object(_utils_math_utils__WEBPACK_IMPORTED_MODULE_11__[\"range\"])(0, numSamples));\n for (let batchIndex = 0; batchIndex < batches.length; ++batchIndex) {\n const batchStart = batches[batchIndex][0];\n const batchEnd = batches[batchIndex][1];\n const batchIds = _backend_tfjs_backend__WEBPACK_IMPORTED_MODULE_1__[\"sliceAlongFirstAxis\"](indexArray, batchStart, batchEnd - batchStart);\n // TODO(cais): In ins, train flag can be a number, instead of an\n // Tensor? Do we need to handle this in tfjs-layers?\n const insBatch = Object(_training_tensors__WEBPACK_IMPORTED_MODULE_17__[\"sliceArraysByIndices\"])(ins, batchIds);\n const batchOuts = f(insBatch);\n if (batchIndex === 0) {\n for (let i = 0; i < batchOuts.length; ++i) {\n outs.push(Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"scalar\"])(0));\n }\n }\n for (let i = 0; i < batchOuts.length; ++i) {\n const batchOut = batchOuts[i];\n outs[i] =\n _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"add\"](outs[i], _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"mul\"](batchEnd - batchStart, batchOut));\n }\n }\n for (let i = 0; i < outs.length; ++i) {\n outs[i] = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"div\"](outs[i], numSamples);\n }\n }\n return outs;\n });\n }", "function WCVTF(state) {\n var stack = state.stack;\n var v = stack.pop();\n var l = stack.pop();\n\n if (exports.DEBUG) {\n console.log(state.step, 'WCVTF[]', v, l);\n }\n\n state.cvt[l] = v * state.ppem / state.font.unitsPerEm;\n }", "async function trainSkillGroupTensor(model, skillGroupList, avarageSkillGroupLevels, userToSkillGroupLevel, userList){\n // Learning rate 0.1\n const optimize = tf.train.sgd(0.1);\n \n model.compile({\n loss: 'meanSquaredError',\n optimizer: optimize\n });\n \n const avarageSkillGroupLevelPerUser = tf.tensor(userList.reduce((map, user) => {\n if(avarageSkillGroupLevels[user._id]){\n map.push(skillGroupList.reduce((map, skillGroup) => {\n if(avarageSkillGroupLevels[user._id][skillGroup._id] && featureArray.includes(skillGroup.name)){\n map.push(avarageSkillGroupLevels[user._id][skillGroup._id].level);\n return map;\n } else if(featureArray.includes(skillGroup.name)) {\n map.push(0);\n return map;\n }\n return map;\n }, []));\n }\n return map;\n }, [])\n );\n \n const skillGroupPercentagePerUser = tf.tensor(userList.reduce((map, user) => {\n if(userToSkillGroupLevel[user._id]){\n map.push(skillGroupList.reduce((map, skillGroup) => {\n if(featureArray.includes(skillGroup.name)){\n map.push(userToSkillGroupLevel[user._id][skillGroup._id].skillGroupLevel);\n return map;\n }\n return map\n }, []));\n }\n return map;\n }, [])\n );\n \n await model.fit(avarageSkillGroupLevelPerUser, skillGroupPercentagePerUser, {epochs: 500});\n\n //console.log(\"Model trained\");\n return \"Model trained\";\n}", "function gen_op_iwmmxt_stl_kernel()\n{\n gen_opc_ptr.push({func:op_iwmmxt_stl_kernel});\n}", "async function prepData(input){\n\n //fix so that don't have to re-access data within every function\n //const irisOriginalFile = await fetch('https://episphere.github.io/ai/data/iris.json'); \n //const irisFile = await irisOriginalFile.json() \n\n return tf.tidy(\n () => { \n tf.util.shuffle(input)\n\n //convert data to tensors\n const inputData = tf.tensor2d(input.map(flower => [flower.sepal_length, \n flower.sepal_width, flower.petal_length, flower.petal_width]),[130,4])\n console.log(\"tensors\" + inputData) //data format incorrect (\"NaN\")\n\n const outputData = tf.tensor2d(input.map(flower => flower.species), [130,1])\n }) \n }", "async testAccuracy() {\n if (this.mnistdata === undefined) {\n this.mnistdata = new MnistData();\n const success = await this.mnistdata.load(6);\n }\n const TEST_DATA_SIZE = 2000;\n\n const [testXs, testYs] = tf.tidy(() => {\n const d = this.mnistdata.getTestBatch(TEST_DATA_SIZE);\n return [\n d.xs.reshape([TEST_DATA_SIZE, 28, 28, 1]),\n d.labels\n ];\n });\n\n const result = this.model.evaluate(testXs, testYs);\n console.log('Done evaluation');\n console.log(this.model.metricsNames);\n console.log(result.forEach(r => r.print()));\n }", "resetStates() {\n Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"])(() => {\n this.layers.forEach(layer => {\n // tslint:disable:no-any\n if (layer.stateful) {\n layer.resetStates();\n }\n // tslint:enable:no-any\n });\n });\n }", "print_glTF() {\r\n console.log(this.glTF);\r\n\r\n console.log(\r\n `glTF file \\n` +\r\n `- Version ${this.glTF.version}\\n` +\r\n `- Default scene name: ${this.defaultScene.name}\\n` +\r\n `- ${this.glTF.scenes.length} scene(s)\\n` +\r\n `- ${this.glTF.images.length} image(s)\\n` +\r\n `- ${this.glTF.materials.length} material(s)\\n` +\r\n `- ${this.glTF.meshes.length} meshe(s)\\n` +\r\n `- ${this.glTF.nodes.length} node(s)\\n` +\r\n `- ${this.glTF.bufferViews.length} buffer view(s)\\n` +\r\n `- ${this.glTF.textures.length} texture(s)\\n`\r\n );\r\n }", "function convertToTensor(data) {\n return tf.tidy(() => {\n //step 1: shuffle data\n //Always shuffle the data. It's important to the final result\n tf.util.shuffle(data);\n\n //2 Convert data to Tensor\n // Converting to a 2d tensor. Tensor shape: [num_examples, num_features_per_example].\n // Here we have: inputs.length examples and each example has 1 input feature (horsepower)\n const inputs = data.map(d => d.horsepower);\n const labels = data.map(d => d.mpg);\n\n const inputTensor = tf.tensor2d(inputs, [inputs.length, 1]);\n const labelTensor = tf.tensor2d(labels, [labels.length, 1]);\n console.log('tensor input', inputTensor)\n\n //3 Normalize the data to the range of 0 - 1 using min-max scaling\n //Normalize data is a best practice\n const inputMax = inputTensor.max();\n const inputMin = inputTensor.min();\n const labelMax = labelTensor.max();\n const labelMin = labelTensor.min();\n\n const normalizedInputs = inputTensor.sub(inputMin).div(inputMax.sub(inputMin));\n const normalizedLabels = labelTensor.sub(labelMin).div(labelMax.sub(labelMin));\n console.log('normalize input', normalizedInputs)\n return {\n inputs: normalizedInputs,\n labels: normalizedLabels,\n // return the min/max bounds so we can use them later\n inputMax,\n inputMin,\n labelMax,\n labelMin\n }\n });\n}", "predictLoop(ins, batchSize = 32, verbose = false) {\n return _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"](() => {\n const numSamples = this.checkNumSamples(ins);\n if (verbose) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_3__[\"NotImplementedError\"]('Verbose predictLoop() is not implemented yet.');\n }\n // Sample-based predictions.\n // Porting Note: Tensor currently does not support sliced assignments as\n // in numpy, e.g., x[1:3] = y. Therefore we use concatenation while\n // iterating over the batches.\n const batches = Object(_training_tensors__WEBPACK_IMPORTED_MODULE_17__[\"makeBatches\"])(numSamples, batchSize);\n const outsBatches = this.outputs.map(output => []);\n // TODO(cais): Can the scope() be pushed down inside the for loop?\n for (let batchIndex = 0; batchIndex < batches.length; ++batchIndex) {\n const batchOuts = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"](() => {\n const batchStart = batches[batchIndex][0];\n const batchEnd = batches[batchIndex][1];\n // TODO(cais): Take care of the case of the last element is a flag for\n // training/test.\n const insBatch = Object(_training_tensors__WEBPACK_IMPORTED_MODULE_17__[\"sliceArrays\"])(ins, batchStart, batchEnd);\n // Construct the feeds for execute();\n const feeds = [];\n if (Array.isArray(insBatch)) {\n for (let i = 0; i < insBatch.length; ++i) {\n feeds.push({ key: this.inputs[i], value: insBatch[i] });\n }\n }\n else {\n feeds.push({ key: this.inputs[0], value: insBatch });\n }\n const feedDict = new _executor__WEBPACK_IMPORTED_MODULE_15__[\"FeedDict\"](feeds);\n return Object(_executor__WEBPACK_IMPORTED_MODULE_15__[\"execute\"])(this.outputs, feedDict);\n });\n batchOuts.forEach((batchOut, i) => outsBatches[i].push(batchOut));\n }\n return Object(_utils_generic_utils__WEBPACK_IMPORTED_MODULE_9__[\"singletonOrArray\"])(outsBatches.map(batches => _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"concat\"](batches, 0)));\n });\n }", "function preprocessImage(image){\n\t// let tensor = tf.fromPixels(image).resizeNearestNeighbor([100,100]).toFloat();\n\tlet tensor = tf.browser.fromPixels(image).resizeNearestNeighbor([size_x,size_y]).toFloat();\n\tlet offset = tf.scalar(255);\n return tensor.div(offset).expandDims();\n}", "async function init() {\n // Load model\n model = await tf.loadLayersModel(\"file://./lib/model/model.json\");\n\n // Process intents and classes\n const ignoreWords = [\"?\"];\n const classesSet = new Set();\n\n intents.intents.forEach((intent) => {\n intent.patterns.forEach((pattern) => {\n words = [\n ...words,\n ...pattern.split(/(\\.)|(,)|(\\'.)|(\\?)/g).join(\" \").split(/[ ]/g)];\n classesSet.add(intent.tag);\n });\n });\n\n classes = Array.from(classesSet);\n words = Array.from(new Set(words\n .filter(word => ignoreWords.indexOf(word) === -1 && word.length > 0)\n .map(word => lancasterStemmer(word))));\n \n // Handle some inconsistencies between lancaster stemmer in python vs javascript\n words.push('univers');\n words[words.indexOf('scy')] = 'sci';\n words[words.indexOf('down-tim')] = 'down-time';\n\n words.sort();\n classes.sort();\n\n return Promise.resolve();\n}", "createVectorSpaceModel(query, doc) {\n query = Array.isArray(query) ? query: query.split(\" \");\n if (this.corpus == null) return null;\n let termFrequencyModel = [];\n let vectorSpaceModel = []\n for (let i = 0; i < query.length; i++){\n termFrequencyModel.push(this.calculateTermFrequency(query[i], doc));\n }\n let idfModel = this.createIdfModel(query);\n for (let j = 0; j < idfModel.length; j++){\n vectorSpaceModel[j] = idfModel[j] * termFrequencyModel[j];\n }\n this.vectorSpaceModel = vectorSpaceModel;\n return vectorSpaceModel\n }", "modelBuilder() {\n const model = tf.sequential();\n \n const IMAGE_WIDTH = 28;\n const IMAGE_HEIGHT = 28;\n const IMAGE_CHANNELS = 1; \n \n // In the first layer of our convolutional neural network we have \n // to specify the input shape. Then we specify some parameters for \n // the convolution operation that takes place in this layer.\n model.add(tf.layers.conv2d({\n inputShape: [IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_CHANNELS],\n kernelSize: 5,\n filters: 8,\n strides: 1,\n activation: 'relu',\n kernelInitializer: 'varianceScaling'\n }));\n \n // The MaxPooling layer acts as a sort of downsampling using max values\n // in a region instead of averaging. \n model.add(tf.layers.maxPooling2d({poolSize: [2, 2], strides: [2, 2]}));\n \n // Repeat another conv2d + maxPooling stack. \n // Note that we have more filters in the convolution.\n model.add(tf.layers.conv2d({\n kernelSize: 5,\n filters: 16,\n strides: 1,\n activation: 'relu',\n kernelInitializer: 'varianceScaling'\n }));\n model.add(tf.layers.maxPooling2d({poolSize: [2, 2], strides: [2, 2]}));\n \n // Now we flatten the output from the 2D filters into a 1D vector to prepare\n // it for input into our last layer. This is common practice when feeding\n // higher dimensional data to a final classification output layer.\n model.add(tf.layers.flatten());\n \n // Our last layer is a dense layer which has 10 output units, one for each\n // output class (i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9).\n const NUM_OUTPUT_CLASSES = 10;\n model.add(tf.layers.dense({\n units: NUM_OUTPUT_CLASSES,\n kernelInitializer: 'varianceScaling',\n activation: 'softmax'\n }));\n \n \n // Choose an optimizer, loss function and accuracy metric,\n // then compile and return the model\n const optimizer = tf.train.adam();\n model.compile({\n optimizer: optimizer,\n loss: 'categoricalCrossentropy',\n metrics: ['accuracy'],\n });\n \n return model;\n }", "modelBuilder() {\n const model = tf.sequential();\n \n const IMAGE_WIDTH = 28;\n const IMAGE_HEIGHT = 28;\n const IMAGE_CHANNELS = 1; \n \n // In the first layer of our convolutional neural network we have \n // to specify the input shape. Then we specify some parameters for \n // the convolution operation that takes place in this layer.\n model.add(tf.layers.conv2d({\n inputShape: [IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_CHANNELS],\n kernelSize: 5,\n filters: 8,\n strides: 1,\n activation: 'relu',\n kernelInitializer: 'varianceScaling'\n }));\n \n // The MaxPooling layer acts as a sort of downsampling using max values\n // in a region instead of averaging. \n model.add(tf.layers.maxPooling2d({poolSize: [2, 2], strides: [2, 2]}));\n \n // Repeat another conv2d + maxPooling stack. \n // Note that we have more filters in the convolution.\n model.add(tf.layers.conv2d({\n kernelSize: 5,\n filters: 16,\n strides: 1,\n activation: 'relu',\n kernelInitializer: 'varianceScaling'\n }));\n model.add(tf.layers.maxPooling2d({poolSize: [2, 2], strides: [2, 2]}));\n \n // Now we flatten the output from the 2D filters into a 1D vector to prepare\n // it for input into our last layer. This is common practice when feeding\n // higher dimensional data to a final classification output layer.\n model.add(tf.layers.flatten());\n \n // Our last layer is a dense layer which has 10 output units, one for each\n // output class (i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9).\n const NUM_OUTPUT_CLASSES = 10;\n model.add(tf.layers.dense({\n units: NUM_OUTPUT_CLASSES,\n kernelInitializer: 'varianceScaling',\n activation: 'softmax'\n }));\n \n \n // Choose an optimizer, loss function and accuracy metric,\n // then compile and return the model\n const optimizer = tf.train.adam();\n model.compile({\n optimizer: optimizer,\n loss: 'categoricalCrossentropy',\n metrics: ['accuracy'],\n });\n \n return model;\n }", "Model(inputNames,outputNames,learningRate){\n var args;\n if (!isNaN(learningRate) || learningRate===undefined)\n args={learningRate:learningRate||0.001};\n else\n args=learningRate;\n //console.log(args)\n\n var m=this.model(inputNames,outputNames);\n m.compile({\n optimizer:args.optimizer||tf.train.adam(args.learningRate||0.001),\n metrics:args.metrics||['accuracy'],\n loss:args.loss||'meanSquaredError',\n });\n return m;\n \n }", "function openCvReady() {\n cv['onRuntimeInitialized']= ()=>{\n // The variable video extracts the video the video element\n let video = document.getElementById(\"cam_input\"); // video is the id of video tag\n // navigator.mediaDevices.getUserMedia is used to access the webcam\n navigator.mediaDevices.getUserMedia({ video: true, audio: false })\n .then(function(stream) {\n video.srcObject = stream;\n video.play();\n })\n .catch(function(err) { \n console.log(\"An error occurred! \" + err);\n });\n\n //src and dst holds the source and destination image matrix\n let src = new cv.Mat(video.height, video.width, cv.CV_8UC4);\n let dst = new cv.Mat(video.height, video.width, cv.CV_8UC1);\n //gray holds the grayscale image of the src\n let gray = new cv.Mat();\n //cap holds the current frame of the video\n let cap = new cv.VideoCapture(cam_input);\n //RectVector is used to hold the vectors of different faces\n let faces = new cv.RectVector();\n let predictions=\"Detecting...\"\n //classifier holds the classifier object\n let classifier = new cv.CascadeClassifier();\n let utils = new Utils('errorMessage');\n //crop holds the ROI of face\n let crop=new cv.Mat(video.height, video.width, cv.CV_8UC1);\n let dsize = new cv.Size(48, 48);\n\n // Loading the haar cascade face detector\n let faceCascadeFile = 'haarcascade_frontalface_default.xml'; // path to xml\n utils.createFileFromUrl(faceCascadeFile, faceCascadeFile, () => {\n classifier.load(faceCascadeFile); // in the callback, load the cascade from file \n});\n\n\n//Loading the model with async as loading the model may take few miliseconds\n//The function dont take and return anything\n//the model holds the model\n(async () => {\n model = await tf.loadLayersModel('./model/model.json')\n console.log(model)\n })()\n\n\n\n const FPS = 30;\n // processvideo will be executed recurrsively \n function processVideo() {\n let begin = Date.now();\n cap.read(src);\n src.copyTo(dst);\n cv.cvtColor(dst, gray, cv.COLOR_RGBA2GRAY, 0); // converting to grayscale\n try{\n classifier.detectMultiScale(gray, faces, 1.1, 3, 0);// detecting the face\n console.log(faces.size());\n }catch(err){\n console.log(err);\n }\n //iterating over all the detected faces\n for (let i = 0; i < faces.size(); ++i) {\n let face = faces.get(i);\n // filtering out the boxes with the area of less than 45000\n if(face.width*face.height <40000){continue;} \n let point1 = new cv.Point(face.x, face.y);\n let point2 = new cv.Point(face.x + face.width, face.y + face.height);\n // creating the bounding box\n cv.rectangle(dst, point1, point2, [51, 255, 255, 255],3);\n //creating a rect element that can be used to extract\n let cutrect=new cv.Rect(face.x,face.y,face.width,face.height)\n //extracting the ROI\n crop=gray.roi(cutrect)\n\n cv.resize(crop,crop,dsize,0,0,cv.INTER_AREA)\n \n //converting the image matrix to a 4d tensor\n const input=tf.tensor4d(crop.data,[1,48,48,1]).div(255)\n\n\n //console.log(input)\n //making the prediction and adding the prediction it to the output canvas\n predictions=model.predict(input).dataSync(0)\n \n \n\n \n \n console.log(predictions)\n //adding the text above the bounding boxes\n cv.putText(dst,String(parseInt(predictions)),{x:face.x,y:face.y-20},1,3,[255, 128, 0, 255],4);\n \n }\n \n\n // showing the final output\n cv.imshow(\"canvas_output\", dst);\n \n let delay = 1000/FPS - (Date.now() - begin);\n setTimeout(processVideo, delay);\n}\n// schedule first one.\nsetTimeout(processVideo, 0);\n };\n}", "call(inputs, kwargs) {\n return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"])(() => {\n inputs = _utils_generic_utils__WEBPACK_IMPORTED_MODULE_4__[\"toList\"](inputs);\n const feedDict = new _executor__WEBPACK_IMPORTED_MODULE_9__[\"FeedDict\"]();\n for (let i = 0; i < this.inputs.length; ++i) {\n feedDict.add(this.inputs[i], inputs[i]);\n }\n return Object(_executor__WEBPACK_IMPORTED_MODULE_9__[\"execute\"])(this.outputs, feedDict, kwargs);\n });\n }", "async classify(inputString, limit = 10) {\n\n if (DEBUG) {\n console.log(inputString.match(/.{1,64}/g).join('\\n'));\n }\n\n if (this.session === null) {\n this.session = new InferenceSession();\n await this.session.loadModel(ONNX_FILE);\n }\n\n const inputArray = new Float32Array(inputString.split('').map(digit => (digit === '1' ? 1 : 0)));\n\n const inputTensor = new Tensor(inputArray, 'float32', [1, 1, 64, 64]);\n\n const outputMap = await this.session.run([inputTensor]);\n\n const rawValues = Array.from(outputMap.values())[0].data;\n\n // Trim off any \"nothing\" labels. They are all at the end of this.labels.\n // They are added as padding during training and the client is not interested in them.\n const nothingOut = ((_e, i) => (!(this.labels[i].startsWith('nothing'))));\n\n const trimmedValues = rawValues.filter(nothingOut);\n const trimmedLabels = this.labels.filter(nothingOut);\n\n // Implementation detail with this particular network- we need to compute softmax\n const exponents = trimmedValues.map(Math.exp);\n const exponentSum = exponents.reduce((acc, e) => acc + e, 0);\n const softmax = exponents.map(e => e / exponentSum);\n\n const valueByLabel = trimmedLabels.reduce((acc, e, i) => {\n acc[e] = softmax[i];\n return acc;\n }, {});\n\n const sortedLabels = trimmedLabels.sort((e1, e2) => valueByLabel[e2] - valueByLabel[e1]);\n // Return top ten\n const tags = sortedLabels.slice(0, limit).map((label => ({ label, value: valueByLabel[label] })));\n\n // Reassemble valueByLabel but sort the keys in descending value order\n const sortedValueByLabel = sortedLabels.reduce((acc, label) => {\n acc[label] = valueByLabel[label];\n return acc;\n }, {});\n\n const returnValue = { valueByLabel: sortedValueByLabel, tags };\n if (DEBUG) {\n console.log(`Classifier result: ${sortedLabels[0]}`);\n console.dir(returnValue);\n }\n return returnValue;\n }", "function get_data() {\r\n $.ajax({\r\n dataType: \"json\",\r\n url: './iris.json',\r\n mimeType: 'application/json',\r\n success: function(result) {\r\n const shuffelArray = arr => arr.map(a => [Math.random(), a]).sort((a, b) => a[0]-b[0]).map(a => a[1]);\r\n result = shuffelArray(result);\r\n x_train = tf.tensor2d(result.slice(0, parseInt(result.length*0.9)).map(instance => [\r\n instance.sepalLength, instance.sepalWidth, instance.petalLength, instance.petalWidth,\r\n ]))\r\n y_train = tf.tensor2d(result.slice(0, parseInt(result.length*0.9)).map(instance => [\r\n instance.species == 'setosa' ? 1:0, \r\n instance.species == 'virginica' ? 1:0, \r\n instance.species == 'versicolor' ? 1:0, \r\n ]))\r\n x_test = tf.tensor2d(result.slice(parseInt(result.length*0.9)).map(instance => [\r\n instance.sepalLength, instance.sepalWidth, instance.petalLength, instance.petalWidth,\r\n ]))\r\n y_test = tf.tensor2d(result.slice(parseInt(result.length*0.9)).map(instance => [\r\n instance.species == 'setosa' ? 1:0, \r\n instance.species == 'virginica' ? 1:0, \r\n instance.species == 'versicolor' ? 1:0, \r\n ]))\r\n }\r\n })\r\n}", "execute(inputs, outputs) {\n inputs = this.mapInputs(inputs);\n const names = Object.keys(inputs).sort();\n this.checkInputs(inputs);\n this.checkInputShapeAndType(inputs);\n outputs = this.mapOutputs(outputs);\n this.checkOutputs(outputs);\n const inputNodes = names.map(name => this.graph.nodes[Object(_operations_executors_utils__WEBPACK_IMPORTED_MODULE_1__[\"parseNodeName\"])(name)[0]]);\n const outputNodeNames = outputs.map(name => Object(_operations_executors_utils__WEBPACK_IMPORTED_MODULE_1__[\"parseNodeName\"])(name)[0]);\n let outputNodes = outputNodeNames.map(name => this.graph.nodes[name]);\n // If no outputs are specified, then use the default outputs of the model.\n if (outputNodes.length === 0) {\n outputNodes = this._outputs;\n }\n const compilationKey = this.getCompilationKey(inputNodes, outputNodes);\n // Do nothing if the compiled graph cache contains the input.\n let orderedNodes = this.compiledMap.get(compilationKey);\n if (orderedNodes == null) {\n orderedNodes = this.compile(inputs, outputNodes);\n this.compiledMap.set(compilationKey, orderedNodes);\n }\n const tensorArrayMap = {};\n const tensorListMap = {};\n return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"])(() => {\n const context = new _execution_context__WEBPACK_IMPORTED_MODULE_3__[\"ExecutionContext\"](this.weightMap, tensorArrayMap, tensorListMap, this.functionExecutorMap);\n const tensorsMap = Object.assign({}, this.weightMap);\n Object.keys(inputs).forEach(name => {\n const [nodeName, index] = Object(_operations_executors_utils__WEBPACK_IMPORTED_MODULE_1__[\"parseNodeName\"])(name);\n const tensors = [];\n tensors[index] = inputs[name];\n tensorsMap[nodeName] = tensors;\n });\n const tensorsToKeep = this.getFrozenTensorIds(tensorsMap);\n const intermediateTensorConsumerCount = {};\n for (let i = 0; i < orderedNodes.length; i++) {\n const node = orderedNodes[i];\n if (!tensorsMap[node.name]) {\n const tensors = Object(_operations_operation_executor__WEBPACK_IMPORTED_MODULE_2__[\"executeOp\"])(node, tensorsMap, context, this._resourceManager);\n if (_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].isPromise(tensors)) {\n throw new Error(`The execution of the op '${node.op}' returned a promise. ` +\n `Please use model.executeAsync() instead.`);\n }\n tensorsMap[node.name] = tensors;\n this.checkTensorForDisposal(node.name, node, tensorsMap, context, tensorsToKeep, outputNodeNames, intermediateTensorConsumerCount);\n }\n }\n // dispose the context for the root executor\n if (this.parent == null) {\n context.dispose(tensorsToKeep);\n }\n return outputs.map(name => Object(_operations_executors_utils__WEBPACK_IMPORTED_MODULE_1__[\"getTensor\"])(name, tensorsMap, context));\n });\n }", "function getInputTensor(data) {\n return tf.tensor(data).asType(\"float32\").reshape([1, 28, 28, 1]);\n}", "function binaryKernelFunc({ opSnippet, packedOpSnippet, checkOutOfBounds = false, supportsComplex = false, cpuKernelImpl, dtype }) {\n return ({ inputs, backend }) => {\n const { a, b } = inputs;\n const webglBackend = backend;\n if (supportsComplex && a.dtype === 'complex64') {\n const aData = webglBackend.texData.get(a.dataId);\n const bData = webglBackend.texData.get(b.dataId);\n const [real, imag] = [\n [aData.complexTensorInfos.real, bData.complexTensorInfos.real],\n [aData.complexTensorInfos.imag, bData.complexTensorInfos.imag]\n ].map(complexParts => {\n const [aPart, bPart] = complexParts;\n const aHandle = {\n dataId: aPart.dataId,\n dtype: aPart.dtype,\n shape: a.shape\n };\n const bHandle = {\n dataId: bPart.dataId,\n dtype: bPart.dtype,\n shape: b.shape\n };\n const program = new _binaryop_gpu__WEBPACK_IMPORTED_MODULE_1__[\"BinaryOpProgram\"](opSnippet, a.shape, b.shape);\n return webglBackend.runWebGLProgram(program, [aHandle, bHandle], Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"upcastType\"])(aPart.dtype, bPart.dtype));\n });\n const complexOutput = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_3__[\"complex\"])({ inputs: { real, imag }, backend: webglBackend });\n webglBackend.disposeIntermediateTensorInfo(real);\n webglBackend.disposeIntermediateTensorInfo(imag);\n // TODO(annxingyuan): Implement CPU forwarding for complex inputs.\n return complexOutput;\n }\n const $dtype = dtype || Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"upcastType\"])(a.dtype, b.dtype);\n if (webglBackend.shouldExecuteOnCPU([a, b]) && cpuKernelImpl != null) {\n const aData = webglBackend.texData.get(a.dataId);\n const bData = webglBackend.texData.get(b.dataId);\n const [outValues, outShape] = cpuKernelImpl(a.shape, b.shape, aData.values, bData.values, $dtype);\n const out = webglBackend.makeTensorInfo(outShape, $dtype);\n const outData = webglBackend.texData.get(out.dataId);\n outData.values = outValues;\n return out;\n }\n const shouldUsePackedProgram = Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"env\"])().getBool('WEBGL_PACK_BINARY_OPERATIONS') &&\n packedOpSnippet != null;\n let program;\n if (shouldUsePackedProgram) {\n program = new _binaryop_packed_gpu__WEBPACK_IMPORTED_MODULE_2__[\"BinaryOpPackedProgram\"](packedOpSnippet, a.shape, b.shape, checkOutOfBounds);\n }\n else {\n program = new _binaryop_gpu__WEBPACK_IMPORTED_MODULE_1__[\"BinaryOpProgram\"](opSnippet, a.shape, b.shape);\n }\n return webglBackend.runWebGLProgram(program, [a, b], $dtype);\n };\n}", "async function train() {\r\n dataset.ys = null;\r\n dataset.encodeLabels(5);\r\n model = tf.sequential({\r\n layers: [\r\n // flattening the layer over which we training is to be done\r\n tf.layers.flatten({inputShape: mobilenet.outputs[0].shape.slice(1)}),\r\n // 120 neurons are added with activation function \"ReLU\"\r\n tf.layers.dense({ units: 120, activation: 'relu'}),\r\n // output is governed by the multi-class classification function \"SIGMOID\"\r\n tf.layers.dense({ units: 5, activation: 'sigmoid'})\r\n ]\r\n });\r\n // used optimiser \"Stochastic Gradient Descent\" with learning-rate, alpha (α) = 0.002\r\n const optimizer = tf.train.sgd(0.002);\r\n // loss-function: measuring distances between target labels and predicted labels\r\n // optimizer: reduces loss and updates weights and biases regularly\r\n model.compile({optimizer: optimizer, loss: 'binaryCrossentropy'});\r\n let loss = 0;\r\n // training the model with above stated loss function and optimizer with epochs(no of times trained)\r\n model.fit(dataset.xs, dataset.ys, {\r\n epochs: 30,\r\n callbacks: {\r\n onBatchEnd: async (batch, logs) => {\r\n loss = logs.loss.toFixed(5);\r\n console.log('LOSS: ' + loss);\r\n }\r\n }\r\n });\r\n}", "function imgToTensor(input, size = null) {\n return tf.tidy(() => {\n let img = tf.browser.fromPixels(input);\n if (size) {\n img = tf.image.resizeBilinear(img, size);\n }\n const croppedImage = cropImage(img);\n const batchedImage = croppedImage.expandDims(0);\n return batchedImage.toFloat().div(tf.scalar(127)).sub(tf.scalar(1));\n });\n}", "function predict(x) {\r\n // y = a * x ^ 3 + b * x ^ 2 + c * x + d\r\n return tf.tidy(() => {\r\n return a.mul(x.pow(tf.scalar(3, 'int32')))\r\n .add(b.mul(x.square()))\r\n .add(c.mul(x))\r\n .add(d);\r\n });\r\n}", "function doTF(tf)\r\n{\r\n termfrequency = {};\r\n var word = tf.split(' '); // individual words\r\n var count=0;\r\n \r\n for(var i = 0;i<tf.length;i++)\r\n {\r\n if(termfrequency.hasOwnProperty(word[i]))\r\n {\r\n // the word is already in the database:\r\n termfrequency[word[i]]++;\r\n arrfrequency++;\r\n }\r\n else\r\n {\r\n // the word is new:\r\n termfrequency[word[i]]=1;\r\n arrfrequency++;\r\n \r\n }\r\n for (var j = 0; j < arr.length; j++) {\r\n if (arr[j] == word[i]) {\r\n count++;\r\n } }\r\n}\r\n \r\n \r\n \r\n console.log(termfrequency);\r\n console.log(arrfrequency);\r\n console.log(word);\r\n console.log(count); \r\n return count;\r\n }", "function convertToTensor(data) {\n // Wrapping these calculations in a tidy will dispose any \n // intermediate tensors.\n \n return tf.tidy(() => {\n // Step 1. Shuffle the data \n //tf.util.shuffle(data);\n \n // Step 2. Convert data to Tensor\n const inputs = data.map(d => d.precipitation)\n const labels = data.map(d => d.yield);\n // has shape: [inputs.length, 1] ([num_examples, num_features_per_example])\n const inputTensor = tf.tensor2d(inputs, [inputs.length, 1]);\n const labelTensor = tf.tensor2d(labels, [labels.length, 1]);\n \n // Step 3. Normalize the data to the range 0 - 1 using min-max scaling\n const inputMax = inputTensor.max();\n const inputMin = inputTensor.min(); \n const labelMax = labelTensor.max();\n const labelMin = labelTensor.min();\n \n const normalizedInputs = inputTensor.sub(inputMin).div(inputMax.sub(inputMin));\n const normalizedLabels = labelTensor.sub(labelMin).div(labelMax.sub(labelMin));\n console.log('normalized');\n return {\n inputs: normalizedInputs,\n labels: normalizedLabels,\n // Return the min/max bounds so we can use them later.\n inputMax,\n inputMin,\n labelMax,\n labelMin,\n }\n }); \n }", "function setTensorTracker(fn) {\n trackerFn = fn;\n}", "function setTensorTracker(fn) {\n trackerFn = fn;\n}", "function predict(x, y, z) {\n return tf.tidy(() => {\n return a.mul(x)\n .add(b.mul(y))\n .add(c.mul(z));\n\n })\n}", "constructor(features, labels, options) {\n // and initial set up of our class (traditionally) w/ feature set, labels, and relevant options for running this algo\n // we're assuming that when features and labels are passed in, that they will already be tensorflow tensors\n this.features = features\n this.labels = labels\n // and we'll also process the options\n this.options = Object.assign(\n {\n // here we can add default values - to make sure there's always a value provided for crucial components\n learningRate: 0.1,\n // specify maximum number of times we want to run our GDesc algo\n iterations: 1000\n },\n options\n )\n\n // create initial guesses for m & b\n this.m = 0\n this.b = 0\n }", "getInput(name) {\n return Object(_executors_utils__WEBPACK_IMPORTED_MODULE_0__[\"getTensor\"])(name, this.tensorMap, this.context);\n }", "constructor(keyDType, valueDType) {\n this.keyDType = keyDType;\n this.valueDType = valueDType;\n this.handle = Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"scalar\"])(0);\n // tslint:disable-next-line: no-any\n this.tensorMap = new Map();\n Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"keep\"])(this.handle);\n }", "async function runModel() {\n showLoadingScreen();\n\n model = await tf.loadGraphModel(modelURL);\n\n tf.tidy(() => model.predict(fetchInputImage())); // warmup\n\n modelChange = false;\n\n while (!modelChange) {\n const saliencyMap = predictSaliency();\n\n await tf.browser.toPixels(saliencyMap, canvas);\n\n saliencyMap.dispose();\n\n await tf.nextFrame();\n }\n\n model.dispose();\n\n runModel();\n}", "function gen_op_stl_kernel()\n{\n gen_opc_ptr.push({func:op_stl_kernel});\n}", "_getTensorId(arg) {\n const name = arg.graphId();\n console.log(` input tensor: ${name}`);\n if (!this._tensorIds.hasOwnProperty(name)) {\n throw new Error(`Tensor ${name} is not found`);\n }\n return this._tensorIds[name];\n }", "function getTensor(name, tensorsMap, context) {\n var _a = parseNodeName(name), nodeName = _a[0], index = _a[1];\n var contextId = context.currentContextIds.find(function (contextId) {\n return !!tensorsMap[getNodeNameWithContextId(nodeName, contextId)];\n });\n return contextId !== undefined ?\n tensorsMap[getNodeNameWithContextId(nodeName, contextId)][index] :\n undefined;\n}", "async function runModel (){\n const model = await tf.loadLayersModel('modeloTipoDocJS/model.json');\n\n setInterval(() => {\n detect(model);\n }, 10);\n }", "function cloneTensor(tensor) {\n return tensor.kept ? tensor : Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"clone\"])(tensor);\n}", "function ft(t, e, n, r, i, o, s) {\n return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []), \n void 0 === i && (i = null), void 0 === o && (o = null), void 0 === s && (s = null), \n new ht(t, e, n, r, i, o, s);\n}", "async function create_model(text) {\n /* data prep */\n text = text.toLowerCase()\n console.log('corpus length:', text.length)\n\n let words = text.replace(/(\\r\\n\\t|\\n|\\r\\t)/gm,\" \").split(\" \")\n words = words.filter((value, index, self) => self.indexOf(value) === index)\n words = words.sort()\n words = words.filter(String)\n\n console.log(\"total number of unique words\", words.length)\n\n const word_indices = {}\n const indices_word = {}\n for (let e0 of words.entries()) {\n const idx = e0[0]\n const word = e0[1]\n word_indices[word] = idx\n indices_word[idx] = word\n }\n\n console.log(\"maxlen: \" + maxlen, \" step: \" + step)\n\n const sentences = []\n const sentences1 = []\n\n const next_words = []\n let list_words = text.toLowerCase().replace(/(\\r\\n\\t|\\n|\\r\\t)/gm, \" \").split(\" \")\n list_words = list_words.filter(String)\n console.log('list_words ' + list_words.length)\n\n for (var i = 0; i < (list_words.length - maxlen); i += step) {\n var sentences2 = list_words.slice(i, i + maxlen).join(\" \")\n sentences.push(sentences2)\n next_words.push(list_words[i + maxlen])\n }\n console.log('nb sequences(length of sentences):', sentences.length)\n console.log('length of next_word', next_words.length)\n\n console.log('Vectorization...')\n const X = nj.zeros([sentences.length, maxlen, words.length])\n console.log('X shape' + X.shape)\n const y = nj.zeros([sentences.length, words.length])\n console.log('y shape' + y.shape)\n for (let e of sentences.entries()) {\n const i = e[0]\n const sentence = e[1]\n for (let e2 of sentence.split(\" \").entries()) {\n const t = e2[0]\n const word = e2[1]\n X.set(i, t, word_indices[word], 1)\n }\n y.set(i, word_indices[next_words[i]], 1)\n }\n\n console.log('Creating model... Please wait.')\n\n console.log(\"MAXLEN \" + maxlen + \", words.length \" + words.length)\n const model = tf.sequential()\n model.add(tf.layers.lstm({\n units: 128,\n returnSequences: true,\n inputShape: [maxlen, words.length]\n }))\n model.add(tf.layers.dropout(0.2))\n model.add(tf.layers.lstm({\n units: 128,\n returnSequences: false\n }))\n model.add(tf.layers.dropout(0.2))\n model.add(tf.layers.dense({units: words.length, activation: 'softmax'}))\n\n model.compile({loss: 'categoricalCrossentropy', optimizer: tf.train.rmsprop(0.002)})\n\n x_tensor = tf.tensor3d(X.tolist(), null, 'bool')\n //x_tensor.print(true)\n y_tensor = tf.tensor2d(y.tolist(), null, 'bool')\n //y_tensor.print(true)\n\n /* training */\n await model.fit(x_tensor, y_tensor, {\n epochs: 100,\n batchSize: 32,\n callbacks: {\n onEpochEnd: async (epoch, logs) => {\n console.log(logs.loss + \",\")\n }\n }\n })\n\n /* prediction */\n const start_index = Math.floor(Math.random() * (list_words.length - maxlen - 1))\n const diversity = 0.5\n console.log('----- diversity:', diversity)\n let generated = ''\n const sentence = list_words.slice(start_index, start_index + maxlen + 1)\n generated += sentence.join(\" \")\n console.log(generated)\n let str = \"\"\n for (let i = 0; i < 100; i++) {\n let x_pred = nj.zeros([1, maxlen, words.length])\n let str_b = \"\"\n for (e3 of sentence.entries()) {\n t = e3[0]\n word = e3[1]\n x_pred.set(0, t, word_indices[word], 1)\n str_b += '(0, ' + t + \", \" + word_indices[word] + \"), \"\n }\n const test = tf.tensor3d(x_pred.tolist())\n const output = model.predict(test)\n const output_data = await output.dataSync()\n const preds = Array.prototype.slice.call(output_data)\n const next_index = sample(preds, diversity)\n const next_word = indices_word[next_index]\n generated += \" \" + next_word\n sentence.shift()\n str += next_word + \" \"\n }\n console.log(str)\n}", "async function one2one() {\n console.log(kleur.bgGreen(kleur.black(\"one2one\")));\n let xInput = tf.tensor([0.0, 0.2, 0.4, 0.6, 0.8]);\n let yExpected = tf.tensor([0.1, 0.3, 0.5, 0.7, 0.9]);\n\n // Reshape\n xInput = xInput.reshape([5, 1, 1]);\n // xInput.print();\n console.log(xInput.shape);\n\n yExpected = yExpected.reshape([5, 1]);\n // yExpected.print();\n console.log(yExpected.shape);\n\n const length = 5;\n\n const numNeurons = length;\n const numBatch = length;\n const numEpoch = 1000;\n\n let model = tf.sequential();\n\n model.add(\n tf.layers.lstm({\n units: length,\n inputShape: [1, 1]\n })\n );\n\n model.add(tf.layers.dense({ units: 1 }));\n\n model.compile({ loss: \"meanSquaredError\", optimizer: \"adam\" });\n\n await model.fit(xInput, yExpected, {\n epochs: numEpoch,\n verbose: 0\n });\n\n const result = model.predict(\n tf.tensor3d([0.0, 0.2, 0.4, 0.6, 0.8], [5, 1, 1])\n );\n console.log(kleur.bgMagenta(kleur.black(`one2one prediction`)));\n console.log(result.shape);\n result.print();\n console.log(kleur.bgMagenta(kleur.black(`______________________________`)));\n}", "async function standardizeWeights(y, sampleWeight, classWeight, sampleWeightMode) {\n if (sampleWeight != null || sampleWeightMode != null) {\n // TODO(cais): Once 'temporal' mode is implemented, document it in the doc\n // string.\n throw new Error('Support sampleWeight is not implemented yet');\n }\n if (classWeight != null) {\n // Apply class weights per sample.\n const yClasses = Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"])(() => {\n if (y.shape.length === 1) {\n // Assume class indices.\n return y.clone();\n }\n else if (y.shape.length === 2) {\n if (y.shape[1] > 1) {\n // Assume one-hot encoding of classes.\n const axis = 1;\n return y.argMax(axis);\n }\n else if (y.shape[1] === 1) {\n // Class index.\n return y.reshape([y.shape[0]]);\n }\n else {\n throw new Error(`Encountered unexpected last-dimension size (${y.shape[1]}) ` +\n `during handling of class weights. The size is expected to be ` +\n `>= 1.`);\n }\n }\n else {\n throw new Error(`Unexpected rank of target (y) tensor (${y.rank}) during ` +\n `handling of class weights. The rank is expected to be 1 or 2.`);\n }\n });\n const yClassIndices = Array.from(await yClasses.data());\n Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"dispose\"])(yClasses);\n const classSampleWeight = [];\n yClassIndices.forEach(classIndex => {\n if (classWeight[classIndex] == null) {\n throw new Error(`classWeight must contain all classes in the training data. ` +\n `The class ${classIndex} exists in the data but not in ` +\n `classWeight`);\n }\n else {\n classSampleWeight.push(classWeight[classIndex]);\n }\n });\n return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tensor1d\"])(classSampleWeight, 'float32');\n }\n else {\n return null;\n }\n}", "function createComplexBinaryKernelImpl(op) {\n return (aShape, bShape, aRealVals, aImagVals, bRealVals, bImagVals) => {\n const resultShape = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].assertAndGetBroadcastShape(aShape, bShape);\n const resultSize = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].sizeFromShape(resultShape);\n const resultRank = resultShape.length;\n const resultStrides = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].computeStrides(resultShape);\n const resultRealVals = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].getTypedArrayFromDType('float32', resultSize);\n const resultImagVals = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].getTypedArrayFromDType('float32', resultSize);\n const aBroadcastDims = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].getBroadcastDims(aShape, resultShape);\n const bBroadcastDims = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].getBroadcastDims(bShape, resultShape);\n const aVals = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].mergeRealAndImagArrays(aRealVals, aImagVals);\n const bVals = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].mergeRealAndImagArrays(bRealVals, bImagVals);\n const aRank = aShape.length;\n const aStrides = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].computeStrides(aShape);\n const bRank = bShape.length;\n const bStrides = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].computeStrides(bShape);\n if (aBroadcastDims.length + bBroadcastDims.length === 0) {\n for (let i = 0; i < resultRealVals.length; i++) {\n const aIdx = i % aVals.length;\n const bIdx = i % bVals.length;\n const result = op(aVals[aIdx * 2], aVals[aIdx * 2 + 1], bVals[bIdx * 2], bVals[bIdx * 2 + 1]);\n resultRealVals[i] = result.real;\n resultImagVals[i] = result.imag;\n }\n }\n else {\n for (let i = 0; i < resultRealVals.length; i++) {\n const loc = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].indexToLoc(i, resultRank, resultStrides);\n const aLoc = loc.slice(-aRank);\n aBroadcastDims.forEach(d => aLoc[d] = 0);\n const aIndex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].locToIndex(aLoc, aRank, aStrides);\n const bLoc = loc.slice(-bRank);\n bBroadcastDims.forEach(d => bLoc[d] = 0);\n const bIndex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].locToIndex(bLoc, bRank, bStrides);\n const opResult = op(aVals[aIndex * 2], aVals[aIndex * 2 + 1], bVals[bIndex * 2], bVals[bIndex * 2 + 1]);\n resultRealVals[i] = opResult.real;\n resultImagVals[i] = opResult.imag;\n }\n }\n return [resultRealVals, resultImagVals, resultShape];\n };\n}", "function getTensor(name, tensorsMap, context, resourceManager) {\n const [nodeName, index] = parseNodeName(name);\n if (resourceManager != null) {\n const tensor = resourceManager.getHashTableHandleByName(nodeName);\n if (tensor != null) {\n return tensor;\n }\n }\n const contextId = context.currentContextIds.find(contextId => {\n return !!tensorsMap[getNodeNameWithContextId(nodeName, contextId)];\n });\n return contextId !== undefined ?\n tensorsMap[getNodeNameWithContextId(nodeName, contextId)][index] :\n undefined;\n}", "function gather(reference, indices, axis) {\n return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tidy\"])(() => {\n if (Array.isArray(indices)) {\n indices = Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"tensor1d\"])(indices, 'int32');\n }\n else {\n indices = indices.toInt();\n }\n return _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"gather\"](reference, indices, axis);\n });\n}", "function gen_op_neon_cgt_f32()\n{\n gen_opc_ptr.push({func:op_neon_cgt_f32});\n}", "function train(index)\n{\n // TODO\n}", "function unaryKernelFunc({ opSnippet, packedOpSnippet, cpuKernelImpl, dtype }) {\n return ({ inputs, backend }) => {\n const { x } = inputs;\n const webglBackend = backend;\n const $dtype = dtype || x.dtype;\n if (webglBackend.shouldExecuteOnCPU([x]) && cpuKernelImpl != null) {\n const xData = webglBackend.texData.get(x.dataId);\n const outValues = cpuKernelImpl(xData.values, $dtype);\n return webglBackend.makeTensorInfo(x.shape, $dtype, outValues);\n }\n const shouldUsePackedProgram = Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"env\"])().getBool('WEBGL_PACK_UNARY_OPERATIONS') && packedOpSnippet != null;\n let program;\n if (shouldUsePackedProgram) {\n program = new _unaryop_packed_gpu__WEBPACK_IMPORTED_MODULE_7__[\"UnaryOpPackedProgram\"](x.shape, packedOpSnippet);\n }\n else {\n program = new _unaryop_gpu__WEBPACK_IMPORTED_MODULE_6__[\"UnaryOpProgram\"](x.shape, opSnippet);\n }\n return webglBackend.runWebGLProgram(program, [x], $dtype);\n };\n}", "function gen_op_vfp_sts_kernel()\n{\n gen_opc_ptr.push({func:op_vfp_sts_kernel});\n}", "function ft(t) {\n return \"string\" == typeof t ? V.fromBase64String(t) : V.fromUint8Array(t);\n}" ]
[ "0.60706496", "0.60706496", "0.6059784", "0.5993308", "0.59173006", "0.58263963", "0.5569604", "0.5419519", "0.5405926", "0.54020846", "0.53792137", "0.5366551", "0.5350338", "0.529773", "0.52623695", "0.52261186", "0.5220202", "0.52025634", "0.51354444", "0.5093367", "0.50894547", "0.5071196", "0.5025819", "0.50226545", "0.50160956", "0.5011216", "0.5002546", "0.5002133", "0.49982548", "0.4988418", "0.49764556", "0.49737868", "0.49601117", "0.4958072", "0.49571133", "0.4952293", "0.49495363", "0.49317193", "0.4914325", "0.49114567", "0.4906989", "0.48974225", "0.48802108", "0.48719886", "0.48345158", "0.4830802", "0.48029107", "0.4802676", "0.47874162", "0.4783074", "0.4773397", "0.4771076", "0.47618964", "0.4751407", "0.47506455", "0.474921", "0.4747321", "0.47458988", "0.47435638", "0.47434708", "0.47385135", "0.47338334", "0.47221342", "0.47221342", "0.47187296", "0.47177035", "0.47153112", "0.47115678", "0.47064126", "0.46930584", "0.4690752", "0.4681367", "0.46803907", "0.4674837", "0.4669505", "0.46488586", "0.4618743", "0.46046522", "0.46046522", "0.45978647", "0.45964953", "0.45884392", "0.45819178", "0.45800832", "0.45797208", "0.45732066", "0.45668653", "0.45515537", "0.4542293", "0.45404345", "0.4540038", "0.45383367", "0.4535395", "0.45337012", "0.45313984", "0.45251104", "0.4511779", "0.45079866", "0.45049712", "0.45017126", "0.44998533" ]
0.0
-1
Firefox does not support outerHTML property
function tf_SetOuterHtml(){ if(document.body.__defineGetter__) { if(HTMLElement) { var element = HTMLElement.prototype; if(element.__defineGetter__) { element.__defineGetter__("outerHTML", function(){ var parent = this.parentNode; var el = tf_CreateElm(parent.tagName); el.appendChild(this); var shtml = el.innerHTML; parent.appendChild(this); return shtml; } ); } } } if(element.__defineSetter__) { HTMLElement.prototype.__defineSetter__("outerHTML", function(sHTML) { var r = this.ownerDocument.createRange(); r.setStartBefore(this); var df = r.createContextualFragment(sHTML); this.parentNode.replaceChild(df, this); return sHTML; }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function outerHTML(elem){\n\tvar div = document.createElement('div');\n\tdiv.appendChild(elem.cloneNode(true));\n\treturn div.innerHTML;\n}", "function outerHtml (element) {\n return document.createElement('div').appendChild(element.cloneNode(true)).parentNode.innerHTML;\n }", "function getOuterHTML(el){if(el.outerHTML){return el.outerHTML;}else{var container=document.createElement('div');container.appendChild(el.cloneNode(true));return container.innerHTML;}}", "function getOuterHTML(el){if(el.outerHTML){return el.outerHTML;}else{var container=document.createElement('div');container.appendChild(el.cloneNode(true));return container.innerHTML;}}", "function getOuterHTML(el){if(el.outerHTML){return el.outerHTML;}else{var container=document.createElement('div');container.appendChild(el.cloneNode(true));return container.innerHTML;}}", "function outerHTML(element) {\n if (element.outerHTML) {\n return element.outerHTML;\n }\n else {\n var twrap = document.createElement(\"div\");\n var tnode = element.cloneNode(true);\n twrap.appendChild(tnode);\n var content = twrap.innerHTML;\n return content;\n }\n}", "get outerHTML(){ \n\t\t return this.xml; \n\t\t \n\t }", "get outerHTML(){ \n\t\t return this.xml; \n\t\t \n\t }", "function outerHTML(node) {\n var el = document.createElement(\"div\");\n el.appendChild(node.cloneNode(true));\n return el.innerHTML;\n }", "function getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML;\n }\n else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML;\n }\n }", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n }", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n }", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n }", "function getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML;\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML;\n }\n }", "function getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML;\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML;\n }\n }", "function getOuterHTML(el) {\n\t if (el.outerHTML) {\n\t return el.outerHTML;\n\t } else {\n\t var container = document.createElement('div');\n\t container.appendChild(el.cloneNode(true));\n\t return container.innerHTML;\n\t }\n\t}", "function getOuterHTML(el) {\n\t if (el.outerHTML) {\n\t return el.outerHTML;\n\t } else {\n\t var container = document.createElement('div');\n\t container.appendChild(el.cloneNode(true));\n\t return container.innerHTML;\n\t }\n\t}", "function getOuterHTML (el) {\n\t if (el.outerHTML) {\n\t return el.outerHTML\n\t } else {\n\t var container = document.createElement('div');\n\t container.appendChild(el.cloneNode(true));\n\t return container.innerHTML\n\t }\n\t}", "function getOuterHTML (el) {\n\t if (el.outerHTML) {\n\t return el.outerHTML\n\t } else {\n\t var container = document.createElement('div');\n\t container.appendChild(el.cloneNode(true));\n\t return container.innerHTML\n\t }\n\t}", "function getOuterHTML (el) {\n\t if (el.outerHTML) {\n\t return el.outerHTML\n\t } else {\n\t var container = document.createElement('div');\n\t container.appendChild(el.cloneNode(true));\n\t return container.innerHTML\n\t }\n\t}", "function getOuterHTML (el) {\n\t if (el.outerHTML) {\n\t return el.outerHTML\n\t } else {\n\t var container = document.createElement('div');\n\t container.appendChild(el.cloneNode(true));\n\t return container.innerHTML\n\t }\n\t}", "function getOuterHTML (el) {\n\t if (el.outerHTML) {\n\t return el.outerHTML\n\t } else {\n\t var container = document.createElement('div');\n\t container.appendChild(el.cloneNode(true));\n\t return container.innerHTML\n\t }\n\t}", "function getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n }", "function getOuterHTML (el) {\r\n if (el.outerHTML) {\r\n return el.outerHTML\r\n } else {\r\n var container = document.createElement('div');\r\n container.appendChild(el.cloneNode(true));\r\n return container.innerHTML\r\n }\r\n}", "function xInnerHtml(e,h)\r\n{\r\n if(!(e=xGetElementById(e)) || !xStr(e.innerHTML)) return null;\r\n var s = e.innerHTML;\r\n if (xStr(h)) {e.innerHTML = h;}\r\n return s;\r\n}", "function getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML;\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML;\n }\n}", "function getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML;\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML;\n }\n}", "function getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML;\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML;\n }\n}", "function getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML;\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML;\n }\n}", "function getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML;\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML;\n }\n}", "function getOuterHTML(el) {\n if (el.outerHTML) {\n return el.outerHTML;\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML;\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}", "function getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}" ]
[ "0.75865865", "0.7538095", "0.74239403", "0.74239403", "0.74239403", "0.7330268", "0.71378577", "0.71378577", "0.7128602", "0.70816106", "0.70718217", "0.70718217", "0.70718217", "0.70707285", "0.70707285", "0.70491534", "0.70491534", "0.70455885", "0.70455885", "0.70455885", "0.70455885", "0.70455885", "0.7032086", "0.70046455", "0.6954635", "0.6926127", "0.6926127", "0.6926127", "0.6926127", "0.6926127", "0.6926127", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156", "0.6923156" ]
0.0
-1
===END removable section=========================== /==================================================== Backward compatibility fns =====================================================
function grabEBI(id){ return tf_Id(id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get removable() { return this._removable; }", "private internal function m248() {}", "transient private protected internal function m182() {}", "get removable() {\n return this._removable;\n }", "removed() {}", "removed() {}", "transient private internal function m185() {}", "protected internal function m252() {}", "moveIsSmart() {}", "function _remove() {\n return;\n }", "removable(type) { return this.removableTokens[type]!==undefined }", "transient protected internal function m189() {}", "transient final protected internal function m174() {}", "disorient(){\n\t\t//\n\t}", "private public function m246() {}", "function DragRefInternal() {}", "function DragRefInternal() {}", "transient private protected public internal function m181() {}", "handleElementMove(item, monitor) {\r\n let creatorElementsCopy = this.state.creatorElements.slice();\r\n for (let i = 0; i < creatorElementsCopy.length; i++) {\r\n if (creatorElementsCopy[i] === item.value) {\r\n creatorElementsCopy.splice(i, 1);\r\n break;\r\n }\r\n }\r\n\r\n this.setState({\r\n creatorElements: creatorElementsCopy,\r\n elementPlatformValue: item.value\r\n });\r\n }", "removables(removableTokens=[]) {\n this.remove = true\n this.removableTokens = {} \n for( var i=0; i<removableTokens.length; i++ )\n this.removableTokens[removableTokens[i]] = removableTokens[i] \n }", "onUnmountDisk(){\n console.log(\"unmount\");\n let current = this.state.current;\n this.state.disks.map((e,index) => {\n if(current.name == e.name && current.kind == \"disk\"){\n this.state.disks.splice(index, 1);\n }\n });\n\n console.log('pos slice .............');\n console.log(this.state.disks);\n\n this.setState({\n disks : this.state.disks,\n current : {dir : []},\n mode : this.state.mode,\n selected : this.state.selected\n })\n\n }", "removed(vrobject){}", "function movable(){\n\t\toldTop = parseInt(this.style.top);\n\t\toldLeft = parseInt(this.style.left);\n\t\tif (oldTop == emptyTop && oldLeft == (eLeft-100) || oldTop == emptyTop && oldLeft == (eLeft+100) || oldTop == (emptyTop-100) && oldLeft == eLeft || oldTop == (emptyTop+100) && oldLeft == eLeft){\n\t\t\t$(this).addClass('movablepiece');\t\n\t\t}\n\t\telse{\n\t\t\t$(this).removeClass(\"movablepiece\");\n\t\t}\n\t}", "function _____SHARED_functions_____(){}", "transient final private protected internal function m167() {}", "detach() {\n throw new Error('Not Implemented');\n }", "detach() {\n throw new Error('Not Implemented');\n }", "removable(t) {\n var i=0\n while(i<this.removableTokens.length && t.type!=this.removableTokens[i]) i++\n return(i!=this.removableTokens.length) \n }", "_onTweenerRemove () {}", "function dropOnHead(){}", "remove() {\n\n }", "remove () {\n }", "function pullOutDestroy() {\n var NewFATab = [];\n\n // flotte attaquante\n for (var i = 0; i < FATab.length; i++) {\n if (FATab[i][3] > 0) {\n // sniff\n NewFATab.push(FATab[i]);\n }\n\n }\n FATab = null;\n FATab = NewFATab;\n// console.log( NewFATab.toString());\n\n\n //flotte defense\n var NewFDTab = [];\n for (var i = 0; i < FDTab.length; i++) {\n if (FDTab[i][3] > 0) {\n NewFDTab.push(FDTab[i]);\n }\n }\n FDTab = null;\n FDTab = NewFDTab;\n\n }", "onRemove() {}", "static transient final private internal function m43() {}", "transient private public function m183() {}", "softDrop() {\r\n if (this.actual.softDrop()) {\r\n this.crashed();\r\n }\r\n }", "grab() {\n // if you try to grab an item that doesn't exist it errors out\n if (this.grabbable && currentRoom === this.location) {\n inventory.push(this.name);\n return `You grabbed the ${this.name}.`;\n //push item to personal inventory to add it // this part works!\n //console.log(contents);\n //console.log(inventory);\n\n //(filter!==this.name) {\n // let newContents = content.filter(this.name)\n // contents.indexOf(this.name);\n // let pos = contents.indexOf(this.name);\n //newContents = contents.splice(pos, 1);\n // console.log(newContents);\n //}\n } else if (this.grabbable === false) { // if an item isn't grabbable it wont go into their inventory and the game will tell them they can't grab it. \n return `You can't grab that.\\n>_`;\n }\n //console.log(this.name);\n ///let newContents = contents.filter(this.name); // do we need to create a new variable newcontents?\n // console.log(newContents);\n //console.log(contents);\n //let index = contents.indexOf(this.name);\n //console.log(index);\n //contents.splice(indexOf(this.name), 0, this.name);\n //let pos = contents.indexOf(this.name); //indexof is character based?\n //console.log(pos); // item is not found ....\n //let removedItem = contents.splice(index); //mayb not splice...\n //it is not working to remove item from contents\n //contents.pop(removedItem); //pop item from room contents to remove it\n //console.log(removedItem);\n \n }", "static final private internal function m106() {}", "_onProcessReplaceableContent() {}", "function garbage(trash){\n\n}", "moveIsValid() {}", "Remove() {}", "constructor(removableTokens){\n super()\n this.removableTokens = removableTokens || []\n this.remove = true\n this.back = false\n }", "unsee() {}", "onDragAbort(context) {\n if (this.view.currentOrientation.availableDivs.includes(context.element)) {\n context.element.classList.add('b-sch-released');\n }\n }", "preorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "function deduplicteMediaItems() {\n\n}", "function dragCard(sprite, pointer)\n{\n sprite.body.moves = false;\n sprite.ref.isDragged = true;\n}", "function _maybeUpdateDraggable(el) {\n var parent = el.parentNode, container = instance.getContainer();\n while(parent != null && parent !== container) {\n if (instance.hasClass(parent, \"jtk-managed\")) {\n instance.recalculateOffsets(parent);\n return\n }\n parent = parent.parentNode;\n }\n }", "function fix(part1, part2){\n\tparts_buffer = items.splice(indexOf(part2), 1);\n\tpart1.durability = 100;\n}", "AllowNullMove (bb) { isNullMove = bb; }", "function detachFromAce(ace) {\n\n }", "move(from, fromIx, fromCount, to, toIx) {\n let evdata = {\n success: false,\n from: from, \n fromIx: fromIx,\n fromCount: fromCount,\n to: to,\n toIx: toIx\n };\n if (!this.canMove(from, fromIx, fromCount, to, toIx)) {\n //this._event(Game.EV.MOVE, evdata); \n return false;\n }\n let card = false;\n let dest = false;\n if (from == 'w') {\n card = this.waste.pop();\n } \n else if (from == 'f') {\n card = this.foundations[fromIx - 1].pop();\n }\n else if (from == 't') {\n let t = this.tableau[fromIx - 1];\n card = t.slice(t.length - fromCount);\n t.length = t.length - fromCount;\n }\n if (to == 't') {\n dest = this.tableau[toIx - 1];\n }\n else if (to == 'f') {\n dest = this.foundations[toIx - 1];\n }\n if (!card || !dest) {\n //this._event(Game.EV.MOVE, evdata); \n return false;\n }\n if (Array.isArray(card)) {\n card.forEach((c) => { \n dest.push(c); \n });\n }\n else {\n dest.push(card);\n }\n evdata.success = true;\n this._event(Game.EV.MOVE, evdata); \n if (from == 't') {\n let last = this.tableau[fromIx - 1].last();\n this._event(Game.EV.REVEAL, {\n tableau: fromIx,\n card: last\n });\n }\n return true;\n }", "function reserved(){}", "static transient private protected internal function m55() {}", "remove () {\n // cleanup\n }", "function empezar(e){\n\te.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData(\"Data\", e.target.getAttribute('id'));\n e.dataTransfer.setDragImage(e.target, 0, 0);\n return true; \n}", "preDestroy() {}", "function removeAvailableMoveCells() {\n cells.forEach((cell) => {\n cell.classList.remove(\"movable\");\n });\n }", "transient final private protected public internal function m166() {}", "function _resyncRemoved() {\n\t if (this.key == null || !this.container || this.container[this.key] !== this.node) {\n\t this._markRemoved();\n\t }\n\t}", "function _resyncRemoved() {\n\t if (this.key == null || !this.container || this.container[this.key] !== this.node) {\n\t this._markRemoved();\n\t }\n\t}", "move () {\n //console.warn(\"WARNING\" + this + \" : not implemented move method\");\n }", "detach() {}", "detach() {\n\n }", "static transient final protected internal function m47() {}", "function letterDestroyer(boardid, tileid, char) {\n var shoveTile = { boardPos: boardid, tileId : tileid, charVal: char, immobile: false };\n tileObj.push(shoveTile);\n var result = $.grep(boardObj, function(e){ return e.tileId == tileid; });\n if (result.length != 0) {\n var $temp = '#block-' + result[0].boardPos;\n $($temp).droppable(\"enable\");\n }\n boardObj = $.grep(boardObj, function(e){\n return e.tileId != tileid;\n });\n}", "remove() { this.doRemove = true; }", "function _resyncRemoved() {\n if (this.key == null || !this.container || this.container[this.key] !== this.node) {\n this._markRemoved();\n }\n}", "function rollbackDragChanges() {\n placeElement.replaceWith(scope.itemScope.element);\n placeHolder.remove();\n dragElement.remove();\n dragElement = null;\n dragHandled = false;\n containment.css('cursor', '');\n containment.removeClass('as-sortable-un-selectable');\n }", "function rollbackDragChanges() {\n placeElement.replaceWith(scope.itemScope.element);\n placeHolder.remove();\n dragElement.remove();\n dragElement = null;\n dragHandled = false;\n containment.css('cursor', '');\n containment.removeClass('as-sortable-un-selectable');\n }", "wipeUnusedSpace() {\n // Mark internal only to be true so that the render doesn't treat it like\n // a new file, all existing data is kept\n this.onDataChange(undefined, false, true);\n }", "function rollbackDragChanges() {\n if (!scope.itemScope.sortableScope.cloning) {\n placeElement.replaceWith(scope.itemScope.element);\n }\n placeHolder.remove();\n dragElement.remove();\n dragElement = null;\n dragHandled = false;\n containment.css('cursor', '');\n containment.removeClass('as-sortable-un-selectable');\n }", "static actualize() {\n for (let i = 0; i < refs.length ; ++i) {\n const ref = refs[i];\n if (ref.isOutdated()) {\n ref.remove();\n refs.splice(i--, 1);\n }\n }\n }", "function OnSafeZone(prohibitDir:Vector3):void{\r\n\tif (isActive) return;\r\n\tprohibitDirs.Add(prohibitDir);\r\n\tresting = true;\r\n}", "static transient final protected public internal function m46() {}", "Rewind() {}", "function movable_tiles(){\r\n\t\toriginalTop = parseInt(this.style.top);\r\n\t\toriginalLeft = parseInt(this.style.left);originalLeft\r\n\t\tif (originalTop == eTop && originalLeft == (eLeft-100) || originalTop == eTop && originalLeft == (eLeft+100) || originalTop == (eTop-100) && originalLeft == eLeft || originalTop == (eTop+100) && originalLeft == eLeft){\r\n\t\t\t$(this).addClass('movablepiece');\t\r\n\t\t}\r\n\t\telse{\r\n\t\t\t$(this).removeClass(\"movablepiece\");\r\n\t\t}\r\n\t}", "function wontDelete() {\n 'use strict';\n\n return 'can\\'t touch this';\n}", "function CdkDragRelease() {}", "function CdkDragRelease() {}", "dragleave_feedback(){\r\n this.dragging = false;\r\n }", "afterLoadData() {\n this.syncIndices('splice', this.storage.allValues); // Babel cannot transpile ?. version of this correctly for some reason\n\n super.afterLoadData && super.afterLoadData();\n }", "function moveable(){\n return (ignoreMoveable==true) ? false : window.DeviceOrientationEvent != undefined\n }", "function reinitializeDraggable(callback) {\n $('.media-card').arrangeable('destroy');\n callback();\n}", "unvoidLine() {\r\n\t\treturn null\r\n\t}", "function isSpliceBroken() {\n\t\t\tvar n = 256, a = [];\n\t\t\ta[n] = 'a';\n\n\t\t\ta.splice( n + 1, 0, 'b' );\n\n\t\t\treturn a[n] !== 'a';\n\t\t}", "function playWithoutDeletedFull() {\n playWithoutDeleted_helper(true);\n}", "function camSafeRemoveObject(obj, flashy)\n{\n\tif (__camLevelEnded)\n\t{\n\t\treturn;\n\t}\n\tif (camIsString(obj))\n\t{\n\t\tobj = getObject(obj);\n\t}\n\tif (camDef(obj) && obj)\n\t{\n\t\tremoveObject(obj, flashy);\n\t}\n}", "function cleanElement(el){\n\tvar px=el.x;\n\tvar py=el.y;\n\tel.x=Math.round(px);\n\tel.y=Math.round(py);\n\tif(px!=el.x||py!=el.y){\n\t\tfl.trace(\"->Moving element named: \"+el.name+\" From: x=\" +px+\", y=\"+py+\" -> To: x=\" +el.x+\", y=\"+el.y);\n\t}\n}", "function G_MOVE_TO_ARCHIVED(_fileId, _taskid, __sender, __fromStage ){\n // add control for sender\n Logger.log( \"G_MOVE_FROM_FULFILLED_TO_ARCHIVED\" )\n var fromStage = \"fulfilled\";\n if( __fromStage != null){\n fromStage = __fromStage;\n }\n var sheet_fulfilled = F_Get_Sheet_By_Name( _fileId, \"fulfilled\" );\n var sheet_archived = F_Get_Sheet_By_Name( _fileId, \"archived\" );\n // var sheet_active = SpreadsheetApp.getActiveSheet();\n var data_fulfilled = sheet_fulfilled.getDataRange().getValues();\n\n// var data_control = sheet.getDataRange().getValues();\n// Logger.log( )\n for( var ira=0; ira<data_fulfilled.length; ira++ ){\n Logger.log( \"Comp = \" + data_fulfilled[ira][0] + \" == \" + _taskid )\n if(data_fulfilled[ira][0] == _taskid ){\n sheet_archived.appendRow( data_fulfilled[ira] );\n sheet_fulfilled.deleteRow(ira+1);\n var date = new Date(),\n event = \"Archivation\",\n comment = \"Task was archived\",\n stage = \"archived\";\n G_ADD_JOURNAL_EVENT_AND_SAVE(_fileId, _taskid, date, event, comment, __sender, stage );\n }\n }\n \n}", "freeze() {\r\n super.freeze();\r\n this.ghostAnchor.undrag();\r\n this.onManipulationEnd();\r\n }", "function dropChar(charId)\n{\n var dest = document.getElementById(\"dest\");\n var elem = document.getElementById(charId);\n var sor = document.getElementById(\"source\"); \n var b = document.getElementById(\"boat1\");\n\n var rect = elem.getBoundingClientRect();\n //alert(rect.left);\n // alert(\"drop invoked\"); \n destCount();\n\n\n if(rect.left>=963){\n\n if(checkBoatCount()<2)\n {\n dest.removeChild(elem);\n elem.style.position=\"absolute\";\n appendBoat(elem,charId);\n }\n else{\n alert(\"boat is full\");\n }\n }\n else{\n var b = document.getElementById(\"boat1\");\n \n // elemm.style.left=216;\n \n \n // alert(checkBoatCount());\n b.removeChild(elem);\n if(charId==\"c3\" || charId==\"c2\" || charId==\"c1\")\n elem.setAttribute(\"class\",\"canni\");\n else\n elem.setAttribute(\"class\",\"saint\");\n elem.style.position=\"relative\";\n elem.style.left=1;\n elem.style.top=2;\n dest.appendChild(elem);\n // sor.removeChild(elem);\n }\n \n}", "function drag_drop(e) {\n if (ie4 && dragapproved) {\n crossobj.style.left = tempx + event.clientX - offsetx\n crossobj.style.top = tempy + event.clientY - offsety\n return false\n }\n else if (ns6 && dragapproved) {\n crossobj.style.left = tempx + e.clientX - offsetx + \"px\"\n crossobj.style.top = tempy + e.clientY - offsety + \"px\"\n return false\n }\n}", "RemoveAt() {\n\n }", "function RemoveObject(objectName) {\n\n}", "onGhostPointerMove(e) {\r\n // do nothing\r\n }", "function cleanEvent() {\n\tvar removable = ACT.Event.removable;\n\tfor (var itor = 0; itor < removable.length; itor++) {\n\t\tif (removable[itor].eventType === 'env:envRendered') continue;\n\t\tif (removable[itor].eventType === 'message') continue;\n\t\tif (removable[itor].eventType === 'screen:status') continue;\n\t\tif (removable[itor].eventType === 'collapseStart') continue;\n if (removable[itor].eventType === 'html5:message') continue;\n\t\tremovable[itor].remove();\n\t}\n\tACT.Event.removable = [];\n}", "function dragleave(){\n elem.removeClass('dragenter');\n }", "function dragleave(){\n elem.removeClass('dragenter');\n }" ]
[ "0.6324693", "0.6123716", "0.59676963", "0.5869448", "0.5841712", "0.5841712", "0.58411694", "0.5802941", "0.57349104", "0.55513406", "0.55364746", "0.5531328", "0.5511446", "0.54937416", "0.5464979", "0.5442133", "0.5442133", "0.54141766", "0.53125405", "0.5280297", "0.52782935", "0.52770853", "0.526791", "0.52519417", "0.52481496", "0.52331847", "0.52331847", "0.52257323", "0.5223403", "0.5202931", "0.51787716", "0.5178021", "0.5176154", "0.51387715", "0.5133", "0.51246154", "0.5110241", "0.50850415", "0.50796646", "0.5077465", "0.5062045", "0.5060277", "0.5056919", "0.5048512", "0.50453293", "0.5024377", "0.50085753", "0.50065434", "0.5006076", "0.50032634", "0.49917924", "0.49916923", "0.49913973", "0.49858612", "0.49804416", "0.49690515", "0.49650255", "0.4965008", "0.49642432", "0.4962239", "0.49419937", "0.4941083", "0.4941083", "0.49324456", "0.49317864", "0.49295422", "0.49287388", "0.4917854", "0.49174607", "0.49156833", "0.4913616", "0.4913616", "0.49085134", "0.49065715", "0.49054235", "0.48997077", "0.48993194", "0.48953125", "0.4889141", "0.4883656", "0.48812827", "0.48812827", "0.48783705", "0.48767903", "0.48748732", "0.48738623", "0.48723784", "0.48722044", "0.48660308", "0.4862107", "0.48576343", "0.4850454", "0.48469803", "0.48375916", "0.483733", "0.48319", "0.4828617", "0.4824917", "0.4819765", "0.48195365", "0.48195365" ]
0.0
-1
tworzy zmienna z drugim linkiem
function alarm(e) { e.preventDefault(); //zapobiegamy domyslej akcji console.log('kliknieto kolejny link'); console.log(e.type); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function galerijLinks(){\r\n\tlengthExtensie = getImgPad(\"plaatjeFrame\");\r\n\tif (Number(lengthExtensie[3]) > 1){\r\n\t\tplaatjeNummer = Number(lengthExtensie[3]) - 1;\r\n\t}\r\n\telse{\r\n\t\tplaatjeNummer = totaalPlaatjes;\r\n\t}\r\n\tsetPlaatjeNaam(lengthExtensie, plaatjeNummer, \"plaatjeFrame\");\r\n\treturn\r\n}", "function playerLinks(){\r\n\t\tvar links = document.getElementsByTagName(\"a\");\r\n\r\n\t\tvar arrayplayerLinks = new Array();\r\n\r\n\t\tdocument.title.search(/travian\\s(\\w+$)/i);\r\n\t\tvar idioma2 = RegExp.$1;\r\n\r\n\t\tvar vx = 0, vy = 0;\r\n\r\n\t\tif(find(\"//a[@class='active_vl']\",XPFirst) != null) {\r\n\t\t\tfind(\"//a[@class='active_vl']\",XPFirst).parentNode.nextSibling.textContent.match(/\\(([-\\d]+)\\n\\|\\n([-\\d]+)\\)/);\r\n\t\t\tvx = RegExp.$1;\r\n\t\t\tvy = RegExp.$2;\r\n\t\t}\r\n\r\n\t\tfor(var i = 0; i < links.length; i++){\r\n\r\n//\t\t\tif (links[i].className == 'done') continue;\r\n\t\t\tif (links[i].className == 'done' || links[i].getAttribute('done')) continue;\r\n\r\n\t\t\t// Por cada enlace a una ficha de jugador\r\n\t\t\tif(links[i].href.search(/spieler.php\\?uid=(\\d+$)/) > 0) {\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (links[i].parentNode.className == 'menu') continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('uid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\", 'target', '_blank', 'done');\r\n\t\t\t\t\tigmlink2.href = 'spieler.php?uid=' + a;\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\t// Introduce el enlace para enviar mensajes usando su ID\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='data:image/gif;base64,\" + imagenes[\"igm\"] + \"' style='margin:3px 0px 1px 3px; display: inline' _title='\" + T('ENVIAR_IGM') + \"' _alt='\" + T('ENVIAR_IGM') + \"' border=0>\", 'target', '_blank', 'done');\r\n\t\t\t\t\tigmlink2.href = 'nachrichten.php?t=1&id=' + a;\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"#\", 'target', '_blank', 'done');\r\n\t\t\t\t\tigmlink2.href = \"http://www.travutils.com/?s=\" + idioma2 + \"&idu=\" + a;\r\n\r\n\t\t\t\t\tigmlink2.style.cssText = 'display: inline; margin-left: 5px; color: #6F84FF';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t// Por cada enlace a una localizacion del mapa\r\n\t\t\t}else if (links[i].href.search(/karte.php\\?d=(\\d+)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('id=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = links[i].href;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('span', ' ( ' + zid2x(a) + ' | ' + zid2y(a) + ' ) ', null, null, 'done tb_coords');\r\n//\t\t\t\t\tigmlink2.style.cssText = 'word-break: keep-all; font: 11px/1.5em Tahoma,Verdana,Arial !important; color:grey;';\r\n//\t\t\t\t\tigmlink2.className = 'tb_coords';\r\n\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tif (vx || vy) {\r\n\t\t\t\t\t\tigmlink2.addEventListener(\"mouseover\", getVillageDist(zid2x(a), zid2y(a)), 0);\r\n\t\t\t\t\t\tigmlink2.addEventListener(\"mouseout\", function(){ clearTimeout(timeout); timeout = 0; get(\"tb_tooltip\").style.display = 'none'; }, 0);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a',\"<img src='\" + img(\"a/att_all.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' height='10' width='10' _title='\" + T('ATACAR') + \"' _alt='\" + T('ATACAR') + \"' border='0'>\");\r\n\t\t\t\t\tigmlink2.href = 'a2b.php?z=' + a;\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a',T('ALDEA_EXTRA2'));\r\n\t\t\t\t\tigmlink2.href = 'build.php?z=' + a + '&gid=17';\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a',T('ALDEA_EXTRA3'));\r\n\t\t\t\t\tigmlink2.href = 'karte.php?z=' + a;\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t\tlinks[i].addEventListener(\"mouseover\", crearEventoRecursosCasilla(links[i].href, links[i]), 0);\r\n\t\t\t\tlinks[i].addEventListener(\"mouseout\", function(){ clearTimeout(timeout); timeout = 0; get(\"tb_tooltip\").style.display = 'none'; }, 0);\r\n\r\n//\t\t\t\tvar atklink = elem('span',\r\n//\t\t\t\t\t\"<a href='a2b.php?z=\" + a + \"'><img src='\" + img(\"a/att_all.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' height='10' width='10' title='\" + T('ATACAR') + \"' alt='\" + T('ATACAR') + \"' border='0'></a>\"\r\n//\t\t\t\t\t+ \"<a href='build.php?z=\" + a + \"&gid=17'>\" + T('ALDEA_EXTRA2') + \"</a>\"\r\n//\t\t\t\t\t+ \"<a href='karte.php?z=\" + a + \"'>\" + T('ALDEA_EXTRA3') + \"</a>\"\r\n//\t\t\t\t);\r\n//\r\n//\t\t\t\tlinks[i].parentNode.insertBefore(atklink, links[i].nextSibling);\r\n\r\n//\t\t\t\tcity.appendChild(elem(\"TD\", \"<a href='build.php?z=\" + id + \"&gid=17'>\" + T('ALDEA_EXTRA2') + \"</a>\"));\r\n//\t\t\t\tcity.appendChild(elem(\"TD\", \"<a href='karte.php?z=\" + id + \"'>\" + T('ALDEA_EXTRA3') + \"</a>\"));\r\n\r\n\t\t\t// Por cada enlace a la ficha de una alianza\r\n\t\t\t}else if (links[i].href.search(/allianz.php\\?aid=(\\d+$)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = links[i].href;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"#\");\r\n\t\t\t\t\tigmlink2.href = \"http://www.travutils.com/?s=\" + idioma2 + \"&ida=\" + a;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\t\t\t\t\tigmlink2.style.cssText = 'display: inline; margin-left: 5px; color: #6F84FF';\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t}else if (links[i].href.search(/allianz.php\\?s=2/) > 0){\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = links[i].href;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t} else if (links[i].href.search(/berichte.php\\?id=(\\d+$)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = 'berichte.php?id=' + a;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t} else if (links[i].href.search(/nachrichten.php\\?id=(\\d+$)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = 'nachrichten.php?id=' + a;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t} else if (links[i].href.search(/build.php\\?id=\\d+&t=1&a=(.+$)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = links[i].href;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\t\t\t} else if (links[i].href.search(/a2b.php\\?d=(\\d+)&c=.+$/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = links[i].href;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\t\t\t}\r\n\r\n\t\t\tif (!links[i].className) links[i].className = 'done';\r\n\t\t\tlinks[i].setAttribute('done', 1);\r\n\t\t}\r\n\t}", "function playerLinks(){\n\t\tvar links = document.getElementsByTagName(\"a\");\n\t\tfor(var i = 0; i < links.length; i++){\n\t\t\t// Por cada enlace a una ficha de jugador \n\t\t\tif(links[i].href.search(/spieler.php\\?uid=(\\d+$)/) > 0) {\n if (RegExp.$1 == 0) continue;\n\t\t\t\tif (links[i].parentNode.className == 'menu') continue;\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('uid=' + RegExp.$1), links[i].nextSibling);\n\n\t\t\t\t// Introduce el enlace para enviar mensajes usando su ID\t\n\t\t\t\tvar igmlink = elem('a', \"<img src='data:image/gif;base64,\" + imagenes[\"igm\"] + \"' style='margin:3px 0px 1px 3px; display: inline' title='\" + T('ENVIAR_IGM') + \"' alt='\" + T('ENVIAR_IGM') + \"' border=0>\");\n\t\t\t\tigmlink.href = 'nachrichten.php?t=1&id=' + RegExp.$1;\n//\t\t\t\tlinks[i].parentNode.insertBefore(igmlink, links[i].nextSibling);\n\t\t\t// Por cada enlace a una localizacion del mapa\n\t\t\t}else if (links[i].href.search(/karte.php\\?d=(\\d+)/) > 0){\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('id=' + RegExp.$1), links[i].nextSibling);\n\n\t\t\t\t// Agrega un enlace para lanzar un ataque usando su posicion\n\t\t\t\tvar atklink = elem('a',\"<img src='\" + img(\"a/att_all.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' height='10' width='10' title='\" + T('ATACAR') + \"' alt='\" + T('ATACAR') + \"' border='0'>\");\n\t\t\t\tatklink.href = 'a2b.php?z=' + RegExp.$1;\n\t\t\t\tlinks[i].parentNode.insertBefore(atklink, links[i].nextSibling);\n\t\t\t// Por cada enlace a la ficha de una alianza\n\t\t\t}else if (links[i].href.search(/allianz.php\\?aid=(\\d+$)/) > 0){\n if (RegExp.$1 == 0) continue;\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + RegExp.$1), links[i].nextSibling);\n\t\t\t}\n\t\t}\n\t}", "function omaLinkki(_linkkisana, _linkki) {\n return _linkkisana.link(_linkki)\n}", "function link(x,y){\n return w.B(x,y, 'w', 3, 15).den(1).fric(0).rest(0)\n }", "function obtenerLink(pokemones){\n pokemones.forEach( async pokemon => {\n informacionPokemones(await busquedaAPI(pokemon));\n });\n\n spinner();\n setTimeout(() => {\n iterarPokemones(pokemonesData);\n }, 1000);\n}", "function dragLink(name){\n var listLinks=[];\n if(listSpheres2[name].link.length>0){//that's mean there is a line or more\n for(let k=0;k<listSpheres2[name].link.length;k++){\n listLinks.push(listSpheres2[name].link[k]);//add the number of the link in the listSpheres2.link property\n } \n }\n for(let j=0; j<listLinks.length;j++){ \n updateLink(listLinks[j],1);//delete and add the link\n }\n}", "function link(x,y,col){col=col||'w'\n return w.B(x,y,col,10,15).den(1).fric(0).rest(0)}", "function updateLinks(key) {\n var isSource = key === 'sources';\n var neighbours = edge.get(key);\n neighbours.forEach(\n function(d) {\n // get number of time we meet d\n var neighbour_count = neighbour_counts[key][d];\n if (neighbour_count === undefined) {\n neighbour_count = 0;\n neighbour_counts[key][d] = neighbour_count;\n }\n // increment neighbour count\n neighbour_count++;\n neighbour_counts[key][d] = neighbour_count;\n // get d links\n var links_by_id = d3_edge[key][d];\n if (links_by_id === undefined) {\n links_by_id = {};\n d3_edge[key][d] = links_by_id;\n }\n // if a link is missing\n var links_by_id_length = Object.keys(links_by_id).length;\n if (links_by_id_length < neighbour_count) {\n // create it\n link = {\n isSource: isSource,\n source: isSource? d : d3_edge.id,\n target: (!isSource)? d : d3_edge.id,\n elt: edge, // save edge\n id: this.uuid(), // uuid\n view_pos: d3_graph.links.length // pos in view\n };\n // add in view\n d3_graph.links.push(link);\n d3_graph.data_by_id[link.id] = link;\n // try to inject references to sources\n var source = d3_graph.data_by_id[link.source];\n if (source !== undefined) {\n link.source = source;\n }\n // and targets\n var target = d3_graph.data_by_id[link.target];\n if (target !== undefined) {\n link.target = target;\n }\n // push link in d3_edge model\n links_by_id[link.id] = link;\n }\n },\n this\n );\n // remove useless links\n for (vertice_id in d3_edge[key]) {\n var neighbour_count = neighbour_counts[key][vertice_id];\n var index = 0; // index to start to remove links\n if (neighbour_count !== undefined) {\n index = neighbour_count;\n }\n // delete links from model\n var link_id_to_delete = Object.keys(d3_edge[key][vertice_id]).splice(index);\n link_id_to_delete.forEach(\n function(link_id) {\n var link = d3_graph.data_by_id[link_id];\n // delete from model\n delete d3_edge[key][vertice_id][link_id];\n // delete from view\n delete d3_graph.data_by_id[link_id];\n link_pos_to_delete.push(link.view_pos);\n },\n this\n );\n }\n }", "function link_forward() {\n for (igen=0; igen < ngens-1; igen++) {\n\t if (igen == 0) {\n\t iList1.push(iselect); // This is the number in the comm_id list\n\t nodeList1.push(comm_name[iselect]) // This is the name of the individual nodes \n\t moneyList1.push(0.); \n\t }\n // empty these again\n \tiList2=[];\n\t nodeList2=[];\n\t moneyList2=[];\n \tmakeGen();\n \n // Now group and annotate the individual links\n\t node1_link=[];\n\t node2_link=[];\n\t money_link=[];\n\t tooltip=[];\n\t money_val=[];\n\t tip_str=[];\n\t tooltip_head=[];\n\n\t for (i=0; i < name1_arr.length; i++) {\n\t val1=comm_group[name1_arr[i]];\n\t type1=comm_type[name1_arr[i]];\n\t val2=comm_group[name2_arr[i]];\n\t type2=comm_type[name2_arr[i]];\n if (isLoop(val1,type1,val2,type2) == false) {\n \n if (val1=='PAC') val1='PAC'+igen.toString();\n if (val2=='PAC') val2='PAC'+(igen+1).toString();\n j2=i_comm_name[name2_arr[i]];\n\t\t id=-1;\n\t\t for (j=0; j < node1_link.length; j++) {\n\t\t if ((node1_link[j]==val1) && (node2_link[j]==val2)) id=j;\n\t\t }\n \t\t if (id >=0) {\n\t \t money_link[id]+=money_arr[i];\n\t\t if (money_arr[i] > min_label) {\n\t\t if (money_arr[i] > min_label){\n\t\t money_val[id].push(money_arr[i]);\n\t\t tip_str[id].push('&nbsp;<a onclick=\"doSelected('+j2+')\" href=\"#\">'+name2_arr[i].substring(0,40)+'</a><i> $'+parseInt(money_arr[i]).toLocaleString()+'</i><br>');\n \t\t\t \n\t\t }\n\t\t }\n\t\t \n\t\t } else {\n\t\t node1_link.push(val1);\n\t\t node2_link.push(val2);\n\t\t money_link.push(money_arr[i]);\n\t\t tooltip_head.push('<b>'+val1+'->'+val2);\n\t\t \n \t\t tooltip.push('<div style=\"text-align:left; font-size: 10px; font-family: garamond;\">');\n\t\t money_val.push([money_arr[i]]); \n\t\t tip_str.push(['&nbsp;<a onclick=\"doSelected('+j2+')\" href=\"#\">'+name2_arr[i]+'</a><i> $'+parseInt(money_arr[i]).toLocaleString()+'</i><br>']);\n\t\t }\n\t\t \n\t\t // Do we put the money into a candidate account as well?\n\t\t if (type2 == 'candidates') {\n\t\t name2=name2_arr[i];\n\t\t i2=i_comm_name[name2];\n\t\t k=i_cand_id[comm_cand_id[i2]];\n\t\t myrace=cand_race[k];\n\t\t if (myrace===undefined) myrace='none';\n\t\t if ((myrace.includes('SEN') == false)&&(myrace.includes('PRES')==false)) {\n\t\t if (cand_party[k] == \"DEM\") {\n\t\t if (myrace in dem_money_house) {\n\t\t dem_money_house[myrace]+=money_arr[i];\n\t\t } else {\n\t\t dem_money_house[myrace]=money_arr[i];\n\t\t }\n\t\t \n\t\t } else if (cand_party[k]== \"REP\") {\n\t\t if (myrace in rep_money_house) {\n\t\t rep_money_house[myrace]+=money_arr[i];\n\t\t } else {\n\t\t rep_money_house[myrace]=money_arr[i];\n\t\t }\n\t\t }\n \t\t //console.log(val2,name2,k,cand_name[k],cand_race[k]);\n\t\t }\n\t\t }\n\t\t \n }\n\t }\t \n\t \n\t for (j=0; j < node1_link.length; j++) {\n\t tooltip_head[j]+=' ($'+parseInt(money_link[j]).toLocaleString()+')</b><br>';\n\t \n\t \n\t tmparr=sortWithIndices(money_val[j]);\n\t nk=money_val[j].length;\n\t for (k=0; k < nk; k++) {\n\t k1=tmparr.sortIndices[nk-k-1];\n\t tooltip[j]+=tip_str[j][k1];\n\t }\n\t \n\t \n\t tooltip[j]+=\"</div>\";\n\t data.addRow([node1_link[j],node2_link[j],money_link[j],tooltip_head[j]+tooltip[j]]);\n\t }\n\t iList1=iList2.slice();\n nodeList1=nodeList2.slice();\n \tmoneyList1=moneyList2.slice();\n }\n title_str=comm_name[iselect]+' $'+totalAmt.toLocaleString();\n document.getElementById(\"chart_title\").innerHTML=title_str;\n\n options = {\n\t width: 900,\n\t tooltip: {isHtml: true},\n\t sankey: {\n node: { label: { fontName: 'Garamond',\n fontSize: 14,\n color: '#871b47',\n bold: true } } },\n };\n\n \n // Instantiate and draw our chart, passing in some options.\n chart = new google.visualization.Sankey(document.getElementById('chart_div'));\n chart.draw(data, options);\n \n if (doMap == true) {\n map_allInvisible();\n map_changeColorScheme('red_blue');\n moneymax=0.\n for (key in dem_money_house) {\n money=dem_money_house[key];\n if (key in rep_money_house) {\n money+=rep_money_house[key];\n }\n if (money > moneymax) moneymax=money;\n }\n for (key in rep_money_house) {\n money=rep_money_house[key];\n if (money > moneymax) moneymax=money;\n }\n console.log(moneymax);\n \n for (key in dem_money_house) {\n dmoney=dem_money_house[key];\n if (key in rep_money_house) {\n rmoney=rep_money_house[key];\n } else {\n rmoney=0.\n }\n if (key in map_bounds) { // really should be a function\n wgt=Math.sqrt((dmoney+rmoney)/moneymax);\n val=(dmoney)/(dmoney+rmoney);\n map_setVal(key,val);\n map_setWeight(key,wgt);\n map_changeVisible(key,true);\n }\n }\n for (key in rep_money_house) {\n rmoney=rep_money_house[key];\n if ((key in dem_money_house) == false) {\n if (key in map_bounds) {\n val=0.;\n wgt=Math.sqrt(rmoney/moneymax);\n map_setVal(key,val);\n map_setWeight(key,wgt); \n map_changeVisible(key,true);\n }\n }\n }\n \n }\n \n \n \n}", "crtajGlavniDeo(host)\n {\n //3 dela\n var navigacija2 = document.createElement(\"div\");\n navigacija2.className=\"Navigacija2\";\n host.appendChild(navigacija2); // levo 25%\n\n\n var ul1 = document.createElement(\"ul\");\n ul1.className =\"LevaNavigacija\";\n navigacija2.appendChild(ul1);\n\n //prvi\n var li_1 = document.createElement(\"li\");\n li_1.className=\"navigacija2_li\";\n ul1.appendChild(li_1);\n var a_1 = document.createElement('a');\n var Pregled_Kolaca = document.createTextNode(\"Pregled svih kolaca\");\n a_1.appendChild(Pregled_Kolaca);\n a_1.className=\"LinkLevo\";\n a_1.title= \"Prikazi sve kolace\";\n a_1.onclick = function() {}\n li_1.appendChild(a_1);\n\n //drugi\n var li_2 = document.createElement(\"li\");\n li_2.className=\"navigacija2_li\";\n ul1.appendChild(li_2);\n var a_2 = document.createElement('a');\n var Pregled_Kolaca = document.createTextNode(\"TEMA\");\n a_2.appendChild(Pregled_Kolaca);\n a_2.className=\"LinkLevo\";\n a_2.title= \"Odaberite temu\";\n a_2.onclick = function() {}\n li_1.appendChild(a_2);\n\n //treci\n var li_3 = document.createElement(\"li\");\n li_3.className=\"navigacija2_li\";\n ul1.appendChild(li_3);\n var a_3 = document.createElement('a');\n var Pregled_Kolaca = document.createTextNode(\"Narucivanje\");\n a_3.appendChild(Pregled_Kolaca);\n a_3.className=\"LinkLevo\";\n a_3.title= \"kliknite da biste izabrali kolaz za narucivanje\";\n\n a_3.onclick = function() {}\n li_1.appendChild(a_3);\n\n //desni deo sa slikama\n const RadniDeo = document.createElement(\"div\");\n RadniDeo.className=\"RadniDeo\"; // to je srednji deo taj\n host.appendChild(RadniDeo); // desno 50%\n\n this.listaArtikla.forEach(el => {\n var a=document.createElement(\"div\");\n a.className=\"PoljeArtikla\";\n RadniDeo.appendChild(a);\n\n var l=document.createElement(\"label\");\n l.className=\"NazivArtikla\";\n l.innerHTML=el.Naziv;\n a.appendChild(l);\n\n var s=document.createElement(\"img\");\n s.className=\"SlikaArtikla\";\n s.src=el.Slika;\n a.appendChild(s);\n\n var c=document.createElement(\"label\");\n c.className=\"cenaArtikla\";\n c.innerHTML=\"Cena:\"+el.Cena;\n a.appendChild(c);\n\n var ulaz=document.createElement(\"input\");\n ulaz.className=\"brojArtikla\";\n ulaz.type=\"number\";\n ulaz.defaultValue=\"1\";\n a.appendChild(ulaz);\n\n var dugmeDodaj=document.createElement(\"button\");\n dugmeDodaj.className=\"dodajDugme\";\n dugmeDodaj.innerHTML=\"Dodaj u korpu\";\n a.appendChild(dugmeDodaj);\n });\n\n\n//deo za Korpu koji je 25% glavnog dela\n\n const korpa=document.createElement(\"div\");\n korpa.className=\"Korpa\";\n korpa.innerHTML=\"Korpa\";\n host.appendChild(korpa); \n }", "function getl () {\r\n\r\n \r\nvar linksx = [];\r\nvar index, diffx;\r\n \r\nfor (var x = 0; x < nodesg.length; ++x) {\r\n(blocks[x] == undefined) ? blocks[x] = 0 : {};\r\n};\r\nfor (var j = 0; j < nodesg.length; ++j) {\r\nbestbl = Math.max.apply(null, blocks);\r\ndiffx = blocks[j] - bestbl;\r\nind = blocks.indexOf(bestbl);\r\n\r\n\r\n(blocks[j] == 0) ? nodesg[j].color = 'Red' :\r\n(diffx < -100) ? nodesg[j].color = 'OrangeRed' :\r\n(diffx < -10) ? nodesg[j].color = 'DarkOrange' : \r\n(diffx < -3) ? nodesg[j].color = 'Yellow' : \r\n(diffx <= 0) ? nodesg[j].color = 'Lime' : {}\r\n \r\n try {\r\n\r\n for (var k of peersx[j]) { \r\n index = ips.indexOf(k.address);\r\n if (~index) {\r\n if (blocks[index] == 0) continue //detect unreachable nodes\r\n linksx.push({\r\n source : nodesg[j].id,\r\n target : nodesg[index].id\r\n })\r\n } \r\n }\r\n } catch(e) {continue} \r\n };\r\n\r\n timerun(ind); // run timer\r\n runbest();\r\n\r\n // draw graph\r\n const gData = {\r\n nodes: nodesg,\r\n links: linksx\r\n };\r\n \r\n const elem = document.getElementById('dg');\r\n const Graph = ForceGraph3D()\r\n // { controlType: 'orbit' }\r\n (elem)\r\n .graphData(gData)\r\n .width(850)\r\n .height(500)\r\n .backgroundColor('#212A3F')\r\n .nodeLabel('id')\r\n .nodeResolution(16)\r\n .linkWidth(1)\r\n .linkDirectionalParticles(10)\r\n .onNodeHover(node => elem.style.cursor = node ? 'pointer' : null)\r\n .onNodeClick(node => {\r\n // Aim at node from outside it\r\n const distance = 40;\r\n const distRatio = 1 + distance/Math.hypot(node.x, node.y, node.z);\r\n Graph.cameraPosition(\r\n { x: node.x * distRatio, y: node.y * distRatio, z: node.z * distRatio }, // new position\r\n node, // lookAt ({ x, y, z })\r\n 3000 // ms transition duration\r\n );\r\n });\r\n\r\n}", "function atLinks() {\n linklist = [\"239MTG\", \"affinityforartifacts\", \"alliesmtg\", \"AllStandards\", \"Alphabetter\", \"Amonkhet\", \"architectMTG\", \"ArclightPhoenixMTG\", \"aristocratsMTG\", \"BadMTGCombos\", \"basementboardgames\", \"BaSE_MtG\", \"BudgetBrews\", \"budgetdecks\", \"BulkMagic\", \"cardsphere\", \"casualmtg\", \"CatsPlayingMTG\", \"CircuitContest\", \"cocomtg\", \"CompetitiveEDH\", \"custommagic\", \"DeckbuildingPrompts\", \"edh\", \"EDHug\", \"EggsMTG\", \"ElvesMTG\", \"enchantress\", \"EsperMagic\", \"findmycard\", \"fishmtg\", \"FlickerMTG\", \"freemagic\", \"goblinsMTG\", \"HamiltonMTG\", \"HardenedScales\", \"humansmtg\", \"infect\", \"johnnys\", \"kikichord\", \"lanternmtg\", \"lavaspike\", \"locketstorm\", \"lrcast\", \"magicarena\", \"Magicdeckbuilding\", \"MagicDuels\", \"magicTCG\", \"magicTCG101\", \"MakingMagic\", \"marchesatheblackrose\", \"marduMTG\", \"MentalMentalMagic\", \"millMTG\", \"ModernLoam\", \"modernmagic\", \"ModernRecMTG\", \"modernspikes\", \"ModernZombies\", \"monobluemagic\", \"mtg\", \"MTGAngels\", \"mtgbattlebox\", \"mtgbracket\", \"mtgbrawl\", \"mtgbudgetmodern\", \"mtgcardfetcher\", \"mtgcube\", \"MTGDredge\", \"mtgfinalfrontier\", \"mtgfinance\", \"mtgfrontier\", \"mtglegacy\", \"MTGManalessDredge\", \"MTGMaverick\", \"mtgmel\", \"mtgrules\", \"mtgspirits\", \"mtgtreefolk\", \"mtgvorthos\", \"neobrand\", \"nicfitmtg\", \"oathbreaker_mtg\", \"oldschoolmtg\", \"pauper\", \"PauperArena\", \"PauperEDH\", \"peasantcube\", \"PennyDreadfulMTG\", \"PioneerMTG\", \"planeshiftmtg\", \"ponzamtg\", \"RatsMTG\", \"RealLifeMTG\", \"RecklessBrewery\", \"rpg_brasil\", \"scapeshift\", \"shittyjudgequestions\", \"sistersmtg\", \"skredred\", \"Sligh\", \"spikes\", \"stoneblade\", \"StrangeBrewEDH\", \"SuperUltraBudgetEDH\", \"therandomclub\", \"Thoptersword\", \"threecardblind\", \"TinyLeaders\", \"TronMTG\", \"UBFaeries\", \"uwcontrol\", \"xmage\", \"reddit.com/message\", \"reddit.com/user/MTGCardFetcher\"]\n\n for (j = 0; j < linklist.length; j++) {\n if (location.href.toLowerCase().includes(linklist[j].toLowerCase()))\n return true;\n }\n return false;\n}", "trackLinkBy(index, link) {\n return link.id;\n }", "linkAll(stiff) {\n let half = this.length / 2;\n for (let i = 0, len = this.length; i < len; i++) {\n let n = (i >= len - 1) ? 0 : i + 1;\n this.link(i, n, stiff);\n if (len > 4) {\n let nd = (Math.floor(half / 2)) + 1;\n let n2 = (i >= len - nd) ? i % len : i + nd;\n this.link(i, n2, stiff);\n }\n if (i <= half - 1) {\n this.link(i, Math.min(this.length - 1, i + Math.floor(half)));\n }\n }\n }", "function permalink() {\r\n\tvar link = document.getElementsByTagName(\"input\")[64].value;\r\n\tlink = link.replace(\" \", \"\");\r\n\tlink = link.replace(new RegExp(\".awdid=.\",\"i\"), '');\r\n\tlink = link.replace(new RegExp(\"[a-z]+\",\"g\"), '');\r\n\t\r\n\tvar full_link = 'http://mediatheque.mairie-saintnazaire.fr/uPortal/Initialize?uP_reload_layout=true&uP_tparam=props&uP_sparam=activeTab&activeTab=2&showBrief=true&link=full' + link + '&currentPosition=0&searchTargetId=16';\r\n\t\r\n\tif ((link != \"<Péé\")&&(link != \"\")&&(link != \"MOTSCLES\")) {\r\n\t\t// Affichage Permalien\r\n\t\tnewtd = document.createElement(\"td\");\r\n\t\tnewtd.id = 'permalien';\r\n\t\tnewtd.innerHTML = '&nbsp;&nbsp;<img src=\"http://antoinev.alwaysdata.net/link.png\"/> <a target=\"_blank\" href=\"' +full_link+'\">Permalien</a><br /><br />';\r\n\t\tdocument.getElementsByTagName(\"table\")[19].appendChild(newtd);\r\n\t\t}\r\n}", "function fnVoltarLink() {\r\n\tvar oLink = document.links[0];\r\n\toLink.innerHTML = \"Pegar Feeds\";\r\n\toLink.className = \"\";\r\n\toLink.onclick = fnGo;\r\n}", "function linkClick(link) {\n\t\tsubjectRead(subjects);\n\t\t$(links[link]).css(\"z-index\",\"1\");\n\t\t$(links[link]).css(\"opacity\",\"1\");\n\t\t$(link).css(\"background-color\",\"#8C6954\");\n\t\t$(link).css(\"color\",\"white\");\n\t\t$.each(links, function (key,value)\n\t\t{\n\t\t\tif (key!=link)\n\t\t\t{\n\t\t\t\t$(links[key]).css(\"z-index\",\"0\");\n\t\t\t\t$(links[key]).css(\"opacity\",\"0\");\n\t\t\t\t$(key).css('background-color','#59323C');\n\t\t\t\t$(key).css(\"color\",\"#F2EEB3\");\n\t\t\t}\n\t\t});\n\t}", "function eLink(db,nm) {\n\tdbs = new Array(\"http://us.battle.net/wow/en/search?f=wowitem&q=\",\"http://www.wowhead.com/?search=\");\n\tdbTs = new Array(\"Armory\",\"Wowhead\");\n\tdbHs = new Array(\"&real; \",\"&omega; \");\n\tel = '<a href=\"'+ dbs[db]+nm + '\" target=\"_blank\" title=\"'+ dbTs[db] +'\">'+ dbHs[db] + '</a>';\n\treturn el;\n}", "function changelinkElementFromBtn(btnElement) {\n let text = 'Commander la ';\n let destination = '';\n\n if (isSwitchBtn(btnElement)) {\n text += 'Nintendo Switch';\n destination = 'https://jeux-video.fnac.com/s470484/Nintendo-Switch';\n } else {\n text += 'Wii U ';\n destination = 'https://jeux-video.fnac.com/s302189/Wii-U';\n }\n\n // change Link's label and destination accordingly\n changelinkLabel(text);\n changelinkDestination(destination);\n }", "function setUrlAdr(link) {\n //url_adr = link.onclick;\n if (link.onclick !== null) { url_adr = link.onclick.toString().split(\"'\")[1]; }\n else {url_adr = link.href.toString().split(\"#\")[1];}\n}", "function updateLink(input, link) {\r\n link.hidden = !input.value;\r\n //if($('#enc_to [id=\"to_text\"]').hasClass('active')){\t//хочу что сохранялись байты а не утф.\r\n \r\n link.href = \"data:text/plain;charset=UTF-8,\" + encodeURI(input.value); //<-- data in href, as UTF-8 text.\r\n link.onclick = '';\r\n link.style.display = (input.value==='') ? 'none' : 'block';\r\n}", "function linkClicado() {\n\tvar clink = document.getElementById(\"clink\");\n\t\tclink.onclick = function() {\n\t\tvar query = this.getAttribute(\"href\").split(\"?\")[1];\n\t\tvar arquivo = \"destaque.php?\"+(query);\n\t\treturn !requisitar(arquivo);\n\t\t};\n\t}", "function getLink( item_data, pos ) {\r\n \r\n // Số thự tự lần gửi request\r\n if(pos == null) {\r\n pos = 1;\r\n }\r\n //lấy item_id\r\n var item_id = getItemId();\r\n //lấy item_title\r\n var item_title = getItemTitle();\r\n //lấy item_image\r\n var item_image = getItemImage();\r\n //lấy item_link\r\n var item_link = getItemLink();\r\n //lấy seller_id\t\r\n var seller_id = getSellerId();\r\n var seller_name = seller_id;\r\n //lay comment\r\n var comment = getComment();\r\n //lay ban gia\r\n var price_table = getPriceTable();\r\n\r\n // lay gia\r\n var item_price = getPrice(item_data[0]);\r\n // Multi buy\r\n var tbl_wrap = document.getElementsByClassName('content-wrapper');\r\n if(tbl_wrap.length > 0) {\r\n if(tbl_wrap[0].getElementsByClassName('content').length > 0) {\r\n item_price = item_data[4];\r\n }\r\n }\r\n\r\n var params = 'type=alibaba';\r\n if(parseInt(item_id) >0 ) params += '&item_id=' + item_id;\r\n if(item_title != '') params += '&item_title=' + item_title;\r\n if(item_image != '') params += '&item_image=' + item_image;\r\n if(comment != '') params += '&comment=' + comment;\r\n if(item_link != '') params += '&item_link=' + item_link;\t\r\n if(item_price > 0) params += '&item_price=' + item_price;\r\n if(price_table != '') params += '&price_table=' + price_table;\t\r\n if(seller_id.length > 0) {\r\n params+='&seller_id='+seller_id;\r\n }\r\n if(seller_name.length > 0) {\r\n params+='&seller_name=' + seller_name;\r\n }\r\n\r\n if(parseInt(item_data[0]) > 0)\r\n params += '&quantity=' + item_data[0];\r\n delete item_data[0];\r\n\r\n if(parseInt(item_data[1]) > 0)\r\n params += '&min=' + item_data[1];\r\n delete item_data[1];\r\n\r\n // Lay color_size_name\r\n if(item_data[2] != \"\") {\r\n params += '&size=' + item_data[2];\r\n }\r\n if(item_data[3] != \"\") {\r\n params += '&color=' + encodeURIComponent(item_data[3]);\r\n }\r\n var color_size_name = item_data[3] + \";\" + item_data[2];\r\n if(color_size_name != '')\r\n params += '&color_size_name=' + encodeURIComponent(color_size_name);\r\n\r\n // Number post send\r\n params += '&pos=' + pos;\r\n params += '&length_pos=' + get_item_data().length;\r\n return addVersion(params);\r\n }", "function zapiszLSlinki(title,link){\n\t\tvar max_links=14;\n\t\tvar get_linki=window.localStorage.getItem('_rss_linki');\n\t\tif (get_linki) {\n\t\t\tvar arr=JSON.parse(get_linki);\n\t\t\tvar ile=arr.length;\n\t\t\tif (ile>max_links) {arr.shift();arr.shift();}\n\t\t\t} else arr=[];\n\t\tvar store_linki=arr;\t\n\t\tarr.push({'title':title, 'link':link})\n\t\tstore_linki=JSON.stringify(store_linki);\n\t\twindow.localStorage.setItem('_rss_linki',store_linki);\n\t}", "function navigasiDijkstra(start, end,jelajah,jalur) {\r\n\t if(jalur == '1'){\r\n\t\t\tvar request = {\r\n\t\t origin: start,\r\n\t\t destination: end,\r\n\t\t optimizeWaypoints: true,\r\n\t\t travelMode: google.maps.TravelMode[jelajah],\r\n\t\t avoidTolls:true\r\n\t\t };\r\n\t\t}else if(jalur == '2'){\r\n\t\t\tvar request = {\r\n\t\t origin: start,\r\n\t\t destination: end,\r\n\t\t optimizeWaypoints: true,\r\n\t\t travelMode: google.maps.TravelMode[jelajah],\r\n\t\t avoidHighways:true\r\n\t\t };\r\n\t\t}else{\r\n\t\t\tvar request = {\r\n\t\t origin: start,\r\n\t\t destination: end,\r\n\t\t optimizeWaypoints: true,\r\n\t\t travelMode: google.maps.TravelMode[jelajah]\r\n\t\t };\r\n\t\t}\r\n\r\n\t directionsService.route(request, function (result, status) {\r\n\t if (status == google.maps.DirectionsStatus.OK) {\r\n\t directionsDisplay.setDirections(result);\r\n\t var leg = result.routes[ 0 ].legs[ 0 ];\r\n \t\t\t\tvar leg_start = $scope.makeMarker( leg.start_location, new google.maps.MarkerImage(icon.mylocation), \"Mulai\" );\r\n\t //$scope.setAllMap(null);\r\n\t }\r\n\t });\r\n\t verteks.splice(0,verteks.length);\r\n\t verteks_zero.splice(0,verteks_zero.length);\r\n\t}", "async function naVrsti() {\n // Preveri za konec igre\n let zm = await zmagovalec();\n if (zm != \"undefined\") {\n if (Number(zm) == igralec) {\n location.replace('/igra/zmaga');\n } else {\n location.replace('/igra/zguba');\n }\n return;\n }\n\n // Posodobi stanje bitke\n await zapolniTabelo();\n\n lahkoNapada = true;\n\n document.getElementById(\"besedilo\").innerText = \"Tunkaj ladje!\";\n document.getElementById(\"hnapad\").classList.add(\"border-info\");\n document.getElementById(\"hdomace\").classList.remove(\"border-info\");\n }", "function getMLDonkeyLink(links) {\r\n\t// Url to add ed2k links to mldonkey\r\n\treturn emuleUrl + \"submit?jvcmd=multidllink&links=\" + links;\r\n}", "function setLinkIndexAndNum()\n {\n for (var i = 0; i < finalResult[1].length; i++)\n {\n if (i != 0 &&\n finalResult[1][i].source == finalResult[1][i - 1].source &&\n finalResult[1][i].target == finalResult[1][i - 1].target)\n {\n finalResult[1][i].linkindex = finalResult[1][i - 1].linkindex + 1;\n }\n else\n {\n finalResult[1][i].linkindex = 1;\n }\n // save the total PhoneNumberber of links between two nodes\n if (mLinkNum[finalResult[1][i].target + \",\" + finalResult[1][i].source] !== undefined)\n {\n mLinkNum[finalResult[1][i].target + \",\" + finalResult[1][i].source] = finalResult[1][i].linkindex;\n }\n else\n {\n mLinkNum[finalResult[1][i].source + \",\" + finalResult[1][i].target] = finalResult[1][i].linkindex;\n }\n }\n }", "function scanLinks() {\r\n\t\tvar links = getLinks();\r\n\r\n\t\tfor (var i=0; i < links.length; i++){\r\n\t\t\tvar link = links[i];\r\n\t\t\tif (match(link.href)) {\r\n\t\t\t\t// do private link first so it appears after normal link\r\n\t\t\t\tif (wtorrent_showprivatelinks == true && wtorrent_alwaysdownloadprivate == false) {\r\n\t\t\t\t\tvar wTorrentPrivateLink = makeWTorrentLink(link,true);\r\n\t\t\t\t\tlink.parentNode.insertBefore(wTorrentPrivateLink, link.nextSibling);\r\n\t\t\t\t\t}\r\n\t\t\t\t// normal wTorrent link\r\n\t\t\t\tvar wTorrentLink = makeWTorrentLink(link,false);\r\n\t\t\t\tlink.parentNode.insertBefore(wTorrentLink, link.nextSibling);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "function calcLink(d) {\n return LINK_CONSTANT * (Math.sqrt(d.cluster.nodes.length + 1) + 0.5);\n}", "function getLink() {\n const idx = Math.floor(Math.random()*links.length);\n document.getElementById(\"link\").href = links[idx];\n}", "async function click(_event) {\n let vorschau = document.getElementById(\"vorschau\");\n clickCount += 1;\n let target = _event.currentTarget;\n let index = Number(target.dataset.index);\n document.getElementById(\"vorschau\").style.display = \"block\";\n let meineDaten = await konvertiereJSONinEinObjekt(url);\n if (clickCount == 1) {\n auswahlBroetchenTop = meineDaten.broetchenTop[index];\n auswahl = auswahlBroetchenTop;\n key = \"BrötchenTop: \";\n document.getElementById(\"auswahlFenster\").innerHTML = \"\";\n auswahlMoeglichkeiten(meineDaten.broetchenBottom);\n let bildVorschau = document.createElement(\"img\");\n bildVorschau.src = auswahl.bild;\n vorschau.appendChild(bildVorschau);\n }\n if (clickCount == 2) {\n möglichkeit.innerHTML = \"Pattie\";\n auswahlBroetchenBottom = meineDaten.broetchenBottom[index];\n auswahl = auswahlBroetchenBottom;\n key = \"BrötchenBottom: \";\n document.getElementById(\"auswahlFenster\").innerHTML = \"\";\n auswahlMoeglichkeiten(meineDaten.patties);\n let bildVorschau = document.createElement(\"img\");\n bildVorschau.src = auswahl.bild;\n vorschau.appendChild(bildVorschau);\n }\n if (clickCount == 3) {\n möglichkeit.innerHTML = \"Soße\";\n auswahlPattie = meineDaten.patties[index];\n auswahl = auswahlPattie;\n key = \"Pattie: \";\n document.getElementById(\"auswahlFenster\").innerHTML = \"\";\n auswahlMoeglichkeiten(meineDaten.sossen);\n let bildVorschau = document.createElement(\"img\");\n bildVorschau.src = auswahl.bild;\n vorschau.appendChild(bildVorschau);\n }\n if (clickCount == 4) {\n möglichkeit.style.display = \"none\";\n auswahlSosse = meineDaten.sossen[index];\n auswahl = auswahlSosse;\n key = \"Sosse: \";\n sessionStorage.setItem(key, JSON.stringify(auswahl));\n document.getElementById(\"auswahlFenster\").innerHTML = \"\";\n document.getElementById(\"vorschau\").style.display = \"none\";\n document.location.href = \"burger.html\";\n }\n // Aufgabe 1b) Speichere die Auswahlmöglichkeit im Browser-Cache\n sessionStorage.setItem(key, JSON.stringify(auswahl));\n }", "function visUre() {\n container.textContent = \"\";\n alleUre.forEach((ur) => {\n if (filter == ur.Farve || filter == \"alle\") {\n let klon = temp.cloneNode(true).content;\n klon.querySelector(\"img\").src = \"images/\" + ur.Billede + \".webp\";\n klon.querySelector(\".navn\").textContent = ur.Navn;\n klon.querySelector(\".farve\").textContent = ur.Farve;\n klon.querySelector(\".pris\").textContent = ur.Pris + \",-\";\n klon.querySelector(\"article\").addEventListener(\"click\", () => {\n location.href = \"produkter_detaljer.html?id=\" + ur._id;\n });\n\n container.appendChild(klon);\n }\n });\n}", "function printlink() {\n\t\t\t\tvar linkElem = $('#inspo');\n\t\t\t\tlinkElem.html(links[randomlink].text);\n\t\t\t}", "function setLinkIndexAndNum(){\n for (var i = 0; i < g.links.length; i++){\n if (i != 0 &&\n g.links[i].source == g.links[i-1].source &&\n g.links[i].target == g.links[i-1].target)\n {\n g.links[i].linkindex = g.links[i-1].linkindex + 1;\n }else{\n g.links[i].linkindex = 1;\n }\n // save the total number of links between two nodes\n\t\t\t//console.log(g.links[i])\n if(mLinkNum[g.links[i].target + \",\" + g.links[i].source] !== undefined){\n mLinkNum[g.links[i].target + \",\" + g.links[i].source] = g.links[i].linkindex;\n }else{\n mLinkNum[g.links[i].source + \",\" + g.links[i].target] = g.links[i].linkindex;\n }\n }\n }", "function sendLinks() {\n const resultLink = $(\"#resultlink\").serialize();\n const voteLink = $(\"#polllink\").serialize();\n $.ajax({\n method: \"GET\",\n url: \"/links\",\n data: resultLink + voteLink,\n dataType: \"json\",\n success: function (result) {\n console.log(\"it was success \", result);\n },\n error: function (err) {\n console.log(\"we are in an error\", err);\n }\n })\n }", "function Dzialaj_dbw()\r\n{\r\n//dodaj potrzebne funkcje do kodu strony\r\nDodajelem(document.body, 'script', {'type':'text/javascript'}, \"function Dodajelem(tojciec, ttyp, tparams, ttext) { var temp_elem = document.createElement(ttyp); for(var key in tparams) temp_elem.setAttribute(key, tparams[key]); if (ttext!=null) temp_elem.innerHTML = ttext; tojciec.appendChild(temp_elem); }\");\r\nDodajelem(document.body, 'script', {'type':'text/javascript'}, \"function post_to_url(path, params, method) { method = method || 'post'; var form = document.createElement('form'); form.setAttribute('method', method); form.setAttribute('action', path); form.setAttribute('target', '_blank'); for(var key in params) Dodajelem(form, 'input', {'type':'hidden','name':key,'value':params[key]},null); Dodajelem(form, 'input', {'type':'submit','name':'submit','id':'dbw_submit'},null); document.body.appendChild(form); $$('dbw_submit').click(); document.body.removeChild(form); }\");\r\n\r\nvar czi1 = 0, czi2 = 0, czi3 = 0; //czi -> chwilowa zmienna integer\r\nvar bw_domena = Ustaldomene();\r\nvar tab_elem = document.getElementsByTagName(\"div\");\r\nvar temp_str = \"\";\r\n\tfor (var i=0;i<tab_elem.length;i++) {\r\n\tif (tab_elem[i].className == \"msg-content msg-quest\") {\r\n\t\tvar temp_tab2=tab_elem[i].getElementsByTagName(\"img\");\t//<<--- ADDED\r\n\t\tif (temp_tab2.length>0) {\r\n\t\ttab_elem = document.getElementsByTagName(\"a\"); //szukamy linka do wiadomosci\r\n\t\tfor (var i=0;i<tab_elem.length;i++) {\r\n\t\t\tif (tab_elem[i].innerHTML.indexOf('showmsg.php')>-1 && tab_elem[i].getAttribute('target')!='_blank') { //link do raportu\r\n\t\t\t\ttab_elem[i].parentNode.innerHTML = tab_elem[i].parentNode.innerHTML + '<br /><br />'+text_jezyk[bw_domena][0]+'<br />';\r\n\t\t\t\tvar temp_str = \"javascript:post_to_url('https://spreadsheets.google.com/spreadsheet/formResponse?hl=en_US&formkey=dEFoT2NaMkRuaEM4NExZZDZnODQwYVE6MQ&ifq',{'entry.0.single':'\"+tab_elem[i].innerHTML.replace(/&amp;/g, '&')+\"','entry.1.single':'\"+Zwroc_adres_kloca()+\"'});\";\r\n\t\t\t\tDodajelem(tab_elem[i].parentNode, 'a', {'href':'JavaScript:void(0);','onclick':temp_str},text_jezyk[bw_domena][1]+' \"Global Quest Stats\"');\r\n\t\t\t\tbreak; }\r\n\t\t}\r\n\t\tbreak; }\r\n\t}\r\n\t}\r\n} //koniec Dzialaj_dbw()", "function do_links( link_snap, get_char, header ) {\r\n var link_letter_order = []\r\n\r\n\r\n for( var i = 0; i< link_snap.snapshotLength; i++ ) {\r\n var link = link_snap.snapshotItem(i)\r\n\r\n var char = get_char(link)\r\n\r\n if( ! char ) continue\r\n\r\n // if the char is different from the last char...\r\n if( link_letter_order.length == 0 || char != link_letter_order[link_letter_order.length-1] ) {\r\n link_letter_order.push( char )\r\n\r\n var s = $e('div')\r\n s.style.background = '#aaa'\r\n s.style.borderTop = 'solid #777 1px'\r\n\r\n s.style.padding = '3px'\r\n s.style.marginTop = '20px'\r\n s.style.marginBottom = '-7px'\r\n\r\n s.innerHTML = \" &middot; \"\r\n\r\n var a = mk_link(char)\r\n a.name = char\r\n\r\n var top = mk_link('^top')\r\n top.target = '_self'\r\n\r\n\r\n s.appendChild( a )\r\n s.appendChild( $t(' ') )\r\n s.appendChild( top )\r\n\r\n var br = $e('br')\r\n\r\n link.parentNode.insertBefore(br,link)\r\n link.parentNode.insertBefore(s,br)\r\n \r\n /* link.parentNode.insertBefore($e('hr'),s) */\r\n }\r\n }\r\n\r\n for( var j=0; j<link_letter_order.length; j++ ) {\r\n var char = link_letter_order[j]\r\n header.innerHTML += \" <a href='#\" + char + \"' target='_self' style='color:#999'>\" + char + \"</a>\"\r\n }\r\n}", "function makeAllLink(){\n if(isTVShow)\n var allButtons=makeaLink(IMG1337x,URLTv1337x,itemName,\"1337x\");\n else\n var allButtons=makeaLink(IMG1337x,URL1337x,itemName,\"1337x\");\n allButtons+=\"|\";\n allButtons+=makeaLink(IMGPirateBay, URLPirateBay,itemName,\"TPB\");\n allButtons+=\"|\";\n allButtons+=makeaLink(IMGTorrentz2,URLTorrentz2,itemName, \"Torrentz2\");\n return allButtons;\n }", "TrafferTrafficAfterHoming(nodei, nodej, home){\n //console.log(\"Home của \" + nodei.label + \" và \" + nodej.label + \" là: \" + home.label)\n let t = 0;\n nodei.processingTraffic.forEach((tra) => {\n if(tra.label == nodej.label){\n t += tra.traffic\n }\n if(tra.label == home.label){\n t += tra.traffic\n }\n });\n\n\n // console.log(t)\n\n nodei.processingTraffic.forEach((tra) => {\n if(tra.label == home.label){\n tra.traffic = t + tra.traffic;\n }\n });\n\n if(nodei.newEraTraffic.length == 0){\n let traf = new Traffic(home.label, t)\n nodei.newEraTraffic.push(traf)\n }else{\n let countForNewEra = 0;\n nodei.newEraTraffic.forEach((traff) => {\n if(traff.label == home.label){\n countForNewEra ++;\n traff.traffic += t;\n }\n });\n\n if(countForNewEra == 0){\n let traf = new Traffic(home.label, t)\n nodei.newEraTraffic.push(traf)\n }\n\n }\n\n }", "get link() {\n\t\treturn this.__link;\n\t}", "function setLinkOrientation() {\n\n for (var i = 0, n = links.length; i < n; i++) {\n if (vertical) {\n // vertical scheme\n /*switch (getTipoNo(links[i].target)) {\n // CVM && PAT priority is highest\n case 'CVM':\n case 'PAT':\n links[i] = switchLinks(links[i]);\n break;\n // ATE && CEMU priority is second highest\n case 'ATE':\n if (getTipoNo(links[i].source) != 'CVM' || getTipoNo(links[i].source) != 'PAT' || getTipoNo(links[i].source) != 'CP')\n links[i] = switchLinks(links[i]);\n break;\n case 'CEMU':\n if (getTipoNo(links[i].source) == 'CVM' || getTipoNo(links[i].source) == 'PAT' || getTipoNo(links[i].source) == 'CP')\n links[i] = switchLinks(links[i]);\n break;\n // CP priority is third highest\n case 'CP':\n if (getTipoNo(links[i].source) != 'CVM' || getTipoNo(links[i].source) != 'PAT')\n links[i] = switchLinks(links[i]);\n break;\n // CC priority is fourth highest\n case 'CC':\n if (getTipoNo(links[i].source) != 'ATE' || getTipoNo(links[i].source) == 'CP')\n links[i] = switchLinks(links[i]);\n break;\n }*/\n\n switch (getTipoNo(links[i].source)) {\n // CVM && PAT priority is highest\n case 'CVM':\n case 'PAT':\n if (getTipoNo(links[i].target) != 'CP' && getTipoNo(links[i].target) != 'ATE')\n links[i] = switchLinks(links[i]);\n break;\n // ATE && CEMU priority is second highest\n case 'ATE':\n if (getTipoNo(links[i].target) != 'CC')\n links[i] = switchLinks(links[i]);\n break;\n case 'CEMU':\n if (getTipoNo(links[i].target) == 'CVM' && getTipoNo(links[i].source) == 'PAT' && getTipoNo(links[i].source) == 'CP')\n links[i] = switchLinks(links[i]);\n break;\n // CP priority is third highest\n case 'CP':\n if (getTipoNo(links[i].target) != 'CC' && getTipoNo(links[i].target) != 'ATE')\n links[i] = switchLinks(links[i]);\n break;\n // CC priority is third highest\n case 'CC':\n links[i] = switchLinks(links[i]);\n break;\n }\n } else {\n // horizontal scheme\n switch (getTipoNo(links[i]['target'])) {\n // CVM && PAT priority is highest\n case 'CVM':\n case 'PAT':\n links[i] = switchLinks(links[i]);\n break;\n // ATE && CEMU priority is second highest\n case 'ATE':\n case 'CEMU':\n if (getTipoNo(links[i].source) == 'CVM' || getTipoNo(links[i].source) == 'PAT')\n links[i] = switchLinks(links[i]);\n break;\n // ATI priority is third highest\n //case 'ATI':\n // CC priority is third highest\n case 'CC':\n if (getTipoNo(links[i].source) == 'CVM' || getTipoNo(links[i].source) == 'PAT' || getTipoNo(links[i].source) == 'ATE')\n links[i] = switchLinks(links[i]);\n break;\n }\n }\n }\n\n // compute paths to endpoints\n if (links.length > 0) {\n\n // select the source node\n var start = firstOfType('CVM');\n if (start == -1)\n start = firstOfType('ATE');\n //if (start == -1)\n // start = firstOfType('ATI');\n if (start == -1)\n start = firstOfType('CC');\n if (start != -1) {\n\n for (i = 0, n = nodes.length; i < n; i++) {\n if (neighbourNodes(i, []).length == 1 && getTipoNo(nodes[i]) == 'CP' || getTipoNo(nodes[i]) == 'TT') {\n\n // get the path from the ati to the node\n var path = findPath(start, nodes[i].id - 1, neighbourNodes(start, []), []);\n\n // update source and target\n for (var j = 0, m = path.length - 1; j < m; j++)\n for (var k = 0; k < links.length; k++)\n if (compareNodes(links[k].source, nodes[path[j]]) && compareNodes(links[k].target, nodes[path[j + 1]]))\n switchLinks(links[k]);\n }\n }\n }\n }\n\n // PAT -> [ATE,ATI]\n for (i = 0, n = nodes.length; i < n; i++) {\n if (getTipoNo(nodes[i]) == 'PAT') {\n\n // find ATE or ATI\n for (j = 0; j < nodes.length; j++) {\n if (getTipoNo(nodes[j]) == 'ATE' || getTipoNo(nodes[j]) == 'ATI') {\n\n // get path to ATE/ATI\n path = findPath(i, j, neighbourNodes(i, []), []).reverse();\n\n // stop if ATI is found (for ATE targets)\n for (k = 0; k < path.length; k++)\n if (getTipoNo(nodes[path[k]]) == 'ATI')\n path.splice(k + 1, path.length - k - 1);\n\n // find links in path\n for (k = 1; k < path.length; k++)\n for (var l = 0; l < links.length; l++)\n if (compareNodes(nodes[path[k]], links[l].source) && compareNodes(nodes[path[k - 1]], links[l].target))\n switchLinks(links[l]);\n }\n }\n }\n }\n}", "function linkFn(d){\n let res = []\n\n let source_x = me.tables[d.source].x;\n let source_y = me.tables[d.source].y;\n\n let target_x = me.tables[d.target].x;\n let target_y = me.tables[d.target].y;\n\n if(source_x < target_x){\n res[2] = [target_x - offLine, target_y]\n res[3] = [target_x, target_y]\n if((source_x + colsWidth + offLine*0) < target_x ){\n res[0] = [source_x + colsWidth, source_y]\n res[1] = [source_x + colsWidth + offLine, source_y]\n }else{\n res[0] = [source_x, source_y]\n res[1] = [source_x - offLine, source_y]\n }\n }else{\n res[1] = [source_x - offLine, source_y]\n res[0] = [source_x, source_y]\n if((target_x + colsWidth + offLine*0) < source_x ){\n res[3] = [target_x + colsWidth, target_y]\n res[2] = [target_x + colsWidth + offLine, target_y]\n }else{\n res[3] = [target_x, target_y]\n res[2] = [target_x - offLine, target_y]\n }\n }\n res[0][1] += d.sourceIndex*colsHeight + colsHeight/2\n res[1][1] += d.sourceIndex*colsHeight + colsHeight/2\n res[2][1] += d.targetIndex*colsHeight + colsHeight/2\n res[3][1] += d.targetIndex*colsHeight + colsHeight/2\n\n return res.map(v=>v.join(',')).join(' ')\n }", "get url() { return this.link.url; }", "function modifyLink() {\n\tvar object = document.getElementById(\"Radicado\");\n\tvar ticket = document.getElementById(\"Ticket\");\n\tticket.value = \"http://jvargas:8080/LabelGenerator/view/rotuloFrames.jsp?params=Radicado=\"\n\t\t\t+ object.value;\n\tdocument.getElementById(\"LINK_Ticket\").href = ticket.value;\n}", "function requestLinks(result){\n if (result.indexOf(\"nicht eindeutig\")>-1){ //Eingabe nicht eindeutig\n console.log(\"ERROR - NICHT EINDEUTIG\\n\"); //Handle Error \n return;\n }\n if (result === null || result ===\"\"){\n console.log(\"ERROR - SOMETHING WENT WRONG\\n\"); //Handle Error \n return;\n }\n var parser=new DOMParser();\n var html = parser.parseFromString(result,\"text/html\");\n\n for (var n=0; n<6; n++){ //clear localStorage routes\n localStorage.removeItem(\"route\"+n);\n }\n\n for (var i=0; i<amountRoutes;i++){// Links in der Routen aus Tabelle lesen (die ersten i) \n console.log(\"\\n\"+ html.getElementsByClassName('timelink').item(i).firstChild.href + \"\\n\\n\");//Log Link URL\n doCORSRequestData({ //Requests für Links\n method: 'GET',\n url: html.getElementsByClassName('timelink').item(i).firstChild.href,\n data: null\n });\n\n };\n \n}", "function TraerUrl(parametro,accion){\n \n if (!parametro)\n {\n \n \n return url;\n }\n else{\n \n if (accion==\"modif\")\n {\n \n \n return urlM + \"/\" + parametro;\n \n }else if (accion==\"suc\") {\n \n return urlS;\n }\n else if (accion==\"elim\") {\n return urlE + \"/\" + parametro;\n }else if (accion==\"alta\") {\n return urlA + \"/\" + parametro;\n }\n else{\n return url + \"/\" + parametro;;\n }\n }\n\n }", "linkPrincipal(link){\n var li = link;\nlet url = \"\";\n let cadena = link.split(\"/\");\n for (let i = 0; i < cadena.length; i++){\n if(i >= 2){\n url += cadena[i];\n }\n }\n \n //Funcion para ocultar el menu superior\n if (li == \"/Fecha_pago/\") {\n document.getElementById(\"menuNavbar1\").style.visibility = \"hidden\";\n }\n \n //Este swicth se ejecuta cada vez que entramos a una url\nswitch(url){ \n\n //A qui cargamos los metodos que se queremos que se ejecuten automaticamente\n //Evaluamos el la url que direcccion estamos para pasar por nuestro navegador\ncase \"Principalprincipal\":\n //Cargamos todo el link con los de usuarios/usuarios\n \n getCliente(1); \n \n break; \n case \"Pagopago\":\n getPago(1);\n break; \n}\n}", "function getAnswerSuccess(data)\n{\n// console.log(data);\n// console.log(\"carregado!\");\n\n if(nodes.indexOf(data.id) == -1)\n {\n graph.addNode(data.id,data);\n nodes.push(data.id);\n getLinks(data.id,defaultBeforeSend,getLinksSuccess);\n }\n}", "function dogadjaj(nivo) {\r\n const polje = document.querySelector(`#${nivo} .polje`);\r\n //Dodavanje dogadjaja polju\r\n polje.addEventListener('click', function (event) {\r\n //event.target tamo gde kliknemo:\r\n let klik = event.target;\r\n //ne dozvoljavamo da se selektuje ceo deo section iza kartica, vec samo kartica moze, i to samo jednom\r\n if (klik.nodeName === 'SECTION' || klik.parentNode.classList.contains('selected')) {\r\n return;\r\n };\r\n if (moves < 2) {\r\n moves++;\r\n if (moves === 1) {\r\n //Definisanje prvog pokusaja\r\n prvi = klik.parentNode.dataset.name;\r\n console.log(prvi);\r\n klik.parentNode.classList.add('selected');\r\n } else {\r\n //Definisanje drugog pokusaja\r\n drugi = klik.parentNode.dataset.name;\r\n console.log(drugi);\r\n klik.parentNode.classList.add('selected');\r\n\r\n brojac();\r\n console.log(brojPokusaja);\r\n };\r\n //Ako oba pokusaja nisu prazni...\r\n if (prvi !== '' && drugi !== '') {\r\n //i prvi i drugi pokusaj su pogodjeni\r\n if (prvi === drugi) {\r\n //niz u koji ubacujemo uparene kartice\r\n upareneKartice.push(izabrano);\r\n console.log(upareneKartice);\r\n\r\n //pozivanje funkcije match sa odlaganjem\r\n setTimeout(match, 1200);\r\n //pozivanje funkcije resetPokusaja\r\n setTimeout(resetPokusaja, 1200);\r\n } else {\r\n setTimeout(resetPokusaja, 1200);\r\n };\r\n };\r\n //Set previous target to clicked (I'll assign the clicked value to prevousTarget after the first click.)\r\n prethodniKlik = klik;\r\n };\r\n otvaranje(nivo);\r\n });\r\n}", "function UserGallerie()\n{\n var Video=deserialize(\"Video\",{});\n // Vorschauliste bunt\n var VideoLinks=$x(\"//a[contains(@href,'watch?v=')]\")\n .map(function (a) { return { link:a.href, elem:('user'==Kategorie?$xs(\"ancestor::div[@class='video yt-tile-visible'] | ancestor::li[@class='channels-content-item']\",a):'channel'==Kategorie?$xs('../..',a):a.parentNode)||a }; })\n .map(function (vid) { vid.id=((vid.link||\"\").match(/v=([a-zA-Z0-9-_]*)/)||[\"\",\"\"])[1]; return vid; });\n //alert(uneval(VideoLinks));\n VideoLinks.forEach(function (vid) { if (Video[vid.id]) /*vid.elem.className=\"w\"+Video[vid.id].qualitaet;*/ vid.elem.style.backgroundColor={ \"gut\":\"green\", \"schlecht\":\"red\", undefined:\"yellow\" }[Video[vid.id].qualitaet]; });\n //showmsg({ text:\"aaa\" });\n $x(\"//a[contains(@href,'v=')]\").forEach(function (a) { a.addEventListener(\"click\",function(event){\n //if (event.ctrlKey) // && event.altKey)\n //{\n var e=event.target;\n while (!e || !e.href) e=e.parentNode;\n var VideoID=e.href.match(/v=([a-zA-Z0-9-_]*)/)[1];\n var Video=deserialize(\"Video\",{});\n if (!Video[VideoID])\n {\n Video[VideoID]={ id:VideoID, anz:0, lastseen:new Date() };\n serialize(\"Video\",Video);\n var ColorNode=$xs(\"ancestor::div[@class='video yt-tile-visible'] | ancestor::li[@class='channels-content-item']\",a)||a;\n ColorNode.style.color=\"lightgray\";\n ColorNode.style.backgroundColor=\"darkgray\";\n event.stopPropagation();\n event.preventDefault();\n }\n //}\n }, true); });\n}", "function populateLink() {\n for (let i = 0; i < dataSet.length; i++) {\n link.insertLast(dataSet[i]);\n }\n}", "function addLink() {\n SC.RunLoop.begin();\n Nodelink.store.createRecord(Nodelink.Link, { guid: 'node2', startNode: 'node1', endNode: 'node2' } );\n SC.RunLoop.end();\n}", "function getImage(link, numer){\t\r\n\t/** pobranie strony w DT */\r\n\tif(link!=undefined){\r\n\t\topis.pobieranieFormularza();\r\n\t\tvar that=this;\r\n\t\t\r\n\t\tif(navigator.appName==\"Opera\"){\r\n\t\t\tvar xmlhttp;\r\n\t\t\txmlhttp=new opera.XMLHttpRequest();\r\n\t\t\txmlhttp.onload = function(){getImage2(xmlhttp.responseText,link, numer);}\r\n\t\t\txmlhttp.onerror=function(){ alert('Error :('); }\r\n\t\t\txmlhttp.open(\"GET\",\"http://www.darkthrone.com/recruiter/outside/\"+link,true);\r\n\t\t\txmlhttp.send(null);\r\n\t\t\tvar xhrTimeout=setTimeout(\"ajaxTimeout(\"+xmlhttp+\",\"+link+\",\"+numer+\");\",8000);\t\t\r\n\t\t}else{\r\n\t\t\tGM_xmlhttpRequest({\r\n\t\t\t\tmethod: 'GET',\r\n\t\t\t\turl: \"http://www.darkthrone.com/recruiter/outside/\"+link,\r\n\t\t\t\tonload: function(responseDetails) {getImage2(responseDetails.responseText,link, numer);},\r\n\t\t\t\tonerror: function(responseDetails) { alert('Error :(');}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\telse{\r\n\t\tdocument.getElementById(numer+'DT').style.display='none';\r\n\t\tvar rys=document.getElementById(numer+'load').getElementsByTagName('img')[0];\r\n\t\trys.style.width=16;\r\n\t\trys.style.height=16;\r\n\t\trys.src='imgs/smiley-evil.png';\r\n\t}\r\n\tfunction getImage2(str,link, numer){\r\n\t\tif(xhrTimeout)\r\n\t\t\tclearTimeout(xhrTimeout);\r\n\t\t//alert(headers);\r\n\t\topis.pobranoFormularz();\r\n\t\tif(\tstr.indexOf('has recruited too many people today')>-1 ||\r\n\t\t\tstr.indexOf('is a Dark Throne Legend')>-1 || \r\n\t\t\tstr.indexOf('vacation')>-1\r\n\t\t){\r\n\t\t\topis.odejmijDoKlikania();\r\n\t\t\tvar client = new XMLHttpRequest();\r\n\t\t\t client.open(\"POST\", \"ajax/setWyklikany.php\");\r\n\t\t\t client.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\");\r\n\t\t\t client.send(\"link=\"+link);\t\r\n\t\t\t nextImage(numer);\r\n\t\t\t return;\r\n\t\t}\r\n\t\tif(str.indexOf('You can only be recruited once per day')>-1){\r\n\t\t\topis.odejmijDoKlikania();\r\n\t\t\tnextImage(numer);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t/** ustawienie obrazka */\r\n\t\tvar captcha_id,src;\t\t\t\t\t\r\n\t\tstr=str.substr(str.indexOf('captcha_id'));\t\r\n//alert(str);\t\t\r\n\t\tvar pom=str.indexOf('value=\"')+7;\r\n\t\tcaptcha_id= str.substr(pom, str.indexOf('>')-pom-3);\t\t\t\r\n\t\tpom=str.indexOf('src=\"')+5;\r\n\t\tsrc = str.substr(pom, str.indexOf('gif')-pom+3);\r\n\t\t\r\n\t\tvar nazwaObrazka=src.substr(src.lastIndexOf('/')+1);\r\n\t\r\n\t\tsetImage(src,numer,captcha_id,link);\r\n\t}\r\n}", "function isConnectedLink(node, link) {\n //link.source and link.target is invalid as it had been automatically replaced with real data.\n if (link.target.index == node.index || link.source.index == node.index)\n return true;\n return false;\n }", "function drawLinks(link)\n{\n link.attr(\"x1\", function(d) { return isNaN(d.source.x)?defaultX:d.source.x; })\n .attr(\"y1\", function(d) { return isNaN(d.source.y)?defaultY:d.source.y; })\n .attr(\"x2\", function(d) { return isNaN(d.target.x)?defaultX:d.target.x; })\n .attr(\"y2\", function(d) { return isNaN(d.target.y)?defaultY:d.target.y; });\nif (curvedLinks){\n\tlink.attr(\"d\", function(d) {\n\t\tvar even=d.source.id%2;\n\t\tvar intermediateX=d.source.x+((even==0)?1:-1)*(100);\n\t\t//console.log(d.source.name+\":\"+d.target.name+\" intermediateX: \"+intermediateX);\n\t\t//console.log(even+\":\"+d);\n\t linkOrientation=linkOrientation*-1;\t\n return \"M\" + d.source.x + \",\" + d.source.y\n + \"S\" + intermediateX + \",\" + d.source.y\n + \" \" + d.target.x + \",\" + d.target.y;\n });\n}\n}", "function link_backward() {\n // This list does not include cash from individuals\n name1_arr=[];\n money_arr=[];\n\n name2=comm_name[iselect];\n id2=comm_id[iselect];\n id2_cand=comm_cand_id[iselect];\n i2_cand=cand_id.indexOf(id2_cand);\n cand_candidate=cand_name[i2_cand];\n console.log(name2,cand_candidate);\n tList=getAllIndexes(tran_id2,id2);\n moneyTot=0.;\n for (j=0; j < tList.length; j++) {\n id1=tran_id1[tList[j]];\n i1=i_comm_id[id1];\n name1=comm_name[i1];\n money=parseFloat(tran_amt[tList[j]]);\n // Does this name already exist in the name array?\n i1_test=name1_arr.indexOf(name1);\n if (i1_test < 0) {\n name1_arr.push(name1)\n money_arr.push(money);\n } else {\n money_arr[i1_test]+=money;\n }\n moneyTot+=money;\n }\n money_indiv=parseFloat(cand_indiv[i2_cand]);\n moneyTot+=money_indiv;\n totalAmt=moneyTot;\n\n // Find the top contributors\n idxarr=sortWithIndices(money_arr).sortIndices;\n nk=idxarr.length;\n kmax=Math.min(ncontrib,nk)\n for (k=0; k < kmax; k++) {\n k1=idxarr[nk-k-1]; // Reversed order\n comm_group[name1_arr[k1]]=name1_arr[k1];\n //console.log(k1,name1_arr[k1],money_arr[nk-k-1]);\n }\n // Now create the actual nodes\n node1_link=[];\n node2_link=cand_candidate;\n money_link=[];\n \n \n tooltip=[];\n\ttooltip_head=[];\n\tmoney_val=[];\n \n for (k=0; k < nk; k++) {\n k1=idxarr[nk-k-1]; // Reversed order\n val1=comm_group[name1_arr[k1]];\n i1_test=node1_link.indexOf(val1);\n i1=i_comm_name[name1_arr[k1]];\n if (i1_test < 0) {\n node1_link.push(val1);\n money_link.push(money_arr[nk-k-1])\n \n tooltip_head.push('<b>'+val1+'->'+cand_candidate);\n \t\ttooltip.push('<div style=\"text-align:left; font-size: 10px; font-family: garamond;\">&nbsp;<a onclick=\"doSelected('+i1+')\" href=\"#\">'+name1_arr[k1]+'</a><i> $'+parseInt(money_arr[nk-k-1]).toLocaleString()+'</i><br>');\n } else {\n money_link[i1_test]+=money_arr[nk-k-1];\n tooltip[i1_test]+='&nbsp;<a onclick=\"doSelected('+i1+')\" href=\"#\">'+name1_arr[k1]+'</a><i> $'+parseInt(money_arr[nk-k-1]).toLocaleString()+'</i><br>'\n }\n }\n \n node1_link.push('Individuals');\n money_link.push(parseFloat(cand_indiv[i2_cand]));\n tooltip_head.push('<b>Individual Contributions ->'+cand_candidate);\n tooltip.push('<div>');\n \n // Now chart it up\n \n for (j=0; j< node1_link.length; j++) {\n tooltip_head[j]+=' ($'+parseInt(money_link[j]).toLocaleString()+')</b><br>';\n tooltip[j]+=\"</div>\";\n data.addRow([node1_link[j],node2_link,money_link[j],tooltip_head[j]+tooltip[j]]);\n\n }\n \n \n title_str=comm_name[iselect]+' $'+totalAmt.toLocaleString();\n document.getElementById(\"chart_title\").innerHTML=title_str;\n\n options = {\n\t width: 900,\n\t tooltip: {isHtml: true},\n\t sankey: {\n node: { label: { fontName: 'Garamond',\n fontSize: 14,\n color: '#871b47',\n bold: true } } },\n };\n\n \n // Instantiate and draw our chart, passing in some options.\n chart = new google.visualization.Sankey(document.getElementById('chart_div'));\n chart.draw(data, options);\n \n map_allInvisible();\n // Make the candidate's district visible?\n \n \n \n \n}", "function invisibili(links, mese, idx) {\n // Itera e rendi invisibile\n for(let i = 1; i < links.length; i++) {\n links[i].style.display = \"none\";\n }\n // Ferma il timer\n clearInterval(finale[mese][idx]);\n}", "function eLink(db,nm) {\ndbs = new Array(\"http://us.battle.net/wow/en/search?q=\",\"http://www.wowhead.com/?search=\",\"http://db.mmo-champion.com/search/all/\",\"http://www.wowdb.com/search?search=\");\ndbTs = new Array(\"Armory\",\"Wowhead\",\"DB MMO-Champion\",\"WoWDB\");\ndbHs = new Array(\"&real; \",\"&omega; \",\"&delta; \",\"&piv; \");\nel = '<a href=\"'+ dbs[db]+nm + '\" target=\"_blank\" title=\"'+ dbTs[db] +'\">'+ dbHs[db] + '</a>';\nreturn el;\n}", "function cityLinks(){\r\n\t\t// Localiza la lista de aldeas\r\n\t\t\t\tvar cities = find(\"//div[@id='lright1']//table[@class='f10']\", XPFirst);\r\n\t\t\t\tif (!cities) return;\r\n\r\n\t\tcities = cities.firstChild;\r\n\t\tfor (var i = 0; i < cities.childNodes.length; i++){\r\n\t\t\t// Utiliza el texto de las coordenadas para averiguar el ID necesario para los enlaces\r\n\t\t\tvar city = cities.childNodes[i];\r\n\t\t\tcity.textContent.search(/\\((.*)\\n?\\|\\n?(.*)\\)/);\r\n\t\t\tvar id = xy2id(RegExp.$1, RegExp.$2);\r\n\t\t\t/*\r\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='a2b.php?z=\" + id + \"'><img src='\" + img('a/def1.gif') + \"' width='12' border='0' title='\" + T('ENV_TROPAS') + \"'></a>\"));\r\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='build.php?z=\" + id + \"&gid=17'><img src='\" + img('r/4.gif') + \"' height='12' border='0' title='\" + T('ENVIAR') + \"'></a>\"));\r\n\t\t\t*/\r\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='a2b.php?z=\" + id + \"'>\" + T('ALDEA_EXTRA1') + \"</a>\"));\r\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='build.php?z=\" + id + \"&gid=17'>\" + T('ALDEA_EXTRA2') + \"</a>\"));\r\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='karte.php?z=\" + id + \"'>\" + T('ALDEA_EXTRA3') + \"</a>\"));\r\n\t\t}\r\n\t}", "function startingLinks() {\n player.startingLink = randomQuery();\n player.targetLink = randomQuery();\n player.previousLink = player.startingLink;\n document.getElementById('starting-link-formated').innerText = removeUrlEncoding(player.startingLink);\n document.getElementById('target-link-formated').innerText = removeUrlEncoding(player.targetLink);\n}", "function getData() {\r\n var hs = '\\uf2b5', sign = '\\uf277', lock = '\\uf023', money = '\\uf0d6';\r\n getTheData(function(data){\r\n console.log(data);\r\n // var savedLinks = data.links;\r\n // var nodes = data.nodes;\r\n // console.log(savedLinks);\r\n // for(var i = 0; i < savedLinks.length; i++){\r\n // for(var j = 0; j < nodes.length; j++){\r\n // if(savedLinks[i].target == nodes[j].name){\r\n // savedLinks[i].target = nodes[j].node;\r\n // } else if (savedLinks[i].source == nodes[j].name){\r\n // savedLinks[i].source = nodes[j].node;\r\n // }\r\n // }\r\n // }\r\n\r\n // console.log(data);\r\n\r\n // data.links = savedLinks;\r\n renderSankey(data);\r\n // return data;\r\n });\r\n}", "function vise_manje(rec){\n\tdugme('#gotovo','disabled',false);\n\tdugme('#jos_druge_igre','disabled',false);\n\t$('#1').attr('src',karta2.slika);\n\tlet izraz;\n\trec==='higher' ? izraz=karta2.vrednost>karta1.vrednost : izraz=karta2.vrednost<karta1.vrednost;\n\tif(izraz){\n\t\tbrojac_druga++;\n\t\tkarta1=karta2;\n\t\tkarta2=spil2.deal_card();\n\t}else{\n\t\tbrojac_druga=0;\n\t\tdugme('#jos_druge_igre');\n\t}\n\tlet a=brojac_druga*dobitak;\n\tprikaz_dobitka(a);\n\tdugme('#vise');\n\tdugme('#manje');\n}", "function addBilanzLinkToCell(cell, gameType, label) {\n const __BILANZLINK = getBilanzLinkFromCell(cell, gameType, label);\n\n if (__BILANZLINK !== \"\") {\n cell.innerHTML += __BILANZLINK;\n }\n}", "depositLink() {\n if (this.pos.inRangeTo(this.link, 1)) {\n this.liveObj.transfer(this.link, RESOURCE_ENERGY);\n } else {\n this.liveObj.moveTo(this.link);\n }\n }", "function addLinkToDiagram(link) {\n diagram.startTransaction();\n model.addLinkData({\n //key: link._id,\n type: link.type,\n from: link.from,\n to: link.to,\n dash: link.dash\n });\n diagram.commitTransaction(\"update\");\n modelLinkWithoutFilter.push(link);\n}", "function genereTournoi(){\n\n selecteurMatch = -1;\n bd.tournoi.tours = [];\n joueurAttente = [];\n\n //init\n for (var i = 0; i < bd.joueurs.length; i++){\n bd.joueurs[i].adversaires = [];\n bd.joueurs[i].coequipiers = [];\n bd.joueurs[i].points = 0;\n }\n\n var nbMatch;\n for (var i = 0; i < bd.tournoi.nbTour; i++){\n mettreJoueursDansSac(); //on met tous les joueurs selectionné dans un sac et on mélange\n populateAllMatchs(); //on générre tous les matchs possibles à partir des joueurs dans sac\n\n //nombre de mathc par tour\n nbMatch = Math.min(\n Math.floor(sac.length / (typeTournoiListe.SIMPLE ? 2 : 4)), \n allMatchs.length,\n bd.tournoi.nbTerrain\n );\n\n //on teste tous les matchs en les priorisant\n for (var j = 0; j < allMatchs.length; j++){\n testContraintes(allMatchs[j]);\n }\n //on tri la liste\n allMatchs.sort((m1, m2) => m1.pointContrainte - m2.pointContrainte);\n var matchs = [];\n var currentMatch;\n for (var j = 0; j < nbMatch; j++){\n if (allMatchs.length == 0) break; //s'il n'y a plus de match dispo on sort\n currentMatch = allMatchs[0];\n matchs.push(currentMatch);\n //attribution adversaires\n for (var k = 0; k < currentMatch[\"equipeA\"].length; k++){\n j1 = currentMatch[\"equipeA\"][k];\n for (var m = 0; m < currentMatch[\"equipeB\"].length; m++){\n j2 = currentMatch[\"equipeB\"][m];\n if (!j1.adversaires.includes(j2)) j1.adversaires.push(j2); \n if (!j2.adversaires.includes(j1)) j2.adversaires.push(j1); \n }\n }\n //et coequipiers equipe A\n var j1, j2;\n for (var k = 0; k < currentMatch[\"equipeA\"].length; k++){\n j1 = currentMatch[\"equipeA\"][k];\n for (var m = 0; m < currentMatch[\"equipeA\"].length; m++){\n j2 = currentMatch[\"equipeA\"][m];\n if (j1 != j2){\n if (!j1.coequipiers.includes(j2)) j1.coequipiers.push(j2);\n if (!j2.coequipiers.includes(j1)) j2.coequipiers.push(j1);\n }\n }\n }\n //et coequipiers equipe B\n var j1, j2;\n for (var k = 0; k < currentMatch[\"equipeB\"].length; k++){\n j1 = currentMatch[\"equipeB\"][k];\n for (var m = 0; m < currentMatch[\"equipeB\"].length; m++){\n j2 = currentMatch[\"equipeB\"][m];\n if (j1 != j2){\n if (!j1.coequipiers.includes(j2)) j1.coequipiers.push(j2);\n if (!j2.coequipiers.includes(j1)) j2.coequipiers.push(j1);\n }\n }\n }\n //on supprime tous les match ayant des joueurs déjà affecté sur ce tour\n allMatchs = allMatchs.filter(match => \n match.equipeA.filter(joueur => currentMatch.equipeA.includes(joueur)).length == 0 && \n match.equipeB.filter(joueur => currentMatch.equipeB.includes(joueur)).length == 0 &&\n match.equipeA.filter(joueur => currentMatch.equipeB.includes(joueur)).length == 0 &&\n match.equipeB.filter(joueur => currentMatch.equipeA.includes(joueur)).length == 0\n );\n\n //on supprime du sac les joueurs affectés a currentMatch\n var currentIndexOf;\n for (var k = 0; k < currentMatch.equipeA.length; k++){\n currentIndexOf = sac.indexOf(currentMatch.equipeA[k]);\n if (currentIndexOf != -1) sac.splice(currentIndexOf, 1);\n }\n for (var k = 0; k < currentMatch.equipeB.length; k++){\n currentIndexOf = sac.indexOf(currentMatch.equipeB[k]);\n if (currentIndexOf != -1) sac.splice(currentIndexOf, 1);\n }\n\n }\n\n //on ajoute dans joueur attente les joueurs restant dans le sac\n var flag;\n for (var k = 0; k < sac.length; k++){\n flag = false;\n for (var m = 0; m < joueurAttente.length; m++) {\n if (joueurAttente[m].name == sac[k].name){\n joueurAttente[m][\"nb\"]++;\n flag = true;\n }\n }\n if (!flag) joueurAttente.push({\"name\": sac[k].name, \"nb\": 1});\n }\n\n bd.tournoi.tours.push({\"matchs\": matchs, \"joueurAttente\": sac});\n }\n\n}", "function dwa() {\n \n //wypisanie do konsoli zawartości zmienna1, zdeklarowanej w funkcji nadrzednej, wartośc zostanie pobrana poprzez hoisting\n console.log(zmienna1);\n \n //Deklaracja i przypisanie w funkcji wewnetrznej\n var zmienna2 = 3;\n }", "function setLinkIndexAndNum()\n { \n for (var i = 0; i < data.links.length; i++) \n {\n if (i != 0 &&\n data.links[i].source == data.links[i-1].source &&\n data.links[i].target == data.links[i-1].target) \n {\n data.links[i].linkindex = data.links[i-1].linkindex + 1;\n }\n else \n {\n data.links[i].linkindex = 1;\n }\n // save the total number of links between two nodes\n if(mLinkNum[data.links[i].target + \",\" + data.links[i].source] !== undefined)\n {\n mLinkNum[data.links[i].target + \",\" + data.links[i].source] = data.links[i].linkindex;\n }\n else\n {\n mLinkNum[data.links[i].source + \",\" + data.links[i].target] = data.links[i].linkindex;\n }\n }\n }", "function setChannelLink(){\n document.querySelectorAll('.channel-link').forEach(link => {\n link.onclick = ()=> {\n load_channel(link.dataset.channel);\n return false;\n }\n });\n }", "function getAmuleLink(links, cat) {\r\n\r\n\tif(cat == \"0\") {\r\n\t\tcat = \"all\";\r\n\t}\r\n\t\r\n\t// Url to add ed2k links to amule\r\n\treturn emuleUrl + \"footer.php?selectcat=\" + cat + \"&Submit=Download+link&ed2klink=\" + links;\r\n}", "function sameLnkDiffUrls() {\n this.ruleID = 'sameLnkDiffUrls';\n}", "function DibujarRuta(myTsp){\n var dirRes = tsp.getGDirections();\n if (Transporte == 0){\n dirRes.Mb = {travelMode: google.maps.TravelMode.WALKING};\n }else if (Transporte == 1){\n dirRes.Mb = {travelMode: google.maps.TravelMode.DRIVING}; \n }\n if (Transporte == 0){\n dirRes.Nb = {travelMode: google.maps.TravelMode.WALKING};\n }else if (Transporte == 1){\n dirRes.Nb = {travelMode: google.maps.TravelMode.DRIVING}; \n }\n var dir = dirRes.routes[0];\n\n //Dibujamos los marcadores\n borrarMarcadores();\n var point = dir.legs[0].start_location;\n var name = dir.legs[0].start_address; \n var myicon = new google.maps.MarkerImage(\"/marker/?text=1&color=azul\");\n var marker = new google.maps.Marker({\n position: point,\n map: map,\n icon: myicon,\n title: name\n });\n markersArray.push(marker);\n\n for (var i = 0; i < dir.legs.length; ++i) {\n var route = dir.legs[i];\n var point = route.end_location;\n var name = route.end_address;\n if (i != dir.legs.length - 1 || mode != 0) {\n var myicon1 = new google.maps.MarkerImage(\"/marker/?text=\"+(i+2)+\"&color=azul\");\n var marker = new google.maps.Marker({\n position: point,\n map: map,\n icon: myicon1,\n title: name\n });\n markersArray.push(marker);\n }\n }\n\n //Limpiar el mapa\n if (dirRenderer != null) {\n dirRenderer.setMap(null);\n }\n //Pintar camino\n \n dirRenderer = new google.maps.DirectionsRenderer({\n directions: dirRes,\n hideRouteList: true,\n map: map,\n panel: null,\n preserveViewport: false,\n suppressInfoWindows: false,\n suppressMarkers: true,\n });\n //Cargamos la tabla de direcciones en el contenedor en Ruta Manual llamando a la función panel ruta mediante el callback\n $(\"#Puntos\").html(PanelRuta(dir));\n //Cargamos la tabla de direcciones en el contenedor en Ruta Guiada llamando a la función panel ruta mediante el callback\n $(\"#PanelRuta\").html(PanelRuta(dir));\n\n}", "function oldGLnk(target, description, linkData)\n{\n}", "function updateConnectedLinks(nameLinkDeleted){\n for (let i=0;i<listSpheres2.length;i++){\n for(let j=0;j<listSpheres2[i].linkName.length;j++){\n if(listSpheres2[i].linkName[j] == nameLinkDeleted){\n //in the linkName property from listSpheres2\n //if the link deleted name is the same\n listSpheres2[i].linkName.splice(j,1);//delete his name from it \n //to update the linkName property = list \n }\n }\n }\n}", "startLinkRouting() {}", "function insertLinks(data) {\n for (var i = 0, n = data.length; i < n; i++) {\n // find nodes by id\n var node1 = -1;\n var node2 = -1;\n for (var j = 0, m = nodes.length; j < m; j++) {\n if (data[i]['idNo1'] == nodes[j].dbId)\n node1 = nodes[j];\n if (data[i]['idNo2'] == nodes[j].dbId)\n node2 = nodes[j];\n if (node1 != -1 && node2 != -1)\n break;\n }\n // add link\n links.push({\n source: node1,\n target: node2,\n distance: data[i]['comprimento']\n });\n }\n}", "function getAnswerSuccess(data)\n{\n console.log(data);\n console.log(\"carregado!\");\n\n if(nodes.indexOf(data.id) == -1)\n {\n graph.addNode(data.id,data);\n nodes.push(data.id);\n getLinks(data.id,defaultBeforeSend,getLinksSuccess);\n }\n}", "function wykonaj_ruch_SI()\n{\n let ruchy = generuj_ruchy(), ruch_t;\n\n // sprawdzanie czy jest mat/pat\n if(ruchy.ruchy.length + ruchy.zbicia.length === 0)\n {\n if(czy_szach(szachownica.biale_ruch))\n {\n // mat, SI przegralo\n napisz_wynik(szachownica.biale_ruch ? 2 : 1);\n }\n else\n {\n // pat, remis\n napisz_wynik(3);\n }\n\n zablokowane = true;\n\n return;\n }\n\n // sprawdzanie pozostalych remisow\n if(szachownica.liczba_polowek_od_r > 100 || poprzednie_pozycje[szachownica.hash] >= 3 || !czy_wystarczajacy_material())\n {\n napisz_wynik(3);\n\n szachownica.biale_ruch = !szachownica.biale_ruch;\n zablokowane = true;\n\n return;\n }\n\n tablica_transp = new Map();\n\n let nr = Math.floor(Math.random() * (ruchy.ruchy.length + ruchy.zbicia.length));\n\n if(nr < ruchy.ruchy.length)\n ruch_t = ruchy.ruchy[nr];\n else\n ruch_t = ruchy.zbicia[nr - ruchy.ruchy.length];\n\n wykonaj_ruch(ruch_t);\n if(szachownica.pola[ruch_t.wiersz_k][ruch_t.kolumna_k] === 6 && ruch_t.wiersz_k === 7)\n {\n // promocja biale\n promuj_piona(ruch_t.wiersz_k, ruch_t.kolumna_k, Math.floor(Math.random() * 4) + 2);\n }\n else if(szachownica.pola[ruch_t.wiersz_k][ruch_t.kolumna_k] === 12 && ruch_t.wiersz_k === 0)\n {\n // promocja czarne\n promuj_piona(ruch_t.wiersz_k, ruch_t.kolumna_k, Math.floor(Math.random() * 4) + 8);\n }\n\n narysuj();\n}", "getTabelasDeBancoDeDadosLinks() {\n let statement = this.statements['tabelasWiki'];\n\n return this._fetchWebApiResults(statement,['query','results'],{},'get', (data) => {\n let results = {'tabelas':[]};\n for (let key in data.query.results) {\n let tabelas = data.query.results[key].printouts['Possui direito de leitura em'];\n tabelas.forEach( (item) => {\n let nomeTabela = item['fulltext'];\n if (!results.tabelas.includes(nomeTabela)) results.tabelas.push(nomeTabela);\n } );\n }\n return results;\n });\n }", "function computeNodeLinks() {\n nodes.forEach(function (node) {\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n links.forEach(function (link) {\n var source = link.source, target = link.target;\n link.source_index = source;\n link.target_index = target;\n if (typeof source === \"number\") source = link.source = nodes[link.source];\n if (typeof target === \"number\") target = link.target = nodes[link.target];\n source.sourceLinks.push(link);/////the link in which node as souce/link\n target.targetLinks.push(link);\n });\n }", "get conceptIndexLink(): LinkModel {\n return this.links.getLinkByKey(\"concepts\");\n }", "function menjaj(smer = \"napred\")\n{\n if(smer == \"napred\")\n {\n id++;\n if(id == 3)\n id = 0;\n }\n else\n {\n id--;\n if(id == -1)\n id = 2;\n }\n\n /*ovde u slike[id] ti prosledjujes id slike koja zelis da se prikaze, a pomocu ovog #bannerSlika\n kazes na koji se to element u html-u odnosi */\n $(\"#bannerSlika\").animate({opacity: 0}, 500, function () { $(\"#bannerSlika\").attr(\"src\", slike[id]); } );\n $(\"#bannerSlika\").animate({opacity: 1}, 500);\n}", "function buildLinkData(link_ary) {\n link_ary.forEach(function (link) {\n link.source = nodeById.get(link.source);\n link.target = nodeById.get(link.target);\n link.n = Number(link.n)\n\n if (link.sentiment == \"1\") {\n link.source.out_pos += link.n\n } else {\n link.source.out_neg += link.n\n }\n // node = nodeById.get(link.target);\n if (link.sentiment == \"1\") {\n link.target.in_pos += link.n\n } else {\n link.target.in_neg += link.n\n }\n link.source.adj_src.push(link);\n link.target.adj_trgt.push(link);\n });\n}", "function change_links(){\n // making the pileup for each country\n group_length=group_pileups.children.length;\n cylinder_heights_length=cylinder_heights.length;\n vS_length=vS.length;\n max_pileups=0.0;\n for(var i=0;i<n_pileups_year;i++) max_pileups=Math.max(max_pileups,data_json_w['pileups'][pileups_year[i]]['value']);\n for(var i=0;i<n_pileups_year;i++){\n\tii=pileups_year[i];\n\tsource=data_json['LL'][data_json_w['pileups'][ii]['country']];// Starting and target points\n\tLATi=0.5*Math.PI-source['lat']*Math.PI/180.0;\n\tLONi=0.5*Math.PI+source['lon']*Math.PI/180.0;\n\tif(i<vS_length){\n\t vS[i].setX(Math.sin(LATi)*Math.sin(LONi));\n\t vS[i].setY(Math.cos(LATi));\n\t vS[i].setZ(Math.sin(LATi)*Math.cos(LONi));\n\t vT[i].copy(vS[i]);\n\t}else{\n\t vS.push(new THREE.Vector3(Math.sin(LATi)*Math.sin(LONi),Math.cos(LATi),Math.sin(LATi)*Math.cos(LONi)));\n\t vT.push(new THREE.Vector3(Math.sin(LATi)*Math.sin(LONi),Math.cos(LATi),Math.sin(LATi)*Math.cos(LONi)));\n\t vS_length+=1;\n\t}\n\tcylinder_height=data_json_w['pileups'][ii]['value']*radius/max_pileups;\n\tvT[i].multiplyScalar(radius+0.5*cylinder_height);\n\tif(i>=group_length){\n\t cylinder_heights.push(cylinder_height);\n\t cylinder_heights_length+=1;\n\t if(lambert) group_pileups.add(new THREE.Mesh(new THREE.CylinderGeometry(FAO_radius,FAO_radius,cylinder_height,32),new THREE.MeshLambertMaterial({color:'white'})));\n\t if(phong) group_pileups.add(new THREE.Mesh(new THREE.CylinderGeometry(FAO_radius,FAO_radius,cylinder_height,32),new THREE.MeshPhongMaterial({color:'white',shininess:100.0})));\n\t if(standard) group_pileups.add(new THREE.Mesh(new THREE.CylinderGeometry(FAO_radius,FAO_radius,cylinder_height,32),new THREE.MeshStandardMaterial({color:'white',metalness:0.5})));\n\t group_length+=1;\n\t}else group_pileups.children[i].scale.set(1.0,cylinder_height/cylinder_heights[i],1.0);\n\tgroup_pileups.children[i].rotation.order='YXZ';\n\tgroup_pileups.children[i].rotation.x=LATi;\n\tgroup_pileups.children[i].rotation.y=LONi;\n\tgroup_pileups.children[i].position.set(vT[i].x,vT[i].y,vT[i].z);\n\tgroup_pileups.children[i].geometry.verticesNeedUpdate=true;\n\tgroup_pileups.children[i].material.color.set('white');\n\tgroup_pileups.children[i].castShadow=true;\n\tgroup_pileups.children[i].receiveShadow=false;\n\tgroup_pileups.children[i].material.needsUpdate=true;\n\tsource=data_json['LL'][data_json_w['pileups'][ii]['country']]['id'];\n\tgroup_pileups.children[i].name=source.concat(' : ',data_json_w['pileups'][ii]['value'].toString());\n }// Rof pileups\n for(var i=(group_length-1);i>=n_pileups_year;i--){\n\tscene.remove(group_pileups.children[i]);\n\tgroup_pileups.remove(group_pileups.children[i]);\n\tcylinder_heights.splice(i,1);\n }\n // making the links\n group_length=group_links.children.length;\n group_mesh_length=group_mesh.children.length;\n n_curves=paths.curves.length;\n n_count=count.length;\n volumes_length=volumes.length;\n vS_length=vS.length;\n mST_length=mST.length;\n bn_length=bn.length;\n console.log(group_links.children.length,group_mesh.children.length,cylinder_heights.length);\n for(var i=0;i<(vS_length-mST_length);i++) mST.push(new THREE.Vector3());\n for(var i=0;i<(vS_length-bn_length);i++) bn.push(new THREE.Vector3());\n for(var i=0;i<n_pairwize_year;i++){\n\tii=pairwize_year[i];\n // Starting and target points\n\tsource=data_json_w['links'][ii]['s'];\n\ttarget=data_json_w['links'][ii]['t'];\n\tindex=n_countries*Math.min(source,target)+Math.max(source,target);\n\tsource=data_json['LL'][source];\n\ttarget=data_json['LL'][target];\n\tLATi=0.5*Math.PI-source['lat']*Math.PI/180.0;\n\tLONi=0.5*Math.PI+source['lon']*Math.PI/180.0;\n\tif(i<vS_length){\n vS[i].setX(Math.sin(LATi)*Math.sin(LONi));\n vS[i].setY(Math.cos(LATi));\n vS[i].setZ(Math.sin(LATi)*Math.cos(LONi));\n\t mST[i].copy(vS[i]);\n }else{\n\t vS.push(new THREE.Vector3(Math.sin(LATi)*Math.sin(LONi),Math.cos(LATi),Math.sin(LATi)*Math.cos(LONi)));\n\t mST.push(new THREE.Vector3(Math.sin(LATi)*Math.sin(LONi),Math.cos(LATi),Math.sin(LATi)*Math.cos(LONi)));\n\t}\n\tLATi=0.5*Math.PI-target['lat']*Math.PI/180.0;\n\tLONi=0.5*Math.PI+target['lon']*Math.PI/180.0;\n if(i<vS_length){\n vT[i].setX(Math.sin(LATi)*Math.sin(LONi));\n vT[i].setY(Math.cos(LATi));\n vT[i].setZ(Math.sin(LATi)*Math.cos(LONi));\n }else{\n\t vT.push(new THREE.Vector3(Math.sin(LATi)*Math.sin(LONi),Math.cos(LATi),Math.sin(LATi)*Math.cos(LONi)));\n\t bn.push(new THREE.Vector3());\n\t}\n\tif(i>=vS_length) vS_length+=1;\n\t// mid-point\n\ttheta=Math.acos(vS[i].x*vT[i].x+vS[i].y*vT[i].y+vS[i].z*vT[i].z);\n\tbn[i].setX(vS[i].y*vT[i].z-vS[i].z*vT[i].y);\n\tbn[i].setY(vS[i].z*vT[i].x-vS[i].x*vT[i].z);\n\tbn[i].setZ(vS[i].x*vT[i].y-vS[i].y*vT[i].x);\n\tbn[i].normalize();\n\tmST[i].applyAxisAngle(bn[i],0.5*theta);\n\tmST[i].multiplyScalar(radius*(1.0+theta));\n\tvS[i].multiplyScalar(radius);\n\tvT[i].multiplyScalar(radius);\n\t// Bezier curves\n\tif(i<n_curves) paths.curves[i]=new THREE.QuadraticBezierCurve3(vS[i],mST[i],vT[i]);\n else{\n\t paths.add(new THREE.QuadraticBezierCurve3(vS[i],mST[i],vT[i]));\n\t n_curves+=1;\n\t}\n\tvolume=weight0*Math.cbrt(3.0*data_json_w['links'][ii]['value']/(4.0*Math.PI));\n\tif(i<n_count){\n\t count[i]=0;\n\t delta_count[i]=parseInt(volume);\n\t}else{\n\t count.push(0);\n\t delta_count.push(parseInt(volume));\n\t n_count+=1;\n\t}\n\t// the link\n\tif(i<group_length){\n\t group_links.children[i].geometry.setFromPoints(paths.curves[i].getPoints(n_points));\n\t group_links.children[i].geometry.verticesNeedUpdate=true;\n\t group_links.children[i].material.needsUpdate=true;\n\t group_links.children[i].material.color.set(colors[index%n_colors]);\n\t}else{\n \t geometry=new THREE.BufferGeometry().setFromPoints(paths.curves[i].getPoints(n_points));\n \t group_links.add(new THREE.Line(geometry,new THREE.LineBasicMaterial({color:colors[index%n_colors]})));\n\t group_length+=1;\n }\n\t// and the associated mesh\n\tif(i<group_mesh_length){\n\t group_mesh.children[i].scale.x=volume/volumes[i];\n\t group_mesh.children[i].scale.y=volume/volumes[i];\n\t group_mesh.children[i].scale.z=volume/volumes[i];\n\t group_mesh.children[i].geometry.verticesNeedUpdate=true;\n\t group_mesh.children[i].material.needsUpdate=true;\n\t group_mesh.children[i].material.color.set(colors[index%n_colors]);\n\t}else{\n\t if(lambert) group_mesh.add(new THREE.Mesh(new THREE.SphereGeometry(volume,segments0,rings0),new THREE.MeshLambertMaterial({color:colors[index%n_colors]})));\n\t if(phong) group_mesh.add(new THREE.Mesh(new THREE.SphereGeometry(volume,segments0,rings0),new THREE.MeshPhongMaterial({color:colors[index%n_colors],shininess:100.0})));\n\t if(standard) group_mesh.add(new THREE.Mesh(new THREE.SphereGeometry(volume,segments0,rings0),new THREE.MeshStandardMaterial({color:colors[index%n_colors],metalness:0.5})));\n\t group_mesh_length+=1;\n\t volumes.push(volume);\n\t volumes_length+=1;\n }\n\tsource=data_json['index_country'][data_json_w['links'][ii]['s']];\n\ttarget=data_json['index_country'][data_json_w['links'][ii]['t']];\n\tgroup_links.children[i].name=source.concat(' with ',target.concat(' : ',data_json_w['links'][ii]['value'].toString()));\n\tgroup_mesh.children[i].name=source.concat(' with ',target.concat(' : ',data_json_w['links'][ii]['value'].toString()));\n }// Rof pairwize\n for(var i=(group_length-1);i>=n_pairwize_year;i--){\n\tscene.remove(group_links.children[i]);\n\tgroup_links.remove(group_links.children[i]);\n\tscene.remove(group_mesh.children[i]);\n\tgroup_mesh.remove(group_mesh.children[i]);\n }\n}", "function makeLink() {\n // var a=\"http://www.geocodezip.com/v3_MW_example_linktothis.html\"\n var url = window.location.pathname;\n var a = url.substring(url.lastIndexOf(\n '/') + 1) + \"?lat=\" +\n map.getCenter()\n .lat()\n .toFixed(6) + \"&lng=\" +\n map.getCenter()\n .lng()\n .toFixed(6) +\n \"&zoom=\" + map.getZoom() +\n \"&type=\" +\n MapTypeId2UrlValue(map.getMapTypeId());\n if (filename !=\n \"TrashDays40.xml\") a +=\n \"&filename=\" + filename;\n document.getElementById(\n \"link\")\n .innerHTML =\n '<a href=\"' + a +\n '\">Link to this page<\\/a>';\n }", "function generateNetwork(data, year){\n\n<<<<<<< HEAD\n\t// show time definition, cant show multiple years\n let filterData = data.filter(d => d.year = year);\n \n const nodesData = new Map();\n const linksData = [];\n \n filterData.forEach(od => { //od is orignal value for each is loop\n \t// check to see if nodes is alraedy in the nodesdatas map\n \tconst newLink = {\n \t\tsource: null,\n \t\ttarget: null,\n \t\tvalue: od.value\n\n \t};\n\n \tif(!nodesData.get(od.origin_name)) { // \"nodesDatae.get(od.origin_name\" is undefiend, \"!\" covert false to ture, \n \t\t\n \t\tconst newNode = {\n name: od.origin_name,\n incoming: [],\n outgoing: [newLink],\n incomingTotal: 0,\n outgoingTotal: newLink.value\n };\n\n \t\tnodesData.set(od.origin_name, newNode); \n \t\tnewLink.source = newNode;\n \t} else{\n\n \t\tconst exsitingNode = nodesData.get(od.origin_name)\n \t\texsitingNode.outgoing.push(newLink);\n exsitingNode.outgoingTotal +- newLink.value;\n newLink.source = exsitingNode;\n\n }\n\n if(!nodesData.get(od.dest_name)) {\n const newNode = {\n name: od.dest_name,\n incoming: [newLink],\n outgoing: [],\n incomingTotal: newLink.value,\n outgoingTotal: 0\n };\n\n \tnodesData.set(od.dest_name, newNode); \n \tnewLink.target = newNode;\n\n } else{\n\n \t\tconst existingNode = nodesData.get(od.dest_name);\n \t\texistingNode.incoming.push(newLink);\n existingNode.incomingTotal += newLink.value;\n newLink.target = existingNode;\n \n }\n \n linksData.push(newLink);\n\n });\n \n \treturn{\n \t\tnodesData: Array.from(nodesData.values()),\n \t\tlinksData: linksData\n \t}\n=======\n\tlet filteredData = data.filter(d => d.year === year);\n\n\tconst nodesData = new Map();\n\tconst linksData = [];\n\n\tfilteredData.forEach(od => {\n\n\t\tconst newLink = {\n\t\t\tvalue: od.value,\n\t\t\tsource: null,\n\t\t\ttarget: null\n\t\t};\n\n\t\t//check to see if node is already in the nodesData map\n\t\tif(!nodesData.get(od.origin_name)){\n\t\t\t//make a new node\n\t\t\tconst newNode = {\n\t\t\t\tname: od.origin_name,\n\t\t\t\tincoming: [],\n\t\t\t\toutgoing: [newLink],\n\t\t\t\tincomingTotal: 0,\n\t\t\t\toutgoingTotal: newLink.value\n\t\t\t};\n\n\t\t\tnodesData.set(od.origin_name, newNode);\n\t\t\tnewLink.source = newNode;\n\t\t}else{\n\t\t\t//if node is already present in the map\n\t\t\tconst existingNode = nodesData.get(od.origin_name);\n\n\t\t\texistingNode.outgoing.push(newLink);\n\t\t\texistingNode.outgoingTotal += newLink.value;\n\t\t\tnewLink.source = existingNode;\n\t\t}\n\n\t\tif(!nodesData.get(od.dest_name)){\n\t\t\tconst newNode = {\n\t\t\t\tname: od.dest_name,\n\t\t\t\tincoming: [newLink],\n\t\t\t\toutgoing: [],\n\t\t\t\tincomingTotal: newLink.value,\n\t\t\t\toutgoingTotal: 0\n\t\t\t};\n\n\t\t\tnodesData.set(od.dest_name, newNode);\n\t\t\tnewLink.target = newNode;\n\t\t}else{\n\t\t\tconst existingNode = nodesData.get(od.dest_name);\n\t\t\texistingNode.incoming.push(newLink);\n\t\t\texistingNode.incomingTotal += newLink.value;\n\t\t\tnewLink.target = existingNode;\n\t\t}\n\n\t\tlinksData.push(newLink);\n\n\t});\n\n\treturn {\n\t\tnodesData: Array.from(nodesData.values()),\n\t\tlinksData: linksData\n\t}\n\n>>>>>>> 6ea7b59de0f7d96b4c351f9674909efd2952b09a\n}", "function AddLink(link, sender) {\n var targetUrlStr = UrlHostPathname(link.target);\n\n if (blackListedUrls.has(targetUrlStr))\n return;\n\n var nodes = sessions[currentSession].nodes;\n\n // insert target node\n if (!(nodes[targetUrlStr])) {\n nodes[targetUrlStr] = {\n url: targetUrlStr,\n rawUrl: link.target,\n title: link.title,\n };\n } else {\n nodes[targetUrlStr].title = link.title;\n }\n\n // timestamp\n //if (!(nodes[targetUrlStr].timestamps)) {\n // nodes[targetUrlStr].timestamps = [];\n //}\n //nodes[targetUrlStr].timestamps.push(Date.now());\n var date = new Date();\n nodes[targetUrlStr].hours = date.getHours();\n nodes[targetUrlStr].minutes = date.getMinutes();\n\n // check that source URL is a nonempty string\n if (link.source.length > 0) {\n var sourceUrlStr = UrlHostPathname(link.source);\n\n // check for a self loop\n if (sourceUrlStr != targetUrlStr) {\n var forwardLinks = sessions[currentSession].forwardLinks;\n var backLinks = sessions[currentSession].backLinks;\n\n // insert source vertex\n if (!(nodes[sourceUrlStr])) {\n nodes[sourceUrlStr] = {\n url: sourceUrlStr,\n rawUrl: link.source\n };\n }\n\n if (!(forwardLinks[sourceUrlStr])) {\n forwardLinks[sourceUrlStr] = new Set();\n }\n if (!(backLinks[targetUrlStr])) {\n backLinks[targetUrlStr] = new Set();\n }\n\n // add vertices to the adjacency lists\n forwardLinks[sourceUrlStr].add(targetUrlStr);\n backLinks[targetUrlStr].add(sourceUrlStr);\n }\n }\n}", "function cityLinks(){\n\t\t// Localiza la lista de aldeas\n var cities = find(\"//div[preceding-sibling::div[@class='div4']]//table[@class='f10']\", XPFirst);\n if (!cities) return;\n\n\t\tcities = cities.firstChild;\n\t\tfor (var i = 0; i < cities.childNodes.length; i++){\n\t\t\t// Utiliza el texto de las coordenadas para averiguar el ID necesario para los enlaces\n\t\t\tvar city = cities.childNodes[i];\n\t\t\tcity.textContent.search(/\\((.*)\\n?\\|\\n?(.*)\\)/);\n\t\t\tvar id = xy2id(RegExp.$1, RegExp.$2);\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='a2b.php?z=\" + id + \"'><img src='\" + img('a/def1.gif') + \"' width='12' border='0' title='\" + T('ENV_TROPAS') + \"'></a>\"));\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='build.php?z=\" + id + \"&gid=17'><img src='\" + img('r/4.gif') + \"' height='12' border='0' title='\" + T('ENVIAR') + \"'></a>\"));\n\t\t}\n\t}", "function addLink(link) {\n links.push(link);\n console.log('Connecting node [' + link.firstId + '] and [' + link.secondId + ']');\n }", "function volgendeBol() {\n // var huidigeBolletje = document.querySelector(\".zwart\").parentNode;\n // var nieuweBolletje = huidigeBolletje.nextSibling;\n // console.log(nieuweBolletje.href);\n // window.location = nieuweBolletje;\n\n\n if (imageOne === true) {\n event.preventDefault();\n document.getElementById(\"Two\").click();\n imageOne = false;\n imageTwo = true;\n } else if (imageTwo === true) {\n event.preventDefault();\n document.getElementById(\"Three\").click();\n imageTwo = false;\n imageThree = true;\n } else if (imageThree === true) {\n event.preventDefault();\n document.getElementById(\"Four\").click();\n imageThree = false;\n imageFour = true;\n } else if (imageFour === true) {\n event.preventDefault();\n document.getElementById(\"Five\").click();\n imageFour = false;\n imageFive = true;\n } else if (imageFive === true) {\n event.preventDefault();\n document.getElementById(\"Six\").click();\n imageFive = false;\n imageSix = true;\n } else if (imageSix === true) {\n event.preventDefault();\n document.getElementById(\"One\").click();\n imageSix = false;\n imageOne = true;\n }\n}", "function quickLinks(){\r\n\t\tvar menu = find(\"//td[@class='menu']\", XPFirst);\r\n\t\tfor (var j = 0; j < 2; j++) for (var i = 0; i < menu.childNodes.length; i++) if (menu.childNodes[i].nodeName == 'BR') removeElement(menu.childNodes[i]);\r\n\t\tvar links = [\t0,\r\n\t\t\t\t[T('ENV_TROPAS'), \"a2b.php\"],\r\n\t\t\t\t[\"联盟概况\", \"allianz.php\"],\r\n\t\t\t\t[T('ALIANZA_ATTACK'), \"allianz.php?s=3\"],\r\n\t\t\t\t[T('SIM'), \"warsim.php\"],\r\n\t\t\t\t[\"行宫\", \"build.php?gid=25\"],\r\n\t\t\t\t[\"皇宫\", \"build.php?gid=26\"],\r\n\t\t\t\t[\"英雄园\", \"build.php?gid=37\"],\r\n//\t\t\t\t[\"市镇厅\", \"build.php?gid=24\"],\r\n\t\t\t\t[\"中心大楼\", \"build.php?gid=15\"],\r\n//\t\t\t\t[T('COMP'), \"http://trcomp.sourceforge.net/?lang=\" + idioma, \"_blank\"],\r\n//\t\t\t\t[T('CALC'), \"http://www.denibol.com/~victor/travian_calc/\", \"_blank\"],\r\n\t\t\t\t0,\r\n\t\t\t\t[T('DUNIUMAP'), \"http://tra.duniu.com/map/\", \"_blank\"],\r\n\t\t\t\t[T('MAPA'), \"http://travmap.shishnet.org/?lang=zh\", \"_blank\"],\r\n\t\t\t\t[T('LOGIN'), \"login.php\"],\r\n//\t\t\t\t[T('CHECKNEW'), \"http://userscripts.org/users/51651/scripts\", \"_blank\"],\r\n//\t\t\t\t['TB-CN &#37197;&#32622;', \"spieler.php?s=2\"],\r\n//\t\t\t\t['Travian Beyond', \"http://www.denibol.com/proyectos/travian_beyond/\", \"_blank\"]\r\n\t\t];\r\n\r\n\t\tfor(var i = 0; i < links.length; i++){\r\n\t\t\tif(links[i]){\r\n\t\t\t\tvar a = elem(\"A\", links[i][0]);\r\n\t\t\t\ta.href = links[i][1];\r\n\t\t\t\tif(links[i][2]) a.setAttribute('target', links[i][2]);\r\n\t\t\t\tmenu.appendChild(a);\r\n\t\t\t}else menu.appendChild(document.createElement('HR'));\r\n\t\t}\r\n\r\n\t\tGM_registerMenuCommand('Travian Beyond > '+T('CHECKNEW'), function(){ GM_openInTab(\"http://userscripts.org/users/51651/scripts\")});\r\n\t}", "function findWay(source){\n\n \n \n var id_room = $('#room').val().split(\" \").join(\"\").toLowerCase();\n id_room = zimmerNameId[id_room];\n \n graph = new Graph(map);\n var shortWay = [];\n shortWay = graph.findShortestPath(zonesNameId[source],id_room);\n console.log(\"the short way to the destination : \\n\"+shortWay);\n var len = shortWay.length;\n // the points of each noud which will be drawed\n var points =[];\n\n for(i=0;i<len;i++){\n var key = shortWay[i];\n if(mapCoordnidates[key]){\n object = {\"x\":mapCoordnidates[key].x, \"y\":mapCoordnidates[key].y};\n points.push(object);\n }\n }\n /*for(i=0;i<points.length;i++){\n\n console.log(\"points of the line : \\n\"+points[i].x+' '+points[i].y);\n }*/\n\n // draw the line of the points until the destination\n d3.select(\"#theWay\").attr(\"visibility\",\"hidden\");\n\n // hide the distination to draw it again\n // d3.select(\"#destination\").attr(\"visibility\",\"hidden\");\n\n var lineFunction = d3.svg.line()\n .x(function(d) { return d.x; })\n .y(function(d) { return d.y; })\n .interpolate(\"linear\");\n // the arrow of the end\n var defs = d3.select(\"#svg8\").append(\"svg:defs\");\n\n /* here to generate the marker shape and assign it the \"arrow\" id */\n defs.append(\"svg:marker\")\n .attr(\"id\", \"arrow\")\n .attr(\"viewBox\", \"0 0 10 10\")\n .attr(\"refX\", 1)\n .attr(\"refY\", 5)\n .attr(\"markerWidth\", 6)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", \"auto\")\n .attr('fill','#3498db')\n .append('svg:path')\n .attr('d', \"M 0 0 L 10 5 L 0 10 z\");\n\n d3.select(\"#theWay\").attr(\"d\", lineFunction(points))\n .attr(\"id\",\"theWay\")\n .attr(\"stroke\", \"#3498db\")\n .attr(\"stroke-width\", 2)\n .attr(\"fill\", \"none\")\n .attr(\"visibility\",\"visible\")\n .attr('marker-end', 'url(#arrow)');\n // draw the destination\n // d3.select(\"#\"+id_room)\n // .style(\"fill\",\"#d35400\")\n // .attr(\"r\",3)\n // .attr('id','destination')\n // .attr(\"visibility\",\"visible\");\n }// end finWay", "function mapa1(){\n // Crea un arreglo con los nodos visitados hasta ahora.\n var nodes = [\n \n {id: 1, label: 'Brasil'},\n ];\n\n // Crea un arreglo con las conexiones entre los nodos.\n var edges = [\n\n ];\n // Crea un arreglo con los nodos activos.\n var activeNode = [ 1 ];\n mapa( nodes, edges, activeNode );\n }", "function eLink(db,nm) {\nel = document.createElement(\"a\");\nel.setAttribute(\"target\",\"_blank\");\ndbs = new Array(\"http://www.wowarmory.com/search.xml?searchType=items&searchQuery=\",\"http://www.wowhead.com/?search=\",\"http://www.thottbot.com/?s=\",\"http://wow.allakhazam.com/search.html?q=\");\ndbTs = new Array(\"Armory\",\"Wowhead\",\"Thottbot\",\"Allakhazam\");\ndbHs = new Array(\"&real; \",\"&omega; \",\"&tau; \",\"&alpha;\");\nel.href = dbs[db]+nm;\nel.setAttribute(\"title\",dbTs[db]);\nel.innerHTML = dbHs[db];\nreturn el;\n}", "function buildLink(xx,yy,ii,jj,kk,ll,colonyData){\r\n\tgetCell(xx,yy,ii,jj).innerHTML = createLink(constructionUrl(kk,ll,colonyData),getCell(xx,yy,ii,jj).innerHTML);\r\n}", "function compareLink(link1, link2) {\n return (((link1.target == link2.target && link1.source == link2.source) || (link1.target == link2.source && link2.target == link1.source)) ? true : false);\n }", "setLinkDirection(valueRegisterer) {\n let link = this.links.find(link => link === valueRegisterer.element);\n let targetedValue = (link.source == valueRegisterer.newValue[0]) ? valueRegisterer.oldValue : valueRegisterer.newValue;\n link.source = targetedValue[0];\n link.target = targetedValue[1];\n this.svgsManager.edgeManager.update();\n }", "function updateLink(num,add){//if add=1 -> add ; add=0 -> just delete not add after\n //local variables declaration\n var numinlist;\n var SphereList = [];\n var nom;\n for(let i=0;i<listLink.length;i++){//i varies in listLink array\n if(listLink[i].name == num){//if the number in the list equals the function parameter (the num of the link we want to remove)\n numinlist=i;//link number is the list = counter\n }\n }\n nom = listLink[numinlist].label[0].name;\n listLink[numinlist].geometry.dispose();//delete the geometry and the material from the property listLink for the link deleted\n listLink[numinlist].material.dispose();//-----------------------\n world.remove( listLink[numinlist] );//remove the link by his number\n world.remove(listLink[numinlist].label[0]);//delete link's label\n listLink.splice(numinlist,1);//remove the number of the link of the links list\n for(let i=0; i<listSpheres2.length; i++){\n for(let j=0; j<listSpheres2[i].link.length; j++){//in listSpheres2.link property = list\n if (listSpheres2[i].link[j] == num){//checked the number is ok\n SphereList.push(listSpheres2[i].label[0].name);//save spheres label \n listSpheres2[i].link.splice(j,1);//delete the link's number from the list\n }\n }\n } \n if(add==0){//link deleted\n updateConnectedLinks(nom);//delete his name from listSpheres2.linkName property = list\n for(let i=0;i<listSpheres2.length;i++){\n if(listSpheres2[i].label[0].name == SphereList[0] ){//first sphere's label OK\n for(let j=0;j<listSpheres2[i].connectedSphereName.length;j++){\n if(listSpheres2[i].connectedSphereName[j] == SphereList[1]){//second sphere's label is in listSpheres2.connectedSphereName property = list\n listSpheres2[i].connectedSphereName.splice(j,1);//delete the sphere's name from it\n }\n }\n }//same for the other sphere\n else if(listSpheres2[i].label[0].name == SphereList[1]){\n for(let j=0;j<listSpheres2[i].connectedSphereName.length;j++){\n if(listSpheres2[i].connectedSphereName[j] == SphereList[0]){\n listSpheres2[i].connectedSphereName.splice(j,1);\n }\n }\n }\n }\n }\n if(add==1){//add the link each time the sphere is dragged\n //updateConnectedLinks(nom);\n addLink(SphereList[0], SphereList[1], 1,nom);//add the link between the two spheres and her label\n \n }\n}", "function getBilanzLinkFromCell(cell, gameType, label) {\n const __GAMETYPEID = getGameTypeID(gameType);\n let ret = \"\";\n\n if (cell.textContent != \"Vorschau\") { // Nur falls Link nicht bereits vorhanden\n if (__GAMETYPEID > 1) { // nicht moeglich fuer \"Friendly\" bzw. \"spielfrei\"\n const __SEARCHFUN = \":os_bericht(\";\n let paarung = cell.innerHTML.substr(cell.innerHTML.indexOf(__SEARCHFUN) + __SEARCHFUN.length);\n\n paarung = paarung.substr(0, paarung.indexOf(')'));\n paarung = paarung.substr(0, paarung.lastIndexOf(','));\n paarung = paarung.substr(0, paarung.lastIndexOf(','));\n ret = ' <a href=\"javascript:spielpreview(' + paarung + ',' + __GAMETYPEID + ')\">' + label + \"</a>\";\n }\n }\n\n return ret;\n}" ]
[ "0.6334056", "0.6281271", "0.6194358", "0.61137885", "0.61066896", "0.5947109", "0.5852844", "0.57178545", "0.56923974", "0.567906", "0.56699646", "0.5617914", "0.5595881", "0.5522329", "0.55221", "0.5503607", "0.54877067", "0.5457458", "0.54450047", "0.5421896", "0.5419858", "0.5418382", "0.54172957", "0.54170793", "0.54168564", "0.54120266", "0.5410471", "0.5389033", "0.53806454", "0.5376382", "0.536689", "0.5346388", "0.53387356", "0.53334796", "0.5329161", "0.53051907", "0.530421", "0.5302408", "0.5301196", "0.5299322", "0.52987176", "0.5296017", "0.52823806", "0.52787894", "0.5250909", "0.52506083", "0.5247428", "0.5244297", "0.5242976", "0.52292025", "0.5225106", "0.5219788", "0.52178615", "0.5203273", "0.5201022", "0.5200774", "0.5194957", "0.5185779", "0.51842755", "0.5182882", "0.5176764", "0.5175987", "0.51709014", "0.51700604", "0.51660573", "0.5163462", "0.5159404", "0.51542675", "0.515396", "0.51492304", "0.5137274", "0.51340824", "0.51294476", "0.51291305", "0.5129052", "0.512869", "0.5128523", "0.51283324", "0.5124742", "0.512031", "0.51157534", "0.511489", "0.5112735", "0.510742", "0.51044154", "0.510438", "0.51042664", "0.51012486", "0.50992036", "0.5099054", "0.5090722", "0.5089633", "0.5078319", "0.5075623", "0.5070394", "0.5062093", "0.5061285", "0.50607497", "0.5059125", "0.50556594", "0.5055547" ]
0.0
-1
RESPOND_TO add a module to the Wallet by responding to "emailappspace"
respondTo(type) { if (type == 'email-appspace') { let obj = {}; obj.render = function (app, mod) { Tutorial03EmailAppspace.render(app, mod); } obj.attachEvents = function (app, mod) { Tutorial03EmailAppspace.attachEvents(app, mod); } return obj; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function registerWithCommMgr() {\n commMgrClient.send({\n type: 'register-msg-handler',\n mskey: msKey,\n mstype: 'msg',\n mshelp: [\n { cmd: '/wallet_set_trustline', txt: 'setup EVER trustline' },\n { cmd: '/wallet_save_keys', txt: 'save/export wallet keys' },\n ],\n }, (err) => {\n if(err) u.showErr(err)\n })\n}", "handler(app, req, res) {\n wallet.addNewAddress(wallet.getDefaultActiveWallet())\n .then(address => {\n res.send(address);\n })\n .catch(e => res.send({\n api_status : 'fail',\n api_message: `unexpected generic api error: (${e})`\n }));\n }", "contributePiggy (playerContribution, minContribution) {\r\n let self = this\r\n\r\n self.contributionStatus = 'contributing'\r\n\r\n // Format contribution\r\n playerContribution = playerContribution.replace(/,/g, '.')\r\n playerContribution = playerContribution.replace(/^\\./g, '0.')\r\n\r\n // Check user contribution\r\n if (playerContribution === '') {\r\n self.contributionError = this.$t('lang.ethereummixin.contributionNotValid')\r\n return false\r\n } else if (playerContribution < minContribution) {\r\n self.contributionError = this.$t('lang.ethereummixin.contributionTooLow') + ' (' + minContribution + ')'\r\n return false\r\n }\r\n\r\n // Dial node\r\n self.dialJs()\r\n\r\n // Contribute\r\n self.web3js.eth.getAccounts()\r\n .then(function (accounts) {\r\n console.log(accounts)\r\n let currentAddress = accounts[0]\r\n\r\n if (self.abi && self.contractAddress) {\r\n // Get contract\r\n var contract = new self.web3js.eth.Contract(self.abi, self.contractAddress)\r\n // Send contribution\r\n contract.methods.contribute().send({value: Units.convert(playerContribution, 'eth', 'wei'), from: currentAddress})\r\n .on('transactionHash', function (hash) {\r\n console.log('as contributed', hash)\r\n self.contributionStatus = 'contributed'\r\n self.$store.state.ethLoading.contribution = true\r\n self.$store.state.ethPendingTx = hash\r\n self.dialog = true\r\n })\r\n .on('receipt', function (receipt) {\r\n console.log('Contribution receipt:', receipt)\r\n self.$store.state.ethLoading.contribution = false\r\n self.getEthGameData()\r\n self.notify(self.$t('lang.ethereummixin.notification.contribute.title'), self.$t('lang.ethereummixin.notification.contribute.text'))\r\n })\r\n .on('confirmation', function (confirmationNumber, receipt) {\r\n // console.log('confirmation:', confirmationNumber, receipt)\r\n })\r\n .on('error', function (error) {\r\n console.log('error:', error)\r\n })\r\n }\r\n })\r\n }", "addWallet() {}", "function addModule() {\n $('<section>')\n .attr('id', 'rsw-discord')\n .addClass('rsw-custom-module rail-module')\n .append(\n $('<a>')\n .attr('href', ('https://discord.gg/s63bxtW'))\n .append(\n $('<img>')\n .attr('src', 'https://vignette.wikia.nocookie.net/vocaloid/images/2/2d/Discord-Logo-Color.png')\n ),\n $('<div>')\n .append(\n $('<p>')\n .append(\n 'Le Wiki VOCALOID a un serveur officiel de Discord ! Clique le bouton ci-dessous pour rejoindre et dialoguer avec les fans et des contributeurs en direct, ou clique ',\n $('<a>')\n .attr('href', mw.util.wikiGetlink('Wiki Vocaloid:Discord'))\n .text('ici'),\n ' pour lire les règles du tchat de ce serveur.'\n ),\n $('<a>')\n .attr('href', 'https://discord.gg/s63bxtW')\n .addClass('wds-button')\n .text('Recevoir une invitation')\n )\n )\n .insertBefore('#wikia-recent-activity');\n }", "function startExtension() {\n\t\tboolean receiverConfirmed = false;\n\n\t\tif (!receiverConfirmed) {\n\t\t\t//sends auto message to see if other person has extension.\n\t\t\tinsertToTextField(firstString);\n\n\t\t\t//sends Key\n\t\t\tinsertToTextField(publicKeyString);\n\n\n\n\t\t}\n\n\t\telse \n\t\t\tinsertToTextField(publicKeyString);\n\t}", "function sendAdd(itemCode) {\n console.log(\"adding \" + itemCode);\n sendText(\"{\\\"action\\\":\\\"add\\\",\" + \"\\\"item\\\":\\\"\" + itemCode + \"\\\"}\");\n}", "function shareEtherpad() {\n APP.xmpp.addToPresence(\"etherpad\", etherpadName);\n}", "function AddModule(module, slots)\n{\n var tree = document.getElementById(\"device_list\");\n var item = document.createElement(\"treeitem\");\n var row = document.createElement(\"treerow\");\n var cell = document.createElement(\"treecell\");\n cell.setAttribute(\"label\", module);\n row.appendChild(cell);\n item.appendChild(row);\n var parent = document.createElement(\"treechildren\");\n for (var i = 0; i<slots.length; i++) {\n var child_item = document.createElement(\"treeitem\");\n var child_row = document.createElement(\"treerow\");\n var child_cell = document.createElement(\"treecell\");\n child_cell.setAttribute(\"label\", slots[i]);\n child_row.appendChild(child_cell);\n child_item.appendChild(child_row);\n child_item.setAttribute(\"pk11kind\", \"slot\");\n parent.appendChild(child_item);\n }\n item.appendChild(parent);\n item.setAttribute(\"pk11kind\", \"module\");\n item.setAttribute(\"open\", \"true\");\n item.setAttribute(\"container\", \"true\");\n tree.appendChild(item);\n}", "function ManageWishedItem() {}", "function toAdd(){\n let date = new Date\n let year = date.getFullYear()\n const conn = new Client();\n conn.on('ready', function(user) {\n console.log('Client :: ready');\n\n users[year].forEach(e=>{\n conn.exec(`ppp secret add name=${e.username} password=${e.password} service=\"pppoe\" profile=${e.type} comment= \"${e.name} ${e.number}\"`, data=> console.log(\"added\"))\n //set\n conn.exec(`ppp secret set [find name=\"${e.username}\"] password=\"${e.password}\" profile=\"${e.type}\" comment=\"${e.name} ${e.number}\"`, data=>console.log(\"done\"))\n })\n }).connect({\n host: '192.168.93.93',\n port: 22,\n username: 'admin',\n password : \"\",\n privateKey: require('fs').readFileSync('./key.ppk')\n });\n }", "function addToInventory() {\n inquirer\n .prompt([\n {\n type: \"input\",\n message: \"Enter the Item ID of the product you want to add more of: \",\n name: \"desiredItemToAddInventory\"\n },\n ])\n .then(function (answer) {\n connection.query(\"SELECT * FROM bamazon.products WHERE item_id = ?\", [answer.desiredItemToAddInventory], function (err, res) {\n if (err) throw err;\n\n var newStockQuantity = res[0].stock_quantity + 10;\n\n connection.query('UPDATE products SET stock_quantity = ? WHERE item_id = ?', [newStockQuantity, answer.desiredItemToAddInventory], function (error, results, fields) {\n if (error) throw error;\n console.log(\"\\nInventory added!\\n\")\n start();\n });\n })\n })\n}", "async addWallet() {\n // Validate and format address\n let newAddress = this.validateAddress();\n // Deactivate addressInput button\n this.addressInput.changeToDeactive();\n // Check if wallet already exists in list of wallets\n if (wallets.findWallet(this.name, newAddress) !== undefined) {\n communication.message('Address already included in database for this blockchain. Please try again.');\n } else {\n // Get financial data to check existence of account\n let walletFinancialData = await this.getWalletsFinancialData(this.name, [newAddress]);\n // Invalid address for blockchain\n if (walletFinancialData[newAddress].valid === false) {\n communication.message(\"Not a valid address on \" + this.name + \" blockchain. Please try again.\");\n // Valid address\n } else {\n communication.message('Verified.<br> Generating new wallet info for ' + this.name + ' blockchain.');\n // Generate a new Wallet instance based on the new address\n // - saves in wallets and also stores the summaryRange in the database\n await wallets.generateNewWallet(this, newAddress, true);\n // Set current wallet to new wallet\n wallets.processWalletSelection(this.name, newAddress);\n // Update wallets table\n wallets.updateWalletsTable();\n wallets.scrollToBottomOfTable();\n communication.message('Verified.<br> Click on LOAD DATA to obtain transactions from ' + this.name + ' blockchain.');\n }\n }\n }", "function addProduct() {\n // future development: add validation for all prompts\n inquirer.prompt([\n {\n type: \"input\",\n name: \"itemIdNew\",\n message: \"Enter the NEW Item ID\",\n validate: function (input) {\n if (isNaN(input)) {\n return \"Enter a number\";\n } else {\n return true;\n }\n }\n },\n {\n type: \"input\",\n name: \"productNew\",\n message: \"Enter the NEW product name\"\n },\n {\n type: \"input\",\n name: \"departmentNew\",\n message: \"Enter the NEW department\"\n },\n {\n type: \"input\",\n name: \"priceNew\",\n message: \"Enter the NEW product price\"\n },\n {\n type: \"input\",\n name: \"productQuantity\",\n message: \"Enter the NEW product stock quantity\",\n validate: function (input) {\n if (isNaN(input)) {\n return \"Enter a number\";\n } else {\n return true;\n }\n }\n }\n ]).then(function (manager) {\n connection.query(\"INSERT INTO products SET ?\",\n {\n item_id: manager.itemIdNew,\n product_name: manager.productNew,\n department_name: manager.departmentNew,\n price: manager.priceNew,\n stock_quantity: manager.productQuantity\n },\n function (err, res) {\n if (err) throw err;\n console.log(manager.productNew + \" has been added to the product list\");\n console.log('\\n*******************');\n managerOptions();\n })\n\n });\n}", "function registerWithCommMgr() {\n commMgrClient.send({\n type: 'register-msg-handler',\n mskey: msKey,\n mstype: 'msg',\n mshelp: [ { cmd: '/remind_me', txt: 'Add reminder (cron format)' } ],\n }, (err) => {\n if(err) u.showErr(err)\n })\n}", "addAccount() {\n let account\n if (this.state.mnemonic) {\n account = this.addAccountFromMnemonic()\n } else {\n account = this.addAccountFromPrivateKey()\n }\n if (account) {\n // Since this is an imported account disable backup prompts because it\n // is assumed the user already has their mnemonic recorded\n this.props.setBackupWarningStatus(account.address)\n DeviceEventEmitter.emit('addAccount', {\n address: account.address,\n mnemonic: account.mnemonic,\n privateKey: account.privateKey\n })\n // Reset state of component\n this.setState({\n mnemonic: true,\n value: '',\n error: '',\n loading: false\n })\n const onSuccess = this.props.navigation.getParam('navigateOnSuccess')\n if (onSuccess) {\n this.props.navigation.navigate(onSuccess)\n }\n }\n }", "function addEmpl() {\n inquirer\n .prompt([\n {\n type: 'input',\n message: \"What is the new Employee's First Name?\",\n name: \"first_name\",\n },\n {\n type: \"input\",\n message: \"What is the new Employee's Last Name?\",\n name: \"last_name\",\n },\n {\n type: \"list\",\n message: \"What is the employee's job title?\",\n name: \"title\",\n },\n {\n type: \"list\",\n message: \"Who is the employee's manager?\",\n name: \"manager\",\n choices: ['Ashley Rodriguez', 'John Doe', 'Sarah Lourd'],\n }\n ]).then(function (response) {\n // console.log(response)\n addEmployees(response)\n })\n}", "function addToInventory() {\n inquirer\n .prompt([\n {\n name: \"itemId\",\n type: \"input\",\n message: \"Please, enter the ID of the product that you want add more:\"\n },\n {\n name: \"quantity\",\n type: \"input\",\n message: \"Please, enter the quantity:\"\n }\n ])\n .then(function(answerInventory) {\n connection.query(\n \"UPDATE products SET stock_quantity = stock_quantity + \" +\n answerInventory.quantity +\n \" WHERE item_id = \" +\n answerInventory.itemId\n );\n viewProducts();\n });\n}", "function setupAddBox() {\n var addBox = document.querySelector('.addRow input');\n addBox.oninput = function() {\n if (addBox.value == '') {\n clearError();\n return;\n }\n fetchAddonManifest(addBox.value);\n };\n function fetchAddonManifest(url) {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.onerror = function() {\n setError();\n };\n xhr.onload = function() {\n var contentType = xhr.getResponseHeader('content-type') || '';\n if (xhr.status != 200 ||\n contentType.indexOf('/json') == -1) {\n setError();\n return;\n }\n\n var manifest;\n try {\n manifest = JSON.parse(xhr.responseText);\n } catch (e) {\n }\n if (!manifest) {\n setError();\n return;\n }\n\n clearError();\n addAddon(url, manifest);\n };\n try {\n xhr.send(null);\n } catch (e) {\n setError();\n }\n };\n function setError() {\n addBox.classList.add('kTextFieldError');\n };\n function clearError() {\n addBox.classList.remove('kTextFieldError');\n };\n\n function addAddon(url, manifest) {\n _gaq.push(['_trackEvent', 'popup', 'addon_added']);\n\n addBox.value = '';\n port.postMessage({\n command: 'add_addon',\n url: url,\n manifest: manifest\n });\n port.postMessage({\n command: 'toggle_addon',\n enabled: true,\n url: url\n });\n };\n}", "async function sendBonus(addr, amount) {\n chain3.setProvider(new chain3.providers.HttpProvider(MOAC_URL));\n if (chain3.isConnected()) {\n var guessitsing = [0x67, 0x75, 0x65, 0x73, 0x73, 0x69, 0x74, 0x62, 0x6f, 0x6e, 0x75, 0x73];\n //Load the contract ABI\n var txcount = chain3.mc.getTransactionCount(pooladdr);\n var networkid = chain3.version.network;\n var rawTx = {\n from: pooladdr,\n nonce: chain3.intToHex(txcount),\n gasPrice: chain3.intToHex(40000000000),\n gasLimit: chain3.intToHex(200000),\n to: addr,\n value: chain3.intToHex(chain3.toSha(amount, 'mc')),\n data: chain3.toHex('guessitbonus'),\n chainId: networkid\n }\n var cmd1 = chain3.signTransaction(rawTx, poolkey);\n\n await chain3.mc.sendRawTransaction(cmd1, function (err, hash) {\n if (!err) {\n log.debug(\"Succeed!: \", hash);\n log.info(\"The bonus has been sent from poolkey to \", addr);\n //ToDO need record this account.?\n return hash;\n } else {\n log.error(\"Chain3 error:\", err.message);\n return err.message;\n }\n });\n /* NID = chain3.version.network;\n\n chain3.mc.sendTransaction({\n from: pooladdr,\n value: chain3.toSha(amount, \"mc\"),\n to: addr,\n gas: \"22000\",\n gasPrice: chain3.mc.gasPrice,\n data: 'guessit'\n }, function (e, transactionHash) {\n if (!e) {\n console.log(\"Transacation hash:\" + transactionHash);\n }\n console.log(e);\n });*/\n\n\n } else {\n log.error(\"Server RPC not connected!\");\n }\n}", "function appendModule(modulename) {\n\n\t//If modulename is empty, print to user, else print the module with the respective details. \n\tif (modulename == null) {\n\t\tconsole.log(\"Module \"+countOfModules+\" name is empty\");\n\t}else {\n\t\tvar node = '<div class = \"module\" id=\"Module'+countOfModules+'\" onClick=openModuleDetails(\"'+modulename+'\")><div class=\"moduletitle\"><p id = \"ModuleP'+countOfModules+'\">'+modulename+'</p></div><div class=\"modulePrecentage\"><p>69%</p></div></div>';\n\t\tdocument.getElementById('module_elements').innerHTML += node;\n\t}\n\n}", "function addToInvetory() {\n inquirer.prompt([\n {\n type: \"input\",\n name: \"itemID\",\n message: \"Enter the Item ID of the item to be updated\",\n validate: function (input) {\n if (isNaN(input)) {\n return \"Enter the product number\";\n } else {\n return true;\n }\n }\n // future development: validate against list of product item_ids\n },\n {\n type: \"input\",\n name: \"quantityToUpdate\",\n message: \"How many should be added to inventory?\",\n validate: function (input) {\n if (isNaN(input)) {\n return false;\n } else {\n return true;\n }\n }\n }\n ]).then(function (manager) {\n var itemToUpdate = manager.itemID;\n var quantityToUpdate = parseInt(manager.quantityToUpdate);\n\n connection.query(\"UPDATE products SET stock_quantity = stock_quantity + ? WHERE item_id = ?\",\n [\n quantityToUpdate,\n itemToUpdate\n ],\n function (err, res) {\n if (err) throw err;\n console.log(\"Quantity of \" + itemToUpdate + \" has been updated\");\n console.log('\\n*******************');\n managerOptions();\n })\n\n });\n}", "function addManagers() {\n // let bigAsk overwrites the constantly set question list with new ones while this function is running.\n let bigAsk = [{\n type: \"input\",\n message: \"What is the name of this Manager? \\n --\",\n name: \"managerName\"\n },\n {\n type: \"input\",\n message: \"What is this Managers ID? \\n --\",\n name: \"managerId\"\n },\n {\n type: \"input\",\n message: \"What is the email for this Manager? \\n --\",\n name: \"managerEmail\"\n },\n {\n type: \"input\",\n message: \"What is this Managers office Number? \\n --\",\n name: \"officeNumber\"\n }\n ]\n // a new inquiry with the new questions, which creates a new manager.\n Inquirer\n .prompt(bigAsk)\n .then((response) => {\n // console.log(response);\n increaseManagers(response.managerName, response.managerId, response.managerEmail, response.officeNumber)\n console.log(\"\\n ++ Added new Manager to roster.\\n \")\n start()\n })\n}", "function shareEtherpad() {\n connection.emuc.addEtherpadToPresence(etherpadName);\n connection.emuc.sendPresence();\n }", "function welcome(agent){\n agent.add(getTelegramButtons(\"Welcome to Big Brother! I'm responsible for taking care of your apps! Here's what you can do with me:\", actions));\n}", "function addToInventory(callback) {\n // Define questions\n var questions = [\n {\n type: 'input',\n name: 'id',\n message: \"Product ID: \",\n validate: function (value) {\n if (value === '0') {\n connection.end();\n process.exit();\n }\n if (!(productTableInfo.productIDs.includes(value)) || !(/^\\d+$/.exec(value))) {\n return 'Error! Please enter a valid product ID.';\n }\n return true;\n }\n },\n {\n type: 'input',\n name: 'quantity',\n message: \"Quantity to add: \",\n validate: function(value) {\n if (!(/^\\d+$/.exec(value))) {\n return 'Error! Please enter a valid quantity.';\n }\n return true;\n }\n }\n ];\n\n // Prompt user for info\n inquirer.prompt(questions).then(answers => {\n // Check current stock and calculate new stock_quantity\n connection.query(`SELECT stock_quantity\n FROM products\n WHERE id=?`, [answers.id], function (error, results, fields) {\n if (error) throw error;\n var newQuantity = Number(answers.quantity) + parseInt(Number(results[0].stock_quantity));\n \n // Update products table with new stock_quantity\n connection.query(`UPDATE products\n SET stock_quantity =?\n WHERE id=?`,\n [newQuantity, answers.id], function (error, results, fields) {\n if (error) throw error;\n \n // Alert user that stock_quantity has been updated \n console.log('\\nQuantity is now ' + newQuantity + '.\\n')\n\n if (callback) {\n callback();\n }\n });\n });\n });\n}", "function insertNew3TPAllowance() {\n var frm = document.frmAllow;\n if (frm.allowTPAddress.value.length < 41) {\n $(\"#statusFormAllow\").css(\"background-color\", \"Salmon\");\n $(\"#statusFormAllow\").html(\"You must inform appropriate information\");\n return\n }\n $(\"#statusFormAllow\").css(\"background-color\", \"lightblue\");\n $(\"#statusFormAllow\").html(\"Waiting for you to confirm the transaction in MetaMask or another Ethereum wallet software\");\n console.log(\"Sending... \" + frm.allowTPAddress.value);\n contract.allowIssuers(frm.allowTPAddress.value, {from: web3.eth.accounts[0], gas: 3000000, value: 0}, function (err, result) {\n if (!err) {\n $(\"#statusFormAllow\").css(\"background-color\", \"yellow\");\n $(\"#statusFormAllow\").text(\"Transaction sent. Wait until it is mined. Transaction hash: \" + result);\n waitForTxToBeMined(result, \"#statusFormAllow\");\n } else {\n console.error(err);\n $(\"#statusFormAllow\").css(\"background-color\", \"Salmon\");\n $(\"#statusFormAllow\").html(\"Error \" + JSON.stringify(err));\n }\n });\n $(\"#btnStartOverNew3TPAllowance\").show();\n $(\"#btnInsertNew3TPAllowance\").hide();\n}", "function addMember() {\n inquirer.prompt([\n {\n type: 'list',\n name: 'addMember',\n message: 'What type of member would you like to add?',\n choices: [\"Intern\", \"Engineer\", \"Done, build my team\"]\n },\n\n // switch cases based on what user chooses from list. \n // 'Engineer' returns addEngineer function, 'Intern' returns addIntern function, 'Done' finishes prompt and builds team html page.\n ]).then(res => {\n switch (res.addMember) {\n case 'Engineer':\n return addEngineer();\n\n case 'Intern':\n return addIntern();\n\n case 'Done, build my team':\n return buildTeam();\n\n }\n })\n}", "function NaClModuleSentMessage(message)\n{\n ModuleSentMessage(message);\n}", "'AddIdeaIntent' () {\n\t\t\tconst {userId} = this.event.session.user;\n\t\t\tconst {slots} = this.event.request.intent;\n\n\t\t\t// prompt for slot values and request a confirmation for each\n\n\t\t\t// IdeaName\n\t\t\tif (!slots.IdeaName.value) {\n\t\t\t\tconst slotToElicit = 'IdeaName';\n\t\t\t\tconst speechOutput = 'What is the name of this idea?';\n\t\t\t\tconst repromptSpeech = 'Please tell me what you would like to call this idea.';\n\t\t\t\treturn this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech);\n\n\t\t\t} else if (slots.IdeaName.confirmationStatus !== 'CONFIRMED') {\n\n\t\t\t\tif (slots.IdeaName.confirmationStatus !== 'DENIED') {\n\t\t\t\t\t// slot status: unconfirmed\n\t\t\t\t\tconst slotToConfirm = 'IdeaName';\n\t\t\t\t\tconst speechOutput = `The name of your idea is ${slots.IdeaName.value}, correct?`;\n\t\t\t\t\tconst repromptSpeech = speechOutput;\n\t\t\t\t\treturn this.emit(':confirmSlot', slotToConfirm, speechOutput, repromptSpeech);\n\t\t\t\t}\n\n\t\t\t\t// slot status: denied -> reprompt for slot data\n\t\t\t\tconst slotToElicit = 'IdeaName';\n\t\t\t\tconst speechOutput = 'What is the name of the idea you would like to add?';\n\t\t\t\tconst repromptSpeech = 'Please tell me what you would like to call this idea.';\n\t\t\t\treturn this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech);\n\t\t\t}\n\n\t\t\t// IdeaContent\n\t\t\tif (!slots.IdeaContent.value) {\n\t\t\t\tconst slotToElicit = 'IdeaContent';\n\t\t\t\tconst speechOutput = 'So what is your idea?';\n\t\t\t\tconst repromptSpeech = 'Please give me the content for this idea.';\n\t\t\t\treturn this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech);\n\n\t\t\t} else if (slots.IdeaContent.confirmationStatus !== 'CONFIRMED') {\n\n\t\t\t\tif (slots.IdeaContent.confirmationStatus !== 'DENIED') {\n\t\t\t\t\t// slot status: unconfirmed\n\t\t\t\t\tconst slotToConfirm = 'IdeaContent';\n\t\t\t\t\tconst speechOutput = `The idea is ${slots.IdeaContent.value}, correct?`;\n\t\t\t\t\tconst repromptSpeech = speechOutput;\n\t\t\t\t\treturn this.emit(':confirmSlot', slotToConfirm, speechOutput, repromptSpeech);\n\t\t\t\t}\n\n\t\t\t\t// slot status: denied -> reprompt for slot data\n\t\t\t\tconst slotToElicit = 'IdeaContent';\n\t\t\t\tconst speechOutput = 'So what is your idea?';\n\t\t\t\tconst repromptSpeech = 'Please give me the content for this idea.';\n\t\t\t\treturn this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech);\n\t\t\t}\n\n\t\t\t// IdeaRating -- crazy, great, ok\n\t\t\tif (!slots.IdeaRating.value) {\n\t\t\t\tconst slotToElicit = 'IdeaRating';\n\t\t\t\tconst speechOutput = 'Is this a great, crazy or just ok idea?';\n\t\t\t\tconst repromptSpeech = 'Is this a great, crazy or just ok idea?';\n\t\t\t\treturn this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech);\n\n\t\t\t} else if (slots.IdeaRating.confirmationStatus !== 'CONFIRMED') {\n\n\t\t\t\tif (slots.IdeaRating.confirmationStatus !== 'DENIED' && (slots.IdeaRating.value === 'great' || slots.IdeaRating.value === 'crazy' || slots.IdeaRating.value === 'OK')) {\n\t\t\t\t\t// slot status: unconfirmed\n\t\t\t\t\tconst slotToConfirm = 'IdeaRating';\n\t\t\t\t\tconst speechOutput = `This is a ${slots.IdeaRating.value} idea, correct?`;\n\t\t\t\t\tconst repromptSpeech = speechOutput;\n\t\t\t\t\treturn this.emit(':confirmSlot', slotToConfirm, speechOutput, repromptSpeech);\n\t\t\t\t}\n\n\t\t\t\t// slot status: denied -> reprompt for slot data\n\t\t\t\tconst slotToElicit = 'IdeaRating';\n\t\t\t\tconst speechOutput = 'Is this a great, crazy or just ok idea?';\n\t\t\t\tconst repromptSpeech = 'Is this a great, crazy or just ok idea?';\n\t\t\t\treturn this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech);\n\t\t\t}\n\n\t\t\t// all slot values received and confirmed, now add the record to Mura\n\n\t\t\tconst iname = slots.IdeaName.value;\n\t\t\tconst icontent = slots.IdeaContent.value;\n\t\t\tconst irating = slots.IdeaRating.value.toLowerCase();\n\t\t\tconst muraParams = {\n\t\t\t\t\"message\": {\n\t\t\t\t\t\"title\": iname,\n\t\t\t\t\t\"remoteid\": userId,\n\t\t\t\t\t\"contentbody\": icontent,\n\t\t\t\t\t\"irating\": irating\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// console.log('Attempting to add idea', JSON.stringify(muraParams));\n\t\t\t// console.log('Check Data', JSON.stringify(checkIfIdeaExistsParams.message));\n\n\t\t\t// method -- resetting the path from above to point to this specific intents bean in Mura\n\t\t\tvar servicenamesetter = '/index.cfm/_api/rest/v1/alexa/askmuraservice/addAnIdea/';\n\t\t\t// append path with method\n\t\t\toptions.path = servicenamesetter;\n\t\t\t// append body to post call\n\t\t\tvar myNewIdea = JSON.stringify(muraParams);\n\n\t\t\toptions.headers = {\n\t\t\t\t\"Cache-Control\": \"no-cache\",\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t'Authorization': 'Basic ' + apiAuth,\n\t\t\t\t'Content-Length': Buffer.byteLength(myNewIdea)\n\t\t\t};\n\n\t\t\tsetAnIdea(options, myNewIdea).then((json) => {\n\t\t\t\tconsole.log('JSON: ' + json);\n\t\t\t\tvar md = JSON.parse(json);\n\t\t\t\tvar isMuraIdeaAdded = \"\";\n\t\t\t\tisMuraIdeaAdded = md.data;\n\t\t\t\tconsole.log(isMuraIdeaAdded.added);\n\n\t\t\t\t//Anything other than true is considered an error.\\\n\t\tif (isMuraIdeaAdded.added) {\n\n\t\t\t\tconst successMessage = `Idea ${iname} added, and may I say<break strength=\"medium\" />It's wonderful!`;\n\t\t\t\t// this.emit(':tell', `Idea ${iname} added, and may I say<break strength=\"medium\" />It's wonderful!`);\n\t\t\t\tthis.emit(':tellWithCard', successMessage, iname, icontent);\n\t\t\t\tconsole.log('Add item succeeded', json);\n\n\t\t\t} else {\n\n\t\t\t\tconst errorMsg = `You already had the ${iname} idea. Great Idea by the way.`;\n\t\t\t\t// this.emit(':tell', errorMsg);\n\t\t\t\tthis.emit(':tellWithCard', errorMsg, iname, icontent);\n\t\t\t\tconsole.error(errorMsg);\n\n\t\t\t}}).catch((err) => {\n\n\t\t\tconsole.error('ERROR: ' + err);\n\n\t\t});\n\n\t}", "function addInformation() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"rawlist\",\n Message: \"WHAT INFORMATION WOULD YOU LIKE TO ADD?\",\n choices: [\"ADD department\", \"ADD role\", \"ADD employee\"],\n })\n //=======IF YOU WANT TO ADD TO THE DEPARTMENT========\n .then(function (answer) {\n switch (answer.action) {\n case \"ADD department\":\n addDepartment();\n break;\n //========IF YOU WANT TO ADD TO THE ROLE=============\n case \"ADD role\":\n addRole();\n break;\n //========IF YOU WANT TO ADD TO THE EMPLOYEE===========\n case \"ADD employee\":\n addEmployee();\n break;\n }\n });\n}", "function addItem() {\n // prompt for info about the item \n inquirer\n .prompt([\n {\n name: \"item\",\n type: \"input\",\n message: \"What is the item you would like to add?\"\n },\n {\n name: \"department\",\n type: \"input\",\n message: \"What department would you like to place your item in?\"\n },\n {\n name: \"price\",\n type: \"input\",\n message: \"What will the price be per item?\",\n validate: function (value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n },\n {\n name: \"quantity\",\n type: \"input\",\n message: \"How many of the item would you like to stock?\"\n },\n ])\n .then(function (answer) {\n // when finished prompting, insert a new item into the db with that info\n connection.query(\n \"INSERT INTO products SET ?\",\n {\n product_name: answer.item,\n department_name: answer.department,\n price: answer.price,\n stock_quantity: answer.quantity\n },\n function (err) {\n if (err) throw err;\n console.log(\"Your item has been added to bamazon.\");\n // re-prompt manager for a new selection\n startMenu();\n }\n );\n });\n}", "function addInventory() {\n inquirer.prompt(questions).then(function(answer) {\n addUnits(answer.product, answer.units);\n });\n}", "addAccountFromMnemonic() {\n const existingAddresses = this.props.wallet.accounts.map(a => a.address)\n // Use a loop to try the next account in the derivation path\n for (let i = 0; i < 10; i++) {\n // This is the default path but explicitly stated here for clarity\n const derivePath = `m/44'/60'/0'/0/${i}`\n // Web3js doesn't support wallet creation from a mnemonic, so somewhat\n // redundantly we have to include ethersjs. Perhaps migrate everything\n // away from web3js to ethersjs or the functionality will be added to web3js\n // sometime in the future, see:\n // https://github.com/ethereum/web3.js/issues/1594\n let wallet\n try {\n wallet = ethers.Wallet.fromMnemonic(this.state.value.trim(), derivePath)\n } catch (error) {\n let errorMessage = error.message\n if (errorMessage === 'invalid mnemonic') {\n errorMessage = fbt(\n 'That does not look like a valid recovery phrase.',\n 'ImportScreen.invalidRecoveryPhraseError'\n )\n }\n this.setState({ error: String(errorMessage) })\n return false\n }\n if (!existingAddresses.includes(wallet.address)) {\n // Got an account we don't have, use that\n return wallet\n }\n }\n this.setState({\n error: 'Maximum addresses reached'\n })\n return false\n }", "function saveUserAddress(device, wallet) {\n db.query(`INSERT INTO xwf_obyfit_user_challenge (device, wallet)\n VALUES (?,?)`, [device, wallet]);\n device.sendMessageToDevice(device, 'text', 'Your address is saved');\n device.sendMessageToDevice(device, 'text', \"Please send me your google id\");\n //toPlay.stackGame(device_address, wallet_address); // ask user to play\n}", "async function addRiddle(){\n const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' });\n const account = accounts[0];\n const riddle = document.getElementById(\"riddleToGuess\").value;\n const answer = document.getElementById(\"answer\").value;\n const prize = document.getElementById(\"prizeBounty\").value;\n document.getElementById(\"riddleToG\").innerHTML= document.getElementById(\"riddleToGuess\").value;\n bid = parseInt(prize);\n const transactionParameters = {\n from: account,\n gasPrice: 0x1D91CA3600,\n value: bid\n };\n updateRiddle();\n document.getElementById(\"riddleToGuess\").innerHTML= \"***\";\n document.getElementById(\"answer\").innerHTML=\"***\";\n\n await Riddle.methods.input_riddle(riddle,answer, prize).send(transactionParameters);\n}", "function InsertSpecialOffer()\n{\n /**\n Open the panel NewSpecialOffer\n */\n CreateSpecialOfferPanel('', '', COMMAND_INSERT);\n}", "createAccount(){\n\n console.log('ACCOUNT CREATED')\n\n // // Ropsten URL \n let ropstenRPC = 'https://ropsten.infura.io/c7b70fc4ec0e4ca599e99b360894b699'\n\n // Create a Web3 instance with the url. \n var web3js = new web3(new web3.providers.HttpProvider(ropstenRPC));\n\n\n\n let newAccount = web3js.eth.accounts.create();\n let newAccount_public = newAccount.address\n let newAccount_private = newAccount.privateKey\n\n\n //JSON that is supporting all chains. \n let newJSON = {\n eth : [\n {\n privateKey : newAccount_private,\n publicKey : newAccount_public, \n }\n ],\n eos : [] \n }\n // 0xf65edc67222a17bdb9979e9560f75ac34fae6dc30e6d2145458295bf11739390\n\n //Turn array to string to store in keychain. \n let stored_string = JSON.stringify(newJSON);\n\n\n //Store array with keys in keychain. \n (async function() {\n\n // Store the credentials\n await Keychain.setGenericPassword('null', stored_string);\n \n })();\n\n this.props.navigator.push({\n id : 'AccountCreated',\n passProps : {\n privateKey : newAccount_private,\n publicKey : newAccount_public\n }\n })\n \n }", "addNewAccount() {\n return __awaiter(this, void 0, void 0, function* () {\n const primaryKeyring = privates\n .get(this)\n .keyring.getKeyringsByType('HD Key Tree')[0];\n /* istanbul ignore if */\n if (!primaryKeyring) {\n throw new Error('No HD keyring found');\n }\n const oldAccounts = yield privates.get(this).keyring.getAccounts();\n yield privates.get(this).keyring.addNewAccount(primaryKeyring);\n const newAccounts = yield privates.get(this).keyring.getAccounts();\n yield this.verifySeedPhrase();\n this.updateIdentities(newAccounts);\n newAccounts.forEach((selectedAddress) => {\n if (!oldAccounts.includes(selectedAddress)) {\n this.setSelectedAddress(selectedAddress);\n }\n });\n return this.fullUpdate();\n });\n }", "function addToInventory() {\n //\n inquirer\n .prompt({\n name: \"addMore\",\n type: \"list\",\n message: \"Which product would you like to add more to inventory ? Choose Item ID from the list.\",\n choices: [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\"]\n })\n .then(function (answer) {\n\n // get the quantity customer would like to purchase\n inquirer\n .prompt({\n name: \"howMany\",\n type: \"input\",\n message: \"How much more is being stocked ? \"\n })\n .then(function (quantity) {\n\n // based on the customer item selection, quantity to purchase, price is calculated and inventory will be updated upon purchase.\n connection.query(\"UPDATE products SET stock_quantity = stock_quantity + ? WHERE item_id= ?\", [parseFloat(quantity.howMany), answer.addMore], function (err, res) {\n if (err) throw err;\n // Log all results of the SELECT statement\n listUpdProducts(answer.addMore);\n });\n\n });\n\n //\n\n });\n\n //\n\n}", "async function addDepartmentPrompts() {\n const deptPrompts = [\n {\n type: 'input',\n name: 'department',\n message: 'Enter new department name :',\n\n }\n ]\n\n const newDepartment = await inquirer.prompt(deptPrompts);\n await addDepartment(newDepartment.department);\n}", "function addToInventory(){\n\tclearScreen();\n\tconsole.log(\" Update Bamazon Inventory \".bgWhite.red);\n\n\tconnection.query(\"SELECT * FROM products\", function(err, results){\n\t\tif(err) throw err;\n\t\tvar itemArray = [];\n\t\t//pushes each item into an itemArray\n\t\tfor(var i=0; i<results.length; i++){\n\t\titemArray.push(results[i].productName);\n\t}\n\tinquirer.prompt([{\n\t\ttype: \"list\",\n\t\tname: \"product\",\n\t\tchoices: itemArray,\n\t\tmessage: \"For which item would you like to increase inventory?\"\n\t},\n\t{\n\t\ttype: \"input\",\n\t\tname: \"qty\",\n\t\tmessage: \"Increase by how much?\",\n\t\tvalidate: function(value){\n\t\t\tif(isNaN(value) === false){return true;}\n\t\t\telse{return false;}\n\t\t}\n }]).then(function(answers){\n\t\t\tvar currentQty;\n\t\t\tfor(var i=0; i<results.length; i++){\n\t\t\t\tif(results[i].productName === answers.product){\n\t\t\t\t currentQty = results[i].stockQuantity;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconnection.query(\"UPDATE products SET ? WHERE ?\", [\n\t\t\t\t{stockQuantity: currentQty + parseInt(answers.qty)},\n\t\t\t\t{productName: answers.product}\n\t\t\t], function(err, results){\n\t\t\t\tif(err) throw err;\n\t\t\t\tconsole.log(colors.bgYellow.blue(\"The quantity for \"+ answers.product + \" was updated by \" + parseInt(answers.qty) + \" \\(New Total: \" + (currentQty + parseInt(answers.qty)) + \"\\)\"));\n\t\t\t\tstart();\n\t\t\t});\n\t\t})\n\t});\n}", "function addInv() {\n inquirer.prompt([\n //Ask the manager the ID of the item they want to increase the inventory for\n {\n type: \"input\",\n name: \"idNumber\",\n message: \"What is the id number of the product for which you would like to increase the inventory?\"\n },\n {\n type: \"input\",\n name: \"quantity\",\n message: \"How many units would you like to add to the inventory?\"\n }\n ]).then(function(user) {\n //Get the current inventory of the product\n // connection.query(\"SELECT stock_quantity FROM products WHERE id = ?\", [user.idNumber], function(err, res) {\n // if(err) throw err;\n // })\n //Update the database with the new inventory\n connection.query(\"UPDATE products SET stock_quantity = stock_quantity + ? WHERE id = ?\", [(user.quantity), user.idNumber], function(err) {\n if (err) throw err;\n promptUser();\n });\n });\n}", "function addInv() {\n\n // get the product and amount to increase inventory by\n inquirer.prompt([\n {\n name: \"id\",\n type: \"input\",\n message: \"Add inventory to which product ID?\"\n },\n {\n name: \"qty\",\n type: \"input\",\n message: \"Add how much to inventory?\"\n }\n ]).then(function (admin) {\n\n // update the inventory as specified\n connection.query(\"UPDATE products SET stock_quantity = stock_quantity + ? WHERE item_id = ?;\", [admin.qty, admin.id], function (err, rows, fields) {\n if (err) throw err;\n\n // ask the user if they want to continue\n doAnother();\n\n });\n\n });\n\n}", "function add_extra() {\n Personals.add_extra(vm.uid, {\n \"extra_client\": vm.new_extra.id,\n }).then(clntAddExtraSuccessFn, clntAddExtraErrorFn);\n function clntAddExtraSuccessFn(data, status, headers, config) {\n activate();\n }\n function clntAddExtraErrorFn(data, status, headers, config) {\n console.log(data);\n }\n }", "addAccount(peerAddr, plugin) {\n let accts = this.getAccounts();\n accts[peerAddr] = plugin;\n globalState.set('000-reputation-accounts', accts);\n this._tryRegisterAcct(peerAddr, plugin);\n }", "function addNewModule() {\n\tcountOfModules++;\n\tvar modulename = document.getElementById(\"module_name\").value;\n\tconsole.log(\"Created Module : \"+modulename);\n\tconsole.log(\"Number of existing modules \"+countOfModules);\n\tvar node = '<div class = \"module\" id=\"Module'+countOfModules+'\" onClick=openModuleDetails(\"'+modulename+'\")><div class=\"moduletitle\"><p id = \"ModuleP'+countOfModules+'\">'+modulename+'</p></div><div class=\"modulePrecentage\"><p>69%</p></div></div>';\n\tdocument.getElementById('module_elements').innerHTML += node;\n\n\t//Close popupup and save the modules\n\tclosepopup();\n\tsaveModules();\n\n}", "function addToInv() {\n\n\tinquirer.prompt([\n\t\t{\n\t\t\tname: \"itemid\",\n\t\t\tmessage: \"Please enter the ID of the item you would like to add inventory for.\",\n\t\t\ttype: \"input\",\n\t\t\tvalidate: function(value) {\n \t\tif (isNaN(value) === false) {\n\t\t return true;\n\t\t }\n\t\t return false;\n\t\t }\t\t\n\t\t}, \n\t\t{\n\t\t\tname: \"amount\",\n\t\t\tmessage: \"Please enter the amount of units you would like to add.\",\n\t\t\ttype: \"input\",\n\t\t\tvalidate: function(value) {\n \t\tif (isNaN(value) === false) {\n\t\t return true;\n\t\t }\n\t\t return false;\n\t\t }\n\t\t}\n\n\t]).then(function(input) {\n\t\tconnection.query(\"SELECT * FROM products WHERE ?\", {item_id: input.itemid}, function(error, response) {\n\t\t\tif (error) throw error;\n\t\t\tvar currentQuantity = response[0].stock_quantity;\n\n\n\t\t\tconnection.query(\"UPDATE products SET ? WHERE ?\", [{\n\t\t\t\tstock_quantity: currentQuantity + parseInt(input.amount)\n\t\t\t}, {\n\t\t\t\titem_id: input.itemid\n\t\t\t}], function(error, response2) {\n\t\t\t\tif (error) throw error;\n\t\t\t\tconsole.log(\"Successfully added \" + input.amount + \" units of '\" + response[0].product_name + \"' to inventory.\");\n\t\t\t\treturnToMenu();\n\t\t\t})\n\n\t\t})\n\t})\n}", "function addProduct() {\n console.log(\"add product fxn\");\n inquirer.prompt([\n {\n name: \"addProduct\",\n type: \"input\",\n message: \"What is the product you would like to add?\"\n },\n {\n name: \"department\",\n type: \"input\",\n message: \"What department would you like to place your product in?\"\n },\n {\n name: \"price\",\n type: \"input\",\n message: \"What would you like its selling price to be?\",\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n },\n {\n name: \"inventory\",\n type: \"input\",\n message: \"How many units of this product would you like to add to inventory?\",\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n }\n ]).then(function(answer) {\n // when finished prompting, insert a new item into the db with that info\n connection.query(\n \"INSERT INTO products SET ?\",\n {\n product_name: answer.addProduct,\n department_name: answer.department,\n price: answer.price,\n stock_quantity: answer.inventory\n },\n function(err) {\n if (err) throw err;\n console.log(\"Your product was added successfully!\");\n // re-prompt the user for if they want to bid or post\n menuOptions();\n }\n );\n });\n connection.end();\n }", "addModule(modulePath) {\n return this.ctx.audioWorklet.addModule(this.baseHref + modulePath);\n }", "function inviteOthers() {\n //specify inviteContacts as tab so it will customize button\n showTab(\"inviteContacts\");\n}", "function addToInventory() {\n\t// the below code prompt two messages for the user.\n\tinquirer.prompt([\n\t \t\n\t\t // First message:\n\t\t{\n\t\t\ttype: \"input\",\n\t\t\tname: \"id\",\n\t\t\tmessage: \"Please enter the ID of the product that you would like to add inventory: \"\n\t\t},\n\t\t// Second message:\n\t\t{\n\t\t\ttype: \"input\",\n\t\t\tname: \"quantity\",\n\t\t\tmessage: \"Please enter the quentity that will be added: \"\n\t\t}\n\t]).then(function(answers) {\n\t\tconnection.query(\"SELECT stock_quantity FROM products WHERE ?\", {item_id:answers.id},\n\t\t\t\t \tfunction(error, results) {\n\t\t\t\t if (error) throw error;\n\t\t\t\t var stock_quantity = results[0].stock_quantity;\n\t\t\t\t //Updating the inventory.\n\t\t\t\t connection.query(\"UPDATE products SET ? WHERE ?\", \n\t\t\t\t [ {stock_quantity: stock_quantity + parseInt(answers.quantity)}, {item_id: answers.id}],\n\t\t\t\t function(error, results) {\n\t\t\t\t \tif (error) throw error;\n\t\t\t\t \trunSearch();\n\t\t\t\t\t})// end of query()\n\t\t\t})//end (answers)\n\t})// end then()\n} // end of addToInventory function", "function onBye(req, rem) {\n sipClient.send(sip.makeResponse(req, 200, 'OK'));\n}", "function addPartner(pAddr, partnerid, GLN, name, partnerAddress, proof, typeofPartner) {\n\tconsole.log('- Calling addPartner smart contract.....');\n\tcontract.methods\n\t\t.addPartner(pAddr, partnerid, GLN, name, partnerAddress, proof, typeofPartner)\n\t\t.send({ from: config.contractOwner, gas: \"200000\" },(err, receipt) => {\n\t\t\tif (!err) {\n\t\t\t\t//console.log(receipt)\n\t\t\t\tconsole.log('- Successful');\t\t\t\t\n\t\t\t} else console.log('- Error:\\n', err);\n\t\t})\n\t\t.then((receipt) => {\n\t\t\t//console.log('- Promise:\\n', receipt)\n\t\t})\n\t\t.catch(async (cause) => {\n\t\t\tconsole.log('- Catched Errror:\\n');\n\t\t});\n\tconsole.log('- Called!');\n}", "function register ()\n{\n if (typeof (webphone_api.plhandler) === 'undefined' || webphone_api.plhandler === null)\n webphone_api.addtoqueue('Register', [parameters]);\n else\n webphone_api.plhandler.Register(parameters);\n}", "function addSomething() {\n return inquirer.prompt([\n {\n type: \"list\",\n name: \"add\",\n message: \"What would you like to add?\",\n choices: [\"Department\", \"Role\", \"Employee\"]\n }\n ]);\n}", "function addEngineers() {\n let bigAsk = [{\n type: \"input\",\n message: \"What is the name of this Engineer? \\n --\",\n name: \"name\"\n },\n {\n type: \"input\",\n message: \"What is this Engineers ID? \\n --\",\n name: \"id\"\n },\n {\n type: \"input\",\n message: \"What is the email for this Engineer? \\n --\",\n name: \"email\"\n },\n {\n type: \"input\",\n message: \"What is this Engineers GitHub username? \\n --\",\n name: \"github\"\n }\n ]\n\n Inquirer\n .prompt(bigAsk)\n .then((response) => {\n // console.log(response);\n increaseEngineers(response.name, response.id, response.email, response.github)\n console.log(\"\\n ++ Added new Engineer to roster.\\n \")\n start()\n })\n}", "function eventAddDelegate(moduleObject, element, event)\n{\n\tvar windowData = new Object();\n\twindowData[\"hide_groups\"] = [\"dynamic\", \"normal\", \"everyone\"];\n\twindowData[\"hide_companies\"] = true;\n\n\tparentWebclient.openModalDialog(-1, 'addressbook', DIALOG_URL+'task=addressbook_modal&storeid='+ moduleObject.storeid +'&type=username_single&source=gab', 800, 500, delegatesFromABCallBack, false, windowData);\n}", "function addUser() {\n inquirer.prompt([\n {\n type: \"input\",\n message: \"Please enter the full name: \".green.italic.bold,\n name: \"fullName\"\n },\n {\n type: \"input\",\n message: \"Please enter the username: \".blue.italic.bold,\n name: \"username\"\n },\n {\n type: \"password\",\n message: \"Please enter the user password: \".green.italic.bold,\n name: \"password\"\n },\n {\n type: \"list\",\n message: \"Please select user type: \".blue.italic.bold,\n name: \"userType\",\n choices: [\"Manager\",\"Supervisor\"]\n }\n ]).then(function (inquirer1) {\n myConnection.insertDatabase(\"users\", {\n full_name: inquirer1.fullName.trim(),\n username: inquirer1.username.trim(),\n user_password: inquirer1.password.trim(),\n user_type: inquirer1.userType.trim()\n }, \"users WHERE username='\" + inquirer1.username.trim() + \"'\", function (res) {\n if (res.affectedRows) {\n console.log(\"\\nSuccessfully added new user.\".yellow);\n console.log(\"Added: \".yellow + inquirer1.fullName.trim().yellow + \" | \".yellow + inquirer1.username.trim()+\" | \"+inquirer1.userType.trim() + \"\\n\".yellow);\n }\n myConnection.goBack(\"Supervisor\", bamazonSupervisor.runBamazonSupervisor);\n }, \"Supervisor\", bamazonSupervisor.runBamazonSupervisor);\n });\n}", "function Add() {\n inquirer\n .prompt([\n {\n type: \"list\",\n name: \"add\",\n message: \"what would you like to add?\",\n choices: [\"Department\", \"Role\", \"Employee\", \"Back\"],\n },\n ])\n .then((res) => {\n switch (res.add) {\n case \"Department\":\n console.log(\"add department function goes here\");\n addDept();\n break;\n case \"Role\":\n console.log(\"add role function goes here\");\n addRole() ;\n break;\n case \"Employee\":\n addEmployee();\n break;\n case \"Back\":\n initPrompt();\n break;\n }\n });\n}", "function addInventory() {\n inquirer.prompt([\n {\n name: 'item',\n type: 'input',\n message: 'What is the Item ID?'\n },\n {\n name: 'amount',\n type: 'input',\n message: 'How many?'\n }\n ]).then(answers => {\n productID = +answers.item;\n amountAdded = +answers.amount;\n updateInventoryInDB(productID, amountAdded);\n showStock();\n });\n}", "function navigateToAddEditBiller(billerCorpId, programId, billerCorpAcctId, isAdd, isMsg, msgType) {\n\tremoveMessageFromDivId();\n\tremoveSuccessOrFailureStrip();\n\tmakeActiveTab('footerHomeTab');\n\tbookmarks.sethash('#addBiller', loadAddEditBill, billerCorpId, programId, billerCorpAcctId, isAdd, isMsg, msgType);\n mainPaymentPageResize();\n}", "async function addMemberFunc() {\n inquirer\n .prompt(addMember)\n .then(function(addMember) {\n if(addMember.title === \"Engineer\") {\n addEngineer();\n }\n else if(addMember.title === \"Intern\") {\n addIntern();\n }\n else {\n let lastContent = `\n </div>\n </div> \n </body>\n </html>\n `;\n fs.appendFileSync(`./output/Roster.html`, lastContent);\n open('./output/Roster.html');\n }\n })\n}", "function addManager() {\n\tinquirer\n\t\t.prompt([\n\t\t\t{\n\t\t\t\tname: 'name',\n\t\t\t\ttype: 'input',\n\t\t\t\tmessage: \"Please enter Manager's name:\",\n\t\t\t\tvalidate: (input) => {\n\t\t\t\t\tif (input) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('--- NOT A VALID INPUT... TRY AGAIN ---');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'id',\n\t\t\t\ttype: 'input',\n\t\t\t\tmessage: \"Enter Manager's ID number:\",\n\t\t\t\tvalidate: (input) => {\n\t\t\t\t\tif (input) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('--- NOT A VALID INPUT... TRY AGAIN ---');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'email',\n\t\t\t\ttype: 'input',\n\t\t\t\tmessage: \"Enter Manager's email address:\",\n\t\t\t\tvalidate: (input) => {\n\t\t\t\t\tif (input) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('--- NOT A VALID INPUT... TRY AGAIN ---');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'officeNumber',\n\t\t\t\ttype: 'input',\n\t\t\t\tmessage: \"Enter Manager's office number:\",\n\t\t\t\tvalidate: (input) => {\n\t\t\t\t\tif (input) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('--- NOT A VALID INPUT... TRY AGAIN ---');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'nextEmp',\n\t\t\t\ttype: 'confirm',\n\t\t\t\tmessage: 'Would you like to add another employee?',\n\t\t\t},\n\t\t])\n\t\t// capture responses and create new manager\n\t\t.then((res, err) => {\n\t\t\tif (err) console.error(err);\n\t\t\tconst newManager = new Manager(\n\t\t\t\tres.name,\n\t\t\t\tres.id,\n\t\t\t\tres.email,\n\t\t\t\tres.officeNumber\n\t\t\t);\n\t\t\t// push new manager to employees array\n\t\t\temployees.push(newManager);\n\n\t\t\tif (res.nextEmp) {\n\t\t\t\tnewMember();\n\t\t\t} else {\n\t\t\t\tconsole.log(employees);\n\t\t\t\trenderTeam();\n\t\t\t}\n\t\t});\n}", "function addEndorsement(identifier) {\n // A user is endorsing a skill! Do some things about it..\n var skill_guid = $(identifier).data('guid');\n\n elgg.action('b_extended_profile/add_endorsement', {\n guid: elgg.get_logged_in_user_guid(),\n skill: skill_guid\n });\n\n\n var targetSkill = $(identifier).data('skill');\n var targetSkillDashed = targetSkill.replace(/\\s+/g, '-').toLowerCase(); // replace spaces with '-' for css classes\n\n\n var endorse_count = $('.gcconnex-skill-entry[data-guid=\"' + skill_guid + '\"]').find('.gcconnex-endorsements-count').text();\n endorse_count++;\n $('.gcconnex-skill-entry[data-guid=\"' + skill_guid + '\"]').find('.gcconnex-endorsements-count').text(endorse_count);\n\n $('.gcconnex-skill-entry[data-guid=\"' + skill_guid + '\"]').append('<span class=\"gcconnex-endorsement-retract elgg-button btn\" onclick=\"retractEndorsement(this)\" data-guid=\"' + skill_guid + '\" data-skill=\"' + targetSkill + '\">Retract Endorsement</span>')\n $('.gcconnex-skill-entry[data-guid=\"' + skill_guid + '\"]').find('.gcconnex-endorsement-add').remove();\n //$('.add-endorsement-' + targetSkillDashed).remove();\n}", "function addDepartment(){\n inquirer\n .prompt(q.addDepartment)\n .then(answer => { \n connection.query(\n queryList.postDepartment, {name:answer.departmentName}, function(err, res){\n if (err) throw err;\n console.log(answer.departmentName + \" department added\");\n startQ();\n }\n );\n })\n .catch(err => {\n if(err) throw err;\n quit();\n });\n}", "function addMore() {\n\n inquirer.prompt([\n {\n type: \"number\",\n message: \"Enter the ID of the Product\",\n name: \"productID\"\n },\n {\n type: \"number\",\n message: \"Enter the quantity you want to add\",\n name: \"productStock\"\n }\n ]).then(function (inqRes) {\n connection.query(\"call checkQuantity(?)\", [inqRes.productID], function (error, respDB) {\n if (error) throw error;\n var quantity = inqRes.productStock + respDB[0][0].quantity;\n connection.query(\"call updateQuantity(?,?,?)\", [inqRes.productID, quantity,0], function (err, respDB) {\n if (error) throw error;\n console.log(\"Successfully added more Quantity\");\n askIfContinuing();\n }); \n });\n });\n}", "function addProduct() {\n prompt.start();\n prompt.get([\n {\n name: \"name\",\n description: colors.blue(\"What item would you like to add?\"),\n type: \"string\",\n required: true\n },\n {\n name: \"department\",\n description: colors.blue(\"In what department would you like to place this item?\"),\n type: \"string\"\n },\n {\n name: \"price\",\n description: colors.blue(\"What is the price of this item?\"),\n type: \"number\",\n required: true\n },\n {\n name: \"quantity\",\n description: colors.blue(\"How many units are there of this item?\"),\n type: \"integer\"\n }\n ], function (err, request) {\n if (err) throw err;\n connection.query(\"INSERT INTO products SET ?\", [{\n productName: request.name,\n departmentName: request.department,\n price: request.price,\n stockQuantity: request.quantity}\n ],function(err, response) {\n if (err) throw err;\n console.log(colors.green(\"You have successfully added \" + request.name + \" to the inventory.\"));\n //asks if user wants to add another item\n inquirer.prompt([\n {\n type: \"confirm\",\n message: colors.blue(\"Would you like to add another item?\"),\n name: \"confirm\"\n }\n ]).then(function(user) {\n if (user.confirm) {\n addProduct();\n }\n else {\n actionPrompt();\n }\n });\n });//ends connection.query\n });//ends function (err, request)\n}//ends addProduct()", "function registerex (accounts)\n{\n if (typeof (webphone_api.plhandler) === 'undefined' || webphone_api.plhandler === null)\n webphone_api.addtoqueue('RegisterEx', [accounts]);\n else\n webphone_api.plhandler.RegisterEx(accounts);\n}", "function addEmRole() {\n inquirer.prompt([\n {\n type: \"input\",\n name: \"Title\",\n message: \"Please enter the title of the position.\"\n },\n {\n name: \"Salary\",\n type: \"input\",\n message: \"Please enter the salary for this role.\"\n },\n {\n name: \"DepartmentID\",\n type: \"input\",\n message: \"What is the department id for this role? Please enter a number. \\n1. Sales \\n2. Finance \\n3. Engineering \\n4. Legal \\n\"\n }\n ]).then((userInput) => {\n connection.query(\"INSERT INTO role SET ?\", \n { \n title: userInput.Title, \n salary: userInput.Salary, \n department_id: userInput.DepartmentID\n }, \n function(err, result) {\n if (err) {\n throw err;\n } else {\n console.log(\"New role added!\");\n console.table(userInput); \n beginApp();\n }\n });\n });\n}", "function managerPrompt() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"list\",\n message: \"Hello Bamazon manager, what would you like to do today?\",\n choices: [\n \"View Products for sale?\",\n \"View Low Inventory?\",\n \"Add to Inventory?\",\n \"Add a New Product?\"\n ]\n })\n .then(function(answer) {\n switch (answer.action) {\n case \"View Products for sale?\":\n viewAllProducts();\n break;\n\n case \"View Low Inventory?\":\n viewLowInventory();\n break;\n\n case \"Add to Inventory?\":\n addInventory();\n break;\n\n case \"Add a New Product?\":\n addNewProduct();\n break;\n }\n\n });\n\n}", "function addInventory() {\n inquirer\n .prompt([\n {\n type: \"list\",\n message: \"Choose What Product to Order for: \",\n choices: productList,\n name: \"product\"\n },\n {\n type: \"input\",\n message: \"How Many do you Want to Order: \",\n name: \"quantity\"\n }\n ]).then(function (inquirerResponse) {\n var item = inquirerResponse.product;\n var query = \"SELECT * FROM products WHERE product_name='\" + item + \"'\";\n var amt = parseInt(inquirerResponse.quantity);\n\n connection.query(query, function (err, res) {\n if (err) throw err;\n\n var stock = res[0].stock_quantity;\n\n updateProduct(item, stock, amt);\n }); //Connection Query End\n });\n}", "function addNewProduct(){\n inquirer.prompt([\n {\n type:\"input\",\n name:\"itemName\",\n message:\"What product would you like to add?\"\n },\n {\n type:\"input\",\n name:\"quantity\",\n message:\"How many would you like to add?\"\n },\n {\n type:\"input\",\n name:\"cost\",\n message:\"What is the cost of this product?\"\n },\n {\n type:\"input\",\n name:\"department\",\n message:\"What department do you want to add this product to?\"\n }\n ]).then(function(response){\n var itemName = response.itemName;\n var quantity = response.quantity;\n var cost = response.cost;\n var department = response.department;\n\n connection.query(\n \"INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('\" + itemName + \"', '\" + department + \"', \" + cost + \", \" + quantity + \")\", \n function(err, res) {\n if (err) throw err;\n\n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"doAgain\",\n message: \"Your product has been successfully added. 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 });\n\n}", "function addTransaction(tx) {\n\n\t // Get user's secret key\n\t keychain.requestSecret(id.account, id.username, function (err, secret) {\n\t if (err) {\n\t console.log(\"client: txQueue: error while unlocking wallet: \", err);\n\n\t return;\n\t }\n\n\t var transaction = ripple.Transaction.from_json(tx.tx_json);\n\n\t transaction.remote = network.remote;\n\t transaction.secret(secret);\n\n\t // If account is funded submit the transaction right away\n\t if ($scope.account.Balance) {\n\t transaction.submit();\n\t }\n\n\t // If not, add it to the queue.\n\t // (Will be submitted as soon as account gets funding)\n\t else {\n\t var item = {\n\t tx_json: tx.tx_json,\n\t type: tx.tx_json.TransactionType\n\t };\n\n\t // Additional details depending on a transaction type\n\t if ('TrustSet' === item.type) {\n\t item.details = tx.tx_json.LimitAmount;\n\t }\n\n\t $scope.userBlob.unshift(\"/txQueue\", item);\n\t }\n\t });\n\t }", "function addToInventory() {\n\tinquirer.prompt([\n\t\t{\n\t\t\tname: \"item\",\n\t\t\ttype: \"input\",\n\t\t\tmessage: \"What would you like to add more of?\"\n\t\t},\n\t\t{\n\t\t\tname: \"quantity\",\n\t\t\ttype: \"input\",\n\t\t\tmessage: \"How much of this product would you like to add?\",\n\t\t\tvalidate: function(value) {\n\t\t\t\tif (isNaN(value) === false) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t]).then(function(answer){\n\t\tconnection.query(\n\t\t\t\"UPDATE products SET ? WHERE ?\",\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tproduct_name: answer.item,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstock_quantity: answer.quantity\n\t\t\t\t},\n\t\t\t],\n\t\t\tfunction(error) {\n\t\t\t\tif (error) throw err;\n\t\t\t\tconsole.log(\"Product successfully updated!\");\n\t\t\t\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\t\t\t\t\tfor (var i = 0; i < res.length; i++) {\n\t\t\t\t\t\tconsole.log(res[i].item_id + \" | \" + res[i].product_name + \" | \" + res[i].price + \" | \" + res[i].stock_quantity);\n\t\t\t\t\t\tconsole.log(\"-----------------------------\");\n\t\t\t\t\t}\n\t\t\t\t\trunSearch();\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t});\n}", "function addNewProduct() {\n inquirer\n .prompt([\n {\n type: \"input\",\n message: \"What is the item you would like to submit?\",\n name: \"postItem\"\n },\n {\n type: \"input\",\n message: \"What department would you like to place your item into?\",\n name: \"category\"\n },\n {\n type: \"input\",\n message: \"What would you like the price to be?\",\n name: \"price\"\n },\n {\n type: \"input\",\n message: \"How many would you like to add?\",\n name: \"stock\"\n }\n ])\n .then(function (answer) {\n var query = connection.query(\n \"INSERT INTO products SET ?\",\n {\n product_name: answer.postItem,\n department_name: answer.category,\n price: answer.price,\n stock_quantity: answer.stock,\n },\n function (err, res) {\n console.log(res.affectedRows + \" item inserted!\\n\");\n // Call postOrBid AFTER the INSERT completes to start\n bamazon();\n }\n );\n });\n}", "async function createNewAccountNode(){\n const password = 'Password'\n const newAccount = await web3.eth.personal.newAccount(password);\n console.log(chalk.cyan(newAccount));\n console.log(chalk.white(\"###### Unlocking the newly created account ########\"));\n let status = await web3.eth.personal.unlockAccount(newAccount, password, 600);\n console.log(chalk.green('Account unlock status: ' + status));\n}", "function addItem() {\n inquirer.prompt(\n [\n {\n type: \"input\",\n message: \"Product name\",\n name: \"product\"\n },\n {\n type: \"input\",\n message: \"What department is it in?\",\n name: \"department\"\n },\n {\n type: \"input\",\n message: \"What's the price?\",\n name: \"price\",\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n },\n {\n type: \"input\",\n message: \"How many do you want?\",\n name: \"qty\",\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n }\n ]).then(function(data){\n connection.query( query,\n {\n product_name: data.product,\n department: data.department,\n price: data.price,\n stock_qty: data.qty\n })\n console.log(data.product + \" added to store!\"); \n setTimeout (function(){\n start();\n }, 1500) \n })\n}", "function addToInventory(){\n \n \n connection.query('SELECT * FROM products', function(err, res){\n if(err) throw err;\n var itemArray = [];\n \n\n for(var i=0; i<res.length; i++){\n itemArray.push(res[i].product_name);\n }\n \n inquirer.prompt([{\n type: \"list\",\n name: \"product\",\n choices: itemArray,\n message: \"Select the product to update quantity\"\n }, {\n type: \"input\",\n name: \"qty\",\n message: `Enter the new quantity of product you selected`,\n \n }]).then(function(ans){\n \n connection.query('UPDATE products SET ? WHERE ?', [\n {stock_quantity: parseInt(ans.qty)}\n ,{product_name: ans.product}\n ], function(err, res){\n if(err) throw err;\n console.log(\"---------------------------------------------------------------------\\n\");\n console.log(`The new quantity of ${ans.product} is ${ans.qty}`);\n console.log(\"---------------------------------------------------------------------\\n\");\n start();\n });\n })\n });\n }", "function addProduct() {\n inquirer.prompt([\n {\n type: \"input\",\n message: \"What item would you like to add?\",\n name: \"product\"\n },\n {\n type: \"input\",\n message: \"What department?\",\n name: \"department\"\n },\n {\n type: \"input\",\n message: \"What's the price?\",\n name: \"price\"\n },\n {\n type: \"input\",\n message: \"How many would you like to stock?\",\n name: \"stock\"\n }\n ]).then(function(inquirerResponse) {\n connection.query(\"INSERT INTO products SET ?\",\n {\n product_name: inquirerResponse.product,\n department_name: inquirerResponse.department,\n price: inquirerResponse.price,\n stock_quantity: inquirerResponse.stock\n },\n function(err, res) {\n if (err) throw err;\n console.log(\"Product inserted!\\n\");\n // Call updateProduct AFTER the INSERT completes\n doWhat();\n }\n )\n })\n}", "function addEmployee() {\n\n inquirer\n var employeeQ = [\n {\n type: \"input\",\n message: \"What is the first name of the employee?\",\n name: \"first_name\"\n },\n {\n type: \"input\",\n message: \"What is the last name of the employee?\",\n name: \"last_name\"\n },\n {\n type: \"input\",\n message: \"What is the employee's title (numerical value 1-8)?\",\n name: \"role_id\"\n },\n {\n type: \"input\",\n message: \"What is the manager id of the new employee (numerical value 1-9)?\",\n name: \"manager_id\"\n }\n\n ]\n inquirer.prompt(employeeQ).then(function (answer) {\n connection.query(\n \"INSERT INTO employee SET ?\",\n {\n first_name: answer.first_name,\n last_name: answer.last_name,\n role_id: answer.role_id,\n manager_id: answer.manager_id,\n },\n function (err) {\n if (err) throw err\n beginTracker()\n //upate employee manager\n }\n )\n })\n}", "function addInventory() {\n var itemID = 0;\n var numItems = 0;\n inquirer\n .prompt([\n {\n name: \"whichProduct\",\n type: \"input\",\n message: \"What is the Item ID?\"\n },\n {\n name: \"numberToAdd\",\n type: \"input\",\n message: \"How many do you want to add?\"\n }\n\n ]).then(function(answer) {\n itemID = parseInt(answer.whichProduct);\n numItems = parseInt(answer.numberToAdd);\n updateInventory(itemID, numItems);\n });\n \n \n}", "function addDepartment() {\n //console.log(\"add department function called\");\n\n inquirer\n .prompt({\n type: \"input\",\n message: \"Enter department name:\",\n name: \"newDepartment\",\n })\n .then((res) => {\n connection.query(\"INSERT INTO department SET ?\", {\n name: res.newDepartment,\n });\n\n console.log(\"Department added\");\n\n start();\n });\n}", "function addInventory() {\n con.query(\"SELECT * FROM products\", (err, res) => {\n inquirer.prompt([{\n message: \"Select which item you would like to add more of.\",\n type: \"list\",\n name: \"item\",\n choices: () => {\n let choiceArray = [];\n res.forEach((element, i) => {\n choiceArray.push(i + 1 + \": \" + element.product_name)\n });\n return choiceArray;\n }\n }, {\n message: \"What amount would you like to add to stock?\",\n name: \"quantity\",\n validate: (value) => {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n }]).then(answer => {\n let chosenItem;\n // this forEach runs through response then matches choice with answer\n res.forEach(element => {\n if (element.product_name === answer.item.split(\": \").pop()) { // <- pops off number and : from answer\n chosenItem = element;\n }\n });\n // parsing integers to get current stock, plus the amount to be added summed\n let currentStock = parseInt(chosenItem.stock_quantity);\n let newStock = parseInt(currentStock) + parseInt(answer.quantity);\n con.query(\"UPDATE products SET stock_quantity =\" + newStock + \" WHERE item_id = \" + chosenItem.item_id, (err, res) => {\n if (err) throw err;\n mainText(`Increased ${chosenItem.product_name} stock by ${answer.quantity}. -- New stock quantity: ${newStock}`)\n startUp();\n })\n })\n })\n}", "function addRecord(){\n inquirer\n .prompt({\n name: \"addRecord\",\n type: \"rawlist\",\n message: \"What type of new data would you like to add?\",\n choices: [\n \"Department\",\n \"Role\",\n \"Employee\",\n \"Go back to previous page\"\n ]\n })\n .then(function(res){\n switch(res[\"addRecord\"]) {\n case \"Department\":\n addDepartment();\n break;\n case \"Role\":\n addRole();\n break;\n case \"Employee\":\n addEmployee();\n break;\n case \"Go back to previous page\":\n startInquiry();\n // connection.end(); \n break;\n }\n }).catch(function(error){\n console.log(error);\n });\n}", "function addItemToEbay() {\r\n addToEbay.value = '1';\r\n }", "async function updateAccount() {\n const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' });\n const account = accounts[0];\n const accountNode = document.getElementById(\"account\");\n if (accountNode.firstChild)\n accountNode.firstChild.remove();\n var textnode = document.createTextNode(account);\n accountNode.appendChild(textnode);\n}", "function modifySearchLoc(senderId){\n if (apartmentType === \"Entire Apartment\"){ \n var modMess = {\n \"attachment\":{\n \"type\":\"template\",\n \"payload\":{\n \"template_type\":\"button\",\n \"text\":\"Would you like to change anything in addition to location?\",\n \"buttons\":[\n {\"type\":\"postback\",\n \"title\":\"Change Price\",\n \"payload\":\"newprice\"\n },\n {\"type\":\"postback\",\n \"title\":\"Change Beds\",\n \"payload\":\"newbeds\"\n },\n {\"type\":\"postback\",\n \"title\":\"Nope\",\n \"payload\":\"nomorechange\"\n }\n ]\n }\n }\n };\n } else {\n var modMess = {\n \"attachment\":{\n \"type\":\"template\",\n \"payload\":{\n \"template_type\":\"button\",\n \"text\":\"Do you want to modify your search? What would you like to change?\",\n \"buttons\":[\n {\"type\":\"postback\",\n \"title\":\"Change Price\",\n \"payload\":\"newprice\"\n }\n ]\n }\n }\n };\n }\n //sendMessage(senderId, \"What would you like to change?\");\n sendMessage(senderId, modMess); \n \n}", "function addToInventory() {\n clearConsole();\n inquirer.prompt([\n {\n type: \"input\",\n name: \"itemID\",\n message: \"Enter ID for Product:\",\n validate: function (value) {\n return validateIsNumeric(value);\n }\n },\n {\n type: \"input\",\n name: \"addUnits\",\n message: \"Enter Number of Additional Units:\",\n validate: function (value) {\n return validateIsNumeric(value);\n }\n }\n ]).then(function (answer) {\n updateQuantity(parseInt(answer.itemID), parseInt(answer.addUnits));\n });\n}", "function promptAddToStock() {\n\n util.printTitle('Add Stock', 40);\n\n inquirer.prompt([{\n type: 'input',\n name: 'itemId',\n message: 'Item ID: '\n },\n {\n type: 'input',\n name: 'qty',\n message: 'QTY to add: '\n }\n ]).then(req => {\n\n // Validate ID input\n if (req.itemId.trim() === '') {\n return util.inputError('Item ID cannot be blank.', () => {\n bamazon.viewProducts().then(promptManagerOptions);\n });\n }\n\n // Validate Item ID and Stock\n bamazon.validateProduct(req.itemId).then(res => {\n\n // ID\n if (!res.length) {\n return util.inputError('Invalid item ID', () => {\n bamazon.viewProducts().then(promptManagerOptions);\n });\n }\n\n // Stock\n if (req.qty < 0 || !req.qty) {\n return util.inputError('Quantity must be greater than 0.', () => {\n bamazon.viewProducts().then(promptManagerOptions);\n });\n }\n\n let item = {\n id: res[0].item_id,\n name: res[0].product_name,\n price: res[0].price,\n stock: res[0].stock_quantity\n };\n\n /**\n * Add stock to product,\n * then log message and show updated product table,\n * then return to manager options prompt.\n */\n console.clear();\n bamazon.modifyStock(item, parseInt(req.qty))\n .then(() => {\n console.log(`(${req.qty}) ${item.name} added. (Total: ${item.stock + parseInt(req.qty)})\\n`);\n return bamazon.viewProducts();\n })\n .then(promptManagerOptions);\n });\n });\n}", "function addToInventory() {\n inquirer.prompt([\n {\n type: \"input\",\n message: \"What is the id of the item you would like to stock?\",\n name: \"item\",\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n },\n {\n type: \"input\",\n message: \"What would you like to set the quantity to?\",\n name: \"amount\",\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n }\n ]).then(function(response){\n connection.query(\"UPDATE products SET ? WHERE ?\", \n [\n {\n stock_quantity: response.amount\n },\n {\n item_id: response.item\n }\n ],\n function(err, res) {\n console.log(\"Inventory Updated!\");\n askIfDone();\n });\n });\n}", "function addInfo() {\n inquirer\n .prompt([\n {\n name: \"addWhat\",\n type: \"list\",\n choices: [\n \"Add departments\",\n \"Add roles\",\n \"Add employees\" ],\n message: \"What would you like to add?\"\n },\n ])\n .then(function(answer) {\n switch (answer.addWhat) {\n case \"Add departments\":\n addDep();\n break;\n \n case \"Add roles\":\n addRole();\n break;\n \n case \"Add employees\":\n addEmp();\n break;\n }\n });\n }", "function addNewItem() {\n inquirer.prompt([\n {\n name: \"name\",\n type: \"input\",\n message: \"Item Name: \"\n },\n {\n name: \"department\",\n type: \"input\",\n message: \"Department Name: \"\n },\n {\n name: \"price\",\n type: \"input\",\n message: \"Enter Price : $\",\n validate: function(value) {\n if (isNaN(value) == false) {\n return true;\n } else {\n return false;\n }\n }\n },\n {\n name: \"qty\",\n type: \"input\",\n message: \"Enter quantity of product available\",\n validate: function(value) {\n if (isNaN(value) == false) {\n return true;\n } else {\n return false;\n }\n }\n },\n ]).then(function(answer) {\n var query = \"INSERT INTO products SET ?\"\n connection.query(query,\n {\n product_name: answer.name,\n department_name: answer.department,\n price: answer.price,\n stock_quantity: answer.qty\n }, \n )\n console.log(\"Item added to inventory successfully!\"); \n managerOptions();\n })\n}", "function addManager() {\n inquirer.prompt(managerQs).then((answers) => {\n const manager = new Manager(answers.name, answers.id, answers.email, answers.officeNumber)\n teamMembers.push(manager);\n questionUser();\n })\n }", "function addInventory() {\n inquirer.prompt([\n {\n type: \"input\",\n name: \"itemID\",\n message: \"\\r\\n\" + \"Enter the ITEM ID for the product you would like to update to: \"\n },\n {\n type: \"input\",\n name: \"stockUpdate\",\n message: \"\\r\\n\" + \"Enter the new stock quantity for this item: \"\n }\n ]).then(function(response) {\n var query = connection.query(\"UPDATE products SET stock_qty = ? WHERE item_id = ?\", [response.stockUpdate, response.itemID],\n function(err, res) {\n if(err) throw err;\n console.log(\"\\r\\n\" + \"-------- \" + chalk.blue(\"BAMAZON UPDATED INVENOTRY\") + \" ----------\" + \"\\r\\n\");\n console.log(\"You updated the stock quantity to: \" + response.stockUpdate + \" for item ID: \" + response.itemID + \"\\r\\n\");\n console.log(\"\\r\\n\" + \" - - - - - - - - - - - - - - - - - - - - - - - - \" + \"\\r\\n\");\n return managerDashboard();\n })\n \n })\n}", "function addWelcome(data) {\r\n addMsg(data, \"server\");\r\n}", "function addNew() {\n inquirer.prompt([\n {\n name: \"product\",\n message: \"What item would you like to add?\"\n },\n {\n name: \"department\",\n message: \"Which Department will it go to?\"\n },\n {\n name: \"price\",\n message: \"How much does it cost? (X.XX)\"\n },\n {\n name: \"stock\",\n message: \"How many will we have in stock?\"\n }\n ]).then(function (response) {\n\n connection.query(\"SELECT product_name FROM products WHERE product_name = ?\", [response.product], function (err, res) {\n\n if (err) throw err;\n\n if (res.length > 0) {\n console.log(\"Product is already in our inventory. Please add to current inventory!\");\n viewProducts();\n }\n else {\n connection.query(`INSERT INTO products SET ?`, {\n product_name: response.product,\n department_name: response.department,\n price: response.price,\n stock_quantity: response.stock\n }, function (err) {\n if (err) throw err;\n viewProducts();\n });\n };\n });\n });\n}", "function addTeamMembers() {\n inquirer\n .prompt([\n {\n type: 'list',\n name: 'addMembers',\n message: 'What would you like to do?',\n choices: [\n 'Add an Engineer',\n 'Add an Intern',\n \"I'm all done. Let's see my team!\",\n ],\n },\n ])\n .then(answers => {\n switch (answers.addMembers) {\n case 'Add an Engineer': {\n promptEngineer();\n break;\n }\n case 'Add an Intern': {\n promptIntern();\n break;\n }\n case \"I'm all done. Let's see my team!\": {\n buildTeam();\n break;\n }\n }\n });\n }", "function addProduct() {\n inquirer.prompt([\n //Ask the manager for the infomation of the new product\n {\n type: \"input\",\n name: \"name\",\n message: \"What is the name of the product you would like to add?\"\n },\n {\n type: \"input\",\n name: \"department\",\n message: \"In which department does this product belong?\"\n },\n {\n type: \"input\",\n name: \"cost\",\n message: \"What is the price of this product?\"\n },\n {\n type: \"input\",\n name: \"quantity\",\n message: \"How many units would you like to add?\"\n }\n ]).then(function(user) {\n connection.query(\"INSERT INTO products SET ?\",\n [{\n product_name: user.name,\n department_name: user.department,\n price: user.cost,\n stock_quantity: user.quantity\n }], function (err) {\n if(err) throw err;\n promptUser();\n });\n \n });\n}", "function notary_send(hash, callback) {\n \n web3.eth.getAccounts(function (error, accounts) {\n contract.methods.addDocHash(hash).send({\n from: accounts[0]\n },function(error, tx) {\n if (error) callback(error, null);\n else callback(null, tx);\n });\n });\n}", "function addDept() {\n console.log(\" ---------------- \\n ADD A DEPARTMENT \\n ----------------\");\n inquirer\n .prompt([\n {\n name: \"dep\",\n type: \"input\",\n message: \"Enter the name of the new department to add.\",\n },\n ])\n .then((answers) => {\n connection.query(\n \"INSERT INTO department SET ?\",\n [\n {\n name: answers.dep,\n },\n ],\n function (error) {\n if (error) throw err;\n console.clear();\n console.log(\"NEW DEPARTMENT ADDED SUCCESSFULLY!\");\n actions();\n }\n );\n });\n}" ]
[ "0.6189353", "0.59274167", "0.5864611", "0.5841397", "0.56313366", "0.55811656", "0.5579221", "0.54397637", "0.54112774", "0.5353078", "0.53012085", "0.525324", "0.5241864", "0.5210839", "0.5164181", "0.5157823", "0.5142047", "0.51215243", "0.5120802", "0.51195604", "0.5111135", "0.510512", "0.5100622", "0.5098177", "0.5087853", "0.50825584", "0.5076514", "0.5067265", "0.50664514", "0.5062316", "0.50448316", "0.5035358", "0.50214493", "0.50188494", "0.50152993", "0.50130004", "0.50114197", "0.5007736", "0.49840662", "0.4978501", "0.49778888", "0.49664825", "0.4960673", "0.49585804", "0.49553305", "0.49519956", "0.49519122", "0.49454176", "0.49303493", "0.4923249", "0.4916143", "0.490742", "0.49010518", "0.4900504", "0.48977172", "0.48934278", "0.48876813", "0.4886192", "0.48811677", "0.48731947", "0.48729396", "0.48700786", "0.48698753", "0.48691726", "0.48682958", "0.48671332", "0.48413453", "0.48400822", "0.4823712", "0.48160407", "0.48147562", "0.4814658", "0.48091638", "0.4807573", "0.48047075", "0.48032418", "0.4802086", "0.4800846", "0.47999138", "0.4799902", "0.47994107", "0.47983512", "0.47958753", "0.47938448", "0.4792899", "0.47916067", "0.47915646", "0.47891608", "0.4781031", "0.47727776", "0.47727126", "0.47710964", "0.4769531", "0.47688928", "0.4768211", "0.47676027", "0.47667888", "0.47618148", "0.47581208", "0.47549784", "0.47537416" ]
0.0
-1