code: function getIdxOfMatchingDirective(node, type) {
      var defs = node.view[TVIEW].directives;
      var flags = node.tNode.flags;
      var count = flags & 4095 /* DirectiveCountMask */;
      var start = flags >> 14 /* DirectiveStartingIndexShift */;
      var end = start + count;
      for (var i = start; i < end; i++) {
          var def = defs[i];
          if (def.type === type && def.diPublic) {
              return i;
          }
      }
      return null;
  }
docs: Iterates over all the directives for a node and returns index of a directive for a given type.
  
  @param node Node on which directives are present.
  @param type Type of a directive to look for.
  @returns Index of a found directive or null when none found.