function(item) {
      var parts = item.displayName.split('.');
      for (var i = parts.length - 1; i > 0; i--) {
        var name = parts.slice(0, i).join('.');
        if (itemsByName[name]) {
          return itemsByName[name];
        }
      }
    }
function(item) {
      var parts = item.displayName.split('.');
      for (var i = parts.length - 1; i > 0; i--) {
        var name = parts.slice(0, i).join('.');
        if (itemsByName[name]) {
          return itemsByName[name];
        }
      }
    }
function ( item ) { var parts = item . displayName . split ( '.' ) ; for ( var i = parts . length - 1 ; i > 0 ; i -- ) { var name = parts . slice ( 0 , i ) . join ( '.' ) ; if ( itemsByName [ name ] ) { return itemsByName [ name ] ; } } }
Try to find a parent by matching the longest substring of the display
name.
@param item
Try to find a parent by matching the longest substring of the display name .
returns the index of the last item in the list