Skip to content
Closed
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
8 changes: 6 additions & 2 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ const getPlatformProperties = (): PlatformProperties => {
'X-Stainless-Arch': normalizeArch(Deno.build.arch),
'X-Stainless-Runtime': 'deno',
'X-Stainless-Runtime-Version':
typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown',
typeof Deno.version === 'string' ? Deno.version : (Deno.version?.deno ?? 'unknown'),
};
}
if (typeof EdgeRuntime !== 'undefined') {
Expand Down Expand Up @@ -1139,7 +1139,11 @@ function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void {
}

export function debug(action: string, ...args: any[]) {
if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') {
if (
typeof process !== 'undefined' &&
typeof process?.env?.['OPENAI_DISABLE_DEBUG'] !== 'string' &&
process?.env?.['DEBUG'] === 'true'
) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify the condition by avoiding redundant optional chaining (?.) on process.env.

if (
  typeof process !== 'undefined' &&
  process?.env && 
  typeof process.env['OPENAI_DISABLE_DEBUG'] !== 'string' &&
  process.env['DEBUG'] === 'true'
) {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could!

However, I won't be making any more changes until I hear from a collaborator on whether or not this PR or a change like it would be merged.

Thanks

console.log(`OpenAI:DEBUG:${action}`, ...args);
}
}
Expand Down