Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.

Commit 9e3b65d

Browse files
committed
docs: comment the cast sample
1 parent fa0f130 commit 9e3b65d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

samples/option.cast.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ const data = `
77
2050-11-27,date2
88
`.trim()
99
const records = parse(data, {
10+
// The cast option exect a function which
11+
// is called with two arguments,
12+
// the parsed value and a context object
1013
cast: function(value, context){
14+
// You can return any value
1115
if(context.index === 0){
16+
// Such as a string
1217
return `${value}T05:00:00.000Z`
1318
}else{
19+
// Or the `context` object literal
1420
return context
1521
}
1622
},

0 commit comments

Comments
 (0)