const allowed = {
    '1': true,
    '2': true,
    '3': true,
    '4': true,
    '5': true,
    '6': true,
    '7': true,
    '8': true,
    '9': true,
    '0': true,
    'ArrowLeft': true,
    'ArrowDown': true,
    'ArrowRight': true,
    'ArrowUp': true,
    'Backspace': true,
    '.': true,
}

const isValidInput = allowed[key]
By Anonymous, 2019-07-26 16:34:12