Synced unorm in shims to most recent version.

This commit is contained in:
Richard Moore 2020-09-05 23:45:25 -04:00
parent 0234cfbbef
commit bdccf7b8d3
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
3 changed files with 26 additions and 16 deletions

@ -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;
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 (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);
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;
}

File diff suppressed because one or more lines are too long

@ -27,7 +27,7 @@
"dist": "browserify ./src/index.js -o ./dist/index.js && uglifyjs --compress --mangle --output ./dist/index.min.js -- ./dist/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xe67b67d07dc853542e750860c5e34b9f59f5c387c5b5043aa1ff639858668e8f",
"tarballHash": "0xc6ad91462bf8be9bb6077a5e22f43ff35e82a815dbd91bbd6d709c945f8e03e2",
"types": "./lib/index.d.ts",
"version": "5.0.5"
}