UNPKG

obj-chain-core

Version:

fluent chaining for obj with dot-prop access

1,613 lines (445 loc) 20.3 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ObjChain - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ObjChain.html">ObjChain</a><ul class='methods'><li data-type='method'><a href="ObjChain.html#.init">init</a></li><li data-type='method'><a href="ObjChain.html#escape">escape</a></li><li data-type='method'><a href="ObjChain.html#extend">extend</a></li><li data-type='method'><a href="ObjChain.html#has">has</a></li><li data-type='method'><a href="ObjChain.html#setIfNotEmpty">setIfNotEmpty</a></li><li data-type='method'><a href="ObjChain.html#toString">toString</a></li><li data-type='method'><a href="ObjChain.html#use">use</a></li><li data-type='method'><a href="ObjChain.html#val">val</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html"></a></li><li><a href="global.html#configPlugin">configPlugin</a></li><li><a href="global.html#flow">flow</a></li><li><a href="global.html#remove">remove</a></li><li><a href="global.html#set">set</a></li><li><a href="global.html#write">write</a></li></ul> </nav> <div id="main"> <h1 class="page-title">ObjChain</h1> <section> <header> <h2> ObjChain </h2> </header> <article> <div class="container-overview"> <h4 class="name" id="ObjChain"><span class="type-signature"></span>new ObjChain<span class="signature">(data, plugins<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line46">line 46</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>data</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>plugins</code></td> <td class="type"> <span class="param-type">Array:<a href="global.html"></a>.&lt;string:<a href="global.html"></a>></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> <code>[]</code> </td> <td class="description last"></td> </tr> </tbody> </table> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".init"><span class="type-signature">(static) </span>init<span class="signature">(data, plugins<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="ObjChain.html">ObjChain</a>}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line53">line 53</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>data</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last">json data</td> </tr> <tr> <td class="name"><code>plugins</code></td> <td class="type"> <span class="param-type">Array:<a href="global.html"></a>.&lt;string:<a href="global.html"></a>></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> <code>[]</code> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type"><a href="ObjChain.html">ObjChain</a></span> </dd> </dl> <h4 class="name" id="escape"><span class="type-signature"></span>escape<span class="signature">(key)</span><span class="type-signature"> &rarr; {string}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line148">line 148</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>key</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">key with `.`</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> string with escaped `\\.` </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id="extend"><span class="type-signature"></span>extend<span class="signature">(methods, nest<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="ObjChain.html">ObjChain</a>}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line297">line 297</a> </li></ul></dd> </dl> <div class="description"> take strings, make them methods to .set on </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>methods</code></td> <td class="type"> <span class="param-type">Array:<a href="global.html"></a>.&lt;string:<a href="global.html"></a>></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>nest</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> <code>false</code> </td> <td class="description last">nest the .set</td> </tr> </tbody> </table> <h5>Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type"><a href="ObjChain.html">ObjChain</a></span> </dd> </dl> <h4 class="name" id="has"><span class="type-signature"></span>has<span class="signature">(key)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line169">line 169</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>key</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">any</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="setIfNotEmpty"><span class="type-signature"></span>setIfNotEmpty<span class="signature">(key, val)</span><span class="type-signature"> &rarr; {<a href="ObjChain.html">ObjChain</a>}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line159">line 159</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>ObjChain.has</li> </ul> </dd> </dl> <div class="description"> sets !.has(key) </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>key</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">any</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>val</code></td> <td class="type"> <span class="param-type">Serializable</span> | <span class="param-type">any</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> @chainable </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type"><a href="ObjChain.html">ObjChain</a></span> </dd> </dl> <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line326">line 326</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id="use"><span class="type-signature"></span>use<span class="signature">(obj)</span><span class="type-signature"> &rarr; {<a href="ObjChain.html">ObjChain</a>}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line233">line 233</a> </li></ul></dd> </dl> <div class="description"> use middleware </div> <h5>Parameters:</h5> <table class="params"> <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">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type"><a href="ObjChain.html">ObjChain</a></span> </dd> </dl> <h4 class="name" id="val"><span class="type-signature"></span>val<span class="signature">(key<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {any}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line190">line 190</a> </li></ul></dd> </dl> <div class="description"> get a value </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>key</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">any</span> | <span class="param-type">null</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> <code>null</code> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> current key or named if there is key param </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">any</span> </dd> </dl> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri Apr 28 2017 01:03:22 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>