<spanclass="kd">var</span><spanclass="nx">nconf</span><spanclass="o">=</span><spanclass="nx">exports</span><spanclass="p">;</span></pre></div></td></tr><trid="section-2"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-2">¶</a></div><h3>Version 0.1.7 :: 4/20/2011</h3></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">version</span><spanclass="o">=</span><spanclass="p">[</span><spanclass="mi">0</span><spanclass="p">,</span><spanclass="mi">1</span><spanclass="p">,</span><spanclass="mi">7</span><spanclass="p">];</span></pre></div></td></tr><trid="section-3"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-3">¶</a></div><p>Include the various store types exposed by nconf</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">stores</span><spanclass="o">=</span><spanclass="nx">require</span><spanclass="p">(</span><spanclass="s1">'nconf/stores'</span><spanclass="p">);</span></pre></div></td></tr><trid="section-4"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-4">¶</a></div><h3>function use (type, options)</h3>
<spanclass="p">};</span></pre></div></td></tr><trid="section-5"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-5">¶</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">nconf</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-6"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-6">¶</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">nconf</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>
<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">nconf</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">nconf</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-9"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-9">¶</a></div><p>If we don't have a callback and the current
store is capable of loading synchronously
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="nx">nconf</span><spanclass="p">.</span><spanclass="nx">store</span><spanclass="p">.</span><spanclass="nx">loadSync</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="kd">var</span><spanclass="nx">error</span><spanclass="o">=</span><spanclass="k">new</span><spanclass="nb">Error</span><spanclass="p">(</span><spanclass="s1">'nconf store '</span><spanclass="o">+</span><spanclass="nx">nconf</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="p">};</span></pre></div></td></tr><trid="section-10"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-10">¶</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">nconf</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-11"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-11">¶</a></div><p>If we still don't have a callback and the
current store is capable of saving synchronously
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="nx">nconf</span><spanclass="p">.</span><spanclass="nx">store</span><spanclass="p">.</span><spanclass="nx">saveSync</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="kd">var</span><spanclass="nx">error</span><spanclass="o">=</span><spanclass="k">new</span><spanclass="nb">Error</span><spanclass="p">(</span><spanclass="s1">'nconf store '</span><spanclass="o">+</span><spanclass="nx">nconf</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>
<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">nconf</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>
<p>Returns a <code>:</code> joined string from the <code>arguments</code>.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">key</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">()</span><spanclass="p">{</span>
<h4>@key {string} The ':' delimited key to split</h4>
<p>Returns a fully-qualified path to a nested nconf key. </p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">path</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-15"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-15">¶</a></div><p>Use the <code>memory</code> engine by default</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">use</span><spanclass="p">(</span><spanclass="s1">'memory'</span><spanclass="p">);</span>