2 ms·
Whenever I deal with an external API, even if it gives me what looks like an integer for any object it has, I treat it as a string. I never do math on it, I don
by IgorPartola 9y ago
Whenever I deal with an external API, even if it gives me what looks like an integer for any object it has, I treat it as a string. I never do math on it, I don’t care about saving space, and I never know when they’ll run out of space and need to switch. Remember when Twitter famously stopped working because their IDs were BigInt but in JavaScript you only have 53 bits of space? Yeah, I don’t want that.
Also a stupid number of APIs I deal with like to use one or more leading zeros in their identifiers. The meaning isn’t different, but it gets annoying when trying to do search, because of course the end user typed those in and wants to be able to look up whatever as 021.