src/input.js
/*
 * Map a key name to the corresponding key code.
 * name: Key name
 */
Map a key name to the corresponding key code.
name: Key name
Map a key name to the corresponding key code . name : Key name
function keyCode(name) {
	if (name.length == 1) {
		var code = name.charCodeAt(0);
		if (code >= 97 && code <= 122) {
			return code + 65 - 97;
		}
		if (code >= 48 && code <= 57) {
			return code;
		}
	}
	return KEY_CODES[name] || null;
}
function keyCode ( name ) { if ( name . length == 1 ) { var code = name . charCodeAt ( 0 ) ; if ( code >= 97 && code <= 122 ) { return code + 65 - 97 ; } if ( code >= 48 && code <= 57 ) { return code ; } } return KEY_CODES [ name ] || null ; }
Map a key name to the corresponding key code.
Map a key name to the corresponding key code .