Skip to content

Commit e62a879

Browse files
committed
Removed .call() in favor of a simpler !fun(array[i]), which I believe should work the same. Added semicolon. angular#4549
1 parent cd47933 commit e62a879

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Angular.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,17 @@ function map(obj, iterator, context) {
516516
return results;
517517
}
518518

519+
/**
520+
* @description
521+
* Determines the total value of a list by returning the value of each item passed into an iterator function
522+
*
523+
* @param array ['value1', 'value2', ... ]
524+
* @param function(String)
525+
* @returns {boolean} The value of all of the items passed into the iterator function
526+
*/
519527
function every(array, fun) {
520528
for (var i = 0; i < array.length; i++) {
521-
if (i in array && !fun.call(array, array[i], i, Object(array))) {
529+
if (i in array && !fun(array[i])) {
522530
return false;
523531
}
524532
}

src/ng/directive/input.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
588588
if (isArray(value)) {
589589
testedValid = every(value, function(val){return URL_REGEXP.test(val);});
590590
} else {
591-
testedValid = URL_REGEXP.test(value)
591+
testedValid = URL_REGEXP.test(value);
592592
}
593593
if (ctrl.$isEmpty(value) || testedValid) {
594594
ctrl.$setValidity('url', true);

0 commit comments

Comments
 (0)