-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Callbacks for foldl or foldr have different argument signature for objects and arrays. For example, foldl(fn, 0, [1, 2, 3]) will invoke the callback with 0, 1, where 0 is the initial value and memo is 1. Doing the same with an object { 1:1, 2:2, 2:3 } will send 0, { key: "1", value: 1 }.
This gets awkward when your application might invoke the fold on an array or object because the callback has to check the type of the original object to know what call signature to expect.
I propose that we change the array signature to match that of the object. It'll require changing all places where the folds are used. Considering that we're still pre 1.0, we can make these changes.
Metadata
Metadata
Assignees
Labels
No labels