mirror of
https://github.com/toss/es-toolkit.git
synced 2024-12-01 10:45:08 +03:00
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);
|
||
|
});
|
||
|
});
|
||
|
});
|