-
Notifications
You must be signed in to change notification settings - Fork 573
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
id versus id_str #126
Comments
I feel like the library might just as well remove the |
+1 - We've been bit by this. Annoying as the data is not guaranteed to be found. |
+1 as well, there's no upside to keeping it around On Fri, Nov 7, 2014 at 10:10 AM, Paul Jensen notifications@github.com
C. Corey Capel corey@capelio.com |
I think casting to string for this case is very unreliable, besides |
close this. |
@helmus Though I agree |
I agree that an explanation is probably a better idea. Here is an idea to make the explanation more explicit: This will automatically educate novices and prevent them from running into issues and it still allows access to the numeric variant in case JavaScript ever get's 64bit support. |
When I rely on a library to communicate with an API, I expect the results I get to be pristine. The fact that |
Accessing |
Are you suggesting that twit should include a bigint library to allow tweet id arithmetic's by default ? Or how exactly do you see a bigint lib solving the "don't use tweet.id" problem ? |
Well I do not know if this is a doable solution, neither if the need actually exists. I'm just pointing the fact that JS libraries exist to handle such cases. But after all, Have you benchmarked the cost of defining a custom getter for so many objects? |
No I haven't, that might actually be a valid reason to not do it. Perhaps it is just better to document it properly. |
I put up some tests, and IMHO the performance cost is not worth it. Let's update the documentation 👍 |
Let me know what you guys think: https://github.com/ttezel/twit/wiki/FAQ |
|
Those two links of yours are great, feel free to update the FAQ :) This could totally fit in the readme by now, but I thought we could add more items to this FAQ in the future? |
Hi there, I'm using tweet.id_str property after doing:
I'm now getting the wrong status Id, I think it was working a few weeks ago. Both tweet.id and tweet.id_str are the same if i output it to console. Thanks, |
// [...]
var status_id = Number(tweets[i].id_str);
// [...] You are casting a String of an 64-Bit Integer to a Floating-Point Number that can only hold a 53-Bit. // [...]
var status_id = tweets[i].id_str;
// [...] Do not use Every number in Javascript is a Double-Prescision Floating-Point number, this is not accurate for large numbers by default. Why that is read: |
Thanks! I didn't realize that there was an issue when casting. It seems like there should be a warning somewhere that indicates overflow is happening. |
Thanks for discussing this everyone! Love the conversation and @aymericbeaumet thanks so much for putting together the FAQ. I updated the twit readme to link to the FAQ page. Closing this issue. |
just gonna put it out there that this just burned me for a month without realizing it and i have a db full of the wrong ids now... |
twit.post('favorites/create', { id: tweet.id_str }, function(err, data, response) {...}
works just fine.
twit.post('favorites/create', { id: tweet.id }, function(err, data, response) {...}
[message=Sorry, that page does not exist, code=34]
This error could be documented and/or casting numerical ids to string.
The text was updated successfully, but these errors were encountered: