function generateSequence(seq, check) {
  seq = seq.substr(0,12) + '' + check;

  var first = seq.substr(0,1),
    group1 = seq.substr(1,6),
    group2 = seq.substr(7);

  var left = [],
    right = [],
    enc = ENCODE_GROUPS[parseInt(first)],
    dInt;

  for (var i = 0; i < 6; i++) {
    dInt = parseInt(group1[i]);
    left = left.concat( BARMAP[ enc[i] ][ dInt ] );
  }

  for (var i = 0; i < 6; i++) {
    dInt = parseInt(group2[i])
    right = right.concat( BARMAP[RIGHT][ dInt ]   );
  }

  return [].concat(START, left, MIDDLE, right, END);
}
function generateSequence(seq, check) {
  seq = seq.substr(0,12) + '' + check;

  var first = seq.substr(0,1),
    group1 = seq.substr(1,6),
    group2 = seq.substr(7);

  var left = [],
    right = [],
    enc = ENCODE_GROUPS[parseInt(first)],
    dInt;

  for (var i = 0; i < 6; i++) {
    dInt = parseInt(group1[i]);
    left = left.concat( BARMAP[ enc[i] ][ dInt ] );
  }

  for (var i = 0; i < 6; i++) {
    dInt = parseInt(group2[i])
    right = right.concat( BARMAP[RIGHT][ dInt ]   );
  }

  return [].concat(START, left, MIDDLE, right, END);
}
function generateSequence ( seq , check ) { seq = seq . substr ( 0 , 12 ) + '' + check ; var first = seq . substr ( 0 , 1 ) , group1 = seq . substr ( 1 , 6 ) , group2 = seq . substr ( 7 ) ; var left = [ ] , right = [ ] , enc = ENCODE_GROUPS [ parseInt ( first ) ] , dInt ; for ( var i = 0 ; i < 6 ; i ++ ) { dInt = parseInt ( group1 [ i ] ) ; left = left . concat ( BARMAP [ enc [ i ] ] [ dInt ] ) ; } for ( var i = 0 ; i < 6 ; i ++ ) { dInt = parseInt ( group2 [ i ] ) right = right . concat ( BARMAP [ RIGHT ] [ dInt ] ) ; } return [ ] . concat ( START , left , MIDDLE , right , END ) ; }
/*
generate ean13 sequence

@param String seq - sequence
@param Int|String check - check digit
@return Array<Number> - array of barwidth
/ * generate ean13 sequence