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

pull snippet does not work #214

Closed
AlexOldest opened this issue Dec 17, 2017 · 2 comments
Closed

pull snippet does not work #214

AlexOldest opened this issue Dec 17, 2017 · 2 comments

Comments

@AlexOldest
Copy link

AlexOldest commented Dec 17, 2017

Original version of pull snippet does not work. The following version works but returns a new array.

const Pull = (a, ...args) => { const s = new Set(args); return a.filter(x => !s.has(x)); };
let a = ["I", "see", "the", "present", "and", "the", "past"];
let v = Pull(a, "the", "and");  // ["I", "see",  "present", "past"]
@Chalarangelo
Copy link
Owner

Chalarangelo commented Dec 17, 2017

This was just fixed in #213. If you do not want to mutate the array, you should use the "array without" snippet, by the way, as the pull snippet is supposed to mutate the array.

@lock
Copy link

lock bot commented Dec 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for any follow-up tasks.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants