
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
construct-new
Advanced tools
Like the new operator, but as a function for convenience and familiarity.
What you would normally do:
class Foo {
constructor(name) {
this.name = name
}
print() {
console.log("Hi, I am " + this.name)
}
}
const myFoo = new Foo("bar")
myFoo.print() // output: Hi, I am bar
What you would do with this:
const construct = require('construct-new')
class Foo {
constructor(name) {
this.name = name
}
print() {
console.log("Hi, I am " + this.name)
}
}
const myFoo = construct({
target: Foo,
args: ["bar"]
})
myFoo.print() // Hi, I am bar
or
construct({
target: Foo,
args: ["bar"],
callback: (myFoo) => {
myFoo.print() // Hi, I am bar
}
})
If the class doesn't take any arguments, you don't have to pass in the args property, it will still work like the args is an empty array.
FAQs
Like the new operator, but a function.
The npm package construct-new receives a total of 1,430 weekly downloads. As such, construct-new popularity was classified as popular.
We found that construct-new demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.