base-methods
Advanced tools
Comparing version 0.2.10 to 0.2.11
22
index.js
@@ -36,2 +36,24 @@ 'use strict'; | ||
/** | ||
* Define a plugin function to be called immediately upon init. | ||
* Plugins are chainable and the only parameter exposed to the | ||
* plugin is the application instance. | ||
* | ||
* ```js | ||
* var app = new Base() | ||
* .use(foo) | ||
* .use(bar) | ||
* .use(baz) | ||
* ``` | ||
* @name .use | ||
* @param {Function} `fn` plugin function to call | ||
* @return {Object} Returns the item instance for chaining. | ||
* @api public | ||
*/ | ||
use: function(fn) { | ||
fn.call(this, this); | ||
return this; | ||
}, | ||
/** | ||
* Assign `value` to `key`. Also emits `set` with | ||
@@ -38,0 +60,0 @@ * the key and value. |
{ | ||
"name": "base-methods", | ||
"description": "Starter for creating a node.js application with a handful of common methods, like `set`, `get`, and `del`.", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"homepage": "https://github.com/jonschlinkert/base-methods", | ||
@@ -14,3 +14,2 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"index.js", | ||
"utils-browser.js", | ||
"utils.js" | ||
@@ -59,2 +58,4 @@ ], | ||
"list": [ | ||
"base-data", | ||
"base-options", | ||
"define-property", | ||
@@ -61,0 +62,0 @@ "set-value", |
@@ -68,4 +68,22 @@ # base-methods [![NPM version](https://badge.fury.io/js/base-methods.svg)](http://badge.fury.io/js/base-methods) | ||
### [.set](index.js#L60) | ||
### [.use](index.js#L52) | ||
Define a plugin function to be called immediately upon init. Plugins are chainable and the only parameter exposed to the plugin is the application instance. | ||
**Params** | ||
* `fn` **{Function}**: plugin function to call | ||
* `returns` **{Object}**: Returns the item instance for chaining. | ||
**Example** | ||
```js | ||
var app = new Base() | ||
.use(foo) | ||
.use(bar) | ||
.use(baz) | ||
``` | ||
### [.set](index.js#L82) | ||
Assign `value` to `key`. Also emits `set` with the key and value. | ||
@@ -95,3 +113,3 @@ | ||
### [.get](index.js#L91) | ||
### [.get](index.js#L113) | ||
@@ -114,3 +132,3 @@ Return the stored value of `key`. Dot notation may be used to get [nested property values][get-value]. | ||
### [.del](index.js#L115) | ||
### [.del](index.js#L137) | ||
@@ -134,3 +152,3 @@ Delete `key` from the instance. Also emits `del` with the key of the deleted item. | ||
### [.define](index.js#L145) | ||
### [.define](index.js#L167) | ||
@@ -154,3 +172,3 @@ Define a non-enumerable property on the instance. | ||
### [.visit](index.js#L161) | ||
### [.visit](index.js#L183) | ||
@@ -166,3 +184,3 @@ Visit `method` over the items in the given object, or map | ||
### [.extend](index.js#L175) | ||
### [.extend](index.js#L197) | ||
@@ -173,3 +191,3 @@ Static method for inheriting both the prototype and | ||
### [.inherit](index.js#L185) | ||
### [.inherit](index.js#L207) | ||
@@ -182,2 +200,4 @@ Similar to `util.inherit`, but copies all static properties, | ||
* [base-data](https://www.npmjs.com/package/base-data): adds a `data` method to base-methods. | [homepage](https://github.com/jonschlinkert/base-data) | ||
* [base-options](https://www.npmjs.com/package/base-options): Adds an `option` method to base-methods. | [homepage](https://github.com/jonschlinkert/base-options) | ||
* [class-utils](https://www.npmjs.com/package/class-utils): Utils for working with JavaScript classes and prototype methods. | [homepage](https://github.com/jonschlinkert/class-utils) | ||
@@ -215,3 +235,3 @@ * [define-property](https://www.npmjs.com/package/define-property): Define a non-enumerable property on an object. | [homepage](https://github.com/jonschlinkert/define-property) | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 02, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 06, 2015._ | ||
@@ -218,0 +238,0 @@ [class-utils]: https://github.com/jonschlinkert/class-utils |
@@ -7,6 +7,5 @@ 'use strict'; | ||
var lazy = require('lazy-cache')(require); | ||
var fn = require; | ||
var utils = require('lazy-cache')(require); | ||
require = utils; | ||
require = lazy; | ||
require('set-value', 'set'); | ||
@@ -21,5 +20,5 @@ require('get-value', 'get'); | ||
/** | ||
* Expose `lazy` modules | ||
* Expose `utils` modules | ||
*/ | ||
module.exports = lazy; | ||
module.exports = utils; |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
13731
214
236
1