When calling marked(undefined), you get the error TypeError: Cannot read property 'replace' of undefined Please report this to https://github.com/chjj/marked..
This error message is not helpful. Either return an empty string, or raise some kind of ArgumentException. This will help de caller identify the problem quicker.
+1
Easies way is to not pass undefined to marked, e.g.: marked(myString || '') -- solved.
Most helpful comment
Easies way is to not pass
undefinedtomarked, e.g.:marked(myString || '')-- solved.