Skip to content

Commit

Permalink
merge into 'if'
Browse files Browse the repository at this point in the history
  • Loading branch information
basz committed Apr 18, 2024
1 parent 359b0ca commit c22b2d7
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ export function encrypt<T extends ObjectLiteral>(entity: any): any {
let { propertyName, mode, target } = columnMetadata;
let options: ExtendedColumnOptions = columnMetadata.options;
let encrypt = options.encrypt;
if (encrypt?.encryptionPredicate && !encrypt?.encryptionPredicate(entity)) {
continue;
}
if (
encrypt &&
encrypt && !(encrypt?.encryptionPredicate && !encrypt?.encryptionPredicate(entity)) &&
mode === 'regular' &&
(encrypt.looseMatching || entity.constructor === target)
) {
Expand All @@ -45,12 +42,9 @@ export function decrypt<T extends ObjectLiteral>(entity: any): any {
let { propertyName, mode, target } = columnMetadata;
let options: ExtendedColumnOptions = columnMetadata.options;
let encrypt = options.encrypt;
if (encrypt?.encryptionPredicate && !encrypt?.encryptionPredicate(entity)) {
continue;
}
if (
encrypt &&
mode === 'regular' &&
encrypt && !(encrypt?.encryptionPredicate && !encrypt?.encryptionPredicate(entity)) &&
mode === "regular" &&
(encrypt.looseMatching || entity.constructor === target)
) {
if (entity[propertyName]) {
Expand Down

0 comments on commit c22b2d7

Please sign in to comment.