mimic-response
Advanced tools
Comparing version 2.0.0 to 2.1.0
12
index.js
@@ -26,12 +26,14 @@ 'use strict'; | ||
module.exports = (fromStream, toStream) => { | ||
const fromProps = new Set(Object.keys(fromStream).concat(knownProperties)); | ||
const fromProperties = new Set(Object.keys(fromStream).concat(knownProperties)); | ||
for (const prop of fromProps) { | ||
// Don't overwrite existing properties | ||
if (prop in toStream) { | ||
for (const property of fromProperties) { | ||
// Don't overwrite existing properties. | ||
if (property in toStream) { | ||
continue; | ||
} | ||
toStream[prop] = typeof fromStream[prop] === 'function' ? fromStream[prop].bind(fromStream) : fromStream[prop]; | ||
toStream[property] = typeof fromStream[property] === 'function' ? fromStream[property].bind(fromStream) : fromStream[property]; | ||
} | ||
return toStream; | ||
}; |
{ | ||
"name": "mimic-response", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Mimic a Node.js HTTP response stream", | ||
"license": "MIT", | ||
"repository": "sindresorhus/mimic-response", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
@@ -16,5 +17,6 @@ "engines": { | ||
"scripts": { | ||
"test": "xo && ava" | ||
"test": "xo && ava && tsd" | ||
}, | ||
"files": [ | ||
"index.d.ts", | ||
"index.js" | ||
@@ -33,7 +35,10 @@ ], | ||
"devDependencies": { | ||
"@sindresorhus/tsconfig": "^0.3.0", | ||
"@types/node": "^12.0.0", | ||
"ava": "^1.1.0", | ||
"create-test-server": "^2.4.0", | ||
"pify": "^4.0.1", | ||
"tsd": "^0.7.3", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -5,3 +5,2 @@ # mimic-response [![Build Status](https://travis-ci.org/sindresorhus/mimic-response.svg?branch=master)](https://travis-ci.org/sindresorhus/mimic-response) | ||
## Install | ||
@@ -13,3 +12,2 @@ | ||
## Usage | ||
@@ -30,3 +28,2 @@ | ||
## API | ||
@@ -48,3 +45,2 @@ | ||
## Related | ||
@@ -55,5 +51,12 @@ | ||
--- | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-mimic-response?utm_source=npm-mimic-response&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4734
5
46
58
7