Skip to content

Commit

Permalink
Merge branch 'release/v0.26.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Nov 8, 2024
2 parents c30c05f + d5392d1 commit 985fda2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zeed",
"type": "module",
"version": "0.26.0",
"version": "0.26.1",
"description": "🌱 Simple foundation library",
"author": {
"name": "Dirk Holtwick",
Expand Down
16 changes: 8 additions & 8 deletions src/common/data/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,24 @@ export function objectPlain(obj: any, opt?: {
if (isPrimitive(obj))
return obj

if (obj instanceof Date) {
if (typeof Date !== 'undefined' && obj instanceof Date) {
return {
__class: 'Date',
value: obj.toISOString(),
}
}

if (obj instanceof RegExp) {
if (typeof RegExp !== 'undefined' && obj instanceof RegExp) {
return {
__class: 'RegExp',
source: obj.toString(),
}
}

if (obj instanceof Map)
if (typeof Map !== 'undefined' && obj instanceof Map)
obj = Object.fromEntries(obj)

if (obj instanceof Set || isBinaryArray(obj))
if (typeof Set !== 'undefined' && obj instanceof Set || isBinaryArray(obj))
obj = Array.from(obj as any)

if (typeof ErrorEvent !== 'undefined' && obj instanceof ErrorEvent) {
Expand All @@ -141,7 +141,7 @@ export function objectPlain(obj: any, opt?: {
}
}

if (obj instanceof Event) {
if (typeof Event !== 'undefined' && obj instanceof Event) {
return {
__class: 'Event',
type: obj.type,
Expand All @@ -150,17 +150,17 @@ export function objectPlain(obj: any, opt?: {
cancelable: obj.cancelable,
defaultPrevented: obj.defaultPrevented,
composed: obj.composed,
timeStamp: obj.timeStamp,
timeStamp: obj.timeStamp,
}
}

if (obj instanceof Error) {
if (typeof Error !== 'undefined' && obj instanceof Error) {
return {
__class: 'Error',
name: obj.name,
message: obj.message,
stack: errorTrace ? obj.stack : undefined,
cause: (obj as any).cause ? String((obj as any).cause) : undefined,
cause: (obj as any).cause ? String((obj as any).cause) : undefined,
}
}
// return `${obj.name || 'Error'}: ${obj.message}${errorTrace ? `\n${obj.stack}` : ''}`
Expand Down

0 comments on commit 985fda2

Please sign in to comment.