Skip to content

Commit b91db2b

Browse files
committed
refactor: remove unnecessary variable re: code review comments
1 parent 16ae35d commit b91db2b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/helpers/schema/getPath.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ module.exports = function getPath(schema, path, discriminatorValueMap) {
2626
schematype = schema.path(cur);
2727
if (schematype != null && schematype.schema) {
2828
schema = schematype.schema;
29-
const currentPath = cur;
30-
cur = '';
3129
if (!isArray && schematype.$isMongooseDocumentArray) {
3230
isArray = true;
3331
}
34-
if (discriminatorValueMap && discriminatorValueMap[currentPath]) {
35-
schema = schema.discriminators[discriminatorValueMap[currentPath]] ?? schema;
32+
if (discriminatorValueMap && discriminatorValueMap[cur]) {
33+
schema = schema.discriminators[discriminatorValueMap[cur]] ?? schema;
3634
}
35+
cur = '';
3736
}
3837
}
3938

0 commit comments

Comments
 (0)