.find(id)

plugins.find(id) is used to find a specific plugin and it's information.

If the plugin cannot be found within the plugins database, it'll return a status code of 404.

This function will return an array of the plugins info and/or the status of the search.

plugins.find(id)

Example use

const plugins = require('bit/plugins');

const pluginInfo = plugins.find('bit-core')

if(!pluginInfo.status.code === 404) {
    console.log(`Plugin with an id of 'bit-core' cannot be found`)
} else {
    console.log(`Plugin with an id of 'bit-core' was found!`)
    console.log(`Plugin Name: ${pluginInfo.plugin.name}`)
    console.log(`Plugin ID: ${pluginInfo.plugin.id}`)
    console.log(`Plugin Version: ${pluginInfo.plugin.version}`)
    console.log(`Plugin Has Index?: ${pluginInfo.plugin.has_index}`)
    console.log(`Plugin Disabled: ${pluginInfo.plugin.disabled}`)
    console.log(`Plugin Requirements: ${pluginInfo.plugin.requirements}`)
}

// Output if bit-core is found
/*
Plugin with an id of 'bit-core' was found!
Plugin Name: Bit: COre
Plugin ID: bit-core
Plugin Version: 2025.2.0
Plugin Has Index?: true
Plugin Disabled: false
Plugin Requirements: {
    "bit": {
        "version": "2025.2.0",
        "level": 0
    }
}
*/

// Output if bit-core is not found
/*
Plugin with an id of 'bit-core' cannot be found
*/

Last updated

Was this helpful?