Socket
Socket
Sign inDemoInstall

clone-response

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clone-response - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

2

package.json
{
"name": "clone-response",
"version": "0.1.1",
"version": "0.2.0",
"description": "Clone a Node.js response object",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -33,3 +33,3 @@ 'use strict';

toStream[prop] = typeof prop === 'function' ? fromStream[prop].bind(fromStream) : fromStream[prop];
toStream[prop] = typeof fromStream[prop] === 'function' ? fromStream[prop].bind(fromStream) : fromStream[prop];
}

@@ -36,0 +36,0 @@ };

@@ -46,3 +46,3 @@ import http from 'http';

cloneResponse.knownProps.forEach(prop => t.is(clonedResponse[prop], response[prop]));
cloneResponse.knownProps.forEach(prop => t.true(typeof clonedResponse[prop] !== 'undefined'));
});

@@ -58,8 +58,10 @@

test('custom functions are copied over', async t => {
test('function methods are bound to the original response instance', async t => {
const response = await rfpify(http.get)(s.url + '/');
response.foo = () => 'bar';
response.getThis = function () {
return this;
};
const clonedResponse = cloneResponse(response);
t.is(clonedResponse.foo(), 'bar');
t.is(response.getThis(), clonedResponse.getThis());
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc