TypeError: chunk.charAt is not a function
Created by: jonnermut
Seems that the scxml.documentStringToModel func is somehow broken?
This code in node (latest):
var scxml = require('scxml')
var xml = `<scxml
xmlns="http://www.w3.org/2005/07/scxml"
version="1.0"
profile="ecmascript"
initial="draft">
<state id="draft">
</state>
</scxml>`
scxml.documentStringToModel(xml, function(err, model) {
if(err) {
throw err;
}
console.log(model)
})
gives the error:
bash-3.2$ node testInNode.js
/Volumes/TERA/Dropbox/code/scion-viz2/node_modules/sax/lib/sax.js:976
result = chunk.charAt(i)
^
TypeError: chunk.charAt is not a function
at charAt (/Volumes/TERA/Dropbox/code/scion-viz2/node_modules/sax/lib/sax.js:976:22)
at Object.write (/Volumes/TERA/Dropbox/code/scion-viz2/node_modules/sax/lib/sax.js:999:11)
at transform (/Volumes/TERA/Dropbox/code/scion-viz2/node_modules/scxml/lib/compiler/scxml-to-scjson.js:296:12)
at Object.documentStringToModel (/Volumes/TERA/Dropbox/code/scion-viz2/node_modules/scxml/lib/runtime/document-string-to-model.js:43:18)
at Object.<anonymous> (/Volumes/TERA/Dropbox/code/scion-viz2/testInNode.js:15:8)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
bash-3.2$
It does the same thing in the browser. Using pathToModel seems to work ok.