Best JavaScript code snippet using puppeteer
maquinaVirtual.js
Source:maquinaVirtual.js
...343 'GOTOF': function () {344 console.log("GOTOFALSE ");345 var c = _this.cuadruplos[_this.index];346 console.log(c);347 var result = (_this.getValue(c.operandLeft, _this.findType(c.operandLeft)));348 if (result) {349 _this.index++;350 }351 else {352 _this.index = c.result;353 }354 },355 'PRINT': function () {356 var c = _this.cuadruplos[_this.index];357 console.log("PRINT");358 console.log('\x1b[36m%s\x1b[34m%s\x1b[0m', c);359 console.log(_this.findType(c.result));360 _this.result += ">" + _this.getValue(c.result, _this.findType(c.result)) + "\n";361 _this.index++;362 },363 'ERA': function () {364 console.log('\x1b[36m%s\x1b[0m', "=================================================");365 console.log("CREATE MEMORY FOR FUNCTION");366 var c = _this.cuadruplos[_this.index];367 console.log('\x1b[33m%s\x1b[0m', c);368 _this.index++;369 console.log('\x1b[36m%s\x1b[0m', "=================================================");370 },371 'GOSUB': function () {372 console.log('\x1b[36m%s\x1b[0m', "=================================================");373 console.log("GO TO FUNCTION");374 var c = _this.cuadruplos[_this.index];375 var fun = c.result;376 console.log(_this.direccionesFunciones, _this.direccionesFunciones[fun]);377 console.log('\x1b[33m%s\x1b[0m', c);378 _this.stackReturn.push(_this.index);379 _this.index = _this.direccionesFunciones[fun];380 console.log('\x1b[36m%s\x1b[0m', "=================================================");381 },382 'ENDPROC': function () {383 console.log('\x1b[36m%s\x1b[0m', "=================================================");384 console.log("TERMINANDO FUNCION");385 _this.index = _this.stackReturn.pop();386 _this.index++;387 console.log('\x1b[36m%s\x1b[0m', "=================================================");388 },389 '=': function () {390 console.log('\x1b[36m%s\x1b[0m', "=================================================");391 console.log("ASIGNACION");392 var c = _this.cuadruplos[_this.index];393 console.log('\x1b[33m%s\x1b[0m', c);394 var dir = _this.getValue(c.operandLeft, _this.findType(c.operandLeft));395 console.log('\x1b[36m%s\x1b[0m', dir, "DIR");396 var type = _this.findType(c.operandLeft);397 _this.saveValue(c.result, type, _this.getValue(c.operandLeft, _this.findType(c.operandLeft)));398 _this.index++;399 console.log('\x1b[36m%s\x1b[0m', "=================================================");400 },401 '+': function () {402 console.log('\x1b[36m%s\x1b[0m', "=================================================");403 console.log("SUMA");404 var c = _this.cuadruplos[_this.index];405 console.log(c);406 var oL = Number(_this.getValue(c.operandLeft, _this.findType(c.operandLeft)));407 var oR = Number(_this.getValue(c.operandRight, _this.findType(c.operandRight)));408 var resultType = _this.findType(c.result);409 console.log("TYPO ", resultType, "C", c.result);410 _this.saveValue(c.result, resultType, oL + oR);411 console.log("OPL: ", oL, "OPR: ", oR, "RESULT: ", oL + oR);412 _this.index++;413 console.log('\x1b[36m%s\x1b[0m', "=================================================");414 },415 '*': function () {416 console.log('\x1b[36m%s\x1b[0m', "=================================================");417 console.log("MULTIPLICACION");418 var c = _this.cuadruplos[_this.index];419 console.log(c);420 var oL = Number(_this.getValue(c.operandLeft, _this.findType(c.operandLeft)));421 var oR = Number(_this.getValue(c.operandRight, _this.findType(c.operandRight)));422 var resultType = _this.findType(c.result);423 console.log("TYPO ", resultType, "C", c.result);424 _this.saveValue(c.result, resultType, oL * oR);425 console.log("OPL: ", oL, "OPR: ", oR, "RESULT: ", oL * oR);426 _this.index++;427 console.log('\x1b[36m%s\x1b[0m', "=================================================");428 },429 '/': function () {430 console.log('\x1b[36m%s\x1b[0m', "=================================================");431 console.log("DIVISION");432 var c = _this.cuadruplos[_this.index];433 console.log(c);434 var oL = Number(_this.getValue(c.operandLeft, _this.findType(c.operandLeft)));435 var oR = Number(_this.getValue(c.operandRight, _this.findType(c.operandRight)));436 var resultType = _this.findType(c.result);437 if (resultType == 'int') {438 console.log("TYPO ", resultType, "C", c.result);439 _this.saveValue(c.result, resultType, Math.floor(oL / oR));440 console.log("OPL: ", oL, "OPR: ", oR, "RESULT: ", Math.floor(oL / oR));441 }442 else {443 console.log("TYPO ", resultType, "C", c.result);444 _this.saveValue(c.result, resultType, oL / oR);445 console.log("OPL: ", oL, "OPR: ", oR, "RESULT: ", oL / oR);446 }447 _this.index++;448 console.log('\x1b[36m%s\x1b[0m', "=================================================");449 },450 '<': function () {451 console.log('\x1b[36m%s\x1b[0m', "=================================================");452 console.log("COMPARACION");453 var c = _this.cuadruplos[_this.index];454 console.log(c);455 var oL = Number(_this.getValue(c.operandLeft, _this.findType(c.operandLeft)));456 var oR = Number(_this.getValue(c.operandRight, _this.findType(c.operandRight)));457 var r = oL < oR;458 console.log(oL, oR, r);459 console.log("OPL: ", oL, "OPR: ", oR, "RESULT: ", r);460 _this.saveValue(c.result, _this.findType(c.result), r);461 _this.index++;462 console.log('\x1b[36m%s\x1b[0m', "=================================================");463 },464 '>': function () {465 console.log('\x1b[36m%s\x1b[0m', "=================================================");466 console.log("COMPARACION");467 var c = _this.cuadruplos[_this.index];468 console.log(c);469 var oL = Number(_this.getValue(c.operandLeft, _this.findType(c.operandLeft)));470 var oR = Number(_this.getValue(c.operandRight, _this.findType(c.operandRight)));471 var r = oL > oR;472 console.log(oL, oR, r);473 console.log("OPL: ", oL, "OPR: ", oR, "RESULT: ", r);474 _this.saveValue(c.result, _this.findType(c.result), r);475 _this.index++;476 console.log('\x1b[36m%s\x1b[0m', "=================================================");477 },478 '>=': function () {479 console.log('\x1b[36m%s\x1b[0m', "=================================================");480 console.log("COMPARACION");481 var c = _this.cuadruplos[_this.index];482 console.log(c);483 var oL = Number(_this.getValue(c.operandLeft, _this.findType(c.operandLeft)));484 var oR = Number(_this.getValue(c.operandRight, _this.findType(c.operandRight)));485 var r = oL <= oR;486 console.log(oL, oR, r);487 console.log("OPL: ", oL, "OPR: ", oR, "RESULT: ", r);488 _this.saveValue(c.result, _this.findType(c.result), r);489 _this.index++;490 console.log('\x1b[36m%s\x1b[0m', "=================================================");491 },492 '<=': function () {493 console.log('\x1b[36m%s\x1b[0m', "=================================================");494 console.log("COMPARACION");495 var c = _this.cuadruplos[_this.index];496 console.log(c);497 var oL = Number(_this.getValue(c.operandLeft, _this.findType(c.operandLeft)));498 var oR = Number(_this.getValue(c.operandRight, _this.findType(c.operandRight)));499 var r = oL <= oR;500 console.log(oL, oR, r);501 console.log("OPL: ", oL, "OPR: ", oR, "RESULT: ", r);502 _this.saveValue(c.result, _this.findType(c.result), r);503 _this.index++;504 console.log('\x1b[36m%s\x1b[0m', "=================================================");505 },506 '!=': function () {507 console.log('\x1b[36m%s\x1b[0m', "=================================================");508 console.log("COMPARACION");509 var c = _this.cuadruplos[_this.index];510 console.log(c);511 var oL = Number(_this.getValue(c.operandLeft, _this.findType(c.operandLeft)));512 var oR = Number(_this.getValue(c.operandRight, _this.findType(c.operandRight)));513 var r = oL != oR;514 console.log(oL, oR, r);515 console.log("OPL: ", oL, "OPR: ", oR, "RESULT: ", r);516 _this.saveValue(c.result, _this.findType(c.result), r);517 _this.index++;518 console.log('\x1b[36m%s\x1b[0m', "=================================================");519 },520 '==': function () {521 console.log('\x1b[36m%s\x1b[0m', "=================================================");522 console.log("COMPARACION");523 var c = _this.cuadruplos[_this.index];524 console.log(c);525 var oL = Number(_this.getValue(c.operandLeft, _this.findType(c.operandLeft)));526 var oR = Number(_this.getValue(c.operandRight, _this.findType(c.operandRight)));527 var r = oL == oR;528 console.log(oL, oR, r);529 console.log("OPL: ", oL, "OPR: ", oR, "RESULT: ", r);530 _this.saveValue(c.result, _this.findType(c.result), r);531 _this.index++;532 console.log('\x1b[36m%s\x1b[0m', "=================================================");533 }534 };535 }536 maquinaVirtual.prototype.saveValue = function (dir, type, val) {537 if (dir < 21000) {538 console.log("Guardando global");539 console.log(dir, type, val);540 console.log("------------------------");541 this.memoria.saveGlobal(dir, type, val);542 }543 else if (dir < 71000) {544 console.log("Guardando stack");...
judgeFace7.js
Source:judgeFace7.js
...35 face.push(arr[i][0]);36 }37 }38 //å¤æç家åè±é¡º39 if (findType(face, Sequential, 10) === "AJKQT") {40 pai = findType(face, Sequential, 10);41 type = 10;42 return { pai, type }; //è¿åæ大çé¢å符串以åç±»å43 } else {44 //å¤æåè±é¡º45 if (findType(face, Sequential, 10)) {46 pai = findType(face, Sequential, 10);47 type = 9;48 return { pai, type };49 }50 }51 // åè±52 if (c.maxCount >= 5) {53 pai = face54 .map((item) => fuzhi[item])55 .sort((a, b) => a - b)56 .map((item) => jiexi[item])57 .join("");58 if (pai.length > 5) {59 pai = pai.split("").splice(1, 5).join("");60 }61 type = 6;62 return { pai, type };63 }64 } else {65 //åæ¡66 if (findType(faceArr, Four, 13)) {67 pai = findType(faceArr, Four, 13);68 let complement = [69 ...pai.split("").filter((item) => !new Set(faceArr).has(item)),70 ...faceArr.filter((item) => !new Set(pai.split("")).has(item)),71 ];72 pai =73 pai +74 complement75 .map((item) => fuzhi[item])76 .sort((a, b) => a - b)77 .map((item) => jiexi[item])78 .reverse()[0];79 type = 8;80 return { pai, type };81 }82 //ä¸å¸¦äº83 if (findType(faceArr, Three, 13)) {84 let three = findType(faceArr, Three, 13)[0]85 .split("")86 .map((item) => fuzhi[item])87 .sort((a, b) => a - b)88 .join("");89 let threeFlag = three + " " + three;90 let matchType = [];91 for (let i = 0; i < 13; i++) {92 if (numFace.includes(Couple[i])) {93 matchType.push(Couple[i]);94 }95 }96 for (let i = matchType.length - 1; i >= 0; i--) {97 if (!(matchType[i] === threeFlag)) {98 pai =99 findType(faceArr, Three, 13) +100 matchType[i]101 .split(" ")102 .map((item) => jiexi[item])103 .sort()104 .join("");105 type = 7;106 return { pai, type };107 }108 }109 }110 //顺å111 if (findType([...new Set(faceArr)], Sequential, 10)) {112 pai = findType([...new Set(faceArr)], Sequential, 10);113 type = 5;114 return { pai, type };115 } else {116 if (117 [...new Set(faceArr.sort())].join("").includes("2345") &&118 faceArr.sort().join("").includes("A")119 ) {120 pai = "2345A";121 type = 5;122 return { pai, type };123 }124 }125 }126 //ä¸æ¡127 if (findType(faceArr, Three, 13)) {128 let threeFace = findType(faceArr, Three, 13);129 let CoupleFace = [];130 let threeFlag = Number(131 findType(faceArr, Three, 13)[0]132 .split("")133 .map((item) => fuzhi[item])134 .sort((a, b) => a - b)135 .join("")136 );137 faceArr = [138 ...new Set(faceArr.map((item) => fuzhi[item]).sort((a, b) => a - b)),139 ];140 for (let i = faceArr.length - 1; i >= 0; i--) {141 if (!(faceArr[i] === threeFlag)) {142 if (CoupleFace.length < 2) {143 CoupleFace.unshift(String(faceArr[i]));144 }145 }146 }147 CoupleFace = CoupleFace.map((item) => Number(item)).map(148 (item) => jiexi[item]149 );150 pai = threeFace + CoupleFace[1] + CoupleFace[0];151 type = 4;152 return { pai, type };153 }154 //俩对155 if (findType(faceArr, Couple, 13)) {156 let matchType = [];157 for (let i = 0; i < 13; i++) {158 if (numFace.includes(Couple[i])) {159 matchType.push(Couple[i]);160 }161 }162 if (matchType.length >= 2) {163 let firstCouple = matchType[matchType.length - 1]164 .split(" ")165 .map((item) => jiexi[item])166 .sort()167 .join("");168 let firstFlag = firstCouple[0];169 let secondCouple = matchType[matchType.length - 2]170 .split(" ")171 .map((item) => jiexi[item])172 .sort()173 .join("");174 let secondFlag = secondCouple[0];175 let otherArr = [];176 for (let i = 0; i < faceArr.length; i++) {177 if (faceArr[i] !== firstFlag && faceArr[i] !== secondFlag) {178 otherArr.push(faceArr[i]);179 }180 }181 otherArr = otherArr182 .map((item) => fuzhi[item])183 .sort((a, b) => a - b)184 .splice(1, 2)185 .map((item) => jiexi[item]);186 pai = firstCouple + secondCouple + otherArr[1];187 type = 3;188 return { pai, type };189 }190 }191 //ä¸å¯¹192 if (findType(faceArr, Couple, 13)) {193 let matchType = [];194 for (let i = 0; i < 13; i++) {195 if (numFace.includes(Couple[i])) {196 matchType.push(Couple[i]);197 }198 }199 let firstCouple = matchType[matchType.length - 1]200 .split(" ")201 .map((item) => jiexi[item])202 .sort()203 .join("");204 let firstFlag = firstCouple[0];205 let otherArr = [];206 for (let i = 0; i < faceArr.length; i++) {...
sort.js
Source:sort.js
...116router.get('/sort', (req, res) => {117 const type = req.query.name118 switch (type) {119 case 'æç±':120 SortModel.findType('æç±', res)121 break122 case 'å§æ
':123 SortModel.findType('å§æ
', res)124 break125 case 'å¤é£':126 SortModel.findType('å¤é£', res)127 break128 case 'æ ¡å':129 SortModel.findType('æ ¡å', res)130 break131 case 'å¥å¹»':132 SortModel.findType('å¥å¹»', res)133 break134 case 'å¯ç¾':135 SortModel.findType('å¯ç¾', res)136 break137 case 'çè¡':138 SortModel.findType('çè¡', res)139 break140 case 'æ¥æ¼«':141 SortModel.findType('æ¥æ¼«', res)142 break143 case 'é©æ¼«':144 SortModel.findType('é©æ¼«', res)145 break146 case '大女主':147 SortModel.findType('大女主', res)148 break149 case 'å®ç»':150 SortModel.findType('å®ç»', res)151 break152 case 'ç©¿è¶':153 SortModel.findType('ç©¿è¶', res)154 break155 case 'èç³»':156 SortModel.findType('èç³»', res)157 break158 case 'çµå¼':159 SortModel.findType('çµå¼', res)160 break161 case 'çå¹»':162 SortModel.findType('çå¹»', res)163 break164 case 'æç¬':165 SortModel.findType('æç¬', res)166 break167 case 'é½å¸':168 SortModel.findType('é½å¸', res)169 break170 case 'æ稿':171 SortModel.findType('æ稿', res)172 break173 case 'æ»è£':174 SortModel.findType('æ»è£', res)175 break176 case 'æ£è½é':177 SortModel.findType('æ£è½é', res)178 break179 default:180 successSend(res, '请è¾å
¥æ¥è¯¢å
容')181 break182 }183})...
judgeGhost.js
Source:judgeGhost.js
...36 }37 }38 //å¤ææ¯å¦åè±39 if (c.maxCount >= 4) {40 if (findType(face, kSequential, 5)) {41 //ç家åè±é¡º42 let complement = [43 ...findType(face, kSequential, 5)44 .split("")45 .filter((item) => !new Set("AJKQT".split("")).has(item)),46 ..."AJKQT"47 .split("")48 .filter(49 (item) =>50 !new Set(findType(face, kSequential, 5).split("")).has(item)51 ),52 ];53 pai = findType(face, kSequential, 5) + complement;54 type = 10;55 return { pai, type };56 }57 //åè±é¡º58 if (findShun(face, Sequential, 41)) {59 pai = findShun(face, Sequential, 41);60 type = 9;61 return { pai, type };62 }63 }64 //ä¸åè±,å
å é¤èµå65 faceArr.splice(faceArr.indexOf("X"), 1);66 //åæ¡67 if (findType(faceArr, Four, 13)) {68 let theSame = findType(faceArr, Four, 13).split("");69 let obj = findMax(faceArr);70 if (obj.maxCount === 4) {71 //çéæ¬èº«èªå¸¦åæ¡72 if (obj.maxItem == "A") {73 theX = "K"; //èµåèµå¼74 } else {75 theX = "A";76 }77 theSame.push(obj.maxItem);78 theSame.push(theX);79 pai = theSame.join("");80 } else {81 //æ¬èº«æ¯ä¸æ¡82 theX = obj.maxItem;83 faceArr.splice(faceArr.indexOf(obj.maxItem), 3);84 faceArr.splice(faceArr.indexOf(obj.maxItem), 1);85 let max =86 jiexi[faceArr.map((item) => fuzhi[item]).sort((a, b) => b - a)[0]]; //å©ä¸çæ大å
ç´ 87 let arr = [theX, theX, theX, theX, max];88 pai = arr.join("");89 }90 type = 8;91 return { pai, type };92 }93 //ä¸å¸¦äº94 if (findType(faceArr, Three, 13)) {95 let maxFace = findType(faceArr, Three, 13);96 theX = maxFace.split("")[0];97 let complement = [98 ...maxFace.split("").filter((item) => !new Set(faceArr).has(item)),99 ...faceArr.filter((item) => !new Set(maxFace.split("")).has(item)),100 ];101 if (findType(complement, Three, 13)) {102 let cp = findType(complement, Three, 13).split("");103 pai = maxFace + theX + cp[cp.length - 1] + cp[cp.length - 2];104 type = 7;105 return { pai, type };106 }107 }108 //åè±109 if (c.maxCount >= 4) {110 pai = face111 .map((item) => fuzhi[item])112 .sort((a, b) => a - b)113 .map((item) => jiexi[item])114 .join("");115 let arrX = pai116 .split("")117 .map((item) => fuzhi[item])118 .reverse();119 if (arrX[0] !== 14) {120 theX = "A";121 } else {122 if (arrX[1] !== 13) {123 theX = "K";124 } else {125 if (arrX[2] !== 12) {126 theX = "Q";127 } else {128 theX = "J";129 }130 }131 }132 if (pai.length >= 4) {133 let len = pai.length;134 pai =135 pai136 .split("")137 .splice(len - 4, 4)138 .join("") + theX;139 }140 type = 6;141 return { pai, type };142 }143 //顺å144 if (findShun(faceArr, Sequential, 41)) {145 pai = findShun(faceArr, Sequential, 41);146 type = 5;147 return { pai, type };148 }149 //ä¸æ¡150 if (findType(faceArr, Three, 13)) {151 let maxFace = findType(faceArr, Three, 13);152 theX = maxFace.split("")[0];153 let complement = [154 ...maxFace.split("").filter((item) => !new Set(faceArr).has(item)),155 ...faceArr.filter((item) => !new Set(maxFace.split("")).has(item)),156 ];157 let cp = complement158 .map((item) => fuzhi[item])159 .sort((a, b) => a - b)160 .map((item) => jiexi[item]);161 pai = maxFace + theX + cp[cp.length - 1] + cp[cp.length - 2];162 type = 4;163 return { pai, type };164 }165 // ä¸å¯¹...
FindPwdType.js
Source:FindPwdType.js
1var FindType = {2 ValitedUrl: "/FindPwdType/"3}4FindType.Valited = {5 ChangeFindPwdType: function () {6 if ($("#FindPwdType").val() == 'mobile') {7 $("#divmobile").show();8 $("#divemail").hide();9 }10 else if ($("#FindPwdType").val() == 'email') {11 $("#divemail").show();12 $("#divmobile").hide();13 }14 },15 SendCodeClick: function (ctrl) {16 if ($(ctrl).attr("disabled") == "disabled") {17 return false;18 }19 var UserID = $("#UserID").val();20 GetRemoteContent(FindType.ValitedUrl + "SendVerifyCode", { UserID: UserID }, ctrl, FindType.Valited.SendVerifyCodeCallBack);21 },22 SendVerifyCodeCallBack: function (ctrl, data) {23 if (data["ErrorCode"] == 'No') {24 alert(FindType.ErrorString.SendSMSFail);25 return false;26 }27 else if (data["ErrorCode"] == 'Yes') {28 VerifyCodeButtonText(ctrl, 60);29 }30 },31 VerifyCodeValited: function () {32 var UserID = $("#UserID").val();33 var code = $.trim($("#txtmcode").val());34 if (code == '') {35 alert(FindType.ErrorString.NoVerifyCode);36 return false;37 }38 GetRemoteContent(FindType.ValitedUrl + "VerifyCodeValited", { UserID: UserID, Code: code }, '', FindType.Valited.VerifyCodeCallBack);39 },40 VerifyCodeCallBack: function (ctrl, data) {41 if (data["ErrorCode"] == 'Fail') {42 alert(data["ErrorMsg"]);43 return false;44 }45 else if (data["ErrorCode"] == 'Success') {46 window.location = data["ErrorMsg"];47 }48 },49 SendEmail: function () {50 $("#emailtip").hide();51 var UserID = $("#UserID").val();52 GetRemoteContent(FindType.ValitedUrl + "SendEmail", { UserID: UserID }, '', FindType.Valited.SendMailCallBack);53 },54 SendMailCallBack: function (ctrl, data) {55 if (data["ErrorCode"] == 'Success')56 $("#emailtip").show();57 else58 alert(data["ErrorMsg"]);59 }60}61function VerifyCodeButtonText(ctrl, time) {62 $(ctrl).html(FindType.ErrorString.VerifyCodeRemainTime + time + FindType.ErrorString.VerifyCodeSecond);63 $(ctrl).attr("disabled", true);64 $(ctrl).css("color", "gray");65 if (time > 0) {66 var temp = time - 1;67 window.setTimeout(function () { VerifyCodeButtonText(ctrl, temp) }, 1000);68 }69 else {70 $(ctrl).attr("disabled", false);71 $(ctrl).html(FindType.ErrorString.GetVerifyCode);72 $(ctrl).attr("style", "");73 }74}75function GetRemoteContent(url, postData, valitedCtrl, func) {76 $.ajax({77 type: "POST",78 url: url,79 data: postData,80 dataType: "json",81 success: function (data) {82 if (data != null) {83 func(valitedCtrl, data);84 }85 }86 });87}88$(function () {89 $("#FindPwdType").change(function () { return FindType.Valited.ChangeFindPwdType() });90 $("#FindPwdType").change();91 $("#btnmcode").click(function () { return FindType.Valited.SendCodeClick($("#btnmcode")); });92 $("#btnmverify").click(function () { return FindType.Valited.VerifyCodeValited(); });93 $("#btnemail").click(function () { return FindType.Valited.SendEmail(); });...
applyFilter.js
Source:applyFilter.js
...14 let temp_data = data;15 //apply filters by filter keys16 temp_data = temp_data.filter((e) => {17 let is = true;18 if (findType('blacklisted') && e.blacklisted !== filter.blacklisted) {19 is=false;20 }21 if (findType('event_type') && e.event_type !== filter.event_type) {22 is=false;23 }24 if (findType('ip') && e.ip !== filter.ip) {25 is=false;26 }27 if (findType('domain') ) {28 if(typeof filter.domain==='object'){29 is=false;30 filter.domain.forEach((d)=> {31 if (e.domain === d) {32 is=true; 33 }34 });35 }36 }37 if (findType('search') && !e.event_type.includes(filter.search)) {38 is=false;39 }40 if (findType('from') && findType('to')) {41 const from = moment(filter.from),to = moment(filter.to),event_time = moment(e.timestamp);42 if (!(event_time.isBetween(from, to))) {43 is=false;44 }45 }46 return is;47 });48 return temp_data;49}...
findInCache.js
Source:findInCache.js
1module.exports = async d => {2 const data = d.util.openFunc(d);3 if (data.err) return d.error(data.err);4 let [type, name, prop, value, findType = "===", returnValue = "$default"] = data.inside.splits;5 prop = prop.trim() === "" ? "" : "?." + prop6 findType = (7 ["includes", "startsWith", "endsWith"].includes(findType) ? findType : (8 [">=", "==", "===", "<=", "<", ">"].includes(findType) ? findType : d.aoiError.fnError(d, "custom", {inside: data.inside}, "Invalid FindType Provided In")9 )10 )11 try {12 if (["includes", "startsWith", "endsWith"].includes(findType)) {13 data.result = eval(`d.client.cacheManager.caches[type][name].find(x => (prop.trim() === "" ? x : x${prop})[findType](value))`);14 data.result = typeof data.result === "object" ? returnValue === "$default" ? JSON.stringify(data.result, null, 2) : eval(`data.result?.${returnValue}`) : data.result15 } else {16 data.result = eval(`d.client.cacheManager.caches[type][name].find(x => (prop.trim() === "" ? x : x${prop})17 ${findType}18 value19 )`);20 }21 } catch (e) {22 console.error(e);23 data.result = ""24 }25 return {26 code: d.util.setCode(data)27 }...
map-tiles.js
Source:map-tiles.js
...26'prti' //portal in27'prto' //portal out28var room;29 // ctf junk30 room.findType('ctf1');31 room.findType('ctf2');32 room.findType('ctf3');33 room.findType('ctf4');34 room.findType('ctf5');35 room.findType('ctfX');36 //zone crap37 room.findType('nest'); 38 room.findType('zone');39 room.findType('roid');40 room.findType('rock');41 room.findType('snow');42 room.findType('fore');43 room.findType('watr');44 room.findType('heal');45 room.findType('lava');46 room.findType('test');47 //portals48 room.findType('prti');...
Using AI Code Generation
1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.type('input[title="Search"]', 'puppeteer');6 await page.click('input[value="Google
Using AI Code Generation
1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 const browser = await puppeteer.launch();5 const page = await browser.newPage();6 const [response] = await Promise.all([7 page.waitForNavigation(),8 page.click('#link'),9 ]);10 await page.screenshot({path: 'example.png'});11 await browser.close();12})();13const puppeteer = require('puppeteer');14const fs = require('fs');15(async () => {16 const browser = await puppeteer.launch();17 const page = await browser.newPage();18 const [response] = await Promise.all([19 page.waitForNavigation(),20 page.click('#link'),21 ]);22 await page.screenshot({path: 'example.png'});23 await browser.close();24})();25const puppeteer = require('puppeteer');26const fs = require('fs');27(async () => {28 const browser = await puppeteer.launch();29 const page = await browser.newPage();30 const [response] = await Promise.all([31 page.waitForNavigation(),32 page.click('#link'),33 ]);34 await page.screenshot({path: 'example.png'});35 await browser.close();36})();37const puppeteer = require('puppeteer');38const fs = require('fs');39(async () => {40 const browser = await puppeteer.launch();41 const page = await browser.newPage();42 const [response] = await Promise.all([43 page.waitForNavigation(),44 page.click('#link'),45 ]);46 await page.screenshot({path: 'example.png'});47 await browser.close();48})();49const puppeteer = require('puppeteer');50const fs = require('fs');51(async () => {52 const browser = await puppeteer.launch();53 const page = await browser.newPage();54 const [response] = await Promise.all([55 page.waitForNavigation(),56 page.click('#link'),
Using AI Code Generation
1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const element = await page.$('h1');6 const elementType = await page.evaluate(element => element.nodeName, element);7 console.log('Element type is: ', elementType);8 await browser.close();9})();10describe('webdriver.io page', () => {11 it('should have the right title', () => {12 const title = browser.getTitle();13 console.log('Title is: ' + title);14 const element = $('h1');15 const elementType = element.getTagName();16 console.log('Element type is: ' + elementType);17 });18});19module.exports = {20 'Demo test Google' : function (browser) {21 .waitForElementVisible('body', 1000)22 .assert.title('Example Domain')23 .assert.visible('h1')24 .getText('h1', function(result) {25 this.assert.equal(typeof result, "object");26 this.assert.equal(result.status, 0);27 this.assert.equal(result.value, "Example Domain");28 })29 .end();30 }31 };
Using AI Code Generation
1const puppeteer = require('puppeteer');2const fs = require('fs');3const path = require('path');4(async () => {5 const browser = await puppeteer.launch();6 const page = await browser.newPage();7 await page.goto(url);8 await page.type('input[title="Search"]', 'Puppeteer');9 await page.click('input[value="Google Search"]');10 await page.waitForNavigation();11 const pageTitle = await page.title();12 console.log(pageTitle);13 await browser.close();14})();15const puppeteer = require('puppeteer');16const fs = require('fs');17const path = require('path');18(async () => {19 const browser = await puppeteer.launch();20 const page = await browser.newPage();21 await page.goto(url);22 await page.type('input[title="Search"]', 'Puppeteer');23 await page.click('input[value="Google Search"]');24 await page.waitForNavigation();25 const pageTitle = await page.title();26 console.log(pageTitle);27 await browser.close();28})();29const puppeteer = require('puppeteer');30const fs = require('fs');31const path = require('path');32(async () => {33 const browser = await puppeteer.launch();34 const page = await browser.newPage();35 await page.goto(url);36 await page.type('input[title="Search"]', 'Puppeteer');37 await page.click('input[value="Google Search"]');38 await page.waitForNavigation();39 const pageTitle = await page.title();40 console.log(pageTitle);41 await page.screenshot({ path: 'screenshot.png' });42 await browser.close();43})();44const puppeteer = require('puppeteer');45const fs = require('fs');46const path = require('path');47(async () => {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!