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

Method denormalize

app/models/Level.js:98–117  ·  view source on GitHub ↗
(supermodel, session, otherSession)

Source from the content-addressed store, hash-verified

96 }
97
98 denormalize (supermodel, session, otherSession) {
99 let tt
100 const o = $.extend(true, {}, this.attributes)
101 if (o.thangs && (utils.isCodeCombat || this.isType('hero', 'hero-ladder', 'hero-coop', 'course', 'course-ladder', 'game-dev', 'web-dev'))) {
102 const thangTypesWithComponents = ((() => {
103 const result = []
104 for (tt of Array.from(supermodel.getModels('ThangType'))) {
105 if (tt.get('components')) {
106 result.push(tt)
107 }
108 }
109 return result
110 })())
111 const thangTypesByOriginal = _.indexBy(thangTypesWithComponents, tt => tt.get('original')) // Optimization
112 for (const levelThang of Array.from(o.thangs)) {
113 this.denormalizeThang(levelThang, supermodel, session, otherSession, thangTypesByOriginal)
114 }
115 }
116 return o
117 }
118
119 denormalizeThang (levelThang, supermodel, session, otherSession, thangTypesByOriginal) {
120 let config, heroThangType, isHero, placeholderComponent, placeholders, placeholdersUsed, thangComponent

Callers 2

serializeMethod · 0.95
Level.spec.jsFile · 0.80

Calls 3

isTypeMethod · 0.95
denormalizeThangMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected