@@ 8-23 (lines=16) @@ | ||
5 | ||
6 | var arrayFuncs = { |
|
7 | ||
8 | count: function(value, not = false){ |
|
9 | var list = this; |
|
10 | var total = 0; |
|
11 | for (var a = 0, al = list.length;a<al;a++){ |
|
12 | if (not) { |
|
13 | if (list[a] != value) { |
|
14 | total++; |
|
15 | } |
|
16 | }else { |
|
17 | if (list[a] == value) { |
|
18 | total++; |
|
19 | } |
|
20 | } |
|
21 | } |
|
22 | return total; |
|
23 | }, |
|
24 | or: function(list2){ |
|
25 | var list = this; |
|
26 | if (list.exists()) { |
@@ 44-55 (lines=12) @@ | ||
41 | } |
|
42 | return -1; |
|
43 | }, |
|
44 | lastIndexOfNot: function(value){ |
|
45 | var list = this; |
|
46 | if (list.length === 0) { |
|
47 | return -1; |
|
48 | } |
|
49 | for (var a = list.length-1;a>=0;a--){ |
|
50 | if (list[a] != value){ |
|
51 | return a; |
|
52 | } |
|
53 | } |
|
54 | return -1; |
|
55 | }, |
|
56 | ||
57 | ||
58 | replace: function(find, replace, stringReplace = false){ |
|
@@ 32-43 (lines=12) @@ | ||
29 | } |
|
30 | return -1; |
|
31 | }, |
|
32 | lastIndexOf: function(value){ |
|
33 | var list = this; |
|
34 | if (list.length === 0) { |
|
35 | return -1; |
|
36 | } |
|
37 | for (var a = list.length-1;a>=0;a--){ |
|
38 | if (list[a] == value){ |
|
39 | return a; |
|
40 | } |
|
41 | } |
|
42 | return -1; |
|
43 | }, |
|
44 | lastIndexOfNot: function(value){ |
|
45 | var list = this; |
|
46 | if (list.length === 0) { |