static async traverseTreeWithActions(argDef, traverseActions, argValue, command) {
    const traversalStack = [];
    traversalStack.push({ children: this.VALIDATION_TREE.impliers, name: null, childIndex: 0 });

    while (traversalStack.length > 0) {
      const currentElement = traversalStack[traversalStack.length - 1];
      let childrenKeys = [];
      if (currentElement.children !== undefined && currentElement.children !== null) {
        childrenKeys = Object.keys(currentElement.children);
      }

      const currentIndex = currentElement.childIndex;

      // Tree traversal must be synchronized.
      /* eslint-disable no-await-in-loop */
      if (traverseActions.onFirstEntry !== undefined && traverseActions.onFirstEntry !== null && currentIndex === 0) {
        await traverseActions.onFirstEntry(argDef, traversalStack, argValue, command);
      }

      if (currentIndex >= childrenKeys.length) {
        if (traverseActions.onLastEntry !== undefined && traverseActions.onLastEntry !== null) {
          await traverseActions.onLastEntry(argDef, traversalStack, argValue, command);
        }

        traversalStack.pop();

        if (traversalStack.length > 0) {
          traversalStack[traversalStack.length - 1].childIndex++;
        }
      } else {
        traversalStack.push({
          children: currentElement.children[childrenKeys[currentIndex]].impliers,
          name: childrenKeys[currentIndex],
          childIndex: 0,
          func: currentElement.children[childrenKeys[currentIndex]].validationFunc
        });
      }
      /* eslint-enable no-await-in-loop */
    }
  }
/**
   * Traverses the validation tree and performs actions at specific points (if such actions are defined).
   * Can throw errors (for example, if validation is not passed).
   * @throws BotPublicError
   * @param  {CommandArgDef}    argDef          the argument definition
   * @param  {Object<Function>} traverseActions the set of functions to be called during the traversal
   * @param  {Object}           argDef          the argument value (can be undefined, if not running for a command)
   * @param  {Command}          command         the command instance (can be undefined, if running not for an instance)
   */
Traverses the validation tree and performs actions at specific points (if such actions are defined).
Can throw errors (for example, if validation is not passed).
Traverses the validation tree and performs actions at specific points ( if such actions are defined ) . Can throw errors ( for example if validation is not passed ) .
static async traverseTreeWithActions(argDef, traverseActions, argValue, command) {
    const traversalStack = [];
    traversalStack.push({ children: this.VALIDATION_TREE.impliers, name: null, childIndex: 0 });
    while (traversalStack.length > 0) {
      const currentElement = traversalStack[traversalStack.length - 1];
      let childrenKeys = [];
      if (currentElement.children !== undefined && currentElement.children !== null) {
        childrenKeys = Object.keys(currentElement.children);
      }
      const currentIndex = currentElement.childIndex;
      if (traverseActions.onFirstEntry !== undefined && traverseActions.onFirstEntry !== null && currentIndex === 0) {
        await traverseActions.onFirstEntry(argDef, traversalStack, argValue, command);
      }
      if (currentIndex >= childrenKeys.length) {
        if (traverseActions.onLastEntry !== undefined && traverseActions.onLastEntry !== null) {
          await traverseActions.onLastEntry(argDef, traversalStack, argValue, command);
        }
        traversalStack.pop();
        if (traversalStack.length > 0) {
          traversalStack[traversalStack.length - 1].childIndex++;
        }
      } else {
        traversalStack.push({
          children: currentElement.children[childrenKeys[currentIndex]].impliers,
          name: childrenKeys[currentIndex],
          childIndex: 0,
          func: currentElement.children[childrenKeys[currentIndex]].validationFunc
        });
      }
    }
  }
static async traverseTreeWithActions ( argDef , traverseActions , argValue , command ) { const traversalStack = [ ] ; traversalStack . push ( { children : this . VALIDATION_TREE . impliers , name : null , childIndex : 0 } ) ; while ( traversalStack . length > 0 ) { const currentElement = traversalStack [ traversalStack . length - 1 ] ; let childrenKeys = [ ] ; if ( currentElement . children !== undefined && currentElement . children !== null ) { childrenKeys = Object . keys ( currentElement . children ) ; } const currentIndex = currentElement . childIndex ; if ( traverseActions . onFirstEntry !== undefined && traverseActions . onFirstEntry !== null && currentIndex === 0 ) { await traverseActions . onFirstEntry ( argDef , traversalStack , argValue , command ) ; } if ( currentIndex >= childrenKeys . length ) { if ( traverseActions . onLastEntry !== undefined && traverseActions . onLastEntry !== null ) { await traverseActions . onLastEntry ( argDef , traversalStack , argValue , command ) ; } traversalStack . pop ( ) ; if ( traversalStack . length > 0 ) { traversalStack [ traversalStack . length - 1 ] . childIndex ++ ; } } else { traversalStack . push ( { children : currentElement . children [ childrenKeys [ currentIndex ] ] . impliers , name : childrenKeys [ currentIndex ] , childIndex : 0 , func : currentElement . children [ childrenKeys [ currentIndex ] ] . validationFunc } ) ; } } }
Traverses the validation tree and performs actions at specific points (if such actions are defined).
Traverses the validation tree and performs actions at specific points ( if such actions are defined ) .
// Tree traversal must be synchronized. /* eslint-disable no-await-in-loop */ /* eslint-enable no-await-in-loop */