Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswong committed Nov 6, 2015
1 parent a89ce69 commit 669405d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/css/formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author chris<wfsr@foxmail.com>
*/

var Comb = require('csscomb');
var Comb = require('csscomb');

var util = require('../util');
var Formatter = require('../formatter');
Expand Down
36 changes: 22 additions & 14 deletions lib/css/rules/space-after-value.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @file csscomb rule
* @author chris<wfsr@foxmail.com>
*/

var gonzales = require('csscomb/node_modules/gonzales-pe');

module.exports = {
Expand All @@ -15,12 +20,14 @@ module.exports = {
/**
* Processes tree node.
*
* @param {node} node
* @param {node} node AST node
*/
process: function(node) {
if (!node.is('block')) return;
process: function (node) {
if (!node.is('block')) {
return;
}

var value = this.getValue('space-after-value');
var value = this.getValue(module.exports.name);

for (var i = node.length; i--;) {
if (!node.get(i).is('declarationDelimiter')) {
Expand All @@ -35,7 +42,7 @@ module.exports = {
}

if (value && !hasSpace) {
var space = gonzales.createNode({ type: 'space', content: value });
var space = gonzales.createNode({type: 'space', content: value});
node.insert(i, space);
continue;
}
Expand All @@ -45,19 +52,20 @@ module.exports = {
/**
* Detects the value of an option at the tree node.
*
* @param {node} node
* @param {node} node AST node
* @return {string} the config value
*/
detect: function(node) {
if (!node.is('declaration')) return;
detect: function (node) {
if (!node.is('block')) {
return;
}

for (var i = node.length; i--;) {
if (!node.get(i).is('declarationDelimiter')) continue;

if (node.get(i - 1).is('space')) {
return node.get(i - 1).content;
} else {
return '';
if (!node.get(i).is('declarationDelimiter')) {
continue;
}

return node.get(i - 1).is('space') ? node.get(i - 1).content : '';
}
}
};

0 comments on commit 669405d

Please sign in to comment.