Maybe it is something that should be fixed in widgets.js



I found an extra comma in the following twitter api code:


The unnecessary extra comma is the first comma in the array literal.
I temporarily rename f into vendor_array. I only found the usage of vendor_array as follows.

if (id) {
   if (~$.indexOf(vendor_array, id)) {
       this.shareWithRetweet = id.replace("-", "_");

The inner then branch will be executed only and if only id is found in vendor_array.
(when id is not in vendor_array, indexOf returns value -1, ~-1 leads to 0).
But even if the id is found at index 0, ~0 leads to -1 which still leads to the execution of the inner then branch.
Therefore, there is no reason to add an extra comma at the beginning of the vendor_array definition.

Another problem is that the extra comma causes raising exception if id is undefined for the inner conditional statements (when id is undefined, the then branch will be executed, replace function is called based on id which is undefined):

if (~$.indexOf(vendor_array, id)) {
    this.shareWithRetweet = id.replace("-", "_");

So, that is why you add the if(id) check. Removing the extra comma makes the check unnecessary and thus you can remove the check to improve the program’s performance.


@benward would be the right person to look into this. Thanks for passing it along.


Nice catch. We’ll get this tidied up. Thanks for bring this to our attention.