Merge pull request #1892 from murgatroid99/node_use_lodash

Replaced underscore and underscore.string modules with lodash
pull/1901/head
Tim Emiola 10 years ago
commit a1a1f3478a
  1. 2
      src/node/cli/service_packager.js
  2. 2
      src/node/examples/perf_test.js
  3. 2
      src/node/examples/route_guide_client.js
  4. 2
      src/node/examples/route_guide_server.js
  5. 2
      src/node/examples/stock_server.js
  6. 2
      src/node/index.js
  7. 2
      src/node/interop/interop_client.js
  8. 2
      src/node/interop/interop_server.js
  9. 5
      src/node/package.json
  10. 2
      src/node/src/client.js
  11. 11
      src/node/src/common.js
  12. 4
      src/node/src/server.js
  13. 6
      src/node/test/surface_test.js

@ -36,7 +36,7 @@
var fs = require('fs');
var path = require('path');
var _ = require('underscore');
var _ = require('lodash');
var async = require('async');
var pbjs = require('protobufjs/cli/pbjs');
var parseArgs = require('minimist');

@ -35,7 +35,7 @@
var grpc = require('..');
var testProto = grpc.load(__dirname + '/../interop/test.proto').grpc.testing;
var _ = require('underscore');
var _ = require('lodash');
var interop_server = require('../interop/interop_server.js');
function runTest(iterations, callback) {

@ -37,7 +37,7 @@ var async = require('async');
var fs = require('fs');
var parseArgs = require('minimist');
var path = require('path');
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('..');
var examples = grpc.load(__dirname + '/route_guide.proto').examples;
var client = new examples.RouteGuide('localhost:50051');

@ -36,7 +36,7 @@
var fs = require('fs');
var parseArgs = require('minimist');
var path = require('path');
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('..');
var examples = grpc.load(__dirname + '/route_guide.proto').examples;

@ -33,7 +33,7 @@
'use strict';
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('..');
var examples = grpc.load(__dirname + '/stock.proto').examples;

@ -33,7 +33,7 @@
'use strict';
var _ = require('underscore');
var _ = require('lodash');
var ProtoBuf = require('protobufjs');

@ -35,7 +35,7 @@
var fs = require('fs');
var path = require('path');
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('..');
var testProto = grpc.load(__dirname + '/test.proto').grpc.testing;
var GoogleAuth = require('google-auth-library');

@ -35,7 +35,7 @@
var fs = require('fs');
var path = require('path');
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('..');
var testProto = grpc.load(__dirname + '/test.proto').grpc.testing;
var Server = grpc.buildServer([testProto.TestService.service]);

@ -25,10 +25,9 @@
},
"dependencies": {
"bindings": "^1.2.0",
"lodash": "^3.9.3",
"nan": "^1.5.0",
"protobufjs": "dcodeIO/ProtoBuf.js",
"underscore": "^1.6.0",
"underscore.string": "^3.0.0"
"protobufjs": "dcodeIO/ProtoBuf.js"
},
"devDependencies": {
"async": "^0.9.0",

@ -33,7 +33,7 @@
'use strict';
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('bindings')('grpc.node');

@ -33,10 +33,7 @@
'use strict';
var _ = require('underscore');
var capitalize = require('underscore.string/capitalize');
var decapitalize = require('underscore.string/decapitalize');
var _ = require('lodash');
/**
* Get a function that deserializes a specific type of protobuf.
@ -81,7 +78,7 @@ function fullyQualifiedName(value) {
}
var name = value.name;
if (value.className === 'Service.RPCMethod') {
name = capitalize(name);
name = _.capitalize(name);
}
if (value.hasOwnProperty('parent')) {
var parent_name = fullyQualifiedName(value.parent);
@ -118,8 +115,8 @@ function wrapIgnoreNull(func) {
function getProtobufServiceAttrs(service) {
var prefix = '/' + fullyQualifiedName(service) + '/';
return _.object(_.map(service.children, function(method) {
return [decapitalize(method.name), {
path: prefix + capitalize(method.name),
return [_.camelCase(method.name), {
path: prefix + _.capitalize(method.name),
requestStream: method.requestStream,
responseStream: method.responseStream,
requestSerialize: serializeCls(method.resolvedRequestType.build()),

@ -33,7 +33,7 @@
'use strict';
var _ = require('underscore');
var _ = require('lodash');
var grpc = require('bindings')('grpc.node');
@ -48,8 +48,6 @@ var util = require('util');
var EventEmitter = require('events').EventEmitter;
var common = require('./common.js');
/**
* Handle an error on a call by sending it as a status
* @param {grpc.Call} call The call to send the error on

@ -45,9 +45,7 @@ var math_proto = ProtoBuf.loadProtoFile(__dirname + '/../examples/math.proto');
var mathService = math_proto.lookup('math.Math');
var capitalize = require('underscore.string/capitalize');
var _ = require('underscore');
var _ = require('lodash');
describe('File loader', function() {
it('Should load a proto file by default', function() {
@ -159,7 +157,7 @@ describe('Generic client and server', function() {
server = new Server({
string: {
capitalize: function(call, callback) {
callback(null, capitalize(call.request));
callback(null, _.capitalize(call.request));
}
}
});

Loading…
Cancel
Save