mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
making the each fixture a little more like underscore, and avoiding passing assignment into functions from the outside
This commit is contained in:
9
test/fixtures/each.cs
vendored
9
test/fixtures/each.cs
vendored
@@ -3,9 +3,12 @@
|
||||
_.each: obj, iterator, context =>
|
||||
index: 0
|
||||
try
|
||||
return obj.forEach(iterator, context) if obj.forEach
|
||||
return iterator.call(context, item, i, obj) for item, i in obj. if _.isArray(obj) or _.isArguments(obj)
|
||||
iterator.call(context, obj[key], key, obj) for key in _.keys(obj).
|
||||
if obj.forEach
|
||||
obj.forEach(iterator, context)
|
||||
else if _.isArray(obj) or _.isArguments(obj)
|
||||
iterator.call(context, item, i, obj) for item, i in obj.
|
||||
else
|
||||
iterator.call(context, obj[key], key, obj) for key in _.keys(obj)..
|
||||
catch e
|
||||
throw e if e aint breaker.
|
||||
obj.
|
||||
Reference in New Issue
Block a user