Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

base

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base - npm Package Compare versions

Comparing version 0.6.3 to 0.6.4

61

index.js

@@ -26,14 +26,9 @@ 'use strict';

}
this.initBase(config);
}
this.define('_callbacks', this._callbacks);
this.options = this.options || {};
this.cache = this.cache || {};
/**
* Prototype methods
*/
if (name) this[name] = {};
if (typeof config === 'object') {
this.visit('set', config);
}
utils.run(this, 'use', fns);
}
Base.prototype = Emitter({

@@ -43,2 +38,20 @@ constructor: Base,

/**
* Initialize `Base` defaults with the given `config` object
*/
initBase: function(config) {
this.define('_callbacks', this._callbacks);
this.define('_isRegistered', {});
this.options = this.options || {};
this.cache = this.cache || {};
if (name) this[name] = {};
if (typeof config === 'object') {
this.visit('set', config);
}
utils.run(this, 'use', fns);
},
/**
* Convenience method for assigning a `name` on the instance

@@ -55,2 +68,30 @@ * for doing lookups in plugins.

/**
* Returns true if a plugin has already been registered on an instance.
* This is optionally used by plugin implementors to prevent plugins
* from being called on an instanced more than once.
*
* ```js
* var base = new Base();
* base.use(function(app) {
* if (app.isRegistered('myPlugin')) {
* return;
* }
* // do stuff
* });
* ```
* @name .isRegistered
* @param {String} `name` The plugin name.
* @return {Boolean} Returns true when a plugin is already registered.
* @api public
*/
isRegistered: function(name) {
if (this._isRegistered.hasOwnProperty(name)) {
return true;
}
this._isRegistered[name] = true;
return false;
},
/**
* Define a plugin function to be called immediately upon init.

@@ -57,0 +98,0 @@ * Plugins are chainable and the only parameter exposed to the

2

package.json
{
"name": "base",
"description": "base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting with a handful of common methods, like `set`, `get`, `del` and `use`.",
"version": "0.6.3",
"version": "0.6.4",
"homepage": "https://github.com/node-base/base",

@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc