-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add 'includes' helper #37
Conversation
var array = [1, 2, 3]; | ||
var value = 2; | ||
|
||
{{includes array value}} => TRUE |
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.
small case true
Current coverage is 98.55%@@ master #37 diff @@
==========================================
Files 7 7
Lines 131 138 +7
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 129 136 +7
Misses 2 2
Partials 0 0
|
return false; | ||
} | ||
|
||
for (let index in array) { |
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.
Can reduce the nested if
s a little bit:
if ((strict && array[index] === value) ||
(!strict && array[index] == value)
) {
return true;
}
See this:
You need one or more tests |
Parameters: | ||
``` | ||
params [array] The array. (Required) | ||
params [mixed] The value to checked for existence in the array. (Required) |
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.
Value to be checked
ca687fb
to
38b86ea
Compare
includes
helper to check for the existence of the value in array strictly(value + data type).Parameters:
Returns
boolean
Usage:
Test Cases: