Code coverage report for stylus-lint/src/checks/checkForZeroUnits.js

Statements: 100% (6 / 6)      Branches: 100% (20 / 20)      Functions: 100% (1 / 1)      Lines: 100% (5 / 5)      Ignored: none     

All files » stylus-lint/src/checks/ » checkForZeroUnits.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29      1 11065     11064                               18     11046    
'use strict';
 
// check for 0unit (0 is preferred)
module.exports = function checkForZeroUnits( line ) {
    if ( typeof line !== 'string' ) { return; }
 
    // return true if 0 + any unit type is found
    if ( line.indexOf(' 0px') !== -1 ||
        line.indexOf(' 0%') !== -1 ||
        line.indexOf(' 0em') !== -1 ||
        line.indexOf(' 0rem') !== -1 ||
        line.indexOf(' 0vh') !== -1 ||
        line.indexOf(' 0vw') !== -1 ||
        line.indexOf(' 0vmin') !== -1 ||
        line.indexOf(' 0vmax') !== -1 ||
        line.indexOf(' 0ex') !== -1 ||
        line.indexOf(' 0ch') !== -1 ||
        line.indexOf(' 0mm') !== -1 ||
        line.indexOf(' 0cm') !== -1 ||
        line.indexOf(' 0in') !== -1 ||
        line.indexOf(' 0pt') !== -1 ||
        line.indexOf(' 0pc') !== -1 ||
        line.indexOf(' 0mozmm') !== -1 ) {
        return true;
    }
    else {
        return false;
    }
}