{"size": 721, "ext": "js", "max_stars_repo_path": "src/index.js", "max_stars_repo_name": "Grigory-m/brackets", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/index.js", "max_issues_repo_name": "Grigory-m/brackets", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/index.js", "max_forks_repo_name": "Grigory-m/brackets", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.75, "max_line_length": 80, "alphanum_fraction": 0.4895977809}
module.exports = function check(str, bracketsConfig) {
    if (str.length % 2) return false;
    let open = new Map();
    let close = new Map();
  
    for (let i = 0; i < bracketsConfig.length; i++) {
    open.set(bracketsConfig[i][0], i);
    close.set(bracketsConfig[i][1], i);
    }    
  
    let newS = '';
  
    for (let i = 0; i < str.length; i++) {
      newS = newS + str[i];
          
      for (let i = 1; i <= newS.length / 2; i++) {
  
        if ( open.has(newS[newS.length-2])) {
        
          if (open.get(newS[newS.length-2]) == close.get(newS[newS.length-1])) {
          newS = newS.slice(0, newS.length - 2);
          } 
        }
      }
    }
    return newS.length == 0 ? true : false;
}
