Add group by helper.

stable
Andrey Antukh 2014-06-25 12:12:12 +02:00
parent 3bb540b6d7
commit 53cd77513f
1 changed files with 8 additions and 0 deletions

View File

@ -50,8 +50,16 @@ toggleText = (element, texts) ->
element.data('nextTextPosition', nextTextPosition + 1)
element.text(text)
groupBy = (coll, pred) ->
result = {}
for item in coll
result[pred(item)] = item
return result
taiga = @.taiga
taiga.bindOnce = bindOnce
taiga.mixOf = mixOf
taiga.trim = trim
taiga.toggleText = toggleText
taiga.groupBy = groupBy