+4
-0
| # Changelog | ||
| ## 0.3.8 (2022-07-07) | ||
| - Allow errors to contain unserializable types such as functions | ||
| ## 0.3.7 (2021-05-20) | ||
@@ -4,0 +8,0 @@ |
+12
-6
@@ -173,6 +173,10 @@ 'use strict'; | ||
| function unpackData(table, data, path) { | ||
| function unpackData(table, data, path, supress) { | ||
| if (supress === void 0) { | ||
| supress = false; | ||
| } | ||
| var map = data.map, | ||
| raw = data.raw; | ||
| var out = map != null ? unpackItem(table, map, raw, path) : raw; | ||
| var out = map != null ? unpackItem(table, map, raw, path, supress) : raw; | ||
| if (data["throw"]) throw out; | ||
@@ -350,3 +354,3 @@ return out; | ||
| var props = unpackData(table, value, path); | ||
| var props = unpackData(table, value, path, true); | ||
@@ -364,3 +368,3 @@ for (var n in props) { | ||
| function unpackItem(table, map, raw, path) { | ||
| function unpackItem(table, map, raw, path, supress) { | ||
| switch (map) { | ||
@@ -449,3 +453,4 @@ case '': | ||
| for (var i = 0; i < map.length; ++i) { | ||
| _out3[i] = unpackItem(table, map[i], raw[i], path + "[" + i + "]"); | ||
| if (supress === true && map[i] === '?') continue; | ||
| _out3[i] = unpackItem(table, map[i], raw[i], path + "[" + i + "]", supress); | ||
| } | ||
@@ -460,3 +465,4 @@ | ||
| for (var n in raw) { | ||
| out[n] = n in map ? unpackItem(table, map[n], raw[n], path + "." + n) : raw[n]; | ||
| if (supress === true && map[n] === '?') continue; | ||
| out[n] = n in map ? unpackItem(table, map[n], raw[n], path + "." + n, supress) : raw[n]; | ||
| } | ||
@@ -463,0 +469,0 @@ |
+12
-6
@@ -169,6 +169,10 @@ import { base64 } from 'rfc4648'; | ||
| function unpackData(table, data, path) { | ||
| function unpackData(table, data, path, supress) { | ||
| if (supress === void 0) { | ||
| supress = false; | ||
| } | ||
| var map = data.map, | ||
| raw = data.raw; | ||
| var out = map != null ? unpackItem(table, map, raw, path) : raw; | ||
| var out = map != null ? unpackItem(table, map, raw, path, supress) : raw; | ||
| if (data["throw"]) throw out; | ||
@@ -346,3 +350,3 @@ return out; | ||
| var props = unpackData(table, value, path); | ||
| var props = unpackData(table, value, path, true); | ||
@@ -360,3 +364,3 @@ for (var n in props) { | ||
| function unpackItem(table, map, raw, path) { | ||
| function unpackItem(table, map, raw, path, supress) { | ||
| switch (map) { | ||
@@ -445,3 +449,4 @@ case '': | ||
| for (var i = 0; i < map.length; ++i) { | ||
| _out3[i] = unpackItem(table, map[i], raw[i], path + "[" + i + "]"); | ||
| if (supress === true && map[i] === '?') continue; | ||
| _out3[i] = unpackItem(table, map[i], raw[i], path + "[" + i + "]", supress); | ||
| } | ||
@@ -456,3 +461,4 @@ | ||
| for (var n in raw) { | ||
| out[n] = n in map ? unpackItem(table, map[n], raw[n], path + "." + n) : raw[n]; | ||
| if (supress === true && map[n] === '?') continue; | ||
| out[n] = n in map ? unpackItem(table, map[n], raw[n], path + "." + n, supress) : raw[n]; | ||
| } | ||
@@ -459,0 +465,0 @@ |
+1
-1
| { | ||
| "name": "yaob", | ||
| "version": "0.3.7", | ||
| "version": "0.3.8", | ||
| "description": "Bridges an object-oriented API across a messaging layer", | ||
@@ -5,0 +5,0 @@ "repository": { |
+12
-6
@@ -99,6 +99,7 @@ // @flow | ||
| data: PackedData, | ||
| path: string | ||
| path: string, | ||
| supress: boolean = false | ||
| ): any { | ||
| const { map, raw } = data | ||
| const out = map != null ? unpackItem(table, map, raw, path) : raw | ||
| const out = map != null ? unpackItem(table, map, raw, path, supress) : raw | ||
| if (data.throw) throw out | ||
@@ -263,3 +264,3 @@ return out | ||
| // Restore the properties: | ||
| const props = unpackData(table, value, path) | ||
| const props = unpackData(table, value, path, true) | ||
| for (const n in props) out[n] = props[n] | ||
@@ -277,3 +278,4 @@ | ||
| raw: any, | ||
| path: string | ||
| path: string, | ||
| supress: boolean | ||
| ): any { | ||
@@ -349,3 +351,4 @@ switch (map) { | ||
| for (let i = 0; i < map.length; ++i) { | ||
| out[i] = unpackItem(table, map[i], raw[i], `${path}[${i}]`) | ||
| if (supress === true && map[i] === '?') continue | ||
| out[i] = unpackItem(table, map[i], raw[i], `${path}[${i}]`, supress) | ||
| } | ||
@@ -358,4 +361,7 @@ return out | ||
| for (const n in raw) { | ||
| if (supress === true && map[n] === '?') continue | ||
| out[n] = | ||
| n in map ? unpackItem(table, map[n], raw[n], `${path}.${n}`) : raw[n] | ||
| n in map | ||
| ? unpackItem(table, map[n], raw[n], `${path}.${n}`, supress) | ||
| : raw[n] | ||
| } | ||
@@ -362,0 +368,0 @@ return out |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
253289
0.71%3406
0.47%