compress = string => {
  const blocks = [];
  let currentBlock = 0;
  let currentBlockSize = 0;

  string.split('').forEach(char => {
    currentBlock = (currentBlock << 1) | char;
    currentBlockSize += 1;

    if (currentBlockSize === MAX_BLOCK_SIZE) {
      blocks.push(currentBlock);
      currentBlock = currentBlockSize = 0;
    }
  });

  // Append last block size to the end.
  if (currentBlockSize) {
    blocks.push(currentBlock, currentBlockSize);
  } else {
    blocks.push(MAX_BLOCK_SIZE);
  }

  return blocks;
}
Compress 0-1 string to int32 array.

@param {string} string
@return {number[]}