mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 20:26:33 +03:00
02643bcbe3
* feat(lowerFirst): Add lowerFirst function * Add lowerFirst benchmark * Add lowerFirst english docs --------- Co-authored-by: Sojin Park <raon0211@toss.im>
29 lines
724 B
TypeScript
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);
|
|
});
|
|
});
|
|
});
|