Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Guard your arguments. Verify and throw error if they do not meet your contract
Guard your arguments. Verify and throw error if they do not meet your contract
var guard = require('varta');
function log(logger) {
// this line will throw exception if logger instance is null or doesn't have
// a method called `log`:
guard(logger).has('log');
}
You can also expect multiple properties from an object:
var guard = require('varta');
function log(logger) {
// this line will throw exception if logger instance is null or doesn't have
// all three methods: `warn`, `info`, and `debug`
guard(logger).has('warn', 'info', 'debug');
}
You can save expectations and reuse them in the code:
var verify = require('varta').has('warn', 'info', 'debug');
function log(logger) {
// Our expectations are saved above. If the logger does not have all three
// methods (`warn`, `info`, and `debug`) the code will throw an exception
verify(logger);
}
Failing early is very helpful technique when it comes to maintaining large code bases. If you fail as early as possible you will know exactly where something went wrong, instead of debugging a cryptic error message down the stack.
With npm do:
npm install varta
MIT
FAQs
Guard your arguments. Verify and throw error if they do not meet your contract
The npm package varta receives a total of 0 weekly downloads. As such, varta popularity was classified as not popular.
We found that varta 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 malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.