question: how to remove sibling nodes from parent?
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 194
- Avg merge
- 22h 43m
- Merged PRs (30d)
- 10
Description
Hi, great job at first!
I'm writing continuous passing style transformation and i have a problem breaking my mind.
I've done almost everything, intercepting callback marker, replacing with a function call and nesting all the sibling nodes.
But i can't figure out how to remove sibling nodes from parent after copying them in the callback function so duplicates persits.
I'm visiting Expressions and calling path.get('elements') or path.parent.get('elements') or path.parentPath.get('elements') and so on... and did't the trick.
I extract siblings from 'path.parent.parentPath.value' starting from the index of the current node, but how can i remove the siblings?
It seems an assignment like
``` javascript
path.parent.parentPath.value = _.initial(path.parent.parentPath.value, current_index)
// (initial returns the first part till the current_index)
```
is not working, do i have to use the .replace() function?
path.parent.parentPath.value.replace is not defined,
path.parent.parentPath.replace is not defined too.
Any suggestions?
Thank you really much for your work!
Contributor guide
No contributing guide indexed for this repository
Research direction
No file or test is named. Start by reproducing the visitor transformation around path.get, path.parentPath, and path.parent.parentPath.value, then inspect the documented path replacement APIs; done means copied sibling nodes are removed from the parent without duplicates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100