text: // check('([{}])', [['(', ')'], ['[', ']'], ['{', '}']]) // -> true
  let arrOfNextBrackets = [];
  
  module.exports = function check(str, bracketsConfig) {
      arrOfNextBrackets = [];
      for (let bracket of str) {
          if (arrOfNextBrackets[arrOfNextBrackets.length - 1] !== bracket) {
              result = processOpenBracket(bracket, bracketsConfig);
              if (!result) {
                  return false;
              }
          } else {
              arrOfNextBrackets.pop();
          }
      }
      if (arrOfNextBrackets.length === 0) {
          return true;
      }
      return false;
  }
  
  function processOpenBracket(bracket, bracketsConfig) {
      for(let pair of bracketsConfig) {
          if (pair[0] === bracket) {
              arrOfNextBrackets.push(pair[1]);
              return true;
          } 
      }
      return false;
  }
  
  