/**
* Find the words that make up an acronym
* @module
* @since 0.0.50
*/
/**
* find the acronym in the array
* @return String of text associated with acronym
*/
/**
* Pass the acronym to lookup
* @param {string} acronym
* @returns {string} Words of the acronym
*/
const getText = (acronym) => {
const target_acronym = acronym.toUpperCase();
const arr_keys = [
{
acronym: 'BCH',
text: 'Business Contract Hire',
},
{
acronym: 'FLB',
text: 'Finance Lease with Balloon',
},
{
acronym: 'FL',
text: 'Finance Lease',
},
{
acronym: 'PCH',
text: 'Personal Contract Hire',
},
{
acronym: 'PCP',
text: 'Personal Contract Purchase',
},
{
acronym: 'HP',
text: 'Hire Purchase',
},
];
const cnt_keys = arr_keys.length;
let found_text = 'No acronym found';
// find the matching key and break out
for (let i = 0; i < cnt_keys; i += 1) {
// if the passed in acronym matches the acronym in the array
if (arr_keys[i].acronym === target_acronym) {
// show its text
found_text = arr_keys[i].text;
// don't carry on, we're done
break;
}
}
return found_text;
};
export {
getText,
};