How to use lastOutput method in fast-check-monorepo

Best JavaScript code snippet using fast-check-monorepo

transcribe.js

Source:transcribe.js Github

copy

Full Screen

1var fromHebrew = new Map();2//Only put consonants in this table.3fromHebrew.set('א', 'aleph');4fromHebrew.set('ב', 'bet');5fromHebrew.set('ג', 'gimel');6fromHebrew.set('ד', 'dalat');7fromHebrew.set('ה', 'he');8fromHebrew.set('ו', 'waw');9fromHebrew.set('ז', 'zayin');10fromHebrew.set('ח', 'het');11fromHebrew.set('ט', 'tet');12fromHebrew.set('י', 'yod');13fromHebrew.set('כ', 'kaf');14fromHebrew.set('ך', 'kaf');15fromHebrew.set('ל', 'lamed');16fromHebrew.set('מ', 'mem');17fromHebrew.set('ם', 'mem');18fromHebrew.set('נ', 'nun');19fromHebrew.set('ן', 'nun');20fromHebrew.set('ס', 'samekh');21fromHebrew.set('ע', 'ayin');22fromHebrew.set('פ', 'pe');23fromHebrew.set('צ', 'tsadi');24fromHebrew.set('ץ', 'tsadi');25fromHebrew.set('ק', 'qof');26fromHebrew.set('ר', 'resh');27fromHebrew.set('ש', 'shin');28fromHebrew.set('ת', 'tav');29var fromArabic = new Map();30fromArabic.set('ء', 'aleph');31fromArabic.set('ب', 'bet');32fromArabic.set('ج', 'gimel');33fromArabic.set('د', 'dalat');34fromArabic.set('ه', 'he');35fromArabic.set('و', 'waw');36fromArabic.set('ز', 'zayin');37fromArabic.set('ذ', 'dhalat');38fromArabic.set('ح', 'het');39fromArabic.set('خ', 'kha');40fromArabic.set('ط', 'tet');41fromArabic.set('ي', 'yod');42fromArabic.set('ك', 'kaf');43fromArabic.set('ل', 'lamed');44fromArabic.set('م', 'mem');45fromArabic.set('ن', 'nun');46fromArabic.set('ع', 'ayin');47fromArabic.set('غ', 'ghayn');48fromArabic.set('ف', 'pe');49fromArabic.set('ص', 'tsadi');50fromArabic.set('ض', 'daad');51fromArabic.set('ظ', 'zaa');52fromArabic.set('ق', 'qof');53fromArabic.set('ر', 'resh');54fromArabic.set('س', 'shin');55fromArabic.set('ث', 'thaa');56fromArabic.set('ش', 'sin');57fromArabic.set('ت', 'tav');58fromArabic.set('ا', 'long-a');59fromArabic.set('ى', 'long-a');60fromArabic.set('َ', 'a');61fromArabic.set('ِ', 'i');62fromArabic.set('ُ', 'u');63fromArabic.set('ّ', 'gemination');64fromArabic.set('ٰ', 'long-a'); // dagger alif65var toCommon = new Map();66toCommon.set('aleph', 'ʼ');67toCommon.set('bet', 'b');68toCommon.set('gimel', '<span class="arabic">j</span><br/><span class="hebrew">g</span>');69toCommon.set('dalat', 'd');70toCommon.set('he', 'h');71toCommon.set('waw', '<span class="arial">v<span class="arabic">v</span></span>');72toCommon.set('zayin', 'z');73toCommon.set('dhalat', '<span class="arabic">dh</span><br/><span class="hebrew">z</span>');74toCommon.set('het', '<span class="hebrew">c</span><span class="thick">h</span>');75toCommon.set('kha', 'kh');76toCommon.set('tet', '<span class="thick">t</span>');77toCommon.set('yod', 'y');78toCommon.set('kaf', 'k');79toCommon.set('lamed', 'l');80toCommon.set('mem', 'm');81toCommon.set('nun', 'n');82toCommon.set('ayin', 'ʻ');83toCommon.set('ghayn', '<span class="arabic">gh</span><br/><span class="hebrew">ʻ</span>');84toCommon.set('pe', '<span class="arabic">f</span><br/><span class="hebrew">p</span>');85toCommon.set('tsadi', '<span class="hebrew">t</span><span class="thick">s</span>');86toCommon.set('daad', '<span class="arabic thick">d</span><br/><span class="hebrew">ts</span>');87toCommon.set('zaa', '<span class="hebrew">t</span><span class="thick">z</span>');88toCommon.set('qof', '<span class="thick">k</span>');89toCommon.set('resh', 'r');90toCommon.set('samekh', 's');91toCommon.set('shin', 's<span class="hebrew">h</span>');92toCommon.set('thaa', '<span class="arabic">th</span><br/><span class="hebrew">sh</span>');93toCommon.set('sin', 's<span class="arabic">h</span>');94toCommon.set('tav', 't');95toCommon.set('feminine-noun', '<span class="diacritic">feminine noun</span>');96toCommon.set('long-a', '<span class="arabic long">a</span><br/><span class="hebrew">o</span>');97toCommon.set('long-a-or-aw-or-u', '<span class="arabic"><span class="long">a</span>/aw/u</span><br/><span class="hebrew">o</span>');98toCommon.set('long-i', '<span class="long">i</span>');99toCommon.set('long-u', '<span class="long">u</span>');100toCommon.set('a', 'a');101toCommon.set('i', 'i');102toCommon.set('u', 'u');103toCommon.set('ai', 'ay');104toCommon.set('aw', 'aw<br/><span class="hebrew">o</span>');105toCommon.set('sukoon', '<span class="english">no-vowel</span>');106toCommon.set('space', '&nbsp;');107toCommon.set('gemination', '<span class="diacritic">2</span>');108toCommon.set('affix-the', '<span class="english">the</span>');109toCommon.set('affix-and', '<span class="english">and</span>');110toCommon.set('affix-accusative', '<span class="english">acc.</span>');111toCommon.set('affix-genitive', '<span class="english">gen.</span>');112toCommon.set('affix-nominative', '<span class="english">nom.</span>');113toCommon.set('affix-unmarked-definiteness', '<span class="english">unk. def.</span>');114toCommon.set('soft', '<span class="diacritic">soft</span>');115toCommon.set('hard', '<span class="diacritic">hard</span>');116var toArabicTrans = new Map();117toArabicTrans.set('aleph', '’');118toArabicTrans.set('bet', 'b');119toArabicTrans.set('gimel', 'j');120toArabicTrans.set('dalat', 'd');121toArabicTrans.set('he', 'h');122toArabicTrans.set('waw', 'w');123toArabicTrans.set('zayin', 'z');124toArabicTrans.set('dhalat', 'dh');125toArabicTrans.set('het', '<span class="thick">h</span>');126toArabicTrans.set('kha', 'kh');127toArabicTrans.set('tet', '<span class="thick">t</span>');128toArabicTrans.set('yod', 'y');129toArabicTrans.set('kaf', 'k');130toArabicTrans.set('lamed', 'l');131toArabicTrans.set('mem', 'm');132toArabicTrans.set('nun', 'n');133toArabicTrans.set('ayin', '‘');134toArabicTrans.set('ghayn', 'gh');135toArabicTrans.set('pe', 'f');136toArabicTrans.set('tsadi', '<span class="thick">s</span>');137toArabicTrans.set('daad', '<span class="thick">d</span>');138toArabicTrans.set('zaa', '<span class="thick">z</span>');139toArabicTrans.set('qof', 'q');140toArabicTrans.set('resh', 'r');141toArabicTrans.set('samekh', 's');142toArabicTrans.set('shin', 's');143toArabicTrans.set('thaa', 'th');144toArabicTrans.set('sin', 'sh');145toArabicTrans.set('tav', 't');146toArabicTrans.set('long-a', '<span class="long">a</span>');147toArabicTrans.set('long-i', '<span class="long">i</span>');148toArabicTrans.set('long-u', '<span class="long">u</span>');149toArabicTrans.set('a', 'a');150toArabicTrans.set('i', 'i');151toArabicTrans.set('u', 'u');152toArabicTrans.set('ai', 'ay');153toArabicTrans.set('aw', 'aw');154toArabicTrans.set('sukoon', '');155toArabicTrans.set('space', ' ');156toArabicTrans.set('affix-and', 'wa');157toArabicTrans.set('affix-the', 'al-');158toArabicTrans.set('affix-accusative', 'a');159toArabicTrans.set('affix-genitive', 'i');160toArabicTrans.set('affix-nominative', 'u');161toArabicTrans.set('affix-unmarked-definiteness', 'n');162var toArabic = new Map();163toArabic.set('bet', 'ب');164toArabic.set('gimel', 'ج');165toArabic.set('dalat', 'د');166toArabic.set('he', 'ه');167toArabic.set('waw', 'و');168toArabic.set('zayin', 'ز');169toArabic.set('dhalat', 'ذ');170toArabic.set('het', 'ح');171toArabic.set('kha', 'خ');172toArabic.set('tet', 'ط');173toArabic.set('yod', 'ي');174toArabic.set('kaf', 'ك');175toArabic.set('lamed', 'ل');176toArabic.set('mem', 'م');177toArabic.set('nun', 'ن');178toArabic.set('ayin', 'ع');179toArabic.set('ghayn', 'غ');180toArabic.set('pe', 'ف');181toArabic.set('tsadi', 'ص');182toArabic.set('daad', 'ض');183toArabic.set('zaa', 'ظ');184toArabic.set('qof', 'ق');185toArabic.set('resh', 'ر');186toArabic.set('samekh', 'س');187toArabic.set('shin', 'س');188toArabic.set('thaa', 'ث');189toArabic.set('sin', 'ش');190toArabic.set('tav', 'ت');191toArabic.set('feminine-noun', 'َة');192toArabic.set('long-a', 'َا');193toArabic.set('long-i', 'ِيْ');194toArabic.set('long-u', 'ُوْ');195toArabic.set('a', 'َ');196toArabic.set('i', 'ِ');197toArabic.set('u', 'ُ');198toArabic.set('ai', 'َيْ');199toArabic.set('aw', 'َوْ');200toArabic.set('sukoon', 'ْ');201toArabic.set('space', ' ');202toArabic.set('gemination', 'ّ');203toArabic.set('affix-the', 'ٱل');204toArabic.set('affix-and', 'وَ');205toArabic.set('affix-accusative', 'َ');206toArabic.set('affix-genitive', 'ِ');207toArabic.set('affix-nominative', 'ُ');208toArabic.set('soft', '');209toArabic.set('hard', '');210var shamsiyah = new Set();211shamsiyah.add('tav');212shamsiyah.add('thaa');213shamsiyah.add('dalat');214shamsiyah.add('dhalat');215shamsiyah.add('resh');216shamsiyah.add('zayin');217shamsiyah.add('samekh');218shamsiyah.add('shin');219shamsiyah.add('sin');220shamsiyah.add('tsadi');221shamsiyah.add('daad');222shamsiyah.add('tet');223shamsiyah.add('zaa');224shamsiyah.add('nun');225shamsiyah.add('lamed');226function parseArabic(input) {227 var output = [];228 var letter, lastOutput;229 var firstConsonant = true;230 var initialAlif = false;231 var initialAlifLam = false;232 var initialWaw = false;233 input = input.normalize('NFD').trim();234 for (let i = 0; i < input.length; i++) {235 letter = input[i];236 if (lastOutput == 'long-a' || lastOutput == 'a') {237 //hamzah qata’238 if (letter == 'َ' || letter == 'ِ' || letter == 'ُ') {239 lastOutput = fromArabic.get(letter);240 output.splice(-1, 1, 'aleph', lastOutput);241 if (input[i + 1] == 'ٔ' || input[i + 1] == 'ٕ') {242 i++;243 }244 initialAlif = false;245 continue;246 } else if (letter == 'ٔ') {247 output.splice(-1, 1, 'aleph');248 initialAlif = false;249 if (input[i + 1] != 'َ' && input[i + 1] != 'ُ') {250 output.push('a');251 lastOutput = 'a';252 }253 continue;254 } else if (letter == 'ٕ') {255 output.splice(-1, 1, 'aleph');256 initialAlif = false;257 if (input[i + 1] != 'ِ') {258 output.push('i');259 lastOutput = 'i';260 }261 continue; 262 }263 }264 if (letter == 'ً') {265 //fathan266 output.push('affix-accusative')267 lastOutput = 'affix-unmarked-definiteness';268 } else if (letter == 'ٍ') {269 //kasrahan270 output.push('affix-genitive')271 lastOutput = 'affix-unmarked-definiteness';272 } else if (letter == 'ٌ') {273 //dammahan274 output.push('affix-nominative')275 lastOutput = 'affix-unmarked-definiteness';276 } else if (letter == 'ٱ' || (firstConsonant && letter == 'ا')) {277 //hamzatu l-waṣli278 if (output.length == 0) {279 lastOutput = 'i';280 } else {281 lastOutput = undefined;282 }283 initialAlif = true;284 } else if (firstConsonant && initialAlif && !initialAlifLam && letter == 'ل') {285 //Al-286 lastOutput = 'affix-the';287 initialAlifLam = true;288 if (output.length == 1 && output[0] == 'i') {289 output.pop();290 }291 } else if (letter == 'ّ') {292 //shaddah293 if (lastOutput == 'a' || lastOutput == 'i' || lastOutput == 'u') {294 output.splice(-1, 0, 'gemination');295 } else {296 output.push('gemination');297 }298 lastOutput = undefined;299 } else if (letter == ' ') {300 //space301 lastOutput = 'space';302 firstConsonant = true;303 initialAlif = false;304 initialAlifLam = false;305 initialWaw = false;306 } else if (letter == 'ـ') {307 //joiner308 lastOutput = undefined;309 } else if (letter == 'ْ') {310 //sukoon311 lastOutput = 'sukoon';312 } else if (letter == 'ة') {313 //ta marbutah314 if (output[output.length - 1] == 'a') {315 output.pop();316 }317 lastOutput = 'feminine-noun';318 } else if (firstConsonant && letter == 'و') {319 lastOutput = 'waw';320 initialWaw = true;321 } else if (firstConsonant && initialWaw && letter == 'َ') {322 output.pop();323 lastOutput = 'affix-and';324 } else {325 lastOutput = fromArabic.get(letter);326 if (lastOutput === undefined) {327 lastOutput = '?';328 }329 if (firstConsonant && lastOutput != 'a' && lastOutput != 'i' && lastOutput != 'u') {330 firstConsonant = false;331 }332 }333 if (lastOutput !== undefined) {334 output.push(lastOutput);335 }336 }337 for (let i = 1; i < output.length; i++) {338 letter = output[i];339 if (letter == 'space') {340 i++;341 continue;342 }343 prevLetter = output[i - 1];344 nextLetter = output[i + 1];345 replaced = false;346 if (letter == 'long-a' && prevLetter == 'a') {347 output.splice(i - 1, 1);348 i--;349 } else if (letter == 'yod' && nextLetter != 'a' && nextLetter != 'i' && nextLetter != 'u') {350 if (prevLetter == 'a') {351 output.splice(i - 1, 1);352 i--;353 output.splice(i, 1, 'ai');354 replaced = true;355 } else if (prevLetter != 'sukoon' && prevLetter != 'u' && prevLetter != 'nunation') {356 output.splice(i - 1, 1);357 i--;358 output.splice(i, 1, 'long-i');359 replaced = true;360 }361 if (replaced && nextLetter == 'gemination') {362 output.splice(i + 1, 1, 'yod');363 }364 } else if (letter == 'waw' && nextLetter != 'a' && nextLetter != 'i' && nextLetter != 'u') {365 if (prevLetter == 'a') {366 output.splice(i - 1, 1);367 i--;368 output.splice(i, 1, 'aw');369 replaced = true; 370 } else if (prevLetter != 'sukoon' && prevLetter != 'i' && prevLetter != 'nunation') {371 output.splice(i - 1, 1);372 i--;373 output.splice(i, 1, 'long-u');374 replaced = true;375 }376 if (replaced && nextLetter == 'gemination') {377 output.splice(i + 1, 1, 'waw');378 }379 }380 if (letter != 'space' && prevLetter == 'sukoon') {381 output.splice(i - 1, 1);382 i--;383 }384 }385 if (letter == 'sukoon') {386 output.splice(-1, 1);387 }388 return output;389}390function Transcription(transcription, process) {391 this.text = transcription;392 this.process = process;393}394function printArabicTrans(input) {395 var output = '';396 var process = [];397 var item, nextItem, prevOutput;398 for (let i = 0; i < input.length; i++) {399 item = input[i];400 if (item == 'long-a-or-aw-or-u') {401 item = 'long-a';402 }403 if (prevOutput == ' ') {404 nextItem = input[i + 1];405 if (nextItem != 'a' && nextItem != 'i' && nextItem != 'u' && nextItem != 'ai' && nextItem != 'aw') {406 if (item == 'long-a' && output.endsWith(toArabicTrans.get('a') + ' ')) {407 process.push('<span class="rule">madd</span>');408 output = output.slice(0, -2);409 } else if (item == 'yod' && output.endsWith(toArabicTrans.get('i') + ' ')) {410 process.push('<span class="rule">madd</span>');411 output = output.slice(0, -2) + toArabicTrans.get('long-i');412 prevOutput = toArabicTrans.get('yod');413 if (nextItem == 'gemination') {414 output = output + ' ';415 }416 continue;417 } else if (item == 'waw' && output.endsWith(toArabicTrans.get('u') + ' ')) {418 process.push('<span class="rule">madd</span>');419 output = output.slice(0, -2) + toArabicTrans.get('long-u');420 prevOutput = toArabicTrans.get('waw');421 if (nextItem == 'gemination') {422 output = output + ' ';423 }424 continue;425 }426 }427 }428 if (item == 'affix-the') {429 nextItem = input[i + 1];430 if (shamsiyah.has(nextItem)) {431 process.push('<span class="rule">lam shamsiyah</span>');432 if (output == '') {433 output = toArabicTrans.get('i');434 prevOutput = toArabicTrans.get('lamed');435 }436 continue;437 } else {438 process.push('<span class="rule">lam qamariyah</span>');439 if (output.endsWith(toArabicTrans.get('a') + ' ') ||440 output.endsWith(toArabicTrans.get('long-a') + ' ')441 ) {442 output = output.slice(0, -1) + '<span class="invisible"> a</span>';443 prevOutput = toArabicTrans.get('lamed');444 output = output + prevOutput + ' ';445 } else if (446 output.endsWith(toArabicTrans.get('i') + ' ') ||447 output.endsWith(toArabicTrans.get('u') + ' ') ||448 output.endsWith(toArabicTrans.get('long-i') + ' ') ||449 output.endsWith(toArabicTrans.get('long-u') + ' ')450 ) {451 output = output.slice(0, -1);452 prevOutput = toArabicTrans.get('lamed');453 output = output + prevOutput + ' ';454 } else {455 output = output + toArabicTrans.get('affix-the');456 prevOutput = toArabicTrans.get('lamed');457 }458 continue;459 }460 } else if (item == 'gemination') {461 //same output as previously.462 var separate =463 prevOutput == toArabicTrans.get('mem') ||464 prevOutput == toArabicTrans.get('nun') ||465 prevOutput == toArabicTrans.get('pe') ||466 prevOutput == toArabicTrans.get('thaa') ||467 prevOutput == toArabicTrans.get('samekh') ||468 prevOutput == toArabicTrans.get('shin') ||469 prevOutput == toArabicTrans.get('tsadi') ||470 prevOutput == toArabicTrans.get('sin') ||471 prevOutput == toArabicTrans.get('zayin') ||472 prevOutput == toArabicTrans.get('resh') ||473 prevOutput == toArabicTrans.get('lamed') ||474 prevOutput == toArabicTrans.get('waw');475 476 if (output.endsWith(' ' + prevOutput)) {477 if (separate) {478 output = output.slice(0, -(prevOutput.length + 1)) + prevOutput + '&#x203f;';479 } else {480 continue;481 }482 } else if (separate && output.slice(-1) != ' ' && prevOutput != toArabicTrans.get('affix-the')) {483 output = output + '<span class="no-copy-undertie"></span>';484 }485 } else if (item == 'feminine-noun') {486 if (input.length == i + 1 || input[i + 1] == 'space') {487 prevOutput = toArabicTrans.get('he');488 } else {489 prevOutput = toArabicTrans.get('tav');490 }491 output = output + toArabicTrans.get('a');492 } else if (item == 'soft' || item == 'hard') {493 //skip494 } else {495 if (item == 'long-a' || item == 'long-i' || item == 'long-u') {496 process.push('<span class="rule">madd</span>');497 }498 prevOutput = toArabicTrans.get(item);499 }500 output = output + prevOutput;501 process.push(prevOutput);502 }503 if (prevOutput == toArabicTrans.get('a') ||504 prevOutput == toArabicTrans.get('i') ||505 prevOutput == toArabicTrans.get('u')506 ) {507 output = output.slice(0, -1);508 if (input[input.length - 2] == 'feminine-noun') {509 output = output.slice(0, -toArabicTrans.get('tav').length) + toArabicTrans.get('he');510 }511 process.splice(-1, 1, '<span class="rule">unoriginal sukoon</span>');512 }513 return new Transcription(output, process);514}515function parseHebrew(input) {516 var output = [];517 var letter, lastOutput, lastConsonant;518 var vcPattern = [];519 input = input.normalize('NFD').trim();520 for (let i = 0; i < input.length; i++) {521 letter = input[i];522 if (letter == 'ּ') {523 //dagesh or shuruk524 if (lastOutput == 'waw' &&525 (vcPattern.length == 1 || vcPattern[vcPattern.length - 2] == 'consonant')526 ) {527 output.pop();528 lastOutput = 'long-u'529 vcPattern.splice(-1, 1, 'vowel');530 } else if (531 lastConsonant == 'bet' || lastConsonant == 'gimel' ||532 lastConsonant == 'dalat' || lastConsonant == 'kaf' ||533 lastConsonant == 'pe' || lastConsonant == 'tav'534 ) {535 lastOutput = 'dagesh';536 vcPattern.push('other');537 } else {538 lastOutput = 'gemination';539 vcPattern.push('other');540 }541 } else if (letter == 'ִ') {542 //hiriq543 lastOutput = 'i';544 vcPattern.push('vowel');545 } else if (letter == 'י' && lastOutput == 'i') {546 output.pop();547 lastOutput = 'long-i'548 } else if (letter == 'ֹ') {549 //holam550 if (lastOutput == 'waw') {551 output.pop();552 vcPattern.pop();553 }554 lastOutput = 'long-a-or-aw-or-u';555 vcPattern.push('vowel');556 } else if (letter == 'ף') {557 //fe558 output.push('pe');559 lastOutput = 'soft';560 vcPattern.push('consonant', 'other');561 } else if (letter == 'ֻ') {562 //kubutz563 lastOutput = 'u';564 vcPattern.push('vowel');565 } else if (letter == 'ָ') {566 //kamatz567 //TODO Kamatz Katan568 lastOutput = 'a';569 vcPattern.push('vowel');570 } else if (letter == 'ׁ') {571 //shin dot572 continue;573 } else if (letter == 'ׂ') {574 //sin dot575 output.pop();576 lastOutput = 'sin';577 } else if (letter == ' ') {578 //space579 lastOutput = 'space';580 vcPattern.push('other');581 } else {582 //consonant583 lastOutput = fromHebrew.get(letter);584 vcPattern.push('consonant');585 lastConsonant = lastOutput;586 if (lastOutput === undefined) {587 lastOutput = '?';588 }589 }590 if ((lastOutput == 'dagesh' || lastOutput == 'gemination') &&591 vcPattern[vcPattern.length - 2] == 'vowel'592 ) {593 output.splice(-1, 0, lastOutput);594 vcPattern.splice(-2, 2, 'other', 'vowel');595 lastOutput = output[output.length - 1];596 } else if (lastOutput !== undefined) {597 output.push(lastOutput);598 }599 }600 var prevVowelPos = -1;601 var found;602 for (let i = 0; i < output.length; i++) {603 if (output[i] == 'dagesh') {604 if (i < 2) {605 output[i] = 'hard';606 } else {607 found = false;608 for (let j = prevVowelPos + 1; j < i - 1; j++) {609 if (vcPattern[j] == 'consonant') {610 output[i] = 'hard';611 found = true;612 break;613 }614 }615 if (!found) {616 output[i] = 'gemination';617 }618 }619 } else if (vcPattern[i] == 'vowel') {620 prevVowelPos = i;621 }622 }623 return output;624}625function printArabic(input) {626 var item, prevItem, nextItem, toOutput;627 var output = '';628 var item;629 for (let i = 0; i < input.length; i++) {630 prevItem = input[i - 1];631 item = input[i];632 nextItem = input[i + 1];633 if (item == 'long-a-or-aw-or-u') {634 item = 'long-a';635 }636 if (nextItem == 'long-a-or-aw-or-u') {637 nextItem = 'long-a';638 }639 toOutput = undefined;640 if (item == 'aleph') {641 if (prevItem == 'space' || i == 0) {642 if (nextItem == 'a') {643 toOutput = 'أ';644 i++;645 } else if (nextItem == 'long-a') {646 toOutput = 'آ';647 i++;648 } else if (nextItem == 'i') {649 toOutput = 'إ';650 i++651 } else if (nextItem == 'long-i') {652 toOutput = 'إي';653 i++;654 } else {655 toOutput = 'أ';656 }657 }658 } else if (item == 'affix-unmarked-definiteness') {659 output = output.slice(0, -1);660 if (prevItem == 'affix-accusative') {661 toOutput = 'ً';662 } else if (prevItem == 'affix-genitive') {663 toOutput = 'ٍ';664 } else if (prevItem == 'affix-nominative') {665 toOutput = 'ٌ';666 }667 } else {668 toOutput = toArabic.get(item);669 }670 output = output + toOutput;671 }672 return output;673}674function printCommon(input) {675 var output = '';676 for (let item of input) {677 output = output + '<div class="common">' + toCommon.get(item) + '</div>';678 }679 return output;...

Full Screen

Full Screen

amplifier.test.ts

Source:amplifier.test.ts Github

copy

Full Screen

1import { Amplifier } from "./amplifier";2describe("Full test", () => {3 test("Example 01", () => {4 const code = [1, 0, 0, 0, 99];5 const output = [2, 0, 0, 0, 99];6 const amplifier = new Amplifier(code, 1);7 amplifier.run();8 expect(amplifier.code).toEqual(output);9 });10 test("Example 02", () => {11 const code = [2, 3, 0, 3, 99];12 const output = [2, 3, 0, 6, 99];13 const amplifier = new Amplifier(code, 1);14 amplifier.run();15 expect(amplifier.code).toEqual(output);16 });17 test("Example 03", () => {18 const code = [2, 4, 4, 5, 99, 0];19 const output = [2, 4, 4, 5, 99, 9801];20 const amplifier = new Amplifier(code, 1);21 amplifier.run();22 expect(amplifier.code).toEqual(output);23 });24 test("Example 04", () => {25 const code = [1, 1, 1, 4, 99, 5, 6, 0, 99];26 const output = [30, 1, 1, 4, 2, 5, 6, 0, 99];27 const amplifier = new Amplifier(code, 1);28 amplifier.run();29 expect(amplifier.code).toEqual(output);30 });31 test("Example 05", () => {32 const code = [1002, 4, 3, 4, 33];33 const amplifier = new Amplifier(code, 1);34 amplifier.run();35 expect(amplifier.code[4]).toEqual(99);36 });37 test("Example 06", () => {38 const code = [1101, 100, -1, 4, 0];39 const amplifier = new Amplifier(code, 1);40 amplifier.run();41 expect(amplifier.code[4]).toEqual(99);42 });43 test("Example 07", () => {44 const code = [3, 9, 8, 9, 10, 9, 4, 9, 99, -1, 8];45 const amplifier = new Amplifier(code, 8);46 amplifier.run();47 expect(amplifier.LastOutput).toEqual(1);48 });49 test("Example 08", () => {50 const code = [3, 9, 8, 9, 10, 9, 4, 9, 99, -1, 8];51 const amplifier = new Amplifier(code, 10);52 amplifier.run();53 expect(amplifier.LastOutput).toEqual(0);54 });55 test("Example 09", () => {56 const code = [3, 9, 7, 9, 10, 9, 4, 9, 99, -1, 8];57 const amplifier = new Amplifier(code, 7);58 amplifier.run();59 expect(amplifier.LastOutput).toEqual(1);60 });61 test("Example 10", () => {62 const code = [3, 9, 7, 9, 10, 9, 4, 9, 99, -1, 8];63 const amplifier = new Amplifier(code, 8);64 amplifier.run();65 expect(amplifier.LastOutput).toEqual(0);66 });67 test("Example 11", () => {68 const code = [3, 3, 1108, -1, 8, 3, 4, 3, 99];69 const amplifier = new Amplifier(code, 8);70 amplifier.run();71 expect(amplifier.LastOutput).toEqual(1);72 });73 test("Example 12", () => {74 const code = [3, 3, 1108, -1, 8, 3, 4, 3, 99];75 const amplifier = new Amplifier(code, 10);76 amplifier.run();77 expect(amplifier.LastOutput).toEqual(0);78 });79 test("Example 13", () => {80 const code = [3, 3, 1107, -1, 8, 3, 4, 3, 99];81 const amplifier = new Amplifier(code, 7);82 amplifier.run();83 expect(amplifier.LastOutput).toEqual(1);84 });85 test("Example 14", () => {86 const code = [3, 3, 1107, -1, 8, 3, 4, 3, 99];87 const amplifier = new Amplifier(code, 8);88 amplifier.run();89 expect(amplifier.LastOutput).toEqual(0);90 });91 test("Example 15", () => {92 const code = [3, 12, 6, 12, 15, 1, 13, 14, 13, 4, 13, 99, -1, 0, 1, 9];93 const amplifier = new Amplifier(code, 1);94 amplifier.run();95 expect(amplifier.LastOutput).toEqual(1);96 });97 test("Example 16", () => {98 const code = [3, 12, 6, 12, 15, 1, 13, 14, 13, 4, 13, 99, -1, 0, 1, 9];99 const amplifier = new Amplifier(code, 0);100 amplifier.run();101 expect(amplifier.LastOutput).toEqual(0);102 });103 test("Example 17", () => {104 const code = [3, 3, 1105, -1, 9, 1101, 0, 0, 12, 4, 12, 99, 1];105 const amplifier = new Amplifier(code, 1);106 amplifier.run();107 expect(amplifier.LastOutput).toEqual(1);108 });109 test("Example 18", () => {110 const code = [3, 3, 1105, -1, 9, 1101, 0, 0, 12, 4, 12, 99, 1];111 const amplifier = new Amplifier(code, 0);112 amplifier.run();113 expect(amplifier.LastOutput).toEqual(0);114 });115 test("Example 19", () => {116 const code = [117 3,118 21,119 1008,120 21,121 8,122 20,123 1005,124 20,125 22,126 107,127 8,128 21,129 20,130 1006,131 20,132 31,133 1106,134 0,135 36,136 98,137 0,138 0,139 1002,140 21,141 125,142 20,143 4,144 20,145 1105,146 1,147 46,148 104,149 999,150 1105,151 1,152 46,153 1101,154 1000,155 1,156 20,157 4,158 20,159 1105,160 1,161 46,162 98,163 99,164 ];165 let amplifier = new Amplifier(code, 6);166 amplifier.run();167 expect(amplifier.LastOutput).toEqual(999);168 amplifier = new Amplifier(code, 8);169 amplifier.run();170 expect(amplifier.LastOutput).toEqual(1000);171 amplifier = new Amplifier(code, 10);172 amplifier.run();173 expect(amplifier.LastOutput).toEqual(1001);174 });...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1'use strict';2var i2cUtils = require('./lib/i2c-utils');3var sleep = require("sleep");4var i2cFace = new i2cUtils();5var lastOutput;6var deadband_minimum = 250;7var deadband_maximum = 10;8var axisMinimum = [77,77,159,158];9var axisMaximum = [88,91,174,164];10function bandPass(lastOutput,output) {11 12 for(var i=0;i<4;i++){13 if (output[i] == 255 && lastOutput[i] != output[i] ) {14 lastOutput[i] = 255;15 console.log("caught random 255");16 return false;17 }18 var computedHighThreshold;19 if (!lastOutput[i]) {20 computedHighThreshold = output[i] ; }21 else {22 computedHighThreshold = lastOutput[i] + 10;23 }24 var computedLowThreshold;25 if (!lastOutput[i]) {26 computedLowThreshold = output[i];27 } else {28 computedLowThreshold = lastOutput[i] -10;29 if (output[i] > computedHighThreshold ) {30 //console.log("Jump Up - axis: "+ i + " value:" + output[i] + " threshold for good value" + computedHighThreshold + " difference: ");31 return false;32 } else if (output[i] < computedLowThreshold) {33 //console.log("Jump Down - " + output[i] + " " + computedLowTreshold);34 return true;35 }36 }37 return true;38}39}40function go() { 41 while(true) {42 var output; // = lastOutput;43 try {44 output = i2cFace.readModuleState(10,4);45 var goodValues = bandPass(output,output);46 if (goodValues) {47 i2cFace.writeToRadio(8,output);48 lastOutput = output;49 }50 } catch (ex) {51 console.log(ex);52 }53 if (output) {54 console.log(output[0] + " " + output[1] + " " + output[2] + " " + output[3] );55 //i2cFace.writeToRadio(8,output);56 }57 }58}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { lastOutput } = require('fast-check');2console.log(lastOutput());3const { lastOutput } = require('fast-check');4console.log(lastOutput());5const { lastOutput } = require('fast-check');6console.log(lastOutput());7const { lastOutput } = require('fast-check');8console.log(lastOutput());9const { lastOutput } = require('fast-check');10console.log(lastOutput());11const { lastOutput } = require('fast-check');12console.log(lastOutput());13const { lastOutput } = require('fast-check');14console.log(lastOutput());15const { lastOutput } = require('fast-check');16console.log(lastOutput());17const { lastOutput } = require('fast-check');18console.log(lastOutput());19const { lastOutput } = require('fast-check');20console.log(lastOutput());21const { lastOutput } = require('fast-check');22console.log(lastOutput());23const { lastOutput } = require('fast-check');24console.log(lastOutput());25const { lastOutput } = require('fast-check');26console.log(lastOutput());27const { lastOutput } = require('fast-check');28console.log(lastOutput());

Full Screen

Using AI Code Generation

copy

Full Screen

1const { lastOutput } = require("fast-check");2const { lastOutput } = require("fast-check");3const { lastOutput } = require("fast-check");4const { lastOutput } = require("fast-check");5const { lastOutput } = require("fast-check");6const { lastOutput } = require("fast-check");7const { lastOutput } = require("fast-check");8const { lastOutput } = require("fast-check");9const { lastOutput } = require("fast-check");10const { lastOutput } = require("fast-check");11const { lastOutput } = require("fast-check");12const { lastOutput } = require("fast-check");13const { lastOutput } = require("fast-check");14const { lastOutput } = require("fast-check");15const { lastOutput } = require("fast-check");16const { lastOutput } = require("fast-check");

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const lastOutput = require('fast-check-monorepo').lastOutput;3console.log(lastOutput(fc.integer()));4const fc = require('fast-check');5const lastOutput = require('fast-check-monorepo').lastOutput;6console.log(lastOutput(fc.integer()));7const fc = require('fast-check');8const lastOutput = require('fast-check-monorepo').lastOutput;9console.log(lastOutput(fc.integer()));10const fc = require('fast-check');11const lastOutput = require('fast-check-monorepo').lastOutput;12console.log(lastOutput(fc.integer()));13const fc = require('fast-check');14const lastOutput = require('fast-check-monorepo').lastOutput;15console.log(lastOutput(fc.integer()));16const fc = require('fast-check');17const lastOutput = require('fast-check-monorepo').lastOutput;18console.log(lastOutput(fc.integer()));19const fc = require('fast-check');20const lastOutput = require('fast-check-monorepo').lastOutput;21console.log(lastOutput(fc.integer()));22const fc = require('fast-check');23const lastOutput = require('fast-check-monorepo').lastOutput;24console.log(lastOutput(fc.integer()));25const fc = require('fast-check');26const lastOutput = require('fast-check-monorepo').lastOutput;27console.log(lastOutput(fc.integer()));28const fc = require('fast-check');29const lastOutput = require('fast-check-monorepo').lastOutput;30console.log(lastOutput(fc.integer()));

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const {lastOutput} = require('fast-check-monorepo');3fc.assert(4 fc.property(fc.integer(), fc.integer(), (a, b) => {5 console.log('test3', {a, b});6 return a + b === b + a;7 }),8 {verbose: true}9);10lastOutput();11const fc = require('fast-check');12const {lastOutput} = require('fast-check-monorepo');13fc.assert(14 fc.property(fc.integer(), fc.integer(), (a, b) => {15 console.log('test4', {a, b});16 return a + b === b + a;17 }),18 {verbose: true}19);20lastOutput();21const fc = require('fast-check');22const {lastOutput} = require('fast-check-monorepo');23fc.assert(24 fc.property(fc.integer(), fc.integer(), (a, b) => {25 console.log('test5', {a, b});26 return a + b === b + a;27 }),28 {verbose: true}29);30lastOutput();31const fc = require('fast-check');32const {lastOutput} = require('fast-check-monorepo');33fc.assert(34 fc.property(fc.integer(), fc.integer(), (a, b) => {35 console.log('test6', {a, b});36 return a + b === b + a;37 }),38 {verbose: true}39);40lastOutput();41const fc = require('fast-check');42const {lastOutput} = require('fast-check-monorepo');43fc.assert(44 fc.property(fc.integer(), fc.integer(), (a, b) => {45 console.log('test7', {a, b});46 return a + b === b + a;47 }),48 {verbose: true}49);50lastOutput();51const fc = require('fast-check');52const {lastOutput} = require('fast-check

Full Screen

Using AI Code Generation

copy

Full Screen

1const { lastOutput } = require('fast-check');2const { lastOutput: lastOutput2 } = require('fast-check-monorepo');3console.log(lastOutput(), lastOutput2());4const { lastOutput } = require('fast-check');5console.log(lastOutput());6const { lastOutput } = require('fast-check-monorepo');7console.log(lastOutput());8const { lastOutput } = require('fast-check');9console.log(lastOutput());10const { lastOutput } = require('fast-check-monorepo');11console.log(lastOutput());12const { lastOutput } = require('fast-check');13console.log(lastOutput());14const { lastOutput } = require('fast-check-monorepo');15console.log(lastOutput());16const { lastOutput } = require('fast-check');17console.log(lastOutput());18const { lastOutput } = require('fast-check-monorepo');19console.log(lastOutput());20const { lastOutput } = require('fast-check');21console.log(lastOutput());22const { lastOutput } = require('fast-check-monorepo');23console.log(lastOutput());24const { lastOutput } = require('fast-check');25console.log(lastOutput());26const { lastOutput } = require('fast-check-monorepo');27console.log(lastOutput());

Full Screen

Using AI Code Generation

copy

Full Screen

1const { check, property } = require("fast-check");2const { lastOutput } = require("fast-check/lib/src/check/runner/LastOutput");3const arb = property(arb => {4 return true;5});6check(arb, { numRuns: 2 }).then(() => {7 console.log(lastOutput());8});9{ numRuns: 2,

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const { lastOutput } = require('fast-check/lib/check/runner/RunnerLastOutput');3const arb = fc.array(fc.integer());4const prop = arr => arr.length > 0;5fc.assert(fc.property(arb, prop), { seed: 42 });6console.log(lastOutput());7const fc = require('fast-check');8const { lastOutput } = require('fast-check/lib/check/runner/RunnerLastOutput');9const arb = fc.array(fc.integer());10const prop = arr => arr.length > 0;11fc.assert(fc.property(arb, prop), { seed: 42 });12console.log(lastOutput());

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const myArbitrary = fc.integer();3const myShrink = fc.shrinkInteger;4const myOutput = fc.lastOutput();5fc.assert(6 fc.property(myArbitrary, myShrink, myOutput,

Full Screen

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fast-check-monorepo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful