
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
emptyfunction
Advanced tools
The module exports nothing but an empty function/closure.
npm install emptyfunction
Get the empty closure from the module
var emptyFunction = require('emptyfunction');
Now use the function whenever there is an optional closure within your code.
function example(cb) {
if (!cb) cb = emptyFunction
for (var i = 0; i < 1337; i++) cb()
}
Sometimes you might need to verify whether the closure is an empty function.
If you have access to the emptyFunction object you can do a strict comparison.
this.someFunction === emptyFunction
If not, a more hacky solution is to use the name of the function:
this.someFunction.name === 'emptyFunction'
A simple function to check whether we're dealing with an actual closure:
function isClosure(cb) {
return (cb && cb !== emptyFunction) ? true: false
}
A simple function to make assigning closures easier:
function setClosure(cb) {
return (isClosure(cb)) ? cb : emptyFunction
}
// Usage:
var myClosure = setClosure(cb)
MIT
FAQs
An empty function.
The npm package emptyfunction receives a total of 251 weekly downloads. As such, emptyfunction popularity was classified as not popular.
We found that emptyfunction 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
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.