aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Michael Lumish <mlumish@google.com>2016-11-14 14:18:40 -0800
committerGravatar GitHub <noreply@github.com>2016-11-14 14:18:40 -0800
commit7466ae732e15c84ae5336c0c907d8584ef450487 (patch)
treeca86d6a66ccc2dbe745a76fc4dcf84b6a7bd3e3c
parent7d46b94bb54c23db3132d9bdf6b572899c04ac85 (diff)
parent9ea40c58f07b84bb6042962d162661a463d1a3d4 (diff)
Merge pull request #8746 from murgatroid99/node_lodash_compat
Make Node library compatible with lodash 3
-rw-r--r--src/node/src/common.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/node/src/common.js b/src/node/src/common.js
index c6c6d597a8..98eabf5c0b 100644
--- a/src/node/src/common.js
+++ b/src/node/src/common.js
@@ -141,8 +141,14 @@ exports.getProtobufServiceAttrs = function getProtobufServiceAttrs(service,
binaryAsBase64 = options.binaryAsBase64;
longsAsStrings = options.longsAsStrings;
}
- return _.fromPairs(_.map(service.children, function(method) {
- return [_.camelCase(method.name), {
+ /* This slightly awkward construction is used to make sure we only use
+ lodash@3.10.1-compatible functions. A previous version used
+ _.fromPairs, which would be cleaner, but was introduced in lodash
+ version 4 */
+ return _.zipObject(_.map(service.children, function(method) {
+ return _.camelCase(method.name);
+ }), _.map(service.children, function(method) {
+ return {
path: prefix + method.name,
requestStream: method.requestStream,
responseStream: method.responseStream,
@@ -150,11 +156,11 @@ exports.getProtobufServiceAttrs = function getProtobufServiceAttrs(service,
responseType: method.resolvedResponseType,
requestSerialize: serializeCls(method.resolvedRequestType.build()),
requestDeserialize: deserializeCls(method.resolvedRequestType.build(),
- binaryAsBase64, longsAsStrings),
+ binaryAsBase64, longsAsStrings),
responseSerialize: serializeCls(method.resolvedResponseType.build()),
responseDeserialize: deserializeCls(method.resolvedResponseType.build(),
- binaryAsBase64, longsAsStrings)
- }];
+ binaryAsBase64, longsAsStrings)
+ };
}));
};