285:30fd0d2a81ce
Anton Shestakov <av6@dwimlabs.net>, Sat, 16 Sep 2017 22:29:17 +0800
Make: use npm update for devel target package.json says we want coffee-script >= 1.6.1, so that's what `make devel` should install (the newest version): since .js source is tracked, there's no risk of running into breaking changes in coffee-script outside of test environment. But running into such changes during tests is OK and even potentially desirable.

previous change 232:0fe8137e0f76

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.binders['style-*'] = (el, value) ->
el.style[@args[0]] = value ? ''
rivets.formatters['first-letter'] = (value) ->
value?.charAt?(0) ? ' '
rivets.formatters['dumb-hash'] = (value) ->
result = 0
if value?.length
for i in [0...value.length]
result += value.charCodeAt(i)
return result
rivets.formatters['fn'] = (value, fn) ->
return fn(value)
rivets.formatters['only'] = (value, allowed...) ->
if value in allowed then value else ''
rivets.formatters['eq'] = (a, b) ->
a is b
rivets.formatters['has'] = (a, b) ->
a? and b in a
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 ''
rivets.formatters['percent'] = (value) ->
"#{ value ? 0 }%"