MCPcopy Index your code
hub / github.com/codecombat/codecombat / clone

Method clone

app/models/CocoModel.js:86–98  ·  view source on GitHub ↗
(withChanges)

Source from the content-addressed store, hash-verified

84 }
85
86 clone (withChanges) {
87 // Backbone does not support nested documents
88 if (withChanges == null) { withChanges = true }
89 const clone = super.clone()
90 clone.set($.extend(true, {}, withChanges || !this._revertAttributes ? this.attributes : this._revertAttributes))
91 if (this._revertAttributes && !withChanges) {
92 // remove any keys that are in the current attributes not in the snapshot
93 for (const key of Array.from(_.difference(_.keys(clone.attributes), _.keys(this._revertAttributes)))) {
94 clone.unset(key)
95 }
96 }
97 return clone
98 }
99
100 onError (level, jqxhr) {
101 this.loading = false

Callers 15

makeCourseObjectFunction · 0.45
makeCampaignObjectFunction · 0.45
makeEarnedAchievementFunction · 0.45
makeCourseObjectFunction · 0.45
makeCampaignObjectFunction · 0.45
makeEarnedAchievementFunction · 0.45
replaceNodesFunction · 0.45
deltas.jsFile · 0.45
blocklyUtils.jsFile · 0.45

Calls 1

setMethod · 0.45

Tested by

no test coverage detected