switch to single quotes
authorXhmikosR <xhmikosr@users.sourceforge.net>
Tue, 26 Mar 2013 14:29:58 +0000 (16:29 +0200)
committerXhmikosR <xhmikosr@users.sourceforge.net>
Sat, 30 Mar 2013 10:02:15 +0000 (12:02 +0200)
lib/clean.js
test/binary-test.js
test/unit-test.js

index 60293b6..38e4649 100644 (file)
@@ -206,12 +206,12 @@ var CleanCSS = {
 
     // replace color name with hex values if shorter (or the other way around)
     ['toHex', 'toName'].forEach(function(type) {
-      var pattern = "(" + Object.keys(CleanCSS.colors[type]).join('|') + ")";
+      var pattern = '(' + Object.keys(CleanCSS.colors[type]).join('|') + ')';
       var colorSwitcher = function(match, prefix, colorValue, suffix) {
         return prefix + CleanCSS.colors[type][colorValue.toLowerCase()] + suffix;
       };
-      replace(new RegExp("([ :,\\(])" + pattern + "([;\\}!\\) ])", 'ig'), colorSwitcher);
-      replace(new RegExp("(,)" + pattern + "(,)", 'ig'), colorSwitcher);
+      replace(new RegExp('([ :,\\(])' + pattern + '([;\\}!\\) ])', 'ig'), colorSwitcher);
+      replace(new RegExp('(,)' + pattern + '(,)', 'ig'), colorSwitcher);
     });
 
     // replace font weight with numerical value
@@ -236,11 +236,11 @@ var CleanCSS = {
     // restore 0% in hsl/hsla
     replace(/(hsl|hsla)\(([^\)]+)\)/g, function(match, colorFunction, colorDef) {
       var tokens = colorDef.split(',');
-      if (tokens[1] == "0")
+      if (tokens[1] == '0')
         tokens[1] = '0%';
-      if (tokens[2] == "0")
+      if (tokens[2] == '0')
         tokens[2] = '0%';
-      return colorFunction + "(" + tokens.join(',') + ")";
+      return colorFunction + '(' + tokens.join(',') + ')';
     });
 
     // none to 0
@@ -255,9 +255,9 @@ var CleanCSS = {
 
     // shorthand notations
     var shorthandRegex = function(repeats, hasSuffix) {
-      var pattern = "(padding|margin|border\\-width|border\\-color|border\\-style|border\\-radius):";
+      var pattern = '(padding|margin|border\\-width|border\\-color|border\\-style|border\\-radius):';
       for (var i = 0; i < repeats; i++) {
-        pattern += "([\\d\\w\\.%#\\(\\),]+)" + (i < repeats - 1 ? ' ' : '');
+        pattern += '([\\d\\w\\.%#\\(\\),]+)' + (i < repeats - 1 ? ' ' : '');
       }
       return new RegExp(pattern + (hasSuffix ? '([;}])' : ''), 'g');
     };
@@ -287,7 +287,7 @@ var CleanCSS = {
     // same 2 values into one
     replace(shorthandRegex(2, true), function(match, property, size1, size2, suffix) {
       if (size1 === size2)
-        return property + ":" + size1 + suffix;
+        return property + ':' + size1 + suffix;
       else
         return match;
     });
index fd43103..c1a9e61 100644 (file)
@@ -50,42 +50,42 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({
   'version': binaryContext('-v', {
     'should output help': function(error, stdout) {
       var version = JSON.parse(fs.readFileSync('./package.json')).version;
-      assert.equal(stdout, version + "\n");
+      assert.equal(stdout, version + '\n');
     }
   }),
-  'stdin': pipedContext("a{color: #f00}", '', {
+  'stdin': pipedContext('a{color: #f00}', '', {
     'should output data': function(error, stdout) {
-      assert.equal(stdout, "a{color:red}");
+      assert.equal(stdout, 'a{color:red}');
     }
   }),
   'no empty by default': pipedContext('a{}', '', {
     'should preserve content': function(error, stdout) {
-      assert.equal(stdout, "a{}");
+      assert.equal(stdout, 'a{}');
     }
   }),
   'strip all but first comment': pipedContext('/*!1st*//*! 2nd */a{}', '--s1', {
     'should keep the 2nd comment': function(error, stdout) {
-      assert.equal(stdout, "/*!1st*/a{}");
+      assert.equal(stdout, '/*!1st*/a{}');
     }
   }),
   'strip all comments': pipedContext('/*!1st*//*! 2nd */a{}', '--s0', {
     'should keep the 2nd comment': function(error, stdout) {
-      assert.equal(stdout, "a{}");
+      assert.equal(stdout, 'a{}');
     }
   }),
   'empty': pipedContext('a{}', '-e', {
     'should preserve content': function(error, stdout) {
-      assert.equal(stdout, "");
+      assert.equal(stdout, '');
     }
   }),
   'no relative to path': binaryContext('./test/data/partials-absolute/base.css', {
     'should not be able to resolve it fully': function(error, stdout) {
-      assert.equal(stdout, ".sub{padding:0}.base{margin:0}");
+      assert.equal(stdout, '.sub{padding:0}.base{margin:0}');
     }
   }),
   'relative to path': binaryContext('-r ./test/data ./test/data/partials-absolute/base.css', {
     'should be able to resolve it': function(error, stdout) {
-      assert.equal(stdout, ".base2{border-width:0}.sub{padding:0}.base{margin:0}");
+      assert.equal(stdout, '.base2{border-width:0}.sub{padding:0}.base{margin:0}');
     }
   }),
   'from source': binaryContext('./test/data/reset.css', {
index 9fb057a..13349b8 100644 (file)
@@ -110,12 +110,12 @@ vows.describe('clean-units').addBatch({
       'div{height:-moz-calc(3 * 2em + 10px)}'
     ],
     'before colon': [
-      "#test{padding-left :0}",
-      "#test{padding-left:0}"
+      '#test{padding-left :0}',
+      '#test{padding-left:0}'
     ],
-    'before colon but not selectors #1': "div :before{}",
-    'before colon but not selectors #2': "div ::-webkit-search-decoration{}",
-    'before colon but not selectors #3': "div :after{color:red}",
+    'before colon but not selectors #1': 'div :before{}',
+    'before colon but not selectors #2': 'div ::-webkit-search-decoration{}',
+    'before colon but not selectors #3': 'div :after{color:red}',
     'windows breaks': [
       'div>a{color:red\r\n }',
       'div>a{color:red}'