node-query/docs/module-helpers.html

1114 lines
14 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DocStrap Module: helpers</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.cosmo.css">
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<a class="brand" href="index.html">DocStrap</a>
<ul class="nav">
<li class="dropdown">
<a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="module-adapter.html">adapter</a>
</li>
<li>
<a href="module-driver.html">driver</a>
</li>
<li>
<a href="module-helpers.html">helpers</a>
</li>
<li>
<a href="module-node-query.html">node-query</a>
</li>
<li>
<a href="module-query-builder.html">query-builder</a>
</li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<div id="main">
<h1 class="page-title">Module: helpers</h1>
<section>
<header>
<h2>
helpers
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="helpers.js.html">helpers.js</a>,
<a href="helpers.js.html#sunlight-1-line-3">line 3</a>
</li>
</ul>
</dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<dt class="name" id="is[type]">
<h4><span class="type-signature">&lt;inner> </span>is[type]<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Determine whether a variable is of the type specified in the
function name, eg isNumber</p>
<p>Types available are Null, Undefined, Object, Array, String, Number, Boolean, Function, RegExp, NaN and Infinite</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="helpers.js.html">helpers.js</a>,
<a href="helpers.js.html#sunlight-1-line-100">line 100</a>
</li>
</ul>
</dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="arrayPluck"><span class="type-signature">&lt;static> </span>arrayPluck<span class="signature">(arr, key)</span><span class="type-signature"> &rarr; {Array}</span></h4>
</dt>
<dd>
<div class="description">
<p>Get a list of values with a common key from an array of objects</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>arr</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>The array of objects to search</p></td>
</tr>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>The key of the object to get</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="helpers.js.html">helpers.js</a>,
<a href="helpers.js.html#sunlight-1-line-57">line 57</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="isScalar"><span class="type-signature">&lt;static> </span>isScalar<span class="signature">(obj)</span><span class="type-signature"> &rarr; {bool}</span></h4>
</dt>
<dd>
<div class="description">
<p>Determine whether an object is scalar</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">mixed</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="helpers.js.html">helpers.js</a>,
<a href="helpers.js.html#sunlight-1-line-46">line 46</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">bool</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="regexInArray"><span class="type-signature">&lt;static> </span>regexInArray<span class="signature">(arr, pattern)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Determine if a value matching the passed regular expression is
in the passed array</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>arr</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>The array to search</p></td>
</tr>
<tr>
<td class="name"><code>pattern</code></td>
<td class="type">
<span class="param-type">RegExp</span>
</td>
<td class="description last"><p>The pattern to match</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="helpers.js.html">helpers.js</a>,
<a href="helpers.js.html#sunlight-1-line-80">line 80</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>If an array item matches the pattern</li>
</ul>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="stringTrim"><span class="type-signature">&lt;static> </span>stringTrim<span class="signature">(str)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
<p>Wrap String.prototype.trim in a way that is easily mappable</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>str</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>The string to trim</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="helpers.js.html">helpers.js</a>,
<a href="helpers.js.html#sunlight-1-line-14">line 14</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>The trimmed string</li>
</ul>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="type"><span class="type-signature">&lt;static> </span>type<span class="signature">(o)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
<p>Get the type of the variable passed</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>o</code></td>
<td class="type">
<span class="param-type">mixed</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="helpers.js.html">helpers.js</a>,
<a href="helpers.js.html#sunlight-1-line-25">line 25</a>
</li>
</ul>
</dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="https://techblog.badoo.com/blog/2013/11/01/type-checking-in-javascript/">https://techblog.badoo.com/blog/2013/11/01/type-checking-in-javascript/</a></li>
<li><a href="http://toddmotto.com/understanding-javascript-types-and-reliable-type-checking/">http://toddmotto.com/understanding-javascript-types-and-reliable-type-checking/</a></li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
DocStrap Copyright © 2012-2014 The contributors to the JSDoc3 and DocStrap projects.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Mon Dec 1st 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>
<div class="span3">
<div id="toc"></div>
</div>
<br clear="both">
</div>
</div>
<!--<script src="scripts/sunlight.js"></script>-->
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : "100px"
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
// $( ".tutorial-section pre, .readme-section pre" ).addClass( "sunlight-highlight-javascript" ).addClass( "linenums" );
$( ".tutorial-section pre, .readme-section pre" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
lang = "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
</body>
</html>