es-toolkit/benchmarks/performance/isRegExp.bench.ts
hyesung oh e436125344
feat(isRegExp): add isRegExp function (#417)
* feat: isRegExp at src/predicate

* feat: isRegExp at compat

* test: bench

* docs: append isRegExp

* chore: format

---------

Co-authored-by: Sojin Park <raon0211@toss.im>
2024-08-25 22:01:12 +09:00

18 lines
461 B
TypeScript

import { bench, describe } from 'vitest';
import { isRegExp as isRegExpToolkit } from 'es-toolkit';
import { isRegExp as isRegExpLodash } from 'lodash';
describe('isRegExp', () => {
bench('es-toolkit/isRegExp', () => {
isRegExpToolkit(new RegExp(''));
isRegExpToolkit(/abc/);
isRegExpToolkit('/abc/');
});
bench('lodash/isRegExp', () => {
isRegExpLodash(new RegExp(''));
isRegExpLodash(/abc/);
isRegExpLodash('/abc/');
});
});