mirror of https://github.com/grpc/grpc-node.git
refactor: drop usage of _.forOwn
This commit is contained in:
parent
c9d4fbec0a
commit
c415fe03cd
|
@ -122,7 +122,8 @@ Metadata.prototype.get = function(key) {
|
|||
*/
|
||||
Metadata.prototype.getMap = function() {
|
||||
var result = {};
|
||||
_.forOwn(this._internal_repr, function(values, key) {
|
||||
Object.keys(this._internal_repr).forEach(key => {
|
||||
const values = this._internal_repr[key];
|
||||
if(values.length > 0) {
|
||||
result[key] = values[0];
|
||||
}
|
||||
|
@ -136,7 +137,8 @@ Metadata.prototype.getMap = function() {
|
|||
*/
|
||||
Metadata.prototype.clone = function() {
|
||||
var copy = new Metadata();
|
||||
_.forOwn(this._internal_repr, function(value, key) {
|
||||
Object.keys(this._internal_repr).forEach(key => {
|
||||
const value = this._internal_repr[key];
|
||||
copy._internal_repr[key] = _.clone(value);
|
||||
});
|
||||
return copy;
|
||||
|
@ -162,7 +164,8 @@ Metadata.prototype._getCoreRepresentation = function() {
|
|||
Metadata._fromCoreRepresentation = function(metadata) {
|
||||
var newMetadata = new Metadata();
|
||||
if (metadata) {
|
||||
_.forOwn(metadata, function(value, key) {
|
||||
Object.keys(metadata).forEach(key => {
|
||||
const value = metadata[key];
|
||||
newMetadata._internal_repr[key] = _.clone(value);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -878,7 +878,8 @@ Server.prototype.addService = function(service, implementation) {
|
|||
throw new Error('Can\'t add a service to a started server.');
|
||||
}
|
||||
var self = this;
|
||||
_.forOwn(service, function(attrs, name) {
|
||||
Object.keys(service).forEach(name => {
|
||||
const attrs = service[name];
|
||||
var method_type;
|
||||
if (attrs.requestStream) {
|
||||
if (attrs.responseStream) {
|
||||
|
|
Loading…
Reference in New Issue