code: function command_id_from_buffer(data) {
  
      var durations = command_durations_from_hex_buffer(data);
  
      if (!valid_leader(durations)) return;
  
      var binary = binary_from_durations(durations);
      if (!valid_binary(binary)) return;
  
      var bytes = bytes_from_binary(binary);
      if (!valid_bytes(bytes)) return;
      if (!valid_codes(bytes)) return;
  
      return command_id_from_bytes(bytes);
  }
docs: a small implementation of the whole flow