{ "version": 3, "sources": ["../../../Vettvangur.Frontend/src/scripts/utility/dictionary.ts"], "sourcesContent": ["/** Dictionary interface */\nexport interface IDictionary {\n /** Key from the dictionary\n */\n key: string\n /** Value for that dictionary key\n */\n value: string\n}\n\n/** Here we are extending the Window interface to include the Umbraco dictionary thats rendered as a script tag. */\nexport interface IWindowExtensionDictionary extends Window {\n /** The dictionary object that the Window interface is being extended with */\n dictionary: IDictionary[]\n}\n// Here we are extending the Window interface with the dictionary interface.\ndeclare let window: IWindowExtensionDictionary\n\n/**\n * @description Dictionary function that returns the value of the dictionary key\n * @param {string} key\n * @description Returns the value of the key from the Umbraco dictionary (that is rendered as a script tag in the markup).\n * @example dictionary('Key')\n */\nexport function dictionary(key: string): string {\n const getDictionary = window.dictionary\n let returnedValue\n\n if (getDictionary) {\n for (const [dictKey, value] of Object.entries(getDictionary)) {\n if (dictKey === key) {\n returnedValue = value\n }\n }\n\n return returnedValue\n }\n\n return '[Dictionary key not found]'\n}\n"], "mappings": "AAwBO,SAASA,EAAWC,EAAqB,CAC9C,IAAMC,EAAgB,OAAO,WACzBC,EAEJ,GAAID,EAAe,CACjB,OAAW,CAACE,EAASC,CAAK,IAAK,OAAO,QAAQH,CAAa,EACrDE,IAAYH,IACdE,EAAgBE,GAIpB,OAAOF,EAGT,MAAO,4BACT", "names": ["dictionary", "key", "getDictionary", "returnedValue", "dictKey", "value"] }