INNER CODE UNIT · JavaScript

filterBySearchTerms

m4heshd/better-sqlite3-multiple-ciphers · benchmark/index.js:13

const filterBySearchTerms = (searchTerms) => (trial) => {
	const terms = [
		trial.type,
		trial.table,
		`(${trial.columns.join(', ')})`,
		`(${trial.columns.join(',')})`,
		...trial.columns,
		...trial.customPragma,
	];
	return searchTerms.every(arg => terms.includes(arg));
};

const sortTrials = (a, b) => {
	const aRo = require(`./types/${a.type}`).readonly;
	const bRo = require(`./types/${b.type}`).readonly;
	if (typeof aRo !== 'boolean') throw new TypeError(`Missing readonly export in benchmark type ${a.type}`);
	if (typeof bRo !== 'boolean') throw new TypeError(`Missing readonly export in benchmark type ${b.type}`);
	return bRo - aRo;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…