# How to use finish method in ava

Best JavaScript code snippet using ava

belt_Array.js

Source:belt_Array.js

1'use strict';2var Curry = require("./curry.js");3var Js_math = require("./js_math.js");4var Caml_primitive = require("./caml_primitive.js");5function get(arr, i) {6 if (i >= 0 && i < arr.length) {7 return /* Some */[arr[i]];8 } else {9 return /* None */0;10 }11}12function getExn(arr, i) {13 if (!(i >= 0 && i < arr.length)) {14 throw new Error("File \"belt_Array.ml\", line 41, characters 6-12");15 }16 return arr[i];17}18function set(arr, i, v) {19 if (i >= 0 && i < arr.length) {20 arr[i] = v;21 return true;22 } else {23 return false;24 }25}26function setExn(arr, i, v) {27 if (!(i >= 0 && i < arr.length)) {28 throw new Error("File \"belt_Array.ml\", line 47, characters 4-10");29 }30 arr[i] = v;31 return /* () */0;32}33function swapUnsafe(xs, i, j) {34 var tmp = xs[i];35 xs[i] = xs[j];36 xs[j] = tmp;37 return /* () */0;38}39function shuffleInPlace(xs) {40 var len = xs.length;41 for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){42 swapUnsafe(xs, i, Js_math.random_int(i, len));43 }44 return /* () */0;45}46function shuffle(xs) {47 var result = xs.slice(0);48 shuffleInPlace(result);49 return result;50}51function reverseInPlace(xs) {52 var len = xs.length;53 var xs\$1 = xs;54 var ofs = 0;55 var len\$1 = len;56 for(var i = 0 ,i_finish = (len\$1 / 2 | 0) - 1 | 0; i <= i_finish; ++i){57 swapUnsafe(xs\$1, ofs + i | 0, ((ofs + len\$1 | 0) - i | 0) - 1 | 0);58 }59 return /* () */0;60}61function make(l, f) {62 if (l <= 0) {63 return /* array */[];64 } else {65 var res = new Array(l);66 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){67 res[i] = f;68 }69 return res;70 }71}72function reverse(xs) {73 var len = xs.length;74 var result = len > 0 ? new Array(len) : /* array */[];75 for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){76 result[i] = xs[(len - 1 | 0) - i | 0];77 }78 return result;79}80function makeByU(l, f) {81 if (l <= 0) {82 return /* array */[];83 } else {84 var res = l > 0 ? (f(0), new Array(l)) : /* array */[];85 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){86 res[i] = f(i);87 }88 return res;89 }90}91function makeBy(l, f) {92 return makeByU(l, Curry.__1(f));93}94function makeByAndShuffleU(l, f) {95 var u = makeByU(l, f);96 shuffleInPlace(u);97 return u;98}99function makeByAndShuffle(l, f) {100 return makeByAndShuffleU(l, Curry.__1(f));101}102function range(start, finish) {103 var cut = finish - start | 0;104 if (cut < 0) {105 return /* array */[];106 } else {107 var arr = new Array(cut + 1 | 0);108 for(var i = 0; i <= cut; ++i){109 arr[i] = start + i | 0;110 }111 return arr;112 }113}114function rangeBy(start, finish, step) {115 var cut = finish - start | 0;116 if (cut < 0 || step <= 0) {117 return /* array */[];118 } else {119 var nb = (cut / step | 0) + 1 | 0;120 var arr = new Array(nb);121 var cur = start;122 for(var i = 0 ,i_finish = nb - 1 | 0; i <= i_finish; ++i){123 arr[i] = cur;124 cur = cur + step | 0;125 }126 return arr;127 }128}129function zip(xs, ys) {130 var lenx = xs.length;131 var leny = ys.length;132 var len = lenx < leny ? lenx : leny;133 var s = len > 0 ? new Array(len) : /* array */[];134 for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){135 s[i] = /* tuple */[136 xs[i],137 ys[i]138 ];139 }140 return s;141}142function zipByU(xs, ys, f) {143 var lenx = xs.length;144 var leny = ys.length;145 var len = lenx < leny ? lenx : leny;146 var s = len > 0 ? (f(xs[0], ys[0]), new Array(len)) : /* array */[];147 for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){148 s[i] = f(xs[i], ys[i]);149 }150 return s;151}152function zipBy(xs, ys, f) {153 return zipByU(xs, ys, Curry.__2(f));154}155function concat(a1, a2) {156 var l1 = a1.length;157 var l2 = a2.length;158 var a1a2 = l1 > 0 ? new Array(l1 + l2 | 0) : /* array */[];159 for(var i = 0 ,i_finish = l1 - 1 | 0; i <= i_finish; ++i){160 a1a2[i] = a1[i];161 }162 for(var i\$1 = 0 ,i_finish\$1 = l2 - 1 | 0; i\$1 <= i_finish\$1; ++i\$1){163 a1a2[l1 + i\$1 | 0] = a2[i\$1];164 }165 return a1a2;166}167function concatMany(arrs) {168 var lenArrs = arrs.length;169 var totalLen = 0;170 var firstArrWithLengthMoreThanZero = /* None */0;171 for(var i = 0 ,i_finish = lenArrs - 1 | 0; i <= i_finish; ++i){172 var len = arrs[i].length;173 totalLen = totalLen + len | 0;174 if (len > 0 && firstArrWithLengthMoreThanZero === /* None */0) {175 firstArrWithLengthMoreThanZero = /* Some */[arrs[i]];176 }177 178 }179 var match = firstArrWithLengthMoreThanZero;180 if (match) {181 var result = new Array(totalLen);182 totalLen = 0;183 for(var j = 0 ,j_finish = lenArrs - 1 | 0; j <= j_finish; ++j){184 var cur = arrs[j];185 for(var k = 0 ,k_finish = cur.length - 1 | 0; k <= k_finish; ++k){186 result[totalLen] = cur[k];187 totalLen = totalLen + 1 | 0;188 }189 }190 return result;191 } else {192 return /* array */[];193 }194}195function slice(a, offset, len) {196 if (len <= 0) {197 return /* array */[];198 } else {199 var lena = a.length;200 var ofs = offset < 0 ? Caml_primitive.caml_int_max(lena + offset | 0, 0) : offset;201 var hasLen = lena - ofs | 0;202 var copyLength = hasLen < len ? hasLen : len;203 if (copyLength <= 0) {204 return /* array */[];205 } else {206 var result = lena > 0 ? new Array(copyLength) : /* array */[];207 for(var i = 0 ,i_finish = copyLength - 1 | 0; i <= i_finish; ++i){208 result[i] = a[ofs + i | 0];209 }210 return result;211 }212 }213}214function fill(a, offset, len, v) {215 if (len > 0) {216 var lena = a.length;217 var ofs = offset < 0 ? Caml_primitive.caml_int_max(lena + offset | 0, 0) : offset;218 var hasLen = lena - ofs | 0;219 var fillLength = hasLen < len ? hasLen : len;220 if (fillLength > 0) {221 for(var i = ofs ,i_finish = (ofs + fillLength | 0) - 1 | 0; i <= i_finish; ++i){222 a[i] = v;223 }224 return /* () */0;225 } else {226 return 0;227 }228 } else {229 return 0;230 }231}232function blitUnsafe(a1, srcofs1, a2, srcofs2, blitLength) {233 if (srcofs2 <= srcofs1) {234 for(var j = 0 ,j_finish = blitLength - 1 | 0; j <= j_finish; ++j){235 a2[j + srcofs2 | 0] = a1[j + srcofs1 | 0];236 }237 return /* () */0;238 } else {239 for(var j\$1 = blitLength - 1 | 0; j\$1 >= 0; --j\$1){240 a2[j\$1 + srcofs2 | 0] = a1[j\$1 + srcofs1 | 0];241 }242 return /* () */0;243 }244}245function blit(a1, ofs1, a2, ofs2, len) {246 var lena1 = a1.length;247 var lena2 = a2.length;248 var srcofs1 = ofs1 < 0 ? Caml_primitive.caml_int_max(lena1 + ofs1 | 0, 0) : ofs1;249 var srcofs2 = ofs2 < 0 ? Caml_primitive.caml_int_max(lena2 + ofs2 | 0, 0) : ofs2;250 var blitLength = Caml_primitive.caml_int_min(len, Caml_primitive.caml_int_min(lena1 - srcofs1 | 0, lena2 - srcofs2 | 0));251 if (srcofs2 <= srcofs1) {252 for(var j = 0 ,j_finish = blitLength - 1 | 0; j <= j_finish; ++j){253 a2[j + srcofs2 | 0] = a1[j + srcofs1 | 0];254 }255 return /* () */0;256 } else {257 for(var j\$1 = blitLength - 1 | 0; j\$1 >= 0; --j\$1){258 a2[j\$1 + srcofs2 | 0] = a1[j\$1 + srcofs1 | 0];259 }260 return /* () */0;261 }262}263function forEachU(a, f) {264 for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){265 f(a[i]);266 }267 return /* () */0;268}269function forEach(a, f) {270 return forEachU(a, Curry.__1(f));271}272function mapU(a, f) {273 var l = a.length;274 var r = l > 0 ? (f(a[0]), new Array(l)) : /* array */[];275 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){276 r[i] = f(a[i]);277 }278 return r;279}280function map(a, f) {281 return mapU(a, Curry.__1(f));282}283function keepU(a, f) {284 var l = a.length;285 var r = l > 0 ? new Array(l) : /* array */[];286 var j = 0;287 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){288 var v = a[i];289 if (f(v)) {290 r[j] = v;291 j = j + 1 | 0;292 }293 294 }295 r.length = j;296 return r;297}298function keep(a, f) {299 return keepU(a, Curry.__1(f));300}301function keepMapU(a, f) {302 var l = a.length;303 var r = new Array(l);304 var j = 0;305 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){306 var v = a[i];307 var match = f(v);308 if (match) {309 r[j] = match[0];310 j = j + 1 | 0;311 }312 313 }314 r.length = j;315 return r;316}317function keepMap(a, f) {318 return keepMapU(a, Curry.__1(f));319}320function forEachWithIndexU(a, f) {321 for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){322 f(i, a[i]);323 }324 return /* () */0;325}326function forEachWithIndex(a, f) {327 return forEachWithIndexU(a, Curry.__2(f));328}329function mapWithIndexU(a, f) {330 var l = a.length;331 var r = l > 0 ? (f(0, a[0]), new Array(l)) : /* array */[];332 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){333 r[i] = f(i, a[i]);334 }335 return r;336}337function mapWithIndex(a, f) {338 return mapWithIndexU(a, Curry.__2(f));339}340function reduceU(a, x, f) {341 var r = x;342 for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){343 r = f(r, a[i]);344 }345 return r;346}347function reduce(a, x, f) {348 return reduceU(a, x, Curry.__2(f));349}350function reduceReverseU(a, x, f) {351 var r = x;352 for(var i = a.length - 1 | 0; i >= 0; --i){353 r = f(r, a[i]);354 }355 return r;356}357function reduceReverse(a, x, f) {358 return reduceReverseU(a, x, Curry.__2(f));359}360function reduceReverse2U(a, b, x, f) {361 var r = x;362 var len = Caml_primitive.caml_int_min(a.length, b.length);363 for(var i = len - 1 | 0; i >= 0; --i){364 r = f(r, a[i], b[i]);365 }366 return r;367}368function reduceReverse2(a, b, x, f) {369 return reduceReverse2U(a, b, x, Curry.__3(f));370}371function everyU(arr, b) {372 var len = arr.length;373 var arr\$1 = arr;374 var _i = 0;375 var b\$1 = b;376 var len\$1 = len;377 while(true) {378 var i = _i;379 if (i === len\$1) {380 return true;381 } else if (b\$1(arr\$1[i])) {382 _i = i + 1 | 0;383 continue ;384 } else {385 return false;386 }387 };388}389function every(arr, f) {390 return everyU(arr, Curry.__1(f));391}392function someU(arr, b) {393 var len = arr.length;394 var arr\$1 = arr;395 var _i = 0;396 var b\$1 = b;397 var len\$1 = len;398 while(true) {399 var i = _i;400 if (i === len\$1) {401 return false;402 } else if (b\$1(arr\$1[i])) {403 return true;404 } else {405 _i = i + 1 | 0;406 continue ;407 }408 };409}410function some(arr, f) {411 return someU(arr, Curry.__1(f));412}413function everyAux2(arr1, arr2, _i, b, len) {414 while(true) {415 var i = _i;416 if (i === len) {417 return true;418 } else if (b(arr1[i], arr2[i])) {419 _i = i + 1 | 0;420 continue ;421 } else {422 return false;423 }424 };425}426function every2U(a, b, p) {427 return everyAux2(a, b, 0, p, Caml_primitive.caml_int_min(a.length, b.length));428}429function every2(a, b, p) {430 return every2U(a, b, Curry.__2(p));431}432function some2U(a, b, p) {433 var arr1 = a;434 var arr2 = b;435 var _i = 0;436 var b\$1 = p;437 var len = Caml_primitive.caml_int_min(a.length, b.length);438 while(true) {439 var i = _i;440 if (i === len) {441 return false;442 } else if (b\$1(arr1[i], arr2[i])) {443 return true;444 } else {445 _i = i + 1 | 0;446 continue ;447 }448 };449}450function some2(a, b, p) {451 return some2U(a, b, Curry.__2(p));452}453function eqU(a, b, p) {454 var lena = a.length;455 var lenb = b.length;456 if (lena === lenb) {457 return everyAux2(a, b, 0, p, lena);458 } else {459 return false;460 }461}462function eq(a, b, p) {463 return eqU(a, b, Curry.__2(p));464}465function cmpU(a, b, p) {466 var lena = a.length;467 var lenb = b.length;468 if (lena > lenb) {469 return 1;470 } else if (lena < lenb) {471 return -1;472 } else {473 var arr1 = a;474 var arr2 = b;475 var _i = 0;476 var b\$1 = p;477 var len = lena;478 while(true) {479 var i = _i;480 if (i === len) {481 return 0;482 } else {483 var c = b\$1(arr1[i], arr2[i]);484 if (c === 0) {485 _i = i + 1 | 0;486 continue ;487 } else {488 return c;489 }490 }491 };492 }493}494function cmp(a, b, p) {495 return cmpU(a, b, Curry.__2(p));496}497function partitionU(a, f) {498 var l = a.length;499 var i = 0;500 var j = 0;501 var a1 = l > 0 ? new Array(l) : /* array */[];502 var a2 = l > 0 ? new Array(l) : /* array */[];503 for(var ii = 0 ,ii_finish = l - 1 | 0; ii <= ii_finish; ++ii){504 var v = a[ii];505 if (f(v)) {506 a1[i] = v;507 i = i + 1 | 0;508 } else {509 a2[j] = v;510 j = j + 1 | 0;511 }512 }513 a1.length = i;514 a2.length = j;515 return /* tuple */[516 a1,517 a2518 ];519}520function partition(a, f) {521 return partitionU(a, Curry.__1(f));522}523function unzip(a) {524 var l = a.length;525 var match;526 if (l > 0) {527 match = /* tuple */[528 new Array(l),529 new Array(l)530 ];531 } else {532 match = /* tuple */[533 /* array */[],534 /* array */[]535 ];536 }537 var a2 = match[1];538 var a1 = match[0];539 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){540 var match\$1 = a[i];541 a1[i] = match\$1[0];542 a2[i] = match\$1[1];543 }544 return /* tuple */[545 a1,546 a2547 ];548}549exports.get = get;550exports.getExn = getExn;551exports.set = set;552exports.setExn = setExn;553exports.shuffleInPlace = shuffleInPlace;554exports.shuffle = shuffle;555exports.reverseInPlace = reverseInPlace;556exports.reverse = reverse;557exports.make = make;558exports.range = range;559exports.rangeBy = rangeBy;560exports.makeByU = makeByU;561exports.makeBy = makeBy;562exports.makeByAndShuffleU = makeByAndShuffleU;563exports.makeByAndShuffle = makeByAndShuffle;564exports.zip = zip;565exports.zipByU = zipByU;566exports.zipBy = zipBy;567exports.unzip = unzip;568exports.concat = concat;569exports.concatMany = concatMany;570exports.slice = slice;571exports.fill = fill;572exports.blit = blit;573exports.blitUnsafe = blitUnsafe;574exports.forEachU = forEachU;575exports.forEach = forEach;576exports.mapU = mapU;577exports.map = map;578exports.keepU = keepU;579exports.keep = keep;580exports.keepMapU = keepMapU;581exports.keepMap = keepMap;582exports.forEachWithIndexU = forEachWithIndexU;583exports.forEachWithIndex = forEachWithIndex;584exports.mapWithIndexU = mapWithIndexU;585exports.mapWithIndex = mapWithIndex;586exports.partitionU = partitionU;587exports.partition = partition;588exports.reduceU = reduceU;589exports.reduce = reduce;590exports.reduceReverseU = reduceReverseU;591exports.reduceReverse = reduceReverse;592exports.reduceReverse2U = reduceReverse2U;593exports.reduceReverse2 = reduceReverse2;594exports.someU = someU;595exports.some = some;596exports.everyU = everyU;597exports.every = every;598exports.every2U = every2U;599exports.every2 = every2;600exports.some2U = some2U;601exports.some2 = some2;602exports.cmpU = cmpU;603exports.cmp = cmp;604exports.eqU = eqU;605exports.eq = eq;...

lighting.js.consoleStripped.js

Source:lighting.js.consoleStripped.js

lighting.js.uncompressed.js

Source:lighting.js.uncompressed.js

lighting.js

Source:lighting.js

app.js

Source:app.js

1let result = document.getElementById("result");2let finishElement = document.getElementById("finish");3let numbersElement = document.getElementById("numbers");4const calculateButton = document.querySelector("#calculator button");5function calculate() {6 let sum = 0;7 let startInput = document.getElementById("startValue");8 let finishInput = document.getElementById("finishValue");9 let startValue = +document.getElementById("startValue").value;10 let finishValue = +document.getElementById("finishValue").value;11 // s1 ve s2 pozitif12 if (startValue > 0 && finishValue > 0) {13 if (startValue < finishValue) {14 let numbers = [];15 for (i = startValue; i <= finishValue; i++) {16 sum = sum + i;17 numbers.push(i);18 }19 console.log(numbers);20 // let tempTextFinish = `\${startValue}21 // ile22 // \${finishValue}23 // arasÄ±ndaki iÅleme alÄ±nan sayÄ± adedi:24 // \${finishValue - startValue + 1}25 // `;26 // let tempTextNumbers = `27 // \${numbers}`;28 // finishElement.textContent = tempTextFinish;29 // numbersElement.textContent = tempTextNumbers30 let tempText =31 startValue +32 " ile " +33 finishValue +34 " aralÄ±ÄÄ±ndaki sayÄ± adedi: " +35 (finishValue - startValue + 1);36 finishElement.textContent = tempText;37 result.textContent = "Toplam: " + sum;38 startInput.value = null;39 finishInput.value = null;40 console.log(startInput);41 } else {42 for (i = startValue; i >= finishValue; i--) {43 sum = sum + i;44 }45 let tempText =46 startValue +47 " ile " +48 finishValue +49 " aralÄ±ÄÄ±ndaki sayÄ± adedi: " +50 (startValue - finishValue + 1);51 finishElement.textContent = tempText;52 result.textContent = "Toplam: " + sum;53 startInput.value = null;54 finishInput.value = null;55 }56 }57 // s1 veya s2 negatif58 else if (startValue < 0 && finishValue > 0) {59 if (startValue * -1 < finishValue) {60 let tempStartValue = startValue * -1;61 for (i = finishValue; i > tempStartValue; i--) {62 sum = sum + i;63 }64 let tempText =65 startValue +66 " ile " +67 finishValue +68 " aralÄ±ÄÄ±ndaki sayÄ± adedi: " +69 (startValue * -1 + finishValue + 1);70 finishElement.textContent = tempText;71 result.textContent = "Toplam: " + sum;72 startInput.value = null;73 finishInput.value = null;74 } else {75 let tempStartValue = startValue * -1;76 for (i = tempStartValue; i > finishValue; i--) {77 sum = sum + i;78 }79 let tempText =80 startValue +81 " ile " +82 finishValue +83 " aralÄ±ÄÄ±ndaki sayÄ± adedi: " +84 (1 + startValue * -1 + finishValue);85 finishElement.textContent = tempText;86 result.textContent = "Toplam: " + -sum;87 startInput.value = null;88 finishInput.value = null;89 }90 } else if (startValue > 0 && finishValue < 0) {91 if (startValue < finishValue * -1) {92 let tempFinishValue = finishValue * -1;93 for (i = tempFinishValue; i > startValue; i--) {94 sum = sum + i;95 }96 let tempText =97 startValue +98 " ile " +99 finishValue +100 " aralÄ±ÄÄ±ndaki sayÄ± adedi: " +101 (1 + startValue + finishValue * -1);102 finishElement.textContent = tempText;103 result.textContent = "Toplam: " + -sum;104 startInput.value = null;105 finishInput.value = null;106 } else {107 let tempFinishValue = finishValue * -1;108 for (i = startValue; i > tempFinishValue; i--) {109 sum = sum + i;110 }111 let tempText =112 startValue +113 " ile " +114 finishValue +115 " aralÄ±ÄÄ±ndaki sayÄ± adedi: " +116 (1 + startValue + finishValue * -1);117 finishElement.textContent = tempText;118 result.textContent = "Toplam: " + sum;119 startInput.value = null;120 finishInput.value = null;121 }122 } else {123 if (startValue * -1 > finishValue * -1) {124 let tempStart = startValue * -1;125 let tempFinish = finishValue * -1;126 for (i = tempFinish; i <= tempStart; i++) {127 sum = sum + i;128 }129 let tempText =130 startValue +131 " ile " +132 finishValue +133 " aralÄ±ÄÄ±ndaki sayÄ± adedi: " +134 (tempStart - tempFinish + 1);135 finishElement.textContent = tempText;136 result.textContent = "Toplam: " + -sum;137 startInput.value = null;138 finishInput.value = null;139 } else if (140 startValue == finishValue ||141 startValue * -1 == finishValue ||142 startValue == finishValue * -1143 ) {144 result.textContent = 0;145 } else {146 let tempStart = startValue * -1;147 let tempFinish = finishValue * -1;148 for (i = tempStart; i <= tempFinish; i++) {149 sum = sum + i;150 }151 let tempText =152 startValue +153 " ile " +154 finishValue +155 " aralÄ±ÄÄ±ndaki sayÄ± adedi: " +156 (tempFinish - tempStart + 1);157 finishElement.textContent = tempText;158 result.textContent = "Toplam: " + -sum;159 startInput.value = null;160 finishInput.value = null;161 }162 }163}...

bidirectionalGreedySearch.js

Source:bidirectionalGreedySearch.js

1export const bidirectionalGreedySearch = (grid, startNode, finishNode) => {2 const visitedNodesInOrderStart = []3 const visitedNodesInOrderFinish = []4 const unvisitedNodesStart = []5 const unvisitedNodesFinish = []6 startNode.distance = 07 finishNode.distance = 08 unvisitedNodesStart.push(startNode)9 unvisitedNodesFinish.push(finishNode)10 while (unvisitedNodesStart.length && unvisitedNodesFinish.length) {11 sortNodesByDistance(unvisitedNodesStart)12 sortNodesByDistance(unvisitedNodesFinish)13 const closestNodeStart = unvisitedNodesStart.shift()14 const closestNodeFinish = unvisitedNodesFinish.shift()15 //if (closestNodeStart.isWall || closestNodeFinish.isWall) continue16 if (isNeighbors(closestNodeStart, closestNodeFinish)) return [visitedNodesInOrderStart, visitedNodesInOrderFinish]17 closestNodeStart.isVisited = true18 closestNodeFinish.isVisited = true19 visitedNodesInOrderStart.push(closestNodeStart)20 visitedNodesInOrderFinish.push(closestNodeFinish)21 //Search22 const unvisitedNeighborsStart = getUnvisitedNeighbors(closestNodeStart, grid)23 const unvisitedNeighborsFinish = getUnvisitedNeighbors(closestNodeFinish, grid)24 for (const neighbor of unvisitedNeighborsStart) {25 const distance = closestNodeStart.distance + 126 if (unvisitedNodesFinish.includes(neighbor)) {27 visitedNodesInOrderStart.push(closestNodeStart)28 visitedNodesInOrderFinish.push(neighbor)29 return [visitedNodesInOrderStart, visitedNodesInOrderFinish]30 }31 if (!unvisitedNodesStart.includes(neighbor)) {32 unvisitedNodesStart.unshift(neighbor)33 neighbor.distance = distance34 neighbor.totalDistance = manhattanDistance(neighbor, finishNode)35 neighbor.previousNode = closestNodeStart36 } else if (distance < neighbor.distance) {37 neighbor.distance = distance38 neighbor.totalDistance = manhattanDistance(neighbor, finishNode)39 neighbor.previousNode = closestNodeStart40 }41 }42 for (const neighbor of unvisitedNeighborsFinish) {43 const distance = closestNodeFinish.distance + 144 if (unvisitedNodesStart.includes(neighbor)) {45 visitedNodesInOrderStart.push(closestNodeFinish)46 visitedNodesInOrderStart.push(neighbor)47 return [visitedNodesInOrderStart, visitedNodesInOrderFinish]48 }49 if (!unvisitedNodesFinish.includes(neighbor)) {50 unvisitedNodesFinish.unshift(neighbor)51 neighbor.distance = distance52 neighbor.totalDistance = manhattanDistance(neighbor, startNode)53 neighbor.previousNode = closestNodeFinish54 } else if (distance < neighbor.distance) {55 neighbor.distance = distance56 neighbor.totalDistance = manhattanDistance(neighbor, startNode)57 neighbor.previousNode = closestNodeFinish58 }59 }60 }61 return [visitedNodesInOrderStart, visitedNodesInOrderFinish]62}63const isNeighbors = (nodeA, nodeB) => {64 if (nodeA.row === nodeB.row && nodeA.col === nodeB.col) return true65 return false66}67const manhattanDistance = (node, finishNode) => {68 const row = Math.abs(node.row - finishNode.row)69 const col = Math.abs(node.col - finishNode.col)70 return row + col71}72const getUnvisitedNeighbors = (node, grid) => {73 const neighbors = []74 const { row, col } = node75 if (row > 0) neighbors.push(grid[row - 1][col])76 if (row < grid.length - 1) neighbors.push(grid[row + 1][col])77 if (col > 0) neighbors.push(grid[row][col - 1])78 if (col < grid[0].length - 1) neighbors.push(grid[row][col + 1])79 return neighbors.filter(neighbor => !neighbor.isWall && !neighbor.isVisited)80}81const sortNodesByDistance = (nodes) => (82 nodes.sort((a, b) => a.totalDistance - b.totalDistance)83)...

finish.js

Source:finish.js

calendarFromTo.js

Source:calendarFromTo.js

1function initCalendarFromTo(startDateTime, finishDateTime) {2 // \$("#datepicker").datepicker();3 // Date range4 \$('.' + startDateTime).datepicker({5 dateFormat: 'dd-mm-yy',6 prevText: '<i class="fa fa-angle-left"></i>',7 nextText: '<i class="fa fa-angle-right"></i>',8 onSelect: function (selectedDate) {9 \$('.' + finishDateTime).datepicker('option', 'minDate', selectedDate);10 }11 });12 \$('.' + finishDateTime).datepicker({13 dateFormat: 'dd-mm-yy',14 prevText: '<i class="fa fa-angle-left"></i>',15 nextText: '<i class="fa fa-angle-right"></i>',16 onSelect: function (selectedDate) {17 \$('.' + startDateTime).datepicker('option', 'maxDate', selectedDate);18 }19 });20 \$(document).on('change', '.' + startDateTime + 'Start', function () {21 var value = \$('.' + startDateTime + 'Start:checked').val(); //Ð´Ð²Ð° Ð²Ð°ÑÐ¸Ð°Ð½ÑÐ° Ð¿Ð¾ Ð² ÑÐ°Ð·Ð½ÑÑ ÑÐ¸ÑÑÐ°ÑÐ¸ÑÑ22 //var value = \$('.' + startDateTime + 'Start[checked="checked"]').val();23 if (parseInt(value) == 1) {24 \$('.' + startDateTime).parents('div.col-sm-6').show();25 \$('.' + startDateTime).val('').focus();26 \$('.' + startDateTime).attr('required', 'required');27 \$('.' + startDateTime + 'StartLabel').html('');28 }29 else {30 \$('.' + startDateTime).parents('div.col-sm-6').hide();31 \$('.' + startDateTime).val('');32 \$('.' + startDateTime).removeAttr('required');33 \$('.' + startDateTime + 'StartLabel').html('ÐÐ°ÑÐ° Ð½Ð°ÑÐ°Ð»Ð° Ð¿Ð¾ÐºÐ°Ð·Ð¾Ð²');34 }35 });36 \$(document).on('change', '.' + finishDateTime + 'Finish', function () {37 var value = \$('.' + finishDateTime + 'Finish:checked').val();38 //var value = \$('.' + finishDateTime + 'Finish[checked="checked"]').val();39 console.log('end='+value);40 if (parseInt(value) == 1) {41 \$('.' + finishDateTime).parents('div.col-sm-6').show();42 \$('.' + finishDateTime).val('').focus();43 \$('.' + finishDateTime).attr('required', 'required');44 \$('.' + finishDateTime + 'FinishLabel').html('');45 }46 else {47 \$('.' + finishDateTime).parents('div.col-sm-6').hide();48 \$('.' + finishDateTime).val('');49 \$('.' + finishDateTime).removeAttr('required');50 \$('.' + finishDateTime + 'FinishLabel').html('ÐÐ°ÑÐ° Ð¾ÐºÐ¾Ð½ÑÐ°Ð½Ð¸Ñ Ð¿Ð¾ÐºÐ°Ð·Ð¾Ð²');51 }52 });...

Using AI Code Generation

1test.cb('my passing test', t => {2 setTimeout(() => {3 t.pass();4 t.end();5 }, 500);6});7test.cb('my failing test', t => {8 setTimeout(() => {9 t.fail();10 t.end();11 }, 500);12});13test.cb('my passing test', t => {14 setTimeout(() => {15 t.pass();16 t.end();17 }, 500);18});19test.cb('my failing test', t => {20 setTimeout(() => {21 t.fail();22 t.end();23 }, 500);24});25test.cb('my passing test', t => {26 setTimeout(() => {27 t.pass();28 t.end();29 }, 500);30});31test.cb('my failing test', t => {32 setTimeout(() => {33 t.fail();34 t.end();35 }, 500);36});37test.cb('my passing test', t => {38 setTimeout(() => {39 t.pass();40 t.end();41 }, 500);42});43test.cb('my failing test', t => {44 setTimeout(() => {45 t.fail();46 t.end();47 }, 500);48});49test.cb('my passing test', t => {50 setTimeout(() => {51 t.pass();52 t.end();53 }, 500);54});55test.cb('my failing test', t => {56 setTimeout(() => {57 t.fail();58 t.end();59 }, 500);60});61test.cb('my passing test', t => {62 setTimeout(() => {63 t.pass();64 t.end();65 }, 500);66});67test.cb('my failing test', t => {68 setTimeout(() => {69 t.fail();70 t.end();71 }, 500);72});73test.cb('my passing test', t => {74 setTimeout(() => {75 t.pass();76 t.end();77 }, 500);78});79test.cb('my

Using AI Code Generation

1test('test', t => {2 setTimeout(() => {3 t.pass();4 t.end();5 }, 1000);6});7test('test', t => {8 setTimeout(() => {9 t.pass();10 t.end();11 }, 1000);12});13test('test', t => {14 setTimeout(() => {15 t.pass();16 t.end();17 }, 1000);18});19test('test', t => {20 setTimeout(() => {21 t.pass();22 t.end();23 }, 1000);24});25test('test', t => {26 setTimeout(() => {27 t.pass();28 t.end();29 }, 1000);30});31test('test', t => {32 setTimeout(() => {33 t.pass();34 t.end();35 }, 1000);36});37test('test', t => {38 setTimeout(() => {39 t.pass();40 t.end();41 }, 1000);42});43test('test', t => {44 setTimeout(() => {45 t.pass();46 t.end();47 }, 1000);48});49test('test', t => {50 setTimeout(() => {51 t.pass();52 t.end();53 }, 1000);54});55test('test', t => {56 setTimeout(() => {57 t.pass();58 t.end();59 }, 1000);60});61test('test', t => {62 setTimeout(() => {63 t.pass();64 t.end();65 }, 1000);66});67test('test', t => {68 setTimeout(() => {69 t.pass();70 t.end();71 }, 1000);72});

Using AI Code Generation

1import test from 'ava';2test.cb('foo', t => {3 setTimeout(() => {4 t.pass();5 t.end();6 }, 100);7});8import test from 'ava';9test.cb('foo', t => {10 setTimeout(() => {11 t.pass();12 t.end();13 }, 100);14});15test.cb('bar', t => {16 setTimeout(() => {17 t.pass();18 t.end();19 }, 100);20});21import test from 'ava';22test.cb('foo', t => {23 setTimeout(() => {24 t.pass();25 t.end();26 }, 100);27});28test.cb('bar', t => {29 setTimeout(() => {30 t.pass();31 t.end();32 }, 100);33});34test.cb('baz', t => {35 setTimeout(() => {36 t.pass();37 t.end();38 }, 100);39});40import test from 'ava';41test.cb('foo', t => {42 setTimeout(() => {43 t.pass();44 t.end();45 }, 100);46});47test.cb('bar', t => {48 setTimeout(() => {49 t.pass();50 t.end();51 }, 100);52});53test.cb('baz', t => {54 setTimeout(() => {55 t.pass();56 t.end();57 }, 100);58});59test.cb('qux', t => {60 setTimeout(() => {61 t.pass();62 t.end();63 }, 100);64});65import test from 'ava';66test.cb('foo', t => {67 setTimeout(() => {68 t.pass();69 t.end();70 }, 100);71});72test.cb('bar', t => {73 setTimeout(() => {74 t.pass();75 t.end();76 }, 100);77});78test.cb('baz', t => {79 setTimeout(() => {80 t.pass();81 t.end();82 }, 100);83});84test.cb('qux', t => {85 setTimeout(() => {86 t.pass();87 t.end();88 }, 100);89});90test.cb('quux', t => {91 setTimeout(() => {92 t.pass();93 t.end();94 }, 100);95});96import test from 'ava';97test.cb('foo', t => {98 setTimeout(() => {99 t.pass();100 t.end();101 }, 100);102});103test.cb('

Using AI Code Generation

1test('something', t => {2 setTimeout(() => {3 t.pass();4 t.end();5 }, 100);6});7test('something', async t => {8 await new Promise(resolve => setTimeout(resolve, 100));9 t.pass();10});11test('something', async t => {12 t.plan(1);13 await new Promise(resolve => setTimeout(resolve, 100));14 t.pass();15});16test('something', async t => {17 t.plan(1);18 await new Promise(resolve => setTimeout(resolve, 100));19 t.pass();20 t.end();21});22test('something', async t => {23 t.plan(1);24 await new Promise(resolve => setTimeout(resolve, 100));25 t.pass();26 t.end();27});28test('something', async t => {29 t.plan(1);30 await new Promise(resolve => setTimeout(resolve, 100));31 t.pass();32 t.end();33 return;34});35test('something', async t => {36 t.plan(1);37 await new Promise(resolve => setTimeout(resolve, 100));38 t.pass();39 t.end();40 return;41});42test('something', async t => {43 t.plan(1);44 await new Promise(resolve => setTimeout(resolve, 100));45 t.pass();46 t.end();47 return;48});49test('something', async t => {50 t.plan(1);51 await new Promise(resolve => setTimeout(resolve, 100));52 t.pass();53 t.end();54 return;55});56test('something', async t => {57 t.plan(1);58 await new Promise(resolve => setTimeout(resolve, 100));59 t.pass();60 t.end();61 return;62});63test('something', async t => {64 t.plan(1);

Using AI Code Generation

1test('title', t => {2 t.plan(1);3 const actual = 'hello';4 const expected = 'hello';5 t.is(actual, expected);6 t.end();7});8test('title', t => {9 t.plan(1);10 const actual = 'hello';11 const expected = 'hello';12 t.is(actual, expected);13 t.end();14});15test('title', t => {16 t.plan(1);17 const actual = 'hello';18 const expected = 'hello';19 t.is(actual, expected);20 t.end();21});22test('title', t => {23 t.plan(1);24 const actual = 'hello';25 const expected = 'hello';26 t.is(actual, expected);27 t.end();28});29test('title', t => {30 t.plan(1);31 const actual = 'hello';32 const expected = 'hello';33 t.is(actual, expected);34 t.end();35});36test('title', t => {37 t.plan(1);38 const actual = 'hello';39 const expected = 'hello';40 t.is(actual, expected);41 t.end();42});43test('title', t => {44 t.plan(1);45 const actual = 'hello';46 const expected = 'hello';47 t.is(actual, expected);48 t.end();49});50test('title', t => {51 t.plan(1);52 const actual = 'hello';53 const expected = 'hello';54 t.is(actual, expected);55 t.end();56});57test('title', t => {58 t.plan(1);59 const actual = 'hello';60 const expected = 'hello';61 t.is(actual, expected);62 t.end();63});64test('title', t => {65 t.plan(1

Using AI Code Generation

1test('test', async t => {2 const stream = fs.createReadStream('./test.txt');3 const finish = await new Promise(resolve => stream.on('finish', resolve));4 t.is(finish, undefined);5});6test('test', async t => {7 const stream = new stream.PassThrough();8 const finish = await new Promise(resolve => stream.on('finish', resolve));9 stream.write('foo');10 stream.end();11 t.is(finish, undefined);12});

Using AI Code Generation

1const test = require('ava');2const request = require('request');3const {promisify} = require('util');4const get = promisify(request.get);5const {app} = require('../app');6const {createServer} = require('http');7const {promisify: promisifyServer} = require('util');8const listen = promisifyServer(app.listen.bind(app));9test('should return 200', async t => {10 const server = await listen(3000);11 t.is(statusCode, 200);12 server.close();13});14const express = require('express');15const app = express();16app.get('/', (req, res) => {17 res.send('hello');18});19module.exports = {app};20{21 "scripts": {22 },23 "devDependencies": {24 }25}26{27}28{29 "import"30 "env": {31 },32 "rules": {33 }34}35{36}

Using AI Code Generation

1const finish = require("./finish");2finish.finish();3module.exports.finish = function() {4 console.log("Finished!");5};6const fs = require("fs");7fs.readFile("test.txt

Using AI Code Generation

1var assert = require('assert');2var finish = require('finish');3function add(a, b, cb) {4 setTimeout(function() {5 cb(null, a + b);6 }, 100);7}8function subtract(a, b, cb) {9 setTimeout(function() {10 cb(null, a - b);11 }, 100);12}13function multiply(a, b, cb) {14 setTimeout(function() {15 cb(null, a * b);16 }, 100);17}18function divide(a, b, cb) {19 setTimeout(function() {20 cb(null, a / b);21 }, 100);22}23function calc(a, b, cb) {24 var f = finish(function(err, result) {25 if (err) return cb(err);26 cb(null, result);27 });28 add(a, b, f());29 subtract(a, b, f());30 multiply(a, b, f());31 divide(a, b, f());32}33calc(5, 10, function(err, result) {34 assert.equal(result[0], 15);35 assert.equal(result[1], -5);36 assert.equal(result[2], 50);37 assert.equal(result[3], 0.5);38});

## Automation Testing Tutorials

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.