
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@activeprospect/old
Advanced tools
Make the 'new' keyword optional for ES6 classes
npm install old
var old = require('old')
class Class {
// ...
}
var Class2 = old(Class)
Class() // throws error
Class2() // creates an instance of Class
With ES5 "constructor" functions, a common pattern is to make the new
keyword optional by doing something like the following:
function Foo () {
if (!(this instanceof Foo)) return new Foo()
// do constructor stuff
}
Recently, ES6 introduced classes to replace constructor functions. However, if these classes are instantiated without new
, an error is thrown: TypeError: Class constructor Foo cannot be invoked without 'new'
. This module makes new
optional, even for these ES6 classes.
FAQs
Make the 'new' keyword optional for ES6 classes
The npm package @activeprospect/old receives a total of 84 weekly downloads. As such, @activeprospect/old popularity was classified as not popular.
We found that @activeprospect/old demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 20 open source maintainers 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.