Skip to content

Commit a7b8617

Browse files
committed
Made \s more specific
1 parent a2bb251 commit a7b8617

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/options/colon-space.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ module.exports = {
99
setValue: function(value) {
1010
this._value = false;
1111
if (value === true) this._value = 'after';
12-
if (typeof value === 'string' && value.match(/after|before|both|(?=.*(?:\s|:))\s*:?\s*/)) this._value = value;
12+
if (typeof value === 'string'&& value.match(/after|before|both|(?=.*(?:[ \t\n]|:))[ \t\n]*:?[ \t\n]*/)) {
13+
this._value = value;
14+
}
1315
if (!this._value) return;
1416
return this;
1517
},
@@ -20,7 +22,7 @@ module.exports = {
2022
* @param {node} node
2123
*/
2224
process: function(nodeType, node) {
23-
var detectSpaces = this._value.match(/((\s*):)?(\s*)/);
25+
var detectSpaces = this._value.match(/(([ \t\n]*):)?([ \t\n]*)/);
2426
if (nodeType === 'property') {
2527
if (node[node.length - 1][0] === 's') node.pop();
2628
if (this._value === 'both' || this._value === 'before')

0 commit comments

Comments
 (0)