Skip to content

Commit b00a1d8

Browse files
authored
Change the reduce function to evaluate the initial value, which lets us capture state for use in the logic function. (#118)
1 parent 9c805e9 commit b00a1d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

logic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ http://ricostacruz.com/cheatsheets/umdjs.html
294294
} else if (op === "reduce") {
295295
scopedData = jsonLogic.apply(values[0], data);
296296
scopedLogic = values[1];
297-
initial = typeof values[2] !== "undefined" ? values[2] : null;
297+
initial = typeof values[2] !== "undefined" ? jsonLogic.apply(values[2], data) : null;
298298

299299
if ( ! Array.isArray(scopedData)) {
300300
return initial;

0 commit comments

Comments
 (0)