base-methods
Advanced tools
Comparing version 0.3.0 to 0.3.1
11
index.js
@@ -21,11 +21,14 @@ 'use strict'; | ||
function Base(options) { | ||
function Base(config) { | ||
if (!(this instanceof Base)) { | ||
return new Base(options); | ||
return new Base(config); | ||
} | ||
this.define('_callbacks', this._callbacks); | ||
this.options = this.options || {}; | ||
this.cache = this.cache || {}; | ||
if (name) this[name] = {}; | ||
if (typeof options === 'object') { | ||
this.visit('set', options); | ||
if (typeof config === 'object') { | ||
this.visit('set', config); | ||
} | ||
@@ -32,0 +35,0 @@ } |
{ | ||
"name": "base-methods", | ||
"description": "Starter for creating a node.js application with a handful of common methods, like `set`, `get`, and `del`.", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"homepage": "https://github.com/jonschlinkert/base-methods", | ||
@@ -29,3 +29,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"get-value": "^1.2.1", | ||
"lazy-cache": "^0.2.3", | ||
"lazy-cache": "^0.2.4", | ||
"set-value": "^0.2.0", | ||
@@ -57,10 +57,7 @@ "unset-value": "^0.1.0" | ||
"related": { | ||
"description": "If none of the following plugins meet your needs, feel free to use them as examples for creating your own!", | ||
"list": [ | ||
"base-data", | ||
"base-options", | ||
"define-property", | ||
"set-value", | ||
"get-value", | ||
"unset-value", | ||
"class-utils" | ||
"base-plugins" | ||
] | ||
@@ -67,0 +64,0 @@ } |
@@ -5,2 +5,4 @@ # base-methods [![NPM version](https://badge.fury.io/js/base-methods.svg)](http://badge.fury.io/js/base-methods) | ||
Great way to start building a highly modular, unit testable and [pluggable](#plugins) node.js application! | ||
## Install | ||
@@ -69,3 +71,3 @@ | ||
### [.use](index.js#L63) | ||
### [.use](index.js#L66) | ||
@@ -88,3 +90,3 @@ 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. | ||
### [.set](index.js#L93) | ||
### [.set](index.js#L96) | ||
@@ -115,3 +117,3 @@ Assign `value` to `key`. Also emits `set` with the key and value. | ||
### [.get](index.js#L119) | ||
### [.get](index.js#L122) | ||
@@ -133,3 +135,3 @@ Return the stored value of `key`. Dot notation may be used to get [nested property values][get-value]. | ||
### [.has](index.js#L144) | ||
### [.has](index.js#L147) | ||
@@ -151,3 +153,3 @@ Return true if app has a stored value for `key`, false only if `typeof` value is `undefined`. | ||
### [.del](index.js#L171) | ||
### [.del](index.js#L174) | ||
@@ -171,3 +173,3 @@ Delete `key` from the instance. Also emits `del` with the key of the deleted item. | ||
### [.define](index.js#L197) | ||
### [.define](index.js#L200) | ||
@@ -191,3 +193,3 @@ Define a non-enumerable property on the instance. | ||
### [.visit](index.js#L213) | ||
### [.visit](index.js#L216) | ||
@@ -203,3 +205,3 @@ Visit `method` over the items in the given object, or map | ||
### [.mixin](index.js#L231) | ||
### [.mixin](index.js#L234) | ||
@@ -217,3 +219,3 @@ Mix property `key` onto the Base prototype. If base-methods | ||
### [.extend](index.js#L245) | ||
### [.extend](index.js#L248) | ||
@@ -224,3 +226,3 @@ Static method for inheriting both the prototype and | ||
### [.inherit](index.js#L255) | ||
### [.inherit](index.js#L258) | ||
@@ -231,11 +233,9 @@ Similar to `util.inherit`, but copies all static properties, | ||
## Related projects | ||
## Plugins | ||
If none of the following plugins meet your needs, feel free to use them as examples for creating your own! | ||
* [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 a few options methods to base-methods, like `option`, `enable` and `disable`. See the readme… [more](https://www.npmjs.com/package/base-options) | [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) | ||
* [define-property](https://www.npmjs.com/package/define-property): Define a non-enumerable property on an object. | [homepage](https://github.com/jonschlinkert/define-property) | ||
* [get-value](https://www.npmjs.com/package/get-value): Use property paths (` a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value) | ||
* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value) | ||
* [unset-value](https://www.npmjs.com/package/unset-value): Delete nested properties from an object using dot notation. | [homepage](https://github.com/jonschlinkert/unset-value) | ||
* [base-plugins](https://www.npmjs.com/package/base-plugins): Upgrade's plugin support in base-methods to allow plugins to be called any time after init. | [homepage](https://github.com/jonschlinkert/base-plugins) | ||
@@ -268,3 +268,3 @@ ## Running tests | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 22, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 24, 2015._ | ||
@@ -271,0 +271,0 @@ [class-utils]: https://github.com/jonschlinkert/class-utils |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
272
15668
Updatedlazy-cache@^0.2.4