Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
is-valid-instance
Advanced tools
Returns true if a value is a valid instance of Base.
Install with npm:
$ npm install --save is-valid-instance
Use in your base plugin to ensure that the plugin is registered on a valid instance.
var isValidInstance = require('is-valid-instance');
function plugin(app) {
if (!isValidInstance(app)) return;
// do plugin stauff
}
Params
val
{Object}names
{Array|Function}: One or more names to check for on the given instance. Example app
will check for app.isApp === true
or app._name === 'app'
.fn
{Function}: Custom function for validating the instance.returns
{Boolean}Example
function plugin(app) {
if (!isValidInstance(app)) return;
// do plugin stuff
}
Collection instance
Return true if the instance is a templates view-collection (views
):
function plugin(collection) {
if (!isValidInstance(collection, ['views'])) {
// optionally return the plugin function so the plugin is re-tried on
// each instance until it finds the correct one
return plugin;
}
// do plugin stauff
}
View instance
Return true if the instance is a templates view:
function plugin(view) {
if (!isValidInstance(view, ['view'])) {
return plugin;
}
// do plugin stauff
}
View instance
Return true if the instance is either "app" or "collection":
function plugin(app) {
if (!isValidInstance(app, ['app', 'collection'])) {
return plugin;
}
// do plugin stauff
}
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
Jon Schlinkert
Copyright © 2017, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.4.3, on March 24, 2017.
FAQs
Returns true if a value is a valid instance of Base.
The npm package is-valid-instance receives a total of 93,268 weekly downloads. As such, is-valid-instance popularity was classified as popular.
We found that is-valid-instance 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 threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.