Permalink
Fetching contributors…
Cannot retrieve contributors at this time
8664 lines (8172 sloc) 603 KB
<!DOCTYPE html>
<html>
<head>
<title>nddb.js</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" media="all" href="doc-style.css" />
<script src="doc-filelist.js"></script>
<script>
var relativeDir = '', thisFile = 'nddb.js', defaultSidebar = true;
</script>
<script src="doc-script.js"></script>
</head>
<body>
<div id="sidebar_wrapper">
<div id="sidebar_switch">
<span class="tree">Files</span>
<span class="headings">Headings</span>
</div>
<div id="tree"></div>
<div id="headings">
<div class="heading h1">
<a href="#nddb--n-dimensional-database">NDDB: N-Dimensional Database</a>
</div>
<div class="heading h2">
<a href="#nddb-is-a-powerful-and-versatile-object-database-for-node.js-and-the-browser.">NDDB is a powerful and versatile object database for node.js and the browser.</a>
</div>
<div class="heading h3">
<a href="#df">df</a>
</div>
<div class="heading h3">
<a href="#nddb.decycle">NDDB.decycle</a>
</div>
<div class="heading h3">
<a href="#nddb.retrocycle">NDDB.retrocycle</a>
</div>
<div class="heading h2">
<a href="#nddb-constructor">NDDB constructor</a>
</div>
<div class="heading h2">
<a href="#public-properties.">Public properties.</a>
</div>
<div class="heading h3">
<a href="#nddbid">nddbid</a>
</div>
<div class="heading h3">
<a href="#db">db</a>
</div>
<div class="heading h3">
<a href="#lastselection">lastSelection</a>
</div>
<div class="heading h3">
<a href="#nddbid">nddbid</a>
</div>
<div class="heading h3">
<a href="#tags">tags</a>
</div>
<div class="heading h3">
<a href="#hooks">hooks</a>
</div>
<div class="heading h3">
<a href="#nddb_pointer">nddb_pointer</a>
</div>
<div class="heading h3">
<a href="#query">query</a>
</div>
<div class="heading h3">
<a href="#filters">filters</a>
</div>
<div class="heading h3">
<a href="#__userdefinedfilters">__userDefinedFilters</a>
</div>
<div class="heading h3">
<a href="#__c">__C</a>
</div>
<div class="heading h3">
<a href="#__h">__H</a>
</div>
<div class="heading h3">
<a href="#__i">__I</a>
</div>
<div class="heading h3">
<a href="#__i">__I</a>
</div>
<div class="heading h3">
<a href="#__update">__update</a>
</div>
<div class="heading h3">
<a href="#__update.pointer">__update.pointer</a>
</div>
<div class="heading h3">
<a href="#__update.indexes">__update.indexes</a>
</div>
<div class="heading h3">
<a href="#__update.sort">__update.sort</a>
</div>
<div class="heading h3">
<a href="#__shared">__shared</a>
</div>
<div class="heading h3">
<a href="#__formats">__formats</a>
</div>
<div class="heading h3">
<a href="#__defaultformat">__defaultFormat</a>
</div>
<div class="heading h3">
<a href="#__wd">__wd</a>
</div>
<div class="heading h3">
<a href="#log">log</a>
</div>
<div class="heading h3">
<a href="#globalcompare">globalCompare</a>
</div>
<div class="heading h3">
<a href="#nddb.addfilter">NDDB.addFilter</a>
</div>
<div class="heading h3">
<a href="#nddb.adddefaultfilters">NDDB.addDefaultFilters</a>
</div>
<div class="heading h2">
<a href="#methods">METHODS</a>
</div>
<div class="heading h3">
<a href="#nddb.throwerr">NDDB.throwErr</a>
</div>
<div class="heading h3">
<a href="#nddb.init">NDDB.init</a>
</div>
<div class="heading h3">
<a href="#nddb.initlog">NDDB.initLog</a>
</div>
<div class="heading h3">
<a href="#nddb._getconstrname">NDDB._getConstrName</a>
</div>
<div class="heading h2">
<a href="#core">CORE</a>
</div>
<div class="heading h3">
<a href="#nddb._autoupdate">NDDB._autoUpdate</a>
</div>
<div class="heading h3">
<a href="#nddb.importdb">NDDB.importDB</a>
</div>
<div class="heading h3">
<a href="#nddb.insert">NDDB.insert</a>
</div>
<div class="heading h3">
<a href="#nddb.size">NDDB.size</a>
</div>
<div class="heading h3">
<a href="#nddb.breed">NDDB.breed</a>
</div>
<div class="heading h3">
<a href="#nddb.clonesettings">NDDB.cloneSettings</a>
</div>
<div class="heading h3">
<a href="#nddb.tostring">NDDB.toString</a>
</div>
<div class="heading h3">
<a href="#nddb.stringify">NDDB.stringify</a>
</div>
<div class="heading h3">
<a href="#nddb.comparator">NDDB.comparator</a>
</div>
<div class="heading h3">
<a href="#nddb.getcomparator">NDDB.getComparator</a>
</div>
<div class="heading h3">
<a href="#nddb.isreservedword">NDDB.isReservedWord</a>
</div>
<div class="heading h3">
<a href="#nddb.index">NDDB.index</a>
</div>
<div class="heading h3">
<a href="#nddb.view">NDDB.view</a>
</div>
<div class="heading h3">
<a href="#nddb.hash">NDDB.hash</a>
</div>
<div class="heading h3">
<a href="#nddb.resetindexes">NDDB.resetIndexes</a>
</div>
<div class="heading h3">
<a href="#nddb.rebuildindexes">NDDB.rebuildIndexes</a>
</div>
<div class="heading h3">
<a href="#nddb._indexit">NDDB._indexIt</a>
</div>
<div class="heading h3">
<a href="#nddb._viewit">NDDB._viewIt</a>
</div>
<div class="heading h3">
<a href="#nddb._hashit">NDDB._hashIt</a>
</div>
<div class="heading h2">
<a href="#event-emitter---listener">Event emitter / listener</a>
</div>
<div class="heading h3">
<a href="#nddb.on">NDDB.on</a>
</div>
<div class="heading h3">
<a href="#nddb.off">NDDB.off</a>
</div>
<div class="heading h3">
<a href="#nddb.emit">NDDB.emit</a>
</div>
<div class="heading h2">
<a href="#sort-and-select">Sort and Select</a>
</div>
<div class="heading h3">
<a href="#nddb._analyzequery">NDDB._analyzeQuery</a>
</div>
<div class="heading h3">
<a href="#nddb.distinct">NDDB.distinct</a>
</div>
<div class="heading h3">
<a href="#nddb.select">NDDB.select</a>
</div>
<div class="heading h3">
<a href="#nddb.and">NDDB.and</a>
</div>
<div class="heading h3">
<a href="#nddb.or">NDDB.or</a>
</div>
<div class="heading h3">
<a href="#nddb.selexec">NDDB.selexec</a>
</div>
<div class="heading h3">
<a href="#nddb.execute">NDDB.execute</a>
</div>
<div class="heading h3">
<a href="#nddb.exists">NDDB.exists</a>
</div>
<div class="heading h3">
<a href="#nddb.limit">NDDB.limit</a>
</div>
<div class="heading h3">
<a href="#nddb.reverse">NDDB.reverse</a>
</div>
<div class="heading h3">
<a href="#nddb.sort">NDDB.sort</a>
</div>
<div class="heading h3">
<a href="#nddb.shuffle">NDDB.shuffle</a>
</div>
<div class="heading h2">
<a href="#custom-callbacks">Custom callbacks</a>
</div>
<div class="heading h3">
<a href="#nddb.filter">NDDB.filter</a>
</div>
<div class="heading h3">
<a href="#nddb.each----nddb.foreach--optimized-">NDDB.each || NDDB.forEach (optimized)</a>
</div>
<div class="heading h3">
<a href="#nddb.map">NDDB.map</a>
</div>
<div class="heading h2">
<a href="#update">Update</a>
</div>
<div class="heading h3">
<a href="#nddb.update">NDDB.update</a>
</div>
<div class="heading h2">
<a href="#deletion">Deletion</a>
</div>
<div class="heading h3">
<a href="#nddb.removeallentries">NDDB.removeAllEntries</a>
</div>
<div class="heading h3">
<a href="#nddb.clear">NDDB.clear</a>
</div>
<div class="heading h2">
<a href="#advanced-operations">Advanced operations</a>
</div>
<div class="heading h3">
<a href="#nddb.join">NDDB.join</a>
</div>
<div class="heading h3">
<a href="#nddb.concat">NDDB.concat</a>
</div>
<div class="heading h3">
<a href="#nddb._join">NDDB._join</a>
</div>
<div class="heading h3">
<a href="#nddb.split">NDDB.split</a>
</div>
<div class="heading h2">
<a href="#fetching">Fetching</a>
</div>
<div class="heading h3">
<a href="#nddb.fetch">NDDB.fetch</a>
</div>
<div class="heading h3">
<a href="#nddb.fetchsubobj">NDDB.fetchSubObj</a>
</div>
<div class="heading h3">
<a href="#nddb.fetchvalues">NDDB.fetchValues</a>
</div>
<div class="heading h3">
<a href="#nddb._fetcharray">NDDB._fetchArray</a>
</div>
<div class="heading h3">
<a href="#nddb.fetcharray">NDDB.fetchArray</a>
</div>
<div class="heading h3">
<a href="#nddb.fetchkeyarray">NDDB.fetchKeyArray</a>
</div>
<div class="heading h3">
<a href="#nddb.groupby">NDDB.groupBy</a>
</div>
<div class="heading h2">
<a href="#statistics">Statistics</a>
</div>
<div class="heading h3">
<a href="#nddb.count">NDDB.count</a>
</div>
<div class="heading h3">
<a href="#nddb.sum">NDDB.sum</a>
</div>
<div class="heading h3">
<a href="#nddb.mean">NDDB.mean</a>
</div>
<div class="heading h3">
<a href="#nddb.stddev">NDDB.stddev</a>
</div>
<div class="heading h3">
<a href="#nddb.min">NDDB.min</a>
</div>
<div class="heading h3">
<a href="#nddb.max">NDDB.max</a>
</div>
<div class="heading h2">
<a href="#skim">Skim</a>
</div>
<div class="heading h3">
<a href="#nddb.skim">NDDB.skim</a>
</div>
<div class="heading h3">
<a href="#nddb.keep">NDDB.keep</a>
</div>
<div class="heading h2">
<a href="#diff">Diff</a>
</div>
<div class="heading h3">
<a href="#nddb.diff">NDDB.diff</a>
</div>
<div class="heading h3">
<a href="#nddb.intersect">NDDB.intersect</a>
</div>
<div class="heading h2">
<a href="#iterator">Iterator</a>
</div>
<div class="heading h3">
<a href="#nddb.get">NDDB.get</a>
</div>
<div class="heading h3">
<a href="#nddb.current">NDDB.current</a>
</div>
<div class="heading h3">
<a href="#nddb.next">NDDB.next</a>
</div>
<div class="heading h3">
<a href="#nddb.previous">NDDB.previous</a>
</div>
<div class="heading h3">
<a href="#nddb.first">NDDB.first</a>
</div>
<div class="heading h3">
<a href="#nddb.last">NDDB.last</a>
</div>
<div class="heading h2">
<a href="#tagging">Tagging</a>
</div>
<div class="heading h3">
<a href="#nddb.tag">NDDB.tag</a>
</div>
<div class="heading h3">
<a href="#nddb.resolvetag">NDDB.resolveTag</a>
</div>
<div class="heading h2">
<a href="#save-load.">Save/Load.</a>
</div>
<div class="heading h3">
<a href="#nddb.load">NDDB.load</a>
</div>
<div class="heading h3">
<a href="#nddb.save">NDDB.save</a>
</div>
<div class="heading h3">
<a href="#nddb.loadsync">NDDB.loadSync</a>
</div>
<div class="heading h3">
<a href="#nddb.savesync">NDDB.saveSync</a>
</div>
<div class="heading h2">
<a href="#formats.">Formats.</a>
</div>
<div class="heading h3">
<a href="#nddb.addformat">NDDB.addFormat</a>
</div>
<div class="heading h3">
<a href="#nddb.getformat">NDDB.getFormat</a>
</div>
<div class="heading h3">
<a href="#nddb.setdefaultformat">NDDB.setDefaultFormat</a>
</div>
<div class="heading h3">
<a href="#nddb.getdefaultformat">NDDB.getDefaultFormat</a>
</div>
<div class="heading h3">
<a href="#nddb.adddefaultformats">NDDB.addDefaultFormats</a>
</div>
<div class="heading h2">
<a href="#helper-methods">Helper Methods</a>
</div>
<div class="heading h3">
<a href="#nddb_insert">nddb_insert</a>
</div>
<div class="heading h3">
<a href="#validatesaveloadparameters">validateSaveLoadParameters</a>
</div>
<div class="heading h3">
<a href="#extractextension">extractExtension</a>
</div>
<div class="heading h3">
<a href="#executesaveload">executeSaveLoad</a>
</div>
<div class="heading h3">
<a href="#findformatfunction">findFormatFunction</a>
</div>
<div class="heading h3">
<a href="#validateformatparameters">validateFormatParameters</a>
</div>
<div class="heading h1">
<a href="#querybuilder">QueryBuilder</a>
</div>
<div class="heading h2">
<a href="#querybuilder-constructor">QueryBuilder Constructor</a>
</div>
<div class="heading h3">
<a href="#querybuilder.addcondition">QueryBuilder.addCondition</a>
</div>
<div class="heading h3">
<a href="#querybuilder.addbreak">QueryBuilder.addBreak</a>
</div>
<div class="heading h3">
<a href="#querybuilder.reset">QueryBuilder.reset</a>
</div>
<div class="heading h3">
<a href="#querybuilder.get">QueryBuilder.get</a>
</div>
<div class="heading h1">
<a href="#nddbhashtray">NDDBHashtray</a>
</div>
<div class="heading h2">
<a href="#nddbhashtray-constructor">NDDBHashtray constructor</a>
</div>
<div class="heading h1">
<a href="#nddbindex">NDDBIndex</a>
</div>
<div class="heading h2">
<a href="#nddbindex-constructor">NDDBIndex Constructor</a>
</div>
<div class="heading h3">
<a href="#nddbindex._add">NDDBIndex._add</a>
</div>
<div class="heading h3">
<a href="#nddbindex._remove">NDDBIndex._remove</a>
</div>
<div class="heading h3">
<a href="#nddbindex.size">NDDBIndex.size</a>
</div>
<div class="heading h3">
<a href="#nddbindex.get">NDDBIndex.get</a>
</div>
<div class="heading h3">
<a href="#nddbindex.remove">NDDBIndex.remove</a>
</div>
<div class="heading h3">
<a href="#nddbindex.pop">NDDBIndex.pop</a>
</div>
<div class="heading h3">
<a href="#nddbindex.update">NDDBIndex.update</a>
</div>
<div class="heading h3">
<a href="#nddbindex.getallkeys">NDDBIndex.getAllKeys</a>
</div>
<div class="heading h3">
<a href="#nddbindex.getallkeyelements">NDDBIndex.getAllKeyElements</a>
</div>
</div>
</div>
<div id="sidebar-toggle"></div>
<div id="container"><div class="background highlight"></div>
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="docs"><div class="dox">
<div class="summary">
<div class="pilwrap" id="nddb--n-dimensional-database">
<h1>
<a href="#nddb--n-dimensional-database" class="pilcrow">&#182;</a>
NDDB: N-Dimensional Database
</h1>
</div>
<p>Copyright(c) 2017 Stefano Balietti
MIT Licensed</p>
</div>
<div class="body">
<div class="pilwrap" id="nddb-is-a-powerful-and-versatile-object-database-for-node.js-and-the-browser.">
<h2>
<a href="#nddb-is-a-powerful-and-versatile-object-database-for-node.js-and-the-browser." class="pilcrow">&#182;</a>
NDDB is a powerful and versatile object database for node.js and the browser.
</h2>
</div>
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">exports</span><span class="p">,</span> <span class="nx">J</span><span class="p">,</span> <span class="nx">store</span><span class="p">)</span> <span class="p">{</span>
<span class="s2">&quot;use strict&quot;</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-2" id="section-2">&#182;</a>
</div>
<p>Expose constructors</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="nx">exports</span><span class="p">.</span><span class="nx">NDDB</span> <span class="o">=</span> <span class="nx">NDDB</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">J</span><span class="p">)</span> <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s1">&#39;NDDB: missing dependency: JSUS.&#39;</span><span class="p">);</span></pre></div>
</td>
</tr>
<tr>
<td class="docs"><div class="dox">
<div class="summary">
<div class="pilwrap" id="df">
<h3>
<a href="#df" class="pilcrow">&#182;</a>
df
</h3>
</div>
</div>
<div class="body"><p>Flag indicating support for method Object.defineProperty</p>
<p>If support is missing, the index <code>_nddbid</code> will be as a normal
property, and, therefore, it will be enumerable.</p>
</div>
<div class="details">
<div class="dox_tag_title">See</div>
<div class="dox_tag_detail">
<span class="dox_type">nddb_insert
JSUS.compatibility
</span>
</div>
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="kd">var</span> <span class="nx">df</span> <span class="o">=</span> <span class="nx">J</span><span class="p">.</span><span class="nx">compatibility</span><span class="p">().</span><span class="nx">defineProperty</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs"><div class="dox">
<div class="summary">
<div class="pilwrap" id="nddb.decycle">
<h3>
<a href="#nddb.decycle" class="pilcrow">&#182;</a>
NDDB.decycle
</h3>
</div>
</div>
<div class="body"><p>Removes cyclic references from an object</p>
</div>
<div class="details">
<div class="dox_tag_title">Params</div>
<div class="dox_tag_detail">
<span class="dox_tag_name">e</span>
<span class="dox_type">object</span>
<span>The object to decycle</span>
</div>
<div class="dox_tag_title">Returns</div>
<div class="dox_tag_detail">
<span class="dox_tag_name"></span>
<span class="dox_type">object</span>
<span>e The decycled object</span>
</div>
<div class="dox_tag_title">See</div>
<div class="dox_tag_detail">
<a href=" ">https://github.com/douglascrockford/JSON-js/
</a>
</div>
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="nx">NDDB</span><span class="p">.</span><span class="nx">decycle</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">JSON</span> <span class="o">&amp;&amp;</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">decycle</span> <span class="o">&amp;&amp;</span> <span class="s1">&#39;function&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">decycle</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">e</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">decycle</span><span class="p">(</span><span class="nx">e</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">e</span><span class="p">;</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs"><div class="dox">
<div class="summary">
<div class="pilwrap" id="nddb.retrocycle">
<h3>
<a href="#nddb.retrocycle" class="pilcrow">&#182;</a>
NDDB.retrocycle
</h3>
</div>
</div>
<div class="body"><p>Restores cyclic references in an object previously decycled</p>
</div>
<div class="details">
<div class="dox_tag_title">Params</div>
<div class="dox_tag_detail">
<span class="dox_tag_name">e</span>
<span class="dox_type">object</span>
<span>The object to retrocycle</span>
</div>
<div class="dox_tag_title">Returns</div>
<div class="dox_tag_detail">
<span class="dox_tag_name"></span>
<span class="dox_type">object</span>
<span>e The retrocycled object</span>
</div>
<div class="dox_tag_title">See</div>
<div class="dox_tag_detail">
<a href=" ">https://github.com/douglascrockford/JSON-js/
</a>
</div>
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="nx">NDDB</span><span class="p">.</span><span class="nx">retrocycle</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">JSON</span> <span class="o">&amp;&amp;</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">retrocycle</span> <span class="o">&amp;&amp;</span> <span class="s1">&#39;function&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">retrocycle</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">e</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">retrocycle</span><span class="p">(</span><span class="nx">e</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">e</span><span class="p">;</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs"><div class="dox">
<div class="summary">
<div class="pilwrap" id="nddb-constructor">
<h2>
<a href="#nddb-constructor" class="pilcrow">&#182;</a>
NDDB constructor
</h2>
</div>
</div>
<div class="body"><p>Creates a new instance of NDDB</p>
</div>
<div class="details">
<div class="dox_tag_title">Params</div>
<div class="dox_tag_detail">
<span class="dox_tag_name">options</span>
<span class="dox_type">object</span>
<span>Optional. Configuration options</span>
</div>
<div class="dox_tag_detail">
<span class="dox_tag_name">db</span>
<span class="dox_type">db</span>
<span>Optional. An initial set of items to import</span>
</div>
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="kd">function</span> <span class="nx">NDDB</span><span class="p">(</span><span class="nx">options</span><span class="p">,</span> <span class="nx">db</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">that</span><span class="p">;</span>
<span class="nx">that</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
<span class="nx">options</span> <span class="o">=</span> <span class="nx">options</span> <span class="o">||</span> <span class="p">{};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="public-properties.">
<h2>
<a href="#public-properties." class="pilcrow">&#182;</a>
Public properties.
</h2>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="nddbid">
<h3>
<a href="#nddbid" class="pilcrow">&#182;</a>
nddbid
</h3>
</div>
<p>A global index of all objects.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">nddbid</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">NDDBIndex</span><span class="p">(</span><span class="s1">&#39;nddbid&#39;</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="db">
<h3>
<a href="#db" class="pilcrow">&#182;</a>
db
</h3>
</div>
<p>The default database.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">db</span> <span class="o">=</span> <span class="p">[];</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="lastselection">
<h3>
<a href="#lastselection" class="pilcrow">&#182;</a>
lastSelection
</h3>
</div>
<p>The subset of items that were selected during the last operations
Notice: some of the items might not exist any more in the database.
@see NDDB.fetch</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">lastSelection</span> <span class="o">=</span> <span class="p">[];</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="nddbid">
<h3>
<a href="#nddbid" class="pilcrow">&#182;</a>
nddbid
</h3>
</div>
<p>A global index of all hashed objects
@see NDDBHashtray</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">hashtray</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">NDDBHashtray</span><span class="p">();</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="tags">
<h3>
<a href="#tags" class="pilcrow">&#182;</a>
tags
</h3>
</div>
<p>The tags list.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">tags</span> <span class="o">=</span> <span class="p">{};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="hooks">
<h3>
<a href="#hooks" class="pilcrow">&#182;</a>
hooks
</h3>
</div>
<p>The list of hooks and associated callbacks</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">hooks</span> <span class="o">=</span> <span class="p">{</span>
<span class="nx">insert</span><span class="o">:</span> <span class="p">[],</span>
<span class="nx">remove</span><span class="o">:</span> <span class="p">[],</span>
<span class="nx">update</span><span class="o">:</span> <span class="p">[]</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="nddb_pointer">
<h3>
<a href="#nddb_pointer" class="pilcrow">&#182;</a>
nddb_pointer
</h3>
</div>
<p>Pointer for iterating along all the elements</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">nddb_pointer</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="query">
<h3>
<a href="#query" class="pilcrow">&#182;</a>
query
</h3>
</div>
<p>QueryBuilder obj
@see QueryBuilder</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">query</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">QueryBuilder</span><span class="p">();</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="filters">
<h3>
<a href="#filters" class="pilcrow">&#182;</a>
filters
</h3>
</div>
<p>Available db filters</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">addDefaultFilters</span><span class="p">();</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__userdefinedfilters">
<h3>
<a href="#__userdefinedfilters" class="pilcrow">&#182;</a>
__userDefinedFilters
</h3>
</div>
<p>Filters that are defined with addFilter
The field is needed by cloneSettings
@see NDDB.addFilter</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__userDefinedFilters</span> <span class="o">=</span> <span class="p">{};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__c">
<h3>
<a href="#__c" class="pilcrow">&#182;</a>
__C
</h3>
</div>
<p>List of comparator functions</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__C</span> <span class="o">=</span> <span class="p">{};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__h">
<h3>
<a href="#__h" class="pilcrow">&#182;</a>
__H
</h3>
</div>
<p>List of hash functions</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__H</span> <span class="o">=</span> <span class="p">{};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__i">
<h3>
<a href="#__i" class="pilcrow">&#182;</a>
__I
</h3>
</div>
<p>List of index functions</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__I</span> <span class="o">=</span> <span class="p">{};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__i">
<h3>
<a href="#__i" class="pilcrow">&#182;</a>
__I
</h3>
</div>
<p>List of view functions</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__V</span> <span class="o">=</span> <span class="p">{};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__update">
<h3>
<a href="#__update" class="pilcrow">&#182;</a>
__update
</h3>
</div>
<p>Auto update options container</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__update</span> <span class="o">=</span> <span class="p">{};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__update.pointer">
<h3>
<a href="#__update.pointer" class="pilcrow">&#182;</a>
__update.pointer
</h3>
</div>
<p>If TRUE, nddb_pointer always points to the last insert</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__update</span><span class="p">.</span><span class="nx">pointer</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__update.indexes">
<h3>
<a href="#__update.indexes" class="pilcrow">&#182;</a>
__update.indexes
</h3>
</div>
<p>If TRUE, rebuild indexes on every insert and remove</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__update</span><span class="p">.</span><span class="nx">indexes</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__update.sort">
<h3>
<a href="#__update.sort" class="pilcrow">&#182;</a>
__update.sort
</h3>
</div>
<p>If TRUE, sort db on every insert and remove</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__update</span><span class="p">.</span><span class="nx">sort</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__shared">
<h3>
<a href="#__shared" class="pilcrow">&#182;</a>
__shared
</h3>
</div>
<p>Objects shared (not cloned) among breeded NDDB instances</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__shared</span> <span class="o">=</span> <span class="p">{};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__formats">
<h3>
<a href="#__formats" class="pilcrow">&#182;</a>
__formats
</h3>
</div>
<p>Currently supported formats for saving/loading items.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__formats</span> <span class="o">=</span> <span class="p">{};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__defaultformat">
<h3>
<a href="#__defaultformat" class="pilcrow">&#182;</a>
__defaultFormat
</h3>
</div>
<p>Default format for saving and loading items.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__defaultFormat</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="__wd">
<h3>
<a href="#__wd" class="pilcrow">&#182;</a>
__wd
</h3>
</div>
<p>Default working directory for saving and loading files.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">__wd</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="log">
<h3>
<a href="#log" class="pilcrow">&#182;</a>
log
</h3>
</div>
<p>Std out for log messages</p>
<p>It can be overriden in options by another function (<code>options.log</code>).
<code>options.logCtx</code> specif the context of execution.
@see NDDB.initLog</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">log</span> <span class="o">=</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="globalcompare">
<h3>
<a href="#globalcompare" class="pilcrow">&#182;</a>
globalCompare
</h3>
</div>
<p>Dummy compare function used to sort elements in the database</p>
<p>It can be overriden with a compare function returning:</p>
<ul>
<li>0 if the objects are the same</li>
<li>a positive number if o2 precedes o1</li>
<li>a negative number if o1 precedes o2</li>
</ul>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">globalCompare</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">o1</span><span class="p">,</span> <span class="nx">o2</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-32" id="section-32">&#182;</a>
</div>
<p>Adding the "compareInAllFields" function.</p>
<p>@see NDDB.comparator</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">comparator</span><span class="p">(</span><span class="s1">&#39;*&#39;</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">o1</span><span class="p">,</span> <span class="nx">o2</span><span class="p">,</span> <span class="nx">trigger1</span><span class="p">,</span> <span class="nx">trigger2</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">d</span><span class="p">,</span> <span class="nx">c</span><span class="p">,</span> <span class="nx">res</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">d</span> <span class="k">in</span> <span class="nx">o1</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">c</span> <span class="o">=</span> <span class="nx">that</span><span class="p">.</span><span class="nx">getComparator</span><span class="p">(</span><span class="nx">d</span><span class="p">);</span>
<span class="nx">o2</span><span class="p">[</span><span class="nx">d</span><span class="p">]</span> <span class="o">=</span> <span class="nx">o2</span><span class="p">[</span><span class="s1">&#39;*&#39;</span><span class="p">];</span>
<span class="nx">res</span> <span class="o">=</span> <span class="nx">c</span><span class="p">(</span><span class="nx">o1</span><span class="p">,</span> <span class="nx">o2</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">res</span> <span class="o">===</span> <span class="nx">trigger1</span><span class="p">)</span> <span class="k">return</span> <span class="nx">res</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">!==</span> <span class="nx">trigger2</span> <span class="o">&amp;&amp;</span> <span class="nx">res</span> <span class="o">===</span> <span class="nx">trigger2</span><span class="p">)</span> <span class="k">return</span> <span class="nx">res</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-33" id="section-33">&#182;</a>
</div>
<p>No need to delete o2[d] afer comparison.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="p">}</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-34" id="section-34">&#182;</a>
</div>
<p>We are not interested in sorting.
Figuring out the right return value.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span><span class="nx">trigger1</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">trigger2</span> <span class="o">===</span> <span class="mi">1</span> <span class="o">?</span> <span class="o">-</span><span class="mi">1</span> <span class="o">:</span> <span class="mi">1</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">trigger1</span> <span class="o">===</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">trigger2</span> <span class="o">===</span> <span class="mi">0</span> <span class="o">?</span> <span class="o">-</span><span class="mi">1</span> <span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">trigger2</span> <span class="o">===</span> <span class="mi">0</span> <span class="o">?</span> <span class="mi">1</span> <span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">});</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-35" id="section-35">&#182;</a>
</div>
<p>Add default formats (e.g. CSV, JSON in Node.js).
See <code>/lib/fs.js</code>.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span><span class="s1">&#39;function&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="k">this</span><span class="p">.</span><span class="nx">addDefaultFormats</span><span class="p">)</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">addDefaultFormats</span><span class="p">();</span>
<span class="p">}</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-36" id="section-36">&#182;</a>
</div>
<p>Mixing in user options and defaults.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">init</span><span class="p">(</span><span class="nx">options</span><span class="p">);</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-37" id="section-37">&#182;</a>
</div>
<p>Importing items, if any.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span><span class="nx">db</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">importDB</span><span class="p">(</span><span class="nx">db</span><span class="p">);</span>
<span class="p">}</span></pre></div>
</td>
</tr>
<tr>
<td class="docs"><div class="dox">
<div class="summary">
<div class="pilwrap" id="nddb.addfilter">
<h3>
<a href="#nddb.addfilter" class="pilcrow">&#182;</a>
NDDB.addFilter
</h3>
</div>
</div>
<div class="body"><p>Registers a <em>select</em> function under an alphanumeric id</p>
<p>When calling <code>NDDB.select('d','OP','value')</code> the second parameter (<em>OP</em>)
will be matched with the callback function specified here.</p>
<p>Callback function must accept three input parameters:</p>
<ul>
<li>d: dimension of comparison</li>
<li>value: second-term of comparison</li>
<li>comparator: the comparator function as defined by <code>NDDB.comparator</code></li>
</ul>
<p>and return a function that execute the desired operation.</p>
<p>Registering a new filter with the same name of an already existing
one, will overwrite the old filter without warnings.</p>
<p>A reference to newly added filters are registered under
<code>__userDefinedFilter</code>, so that they can be copied by <code>cloneSettings</code>.</p>
</div>
<div class="details">
<div class="dox_tag_title">Params</div>
<div class="dox_tag_detail">
<span class="dox_tag_name">op</span>
<span class="dox_type">string</span>
<span>An alphanumeric id</span>
</div>
<div class="dox_tag_detail">
<span class="dox_tag_name">cb</span>
<span class="dox_type">function</span>
<span>The callback function</span>
</div>
<div class="dox_tag_title">See</div>
<div class="dox_tag_detail">
<span class="dox_type">QueryBuilder.addDefaultOperators
</span>
</div>
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="nx">NDDB</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">addFilter</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">op</span><span class="p">,</span> <span class="nx">cb</span><span class="p">)</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="nx">op</span><span class="p">]</span> <span class="o">=</span> <span class="nx">cb</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">__userDefinedFilters</span><span class="p">[</span><span class="nx">op</span><span class="p">]</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="nx">op</span><span class="p">];</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs"><div class="dox">
<div class="summary">
<div class="pilwrap" id="nddb.adddefaultfilters">
<h3>
<a href="#nddb.adddefaultfilters" class="pilcrow">&#182;</a>
NDDB.addDefaultFilters
</h3>
</div>
</div>
<div class="body"><p>Register default filters for NDDB</p>
<p>Default filters include standard logical operators:</p>
<ul>
<li>'=', '==', '!=', ''>', >=', '&lt;', '&lt;=',</li>
</ul>
<p>and:</p>
<ul>
<li>'E': field exists (can be omitted, it is the default one)</li>
<li>'>&lt;': between values</li>
<li>'&lt;>': not between values</li>
<li>'in': element is found in array</li>
<li>'!in': element is noi found in array</li>
<li>'LIKE': string SQL LIKE (case sensitive)</li>
<li>'iLIKE': string SQL LIKE (case insensitive)</li>
</ul>
</div>
<div class="details">
<div class="dox_tag_title">See</div>
<div class="dox_tag_detail">
<span class="dox_type">NDDB.filters
</span>
</div>
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="nx">NDDB</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">addDefaultFilters</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span> <span class="o">=</span> <span class="p">{};</span>
<span class="kd">var</span> <span class="nx">that</span><span class="p">;</span>
<span class="nx">that</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-40" id="section-40">&#182;</a>
</div>
<p>Exists.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;E&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">d</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">d</span><span class="p">,</span> <span class="nx">c</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">d</span> <span class="k">in</span> <span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">c</span> <span class="o">=</span> <span class="nx">that</span><span class="p">.</span><span class="nx">getComparator</span><span class="p">(</span><span class="nx">d</span><span class="p">);</span>
<span class="nx">value</span><span class="p">[</span><span class="nx">d</span><span class="p">]</span> <span class="o">=</span> <span class="nx">value</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">&#39;*&#39;</span><span class="p">];</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">c</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">value</span><span class="p">[</span><span class="nx">d</span><span class="p">]</span> <span class="o">=</span> <span class="nx">value</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="s1">&#39;*&#39;</span><span class="p">];</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">c</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">!==</span> <span class="k">typeof</span> <span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">])</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">!==</span> <span class="k">typeof</span> <span class="nx">J</span><span class="p">.</span><span class="nx">getNestedValue</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span><span class="nx">elem</span><span class="p">))</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">!==</span> <span class="k">typeof</span> <span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">])</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">!==</span> <span class="k">typeof</span> <span class="nx">J</span><span class="p">.</span><span class="nx">getNestedValue</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span><span class="nx">elem</span><span class="p">))</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-41" id="section-41">&#182;</a>
</div>
<p>(strict) Equals.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;==&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-42" id="section-42">&#182;</a>
</div>
<p>(strict) Not Equals.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;!=&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">!==</span> <span class="mi">0</span><span class="p">)</span> <span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-43" id="section-43">&#182;</a>
</div>
<p>Smaller than.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;&gt;&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">d</span> <span class="o">||</span> <span class="nx">d</span> <span class="o">===</span> <span class="s1">&#39;*&#39;</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="o">===</span> <span class="mi">1</span><span class="p">)</span> <span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">])</span> <span class="k">return</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="o">===</span> <span class="mi">1</span><span class="p">)</span> <span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-44" id="section-44">&#182;</a>
</div>
<p>Greater than.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;&gt;=&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">d</span> <span class="o">||</span> <span class="nx">d</span> <span class="o">===</span> <span class="s1">&#39;*&#39;</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">compared</span> <span class="o">=</span> <span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">compared</span> <span class="o">===</span> <span class="mi">1</span> <span class="o">||</span> <span class="nx">compared</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">])</span> <span class="k">return</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">compared</span> <span class="o">=</span> <span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">compared</span> <span class="o">===</span> <span class="mi">1</span> <span class="o">||</span> <span class="nx">compared</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-45" id="section-45">&#182;</a>
</div>
<p>Smaller than.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;&lt;&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">d</span> <span class="o">||</span> <span class="nx">d</span> <span class="o">===</span> <span class="s1">&#39;*&#39;</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">===</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">])</span> <span class="k">return</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">===</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-46" id="section-46">&#182;</a>
</div>
<p>Smaller or equal than.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;&lt;=&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">d</span> <span class="o">||</span> <span class="nx">d</span> <span class="o">===</span> <span class="s1">&#39;*&#39;</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">compared</span> <span class="o">=</span> <span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">compared</span> <span class="o">===</span> <span class="o">-</span><span class="mi">1</span> <span class="o">||</span> <span class="nx">compared</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">])</span> <span class="k">return</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">compared</span> <span class="o">=</span> <span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">compared</span> <span class="o">===</span> <span class="o">-</span><span class="mi">1</span> <span class="o">||</span> <span class="nx">compared</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-47" id="section-47">&#182;</a>
</div>
<p>Between.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;&gt;&lt;&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">d</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">len</span><span class="p">;</span>
<span class="nx">len</span> <span class="o">=</span> <span class="nx">d</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span> <span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="mi">1</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span>
<span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">d</span> <span class="o">===</span> <span class="s1">&#39;*&#39;</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">d</span><span class="p">,</span> <span class="nx">c</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">d</span> <span class="k">in</span> <span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">c</span> <span class="o">=</span> <span class="nx">that</span><span class="p">.</span><span class="nx">getComparator</span><span class="p">(</span><span class="nx">d</span><span class="p">);</span>
<span class="nx">value</span><span class="p">[</span><span class="nx">d</span><span class="p">]</span> <span class="o">=</span> <span class="nx">value</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">&#39;*&#39;</span><span class="p">];</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">c</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">value</span><span class="p">[</span><span class="nx">d</span><span class="p">]</span> <span class="o">=</span> <span class="nx">value</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="s1">&#39;*&#39;</span><span class="p">];</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">c</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="mi">1</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span>
<span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-48" id="section-48">&#182;</a>
</div>
<p>Not Between.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;&lt;&gt;&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">d</span> <span class="o">||</span> <span class="nx">d</span> <span class="o">===</span> <span class="s1">&#39;*&#39;</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">0</span> <span class="o">||</span>
<span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="mi">1</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">])</span> <span class="k">return</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">0</span> <span class="o">||</span>
<span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="mi">1</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-49" id="section-49">&#182;</a>
</div>
<p>In Array.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;in&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">d</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">len</span><span class="p">;</span>
<span class="nx">len</span> <span class="o">=</span> <span class="nx">value</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">[</span><span class="nx">i</span><span class="p">],</span> <span class="mi">0</span><span class="p">)</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">obj</span><span class="p">,</span> <span class="nx">len</span><span class="p">;</span>
<span class="nx">obj</span> <span class="o">=</span> <span class="p">{},</span> <span class="nx">len</span> <span class="o">=</span> <span class="nx">value</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">obj</span><span class="p">[</span><span class="nx">d</span><span class="p">]</span> <span class="o">=</span> <span class="nx">value</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">obj</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-50" id="section-50">&#182;</a>
</div>
<p>Not In Array.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;!in&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">d</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">len</span><span class="p">;</span>
<span class="nx">len</span> <span class="o">=</span> <span class="nx">value</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">value</span><span class="p">[</span><span class="nx">i</span><span class="p">],</span> <span class="mi">0</span><span class="p">)</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">obj</span><span class="p">,</span> <span class="nx">len</span><span class="p">;</span>
<span class="nx">obj</span> <span class="o">=</span> <span class="p">{},</span> <span class="nx">len</span> <span class="o">=</span> <span class="nx">value</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">obj</span><span class="p">[</span><span class="nx">d</span><span class="p">]</span> <span class="o">=</span> <span class="nx">value</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">comparator</span><span class="p">(</span><span class="nx">elem</span><span class="p">,</span> <span class="nx">obj</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-51" id="section-51">&#182;</a>
</div>
<p>Supports <code>_</code> and <code>%</code> wildcards.</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="kd">function</span> <span class="nx">generalLike</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">,</span> <span class="nx">sensitive</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">regex</span><span class="p">;</span>
<span class="nb">RegExp</span><span class="p">.</span><span class="nx">escape</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">str</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">str</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/([.*+?^=!:${}()|[\]\/\\])/g</span><span class="p">,</span> <span class="s1">&#39;\\$1&#39;</span><span class="p">);</span>
<span class="p">};</span>
<span class="nx">regex</span> <span class="o">=</span> <span class="nb">RegExp</span><span class="p">.</span><span class="nx">escape</span><span class="p">(</span><span class="nx">value</span><span class="p">);</span>
<span class="nx">regex</span> <span class="o">=</span> <span class="nx">regex</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/%/g</span><span class="p">,</span> <span class="s1">&#39;.*&#39;</span><span class="p">).</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/_/g</span><span class="p">,</span> <span class="s1">&#39;.&#39;</span><span class="p">);</span>
<span class="nx">regex</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">RegExp</span><span class="p">(</span><span class="s1">&#39;^&#39;</span> <span class="o">+</span> <span class="nx">regex</span> <span class="o">+</span> <span class="s1">&#39;$&#39;</span><span class="p">,</span> <span class="nx">sensitive</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">d</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">len</span><span class="p">;</span>
<span class="nx">len</span> <span class="o">=</span> <span class="nx">d</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">!==</span> <span class="k">typeof</span> <span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">[</span><span class="nx">i</span><span class="p">]])</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">regex</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">[</span><span class="nx">i</span><span class="p">]]))</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">d</span> <span class="o">===</span> <span class="s1">&#39;*&#39;</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">d</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">d</span> <span class="k">in</span> <span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">!==</span> <span class="k">typeof</span> <span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">])</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">regex</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">]))</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">elem</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;undefined&#39;</span> <span class="o">!==</span> <span class="k">typeof</span> <span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">])</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">regex</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">elem</span><span class="p">[</span><span class="nx">d</span><span class="p">]))</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">elem</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">}</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-52" id="section-52">&#182;</a>
</div>
<p>Like operator (Case Sensitive).</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;LIKE&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span> <span class="nx">likeOperator</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">generalLike</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">);</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-53" id="section-53">&#182;</a>
</div>
<p>Like operator (Case Insensitive).</p>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">filters</span><span class="p">[</span><span class="s1">&#39;iLIKE&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span> <span class="nx">likeOperatorI</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">generalLike</span><span class="p">(</span><span class="nx">d</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">comparator</span><span class="p">,</span> <span class="s1">&#39;i&#39;</span><span class="p">);</span>
<span class="p">};</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs">
<div class="pilwrap" id="methods">
<h2>
<a href="#methods" class="pilcrow">&#182;</a>
METHODS
</h2>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre></pre></div>
</td>
</tr>
<tr>
<td class="docs"><div class="dox">
<div class="summary">
<div class="pilwrap" id="nddb.throwerr">
<h3>
<a href="#nddb.throwerr" class="pilcrow">&#182;</a>
NDDB.throwErr
</h3>
</div>
</div>
<div class="body"><p>Throws an error with a predefined format</p>
<p>The format is "constructor name" . "method name" : "error text" .</p>
<p>It does <strong>not</strong> perform type checking on itw own input parameters.</p>
</div>
<div class="details">
<div class="dox_tag_title">Params</div>
<div class="dox_tag_detail">
<span class="dox_tag_name">type</span>
<span class="dox_type">string</span>
<span>Optional. The error type, e.g. 'TypeError'.
Default, 'Error'</span>
</div>
<div class="dox_tag_detail">
<span class="dox_tag_name">method</span>
<span class="dox_type">string</span>
<span>Optional. The name of the method</span>
</div>
<div class="dox_tag_detail">
<span class="dox_tag_name">err</span>
<span class="dox_type">string</span>
<span class="dox_type">object</span>
<span>Optional. The error. Default, 'generic error'</span>
</div>
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="nx">NDDB</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">throwErr</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">type</span><span class="p">,</span> <span class="nx">method</span><span class="p">,</span> <span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">errMsg</span><span class="p">,</span> <span class="nx">text</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;object&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">err</span><span class="p">)</span> <span class="nx">text</span> <span class="o">=</span> <span class="nx">err</span><span class="p">.</span><span class="nx">stack</span> <span class="o">||</span> <span class="nx">err</span><span class="p">;</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="s1">&#39;string&#39;</span> <span class="o">===</span> <span class="k">typeof</span> <span class="nx">err</span><span class="p">)</span> <span class="nx">text</span> <span class="o">=</span> <span class="nx">err</span><span class="p">;</span>
<span class="nx">text</span> <span class="o">=</span> <span class="nx">text</span> <span class="o">||</span> <span class="s1">&#39;generic error&#39;</span><span class="p">;</span>
<span class="nx">errMsg</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_getConstrName</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">method</span><span class="p">)</span> <span class="nx">errMsg</span> <span class="o">=</span> <span class="nx">errMsg</span> <span class="o">+</span> <span class="s1">&#39;.&#39;</span> <span class="o">+</span> <span class="nx">method</span><span class="p">;</span>
<span class="nx">errMsg</span> <span class="o">=</span> <span class="nx">errMsg</span> <span class="o">+</span> <span class="s1">&#39;: &#39;</span> <span class="o">+</span> <span class="nx">text</span> <span class="o">+</span> <span class="s1">&#39;.&#39;</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">type</span> <span class="o">===</span> <span class="s1">&#39;TypeError&#39;</span><span class="p">)</span> <span class="k">throw</span> <span class="k">new</span> <span class="nx">TypeError</span><span class="p">(</span><span class="nx">errMsg</span><span class="p">);</span>
<span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="nx">errMsg</span><span class="p">);</span>
<span class="p">};</span></pre></div>
</td>
</tr>
<tr>
<td class="docs"><div class="dox">
<div class="summary">
<div class="pilwrap" id="nddb.init">
<h3>
<a href="#nddb.init" class="pilcrow">&#182;</a>
NDDB.init
</h3>
</div>
</div>
<div class="body"><p>Sets global options based on local configuration</p>
</div>
<div class="details">
<div class="dox_tag_title">Params</div>
<div class="dox_tag_detail">
<span class="dox_tag_name">options</span>
<span class="dox_type">object</span>
<span>Optional. Configuration options
TODO: type checking on input params</span>
</div>
</div>
</div>
</td>
<td class="code highlight"><div class="highlight"><pre> <span class="nx">NDDB</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">init</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">options</span><span class="