Skip to content

can d3-array also support BigInt numbers? #280

@tx0c

Description

@tx0c

some like d3.ascending d3.descending have no problems, some are not:

const bigints = [ 1n, 2n, 3n, -300n ];

bigints.sort(d3.descending); // okay
d3.sum(bigints); // error
file:///path/to/node_modules/d3-array/src/sum.js:5
      if (value = +value) {
                  ^

TypeError: Cannot convert a BigInt value to a number
    at Module.sum (file:///path/to/tmp/node_modules/d3-array/src/sum.js:5:19)
    at file:///path/to/tmp/xxx.mjs:67:6
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v21.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions