Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 937d151

Browse files
authored
Merge pull request #1 from contra/patch-1
add mapValues and mapHeaders options
2 parents 405de7e + 9fda56c commit 937d151

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ module.exports = function exceljsStream(opts) {
1818
workbook.eachSheet(function (sheet, id) {
1919
sheet.eachRow(function (row, id) {
2020
if (id === 1 || !headers) {
21-
headers = row.values
21+
headers = opts.mapHeaders ? row.values.map(opts.mapHeaders) : row.values
2222
return
2323
}
2424
var item = {}
2525
row.values.forEach(function (v, k) {
2626
if (!headers) return
27-
item[headers[k]] = v
27+
item[headers[k]] = opts.mapValues ? opts.mapValues(v) : v
2828
})
2929
if (!opts.objectMode) {
3030
second.push(JSON.stringify(item))

0 commit comments

Comments
 (0)