Skip to content

Commit 05860e2

Browse files
committed
Merge pull request #92 from houkanshan/double-load
Fix the broken `each` function.
2 parents 419f5c4 + 668370c commit 05860e2

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

dist/script.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
}
3030
function each(ar, fn) {
3131
every(ar, function (el) {
32-
return !fn(el)
32+
fn(el)
33+
return 1
3334
})
3435
}
3536

dist/script.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/script.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
}
2424
function each(ar, fn) {
2525
every(ar, function (el) {
26-
return !fn(el)
26+
fn(el)
27+
return 1
2728
})
2829
}
2930

tests/tests.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ script('../node_modules/domready/ready.js', function () {
141141
})
142142
})
143143

144+
test('double loaded file in different loading list', 2, function() {
145+
script(['../vendor/lab2.js', '../vendor/lab2.min.js'], function() {
146+
ok(true, 'lab2 and lab2.min have been loaded')
147+
})
148+
script(['../vendor/lab2.js', '../vendor/head.js'], function() {
149+
ok(true, 'lab2 and head have been loaded')
150+
})
151+
})
152+
144153
})
145154
start()
146155
})

0 commit comments

Comments
 (0)