es-toolkit/benchmarks/performance/lowerFirst.bench.ts
mattiacoll 02643bcbe3
feat(lowerFirst): add lowerFirst function (#403)
* feat(lowerFirst): Add lowerFirst function

* Add lowerFirst benchmark

* Add lowerFirst english docs

---------

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

29 lines
724 B
TypeScript

import { bench, describe } from 'vitest';
import { lowerFirst as lowerFirstToolkit } from 'es-toolkit';
import { lowerFirst as lowerFirstLodash } from 'lodash';
describe('lowerFirst', () => {
describe('short string', () => {
bench('es-toolkit/lowerFirst', () => {
const str = 'camelCase';
lowerFirstToolkit(str);
});
bench('lodash/lowerFirst', () => {
const str = 'camelCase';
lowerFirstLodash(str);
});
});
describe('long string', () => {
const LONG_STR = 'camelCaseLongString'.repeat(1000);
bench('es-toolkit/lowerFirst', () => {
lowerFirstToolkit(LONG_STR);
});
bench('lodash/lowerFirst', () => {
lowerFirstLodash(LONG_STR);
});
});
});