selfcarebot/node_modules/upper-case/dist/index.js

49 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-03-30 06:02:54 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.upperCase = exports.localeUpperCase = void 0;
/**
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
*/
var SUPPORTED_LOCALE = {
tr: {
regexp: /[\u0069]/g,
map: {
i: "\u0130",
},
},
az: {
regexp: /[\u0069]/g,
map: {
i: "\u0130",
},
},
lt: {
regexp: /[\u0069\u006A\u012F]\u0307|\u0069\u0307[\u0300\u0301\u0303]/g,
map: {
i̇: "\u0049",
j̇: "\u004A",
į̇: "\u012E",
i̇̀: "\u00CC",
i̇́: "\u00CD",
i̇̃: "\u0128",
},
},
};
/**
* Localized upper case.
*/
function localeUpperCase(str, locale) {
var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
if (lang)
return upperCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
return upperCase(str);
}
exports.localeUpperCase = localeUpperCase;
/**
* Upper case as a function.
*/
function upperCase(str) {
return str.toUpperCase();
}
exports.upperCase = upperCase;
//# sourceMappingURL=index.js.map