Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined is not a function #614

Closed
benjamingr opened this issue Jul 2, 2015 · 5 comments · Fixed by #682
Closed

Undefined is not a function #614

benjamingr opened this issue Jul 2, 2015 · 5 comments · Fixed by #682

Comments

@benjamingr
Copy link

Being a good citizen.

TypeError: undefined is not a function
Please report this to https://github.com/chjj/marked.
    at Lexer.lex (/Users/Benjamin/Desktop/testFiddle/node_modules/marked/lib/marked.js:137:6)
    at Function.Lexer.lex (/Users/Benjamin/Desktop/testFiddle/node_modules/marked/lib/marked.js:128:16)
    at marked (/Users/Benjamin/Desktop/testFiddle/node_modules/marked/lib/marked.js:1207:31)
    at /Users/Benjamin/Desktop/testFiddle/index.js:17:9
    at Layer.handle [as handle_request] (/Users/Benjamin/Desktop/testFiddle/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/Benjamin/Desktop/testFiddle/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/Users/Benjamin/Desktop/testFiddle/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/Benjamin/Desktop/testFiddle/node_modules/express/lib/router/layer.js:95:5)
    at /Users/Benjamin/Desktop/testFiddle/node_modules/express/lib/router/index.js:277:22
    at param (/Users/Benjamin/Desktop/testFiddle/node_modules/express/lib/router/index.js:349:14)
@benjamingr
Copy link
Author

Oh lol, silly me - forgot to add what triggered it.

This was caused because I passed a buffer instead of a String to marked. Passing a string fixed it.

This can be fixed by either supporting buffers (by parsing or just toStringing them), or throwing a better error before passing it into Lexer.lex. If you'd like I can make a PR.

@codeshrew
Copy link

👍

This same thing confused me too. Thanks for the fix/usage-note @benjamingr

@AndrewRayCode
Copy link

👍 just bit me - needs obvious error for when a non-string is passed in

@SN4T14
Copy link

SN4T14 commented Dec 13, 2015

👍 Just had this issue as well, very annoying.

@Feder1co5oave
Copy link
Contributor

Solved. @joshbruce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants