@open-tender/store
Version:
A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API
13 lines (12 loc) • 410 B
JavaScript
export var getKeyboardValue = function (key, value, maxLength, isShiftOn) {
if (key === 'Del')
return value.slice(0, -1);
else if (key === 'Clr')
return '';
else if ((maxLength && value.length >= maxLength) || key === '\u21E7')
return value;
else if (key === 'Space')
return value + ' ';
else
return value + (isShiftOn ? key.toUpperCase() : key);
};