Get unique identifiers from objects (JavaScript/Node.js)