renaming any helper to some, reflecting Array::some

This commit is contained in:
Michael Ficarra
2012-05-16 07:58:14 -04:00
parent e8a8209a2b
commit c6fafa1bc9
4 changed files with 8 additions and 8 deletions

View File

@@ -55,7 +55,7 @@ exports.del = (obj, key) ->
# Gets the last item of an array(-like) object.
exports.last = (array, back) -> array[array.length - (back or 0) - 1]
# Typical Array::any
exports.any = Array::some ? (fn) ->
# Typical Array::some
exports.some = Array::some ? (fn) ->
return true for e in this when fn e
false

View File

@@ -7,7 +7,7 @@
{RESERVED, STRICT_PROSCRIBED} = require './lexer'
# Import the helpers we plan to use.
{any, compact, flatten, extend, merge, del, starts, ends, last} = require './helpers'
{compact, flatten, extend, merge, del, starts, ends, last, some} = require './helpers'
exports.extend = extend # for parser
@@ -821,7 +821,7 @@ exports.Obj = class Obj extends Base
prop = prop.variable if prop.isComplex()
if prop?
propName = prop.unwrapAll().value.toString()
if any.call propNames, isDuplicate propName
if some.call propNames, isDuplicate propName
throw SyntaxError "multiple object literal properties named \"#{propName}\""
propNames.push propName
return (if @front then '({})' else '{}') unless props.length