function stringifyDirection(dir, oldStyle) {
						var reNewStyle = /^to\s/;
						var keys = Object.keys(directions).filter(function (k) {
							var hasPrefix = reNewStyle.test(k);
							return oldStyle ? !hasPrefix : hasPrefix;
						});

						for (var i = 0; i < keys.length; i++) {
							if (directions[keys[i]] == dir) {
								return keys[i];
							}
						}

						if (oldStyle) {
							dir = (dir + 270) % 360;
						}

						return dir + 'deg';
					}
Parses gradient definition into an object.
This object can be used to transform gradient into various
forms
@param  {String} gradient Gradient definition
@return {LinearGradient}