{"size": 600, "ext": "js", "max_stars_repo_path": "CTCI/c1/q4.js", "max_stars_repo_name": "rishabh09/algorithms-practice", "max_stars_repo_stars_event_min_datetime": "2018-11-07T17:48:27.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-27T18:04:55.000Z", "max_issues_repo_path": "CTCI/c1/q4.js", "max_issues_repo_name": "rishabh09/algorithms-practice", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "CTCI/c1/q4.js", "max_forks_repo_name": "rishabh09/algorithms-practice", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.2222222222, "max_line_length": 66, "alphanum_fraction": 0.59}
const checkLookup = obj => {
  let isPalindrome = false;
  for (char in obj) {
    if (obj[char] % 2 === 0) isPalindrome = true;
    else {
      if (!isPalindrome) {
        isPalindrome = false;
        break;
      }
    }
  }
  return isPalindrome;
};

const checkPalindromePermutations = str => {
  if (typeof str !== "string") return false;

  const lookup = {};
  for (let i = 0; i < str.length; i++) {
    let letter = str[i].toLowerCase();
    lookup[letter] ? (lookup[letter] += 1) : (lookup[letter] = 1);
  }
  return checkLookup(lookup);
};

module.exports = checkPalindromePermutations;
