jeffbski / joi-browser

joi validation bundled for the browser (deprecated) - use joi@16+
Other
273 stars 39 forks source link

TypeError: undefined is not a constructor (evaluating 'email.normalize('NFC')') #32

Open rokoroku opened 6 years ago

rokoroku commented 6 years ago
TypeError: undefined is not a constructor (evaluating 'email.normalize('NFC')')

Caused by calling str.normalize() in the isemail module

String.prototype.normalize() is not supported in every browsers. Adding polyfill like unorm or just adding mock function returns itself fixes the issue.

rokoroku commented 6 years ago

Here's my simple workaround:

if (typeof String.prototype.normalize === 'undefined') {
  String.prototype.normalize = function () { return this; };
}