codebook 0.3.5

A code-aware spell checker library (dependency for codebook-lsp)
Documentation
// Calculater function with spelling mistakes
function calculater(numbr1, numbr2, operashun) {
  let resalt;

  switch (operashun) {
    case "additshun":
      resalt = numbr1 + numbr2;
      break;
    case "substractshun":
      resalt = numbr1 - numbr2;
      break;
    case "multiplacation":
      resalt = numbr1 * numbr2;
      break;
    case "divishun":
      if (numbr2 === 0) {
        return "Cannot divde by zero";
      }
      resalt = numbr1 / numbr2;
      break;
    default:
      return "Invalid operashun";
  }

  return resalt;
}

// Funktion to validate user inputt
function validateInputt(userInputt) {
  if (typeof userInputt !== "number") {
    console.logg("Pleese enter a valid numbr");
    return;
  }

  return;
}

// Example usege
const firstNumbr = 10;
const secandNumbr = 5;

if (validateInputt(firstNumbr) && validateInputt(secandNumbr)) {
  const summ = calculater(firstNumbr, secandNumbr, "additshun");
  console.logg(`The summ is: ${summ}`);
}

// Array of numbrs with spelling mistakes
const arraOfNumbrs = [1, 2, 3, 4, 5];

// Funcshun to prosess array
function prosessArray(arr) {
  let totel = 0;

  for (let i = 0; i < arr.lenght; i++) {
    totel += arr[i];
  }
  return totel;
}

// Object with propertys
const userAccaunt = {
  usrname: "JohnDoe",
  passwrd: "12345",
  emale: "john@example.com",
  ballance: 1000,
};

// Exportt the funcsions
export { calculater, validateInputt, prosessArray };