lib/helper/watcher.js
function(watcher){
    var dirty = false;
    if(!watcher) return;

    var now, last, tlast, tnow,  
      eq, diff, keyOf, trackDiff
     

    if(!watcher.test){

      now = watcher.get(this);
      last = watcher.last;
      keyOf = watcher.keyOf

      if(now !== last || watcher.force){
        tlast = _.typeOf(last);
        tnow = _.typeOf(now);
        eq = true; 

        // !Object
        if( !(tnow === 'object' && tlast==='object' && watcher.deep) ){
          // Array
          if( tnow === 'array' && ( tlast=='undefined' || tlast === 'array') ){
            if(typeof keyOf === 'function'){
              trackDiff = diffTrack(now, watcher.last || [], keyOf )
              diff = trackDiff.steps;
              if(trackDiff.dirty) dirty = true;
            }else{
              diff = diffArray(now, watcher.last || [], watcher.diff)
            }
            
            if(!dirty && (tlast !== 'array' || diff === true || diff.length) ) dirty = true;
          }else{
            eq = _.equals( now, last );
            if( !eq || watcher.force ){
              watcher.force = null;
              dirty = true; 
            }
          }
        }else{
          diff =  diffObject( now, last, watcher.diff, keyOf  );
          if(diff.isTrack){
            trackDiff = diff;
            diff = trackDiff.steps;
          }
          if( diff === true || diff.length ) dirty = true;
        }
      }

    } else{
      // @TODO 是否把多重改掉
      var result = watcher.test(this);
      if(result){
        dirty = true;
        watcher.fn.apply(this, result)
      }
    }
    if(dirty && !watcher.test){
      if(tnow === 'object' && watcher.deep || tnow === 'array'){
        watcher.last = _.clone(now);
      }else{
        watcher.last = now;
      }
      watcher.fn.call(this, now, last, diff, trackDiff && trackDiff.oldKeyMap, trackDiff && trackDiff.dirty)
      if(watcher.once) this.$unwatch(watcher)
    }

    return dirty;
  }
function(watcher){
    var dirty = false;
    if(!watcher) return;

    var now, last, tlast, tnow,  
      eq, diff, keyOf, trackDiff
     

    if(!watcher.test){

      now = watcher.get(this);
      last = watcher.last;
      keyOf = watcher.keyOf

      if(now !== last || watcher.force){
        tlast = _.typeOf(last);
        tnow = _.typeOf(now);
        eq = true; 

        // !Object
        if( !(tnow === 'object' && tlast==='object' && watcher.deep) ){
          // Array
          if( tnow === 'array' && ( tlast=='undefined' || tlast === 'array') ){
            if(typeof keyOf === 'function'){
              trackDiff = diffTrack(now, watcher.last || [], keyOf )
              diff = trackDiff.steps;
              if(trackDiff.dirty) dirty = true;
            }else{
              diff = diffArray(now, watcher.last || [], watcher.diff)
            }
            
            if(!dirty && (tlast !== 'array' || diff === true || diff.length) ) dirty = true;
          }else{
            eq = _.equals( now, last );
            if( !eq || watcher.force ){
              watcher.force = null;
              dirty = true; 
            }
          }
        }else{
          diff =  diffObject( now, last, watcher.diff, keyOf  );
          if(diff.isTrack){
            trackDiff = diff;
            diff = trackDiff.steps;
          }
          if( diff === true || diff.length ) dirty = true;
        }
      }

    } else{
      // @TODO 是否把多重改掉
      var result = watcher.test(this);
      if(result){
        dirty = true;
        watcher.fn.apply(this, result)
      }
    }
    if(dirty && !watcher.test){
      if(tnow === 'object' && watcher.deep || tnow === 'array'){
        watcher.last = _.clone(now);
      }else{
        watcher.last = now;
      }
      watcher.fn.call(this, now, last, diff, trackDiff && trackDiff.oldKeyMap, trackDiff && trackDiff.dirty)
      if(watcher.once) this.$unwatch(watcher)
    }

    return dirty;
  }
function ( watcher ) { var dirty = false ; if ( ! watcher ) return ; var now , last , tlast , tnow , eq , diff , keyOf , trackDiff if ( ! watcher . test ) { now = watcher . get ( this ) ; last = watcher . last ; keyOf = watcher . keyOf if ( now !== last || watcher . force ) { tlast = _ . typeOf ( last ) ; tnow = _ . typeOf ( now ) ; eq = true ; // !Object if ( ! ( tnow === 'object' && tlast === 'object' && watcher . deep ) ) { // Array if ( tnow === 'array' && ( tlast == 'undefined' || tlast === 'array' ) ) { if ( typeof keyOf === 'function' ) { trackDiff = diffTrack ( now , watcher . last || [ ] , keyOf ) diff = trackDiff . steps ; if ( trackDiff . dirty ) dirty = true ; } else { diff = diffArray ( now , watcher . last || [ ] , watcher . diff ) } if ( ! dirty && ( tlast !== 'array' || diff === true || diff . length ) ) dirty = true ; } else { eq = _ . equals ( now , last ) ; if ( ! eq || watcher . force ) { watcher . force = null ; dirty = true ; } } } else { diff = diffObject ( now , last , watcher . diff , keyOf ) ; if ( diff . isTrack ) { trackDiff = diff ; diff = trackDiff . steps ; } if ( diff === true || diff . length ) dirty = true ; } } } else { // @TODO 是否把多重改掉 var result = watcher . test ( this ) ; if ( result ) { dirty = true ; watcher . fn . apply ( this , result ) } } if ( dirty && ! watcher . test ) { if ( tnow === 'object' && watcher . deep || tnow === 'array' ) { watcher . last = _ . clone ( now ) ; } else { watcher . last = now ; } watcher . fn . call ( this , now , last , diff , trackDiff && trackDiff . oldKeyMap , trackDiff && trackDiff . dirty ) if ( watcher . once ) this . $unwatch ( watcher ) } return dirty ; }
check a single one watcher
check a single one watcher