We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I was thinking maybe it could be possible to use Set instead to do the same thing... A benchmark for it maybe?
Set
var a = ['a', 'b', 'c', 'd']; var b = ['b', 'c']; var set = new Set(a) b.forEach(a => set.delete(a)) Array.from(set) // => ['a', 'd']
Also in many situations it's wasteful to cast the set into an array... ppl only do it to keep the same signature and never used set in the first place
curious to see a benchmark for this native solution
The text was updated successfully, but these errors were encountered:
@jimmywarting so do you want to add another function which you call like this:
anotherDiffFn(setToRemoveValuesFrom, arrayOfThingsToRemove)
?
Sorry, something went wrong.
I was thinking more in terms of:
// index.js export default function diff (a, b) { const set = new Set(a) b.forEach(a => set.delete(a)) return set }
import diff from 'arr-diff' var a = ['a', 'b', 'c', 'd'] var b = ['b', 'c'] console.log(diff(a, b)) //=> Set(2) {'a', 'b'}
doe it would be breaking change...
No branches or pull requests
I was thinking maybe it could be possible to use
Set
instead to do the same thing...A benchmark for it maybe?
Also in many situations it's wasteful to cast the set into an array... ppl only do it to keep the same signature and never used set in the first place
curious to see a benchmark for this native solution
The text was updated successfully, but these errors were encountered: