Commit 77b229bb authored by Aral Balkan's avatar Aral Balkan
Browse files

Fixes #10: fix table load crash when data includes multiline string

parent 635e23e3
......@@ -158,9 +158,11 @@ export default class JSTable extends EventEmitter {
// Create a local constant to hold the root data structure based on the
// one exported in the first line of the table and populate it with
// the initial/compacted data provided for it on that line.
const indexOfFirstNewline = table.indexOf('\n')
const matchLastNewline = /\n$/
const indexOfFirstNewline = matchLastNewline.exec(table).index
const initialData = table.substr(0, indexOfFirstNewline).replace('export const ', '')
let _
log(initialData)
eval(initialData)
// Remove the first line.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment