Skip to content

Commit

Permalink
new wersion: fix space and spec on json
Browse files Browse the repository at this point in the history
  • Loading branch information
siarheidudko committed Jan 15, 2020
1 parent c09c672 commit 6bc9d4e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-se
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 12:19:17 GMT+0300 (GMT+03:00)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Wed Jan 15 2020 09:30:06 GMT+0300 (GMT+03:00)
</footer>

<script> prettyPrint(); </script>
Expand Down
14 changes: 9 additions & 5 deletions docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h1 class="page-title">Source: index.js</h1>
* @author Siarhei Dudko &lt;[email protected]>
* @copyright 2019
* @license MIT
* @version 1.7.5
* @version 1.7.6
* @requires stream
* @requires string_decoder
*/
Expand Down Expand Up @@ -149,7 +149,11 @@ <h1 class="page-title">Source: index.js</h1>
let self = this;
const _startToken = Buffer.from(_start)[0],
_separatorToken = Buffer.from(_separator)[0],
_endToken = Buffer.from(_end)[0];
_endToken = Buffer.from(_end)[0],
_spaceToken = Buffer.from(' ')[0],
_rToken = Buffer.from('\r')[0],
_nToken = Buffer.from('\n')[0],
_tToken = Buffer.from('\t')[0];
self.bytesRead = 0;
self.encoding = 'utf8';
self.StringDecoder = new StringDecoder(self.encoding);
Expand All @@ -169,8 +173,8 @@ <h1 class="page-title">Source: index.js</h1>
}
if(self.LeftBrace !== 0) {
self.StringBufferArray.push(_buffer.slice(s,s+1));
} else if((_startToken !== _buffer[s]) &amp;&amp; (_endToken !== _buffer[s]) &amp;&amp; (_separatorToken !== _buffer[s])){
error.push(new Error('Unexpected token '+_buffer.slice(s,s+1).toString(self.encoding)+' in JSON at position '+s));
} else if((_startToken !== _buffer[s]) &amp;&amp; (_endToken !== _buffer[s]) &amp;&amp; (_separatorToken !== _buffer[s]) &amp;&amp; (_spaceToken !== _buffer[s]) &amp;&amp; (_rToken !== _buffer[s]) &amp;&amp; (_nToken !== _buffer[s]) &amp;&amp; (_tToken !== _buffer[s])){
error.push(new Error('Unexpected token '+_buffer.slice(s,s+1).toString(self.encoding)+' in JSON at position '+(self.bytesRead+s)));
}
}
self.transform = new Stream.Transform({
Expand Down Expand Up @@ -292,7 +296,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-se
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 12:19:17 GMT+0300 (GMT+03:00)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Wed Jan 15 2020 09:30:06 GMT+0300 (GMT+03:00)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/module-sergdudko_objectstream-Parser.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-se
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 12:19:17 GMT+0300 (GMT+03:00)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Wed Jan 15 2020 09:30:06 GMT+0300 (GMT+03:00)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/module-sergdudko_objectstream-Stringifer.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-se
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 12:19:17 GMT+0300 (GMT+03:00)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Wed Jan 15 2020 09:30:06 GMT+0300 (GMT+03:00)
</footer>

<script> prettyPrint(); </script>
Expand Down
4 changes: 2 additions & 2 deletions docs/module-sergdudko_objectstream.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h1 class="page-title">Module: sergdudko/objectstream</h1>


<dt class="tag-version">Version:</dt>
<dd class="tag-version"><ul class="dummy"><li>1.7.5</li></ul></dd>
<dd class="tag-version"><ul class="dummy"><li>1.7.6</li></ul></dd>



Expand Down Expand Up @@ -190,7 +190,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-se
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 12:19:17 GMT+0300 (GMT+03:00)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Wed Jan 15 2020 09:30:06 GMT+0300 (GMT+03:00)
</footer>

<script> prettyPrint(); </script>
Expand Down
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Siarhei Dudko <[email protected]>
* @copyright 2019
* @license MIT
* @version 1.7.5
* @version 1.7.6
* @requires stream
* @requires string_decoder
*/
Expand Down Expand Up @@ -121,7 +121,11 @@ let Parser = function(_start = '', _separator = '', _end = ''){
let self = this;
const _startToken = Buffer.from(_start)[0],
_separatorToken = Buffer.from(_separator)[0],
_endToken = Buffer.from(_end)[0];
_endToken = Buffer.from(_end)[0],
_spaceToken = Buffer.from(' ')[0],
_rToken = Buffer.from('\r')[0],
_nToken = Buffer.from('\n')[0],
_tToken = Buffer.from('\t')[0];
self.bytesRead = 0;
self.encoding = 'utf8';
self.StringDecoder = new StringDecoder(self.encoding);
Expand All @@ -141,8 +145,8 @@ let Parser = function(_start = '', _separator = '', _end = ''){
}
if(self.LeftBrace !== 0) {
self.StringBufferArray.push(_buffer.slice(s,s+1));
} else if((_startToken !== _buffer[s]) && (_endToken !== _buffer[s]) && (_separatorToken !== _buffer[s])){
error.push(new Error('Unexpected token '+_buffer.slice(s,s+1).toString(self.encoding)+' in JSON at position '+s));
} else if((_startToken !== _buffer[s]) && (_endToken !== _buffer[s]) && (_separatorToken !== _buffer[s]) && (_spaceToken !== _buffer[s]) && (_rToken !== _buffer[s]) && (_nToken !== _buffer[s]) && (_tToken !== _buffer[s])){
error.push(new Error('Unexpected token '+_buffer.slice(s,s+1).toString(self.encoding)+' in JSON at position '+(self.bytesRead+s)));
}
}
self.transform = new Stream.Transform({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sergdudko/objectstream",
"version": "1.7.5",
"version": "1.7.6",
"description": "Creates a stream to convert json from string or convert json to string.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 6bc9d4e

Please sign in to comment.