Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More coffeescript'ish list comprehension for finding unique ids.

  • Loading branch information...
commit 28cfbbe4bb48c7e4e72fde344ceb739851f1259d 1 parent 2d15a43
gvarela authored
Showing with 2 additions and 4 deletions.
  1. +2 −4 app/assets/javascripts/mercury/snippet.js.coffee
View
6 app/assets/javascripts/mercury/snippet.js.coffee
@@ -34,10 +34,8 @@ class @Mercury.Snippet
return instance
@uniqueId: ->
- i = 0
- identities = []
- identity = "snippet_#{i}"
- identities.push snippet.identity for snippet in @all
+ [i, identity] = [0, "snippet_0"]
+ identities = (snippet.identity for snippet in @all)
while identities.indexOf(identity) isnt -1
i += 1

0 comments on commit 28cfbbe

Please sign in to comment.
Something went wrong with that request. Please try again.