cloneDeep
인자로 주어진 값을 깊은 복사
를 수행하는 함수입니다.
Code
Benchmark
hz
: 초당 작업 수mean
: 평균 응답 시간(ms)
이름 | hz | mean | 성능 |
---|---|---|---|
modern-kit/cloneDeep | 1,529,157.20 | 0.0007 | fastest |
lodash/cloneDeep | 650,320.39 | 0.0015 | - |
- modern-kit/cloneDeep
2.35x
faster than lodash/cloneDeep
Interface
typescript
function cloneDeep<T>(value: T): T
Usage
typescript
import { cloneDeep } from '@modern-kit/utils';
const originNum = 42;
const copyNum = cloneDeep(originNum);
const originObj = { a: 1, b: { c: 2 } };
const copyObj = cloneDeep(originObj);
const originArray = [1, 2, [3, 4]];
const copyArray = cloneDeep(originArray);
const originSet = new Set([1, 2, 3]);
const copySet = cloneDeep(originSet);
const originMap = new Map([
['a', 1],
['b', 2],
]);
const copyMap = cloneDeep(originMap);