Skip to content

Commit 41f1d2d

Browse files
committed
docs(parsers): improve the parser examples
1 parent e8b73c2 commit 41f1d2d

28 files changed

+67
-99
lines changed

docs/BaseBinding.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ <h5>Returns:</h5>
23832383
<br class="clear">
23842384

23852385
<footer>
2386-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 22:46:41 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2386+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 23:06:42 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
23872387
</footer>
23882388

23892389
<script>prettyPrint();</script>

docs/ByteLengthParser.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ <h4 class="name" id="ByteLengthParser"><span class="type-signature"></span>new B
6969

7070
<dt class="tag-source">Source:</dt>
7171
<dd class="tag-source"><ul class="dummy"><li>
72-
<a href="parsers_byte-length.js.html">parsers/byte-length.js</a>, <a href="parsers_byte-length.js.html#line20">line 20</a>
72+
<a href="parsers_byte-length.js.html">parsers/byte-length.js</a>, <a href="parsers_byte-length.js.html#line18">line 18</a>
7373
</li></ul></dd>
7474

7575

@@ -118,14 +118,12 @@ <h4 class="name" id="ByteLengthParser"><span class="type-signature"></span>new B
118118

119119
<h5>Example</h5>
120120

121-
<pre class="prettyprint"><code>To use the `ByteLength` parser:
122-
```js
121+
<pre class="prettyprint"><code>// To use the `ByteLength` parser:
123122
const SerialPort = require('serialport');
124123
const ByteLength = SerialPort.parsers.ByteLength
125124
const port = new SerialPort('/dev/tty-usbserial1');
126125
const parser = port.pipe(new ByteLength({length: 8}));
127-
parser.on('data', console.log); // will have 8 bytes per data event
128-
```</code></pre>
126+
parser.on('data', console.log); // will have 8 bytes per data event</code></pre>
129127

130128

131129

@@ -285,7 +283,7 @@ <h3 class="subsection-title">Extends</h3>
285283
<br class="clear">
286284

287285
<footer>
288-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 22:46:41 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
286+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 23:06:42 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
289287
</footer>
290288

291289
<script>prettyPrint();</script>

docs/CCTalkParser.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ <h4 class="name" id="CCTalkParser"><span class="type-signature"></span>new CCTal
6969

7070
<dt class="tag-source">Source:</dt>
7171
<dd class="tag-source"><ul class="dummy"><li>
72-
<a href="parsers_cctalk.js.html">parsers/cctalk.js</a>, <a href="parsers_cctalk.js.html#line17">line 17</a>
72+
<a href="parsers_cctalk.js.html">parsers/cctalk.js</a>, <a href="parsers_cctalk.js.html#line15">line 15</a>
7373
</li></ul></dd>
7474

7575

@@ -118,14 +118,12 @@ <h4 class="name" id="CCTalkParser"><span class="type-signature"></span>new CCTal
118118

119119
<h5>Example</h5>
120120

121-
<pre class="prettyprint"><code>CCTalk Messages are emitted as buffers.
122-
```js
121+
<pre class="prettyprint"><code>// CCTalk Messages are emitted as buffers.
123122
const SerialPort = require('serialport');
124123
const CCTalk = SerialPort.parsers.CCTalk;
125124
const port = new SerialPort('/dev/ttyUSB0');
126125
const parser = port.pipe(new CCtalk());
127-
parser.on('data', console.log);
128-
```</code></pre>
126+
parser.on('data', console.log);</code></pre>
129127

130128

131129

@@ -187,7 +185,7 @@ <h3 class="subsection-title">Extends</h3>
187185
<br class="clear">
188186

189187
<footer>
190-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 22:46:41 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
188+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 23:06:42 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
191189
</footer>
192190

193191
<script>prettyPrint();</script>

docs/DelimiterParser.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ <h4 class="name" id="DelimiterParser"><span class="type-signature"></span>new De
6969

7070
<dt class="tag-source">Source:</dt>
7171
<dd class="tag-source"><ul class="dummy"><li>
72-
<a href="parsers_delimiter.js.html">parsers/delimiter.js</a>, <a href="parsers_delimiter.js.html#line17">line 17</a>
72+
<a href="parsers_delimiter.js.html">parsers/delimiter.js</a>, <a href="parsers_delimiter.js.html#line15">line 15</a>
7373
</li></ul></dd>
7474

7575

@@ -118,14 +118,12 @@ <h4 class="name" id="DelimiterParser"><span class="type-signature"></span>new De
118118

119119
<h5>Example</h5>
120120

121-
<pre class="prettyprint"><code>To use the `Delimiter` parser, provide a delimiter as a string, buffer, or array of bytes:
122-
```js
121+
<pre class="prettyprint"><code>// To use the `Delimiter` parser, provide a delimiter as a string, buffer, or array of bytes:
123122
const SerialPort = require('serialport');
124123
const Delimiter = SerialPort.parsers.Delimiter;
125124
const port = new SerialPort('/dev/tty-usbserial1');
126-
const parser = port.pipe(new Delimiter({ delimiter: Buffer.from('EOL') }));
127-
parser.on('data', console.log);
128-
```</code></pre>
125+
const parser = port.pipe(new Delimiter({ delimiter: '\n' }));
126+
parser.on('data', console.log);</code></pre>
129127

130128

131129

@@ -187,7 +185,7 @@ <h3 class="subsection-title">Extends</h3>
187185
<br class="clear">
188186

189187
<footer>
190-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 22:46:41 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
188+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 23:06:42 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
191189
</footer>
192190

193191
<script>prettyPrint();</script>

docs/Poller.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ <h5>Returns:</h5>
576576
<br class="clear">
577577

578578
<footer>
579-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 22:46:41 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
579+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 23:06:42 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
580580
</footer>
581581

582582
<script>prettyPrint();</script>

docs/ReadLineParser.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ <h2>
4343
ReadLineParser
4444
</h2>
4545

46-
<div class="class-description"><p>A transform stream that emits data after a newline delimiter is received.</p></div>
46+
<div class="class-description"><p>A transform stream that emits data after a newline delimiter is received.</p>
47+
<p> To use the <code>Readline</code> parser, provide a delimiter (defaults to <code>\n</code>). Data is emitted as string controllable by the <code>encoding</code> option (defaults to <code>utf8</code>).</p></div>
4748

4849

4950
</header>
@@ -69,7 +70,7 @@ <h4 class="name" id="ReadLineParser"><span class="type-signature"></span>new Rea
6970

7071
<dt class="tag-source">Source:</dt>
7172
<dd class="tag-source"><ul class="dummy"><li>
72-
<a href="parsers_readline.js.html">parsers/readline.js</a>, <a href="parsers_readline.js.html#line17">line 17</a>
73+
<a href="parsers_readline.js.html">parsers/readline.js</a>, <a href="parsers_readline.js.html#line16">line 16</a>
7374
</li></ul></dd>
7475

7576

@@ -118,14 +119,11 @@ <h4 class="name" id="ReadLineParser"><span class="type-signature"></span>new Rea
118119

119120
<h5>Example</h5>
120121

121-
<pre class="prettyprint"><code>To use the `Readline` parser, provide a delimiter (defaults to '\n'). Data is emitted as string controllable by the `encoding` option (defaults to `utf8`).
122-
```js
123-
const SerialPort = require('serialport');
122+
<pre class="prettyprint"><code>const SerialPort = require('serialport');
124123
const Readline = SerialPort.parsers.Readline;
125124
const port = new SerialPort('/dev/tty-usbserial1');
126125
const parser = port.pipe(new Readline({ delimiter: '\r\n' }));
127-
parser.on('data', console.log);
128-
```</code></pre>
126+
parser.on('data', console.log);</code></pre>
129127

130128

131129

@@ -187,7 +185,7 @@ <h3 class="subsection-title">Extends</h3>
187185
<br class="clear">
188186

189187
<footer>
190-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 22:46:41 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
188+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 23:06:42 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
191189
</footer>
192190

193191
<script>prettyPrint();</script>

docs/ReadyParser.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ <h2>
4343
ReadyParser
4444
</h2>
4545

46-
<div class="class-description"><p>A transform stream that waits for a sequence of &quot;ready&quot; bytes before emitting a ready event and emitting data events</p></div>
46+
<div class="class-description"><p>A transform stream that waits for a sequence of &quot;ready&quot; bytes before emitting a ready event and emitting data events</p>
47+
<p>To use the <code>Ready</code> parser provide a byte start sequence. After the bytes have been received a ready event is fired and data events are passed through.</p></div>
4748

4849

4950
</header>
@@ -69,7 +70,7 @@ <h4 class="name" id="ReadyParser"><span class="type-signature"></span>new ReadyP
6970

7071
<dt class="tag-source">Source:</dt>
7172
<dd class="tag-source"><ul class="dummy"><li>
72-
<a href="parsers_ready.js.html">parsers/ready.js</a>, <a href="parsers_ready.js.html#line18">line 18</a>
73+
<a href="parsers_ready.js.html">parsers/ready.js</a>, <a href="parsers_ready.js.html#line17">line 17</a>
7374
</li></ul></dd>
7475

7576

@@ -118,15 +119,12 @@ <h4 class="name" id="ReadyParser"><span class="type-signature"></span>new ReadyP
118119

119120
<h5>Example</h5>
120121

121-
<pre class="prettyprint"><code>To use the `Ready` parser provide a byte start sequence. After the bytes have been received a ready event is fired and data events are passed through.
122-
```js
123-
const SerialPort = require('serialport');
122+
<pre class="prettyprint"><code>const SerialPort = require('serialport');
124123
const Ready = SerialPort.parsers.Ready;
125124
const port = new SerialPort('/dev/tty-usbserial1');
126125
const parser = port.pipe(new Ready({ delimiter: 'READY' }));
127126
parser.on('ready', () => console.log('the ready byte sequence has been received'))
128-
parser.on('data', console.log); // all data after READY is received
129-
```</code></pre>
127+
parser.on('data', console.log); // all data after READY is received</code></pre>
130128

131129

132130

@@ -292,7 +290,7 @@ <h3 class="subsection-title">Extends</h3>
292290
<br class="clear">
293291

294292
<footer>
295-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 22:46:41 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
293+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 23:06:42 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
296294
</footer>
297295

298296
<script>prettyPrint();</script>

docs/RegexParser.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ <h2>
4343
RegexParser
4444
</h2>
4545

46-
<div class="class-description"><p>A transform stream that uses a regular expression to split the incoming text upon.</p></div>
46+
<div class="class-description"><p>A transform stream that uses a regular expression to split the incoming text upon.</p>
47+
<p>To use the <code>Regex</code> parser provide a regular expression to split the incoming text upon. Data is emitted as string controllable by the <code>encoding</code> option (defaults to <code>utf8</code>).</p></div>
4748

4849

4950
</header>
@@ -69,7 +70,7 @@ <h4 class="name" id="RegexParser"><span class="type-signature"></span>new RegexP
6970

7071
<dt class="tag-source">Source:</dt>
7172
<dd class="tag-source"><ul class="dummy"><li>
72-
<a href="parsers_regex.js.html">parsers/regex.js</a>, <a href="parsers_regex.js.html#line17">line 17</a>
73+
<a href="parsers_regex.js.html">parsers/regex.js</a>, <a href="parsers_regex.js.html#line15">line 15</a>
7374
</li></ul></dd>
7475

7576

@@ -118,14 +119,11 @@ <h4 class="name" id="RegexParser"><span class="type-signature"></span>new RegexP
118119

119120
<h5>Example</h5>
120121

121-
<pre class="prettyprint"><code>To use the `Regex` parser provide a regular expression to split the incoming text upon. Data is emitted as string controllable by the `encoding` option (defaults to `utf8`).
122-
```js
123-
const SerialPort = require('serialport');
122+
<pre class="prettyprint"><code>const SerialPort = require('serialport');
124123
const Regex = SerialPort.parsers.Regex;
125124
const port = new SerialPort('/dev/tty-usbserial1');
126125
const parser = port.pipe(new Regex({ regex: /[\r\n]+/ }));
127-
parser.on('data', console.log);
128-
```</code></pre>
126+
parser.on('data', console.log);</code></pre>
129127

130128

131129

@@ -187,7 +185,7 @@ <h3 class="subsection-title">Extends</h3>
187185
<br class="clear">
188186

189187
<footer>
190-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 22:46:41 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
188+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 23:06:42 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
191189
</footer>
192190

193191
<script>prettyPrint();</script>

docs/SerialPort.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2981,7 +2981,7 @@ <h5>Returns:</h5>
29812981
<br class="clear">
29822982

29832983
<footer>
2984-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 22:46:41 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2984+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 23:06:42 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
29852985
</footer>
29862986

29872987
<script>prettyPrint();</script>

docs/bindings_base.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ <h1 class="page-title">bindings/base.js</h1>
280280
<br class="clear">
281281

282282
<footer>
283-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 22:46:41 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
283+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Feb 27 2018 23:06:42 GMT-0500 (EST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
284284
</footer>
285285

286286
<script>prettyPrint();</script>

0 commit comments

Comments
 (0)