<h4>@options {Object} Options for this instance.</h4>
<p>Constructor function for the Provider object responsible
for exposing the pluggable storage features of <code>nconf</code>.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="kd">var</span><spanclass="nx">Provider</span><spanclass="o">=</span><spanclass="nx">exports</span><spanclass="p">.</span><spanclass="nx">Provider</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">options</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-3"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-3">¶</a></div><h3>function use (type, options)</h3>
<h4>@type {string} Type of the nconf store to use.</h4>
<h4>@options {Object} Options for the store instance.</h4>
<p>Sets the active <code>this.store</code> to a new instance of the
<spanclass="p">};</span></pre></div></td></tr><trid="section-4"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-4">¶</a></div><h3>function get (key, callback)</h3>
<h4>@key {string} Key to retrieve for this instance.</h4>
<h4>@callback {function} <strong>Optional</strong> Continuation to respond to when complete.</h4>
<p>Retrieves the value for the specified key (if any).</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Provider</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">get</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-5"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-5">¶</a></div><h3>function set (key, value, callback)</h3>
<h4>@key {string} Key to set in this instance</h4>
<h4>@value {literal|Object} Value for the specified key</h4>
<h4>@callback {function} <strong>Optional</strong> Continuation to respond to when complete.</h4>
<p>Sets the <code>value</code> for the specified <code>key</code> in this instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Provider</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">set</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">value</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="k">return</span><spanclass="nx">onError</span><spanclass="p">(</span><spanclass="k">new</span><spanclass="nb">Error</span><spanclass="p">(</span><spanclass="s1">'Cannot merge non-Object into top-level.'</span><spanclass="p">),</span><spanclass="nx">callback</span><spanclass="p">);</span>
<h4>@files {Object|Array} List of files (or settings object) to load.</h4>
<h4>@callback {function} Continuation to respond to when complete.</h4>
<p>Merges all <code>key:value</code> pairs in the <code>files</code> supplied into the
store that is managed by this provider instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Provider</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">mergeFiles</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">files</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
<h4>@key {string} Key to remove from this instance</h4>
<h4>@callback {function} <strong>Optional</strong> Continuation to respond to when complete.</h4>
<p>Removes the value for the specified <code>key</code> from this instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Provider</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">clear</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
<p>Responds with an Object representing all keys associated in this instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Provider</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">load</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span></pre></div></td></tr><trid="section-10"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-10">¶</a></div><p>If we don't have a callback and the current
then do so.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">if</span><spanclass="p">(</span><spanclass="o">!</span><spanclass="nx">callback</span><spanclass="o">&&</span><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">store</span><spanclass="p">.</span><spanclass="nx">loadSync</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="o">?</span><spanclass="nx">onError</span><spanclass="p">(</span><spanclass="k">new</span><spanclass="nb">Error</span><spanclass="p">(</span><spanclass="s1">'nconf store '</span><spanclass="o">+</span><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">store</span><spanclass="p">.</span><spanclass="nx">type</span><spanclass="o">+</span><spanclass="s1">' has no load() method'</span><spanclass="p">),</span><spanclass="nx">callback</span><spanclass="p">)</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-11"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-11">¶</a></div><h3>function save (value, callback)</h3>
<h4>@value {Object} <strong>Optional</strong> Config object to set for this instance</h4>
<h4>@callback {function} Continuation to respond to when complete.</h4>
<p>Removes any existing configuration settings that may exist in this
instance and then adds all key-value pairs in <code>value</code>. </p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Provider</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">save</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">value</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
</pre></div></td></tr><trid="section-12"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-12">¶</a></div><p>If we still don't have a callback and the
then do so.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">if</span><spanclass="p">(</span><spanclass="o">!</span><spanclass="nx">callback</span><spanclass="o">&&</span><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">store</span><spanclass="p">.</span><spanclass="nx">saveSync</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="o">?</span><spanclass="nx">onError</span><spanclass="p">(</span><spanclass="k">new</span><spanclass="nb">Error</span><spanclass="p">(</span><spanclass="s1">'nconf store '</span><spanclass="o">+</span><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">store</span><spanclass="p">.</span><spanclass="nx">type</span><spanclass="o">+</span><spanclass="s1">' has no save() method'</span><spanclass="p">),</span><spanclass="nx">callback</span><spanclass="p">)</span>
<h4>@callback {function} <strong>Optional</strong> Continuation to respond to when complete.</h4>
<p>Clears all keys associated with this instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Provider</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">reset</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-14"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-14">¶</a></div><h3>@private function _execute (action, syncLength, [arguments])</h3>
<h4>@action {string} Action to execute on <code>this.store</code>.</h4>
<h4>@syncLength {number} Function length of the sync version.</h4>
<h4>@arguments {Array} Arguments array to apply to the action</h4>
<p>Executes the specified <code>action</code> on <code>this.store</code>, ensuring a callback supplied
to a synchronous store function is still invoked.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Provider</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">_execute</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">action</span><spanclass="p">,</span><spanclass="nx">syncLength</span><spanclass="cm">/* [arguments] */</span><spanclass="p">)</span><spanclass="p">{</span>
<p>Gets a property indicating if we should wrap calls to <code>.get</code>
by checking <code>optimist.argv</code>.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Provider</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">__defineGetter__</span><spanclass="p">(</span><spanclass="s1">'useArgv'</span><spanclass="p">,</span><spanclass="kd">function</span><spanclass="p">()</span><spanclass="p">{</span>
<p>Sets a property indicating if we should wrap calls to <code>.get</code>
by checking <code>optimist.argv</code>.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Provider</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">__defineSetter__</span><spanclass="p">(</span><spanclass="s1">'useArgv'</span><spanclass="p">,</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">val</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="p">});</span></pre></div></td></tr><trid="section-17"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-17">¶</a></div><p>Throw the <code>err</code> if a callback is not supplied</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="kd">function</span><spanclass="nx">onError</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>