Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Jun 1, 2022
1 parent b652c00 commit 745293f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/babel-core/src/transformation/util/clone-deep.ts
@@ -1,5 +1,3 @@
import type { types } from "@babel/core";

//https://github.com/babel/babel/pull/14583#discussion_r882828856
function deepClone(value: any, cache: Map<any, any>): any {
if (value !== null) {
Expand Down Expand Up @@ -28,7 +26,7 @@ function deepClone(value: any, cache: Map<any, any>): any {
return value;
}

export default function <T = types.Node>(value: T): T {
export default function <T>(value: T): T {
if (typeof value !== "object") return value;
return deepClone(value, new Map());
}

0 comments on commit 745293f

Please sign in to comment.