index.js
function octinputtobin(octinput){
  var len = octinput.length;
  if(len == 0){return filledarray(false, 1);}
  var bin = new Array(len * 3);
  var j = 0;
  for (var i = 0; i < len; i++){
    switch (octinput[i]){
    case '0': bin[j+0] = false; bin[j+1] = false; bin[j+2] = false; j+=3; break;
    case '1': bin[j+0] = false; bin[j+1] = false; bin[j+2] = true;  j+=3; break;
    case '2': bin[j+0] = false; bin[j+1] = true;  bin[j+2] = false; j+=3; break;
    case '3': bin[j+0] = false; bin[j+1] = true;  bin[j+2] = true;  j+=3; break;
    case '4': bin[j+0] = true;  bin[j+1] = false; bin[j+2] = false; j+=3; break;
    case '5': bin[j+0] = true;  bin[j+1] = false; bin[j+2] = true;  j+=3; break;
    case '6': bin[j+0] = true;  bin[j+1] = true;  bin[j+2] = false; j+=3; break;
    case '7': bin[j+0] = true;  bin[j+1] = true;  bin[j+2] = true;  j+=3; break;
    default: break;
    }
  }
  return removezeros(bin.slice(0, j));
}
function octinputtobin(octinput){
  var len = octinput.length;
  if(len == 0){return filledarray(false, 1);}
  var bin = new Array(len * 3);
  var j = 0;
  for (var i = 0; i < len; i++){
    switch (octinput[i]){
    case '0': bin[j+0] = false; bin[j+1] = false; bin[j+2] = false; j+=3; break;
    case '1': bin[j+0] = false; bin[j+1] = false; bin[j+2] = true;  j+=3; break;
    case '2': bin[j+0] = false; bin[j+1] = true;  bin[j+2] = false; j+=3; break;
    case '3': bin[j+0] = false; bin[j+1] = true;  bin[j+2] = true;  j+=3; break;
    case '4': bin[j+0] = true;  bin[j+1] = false; bin[j+2] = false; j+=3; break;
    case '5': bin[j+0] = true;  bin[j+1] = false; bin[j+2] = true;  j+=3; break;
    case '6': bin[j+0] = true;  bin[j+1] = true;  bin[j+2] = false; j+=3; break;
    case '7': bin[j+0] = true;  bin[j+1] = true;  bin[j+2] = true;  j+=3; break;
    default: break;
    }
  }
  return removezeros(bin.slice(0, j));
}
function octinputtobin ( octinput ) { var len = octinput . length ; if ( len == 0 ) { return filledarray ( false , 1 ) ; } var bin = new Array ( len * 3 ) ; var j = 0 ; for ( var i = 0 ; i < len ; i ++ ) { switch ( octinput [ i ] ) { case '0' : bin [ j + 0 ] = false ; bin [ j + 1 ] = false ; bin [ j + 2 ] = false ; j += 3 ; break ; case '1' : bin [ j + 0 ] = false ; bin [ j + 1 ] = false ; bin [ j + 2 ] = true ; j += 3 ; break ; case '2' : bin [ j + 0 ] = false ; bin [ j + 1 ] = true ; bin [ j + 2 ] = false ; j += 3 ; break ; case '3' : bin [ j + 0 ] = false ; bin [ j + 1 ] = true ; bin [ j + 2 ] = true ; j += 3 ; break ; case '4' : bin [ j + 0 ] = true ; bin [ j + 1 ] = false ; bin [ j + 2 ] = false ; j += 3 ; break ; case '5' : bin [ j + 0 ] = true ; bin [ j + 1 ] = false ; bin [ j + 2 ] = true ; j += 3 ; break ; case '6' : bin [ j + 0 ] = true ; bin [ j + 1 ] = true ; bin [ j + 2 ] = false ; j += 3 ; break ; case '7' : bin [ j + 0 ] = true ; bin [ j + 1 ] = true ; bin [ j + 2 ] = true ; j += 3 ; break ; default : break ; } } return removezeros ( bin . slice ( 0 , j ) ) ; }
Computes a binary array out of an octal input string
Computes a binary array out of an octal input string