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

pre-release cleanup #428

Merged
merged 9 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
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: 0 additions & 8 deletions .travis.yml

This file was deleted.

16 changes: 0 additions & 16 deletions Dockerfile

This file was deleted.

14 changes: 0 additions & 14 deletions docker-compose.yml

This file was deleted.

11 changes: 5 additions & 6 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@ const safeArrayToString = (
return mapped.join()
}

const safeToStringImpl = (
val: unknown,
seenArrays?: WeakSet<object>,
): string => {
const safeToStringImpl = (val: unknown, seenArrays = new WeakSet()): string => {
// Using .toString() fails for null/undefined and implicit conversion (val + "") fails for symbols
// and objects with null prototype
if (val === undefined || val === null || typeof val.toString === 'function') {
if (typeof val !== 'object' || val === null) {
return String(val)
} else if (typeof val.toString === 'function') {
return Array.isArray(val)
? // Arrays have a weird custom toString that we need to replicate
safeArrayToString(val, seenArrays ?? new WeakSet())
safeArrayToString(val, seenArrays)
: String(val)
} else {
// This case should just be objects with null prototype, so we can just use Object#toString
Expand Down
Loading