Various fixes
This commit is contained in:
		@@ -26,10 +26,10 @@ module.exports =  {
 | 
			
		||||
    .map((num)=>((num%52)+52)%52)
 | 
			
		||||
    .map((num)=>{
 | 
			
		||||
      if(num < 26){
 | 
			
		||||
        asciiOffset = 97;
 | 
			
		||||
        var asciiOffset = 97;
 | 
			
		||||
      }
 | 
			
		||||
      else{
 | 
			
		||||
        asciiOffset = 65 - 26;
 | 
			
		||||
        var asciiOffset = 65 - 26;
 | 
			
		||||
      }
 | 
			
		||||
      return num + asciiOffset;
 | 
			
		||||
    })
 | 
			
		||||
 
 | 
			
		||||
@@ -9,8 +9,8 @@ function getFactors(num){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function coPrime(a, b){
 | 
			
		||||
  aFactors = getFactors(a);
 | 
			
		||||
  bFactors = getFactors(b);
 | 
			
		||||
  var aFactors = getFactors(a);
 | 
			
		||||
  var bFactors = getFactors(b);
 | 
			
		||||
  var common = aFactors.filter((factor)=>(bFactors.indexOf(factor) > -1));
 | 
			
		||||
 | 
			
		||||
  return (common.length == 0);
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ module.exports =  {
 | 
			
		||||
    return cipherText
 | 
			
		||||
    .split("")
 | 
			
		||||
    .map(require("./util/toNum.js"))
 | 
			
		||||
    .map((int, pos, ints)=>{
 | 
			
		||||
    .map(function(int, pos, ints){
 | 
			
		||||
      if(Number.isInteger(int)){
 | 
			
		||||
        this.i++;
 | 
			
		||||
        return (int + 26 - keyNums[this.i%key.length])%26;
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ module.exports =  {
 | 
			
		||||
    .map(function(int, pos, ints){
 | 
			
		||||
      if(Number.isInteger(int)){
 | 
			
		||||
        this.i++;
 | 
			
		||||
        return val =  (int + keyNums[this.i % key.length]) % 26;
 | 
			
		||||
        return (int + keyNums[this.i % key.length]) % 26;
 | 
			
		||||
      }
 | 
			
		||||
      else{
 | 
			
		||||
        return int;
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ module.exports = {
 | 
			
		||||
  },
 | 
			
		||||
  number: function(input){
 | 
			
		||||
    if(isNaN(parseInt(input))){
 | 
			
		||||
      throw "Invalid input type - should be a string.";
 | 
			
		||||
      throw "Invalid input type - should be a number.";
 | 
			
		||||
    }
 | 
			
		||||
    return parseInt(input);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user