4 ms·
It's great that the author built this as an api-first service for maximum compatability, but what would really help adoption and make it a lot easier to use is
by DanHulton 4y ago
It's great that the author built this as an api-first service for maximum compatability, but what would really help adoption and make it a lot easier to use is per-language libraries. Why write all the request sending and parsing yourself, when you could instead simply write:
try {
const isOdd = require('isOdd')({ apiKey: 'xxx', ...options });
}
catch (e) {
if (typeof e === 'IsOddAuthenticationException') {
console.log('Could not connect to issOdd service. Is your API key correct?');
}
else {
console.log(e);
}
}
try {
const is43Odd = await isOdd(43);
}
catch (e) {
console.log(e);
}
console.log(is43Odd ? '43 is odd!' : 'Sorry, 43 is not odd.
- graderjs 4y agoPedantic quibble: the is43Odd variable is out of scope for the final log statement. Let's push it into the PR queue and circle back to this after we clear our outstanding merges.
- KRAKRISMOTT 4y ago> Pedantic quibble: the is43Odd variable is out of scope for the final log statement. Let's push it into the PR queue and circle back to this after we clear our outstanding merges. The const should have been a var. Get off my lawn!
- DanHulton 4y agoI love you preface an actual legitimate bug with "pedantic quibble." What do you do when you see an actual pedantic quibble like about whitespace? Tip? =)
- graderjs 4y agoHaha. Oh, you know...it's part of the satire. Something like: pointing out an actual bug in pseudo code in a joke is type of pedantic quibble HN comment threads are known throughout all the lands to espouse. Hmm, if I saw an actual outside-joke pedantic quibble? I'd probably lose my mind and go on an hours long rant about the declining state of HN comment threads. Hahah. Or maybe...Shrug sigh and move on? Or maybe...I probably wouldn't even see it...it's such a part of the background noise here. Or maybe...I'd laugh and try to engage humorously with the poor soul. Wait...was this a pedantic quibble, was that what you just did? o.O hahah
- KRAKRISMOTT 4y agoUse ES6 style imports for better compatibility with other bundlers