Closed whatthehanan closed 3 years ago
match method is being used which returns an empty array in case of no match and filter method considers it as a truthy value.
I don't think that is correct. match
is defined as:
// match :: RegExp -> String -> Boolean
const match = curry((re, str) => re.test(str));
That is not the string.match
function you normally use in JavaScript, which returns an array. But a custom function that indeed returns a Boolean.
Perhaps renaming the match
function to test
would make it easier to grok for js developers used to string.match
and regExp.test
.
the filterQs example is incorrect. currently,
match
method is being used which returns an empty array in case of no match andfilter
method considers it as a truthy value. I have replacedmatch
withtest
for intended behavior