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

Method markToRevert

app/models/CocoModel.js:312–329  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

310 }
311
312 markToRevert () {
313 if (this.type() === 'ThangType') {
314 // Don't deep clone the raw vector data, but do deep clone everything else.
315 this._revertAttributes = _.clone(this.attributes)
316 return (() => {
317 const result = []
318 for (const smallProp in this.attributes) {
319 const value = this.attributes[smallProp]
320 if (value && (smallProp !== 'raw')) {
321 result.push(this._revertAttributes[smallProp] = _.cloneDeep(value))
322 }
323 }
324 return result
325 })()
326 } else {
327 this._revertAttributes = $.extend(true, {}, this.attributes)
328 }
329 }
330
331 revert () {
332 this.clear({ silent: true })

Callers 15

setMethod · 0.95
saveMethod · 0.95
PatchModal.spec.jsFile · 0.80
User.spec.jsFile · 0.80
runTestsMethod · 0.80
buildTranslationListMethod · 0.80
applyDeltaMethod · 0.80

Calls 2

typeMethod · 0.95
cloneMethod · 0.45

Tested by

no test coverage detected