From 2d149e2266d059191e0a8a38a767446a1c174027 Mon Sep 17 00:00:00 2001 From: Rafael Caricio Date: Sun, 7 Sep 2014 15:50:31 +0200 Subject: [PATCH] Refactor --- lib/parser.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/parser.js b/lib/parser.js index 32e37e7..599a66b 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -29,6 +29,8 @@ module.exports = (function() { radialGradient: /^radial\-gradient/i, repeatingRadialGradient: /^repeating\-radial\-gradient/i, sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i, + extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/, + positionKeywords: /^(left|center|right|top|bottom)/i, pixelValue: /^([0-9]+)px/, percentageValue: /^([0-9]+)\%/, emValue: /^([0-9]+)em/, @@ -199,7 +201,7 @@ module.exports = (function() { } function matchExtentKeyword() { - return match('extent-keyword', /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/, 1); + return match('extent-keyword', tokens.extentKeywords, 1); } function matchAtPosition() { @@ -306,7 +308,7 @@ module.exports = (function() { } function matchPositionKeyword() { - return match('positionKeyword', /^(left|center|right|top|bottom)/i, 1); + return match('positionKeyword', tokens.positionKeywords, 1); } function matchLength() {