mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 20:26:33 +03:00
58ea6baa5d
Co-authored-by: Sojin Park <raon0211@toss.im>
24 lines
508 B
TypeScript
24 lines
508 B
TypeScript
import { bench, describe } from 'vitest';
|
|
import { clone } from 'es-toolkit';
|
|
import { clone as lodashClone } from 'lodash';
|
|
|
|
const obj = {
|
|
number: 29,
|
|
string: 'es-toolkit',
|
|
boolean: true,
|
|
array: [1, 2, 3],
|
|
object: { a: 1, b: 'es-toolkit' },
|
|
date: new Date(),
|
|
regex: /abc/g,
|
|
nested: { a: [1, 2, 3], b: { c: 'es-toolkit' }, d: new Date() },
|
|
};
|
|
|
|
describe('clone', () => {
|
|
bench('es-toolkit/clone', () => {
|
|
clone(obj);
|
|
});
|
|
bench('lodash/clone', () => {
|
|
lodashClone(obj);
|
|
});
|
|
});
|