Skip to content

Commit

Permalink
Remove unused depth variable
Browse files Browse the repository at this point in the history
  • Loading branch information
billouboq committed Aug 24, 2023
1 parent d6d8979 commit 031fc4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 27 deletions.
2 changes: 0 additions & 2 deletions src/bson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export function serialize(object: Document, options: SerializeOptions = {}): Uin
object,
checkKeys,
0,
0,
serializeFunctions,
ignoreUndefined,
null
Expand Down Expand Up @@ -152,7 +151,6 @@ export function serializeWithBufferAndIndex(
object,
checkKeys,
0,
0,
serializeFunctions,
ignoreUndefined,
null
Expand Down
29 changes: 4 additions & 25 deletions src/parser/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ function serializeObject(
value: Document,
index: number,
checkKeys: boolean,
depth: number,
serializeFunctions: boolean,
ignoreUndefined: boolean,
path: Set<Document>
Expand All @@ -320,7 +319,6 @@ function serializeObject(
value,
checkKeys,
index,
depth + 1,
serializeFunctions,
ignoreUndefined,
path
Expand Down Expand Up @@ -435,7 +433,6 @@ function serializeCode(
value: Code,
index: number,
checkKeys = false,
depth = 0,
serializeFunctions = false,
ignoreUndefined = true,
path: Set<Document>
Expand Down Expand Up @@ -475,7 +472,6 @@ function serializeCode(
value.scope,
checkKeys,
index,
depth + 1,
serializeFunctions,
ignoreUndefined,
path
Expand Down Expand Up @@ -582,7 +578,6 @@ function serializeDBRef(
key: string,
value: DBRef,
index: number,
depth: number,
serializeFunctions: boolean,
path: Set<Document>
) {
Expand All @@ -606,16 +601,7 @@ function serializeDBRef(
}

output = Object.assign(output, value.fields);
const endIndex = serializeInto(
buffer,
output,
false,
index,
depth + 1,
serializeFunctions,
true,
path
);
const endIndex = serializeInto(buffer, output, false, index, serializeFunctions, true, path);

// Calculate object size
const size = endIndex - startIndex;
Expand All @@ -633,7 +619,6 @@ export function serializeInto(
object: Document,
checkKeys: boolean,
startingIndex: number,
depth: number,
serializeFunctions: boolean,
ignoreUndefined: boolean,
path: Set<Document> | null
Expand Down Expand Up @@ -714,7 +699,6 @@ export function serializeInto(
value,
index,
checkKeys,
depth,
serializeFunctions,
ignoreUndefined,
path
Expand All @@ -741,7 +725,6 @@ export function serializeInto(
value,
index,
checkKeys,
depth,
serializeFunctions,
ignoreUndefined,
path
Expand All @@ -751,7 +734,7 @@ export function serializeInto(
} else if (value._bsontype === 'BSONSymbol') {
index = serializeSymbol(buffer, key, value, index);
} else if (value._bsontype === 'DBRef') {
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
index = serializeDBRef(buffer, key, value, index, serializeFunctions, path);
} else if (value._bsontype === 'BSONRegExp') {
index = serializeBSONRegExp(buffer, key, value, index);
} else if (value._bsontype === 'Int32') {
Expand Down Expand Up @@ -824,7 +807,6 @@ export function serializeInto(
value,
index,
checkKeys,
depth,
serializeFunctions,
ignoreUndefined,
path
Expand All @@ -849,7 +831,6 @@ export function serializeInto(
value,
index,
checkKeys,
depth,
serializeFunctions,
ignoreUndefined,
path
Expand All @@ -861,7 +842,7 @@ export function serializeInto(
} else if (value._bsontype === 'BSONSymbol') {
index = serializeSymbol(buffer, key, value, index);
} else if (value._bsontype === 'DBRef') {
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
index = serializeDBRef(buffer, key, value, index, serializeFunctions, path);
} else if (value._bsontype === 'BSONRegExp') {
index = serializeBSONRegExp(buffer, key, value, index);
} else if (value._bsontype === 'Int32') {
Expand Down Expand Up @@ -934,7 +915,6 @@ export function serializeInto(
value,
index,
checkKeys,
depth,
serializeFunctions,
ignoreUndefined,
path
Expand All @@ -959,7 +939,6 @@ export function serializeInto(
value,
index,
checkKeys,
depth,
serializeFunctions,
ignoreUndefined,
path
Expand All @@ -971,7 +950,7 @@ export function serializeInto(
} else if (value._bsontype === 'BSONSymbol') {
index = serializeSymbol(buffer, key, value, index);
} else if (value._bsontype === 'DBRef') {
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
index = serializeDBRef(buffer, key, value, index, serializeFunctions, path);
} else if (value._bsontype === 'BSONRegExp') {
index = serializeBSONRegExp(buffer, key, value, index);
} else if (value._bsontype === 'Int32') {
Expand Down

0 comments on commit 031fc4f

Please sign in to comment.