es-toolkit/benchmarks/performance/get.bench.ts
PiQuark6046 a186e5d4bd
feat(get): Add get (#232)
* feat: get

* chore: add benchmark of get

* test: get

* feat: get

* docs: get

* Update src/object/get.ts

---------

Co-authored-by: Sojin Park <raon0211@toss.im>
Co-authored-by: Sojin Park <raon0211@gmail.com>
2024-07-18 21:17:15 +09:00

23 lines
532 B
TypeScript

import { bench, describe } from 'vitest';
import { get as getToolkit } from 'es-toolkit';
import { get as getLodash } from 'lodash';
describe('get with string', () => {
bench('es-toolkit/get', () => {
getToolkit({ a: { b: 3 } }, 'a.b')
})
bench('lodash/get', () => {
getLodash({ a: { b: 3 } }, 'a.b')
})
})
describe('get with string array', () => {
bench('es-toolkit/get', () => {
getToolkit({ a: { b: 3 } }, ['a', 'b'])
})
bench('lodash/get', () => {
getLodash({ a: { b: 3 } }, ['a', 'b'])
})
})