Skip to content

Commit 160495d

Browse files
committed
FNs should return something.
All output tested for falsy, make fail returns false.
1 parent 3344563 commit 160495d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

index.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ module.exports = function(css, options){
122122

123123
function match(re) {
124124
var m = re.exec(css);
125-
if (!m) return;
125+
if (!m) return false;
126126
var str = m[0];
127127
updatePosition(str);
128128
css = css.slice(str.length);
@@ -154,7 +154,7 @@ module.exports = function(css, options){
154154

155155
function comment() {
156156
var pos = position();
157-
if ('/' != css.charAt(0) || '*' != css.charAt(1)) return;
157+
if ('/' != css.charAt(0) || '*' != css.charAt(1)) return false;
158158

159159
var i = 2;
160160
while ("" !== css.charAt(i) && ('*' != css.charAt(i) || '/' != css.charAt(i + 1))) ++i;
@@ -178,7 +178,7 @@ module.exports = function(css, options){
178178

179179
function selector() {
180180
var m = match(/^([^{]+)/);
181-
if (!m) return;
181+
if (!m) return false;
182182
/* @fix Remove all comments from selectors
183183
* http://ostermiller.org/findcomment.html */
184184
return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').split(/\s*,\s*/);
@@ -193,7 +193,7 @@ module.exports = function(css, options){
193193

194194
// prop
195195
var prop = match(/^(\*?[-#\/\*\w]+(\[[0-9a-z_-]+\])?)\s*/);
196-
if (!prop) return;
196+
if (!prop) return false;
197197
prop = trim(prop[0]);
198198

199199
// :
@@ -250,7 +250,7 @@ module.exports = function(css, options){
250250
match(/^,\s*/);
251251
}
252252

253-
if (!vals.length) return;
253+
if (!vals.length) return false;
254254

255255
return pos({
256256
type: 'keyframe',
@@ -267,7 +267,7 @@ module.exports = function(css, options){
267267
var pos = position();
268268
var m = match(/^@([-\w]+)?keyframes */);
269269

270-
if (!m) return;
270+
if (!m) return false;
271271
var vendor = m[1];
272272

273273
// identifier
@@ -302,7 +302,7 @@ module.exports = function(css, options){
302302
var pos = position();
303303
var m = match(/^@supports *([^{]+)/);
304304

305-
if (!m) return;
305+
if (!m) return false;
306306
var supports = trim(m[1]);
307307

308308
if (!open()) return error("@supports missing '{'");
@@ -326,7 +326,7 @@ module.exports = function(css, options){
326326
var pos = position();
327327
var m = match(/^@host */);
328328

329-
if (!m) return;
329+
if (!m) return false;
330330

331331
if (!open()) return error("@host missing '{'");
332332

@@ -348,7 +348,7 @@ module.exports = function(css, options){
348348
var pos = position();
349349
var m = match(/^@media *([^{]+)/);
350350

351-
if (!m) return;
351+
if (!m) return false;
352352
var media = trim(m[1]);
353353

354354
if (!open()) return error("@media missing '{'");
@@ -371,7 +371,7 @@ module.exports = function(css, options){
371371
function atpage() {
372372
var pos = position();
373373
var m = match(/^@page */);
374-
if (!m) return;
374+
if (!m) return false;
375375

376376
var sel = selector() || [];
377377

@@ -401,7 +401,7 @@ module.exports = function(css, options){
401401
function atdocument() {
402402
var pos = position();
403403
var m = match(/^@([-\w]+)?document *([^{]+)/);
404-
if (!m) return;
404+
if (!m) return false;
405405

406406
var vendor = trim(m[1]);
407407
var doc = trim(m[2]);
@@ -451,7 +451,7 @@ module.exports = function(css, options){
451451
function _atrule(name) {
452452
var pos = position();
453453
var m = match(new RegExp('^@' + name + ' *([^;\\n]+);'));
454-
if (!m) return;
454+
if (!m) return false;
455455
var ret = { type: name };
456456
ret[name] = trim(m[1]);
457457
return pos(ret);
@@ -462,7 +462,7 @@ module.exports = function(css, options){
462462
*/
463463

464464
function atrule() {
465-
if (css[0] != '@') return;
465+
if (css[0] != '@') return false;
466466

467467
return atkeyframes()
468468
|| atmedia()

0 commit comments

Comments
 (0)