frontend/.pnpm-store/v3/files/ae/c97c60a501d91395a87d2890db7e30c1d2d2b3ede1b0ad14e6e6e00b70064989d38f19e0b2f55068037d6b7924b791805de1e183b497c5629d6e154b06b663

33 lines
758 B
Plaintext

'use strict';
// We define these manually to ensure they're always copied
// even if they would move up the prototype chain
// https://nodejs.org/api/http.html#http_class_http_incomingmessage
const knownProps = [
'destroy',
'setTimeout',
'socket',
'headers',
'trailers',
'rawHeaders',
'statusCode',
'httpVersion',
'httpVersionMinor',
'httpVersionMajor',
'rawTrailers',
'statusMessage'
];
module.exports = (fromStream, toStream) => {
const fromProps = new Set(Object.keys(fromStream).concat(knownProps));
for (const prop of fromProps) {
// Don't overwrite existing properties
if (prop in toStream) {
continue;
}
toStream[prop] = typeof fromStream[prop] === 'function' ? fromStream[prop].bind(fromStream) : fromStream[prop];
}
};