Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cascading PUTs #73

Merged
merged 1 commit into from
Jun 17, 2015
Merged

cascading PUTs #73

merged 1 commit into from
Jun 17, 2015

Conversation

TakenPilot
Copy link
Contributor

Allow cascading PUTs, so that people can save things like this:

ref at { a: "b", c: {_ref: "d", e: "f"}}

which will produce two PUTs in this order:

ref at { a: "b", c: {_ref: "d"}}
d at { e: "f"}

If either PUT fails, they'll both fail.

*
* @param {object} obj
*/
function clearOwnProperties(obj) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just obj = {};?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it needs to be a particular object, specifically the one linked to by the original object. That's what it means by "in-place". Creating a new object might as well be {}, like you say.

In this case, there is a root object with many objects within it, and we're clearing those deep objects located somewhere deep within that root object. We don't know where these deep objects are -- they could even be within several layers of other objects within the root object.

@cruzanmo
Copy link

Looks good.

TakenPilot added a commit that referenced this pull request Jun 17, 2015
@TakenPilot TakenPilot merged commit a54d607 into master Jun 17, 2015
@TakenPilot TakenPilot deleted the cascasing-put branch June 17, 2015 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants