Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Yonaba/Moses.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorYonaba <roland.yonaba@gmail.com>2017-04-10 16:13:25 +0300
committerYonaba <roland.yonaba@gmail.com>2017-04-10 16:13:25 +0300
commitadf136ea2b1cd41ea1bda6120d03809f1aa12a9e (patch)
tree5433dcc7f9d66fb3231d3dcb25ffa8eade6e1b9c /doc
parent30e0a15a5e9991d7f41bdc0fc331aee3b5bc2fe1 (diff)
Added _.kvpairs
Diffstat (limited to 'doc')
-rw-r--r--doc/index.html37
-rw-r--r--doc/topics/tutorial.md.html20
-rw-r--r--doc/tutorial.md15
3 files changed, 66 insertions, 6 deletions
diff --git a/doc/index.html b/doc/index.html
index 2389521..30e5389 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -454,6 +454,10 @@
<td class="summary">Returns the values of the object properties.</td>
</tr>
<tr>
+ <td class="name" nowrap><a href="#pairs">pairs (obj)</a></td>
+ <td class="summary">Converts keys and values a an array-list of [k, v].</td>
+ </tr>
+ <tr>
<td class="name" nowrap><a href="#toBoolean">toBoolean (value)</a></td>
<td class="summary">Converts any given value to a boolean</td>
</tr>
@@ -511,7 +515,7 @@
</tr>
<tr>
<td class="name" nowrap><a href="#isIterable">isIterable (obj)</a></td>
- <td class="summary">Checks if the given object is iterable with <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pairs">pairs</a> (or <a href="https://www.lua.org/manual/5.1/manual.html#pdf-ipairs">ipairs</a>).</td>
+ <td class="summary">Checks if the given object is iterable with <a href="index.html#pairs">pairs</a> (or <a href="https://www.lua.org/manual/5.1/manual.html#pdf-ipairs">ipairs</a>).</td>
</tr>
<tr>
<td class="name" nowrap><a href="#isEmpty">isEmpty ([obj])</a></td>
@@ -3707,6 +3711,31 @@
</dd>
<dt>
+ <a name = "pairs"></a>
+ <strong>pairs (obj)</strong>
+ </dt>
+ <dd>
+ Converts keys and values a an array-list of [k, v].
+
+
+ <h3>Parameters:</h3>
+ <ul>
+ <li><span class="parameter">obj</span>
+ an object
+ </li>
+ </ul>
+
+ <h3>Returns:</h3>
+ <ol>
+
+ an array list of key-values pairs
+ </ol>
+
+
+
+
+</dd>
+ <dt>
<a name = "toBoolean"></a>
<strong>toBoolean (value)</strong>
</dt>
@@ -4120,7 +4149,7 @@
<strong>isIterable (obj)</strong>
</dt>
<dd>
- Checks if the given object is iterable with <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pairs">pairs</a> (or <a href="https://www.lua.org/manual/5.1/manual.html#pdf-ipairs">ipairs</a>).
+ Checks if the given object is iterable with <a href="index.html#pairs">pairs</a> (or <a href="https://www.lua.org/manual/5.1/manual.html#pdf-ipairs">ipairs</a>).
<h3>Parameters:</h3>
@@ -4133,7 +4162,7 @@
<h3>Returns:</h3>
<ol>
- <code>true</code> if the object can be iterated with <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pairs">pairs</a> (or <a href="https://www.lua.org/manual/5.1/manual.html#pdf-ipairs">ipairs</a>), <code>false</code> otherwise
+ <code>true</code> if the object can be iterated with <a href="index.html#pairs">pairs</a> (or <a href="https://www.lua.org/manual/5.1/manual.html#pdf-ipairs">ipairs</a>), <code>false</code> otherwise
</ol>
@@ -4458,7 +4487,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
-<i style="float:right;">Last updated 2017-04-10 12:44:34 </i>
+<i style="float:right;">Last updated 2017-04-10 13:11:54 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
diff --git a/doc/topics/tutorial.md.html b/doc/topics/tutorial.md.html
index a9e00ac..dc6c881 100644
--- a/doc/topics/tutorial.md.html
+++ b/doc/topics/tutorial.md.html
@@ -1643,6 +1643,22 @@ _.values({<span class="number">1</span>,<span class="number">2</span>,<span clas
</pre>
+<h3>kvpairs (obj)</h3>
+
+<p>Converts an object to an array-list of key-value pairs.</p>
+
+<pre>
+<span class="keyword">local</span> obj = {x = <span class="number">1</span>, y = <span class="number">2</span>, z = <span class="number">3</span>}
+_.each(_.kvpairs(obj), <span class="keyword">function</span>(k,v)
+ <span class="global">print</span>(k, <span class="global">table</span>.concat(v,<span class="string">','</span>))
+<span class="keyword">end</span>)
+
+<span class="comment">-- =&gt; 1 y,2
+</span><span class="comment">-- =&gt; 2 x,1
+</span><span class="comment">-- =&gt; 3 z,3</span>
+</pre>
+
+
<h3>toBoolean (value)</h3>
<p>Converts a given value to a boolean.</p>
@@ -1809,7 +1825,7 @@ _.isArray({}) <span class="comment">-- =&gt; true
<h3>isIterable (obj)</h3>
-<p>Checks if the given object is iterable with <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pairs">pairs</a>.</p>
+<p>Checks if the given object is iterable with <a href="../index.html#pairs">pairs</a>.</p>
<pre>
_.isIterable({}) <span class="comment">-- =&gt; true
@@ -2024,7 +2040,7 @@ _.import(context, <span class="keyword">true</span>)
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
-<i style="float:right;">Last updated 2017-04-10 12:44:34 </i>
+<i style="float:right;">Last updated 2017-04-10 13:11:54 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
diff --git a/doc/tutorial.md b/doc/tutorial.md
index 80091c7..721dce7 100644
--- a/doc/tutorial.md
+++ b/doc/tutorial.md
@@ -1416,6 +1416,21 @@ _.values({1,2,3}) -- => "{1,2,3}"
_.values({x = 0, y = 1}) -- => "{1,0}"
````
+### kvpairs (obj)
+
+Converts an object to an array-list of key-value pairs.
+
+```lua
+local obj = {x = 1, y = 2, z = 3}
+_.each(_.kvpairs(obj), function(k,v)
+ print(k, table.concat(v,','))
+end)
+
+-- => 1 y,2
+-- => 2 x,1
+-- => 3 z,3
+````
+
### toBoolean (value)
Converts a given value to a boolean.