From 16d0641f46fdd01e84c74b6a5441fde5dfe9bf54 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Sun, 19 Jan 2014 11:48:37 -0500 Subject: [PATCH] prop_parse no longer scans the string twice The performance impact is negligable in either case. --- lib/prop_parser.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/prop_parser.js b/lib/prop_parser.js index 6ff68a7..41f4e7e 100644 --- a/lib/prop_parser.js +++ b/lib/prop_parser.js @@ -51,13 +51,11 @@ exports.parseKeywords = function ( prop ) prop = ''+( prop ); - // only perform parsing if the string contains a space - if ( / /.test( prop ) ) + // the keywords are all words, except for the last, which is the + // property name + if ( ( keywords = prop.split( /\s+/ ) ).length !== 1 ) { - // the keywords are all words, except for the last, which is the - // property name - keywords = prop.split( /\s+/ ); - name = keywords.pop(); + name = keywords.pop(); var i = keywords.length, keyword = '';