@dxos/codec-protobuf
Advanced tools
Comparing version 1.1.0-beta.5 to 1.1.0-beta.6
@@ -199,3 +199,3 @@ "use strict"; | ||
const object = this._iterate(value, value => { | ||
const object = this._iterate(type, value, null, (value, parentProp) => { | ||
if (!value.__type_url) { | ||
@@ -205,2 +205,6 @@ return; | ||
if (type.fields[parentProp].type !== 'google.protobuf.Any') { | ||
throw new Error(`Invalid __type_url for a non google.protobuf.Any: ${type.name}.${parentProp}`); | ||
} | ||
const { | ||
@@ -288,3 +292,3 @@ __type_url: typeUrl, | ||
const object = this._iterate(value, value => { | ||
const object = this._iterate(type, value, null, value => { | ||
// Test if already decoded. | ||
@@ -323,3 +327,3 @@ if (value.__type_url) { | ||
_iterate(value, callback) { | ||
_iterate(type, value, parentProp, callback) { | ||
if (typeof value !== 'object') return value; | ||
@@ -331,3 +335,3 @@ let tmp; | ||
if (str === '[object Object]') { | ||
const result = callback(value); | ||
const result = callback(value, parentProp); | ||
@@ -341,3 +345,3 @@ if (result) { | ||
for (prop in value) { | ||
tmp[prop] = this._iterate(value[prop], callback); | ||
tmp[prop] = this._iterate(type, value[prop], prop, callback); | ||
} | ||
@@ -352,3 +356,3 @@ | ||
for (tmp = new Array(prop); prop--;) { | ||
tmp[prop] = this._iterate(value[prop], callback); | ||
tmp[prop] = this._iterate(type, value[prop], parentProp, callback); | ||
} | ||
@@ -355,0 +359,0 @@ |
{ | ||
"name": "@dxos/codec-protobuf", | ||
"version": "1.1.0-beta.5", | ||
"version": "1.1.0-beta.6", | ||
"description": "Value encoding for protobuf.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/dxos/codec-protobuf#readme", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62328
309