From bdccf7b8d352ba400317266a0a37e6e290633e3c Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Sat, 5 Sep 2020 23:45:25 -0400 Subject: [PATCH] Synced unorm in shims to most recent version. --- packages/shims/dist/index.js | 40 ++++++++++++++++++++------------ packages/shims/dist/index.min.js | 2 +- packages/shims/package.json | 2 +- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/packages/shims/dist/index.js b/packages/shims/dist/index.js index 5048c035d2..3e037f5eec 100644 --- a/packages/shims/dist/index.js +++ b/packages/shims/dist/index.js @@ -649,22 +649,32 @@ UChar.udata={ unorm.shimApplied = false; if (!String.prototype.normalize) { - String.prototype.normalize = function(form) { - var str = "" + this; - form = form === undefined ? "NFC" : form; - - if (form === "NFC") { - return unorm.nfc(str); - } else if (form === "NFD") { - return unorm.nfd(str); - } else if (form === "NFKC") { - return unorm.nfkc(str); - } else if (form === "NFKD") { - return unorm.nfkd(str); - } else { - throw new RangeError("Invalid normalization form: " + form); + Object.defineProperty(String.prototype, "normalize", { + enumerable: false, + configurable: true, + writable: true, + value: function normalize (/*form*/) { + + var str = "" + this; + var form = arguments[0] === undefined ? "NFC" : arguments[0]; + + if (this === null || this === undefined) { + throw new TypeError("Cannot call method on " + Object.prototype.toString.call(this)); + } + + if (form === "NFC") { + return unorm.nfc(str); + } else if (form === "NFD") { + return unorm.nfd(str); + } else if (form === "NFKC") { + return unorm.nfkc(str); + } else if (form === "NFKD") { + return unorm.nfkd(str); + } else { + throw new RangeError("Invalid normalization form: " + form); + } } - }; + }); unorm.shimApplied = true; } diff --git a/packages/shims/dist/index.min.js b/packages/shims/dist/index.min.js index 9a4083bd55..aa26d7f43d 100644 --- a/packages/shims/dist/index.min.js +++ b/packages/shims/dist/index.min.js @@ -1 +1 @@ -!function(){return function t(r,e,n){function o(a,s){if(!e[a]){if(!r[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var h=e[a]={exports:{}};r[a][0].call(h.exports,function(t){return o(r[a][1][t]||t)},h,h.exports,t,r,e,n)}return e[a].exports}for(var i="function"==typeof require&&require,a=0;a255||(o=t.charCodeAt(s++))>255||(i=t.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");a+=n.charAt((r=e<<16|o<<8|i)>>18&63)+n.charAt(r>>12&63)+n.charAt(r>>6&63)+n.charAt(63&r)}return u?a.slice(0,u-3)+"===".substring(u):a},t.atob=function(t){if(t=String(t).replace(/[\t\n\f\r ]+/g,""),!o.test(t))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");t+="==".slice(2-(3&t.length));for(var r,e,i,a="",s=0;s>16&255):64===i?String.fromCharCode(r>>16&255,r>>8&255):String.fromCharCode(r>>16&255,r>>8&255,255&r);return a}}},"function"==typeof define&&define.amd?define([],function(){o(n)}):o(n)},{}],2:[function(t,r,e){(function(r){"use strict";!function(){var e=[];try{for(var n=[],o=["NFD","NFC","NFKD","NFKC"],i=0;i{var t=atob(r.result.split(",").pop().trim()),e=new ArrayBuffer(t.length);new Uint8Array(e).set(Array.from(t).map(t=>t.charCodeAt(0))),this._result=e,this._setReadyState(this.DONE)}),r.readAsDataURL(t)}}catch(t){console.log("Missing FileReader; unsupported platform")}if(e.length){console.log("Shims Injected:");for(i=0;i>8&255]>n&&(d[r]=o),o},function(t,r,e){return e?t(r,e):new p(r,null)},function(t,r,e){var n;if(r=55296&&t<=56319},p.isLowSurrogate=function(t){return t>=56320&&t<=57343},p.prototype.prepFeature=function(){this.feature||(this.feature=p.fromCharCode(this.codepoint,!0).feature)},p.prototype.toString=function(){if(this.codepoint<65536)return String.fromCharCode(this.codepoint);var t=this.codepoint-65536;return String.fromCharCode(Math.floor(t/1024)+55296,t%1024+56320)},p.prototype.getDecomp=function(){return this.prepFeature(),this.feature[0]||null},p.prototype.isCompatibility=function(){return this.prepFeature(),!!this.feature[1]&&256&this.feature[1]},p.prototype.isExclude=function(){return this.prepFeature(),!!this.feature[1]&&512&this.feature[1]},p.prototype.getCanonicalClass=function(){return this.prepFeature(),this.feature[1]?255&this.feature[1]:0},p.prototype.getComposite=function(t){if(this.prepFeature(),!this.feature[2])return null;var r=this.feature[2][t.codepoint];return r?p.fromCharCode(r):null};var y=function(t){this.str=t,this.cursor=0};y.prototype.next=function(){if(this.str&&this.cursor0;--e){if(this.resBuf[e-1].getCanonicalClass()<=t)break}this.resBuf.splice(e,0,r)}while(0!==t);return this.resBuf.shift()};var b=function(t){this.it=t,this.procBuf=[],this.resBuf=[],this.lastClass=null};b.prototype.next=function(){for(;0===this.resBuf.length;){var t=this.it.next();if(!t){this.resBuf=this.procBuf,this.procBuf=[];break}if(0===this.procBuf.length)this.lastClass=t.getCanonicalClass(),this.procBuf.push(t);else{var r=this.procBuf[0].getComposite(t),e=t.getCanonicalClass();r&&(this.lastClass255||(o=t.charCodeAt(s++))>255||(i=t.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");a+=n.charAt((r=e<<16|o<<8|i)>>18&63)+n.charAt(r>>12&63)+n.charAt(r>>6&63)+n.charAt(63&r)}return u?a.slice(0,u-3)+"===".substring(u):a},t.atob=function(t){if(t=String(t).replace(/[\t\n\f\r ]+/g,""),!o.test(t))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");t+="==".slice(2-(3&t.length));for(var r,e,i,a="",s=0;s>16&255):64===i?String.fromCharCode(r>>16&255,r>>8&255):String.fromCharCode(r>>16&255,r>>8&255,255&r);return a}}},"function"==typeof define&&define.amd?define([],function(){o(n)}):o(n)},{}],2:[function(t,r,e){(function(r){"use strict";!function(){var e=[];try{for(var n=[],o=["NFD","NFC","NFKD","NFKC"],i=0;i{var t=atob(r.result.split(",").pop().trim()),e=new ArrayBuffer(t.length);new Uint8Array(e).set(Array.from(t).map(t=>t.charCodeAt(0))),this._result=e,this._setReadyState(this.DONE)}),r.readAsDataURL(t)}}catch(t){console.log("Missing FileReader; unsupported platform")}if(e.length){console.log("Shims Injected:");for(i=0;i>8&255]>n&&(d[r]=o),o},function(t,r,e){return e?t(r,e):new p(r,null)},function(t,r,e){var n;if(r=55296&&t<=56319},p.isLowSurrogate=function(t){return t>=56320&&t<=57343},p.prototype.prepFeature=function(){this.feature||(this.feature=p.fromCharCode(this.codepoint,!0).feature)},p.prototype.toString=function(){if(this.codepoint<65536)return String.fromCharCode(this.codepoint);var t=this.codepoint-65536;return String.fromCharCode(Math.floor(t/1024)+55296,t%1024+56320)},p.prototype.getDecomp=function(){return this.prepFeature(),this.feature[0]||null},p.prototype.isCompatibility=function(){return this.prepFeature(),!!this.feature[1]&&256&this.feature[1]},p.prototype.isExclude=function(){return this.prepFeature(),!!this.feature[1]&&512&this.feature[1]},p.prototype.getCanonicalClass=function(){return this.prepFeature(),this.feature[1]?255&this.feature[1]:0},p.prototype.getComposite=function(t){if(this.prepFeature(),!this.feature[2])return null;var r=this.feature[2][t.codepoint];return r?p.fromCharCode(r):null};var y=function(t){this.str=t,this.cursor=0};y.prototype.next=function(){if(this.str&&this.cursor0;--e){if(this.resBuf[e-1].getCanonicalClass()<=t)break}this.resBuf.splice(e,0,r)}while(0!==t);return this.resBuf.shift()};var b=function(t){this.it=t,this.procBuf=[],this.resBuf=[],this.lastClass=null};b.prototype.next=function(){for(;0===this.resBuf.length;){var t=this.it.next();if(!t){this.resBuf=this.procBuf,this.procBuf=[];break}if(0===this.procBuf.length)this.lastClass=t.getCanonicalClass(),this.procBuf.push(t);else{var r=this.procBuf[0].getComposite(t),e=t.getCanonicalClass();r&&(this.lastClass