Skip to content

Commit

Permalink
Mention d3.autoType in discussion of row conversion functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw authored and mbostock committed Mar 6, 2019
1 parent 3c1f1a7 commit 6c0c578
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ data.columns; // ["Year", "Make", "Model", "Length"]

If a *row* conversion function is not specified, field values are strings. For safety, there is no automatic conversion to numbers, dates, or other types. In some cases, JavaScript may coerce strings to numbers for you automatically (for example, using the `+` operator), but better is to specify a *row* conversion function.

[*dsv*.autoType](#autoType) is included as a convenient *row* conversion function that infers and coerces common types like numbers and strings.

If a *row* conversion function is specified, the specified function is invoked for each row, being passed an object representing the current row (`d`), the index (`i`) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, the row is skipped and will be omitted from the array returned by *dsv*.parse; otherwise, the returned value defines the corresponding row object. For example:

```js
Expand Down

0 comments on commit 6c0c578

Please sign in to comment.