Key includes value.
npm install @jswork/kiv
import kiv from '@jswork/kiv';
const str2icon = {
'@beta': '🍏',
'@production': '🍎',
'@upload': '🚚',
'@cache': '📦',
};
kiv('Current msg is __@beta__.', str2icon); // Current msg is 🍏.
kiv('Current msg is __@production__.', str2icon); // Current msg is 🍎.
kiv('Current msg is __@upload__.', str2icon); // Current msg is 🚚.
kiv('Current msg is __@cache__.', str2icon); // Current msg is 📦.
kiv('Current msg is __@unknown__.', str2icon); // Current msg is ''.
kiv('Current msg is __@unknown__.', str2icon, '🍌'); // Current msg is 🍌.
Code released under the MIT license.