File tree Expand file tree Collapse file tree 3 files changed +84
-0
lines changed Expand file tree Collapse file tree 3 files changed +84
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ *
3
+ every() exectues a provided *predicate* on each element of
4
+ the array until it is not fulfilled.
5
+
6
+ every() has two parameters:
7
+
8
+ - the predicate callback function
9
+ - a *this* argument for the callback. If none is provided, *this* will not be set in the predicate
10
+
11
+ The predicate function one to three arguments:
12
+
13
+ - the value of current element
14
+ - the index of the current element
15
+ - the Array object being traversed
16
+
17
+ If the predicate is not fulfilled then the method will exit early (and return false).
18
+
19
+ Calling every on an empty array will return true.
20
+ */
21
+ Array . prototype . myEvery = function myEvery ( predicate , thisArg ) {
22
+ for ( var i = 0 ; i < this . length ; ++ i ) {
23
+ if ( ! predicate . call ( thisArg , this [ i ] , i , this ) )
24
+ return false ;
25
+ }
26
+
27
+ return true ;
28
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ *
3
+ none() exectues a provided *predicate* on each element of
4
+ the array until it is fulfilled.
5
+
6
+ none() has two parameters:
7
+
8
+ - the predicate callback function
9
+ - a *this* argument for the callback. If none is provided, *this* will not be set in the predicate
10
+
11
+ The predicate function one to three arguments:
12
+
13
+ - the value of current element
14
+ - the index of the current element
15
+ - the Array object being traversed
16
+
17
+ If the predicate is fulfilled then the method will exit early (and return false).
18
+
19
+ Calling none on an empty array will return true.
20
+ */
21
+ Array . prototype . myNone = function myNone ( predicate , thisArg ) {
22
+ for ( var i = 0 ; i < this . length ; ++ i ) {
23
+ if ( predicate . call ( thisArg , this [ i ] , i , this ) )
24
+ return false ;
25
+ }
26
+
27
+ return true ;
28
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ *
3
+ some() exectues a provided *predicate* on each element of
4
+ the array until it is fulfilled.
5
+
6
+ some() has two parameters:
7
+
8
+ - the predicate callback function
9
+ - a *this* argument for the callback. If none is provided, *this* will not be set in the predicate
10
+
11
+ The predicate function one to three arguments:
12
+
13
+ - the value of current element
14
+ - the index of the current element
15
+ - the Array object being traversed
16
+
17
+ If the predicate is fulfilled then the method will exit early (and return true).
18
+
19
+ Calling some on an empty array will return false.
20
+ */
21
+ Array . prototype . mySome = function mySome ( predicate , thisArg ) {
22
+ for ( var i = 0 ; i < this . length ; ++ i ) {
23
+ if ( predicate . call ( thisArg , this [ i ] , i , this ) )
24
+ return true ;
25
+ }
26
+
27
+ return false ;
28
+ } ;
You can’t perform that action at this time.
0 commit comments