Skip to content

q.push deeply flats arrays in v3 #1645

@darksabrefr

Description

@darksabrefr

In v3, a change occurred in queues/cargos handling : the push method now deeply flats array passed as data.

What version of async are you using?
3.0.0

Which environment did the issue occur in (Node version/browser version)
Node 12.3.1

What did you do? Please include a minimal reproducible case illustrating issue.

const myCargo = async.cargo(async (data) => {
  console.log(data);
});
const myData1 = [1, 2, 3];
const myData2 = [4, 5, 6];
myCargo.push([myData1, myData2]);

What did you expect to happen?
The output should be [[1, 2, 3], [4, 5, 6]]

What was the actual result?
In v3, the main array is deeply flatten and the output is [1, 2, 3, 4, 5, 6] (or with a true async code, it could be [1, 2, 3] and [4, 5, 6]), so we cannot pass arrays as data anymore to queues/cargos.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions