Merge pull request #678 from murgatroid99/native_protojs6_each_fix2

Native: Protobuf.js 6: use nested again
This commit is contained in:
Nicolas Noble 2018-12-11 14:34:47 -08:00 committed by GitHub
commit 07c7ac4532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -135,11 +135,13 @@ exports.loadObject = function loadObject(value, options) {
return client.makeClientConstructor(service_attrs);
}
if (value.hasOwnProperty('nestedArray')) {
if (value.hasOwnProperty('nested')) {
// It's a namespace or root object
value.nestedArray.forEach(nested => {
result[nested.name] = loadObject(nested, options);
});
if (value.nested !== null && value.nested !== undefined) {
Object.values(value.nested).forEach(nested => {
result[nested.name] = loadObject(nested, options);
});
}
return result;
}