Return value from recurring function

后端 未结 2 823
一生所求
一生所求 2021-01-27 06:14

This Meteor server recursive method commonHint returns result undefined to the console even the finalRes has a value.
Any suggestion o

2条回答
  •  清歌不尽
    2021-01-27 06:46

    Any place you call commonHint you need to return the value of the call.

      ... 
    
      if (!hinters) {
        hinters = [...lib.getCombinations(['arg1', 'arg2', 'arg3'], 2, 3)];
        return this.commonHint(doc, shortMatches, hinters, results);  // hinters is an array of length 3 with 2 elements each
      }
    
      ...
    
      if (hinters.length > 0) {
        return this.commonHint(doc, shortMatches, hinters, results);
    

提交回复
热议问题