There are many things I would like to change:
|
module.exports = function diff(arr, arrays) { |
Uses function instead of arrow function
|
module.exports = function diff(arr, arrays) { |
Uses arrays for a parameter, but is actually used like const arrays =. Uses arguments, when it could use ...arrays.
|
arrays = [].concat.apply([], [].slice.call(arguments, 1)); |
This is a really wierd line. Can just use [].concat() instead of [].concat.apply(). Uses [].slice when Array.prototype.slice makes more sense.
|
return arrays.indexOf(ele) === -1; |
Can use includes instead of indexOf
Can I make a pull request changing this? Should I add a new benchmark or edit the existing one?
There are many things I would like to change:
arr-diff/benchmark/code/filter.js
Line 3 in ea84b7d
functioninstead of arrow functionarr-diff/benchmark/code/filter.js
Line 3 in ea84b7d
arraysfor a parameter, but is actually used likeconst arrays =. Usesarguments, when it could use...arrays.arr-diff/benchmark/code/filter.js
Line 4 in ea84b7d
[].concat()instead of[].concat.apply(). Uses[].slicewhenArray.prototype.slicemakes more sense.arr-diff/benchmark/code/filter.js
Line 6 in ea84b7d
includesinstead ofindexOfCan I make a pull request changing this? Should I add a new benchmark or edit the existing one?