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.
Structs inspired from Golang
newStruct = require('new-struct')
Animal = newStruct({
name: '',
type: '',
age: 0,
run: run
})
function run (animal) {
console.log('%s is running', animal.name)
}
dongdong = Animal('dongdong', 'cat', 4)
blackbear = Animal('blackbear', 'cat', 3)
dongdong.run()
// => dongdong is running
blackbear.run()
// => blackbear is running
$ npm install new-struct
You can pass the values as an object, too;
dongdong = Animal({ type: 'cat', foobar: 'dfjh' })
Methods can also be defined later;
Animal.method('jump', function(animal){
console.log('%s is jumping!!', animal.name)
})
To extend an existing struct:
Cat = Animal.extend({
type: 'cat',
grrr: grrr
})
function grrr(cat) {
console.log('grrrrrr')
}
dongdong = Cat('dongdong', 2) // notice how 'type' property got eleminated from parameter order.
To define a constructor method:
Animal = newStruct({
construct: construct,
name: '',
type: '',
age: 0,
run: run
})
function construct (animal) {
animal.log = console.log
animal.log('%s just born!', animal.name)
}
dondong = Animal('dongdong', 'cat')
// => dongdong just born
FAQs
This package name is not currently in use, but was formerly occupied by a popular package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.
The npm package new-struct receives a total of 0 weekly downloads. As such, new-struct popularity was classified as not popular.
We found that new-struct 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.