question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement extend resource create a new object with added property

See original GitHub issue

While we have a resource for setting a value in an array (set resource), I think we don’t have such for objects.

It is up to discussion whether a new resource should be created or rather set should be extended to work for objects.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
mhagmajercommented, Jun 27, 2020

Because of data mutability we need to support extend for objects.

let a = { firstName: 'John' }
let b = extend(a, { lastName: 'Smith' }

should return { firstName: 'John', lastName: 'Smith' }

0reactions
czerwinskilukasz1commented, Jul 17, 2020

Yes, I know. That’s why I wrote ‘change’ in italics. Anyways, you answered my question: yes, extend will also work on a key that is already defined. So using extend could be a workaround for updating a value in a map. Anyway, don’t we need a set resource for maps?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object.create() - JavaScript - MDN Web Docs
The Object.create() method creates a new object, using an existing object as the prototype of the newly created object.
Read more >
Is it possible to extend terraform object's (resource) property in ...
I want to create a module who can update object's property without overwriting original terraform file where object is defined before, but in ......
Read more >
Understanding Objects in JavaScript - DigitalOcean
In this tutorial, we will review how to create an object, what object properties and methods are, and how to access, add, delete,...
Read more >
contact resource type - Microsoft Graph v1.0
Property Type Description assistantName String The name of the contact's assistant. businessAddress PhysicalAddress The contact's business address. businessHomePage String The business home page of the contact....
Read more >
Developing Custom Gradle Plugins
To create a Gradle plugin, you need to write a class that implements the Plugin ... an extension object extends the Gradle DSL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found