Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/lib/messages/patchop.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export class PatchOp {
// Filter out any values that exist in removals list
target[property] = (target[property] ?? []).filter(v => !removals.includes(v));
// Unset the property if it's now empty
if (target[property].length === 0) target[property] = undefined;
if ((target[property] ?? []).length === 0) target[property] = undefined;
}
} catch (ex) {
if (ex instanceof Types.Error) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class Filter extends Array {
*/
match(values) {
// Match against any of the filters in the set
return values.filter(value =>
return values?.filter(value =>
this.some(f => Object.entries(f).every(([attr, expressions]) => {
const [,actual] = Object.entries(value).find(([key]) => key.toLowerCase() === attr.toLowerCase()) ?? [];
const isActualDate = (actual instanceof Date || (new Date(actual).toString() !== "Invalid Date" && String(actual).match(isoDate)));
Expand Down