Skip to content

Commit

Permalink
[feat] Strip BOM character
Browse files Browse the repository at this point in the history
  • Loading branch information
EdvinasDaugirdas committed Jan 28, 2022
1 parent d893ac5 commit 7b39c1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/har-to-k6.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const { DEFAULT_CLI_OPTIONS } = require('../src/constants')
const { VError } = require('verror')

class CommandLineError extends VError {}
const BOM_REGEX = /^\uFEFF/

pkginfo(module, 'version')
const version = module.exports.version
Expand Down Expand Up @@ -66,7 +67,7 @@ function read(file) {

function parse(json) {
try {
return JSON.parse(json)
return JSON.parse(json.replace(BOM_REGEX, ''))
} catch (error) {
throw new CommandLineError({ name: 'ParseError', cause: error })
}
Expand Down

0 comments on commit 7b39c1a

Please sign in to comment.