Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove warning when parseDateFields reaches depth limit #521

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Readable } from 'node:stream';
import util from 'util';
import zlib from 'zlib';

import log from '@apify/log';
import ow from 'ow';
import type { TypedArray, JsonValue } from 'type-fest';

Expand Down Expand Up @@ -62,8 +61,8 @@ type ReturnJsonArray = Array<ReturnJsonValue>;
export function parseDateFields(input: JsonValue, shouldParseField: ((key: string) => boolean) | null = null, depth = 0): ReturnJsonValue {
// Don't go too deep to avoid stack overflows (especially if there is a circular reference). The depth of 3
// corresponds to obj.data.someArrayField.[x].field and should be generally enough.
// TODO: Consider removing this limitation. It might came across as an annoying surprise as it's not communicated.
if (depth > 3) {
log.warning('parseDateFields: Maximum depth reached, not parsing further');
return input as ReturnJsonValue;
}

Expand Down