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

Commit b3d79fb

Browse files
committed
bom: sample with hidden bom
1 parent 0cbd647 commit b3d79fb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
## Trunk
1414

15+
* bom: sample with hidden bom
1516
* bom: test behavior with the column option
1617
* src: cache length in loops
1718

samples/options.bom.hidden.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
const parse = require('../lib/sync')
3+
const assert = require('assert')
4+
5+
const data = "\ufeffkey\nvalue"
6+
const records = parse(data, {
7+
bom: false,
8+
columns: true
9+
})
10+
// It seems that the output is perfectly fine
11+
assert.equal(JSON.stringify(records[0]), '{"key":"value"}')
12+
// However, the first property include the BOM bytes
13+
assert.equal(Object.keys(records[0])[0], '\ufeffkey')

0 commit comments

Comments
 (0)