This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scroll down for code example and result | |
////////////////////// | |
// Code - Normal usage | |
const [index, score] = await PluginBase.util.fuzzyHighScore( | |
sub.query, | |
filteredVideos.map(video => video.title), | |
0, | |
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Question: https://stackoverflow.com/questions/60623418/is-there-any-programmatic-way-to-break-infinite-loop-in-nodejs | |
const example = () => { | |
const infiniteLoopWithSignal = async controller => { | |
let iteration = 0; | |
while (true) { | |
if(controller.isStopped) break; | |
console.log("Iteration: ", iteration++); | |
await new Promise(resolve => setTimeout(resolve, 1000)); | |
} |