Skip to content

Commit 031fc4f

Browse files
committed
Remove unused depth variable
1 parent d6d8979 commit 031fc4f

File tree

2 files changed

+4
-27
lines changed

2 files changed

+4
-27
lines changed

src/bson.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ export function serialize(object: Document, options: SerializeOptions = {}): Uin
108108
object,
109109
checkKeys,
110110
0,
111-
0,
112111
serializeFunctions,
113112
ignoreUndefined,
114113
null
@@ -152,7 +151,6 @@ export function serializeWithBufferAndIndex(
152151
object,
153152
checkKeys,
154153
0,
155-
0,
156154
serializeFunctions,
157155
ignoreUndefined,
158156
null

src/parser/serializer.ts

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ function serializeObject(
297297
value: Document,
298298
index: number,
299299
checkKeys: boolean,
300-
depth: number,
301300
serializeFunctions: boolean,
302301
ignoreUndefined: boolean,
303302
path: Set<Document>
@@ -320,7 +319,6 @@ function serializeObject(
320319
value,
321320
checkKeys,
322321
index,
323-
depth + 1,
324322
serializeFunctions,
325323
ignoreUndefined,
326324
path
@@ -435,7 +433,6 @@ function serializeCode(
435433
value: Code,
436434
index: number,
437435
checkKeys = false,
438-
depth = 0,
439436
serializeFunctions = false,
440437
ignoreUndefined = true,
441438
path: Set<Document>
@@ -475,7 +472,6 @@ function serializeCode(
475472
value.scope,
476473
checkKeys,
477474
index,
478-
depth + 1,
479475
serializeFunctions,
480476
ignoreUndefined,
481477
path
@@ -582,7 +578,6 @@ function serializeDBRef(
582578
key: string,
583579
value: DBRef,
584580
index: number,
585-
depth: number,
586581
serializeFunctions: boolean,
587582
path: Set<Document>
588583
) {
@@ -606,16 +601,7 @@ function serializeDBRef(
606601
}
607602

608603
output = Object.assign(output, value.fields);
609-
const endIndex = serializeInto(
610-
buffer,
611-
output,
612-
false,
613-
index,
614-
depth + 1,
615-
serializeFunctions,
616-
true,
617-
path
618-
);
604+
const endIndex = serializeInto(buffer, output, false, index, serializeFunctions, true, path);
619605

620606
// Calculate object size
621607
const size = endIndex - startIndex;
@@ -633,7 +619,6 @@ export function serializeInto(
633619
object: Document,
634620
checkKeys: boolean,
635621
startingIndex: number,
636-
depth: number,
637622
serializeFunctions: boolean,
638623
ignoreUndefined: boolean,
639624
path: Set<Document> | null
@@ -714,7 +699,6 @@ export function serializeInto(
714699
value,
715700
index,
716701
checkKeys,
717-
depth,
718702
serializeFunctions,
719703
ignoreUndefined,
720704
path
@@ -741,7 +725,6 @@ export function serializeInto(
741725
value,
742726
index,
743727
checkKeys,
744-
depth,
745728
serializeFunctions,
746729
ignoreUndefined,
747730
path
@@ -751,7 +734,7 @@ export function serializeInto(
751734
} else if (value._bsontype === 'BSONSymbol') {
752735
index = serializeSymbol(buffer, key, value, index);
753736
} else if (value._bsontype === 'DBRef') {
754-
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
737+
index = serializeDBRef(buffer, key, value, index, serializeFunctions, path);
755738
} else if (value._bsontype === 'BSONRegExp') {
756739
index = serializeBSONRegExp(buffer, key, value, index);
757740
} else if (value._bsontype === 'Int32') {
@@ -824,7 +807,6 @@ export function serializeInto(
824807
value,
825808
index,
826809
checkKeys,
827-
depth,
828810
serializeFunctions,
829811
ignoreUndefined,
830812
path
@@ -849,7 +831,6 @@ export function serializeInto(
849831
value,
850832
index,
851833
checkKeys,
852-
depth,
853834
serializeFunctions,
854835
ignoreUndefined,
855836
path
@@ -861,7 +842,7 @@ export function serializeInto(
861842
} else if (value._bsontype === 'BSONSymbol') {
862843
index = serializeSymbol(buffer, key, value, index);
863844
} else if (value._bsontype === 'DBRef') {
864-
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
845+
index = serializeDBRef(buffer, key, value, index, serializeFunctions, path);
865846
} else if (value._bsontype === 'BSONRegExp') {
866847
index = serializeBSONRegExp(buffer, key, value, index);
867848
} else if (value._bsontype === 'Int32') {
@@ -934,7 +915,6 @@ export function serializeInto(
934915
value,
935916
index,
936917
checkKeys,
937-
depth,
938918
serializeFunctions,
939919
ignoreUndefined,
940920
path
@@ -959,7 +939,6 @@ export function serializeInto(
959939
value,
960940
index,
961941
checkKeys,
962-
depth,
963942
serializeFunctions,
964943
ignoreUndefined,
965944
path
@@ -971,7 +950,7 @@ export function serializeInto(
971950
} else if (value._bsontype === 'BSONSymbol') {
972951
index = serializeSymbol(buffer, key, value, index);
973952
} else if (value._bsontype === 'DBRef') {
974-
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
953+
index = serializeDBRef(buffer, key, value, index, serializeFunctions, path);
975954
} else if (value._bsontype === 'BSONRegExp') {
976955
index = serializeBSONRegExp(buffer, key, value, index);
977956
} else if (value._bsontype === 'Int32') {

0 commit comments

Comments
 (0)