Make await array behavior similar to built-in Promise.all
const [a, b] = await [Promise.resolve(1), Promise.resolve(2)]
console.log(a, b) // should print 1, 2
To add new approach to be tested and benchmarked, it should fulfil following requirements:
- Should be a
thenable
function - Ecmascript module syntax
- named function (will be used in tests and benchmarks as label)
- default exported
- be in separate file inside approahces directory
If necessary function could also by async.
Approach will automaticaly be assigned to Array.prototype.then
during tests.
Here is an example of correctly disgned approach:
export default function testApproach (resolve) {
// some code here
resolve(this)
}
Before running tests make sure all necessary dependencies to be installed via
npm i
npm run test
or
npm t
npm run bench