UNPKG
monky
Version:
latest (0.7.1)
0.7.1
0.7.0
0.6.13
0.6.12
0.6.11
0.6.10
0.6.9
0.6.8
0.6.7
0.6.6
0.6.5
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.1
0.5.0
0.4.2
0.4.1
0.4.0
0.3.1
0.3.0
0.2.2
0.2.1
0.2.0
0.1.1
0.1.0
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
Mongoose fixtures library inspired by factory_girl
github.com/behrendtio/monky
behrendtio/monky
monky
/
helpers
/
each.js
18 lines
(14 loc)
•
302 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module
.
exports
=
function
_each
(
collection, iterator, cb
) {
var
done =
0
;
if
(collection.
length
===
0
) {
return
cb
(); } collection.
forEach
(
function
(
item
) {
iterator
(item,
function
(
err
) { done +=
1
;
if
(done >= collection.
length
) {
cb
(err); } }) }) };