[doc] Update code docs

This commit is contained in:
indexzero 2011-06-05 01:35:54 -04:00
parent 4459ba54a1
commit c9e60d96b5
3 changed files with 41 additions and 0 deletions

View file

@ -7,6 +7,12 @@
var stores = require('./stores'); var stores = require('./stores');
//
// ### function Provider (options)
// #### @options {Object} Options for this instance.
// Constructor function for the Provider object responsible
// for exposing the pluggable storage features of `nconf`.
//
var Provider = exports.Provider = function (options) { var Provider = exports.Provider = function (options) {
options = options || {}; options = options || {};
this.store = stores.create(options.type || 'memory', options); this.store = stores.create(options.type || 'memory', options);
@ -46,6 +52,18 @@ Provider.prototype.set = function (key, value, callback) {
return this.store.set(key, value, callback); return this.store.set(key, value, callback);
}; };
//
// ### function merge (key, value)
// #### @key {string} Key to merge the value into
// #### @value {literal|Object} Value to merge into the key
// Merges the properties in `value` into the existing object value
// at `key`. If the existing value `key` is not an Object, it will be
// completely overwritten.
//
Provider.prototype.merge = function (key, value, callback) {
return this.store.merge(key, value, callback);
}
// //
// ### function clear (key, callback) // ### function clear (key, callback)
// #### @key {string} Key to remove from this instance // #### @key {string} Key to remove from this instance

View file

@ -112,6 +112,14 @@ Memory.prototype.clear = function (key) {
return true; return true;
}; };
//
// ### function merge (key, value)
// #### @key {string} Key to merge the value into
// #### @value {literal|Object} Value to merge into the key
// Merges the properties in `value` into the existing object value
// at `key`. If the existing value `key` is not an Object, it will be
// completely overwritten.
//
Memory.prototype.merge = function (key, value) { Memory.prototype.merge = function (key, value) {
// //
// If the key is not an `Object` or is an `Array`, // If the key is not an `Object` or is an `Array`,

View file

@ -162,6 +162,15 @@ Redis.prototype.set = function (key, value, callback) {
}); });
}; };
//
// ### function merge (key, value, callback)
// #### @key {string} Key to merge the value into
// #### @value {literal|Object} Value to merge into the key
// #### 2callback {function} Continuation to respond to when complete.
// Merges the properties in `value` into the existing object value
// at `key`. If the existing value `key` is not an Object, it will be
// completely overwritten.
//
Redis.prototype.merge = function (key, value, callback) { Redis.prototype.merge = function (key, value, callback) {
// //
// If the key is not an `Object` or is an `Array`, // If the key is not an `Object` or is an `Array`,
@ -358,6 +367,12 @@ Redis.prototype.reset = function (callback) {
}); });
}; };
//
// ### @private function _addKeys (key, callback)
// #### @key {string} Key to add parent keys for
// #### @callback {function} Continuation to respond to when complete.
// Adds the full `key` path to Redis via `sadd`.
//
Redis.prototype._addKeys = function (key, callback) { Redis.prototype._addKeys = function (key, callback) {
var self = this, var self = this,
path = nconf.path(key); path = nconf.path(key);