
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
babel-plugin-class-properties-default-value
Advanced tools
The plugin for transform properties of class **which has parent class**.
The plugin for transform properties of class which has parent class.
When we use Babel to support class properties. Let's see the follow case:
class P {
value = 'value In P'
constructor(obj) {
Object.assign(this, obj)
}
}
class S extends P {
val = 'value in S'
}
console.log(new S({ val: 'cus' }).val) // what should be printed?
I think the printed val should be 'cus' at first. But actually, It's 'value in S'.
the above code will transform to the follow code by transform class properties.
class P {
constructor(obj) {
this.value = 'value In P'
Object.assign(this, obj)
}
}
class S extends P {
constructor(...args) {
// After called super() that We can use this expression
super(...args)
this.val = 'value in S'
}
}
console.log(new S({ val: 'cus' }).val)
super(...args) meaning call the constructor of P and after called it val === 'cus'.
Unfortunately, this.val = 'value in S' causes the shit happening.
And this is ES6 inheritance's standard.
So if I want to regard 'value in S' as DEFAULT VALUE by this way.
class S extends P {
constructor(...args) {
// After called super() that We can use this expression
super(...args)
this.val = this.hasOwnProperty('val') ? this.val : 'value in S'
}
}
condType (default: 'typeofUndefined') 'typeofUndefined' | 'in' | 'hasOwnProperty'
effectThisExpr (default: false)
Whether effecting the work on this expression
false will ignore this.val = this.abc
onlyEffectConst (default: false)
Whether effecting the constant only
true will ignore options.effectThisExpr, only effect constant expressions
effectDecorator (default: false)
Whether effecting the work on decorator
false will ignore @decorator this.val = 'val'
{
"plugins": [
// NOTE: the order is important
"class-properties-default-value",
"transform-class-properties"
]
}
FAQs
The plugin for transform properties of class **which has parent class**.
We found that babel-plugin-class-properties-default-value 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 discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.