diff --git a/dist/js/entity/in_memory.js b/dist/js/entity/in_memory.js index 7160e75..fc7ea31 100644 --- a/dist/js/entity/in_memory.js +++ b/dist/js/entity/in_memory.js @@ -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 diff --git a/src/js/entity/in_memory.ts b/src/js/entity/in_memory.ts index 7d9fd6d..e440387 100644 --- a/src/js/entity/in_memory.ts +++ b/src/js/entity/in_memory.ts @@ -61,7 +61,7 @@ export class InMemoryEntity implements BaseInMemoryEntitySchema { */ prop(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; } /**