/** * PROJECT DEFINITIONS ========================================================= * ============================================================================= */ /** * Define Getters and Setters for Definition Object to avoid duplicate definitions by mistake * * @example: * const FIELD = definitionSetup('TYPE', 'ID') * FIELD.TYPE = { * EXPAND: 'Expand', * COLLAPSE: 'Expand', // throws error because of duplicate value 'Expand' * } * .... * FIELD.TYPE = { * EXPAND: 'Expand' // throws error the second time because of duplicate key 'EXPAND' * } * * @param {String} props - list of definition keys * @returns {Object} DEFINITION - new object with getters and setters defined for given `props` */ export function definitionSetup(...props: string): Object; /** * Map Object Definition by its Underscore Value * * @example: * definitionByValue(LANGUAGE) * >>> { * 'en': { * _: 'en', * 'en': 'English' * ... * }, * ... * } * * @param {Object|Object[]} DEFINITION - key/value pairs of variable name with its underscore value * @return {Object} definition - grouped by its underscore value */ export function definitionByValue(DEFINITION: Object | Object[]): Object; /** * Generate Enumerable List of Values from given Object Definition * * @example: * enumFrom(LANGUAGE) * >>> ['en', 'fr'...] * * @param {Object|Object[]} DEFINITION - key/value pairs of variable name with its underscore value * @returns {Array} enums - list of enumerable values */ export function enumFrom(DEFINITION: Object | Object[]): Array; export function optionsFrom(DEFINITION: any): { readonly items: any; }; /** * Create Initial Values for given Object Definition * * @example: * initValuesFor(LANGUAGE, LANGUAGE_LEVEL.BASIC._) * >>> {'en': 1, 'fr': 1, ...} * * @param {Object} DEFINITION - key/value pairs of variable name with its underscore value * @param {Number} initValue - the initial value to use for each option * @return {Object} initial values - to use with redux form, for example */ export function initValuesFor(DEFINITION: Object, initValue?: number): Object;