mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
grpc-js-core: remove extra map() calls in fromHttp2Headers()
The extra map() calls added an extra loop over the arrays just to trim() a string. This commit moves the trim() into the forEach() and drops the map().
This commit is contained in:
parent
b64ed1c18e
commit
2c75b64071
@ -205,9 +205,9 @@ export class Metadata {
|
||||
result.add(key, Buffer.from(value, 'base64'));
|
||||
});
|
||||
} else if (values !== undefined) {
|
||||
values.split(',')
|
||||
.map(v => v.trim())
|
||||
.forEach(v => result.add(key, Buffer.from(v, 'base64')));
|
||||
values.split(',').forEach(v => {
|
||||
result.add(key, Buffer.from(v.trim(), 'base64'));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (Array.isArray(values)) {
|
||||
@ -215,7 +215,7 @@ export class Metadata {
|
||||
result.add(key, value);
|
||||
});
|
||||
} else if (values !== undefined) {
|
||||
values.split(',').map(v => v.trim()).forEach(v => result.add(key, v));
|
||||
values.split(',').forEach(v => result.add(key, v.trim()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user