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
Allow usage of arrays in addition to variadic arguments in Interval and Plan functions #25
Conversation
…nd Plan functions
Codecov Report
@@ Coverage Diff @@
## master #25 +/- ##
==========================================
+ Coverage 90.71% 90.88% +0.17%
==========================================
Files 16 16
Lines 840 834 -6
==========================================
- Hits 762 758 -4
+ Misses 78 76 -2 |
Hi, @Wilsonator5000 , thank you for your contribution to the project! |
Hi @jianstm, Yep, I forgot to consider that. Should I implement it where the functions return Thanks, |
Just return a |
Needed for unit tests to compare different Plan instances. The == check is based on Plan.sequence.
The == check was only reliable on never Plans and failed for Plans with dates or intervals, so it was removed and replaced with the reliable, single-purpose isNever() check.
OK, I added the checks and some corresponding unit tests. I originally made Plan equatable so I could test for never Plans in the unit tests, but it proved to be unreliable. Instead I created an |
@Wilsonator5000 Thanks! |
Although it is cleaner to use a variadic function when creating schedules (ex. via
Plan.of(_ dates: Date...)
), sometimes it is necessary to pass an array instead of a list of parameters, like when dealing with data obtained at runtime. This PR adds that ability. For example, thePlan.of(_:)
function can now take an array ofDate
s like so:The existing API has not changed whatsoever, the only difference being that the function implementations are now located in the array-variant of the function, and the existing variadic-variant (whose parameters are interpreted as an array in the function body) now simply passes its parameters into the array-variant.