
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
A simple function for interrupting program flow if a condition isn’t met.
A simple function for interrupting program flow if a condition isn’t met.
Requires Node.js 4.0.0 or above.
npm i roadblock
The module exposes a single function:
module.exports = (shouldBlock, block, main) => shouldBlock ? block(main) : main()
If shouldBlock
is true, then the block
function is called and is given main
as an argument, to be invoked when/if block
is ready. If shouldBlock
is false, block
is bypassed and main
is called immediately.
const roadblock = require('roadblock')
roadblock(!loggedIn, main => {
// show login form
if (loginSuccessful) main()
}, () => {
// show user-only page
})
In the above example, if loggedIn
is false, the login function is invoked, and is given a callback which it can use once the login is successful. If, on the other hand, loggedIn
is true, then the login function is bypassed and the main function is called directly.
Without roadblock
, the code for the previous example would look something like this:
function login () {
// show login form
if (loginSuccessful) main()
}
function main () {
// show user-only page
}
if (loggedIn) {
main()
} else {
login()
}
roadblock
is intended to make your code more compact, more sequential, and less cluttered with named functions that are used only once or twice.
FAQs
A simple function for interrupting program flow if a condition isn’t met.
We found that roadblock 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
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.