src/use.js
/**
 * Install a plugin, such as scanthng.js
 *
 * The plugin is provided an API object with items for it to manipulate in its
 * `install()` method, such as adding new methods to scope prototypes.
 *
 * @param {object} plugin - The plugin object, which must implement the `install()` method.
 */
Install a plugin, such as scanthng.js
The plugin is provided an API object with items for it to manipulate in its
`install()` method, such as adding new methods to scope prototypes.

@param {object} plugin - The plugin object, which must implement the `install()` method.
Install a plugin such as scanthng . js The plugin is provided an API object with items for it to manipulate in its ` install () ` method such as adding new methods to scope prototypes . @param { object } plugin - The plugin object which must implement the ` install () ` method .
function use (plugin) {
  if (!plugin.install || typeof plugin.install !== 'function') {
    throw new Error("Plugin must implement an 'install()' method")
  }
  try {
    plugin.install(API)
  } catch (e) {
    console.log('Failed to install plugin')
    console.log(e)
  }
}
function use ( plugin ) { if ( ! plugin . install || typeof plugin . install !== 'function' ) { throw new Error ( "Plugin must implement an 'install()' method" ) } try { plugin . install ( API ) } catch ( e ) { console . log ( 'Failed to install plugin' ) console . log ( e ) } }
Install a plugin, such as scanthng.js
 The plugin is provided an API object with items for it to manipulate in its
 `install()` method, such as adding new methods to scope prototypes.
Install a plugin such as scanthng . js The plugin is provided an API object with items for it to manipulate in its ` install () ` method such as adding new methods to scope prototypes .