Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dist/js/entity/in_memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ class InMemoryEntity {
* @summary Return a prop or the default
*/
prop(name, defaultValue) {
var _a;
// `lodash.get` gets `null` when the value is `null`, but we still want a default value in this case, hence `||`
return (0, get_1.default)(this._json, name, defaultValue) || defaultValue;
return (_a = (0, get_1.default)(this._json, name, defaultValue)) !== null && _a !== void 0 ? _a : defaultValue;
}
/**
* @summary Return a required prop, throwing an error if it doesn't exist or is undefined/null
Expand Down
2 changes: 1 addition & 1 deletion src/js/entity/in_memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class InMemoryEntity implements BaseInMemoryEntitySchema {
*/
prop<T = undefined>(name: string, defaultValue?: T): T | undefined {
// `lodash.get` gets `null` when the value is `null`, but we still want a default value in this case, hence `||`
return (getValue(this._json, name, defaultValue) as T) || defaultValue;
return (getValue(this._json, name, defaultValue) as T) ?? defaultValue;
}

/**
Expand Down
Loading