updating underscore.coffee to 0.5.8

This commit is contained in:
Jeremy Ashkenas 2010-02-13 02:03:48 -05:00
parent 506ea8aa52
commit 89cac4071e
1 changed files with 3 additions and 3 deletions

View File

@ -47,7 +47,7 @@
# Current version. # Current version.
_.VERSION: '0.5.7' _.VERSION: '0.5.8'
# ------------------------ Collection Functions: --------------------------- # ------------------------ Collection Functions: ---------------------------
@ -58,7 +58,7 @@
index: 0 index: 0
try try
return obj.forEach(iterator, context) if obj.forEach return obj.forEach(iterator, context) if obj.forEach
if _.isArray(obj) or _.isArguments(obj) if _.isNumber(obj.length)
return iterator.call(context, obj[i], i, obj) for i in [0...obj.length] return iterator.call(context, obj[i], i, obj) for i in [0...obj.length]
iterator.call(context, val, key, obj) for key, val of obj iterator.call(context, val, key, obj) for key, val of obj
catch e catch e
@ -147,7 +147,7 @@
# Determine if a given value is included in the array or object, # Determine if a given value is included in the array or object,
# based on '==='. # based on '==='.
_.include: (obj, target) -> _.include: (obj, target) ->
return _.indexOf(obj, target) isnt -1 if _.isArray(obj) return _.indexOf(obj, target) isnt -1 if obj and _.isFunction(obj.indexOf)
for key, val of obj for key, val of obj
return true if val is target return true if val is target
false false