Cross Reference:
xref
: /
yui3
/
sandbox
/
colly
/
js
/
nodelist-modulus.js
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
nodelist-modulus.js revision e09da100d0c76f9a0d5c9e3d60a44c29b2402e9d
Y.
mix
( Y.
NodeList
.
prototype
, {
modulus
:
function
( n, r ) {
r = r ||
0
;
var
items
= [];
Y.
Array
.
each
(
this
.
_items
,
function
(
item
, i ) {
if
( i % n === r ) {
items
.
push
(
item
);
}
},
this
);
return
Y.
all
(
items
);
},
odd
:
function
() {
return
this
.
modulus
(
2
,
1
);
},
even
:
function
() {
return
this
.
modulus
(
2
);
}
});