Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reime005/37767939e7b8179162797d546253f0c5 to your computer and use it in GitHub Desktop.
Save reime005/37767939e7b8179162797d546253f0c5 to your computer and use it in GitHub Desktop.
const someObject = {
magicValue: 42,
};
const hugeObject = {
...someObject,
someValue: 37,
deepObject: {
foo: [42, 43],
}
}
const overridenObject = {
...hugeObject,
someValue: 24,
deepObject: {
someArray: [91, 21], // foo[] will be overridden
}
}
const notOverridenObject = {
...hugeObject,
anotherValue: 37,
deepObject: {
...hugeObject.deepObject, // extend nested object
someArray: [42, 43],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment