lib/render/client.js
function(name, cfg){
    if(!name) return;

    var type = typeof name;
    if(type === 'object' && !cfg){
      for(var k in name){
        if(name.hasOwnProperty(k)) this.directive(k, name[k]);
      }
      return this;
    }
    var directives = this._directives, directive;
    if(cfg == null){
      if( type === 'string' ){
        if( directive = directives[name] ) return directive;
        else{
          var regexp = directives.__regexp__;
          for(var i = 0, len = regexp.length; i < len ; i++){
            directive = regexp[i];
            var test = directive.regexp.test(name);
            if(test) return directive;
          }
        }
      }
    }else{
      if( typeof cfg === 'function') cfg = { link: cfg } 
      if( type === 'string' ) directives[name] = cfg;
      else{
        cfg.regexp = name;
        directives.__regexp__.push(cfg)
      }
      if(typeof cfg.link !== 'function') cfg.link = NOOP;
      return this
    }
  }
function(name, cfg){
    if(!name) return;

    var type = typeof name;
    if(type === 'object' && !cfg){
      for(var k in name){
        if(name.hasOwnProperty(k)) this.directive(k, name[k]);
      }
      return this;
    }
    var directives = this._directives, directive;
    if(cfg == null){
      if( type === 'string' ){
        if( directive = directives[name] ) return directive;
        else{
          var regexp = directives.__regexp__;
          for(var i = 0, len = regexp.length; i < len ; i++){
            directive = regexp[i];
            var test = directive.regexp.test(name);
            if(test) return directive;
          }
        }
      }
    }else{
      if( typeof cfg === 'function') cfg = { link: cfg } 
      if( type === 'string' ) directives[name] = cfg;
      else{
        cfg.regexp = name;
        directives.__regexp__.push(cfg)
      }
      if(typeof cfg.link !== 'function') cfg.link = NOOP;
      return this
    }
  }
function ( name , cfg ) { if ( ! name ) return ; var type = typeof name ; if ( type === 'object' && ! cfg ) { for ( var k in name ) { if ( name . hasOwnProperty ( k ) ) this . directive ( k , name [ k ] ) ; } return this ; } var directives = this . _directives , directive ; if ( cfg == null ) { if ( type === 'string' ) { if ( directive = directives [ name ] ) return directive ; else { var regexp = directives . __regexp__ ; for ( var i = 0 , len = regexp . length ; i < len ; i ++ ) { directive = regexp [ i ] ; var test = directive . regexp . test ( name ) ; if ( test ) return directive ; } } } } else { if ( typeof cfg === 'function' ) cfg = { link : cfg } if ( type === 'string' ) directives [ name ] = cfg ; else { cfg . regexp = name ; directives . __regexp__ . push ( cfg ) } if ( typeof cfg . link !== 'function' ) cfg . link = NOOP ; return this } }
Define a directive

@method directive
@return {Object} Copy of ...
Define a directive