I'm trying to add a specific item on the front of an array but I can't work out how to do this? I know you do it with unshift, but I'm not sure how to do it with a key value array?
var outgoingHeaders = {
    "send_client_version": 1,
    "send_auth_ticket": 5
};
function sendPacket(packetName, packetData) {
    const packetId = outgoingHeaders[packetName];
    const packetArray = {'packet_id' : packetId };
    // TODO: Add packetArray at the start of packetData
    socket.send(JSON.stringify(packetData));
}
Example of calling it...
sendPacket('send_auth_ticket', {
    'auth_ticket' : authTicket,
});
 
     
    