You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Until earlier today when I found myself wanting to understand how Twitter calculates the length of a potential tweet and needed to do some tests, I'd never done anything with Node.js. But I'm pretty certain that parts of https://github.com/twitter/twitter-text/blob/master/js/README.md are wrong.
I was confused by
The twttr.txt namespace is exported, making it available as such:
because the following code is
var twitter = require('twitter-text')
twitter.autoLink(twitter.htmlEscape('#hello < @world >'))
so where does twttr.txt come from? But the rest of the example code uses twttr.txt so I thought I guess it's correct and it's just my lack of understanding of how this stuff works. So I assembled the following, copy/pasted from the example code
var twitter = require('twitter-text');
var tweet = "This is a test tweet";
console.log(twttr.txt.parseTweet(tweet));
And it didn't work.
somethingTest.js:3
console.log(twttr.txt.parseTweet(tweet));
^
ReferenceError: twttr is not defined
So I changed line 3 to
console.log(twitter.parseTweet(tweet));
and that worked.
The "Tweet Parsing" section describes the fields validDisplayRangeStart and validDisplayRangeEnd neither of which appear in the example output that follows. The order of fields in the example output
Until earlier today when I found myself wanting to understand how Twitter calculates the length of a potential tweet and needed to do some tests, I'd never done anything with Node.js. But I'm pretty certain that parts of https://github.com/twitter/twitter-text/blob/master/js/README.md are wrong.
I was confused by
because the following code is
so where does
twttr.txt
come from? But the rest of the example code usestwttr.txt
so I thought I guess it's correct and it's just my lack of understanding of how this stuff works. So I assembled the following, copy/pasted from the example codeAnd it didn't work.
So I changed line 3 to
and that worked.
The "Tweet Parsing" section describes the fields
validDisplayRangeStart
andvalidDisplayRangeEnd
neither of which appear in the example output that follows. The order of fields in the example outputdoesn't match the order they appear in actual output
The text was updated successfully, but these errors were encountered: