src/utils/bot-utils.js
/**
   * Splits the given text based on un-quoted spaces. Removes duplicate spaces before that.
   * @param  {text}          text the text to be splitted
   * @return {Array<string>}      splitted array of arguments, trimmed
   */
Splits the given text based on un-quoted spaces. Removes duplicate spaces before that.
@param  {text}          text the text to be splitted
@return {Array}      splitted array of arguments, trimmed
Splits the given text based on un - quoted spaces . Removes duplicate spaces before that . @param { text } text the text to be splitted @return { Array } splitted array of arguments trimmed
static splitForArguments(text) {
    const trimmedText = Utils.dry(text);
    const indicesNotInQuotes = Utils.getNonQuotedIndices(trimmedText, ' ');
    const args = [];
    for (let i = 0; i < indicesNotInQuotes.length - 1; i++) {
      args.push(trimmedText.slice(indicesNotInQuotes[i], indicesNotInQuotes[i + 1]).trim());
    }
    if (indicesNotInQuotes.length > 0) {
      args.push(trimmedText.slice(indicesNotInQuotes[indicesNotInQuotes.length - 1], trimmedText.length).trim());
    }
    return args;
  }
static splitForArguments ( text ) { const trimmedText = Utils . dry ( text ) ; const indicesNotInQuotes = Utils . getNonQuotedIndices ( trimmedText , ' ' ) ; const args = [ ] ; for ( let i = 0 ; i < indicesNotInQuotes . length - 1 ; i ++ ) { args . push ( trimmedText . slice ( indicesNotInQuotes [ i ] , indicesNotInQuotes [ i + 1 ] ) . trim ( ) ) ; } if ( indicesNotInQuotes . length > 0 ) { args . push ( trimmedText . slice ( indicesNotInQuotes [ indicesNotInQuotes . length - 1 ] , trimmedText . length ) . trim ( ) ) ; } return args ; }
Splits the given text based on un-quoted spaces.
Splits the given text based on un - quoted spaces .