Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@stamp/convert-class
Advanced tools
Converts an ES6 class to a stamp respecting the class's inheritance chain. The prototype chain is squashed into the methods
of a stamp.
npm i -S @stamp/convert-class
class CParent {
constructor(arg1) {
this.parentProp = arg1
}
commonMethod() { return 'parent' }
parentMethod() { return 'parent' }
static commonStaticMethod() { return 'parent' }
static parentStaticMethod() { return 'parent' }
}
class CChild extends CParent {
constructor(arg1, arg2) {
super(arg1)
this.childProp = arg2
}
commonMethod() { return super.commonMethod() } // overriding parent method
childMethod() { return 'child' }
static commonStaticMethod() { return super.commonStaticMethod() } // overriding parent static method
static childStaticMethod() { return 'child' }
}
const convertClass = require('@stamp/convert-class');
const Stamp = convertClass(CChild);
// parent class method
Stamp.compose.methods.parentMethod === CParent.prototype.parentMethod;
// child class method
Stamp.compose.methods.childMethod === CChild.prototype.childMethod;
// the overridden method
Stamp.compose.methods.commonMethod === CChild.prototype.commonMethod;
// The `super` inside regular method is delegated to parent
Stamp().commonMethod() === (new CChild()).commonMethod() === 'parent';
// parent static method
Stamp.parentStaticMethod === CParent.parentStaticMethod;
// child static method
Stamp.childStaticMethod === CChild.childStaticMethod;
// the overridden static method
Stamp.commonStaticMethod === CChild.commonStaticMethod;
// The `super` inside static methods of child classes is also delegated to parent
Stamp.commonStaticMethod() === CChild.commonStaticMethod() === 'parent';
FAQs
Converts ES6 class to stamp
The npm package @stamp/convert-class receives a total of 0 weekly downloads. As such, @stamp/convert-class popularity was classified as not popular.
We found that @stamp/convert-class 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.