gregjacobs / Autolinker.js

Utility to Automatically Link URLs, Email Addresses, Phone Numbers, Twitter handles, and Hashtags in a given block of text/HTML
MIT License
1.48k stars 238 forks source link

updating above v0.22 causes error #170

Closed barbalex closed 8 years ago

barbalex commented 8 years ago

after updating to v0.23 or higher I get:

Uncaught TypeError: textOrHtml.substring is not a function

It works fine with versions up to v0.22.

I realize this issue may not be reproducible so feel free to close it.

gregjacobs commented 8 years ago

blockquote, div.yahoo_quoted { margin-left: 0 !important; border-left:1px #715FFA solid !important; padding-left:1ex !important; background-color:white !important; } Hmm, maje sure that you provide a string to autolinker.link() Something like: autolinker.link( myText || '' ); would make sure you aren't accidentally passing undefined or null. And if you by chance you are passing a number: autolinker.link( String( myNumber ) );

after updating to v0.23 or higher I get: Uncaught TypeError: textOrHtml.substring is not a function

It works fine with versions up to v0.22.

I realize this issue may not be reproducible so feel free to close it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

barbalex commented 8 years ago

thanks, this helps

I am now using:

autolinker.link(value ? '' + value : '')

which converts null/undefined to '' and numbers to strings. This runs on v0.27 without error.

gregjacobs commented 8 years ago

blockquote, div.yahoo_quoted { margin-left: 0 !important; border-left:1px #715FFA solid !important; padding-left:1ex !important; background-color:white !important; } Perfect - that works, and glad to help!

thanks, this helps

I am now using: autolinker.link(value ? '' + value : '')

which converts null/undefined to '' and numbers to strings. This runs on v0.27 without error.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or mute the thread.