Skip to content

Commit 07b0307

Browse files
Copilothotlong
andcommitted
refactor: separate contains/notcontains into distinct case blocks for clarity
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent fdb9155 commit 07b0307

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/plugins/driver-memory/src/memory-driver.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,11 +693,10 @@ export class InMemoryDriver implements DriverInterface {
693693
return { [field]: { $in: value } };
694694
case 'nin': case 'not in':
695695
return { [field]: { $nin: value } };
696-
case 'contains': case 'like': case 'notcontains': case 'not_contains':
697-
if (operator === 'notcontains' || operator === 'not_contains') {
698-
return { [field]: { $not: { $regex: new RegExp(this.escapeRegex(value), 'i') } } };
699-
}
696+
case 'contains': case 'like':
700697
return { [field]: { $regex: new RegExp(this.escapeRegex(value), 'i') } };
698+
case 'notcontains': case 'not_contains':
699+
return { [field]: { $not: { $regex: new RegExp(this.escapeRegex(value), 'i') } } };
701700
case 'startswith': case 'starts_with':
702701
return { [field]: { $regex: new RegExp(`^${this.escapeRegex(value)}`, 'i') } };
703702
case 'endswith': case 'ends_with':

0 commit comments

Comments
 (0)