The relevant part of my code is very succinct and simple this time:
const _ = require('lodash');
...
console.log(cur.advantages);
const charDup = _.cloneDeep(cur);
console.log(charDup.advantages);
When I run this code with the subsequent stuff commented out, it works as expected, but when I run it as part of a larger function, I get different values out of these two console.log() functions. I'm baffled.
It almost seems like there's something asynchronous going on, where the second console.log isn't actually running until more changes are made to charDup. But console.log isn't asynchronous. Even lodash.cloneDeep isn't asynchronous, from what I've been able to find on the web.