UNPKG

500 BJavaScriptView Raw
1import fs from 'fs'
2
3const COMMENT = '// This file is a workaround for a bug in web browsers\' "native"' + '\n' +
4 '// ES6 importing system which is uncapable of importing "*.json" files.' + '\n' +
5 '// https://github.com/catamphetamine/libphonenumber-js/issues/239'
6
7const path = process.argv[2]
8jsonToJs(path)
9
10function jsonToJs(path) {
11 let contents = fs.readFileSync(path, 'utf-8')
12 contents = COMMENT + '\n' + 'export default ' + contents
13 fs.writeFileSync(path + '.js', contents)
14}
\No newline at end of file