/** * @created 11.05.2017 * @description Contains helper functions for general purposes needed in the Application. */ /** * @description Returns an array that contains unique values * of the given properties in the given array. * @param { String } prop - The key of {array} which values will be unique. * @param { [Object] } array - The array to take keys from. * @returns { [*] } A new Array containing unique values of the {arrays} {key} property */ declare function unique(prop: any, array: any): unknown[]; /** * @description Abstract function that returns an image from /assets/img * @param { String } image - The path to the image from /assets/img without fileending e.g. "/flags/eu" * @param { String } defaultFallbackImage - The path to the default fallback image from /assets/img without fileending e.g. "/flags/eu" * @returns { String } An image, represented by its absolute path. */ declare function getImg(image?: string, defaultFallbackImage?: string): any; /** * @description Returns an image of a flag. * @param { String } countryId - The ID (example: 'en', 'de', 'fr') of a country to get the flag from. * @returns { String } An image, represented by its absolute path. */ declare function getCountryFlagImg(countryId: any): any; declare function getRepresentativeLocaleOf(prop: any, userLocale: any, fallbacks: any): any; /** * @description Checks if a translation for the given prop parameter is available and returns it in the following priority order: * 1. User set locale * 2. Given fallback languages * 3. Any available language * @param { Object } prop - The object that should contain the translations * @param { String } userLocale - The currently set locale. * @param { [String] } fallbacks - The fallback languages to check for, when given locale is not available in given prop * @returns { String } A translated text. */ declare function getTranslationFor(prop: any, userLocale: any, fallbacks: any): any; /** * @description Returns the translation for a facet item * @param { String } fieldId * @param { String } facetId * @param { String } userLocale * @param { String } fallback * @returns { String } The translated facet item, if available */ declare function getFacetTranslation(fieldId: any, facetId: any, userLocale: any, fallback: any): any; /** * Truncates a String to a maximum character count of maxChars * @param text * @param maxChars * @param noAppend */ declare function truncate(text: any, maxChars: any, noAppend: any): any; /** * normalizing the dataset id * @param str string to be normalized */ declare function normalize(str: any): any; /** * remove mailto or tel * @param str string */ declare function removeMailtoOrTel(str: any): any; declare function replaceHttp(str: any): any; /** * Returns a function that takes an object and returns a modified object * where for each dstProp in dstProps holds: object.dstProp === object.srcProp * * This function aims to help maintain stability against DCAT-AP schema changes * by providing alternative keys names for access * * @example * const foo = { foo: 'hello world' }; * const mirrorFooAsBar = mirrorPropertyFn('foo', 'bar'); * const mirrored = mirrorFooAsBar(foo); * log(mirrored.foo) // -> 'hello world' * log(mirrored.bar) // -> 'hello world' * @param {String} srcProp * @param {String | Array} dstProps * @returns {Function} */ declare function mirrorPropertyFn(srcProp: any, dstProps: any): (obj: any) => any; /** * @description Function for determining of given data is of type object * @param {*} data * @returns Boolean determining, if data is object */ declare function matchesObjectStructure(data: any): boolean; /** * @description Function to search for all properties in inputconfiguration which provide a 'source'-property. * Each name provided by a 'source'-property is saved inside the propertyNamesArray and returned as an array of property-names. * @param {Array} inputConfigArray Array of inputconfiguration containing information about components to render. * @param {Array} propertyNamesArray Array of names retrieved from components with a 'source'-property. * @returns {Array} Array with all names retireved (popertyNamesArray) */ declare function findPropertiesWithSources(inputConfigArray: any, propertyNamesArray: any): any; /** * * @param {*} dataset * @param {*} properties * @param {*} translatableProperties */ declare function setTranslation(dataset: any, properties: any, translatableProperties: any, languageInformation: any): void; /** * @description Appends current locale to an url * @param {String} url url */ declare function appendCurrentLocaleToURL(url: any): any; /** * @description Add preceding zero for numbers < 100 (if not already existing) * @param {String} value value */ declare function addPrecedingZero(value: any): string; /** * @description Formatting temporalResolution property into human-readable format * @param {String} datetime datetime in temporalResolution format */ declare function formatDatetime(datetime: any): string; /** * @description Creates a navigation guard that adds a locale to the query if it is not present. */ declare function createStickyLocale(fallbackLocale?: string): (to: any, from: any, next: Function) => void; export { unique, getImg, getCountryFlagImg, getFacetTranslation, getRepresentativeLocaleOf, getTranslationFor, truncate, normalize, removeMailtoOrTel, replaceHttp, mirrorPropertyFn, matchesObjectStructure, findPropertiesWithSources, setTranslation, appendCurrentLocaleToURL, addPrecedingZero, formatDatetime, createStickyLocale, };