modifyAwarenessUpdate = (update, modify) => {
  const decoder = decoding.createDecoder(update);
  const encoder = encoding.createEncoder();
  const len = decoding.readVarUint(decoder);
  encoding.writeVarUint(encoder, len);

  for (let i = 0; i < len; i++) {
    const clientID = decoding.readVarUint(decoder);
    const clock = decoding.readVarUint(decoder);
    const state = JSON.parse(decoding.readVarString(decoder));
    const modifiedState = modify(state);
    encoding.writeVarUint(encoder, clientID);
    encoding.writeVarUint(encoder, clock);
    encoding.writeVarString(encoder, JSON.stringify(modifiedState));
  }

  return encoding.toUint8Array(encoder);
}
Modify the content of an awareness update before re-encoding it to an awareness update.

This might be useful when you have a central server that wants to ensure that clients
cant hijack somebody elses identity.

@param {Uint8Array} update
@param {function(any):any} modify
@return {Uint8Array}