mirror of https://github.com/grpc/grpc-node.git
Merge pull request #634 from JustinBeckwith/identity
refactor: stop using _.identity
This commit is contained in:
commit
e7343b3bb7
|
|
@ -895,8 +895,8 @@ var deprecated_request_wrap = {
|
||||||
opt_args.options, callback);
|
opt_args.options, callback);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[methodTypes.SERVER_STREAMING]: _.identity,
|
[methodTypes.SERVER_STREAMING]: x => x,
|
||||||
[methodTypes.BIDI_STREAMING]: _.identity
|
[methodTypes.BIDI_STREAMING]: x => x
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ var constants = require('./constants');
|
||||||
*/
|
*/
|
||||||
exports.wrapIgnoreNull = function wrapIgnoreNull(func) {
|
exports.wrapIgnoreNull = function wrapIgnoreNull(func) {
|
||||||
if (!func) {
|
if (!func) {
|
||||||
return _.identity;
|
return x => x;
|
||||||
}
|
}
|
||||||
return function(arg) {
|
return function(arg) {
|
||||||
if (arg === null || arg === undefined) {
|
if (arg === null || arg === undefined) {
|
||||||
|
|
|
||||||
|
|
@ -204,10 +204,10 @@ describe('Client constructor building', function() {
|
||||||
path: '/illegal/$method',
|
path: '/illegal/$method',
|
||||||
requestStream: false,
|
requestStream: false,
|
||||||
responseStream: false,
|
responseStream: false,
|
||||||
requestSerialize: _.identity,
|
requestSerialize: x => x,
|
||||||
requestDeserialize: _.identity,
|
requestDeserialize: x => x,
|
||||||
responseSerialize: _.identity,
|
responseSerialize: x => x,
|
||||||
responseDeserialize: _.identity
|
responseDeserialize: x => x
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
it('Should reject method names starting with $', function() {
|
it('Should reject method names starting with $', function() {
|
||||||
|
|
@ -628,29 +628,29 @@ describe('Client malformed response handling', function() {
|
||||||
path: '/TestService/Unary',
|
path: '/TestService/Unary',
|
||||||
requestStream: false,
|
requestStream: false,
|
||||||
responseStream: false,
|
responseStream: false,
|
||||||
requestDeserialize: _.identity,
|
requestDeserialize: x => x,
|
||||||
responseSerialize: _.identity
|
responseSerialize: x => x
|
||||||
},
|
},
|
||||||
clientStream: {
|
clientStream: {
|
||||||
path: '/TestService/ClientStream',
|
path: '/TestService/ClientStream',
|
||||||
requestStream: true,
|
requestStream: true,
|
||||||
responseStream: false,
|
responseStream: false,
|
||||||
requestDeserialize: _.identity,
|
requestDeserialize: x => x,
|
||||||
responseSerialize: _.identity
|
responseSerialize: x => x
|
||||||
},
|
},
|
||||||
serverStream: {
|
serverStream: {
|
||||||
path: '/TestService/ServerStream',
|
path: '/TestService/ServerStream',
|
||||||
requestStream: false,
|
requestStream: false,
|
||||||
responseStream: true,
|
responseStream: true,
|
||||||
requestDeserialize: _.identity,
|
requestDeserialize: x => x,
|
||||||
responseSerialize: _.identity
|
responseSerialize: x => x
|
||||||
},
|
},
|
||||||
bidiStream: {
|
bidiStream: {
|
||||||
path: '/TestService/BidiStream',
|
path: '/TestService/BidiStream',
|
||||||
requestStream: true,
|
requestStream: true,
|
||||||
responseStream: true,
|
responseStream: true,
|
||||||
requestDeserialize: _.identity,
|
requestDeserialize: x => x,
|
||||||
responseSerialize: _.identity
|
responseSerialize: x => x
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
server = new grpc.Server();
|
server = new grpc.Server();
|
||||||
|
|
@ -729,28 +729,28 @@ describe('Server serialization failure handling', function() {
|
||||||
path: '/TestService/Unary',
|
path: '/TestService/Unary',
|
||||||
requestStream: false,
|
requestStream: false,
|
||||||
responseStream: false,
|
responseStream: false,
|
||||||
requestDeserialize: _.identity,
|
requestDeserialize: x => x,
|
||||||
responseSerialize: serializeFail
|
responseSerialize: serializeFail
|
||||||
},
|
},
|
||||||
clientStream: {
|
clientStream: {
|
||||||
path: '/TestService/ClientStream',
|
path: '/TestService/ClientStream',
|
||||||
requestStream: true,
|
requestStream: true,
|
||||||
responseStream: false,
|
responseStream: false,
|
||||||
requestDeserialize: _.identity,
|
requestDeserialize: x => x,
|
||||||
responseSerialize: serializeFail
|
responseSerialize: serializeFail
|
||||||
},
|
},
|
||||||
serverStream: {
|
serverStream: {
|
||||||
path: '/TestService/ServerStream',
|
path: '/TestService/ServerStream',
|
||||||
requestStream: false,
|
requestStream: false,
|
||||||
responseStream: true,
|
responseStream: true,
|
||||||
requestDeserialize: _.identity,
|
requestDeserialize: x => x,
|
||||||
responseSerialize: serializeFail
|
responseSerialize: serializeFail
|
||||||
},
|
},
|
||||||
bidiStream: {
|
bidiStream: {
|
||||||
path: '/TestService/BidiStream',
|
path: '/TestService/BidiStream',
|
||||||
requestStream: true,
|
requestStream: true,
|
||||||
responseStream: true,
|
responseStream: true,
|
||||||
requestDeserialize: _.identity,
|
requestDeserialize: x => x,
|
||||||
responseSerialize: serializeFail
|
responseSerialize: serializeFail
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -943,29 +943,29 @@ describe('Other conditions', function() {
|
||||||
path: '/TestService/Unary',
|
path: '/TestService/Unary',
|
||||||
requestStream: false,
|
requestStream: false,
|
||||||
responseStream: false,
|
responseStream: false,
|
||||||
requestSerialize: _.identity,
|
requestSerialize: x => x,
|
||||||
responseDeserialize: _.identity
|
responseDeserialize: x => x
|
||||||
},
|
},
|
||||||
clientStream: {
|
clientStream: {
|
||||||
path: '/TestService/ClientStream',
|
path: '/TestService/ClientStream',
|
||||||
requestStream: true,
|
requestStream: true,
|
||||||
responseStream: false,
|
responseStream: false,
|
||||||
requestSerialize: _.identity,
|
requestSerialize: x => x,
|
||||||
responseDeserialize: _.identity
|
responseDeserialize: x => x
|
||||||
},
|
},
|
||||||
serverStream: {
|
serverStream: {
|
||||||
path: '/TestService/ServerStream',
|
path: '/TestService/ServerStream',
|
||||||
requestStream: false,
|
requestStream: false,
|
||||||
responseStream: true,
|
responseStream: true,
|
||||||
requestSerialize: _.identity,
|
requestSerialize: x => x,
|
||||||
responseDeserialize: _.identity
|
responseDeserialize: x => x
|
||||||
},
|
},
|
||||||
bidiStream: {
|
bidiStream: {
|
||||||
path: '/TestService/BidiStream',
|
path: '/TestService/BidiStream',
|
||||||
requestStream: true,
|
requestStream: true,
|
||||||
responseStream: true,
|
responseStream: true,
|
||||||
requestSerialize: _.identity,
|
requestSerialize: x => x,
|
||||||
responseDeserialize: _.identity
|
responseDeserialize: x => x
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var Client = grpc.makeGenericClientConstructor(test_service_attrs,
|
var Client = grpc.makeGenericClientConstructor(test_service_attrs,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue