@tginternal/language-util
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,4 +0,3 @@ | ||
export declare const getCountryFlagEmoji: (country: string) => string | undefined; | ||
export declare const symbolToHex: (str: string) => string; | ||
export declare const getSvgNameByEmoji: (emoji: string) => string; | ||
//# sourceMappingURL=flags.d.ts.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSvgNameByEmoji = exports.symbolToHex = exports.getCountryFlagEmoji = void 0; | ||
var country_flag_emoji_1 = __importDefault(require("country-flag-emoji")); | ||
exports.getSvgNameByEmoji = exports.symbolToHex = void 0; | ||
var supportedFlags_1 = require("./generated/supportedFlags"); | ||
var getCountryFlagEmoji = function (country) { | ||
var _a; | ||
return (_a = country_flag_emoji_1.default.get(country)) === null || _a === void 0 ? void 0 : _a.emoji; | ||
}; | ||
exports.getCountryFlagEmoji = getCountryFlagEmoji; | ||
var symbolToHex = function (str) { | ||
@@ -15,0 +6,0 @@ var _a; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var flags_1 = require("./flags"); | ||
var availableLocales = __importStar(require("cldr-core/availableLocales.json")); | ||
var languages_1 = require("./languages"); | ||
describe('flags', function () { | ||
test('returns correct flag for CZ', function () { | ||
var flag = flags_1.getCountryFlagEmoji('CZ'); | ||
expect(flag).toEqual('🇨🇿'); | ||
}); | ||
test('returns flags for available locales', function () { | ||
var result = availableLocales.availableLocales.modern.reduce(function (acc, curr) { | ||
var _a; | ||
return (__assign(__assign({}, acc), (_a = {}, _a[curr] = languages_1.getLanguageRegions(curr).map(function (r) { | ||
return flags_1.getCountryFlagEmoji(r); | ||
}), _a))); | ||
}, {}); | ||
expect(result['en'][0]).toEqual('🇬🇧'); | ||
expect(result['en'][1]).toEqual('🇺🇸'); | ||
}); | ||
test('returns correct symbol to hex', function () { | ||
@@ -52,0 +6,0 @@ expect(flags_1.symbolToHex('🇬🇧')).toEqual('1f1ec-1f1e7'); |
{ | ||
"name": "@tginternal/language-util", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Language data utility for Tolgee localization tool", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1046582
12044