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.5 to 0.6.6

31

index.js

@@ -140,2 +140,33 @@ 'use strict';

/**
* Lazily invoke a registered plugin. This can only be used
* with:
*
* 1. plugins that add a single method or property to `app`
* 2. plugins that do not return a function
*
* ```js
* app.lazy('store', require('base-store'));
* ```
* @param {String} `prop` The name of the property or method added by the plugin.
* @param {Function} `fn` The plugin function
* @param {Object} `options` Options to use when the plugin is invoked.
* @return {Object} Returns the instance for chaining
* @api public
*/
lazy: function(prop, fn, opts) {
this.define(prop, {
configurable: true,
set: function(val) {
this.define(prop, val);
},
get: function() {
this.use(fn(opts));
return this[prop];
}
});
return this;
},
/**
* Assign `value` to `key`. Also emits `set` with

@@ -142,0 +173,0 @@ * the key and value.

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.5",
"version": "0.6.6",
"homepage": "https://github.com/node-base/base",

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

@@ -162,4 +162,20 @@ # base [![NPM version](https://img.shields.io/npm/v/base.svg)](https://www.npmjs.com/package/base) [![Build Status](https://img.shields.io/travis/node-base/base.svg)](https://travis-ci.org/node-base/base)

### [.set](index.js#L165)
1. plugins that add a single method or property to `app`
2. plugins that do not return a function
**Params**
* `prop` **{String}**: The name of the property or method added by the plugin.
* `fn` **{Function}**: The plugin function
* `options` **{Object}**: Options to use when the plugin is invoked.
* `returns` **{Object}**: Returns the instance for chaining
**Example**
```js
app.lazy('store', require('base-store'));
```
### [.set](index.js#L196)
Assign `value` to `key`. Also emits `set` with the key and value.

@@ -193,3 +209,3 @@

### [.get](index.js#L198)
### [.get](index.js#L229)

@@ -218,3 +234,3 @@ Return the stored value of `key`. Dot notation may be used to get [nested property values][get-value].

### [.has](index.js#L225)
### [.has](index.js#L256)

@@ -240,3 +256,3 @@ Return true if app has a stored value for `key`, false only if `typeof` value is `undefined`.

### [.del](index.js#L254)
### [.del](index.js#L285)

@@ -264,3 +280,3 @@ Delete `key` from the instance. Also emits `del` with the key of the deleted item.

### [.define](index.js#L282)
### [.define](index.js#L313)

@@ -288,3 +304,3 @@ Define a non-enumerable property on the instance. Dot-notation is **not supported** with `define`.

### [.visit](index.js#L299)
### [.visit](index.js#L330)

@@ -300,3 +316,3 @@ Visit `method` over the items in the given object, or map

### [.mixin](index.js#L317)
### [.mixin](index.js#L348)

@@ -314,3 +330,3 @@ Mix property `key` onto the Base prototype. If base-methods

### [.use](index.js#L340)
### [.use](index.js#L371)

@@ -334,3 +350,3 @@ Static method for adding global plugin functions that will be added to an instance when created.

### [.extend](index.js#L352)
### [.extend](index.js#L383)

@@ -341,3 +357,3 @@ Static method for inheriting both the prototype and

### [.Base.mixin](index.js#L389)
### [.Base.mixin](index.js#L420)

@@ -361,3 +377,3 @@ Static method for adding mixins to the prototype. When a function is returned from the mixin plugin, it will be added to an array so it can be used on inheriting classes via `Base.mixins(Child)`.

### [.Base.mixins](index.js#L410)
### [.Base.mixins](index.js#L441)

@@ -377,3 +393,3 @@ Static method for running currently saved global mixin functions against a child constructor.

### [.inherit](index.js#L422)
### [.inherit](index.js#L453)

@@ -439,2 +455,2 @@ Similar to `util.inherit`, but copies all static properties,

_This file was generated by [verb](https://github.com/verbose/verb) on January 23, 2016._
_This file was generated by [verb](https://github.com/verbose/verb) on January 25, 2016._
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