Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Promise.resolve(true).then(() => {
done(null, true);
});
}
function testSetTimeOut(done) {
setTimeout(() => {
done(null, true);
}, 0);
}
module.exports = [
{
async: true,
name: "promise",
test: test(testPromise, expected),
benchmark: testPromise
},
{
async: true,
name: "timeout",
test: test(testSetTimeOut, expected),
benchmark: testSetTimeOut
}
];
let index = 0;
while (index !== array.length) {
result += array[index];
index += 1;
}
const length = result.length;
result = "";
return length;
}
module.exports = [
{
async: false,
name: "while-loop",
test: test(whileLoop, expected),
benchmark: whileLoop
},
{
async: false,
name: "for-loop",
test: test(forLoop, expected),
benchmark: forLoop
}
];
setTimeout(() => {
done(null, true);
}, 0);
}
module.exports = [
{
async: true,
name: "promise",
test: test(testPromise, expected),
benchmark: testPromise
},
{
async: true,
name: "timeout",
test: test(testSetTimeOut, expected),
benchmark: testSetTimeOut
}
];
const length = result.length;
result = "";
return length;
}
module.exports = [
{
async: false,
name: "while-loop",
test: test(whileLoop, expected),
benchmark: whileLoop
},
{
async: false,
name: "for-loop",
test: test(forLoop, expected),
benchmark: forLoop
}
];