Is there a reason, besides performance, for d3.autotype skipping leading 0?
d3.autoType({id: "06075"})
=> 6075
d3.autotype is quite convenient.
Could a test on leading 0 be added to avoid string to number conversion here?
Is there a reason, besides performance, for d3.autotype skipping leading 0?
d3.autoType({id: "06075"})
=> 6075
d3.autotype is quite convenient.
Could a test on leading 0 be added to avoid string to number conversion here?
You’ll probably want to raise an issue in the d3-dsv repo, which provides d3.autoType
.
In the meantime I’d suggest to use destructuring:
d3.csvParse(text, ({id, ...d}) => ({id, ...d3.autoType(d)}))
brilliant, thanks!
I’ll raise the issue in the suggested repo.