leodido / i18n.phonenumbers.js

Parse, format, and validate international phone numbers through libphonenumber
18 stars 14 forks source link

Fix type error in compiled library #7

Closed leodido closed 9 years ago

leodido commented 9 years ago

Error message: cannot use 'in' operator to search for 'leodido' in undefined.

Bug is caused by the fact that in ES5 strict the expression goog.global = this does not work inside a typical IIFE (e.g., (function(){%output%})();').

Since the goog.global variable is used to export symbols by google closure library functions everything breaks.

leodido commented 9 years ago

In ES5 strict we need to set the this to window this way:

(function(){...}).call(window);