Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cloneDeepWithoutLoc #10670

Open
jridgewell opened this issue Nov 6, 2019 · 2 comments · May be fixed by #10680

Comments

@jridgewell
Copy link
Member

@jridgewell jridgewell commented Nov 6, 2019

I had a need for a t.cloneDeepWithoutLoc function today. We have a t.cloneDeep and a t.cloneWithoutLoc (both deprecated, but that's OK), but we do not have a t.cloneDeepWithoutLoc.

These functions all live in https://github.com/babel/babel/tree/bdb4318f47ec42ca4e325b5163e2e8ad57de4849/packages/babel-types/src/clone.

They are exported publicly at

// clone
export { default as cloneNode } from "./clone/cloneNode";
export { default as clone } from "./clone/clone";
export { default as cloneDeep } from "./clone/cloneDeep";
export { default as cloneWithoutLoc } from "./clone/cloneWithoutLoc";
.

We can add the functionality as a new optional-boolean parameter t.cloneNode. Let's call it withoutLoc. While we're add it, we can update t.cloneWithoutLoc to use this new parameter.

Let's also add tests, and flow and typescript types.

@Taym95

This comment has been minimized.

Copy link

@Taym95 Taym95 commented Nov 6, 2019

I would like to work on it!

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Nov 6, 2019

It's yours!

@Taym95 Taym95 referenced a pull request that will close this issue Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.