UNPKG

react-native-web-internals

Version:

React Native for Web

96 lines (95 loc) 2.12 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: !0 }); }, __copyProps = (to, from, except, desc) => { if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod); var isLocaleRTL_exports = {}; __export(isLocaleRTL_exports, { isLocaleRTL: () => isLocaleRTL }); module.exports = __toCommonJS(isLocaleRTL_exports); var rtlScripts = /* @__PURE__ */ new Set([ "Arab", "Syrc", "Samr", "Mand", "Thaa", "Mend", "Nkoo", "Adlm", "Rohg", "Hebr" ]), rtlLangs = /* @__PURE__ */ new Set([ "ae", // Avestan "ar", // Arabic "arc", // Aramaic "bcc", // Southern Balochi "bqi", // Bakthiari "ckb", // Sorani "dv", // Dhivehi "fa", "far", // Persian "glk", // Gilaki "he", "iw", // Hebrew "khw", // Khowar "ks", // Kashmiri "ku", // Kurdish "mzn", // Mazanderani "nqo", // N'Ko "pnb", // Western Punjabi "ps", // Pashto "sd", // Sindhi "ug", // Uyghur "ur", // Urdu "yi" ]), cache = /* @__PURE__ */ new Map(); function isLocaleRTL(locale) { var cachedRTL = cache.get(locale); if (cachedRTL) return cachedRTL; var isRTL = !1; if (Intl.Locale) { var script = new Intl.Locale(locale).maximize().script; isRTL = rtlScripts.has(script); } else { var lang = locale.split("-")[0]; isRTL = rtlLangs.has(lang); } return cache.set(locale, isRTL), isRTL; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { isLocaleRTL }); //# sourceMappingURL=isLocaleRTL.js.map