Skip to content

Commit b1aa325

Browse files
author
A-yon Lee
committed
rebuild
1 parent 82bea36 commit b1aa325

17 files changed

Lines changed: 97 additions & 32 deletions

bundle/jsext.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/jsext.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/worker-node.mjs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -870,17 +870,20 @@ function toObject(err) {
870870
"@@type": err.constructor.name,
871871
...omit(err, ["toString", "toJSON", "__callSiteEvals"]),
872872
};
873+
if ("cause" in obj) {
874+
obj["cause"] = obj["cause"] instanceof Error ? toObject(obj["cause"]) : obj["cause"];
875+
}
873876
if (obj["@@type"] === "AggregateError" && Array.isArray(obj["errors"])) {
874877
obj["errors"] = obj["errors"].map(item => {
875878
return item instanceof Error ? toObject(item) : item;
876879
});
877880
}
878881
return obj;
879882
}
880-
function fromObject(obj, ctor = undefined) {
881-
var _a, _b, _c;
883+
function fromObject(obj, ctor = null, strict = false) {
884+
var _a, _b, _c, _d;
882885
// @ts-ignore
883-
if (!(obj === null || obj === void 0 ? void 0 : obj.name)) {
886+
if (!(obj === null || obj === void 0 ? void 0 : obj.name) || (strict && !obj["@@type"])) {
884887
return null;
885888
}
886889
// @ts-ignore
@@ -920,7 +923,9 @@ function fromObject(obj, ctor = undefined) {
920923
configurable: true,
921924
enumerable: false,
922925
writable: true,
923-
value: obj["cause"],
926+
value: isPlainObject(obj["cause"])
927+
? ((_d = fromObject(obj["cause"], undefined, true)) !== null && _d !== void 0 ? _d : obj["cause"])
928+
: obj["cause"],
924929
});
925930
}
926931
const otherKeys = Reflect.ownKeys(obj).filter(key => ![

bundle/worker.mjs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -868,17 +868,20 @@ function toObject(err) {
868868
"@@type": err.constructor.name,
869869
...omit(err, ["toString", "toJSON", "__callSiteEvals"]),
870870
};
871+
if ("cause" in obj) {
872+
obj["cause"] = obj["cause"] instanceof Error ? toObject(obj["cause"]) : obj["cause"];
873+
}
871874
if (obj["@@type"] === "AggregateError" && Array.isArray(obj["errors"])) {
872875
obj["errors"] = obj["errors"].map(item => {
873876
return item instanceof Error ? toObject(item) : item;
874877
});
875878
}
876879
return obj;
877880
}
878-
function fromObject(obj, ctor = undefined) {
879-
var _a, _b, _c;
881+
function fromObject(obj, ctor = null, strict = false) {
882+
var _a, _b, _c, _d;
880883
// @ts-ignore
881-
if (!(obj === null || obj === void 0 ? void 0 : obj.name)) {
884+
if (!(obj === null || obj === void 0 ? void 0 : obj.name) || (strict && !obj["@@type"])) {
882885
return null;
883886
}
884887
// @ts-ignore
@@ -918,7 +921,9 @@ function fromObject(obj, ctor = undefined) {
918921
configurable: true,
919922
enumerable: false,
920923
writable: true,
921-
value: obj["cause"],
924+
value: isPlainObject(obj["cause"])
925+
? ((_d = fromObject(obj["cause"], undefined, true)) !== null && _d !== void 0 ? _d : obj["cause"])
926+
: obj["cause"],
922927
});
923928
}
924929
const otherKeys = Reflect.ownKeys(obj).filter(key => ![

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ayonli/jsext",
3-
"version": "1.7.4",
3+
"version": "1.8.0",
44
"exports": {
55
".": "./index.ts",
66
"./archive": "./archive.ts",

esm/array.js

Lines changed: 28 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esm/array.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esm/augment/array.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esm/augment/array.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esm/augment/number.js

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)