tasks/px_to_rem.js
function checkFallback(obj) {
      var props = [];
      var hasFallback = [];
      var values = [];

      for (var prop in obj) {
        if (obj.hasOwnProperty(prop)) {
          var pro = obj[prop].prop;

          if (obj[prop].type === 'comment') {
            continue;
          }

          if (props.indexOf(pro) === -1) {
            props.push(pro);
            values.push({prop: pro, val:obj[prop].value});
          } else {
            var lookup = {};

            for (var i = 0, len = values.length; i < len; i++) {
              lookup[values[i].prop] = values[i].val;
            }

            if (lookup[pro].search('px') === -1 && obj[prop].value.search('rem') === -1 ||
            lookup[pro].search('rem') === -1 && obj[prop].value.search('px') === -1) {
              hasFallback.push(pro);
            }
          }
        }
      }

      return hasFallback;
    }
function checkFallback(obj) {
      var props = [];
      var hasFallback = [];
      var values = [];

      for (var prop in obj) {
        if (obj.hasOwnProperty(prop)) {
          var pro = obj[prop].prop;

          if (obj[prop].type === 'comment') {
            continue;
          }

          if (props.indexOf(pro) === -1) {
            props.push(pro);
            values.push({prop: pro, val:obj[prop].value});
          } else {
            var lookup = {};

            for (var i = 0, len = values.length; i < len; i++) {
              lookup[values[i].prop] = values[i].val;
            }

            if (lookup[pro].search('px') === -1 && obj[prop].value.search('rem') === -1 ||
            lookup[pro].search('rem') === -1 && obj[prop].value.search('px') === -1) {
              hasFallback.push(pro);
            }
          }
        }
      }

      return hasFallback;
    }
function checkFallback ( obj ) { var props = [ ] ; var hasFallback = [ ] ; var values = [ ] ; for ( var prop in obj ) { if ( obj . hasOwnProperty ( prop ) ) { var pro = obj [ prop ] . prop ; if ( obj [ prop ] . type === 'comment' ) { continue ; } if ( props . indexOf ( pro ) === - 1 ) { props . push ( pro ) ; values . push ( { prop : pro , val : obj [ prop ] . value } ) ; } else { var lookup = { } ; for ( var i = 0 , len = values . length ; i < len ; i ++ ) { lookup [ values [ i ] . prop ] = values [ i ] . val ; } if ( lookup [ pro ] . search ( 'px' ) === - 1 && obj [ prop ] . value . search ( 'rem' ) === - 1 || lookup [ pro ] . search ( 'rem' ) === - 1 && obj [ prop ] . value . search ( 'px' ) === - 1 ) { hasFallback . push ( pro ) ; } } } } return hasFallback ; }
Function to check if rem and px exist
Function to check if rem and px exist