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

Method buildAttributesWithDefaults

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

Source from the content-addressed store, hash-verified

153 }
154
155 buildAttributesWithDefaults () {
156 const t0 = new Date()
157 const clone = $.extend(true, {}, this.attributes)
158 const thisTV4 = tv4.freshApi()
159 thisTV4.addSchema('#', this.schema())
160 thisTV4.addSchema('metaschema', require('schemas/metaschema'))
161 TreemaUtils.populateDefaults(clone, this.schema(), thisTV4)
162 this.attributesWithDefaults = clone
163 const duration = new Date() - t0
164 if (duration > 10) { return console.debug(`Populated defaults for ${this.type()}${this.attributes.name ? ' ' + this.attributes.name : ''} in ${duration}ms`) }
165 }
166
167 loadFromBackup () {
168 if (!this.saveBackups) { return }

Callers 2

getMethod · 0.95
User.spec.jsFile · 0.80

Calls 2

schemaMethod · 0.95
typeMethod · 0.95

Tested by

no test coverage detected