Closed yields closed 11 years ago
Cool, definitely need to add more tests.
This removes all characters from the publicly exposed exports.codes object :(
That's not a problem, since we can do exports.codes[num] || String.fromCharCode(num);
, and i just found out we can do the same with the numbers loop.
'1'.charCodeAt(0); // 49
String.fromCharCode(49); // 1
'A'.charCodeAt(0); // 65
String.fromCharCode(65); // A
let me see what i can do, hopefully i will make it work as expected without an loops.
btw i just remembered that we already have keycode > keyname
utility using component/keyname.
so it might be a good idea to deprecate keycode > keyname
conversation and stay with keyname > keycode
.
@yields possibly, though component/keyname only supports named keys, e.g. keyname(65) !== 'a'
. Perhaps should just add them to it.
Also modified your commit a bit, left the loop in but falls back to charCodeAt if it can't find an existing named key, for non-standard keyboards
Sounds good, loops are crap
the tests are passing. also i converted tabs to spaces.