{"size": 1027, "ext": "js", "max_stars_repo_path": "src/tree-select/tree-select-utils.js", "max_stars_repo_name": "CBIIT/cbiitss-react-components", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/tree-select/tree-select-utils.js", "max_issues_repo_name": "CBIIT/cbiitss-react-components", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/tree-select/tree-select-utils.js", "max_forks_repo_name": "CBIIT/cbiitss-react-components", "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": 21.3958333333, "max_line_length": 63, "alphanum_fraction": 0.5481986368}
export const containsVal = (arr, val) => {
  let result = false;
  for (var i = 0; i < arr.length; i++) {
    if ((arr[i].id ? arr[i].id : arr[i]) === val) {
      result = true;
    }
  }
  return result;
};

export const containsAllVals = (arr, vals) => {
  let result = true;
  for (var i = 0; i < vals.length; i++) {
    if (!containsVal(arr, vals[i].id ? vals[i].id : vals[i])) {
      result = false;
    }
  }
  return result;
};

export const removeVal = (arr, val) => {
  for (var i = 0; i < arr.length; i++) {
    if ((arr[i].id ? arr[i].id : arr[i]) === val) {
      arr.splice(i, 1);
    }
  }
  return arr;
};

export const removeAllVals = (arr, vals) => {
  for (var i = 0; i < vals.length; i++) {
    removeVal(arr, vals[i].id ? vals[i].id : vals[i]);
  }
  return arr;
};

export const flattenTree = (nodes) => {
  let children = [];
  nodes.forEach(addChildren);
  function addChildren(node) {
    children.push(node);
    if (node.children)
      node.children.forEach(addChildren);
  }
  return children;
}

