-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
chore!: Normalize repository, dropping node <10.13 support #34
Conversation
2dca685
to
e958d97
Compare
lib/helpers.js
Outdated
@@ -2,10 +2,8 @@ | |||
|
|||
var assert = require('assert'); | |||
|
|||
var filter = require('arr-filter'); | |||
var map = require('arr-map'); | |||
// bach supports nodejs>=v10.13, but Array#flat is introduced in v11. | |||
var flatten = require('arr-flatten'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should arr-flatten
be replaced by Array.prototype.slice.apply
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arr-flatten
expands array elements recursively.
@phated I've dropped |
lib/flatten.js
Outdated
function flatten(arr, ret) { | ||
ret = ret || []; | ||
for (var i = 0, n = arr.length; i < n; i++) { | ||
var el = arr[i]; | ||
if (Array.isArray(el)) { | ||
flatten(el, ret); | ||
} else { | ||
ret.push(el) | ||
} | ||
} | ||
return ret; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I originally designed bach, I only wanted to support this syntax:
bach.series([a, b, c], options)
I don't really care if we recursively flatten, and this will be a breaking release, so I think we can use Array.prototype.slice.apply
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phated OK. I'll modify it to use Array.prototype.slice.apply
.
77b41fe
to
04f75ea
Compare
@phated I've modified what you pointed out. |
@@ -53,28 +56,29 @@ function buildOnSettled(done) { | |||
} | |||
|
|||
function verifyArguments(args) { | |||
args = flatten(args); | |||
var lastIdx = args.length - 1; | |||
args = Array.prototype.slice.apply(args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to add a semantic commit message for this potentially breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sttk 🙇 This looks great. I'm going to merge and then reword some things like extensions
since they are now called options
in now-and-later
This PR updates this project:
arr-filter
,array-map
,array-each
,array-initial
, andarray-last
from dependencies.arr-flatten
is left becauseArray#flat
is introduced in Node.js v11.NOTE: Be careful that this package depends on
async-done
,async-settle
andnow-and-later
that will be bumped up.