Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update usage of ArrayReduction

  • Loading branch information...
commit 5cb9e4534861243982f6339729ed2ecfe3d5e992 1 parent 8462584
@rafaelw rafaelw authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 examples/how_to/array_reduction.html
View
5 examples/how_to/array_reduction.html
@@ -33,7 +33,7 @@
path: 'selected',
initial: true,
reduce: function(prev, current) {
- return prev && !current;
+ return prev && !current.selected;
}
});
@@ -42,8 +42,9 @@
var reduction2 = ArrayReduction.defineProperty(model, 'sum', {
array: model.items,
path: 'amount',
+ initial: 0,
reduce: function(prev, current) {
- return Number(prev) + Number(current);
+ return prev + Number(current.amount);
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.