lib/resolver/gradient/linear.js
function resolveDirection(dir) {
		if (typeof dir == 'number') {
			return dir;
		}

		dir = normalizeSpace(dir).toLowerCase();
		if (reDeg.test(dir)) {
			return +RegExp.$1;
		}

		var prefix = /^to\s/.test(dir) ? 'to ' : '';
		var left   = ~dir.indexOf('left')   && 'left';
		var right  = ~dir.indexOf('right')  && 'right';
		var top    = ~dir.indexOf('top')    && 'top';
		var bottom = ~dir.indexOf('bottom') && 'bottom';

		var key = normalizeSpace(prefix + (top || bottom || '') + ' ' + (left || right || ''));
		return directions[key] || 0;
	}
function resolveDirection(dir) {
		if (typeof dir == 'number') {
			return dir;
		}

		dir = normalizeSpace(dir).toLowerCase();
		if (reDeg.test(dir)) {
			return +RegExp.$1;
		}

		var prefix = /^to\s/.test(dir) ? 'to ' : '';
		var left   = ~dir.indexOf('left')   && 'left';
		var right  = ~dir.indexOf('right')  && 'right';
		var top    = ~dir.indexOf('top')    && 'top';
		var bottom = ~dir.indexOf('bottom') && 'bottom';

		var key = normalizeSpace(prefix + (top || bottom || '') + ' ' + (left || right || ''));
		return directions[key] || 0;
	}
function resolveDirection ( dir ) { if ( typeof dir == 'number' ) { return dir ; } dir = normalizeSpace ( dir ) . toLowerCase ( ) ; if ( reDeg . test ( dir ) ) { return + RegExp . $1 ; } var prefix = / ^to\s / . test ( dir ) ? 'to ' : '' ; var left = ~ dir . indexOf ( 'left' ) && 'left' ; var right = ~ dir . indexOf ( 'right' ) && 'right' ; var top = ~ dir . indexOf ( 'top' ) && 'top' ; var bottom = ~ dir . indexOf ( 'bottom' ) && 'bottom' ; var key = normalizeSpace ( prefix + ( top || bottom || '' ) + ' ' + ( left || right || '' ) ) ; return directions [ key ] || 0 ; }
Resolves textual direction to degrees
@param  {String} dir Direction to resolve
@return {Number}
Resolves textual direction to degrees