Test name | Executions per second |
---|---|
Using the spread operator | 54793840.0 Ops/sec |
Using Object.assign | 7636371.0 Ops/sec |
const firstObject = {
attempts: 1,
created_at: 1694778031091,
expires_at: 1694778091091,
source: {
externalId: "831f76fc-5a9d-49bc-8d4b-114010cedb73",
name: "Tengen Uzui",
type: "phone",
},
type: "phone",
value: "411273",
};
const finalObject = {
firstObject,
attempts: firstObject.attempts + 1,
};
const firstObject = {
attempts: 1,
created_at: 1694778031091,
expires_at: 1694778091091,
source: {
externalId: "831f76fc-5a9d-49bc-8d4b-114010cedb73",
name: "Tengen Uzui",
type: "phone",
},
type: "phone",
value: "411273",
};
const finalObject = Object.assign({}, firstObject, {
attempts: firstObject.attempts + 1,
});