@kaspernj/api-maker 1.0.280 → 1.0.281

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  ]
17
17
  },
18
18
  "name": "@kaspernj/api-maker",
19
- "version": "1.0.280",
19
+ "version": "1.0.281",
20
20
  "type": "module",
21
21
  "description": "",
22
22
  "main": "index.js",
@@ -184,13 +184,14 @@ export default class BaseModel {
184
184
  assignAttributes (newAttributes) {
185
185
  for (const key in newAttributes) {
186
186
  const newValue = newAttributes[key]
187
+ const attributeUnderscore = inflection.underscore(key)
187
188
 
188
189
  let applyChange = true
189
190
  let deleteChange = false
190
191
 
191
192
  if (this.isAttributeLoaded(key)) {
192
- const oldValue = this.readAttributeUnderscore(key)
193
- const originalValue = this.modelData[key]
193
+ const oldValue = this.readAttribute(key)
194
+ const originalValue = this.modelData[attributeUnderscore]
194
195
 
195
196
  if (newValue == oldValue) {
196
197
  applyChange = false
@@ -201,9 +202,9 @@ export default class BaseModel {
201
202
  }
202
203
 
203
204
  if (applyChange) {
204
- this.changes[key] = newValue
205
+ this.changes[attributeUnderscore] = newValue
205
206
  } else if (deleteChange) {
206
- delete this.changes[key]
207
+ delete this.changes[attributeUnderscore]
207
208
  }
208
209
  }
209
210
  }