Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Monkey Patch Wrapper that support multiple wrapping and unwrapping.
npm install --save mpwrapper
const https = require('https');
const mpWrapper = require('mpwrapper');
const wrapper1 = mpWrapper.wrap(https, 'get', (original) => {
return function () {
console.log('before request 1');
const result = original.apply(this, arguments);
console.log('after request 1');
return result;
};
});
const wrapper2 = mpWrapper.wrap(https, 'get', (original) => {
return function () {
console.log('before request 2');
const result = original.apply(this, arguments);
console.log('after request 2');
return result;
};
});
function getData(callback) {
const url = 'https://raw.githubusercontent.com/obecny/mpwrapper/master/package.json';
https.get(url, (response) => {
let data = '';
response.on('data', (chunk) => {
data += chunk;
});
response.on('end', () => {
const info = JSON.parse(data);
console.log(`${info.name} - ${info.version}`);
callback();
});
});
}
getData(()=> {
wrapper1.unwrap();
getData(()=> {
wrapper2.unwrap();
getData(()=> {
console.log('done');
});
});
});
// before request 1
// before request 2
// after request 2
// after request 1
// mpwrapper - 0.1.0
// before request 2
// after request 2
// mpwrapper - 0.1.0
// mpwrapper - 0.1.0
// done
import * as mpWrapper from 'mpwrapper';
const wrapper1 = mpWrapper.wrap(XMLHttpRequest.prototype, 'open', (original) => {
return function () {
console.log('before request 1');
const result = original.apply(this, arguments);
console.log('after request 1');
return result;
};
});
const wrapper2 = mpWrapper.wrap(XMLHttpRequest.prototype, 'open', (original) => {
return function () {
console.log('before request 2');
const result = original.apply(this, arguments);
console.log('after request 2');
return result;
};
});
function getData(callback) {
const url = 'https://raw.githubusercontent.com/obecny/mpwrapper/master/package.json';
const req = new XMLHttpRequest();
req.open('GET', url, true);
req.send();
req.onload = function () {
const info = JSON.parse(req.responseText);
console.log(`${info.name} - ${info.version}`);
callback();
};
}
getData(()=> {
wrapper1.unwrap();
getData(()=> {
wrapper2.unwrap();
getData(()=> {
console.log('done');
});
});
});
// before request 1
// before request 2
// after request 2
// after request 1
// mpwrapper - 0.1.0
// before request 2
// after request 2
// mpwrapper - 0.1.0
// mpwrapper - 0.1.0
// done
Apache 2.0 - See LICENSE for more information.
FAQs
Monkey Patch Wrapper that support multiple wrapping and unwrapping
The npm package mpwrapper receives a total of 16 weekly downloads. As such, mpwrapper popularity was classified as not popular.
We found that mpwrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.