<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>util/using.js - Documentation</title>

    <!--[if lt IE 9]>
        <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/main.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 class="nav">
    <h2 class="home-link"><a href="index.html">immutadot</a></h2><h3>Namespaces</h3><ul><li><details open><summary><a href="array.html">array</a></summary><ul class='methods'><li data-type='method'><a href="array.html#.push">push</a></li><li data-type='method'><a href="array.html#.xor">xor</a></li></ul></details></li><li><details open><summary><a href="collection.html">collection</a></summary><ul class='methods'><li data-type='method'><a href="collection.html#.map">map</a></li></ul></details></li><li><details open><summary><a href="lang.html">lang</a></summary><ul class='methods'><li data-type='method'><a href="lang.html#.toggle">toggle</a></li></ul></details></li><li><details open><summary><a href="math.html">math</a></summary><ul class='methods'><li data-type='method'><a href="math.html#.add">add</a></li></ul></details></li><li><details open><summary><a href="object.html">object</a></summary><ul class='methods'><li data-type='method'><a href="object.html#.assign">assign</a></li><li data-type='method'><a href="object.html#.mapValues">mapValues</a></li><li data-type='method'><a href="object.html#.pickBy">pickBy</a></li><li data-type='method'><a href="object.html#.set">set</a></li><li data-type='method'><a href="object.html#.unset">unset</a></li><li data-type='method'><a href="object.html#.update">update</a></li></ul></details></li><li><details open><summary><a href="seq.html">seq</a></summary><ul class='methods'><li data-type='method'><a href="seq.html#.chain">chain</a></li><li data-type='method'><a href="seq.html#value">value</a></li></ul></details></li><li><details open><summary><a href="util.html">util</a></summary><ul class='methods'><li data-type='method'><a href="util.html#.using">using</a></li></ul></details></li></ul>
</nav>

<div id="main" class="main-container">
    
        <h1 class="page-title">util/using.js</h1>
    

    



    
    <section>
        <article>
            <pre class="source linenums"><code><ol class="lines"><li id="line1" class="line"><span class="hljs-keyword">import</span> UsingWrapper <span class="hljs-keyword">from</span> <span class="hljs-string">'./UsingWrapper'</span></li><li id="line2" class="line"></li><li id="line3" class="line"><span class="hljs-comment">/**</span></li><li id="line4" class="line"><span class="hljs-comment"> * Allows to specify one or several paths to use as arguments for an immutadot function call.</span></li><li id="line5" class="line"><span class="hljs-comment"> * @function using</span></li><li id="line6" class="line"><span class="hljs-comment"> * @memberof util</span></li><li id="line7" class="line"><span class="hljs-comment"> * @param {...(Array|string)} paths The paths to use as arguments.</span></li><li id="line8" class="line"><span class="hljs-comment"> * @return {Object} Returns an object with immutadot functions.</span></li><li id="line9" class="line"><span class="hljs-comment"> * @example &lt;caption&gt;Add &lt;code&gt;b&lt;/code&gt; to &lt;code&gt;a&lt;/code&gt;&lt;/caption&gt;</span></li><li id="line10" class="line"><span class="hljs-comment"> * const o = { nested: { a: 2, b: 3 } }</span></li><li id="line11" class="line"><span class="hljs-comment"> * using('nested.b').add(o, 'nested.a') // =&gt; { nested: { a: 5, b: 3 } }</span></li><li id="line12" class="line"><span class="hljs-comment"> * @example &lt;caption&gt;Replace &lt;code&gt;a&lt;/code&gt; by &lt;code&gt;a * b + c&lt;/code&gt;&lt;/caption&gt;</span></li><li id="line13" class="line"><span class="hljs-comment"> * const o = { nested: { a: 2, b: 3, c: 4 } }</span></li><li id="line14" class="line"><span class="hljs-comment"> * using('nested.b', 'nested.c')</span></li><li id="line15" class="line"><span class="hljs-comment"> *   .update(o, 'nested.a', (a, b, c) =&gt; a * b + c) // =&gt; { nested: { a: 10, b: 3, c: 4 } }</span></li><li id="line16" class="line"><span class="hljs-comment"> * @since 0.1.12</span></li><li id="line17" class="line"><span class="hljs-comment"> */</span></li><li id="line18" class="line"><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> (...paths) =&gt; <span class="hljs-keyword">new</span> UsingWrapper(...paths)</li><li id="line19" class="line"></li></ol></code></pre>
        </article>
    </section>





</div>

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script src="scripts/main.js"></script>
</body>
</html>
