UNPKG

forto-sorter

Version:

Fast and powerful array sorting. Sort by any property in any direction with easy to read syntax.

24 lines (20 loc) 588 B
const runner = require('./../runner'); module.exports.run = function({ sortImplementation, testArr, numberOfRuns, librariesToRun, }) { // Control array to make sure that all implementation have sorted arrays correctly const controlArr = sortImplementation.fortoSorter([...testArr]); const run = runner.bind(undefined, testArr, controlArr, numberOfRuns); const results = {}; Object .keys(sortImplementation) .forEach((key) => { if (librariesToRun.includes(key)) { results[key] = run(sortImplementation[key]); } }); return results; };