tex2svg fails if input is a number or starts with "-"
Wallacoloo opened this issue · 0 comments
Wallacoloo commented
For example:
$ tex2svg '2'
/usr/lib/node_modules/tex-equation-to-svg/lib/factory.js:51
throw new TypeError( 'invalid input argument. Must provide a string primitive. Value: `' + str + '`.' );
TypeError: invalid input argument. Must provide a string primitive. Value: `undefined`.
at tex2svg (/usr/lib/node_modules/tex-equation-to-svg/lib/factory.js:51:10)
at tex2svg (/usr/lib/node_modules/tex-equation-to-svg/lib/tex2svg.js:28:26)
at Object.<anonymous> (/usr/lib/node_modules/tex-equation-to-svg/bin/cli:85:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
On the other hand,
$ tex2svg ' 2'
(notice the extra space before the minus sign) and
$ tex2svg '2 < a'
both produce valid outputs.
Note that tex2svg '-2 < a'
still breaks. "-" seems to be deadly when occurring as the first character.