mirror of
https://github.com/toss/es-toolkit.git
synced 2024-12-01 10:45:08 +03:00
231b7ef83c
* feat(after): Add after function * feat(after): Add after test code * feat(after): Add after benchmark * feat(after): Add after docs * fix(after): should create a function that unc only after being called calls * docs(after): change the after function docs * Apply suggestions from code review * Apply suggestions from code review --------- Co-authored-by: Sojin Park <raon0211@gmail.com> Co-authored-by: Sojin Park <raon0211@toss.im>
24 lines
600 B
TypeScript
24 lines
600 B
TypeScript
import { bench, describe } from 'vitest';
|
|
import { after as afterToolkit } from 'es-toolkit';
|
|
import { after as afterLodash } from 'lodash';
|
|
|
|
describe('after', () => {
|
|
bench('es-toolkit/after', () => {
|
|
const add = (a: number, b: number) => a + b;
|
|
const n = 10;
|
|
const afterFn = afterToolkit(n, add);
|
|
for (let i = 0; i < n + 1; i++) {
|
|
afterFn(1, 2);
|
|
}
|
|
});
|
|
|
|
bench('lodash/after', () => {
|
|
const add = (a: number, b: number) => a + b;
|
|
const n = 10;
|
|
const afterFn = afterLodash(n, add);
|
|
for (let i = 0; i < n + 1; i++) {
|
|
afterFn(1, 2);
|
|
}
|
|
});
|
|
});
|