Skip to content

Commit

Permalink
Merge branch 'release/v0.25.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Oct 17, 2024
2 parents 396a969 + d91b4c3 commit 020153a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 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.24.23",
"version": "0.25.0",
"description": "🌱 Simple foundation library",
"author": {
"name": "Dirk Holtwick",
Expand Down
26 changes: 25 additions & 1 deletion src/common/data/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,37 @@ export function objectPlain(obj: any, opt?: {
if (obj instanceof Set || isBinaryArray(obj))
obj = Array.from(obj as any)

if (typeof ErrorEvent !== 'undefined' && obj instanceof ErrorEvent) {
return {
__class: 'ErrorEvent',
message: obj.message,
filename: obj.filename,
lineno: obj.lineno,
colno: obj.colno,
error: obj.error ? handleObject(obj.error, depth + 1) : undefined,
}
}

if (obj instanceof Event) {
return {
__class: 'Event',
type: obj.type,
eventPhase: obj.eventPhase,
bubbles: obj.bubbles,
cancelable: obj.cancelable,
defaultPrevented: obj.defaultPrevented,
composed: obj.composed,
timeStamp: obj.timeStamp,
}
}

if (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 020153a

Please sign in to comment.