{"size": 760, "ext": "js", "max_stars_repo_path": "src/js/utils/localStore.js", "max_stars_repo_name": "blacktoast/javascript-subway", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/js/utils/localStore.js", "max_issues_repo_name": "blacktoast/javascript-subway", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/js/utils/localStore.js", "max_forks_repo_name": "blacktoast/javascript-subway", "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": 23.0303030303, "max_line_length": 76, "alphanum_fraction": 0.5934210526}
import { LOCAL_KEY } from "./constante.js";

export let localStore = {
  singUp({ id, password }) {
    console.log(hash(password));
  },
  Login({ id, password }) {
    let flag = false;
    let users = getItem(LOCAL_KEY.SIGNUP);
    [...users].map((user) => {
      if (user.id === id && user.password === password) {
        setItem(LOCAL_KEY.LOGIN_AUTH, id);
      }
    });
  },
  isLogin() {
    return getItem(LOCAL_KEY.LOGIN_AUTH);
  },
};

function hash(password) {
  let t = [...password].map((e, i) => e.charCodeAt(0) * (100 - i)).join("");
  t = parseInt(t).toString(16);
  return t;
}

function getItem(key) {
  return JSON.stringify(localStorage.getItem(key)) || "";
}
function setItem(key, item) {
  localStore.setItem(key, JSON.parse(item));
}
