Closed lukeed closed 8 years ago
What was the issue with rest arguments? I was actually working on adding more test cases for this while I was working on another feature.
I think I see why there was a problem, it comes from this commit. He updated the isPlainObject
function to actually be correct because I had !==
instead of ===
like it should have been. But when he made that change he didn't update the places where it was called to be !isPlainObject(options)
if (!isPlainObject(options)) {
globs.push(options)
options = {}
}
In the pr I'm working on I added 6+ tests cases fly.source
and similar tests for the other functions that were touched.
@tjbenton I did that as well, still had issues. 😟 I also checked out your PR commit directly.
It's okay though, I prefer this method of handling arguments. It's less code, more intuitive, and more consistent. Only fly.clear
has the flexible sourcing (because it's one argument).
With #189 (thanks to @tjbenton!),
fly.source
,fly.clear
,fly.start
, andfly.watch
had their APIs modified and/or refactored to allow foroption
objects to parsed from glob-arrays.Despite passing tests, his first pass was unusable at runtime / outside of the
test
environment. (Add "better tests" to the todo list...)This fills in the gaps while still maintaining the new features.
Changes:
fly.start
andfly.source
lose "intelligent" globbing.Instead of passing an infinite argument list (with an
options
object as the last entry) for a spread-like behavior, there are now only two arguments:globs
andoptions
.This means that multiple glob entries must always be received as an array.
Single glob selections may or may not choose to be an array.
Examples:
Changed ${filepath}
toFile changed: ${filepath}
Thanks to @hzlmn for pointing out the issue & jumpstarting the process.