I'm trying to convert a map to an array with a firebase cloud functions
This is my code.
  let map = new Map();
  map.set("1", 1);
  map.set("2", 2);
  console.log(new Array(...map).map(pairs => pairs[0]));
  // Upper code not relevant: just to test, but prints ["1", "2"] in the firebase logs)
  const getUser = await admin.firestore()
  .collection("users")
  .doc(context.auth.uid)
  .get();
  let userMap = getUser.data()['friendsMap'];
  console.log(userMap);
   // Prints this in the firebase logs: { '1234ab': 'Jeff',
  5678ab: 'Bob' }
  let userIDLIST = new Array(...userMap).map(pairs => pairs[0]);
  console.log('userIDLIST:'+userIDLIST);
when I want to convert the userMap to userIDLIST array (last lines of code), I get the error:
Unhandled error TypeError: undefined is not a function
What am I doing wrong?
Thanks in advance!