39:28ad6d3e2618
Anton Shestakov <av6@dwimlabs.net>, Wed, 23 Mar 2016 16:55:52 +0800
index: maintain only one contact with type 'self' This isn't done in an event handler of contacts collection because doing it in 'add' handler would trigger 'sort' event after the model has been added, but before its 'add' event has propagated, and that's dumb.

next change 45:3e09cda9a660
previous change 34:a7e8ed799092

coffee/rivets.coffee

Permissions: -rw-r--r--

Other formats: Feeds:
rivets.adapters[':'] =
observe: (obj, keypath, callback) ->
obj.on('change:' + keypath, callback)
unobserve: (obj, keypath, callback) ->
obj.off('change:' + keypath, callback)
get: (obj, keypath) ->
obj.get(keypath)
set: (obj, keypath, value) ->
obj.set(keypath, value)
rivets.formatters['first-letter'] = (value) ->
value?.charAt?(0) ? ' '
rivets.formatters['only'] = (value, allowed...) ->
if value in allowed then value else ''
rivets.formatters['eq'] = (a, b) ->
a is b
rivets.formatters['format-date'] = (value, format) ->
if value? then value.format(format) else ''
rivets.formatters['iso-date'] = (value) ->
if value? then value.toISOString() else ''
rivets.formatters['from-now'] = (value) ->
if value? then value.fromNow() else ''