simplecsv
Version:
Fast and compact CSV parser for parsing CSV with CSV to JSON support.
650 lines (178 loc) • 8.58 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: private</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-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: private</h1>
<section>
<header>
<h2>
private
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="private"><span class="type-signature"></span>new private<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Constructs a new private class.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_private.js.html">lib/private.js</a>, <a href="lib_private.js.html#line13">line 13</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".doubleQuoteIfNecessary"><span class="type-signature">(static) </span>doubleQuoteIfNecessary<span class="signature">(input)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Double-quotes the fields according the rules on Wikipedia as of 6/2015.
(<a href="https://en.wikipedia.org/wiki/Comma-separated_values">https://en.wikipedia.org/wiki/Comma-separated_values</a>)</p>
<ul>
<li>Fields with embedded commas or double-quote characters must be quoted.</li>
<li>Each of the embedded double-quote characters must be represented by a pair of double-quote characters.</li>
<li>Fields with embedded line breaks must be quoted.</li>
<li>(Python addition) Python csv parser double-quotes <code>\r</code> always.</li>
</ul>
</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>input</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Input to double quote if necessary.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_private.js.html">lib/private.js</a>, <a href="lib_private.js.html#line25">line 25</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".getArg"><span class="type-signature">(static) </span>getArg<span class="signature">(argDic, argName, defVal)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Get the argument from the argument dictionary, with a default value.
Default value (defval) is returned if the argument is not in the argument:value
dictionary, or, if the argument's type is not the same as default value.</p>
</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>argDic</code></td>
<td class="type">
<span class="param-type">dictionary</span>
</td>
<td class="description last"><p>A dictionary of the type argName: value</p></td>
</tr>
<tr>
<td class="name"><code>argName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The name of the argument to be found in dictionary</p></td>
</tr>
<tr>
<td class="name"><code>defVal</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"><p>If it cannot find this argName in argDic, it returns defVal.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_private.js.html">lib/private.js</a>, <a href="lib_private.js.html#line52">line 52</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".parseStringToArray"><span class="type-signature">(static) </span>parseStringToArray<span class="signature">(argdic, str)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Given a csv string, it parses it into double array.
Delimiter can be changed with argdic's delim parameter.</p>
<p>Follows the csv format described in <a href="http://tools.ietf.org/html/rfc4180">http://tools.ietf.org/html/rfc4180</a>
as in: <em>"Fields containing line breaks (CRLF), double quotes, and commas
should be enclosed in double-quotes."</em></p>
</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>argdic</code></td>
<td class="type">
<span class="param-type">dictionary</span>
</td>
<td class="description last"><p>A dictionary of possible parameters.</p></td>
</tr>
<tr>
<td class="name"><code>str</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>csv string to be parsed.
Recognized values are:</p>
<ul>
<li><code>hasHeaders</code>: boolean - Whether str has header column. <em>[default: false]</em></li>
<li><code>delim</code>: char - Single delimiter char <em>[default: ',']</em></li>
<li><code>hasComments</code>: boolean - Whether str has comments. If true, any row which
starts with <code>#</code> will be skipped. <em>[default: false]</em></li>
</ul></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_private.js.html">lib/private.js</a>, <a href="lib_private.js.html#line73">line 73</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-simplecsv.html">simplecsv</a></li></ul><h3>Classes</h3><ul><li><a href="csv.html">csv</a></li><li><a href="csvdata.html">csvdata</a></li><li><a href="private.html">private</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.2</a> on Fri Jul 17 2015 02:09:00 GMT-0400 (EDT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>