Skip to content

Commit ebb4ad9

Browse files
committed
Hoist constant array
1 parent 744c777 commit ebb4ad9

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/transform.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,21 @@ function transformUpdateOperator(operator, flatten) {
612612
}
613613
}
614614

615+
const specialKeysForUntransform = [
616+
'_id',
617+
'_hashed_password',
618+
'_acl',
619+
'_email_verify_token',
620+
'_perishable_token',
621+
'_tombstone',
622+
'_session_token',
623+
'updatedAt',
624+
'_updated_at',
625+
'createdAt',
626+
'_created_at',
627+
'expiresAt',
628+
'_expiresAt',
629+
];
615630

616631
// Converts from a mongo-format object to a REST-format object.
617632
// Does not strip out anything based on a lack of authentication.
@@ -645,22 +660,7 @@ function untransformObject(schema, className, mongoObject, isNestedObject = fals
645660

646661
var restObject = untransformACL(mongoObject);
647662
for (var key in mongoObject) {
648-
const specialKeys = [
649-
'_id',
650-
'_hashed_password',
651-
'_acl',
652-
'_email_verify_token',
653-
'_perishable_token',
654-
'_tombstone',
655-
'_session_token',
656-
'updatedAt',
657-
'_updated_at',
658-
'createdAt',
659-
'_created_at',
660-
'expiresAt',
661-
'_expiresAt',
662-
];
663-
if (isNestedObject && _.includes(specialKeys, key)) {
663+
if (isNestedObject && _.includes(specialKeysForUntransform, key)) {
664664
restObject[key] = untransformObject(schema, className, mongoObject[key], true);
665665
continue;
666666
}

0 commit comments

Comments
 (0)