UNPKG

@giancosta86/hermes

Version:
21 lines 696 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Dictionary = void 0; const hashed_1 = require("@rimbu/hashed"); class Dictionary { static fromRawTranslations(translations) { const translationsMap = hashed_1.HashMap.from(Object.entries(translations)); return new Dictionary(translationsMap); } constructor(translations) { this.translations = translations; } translate(phrase) { return this.translations?.get(phrase) ?? phrase; } toRawTranslations() { return Object.fromEntries(this.translations?.stream() ?? []); } } exports.Dictionary = Dictionary; //# sourceMappingURL=Dictionary.js.map