Skip to content

Commit

Permalink
Merge pull request markedjs#682 from Feder1co5oave/fix_typeerror
Browse files Browse the repository at this point in the history
Throw error on non-string input
  • Loading branch information
joshbruce authored Jan 20, 2018
2 parents 930f551 + 1ec0bf3 commit f46a028
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,14 @@ function merge(obj) {
*/

function marked(src, opt, callback) {
// throw error in case of non string input
if (typeof src == 'undefined' || src === null)
throw new Error('marked(): input parameter is undefined or null');
if (typeof src != 'string')
throw new Error('marked(): input parameter is of type ' +
Object.prototype.toString.call(src) + ', string expected');


if (callback || typeof opt === 'function') {
if (!callback) {
callback = opt;
Expand Down

0 comments on commit f46a028

Please sign in to comment.