Closed scraggo closed 3 years ago
Does the issue also apply to .all
? If so, we should fix it there too.
@sindresorhus I tried a slightly different approach in my latest push and applied it to .all
as well.
I decided to keep the options object for this approach because it's now a boolean flag. {multipleValues: true}
is more readable in my opinion than a bare boolean. This isn't a strong opinion and it's easily changed if you disagree 😄
(I could also make a new function to handle multiple values, named assertTypes
or assertMultipleTypes
)
Thanks :)
This PR fixes #131
Approach: Add an options object to
assertType
. This allows a custom failure message from the calling code. It's a function that returns a string and passed in asgetValuesMessage
to the options object.What do you think of the approach?