src/input.js
/*
 * Parse a list of keys and return a list of keycodes.
 */
Parse a list of keys and return a list of keycodes.
Parse a list of keys and return a list of keycodes .
function parseKeyCodes(key) {
	var result = [];
	if (typeof key == 'string') {
		key = key.split(/ +/);
	}
	if (!_.isArray(key)) {
		throw new TypeError('Invalid key name');
	}
	for (var i = 0; i < key.length; i++) {
		var name = key[i];
		var code = keyCode(name);
		if (!code) {
			console.warn('Unknown key: ' + name);
			continue;
		}
		result.push(code);
	}
	return result;
}
function parseKeyCodes ( key ) { var result = [ ] ; if ( typeof key == 'string' ) { key = key . split ( /  + / ) ; } if ( ! _ . isArray ( key ) ) { throw new TypeError ( 'Invalid key name' ) ; } for ( var i = 0 ; i < key . length ; i ++ ) { var name = key [ i ] ; var code = keyCode ( name ) ; if ( ! code ) { console . warn ( 'Unknown key: ' + name ) ; continue ; } result . push ( code ) ; } return result ; }
Parse a list of keys and return a list of keycodes.
Parse a list of keys and return a list of keycodes .