Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Commit

Permalink
fix: allow mutating returned .toJSON value
Browse files Browse the repository at this point in the history
Relaxes the constraints from #81 a little as it's
caused quite a lot of tests to break.

We still have an immutable copy in the object but any objects
returned will be mutable.
  • Loading branch information
achingbrain authored and vmx committed Aug 13, 2018
1 parent 11d7f0a commit d8239ad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/dag-link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DAGLink {
})
}

return this._json
return Object.assign({}, this._json)
}

get name () {
Expand Down
2 changes: 1 addition & 1 deletion src/dag-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DAGNode {
})
}

return this._json
return Object.assign({}, this._json)
}

toString () {
Expand Down
4 changes: 2 additions & 2 deletions test/dag-node-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ module.exports = (repo) => {
})
},
(cb) => {
const link = Object.assign({}, toDAGLink(node2).toJSON())
const link = toDAGLink(node2).toJSON()
link.name = 'banana'

DAGNode.addLink(node1a, link, (err, node) => {
Expand Down Expand Up @@ -402,7 +402,7 @@ module.exports = (repo) => {
})
},
(cb) => {
const link = Object.assign({}, toDAGLink(node2).toJSON())
const link = toDAGLink(node2).toJSON()
link.name = 'banana'

DAGNode.addLink(node1a, link, (err, node) => {
Expand Down

0 comments on commit d8239ad

Please sign in to comment.