From 670d58c505dabae39b160df72e3c81c321a77f4f Mon Sep 17 00:00:00 2001 From: Rafael Caricio Date: Sat, 6 Sep 2014 18:20:11 +0200 Subject: [PATCH] Refactor --- gradient-parser.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gradient-parser.js b/gradient-parser.js index 26c0c3b..7d38798 100644 --- a/gradient-parser.js +++ b/gradient-parser.js @@ -71,26 +71,24 @@ module.exports = (function() { function matchGradient(gradientType, pattern, orientationMatcher) { return matchCall(pattern, function(captures) { - orientation = orientationMatcher(); + + var orientation = orientationMatcher(); if (orientation) { if (!scan(tokens.comma)) { error('Missing comma before color stops'); } } - colorStops = matchListing(matchColorStop); return { type: gradientType, orientation: orientation, - colorStops: colorStops + colorStops: matchListing(matchColorStop) }; }); } function matchCall(pattern, callback) { - var captures = scan(pattern), - orientation, - colorStops; + var captures = scan(pattern); if (captures) { if (!scan(tokens.startCall)) {