babbf49a by Michael Richards

Clean up formattedValue implementation.

1 parent 924b7ba1
...@@ -37,17 +37,17 @@ class Rivets.Binding ...@@ -37,17 +37,17 @@ class Rivets.Binding
37 for formatter in @formatters 37 for formatter in @formatters
38 args = formatter.split /\s+/ 38 args = formatter.split /\s+/
39 id = args.shift() 39 id = args.shift()
40 value = if @model[id] instanceof Function 40
41 @model[id] value, args... 41 formatter = if @model[id] instanceof Function
42 else if Rivets.formatters[id] 42 @model[id]
43 if Rivets.formatters[id].read instanceof Function 43 else
44 Rivets.formatters[id].read value, args... 44 Rivets.formatters[id]
45 else if Rivets.formatters[id] instanceof Function # could occur if fmt = { publish: function() {}} 45
46 Rivets.formatters[id] value, args... 46 if formatter?.read instanceof Function
47 else # skip if no read function exists 47 value = formatter.read value, args...
48 value 48 else if formatter instanceof Function
49 else # skip if no formatter exists 49 value = formatter value, args...
50 value 50
51 value 51 value
52 52
53 # Sets the value for the binding. This Basically just runs the binding routine 53 # Sets the value for the binding. This Basically just runs the binding routine
......