Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@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 6 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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.