create function with object for key-value mapping

 /**

        * Function used to get the internal Id of the currency

        * @param {string} currency – Zoho Opportunity stage

        * @returns {number} currencyID – Internal ID of the currency

         */

        function getCurrency(currency) {

            try {

                const currencyMapping = {

                    ‘USD’: 2,

                    ‘EUR’: 4,

                    ‘AED’: 7,

                    ‘AUD’: 8

                };

                return currencyMapping[currency] || null;

            } catch (error) {

                log.error({ title: “Error in getCurrency”, details: error });

            }

        }

Leave a comment

Your email address will not be published. Required fields are marked *