Skip to content

Commit

Permalink
fix: Special characters being printed out from recurrent net
Browse files Browse the repository at this point in the history
fixes issue BrainJS#267
  • Loading branch information
robertleeplummerjr committed Aug 29, 2018
1 parent a82faba commit 28726ea
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 30 deletions.
15 changes: 7 additions & 8 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* license: MIT (http://opensource.org/licenses/MIT)
* author: Heather Arthur <[email protected]>
* homepage: https://github.com/brainjs/brain.js#readme
* version: 1.2.6
* version: 1.2.7
*
* acorn:
* license: MIT (http://opensource.org/licenses/MIT)
Expand Down Expand Up @@ -4997,13 +4997,12 @@ var DataFormatter = function () {
}
}, {
key: 'addSpecial',
value: function addSpecial() {
for (var i = 0; i < arguments.length; i++) {
var special = arguments[i];
var specialIndex = this.indexTable[special] = this.characters.length;
this.characterTable[specialIndex] = special;
this.characters.push(special);
}
value: function addSpecial(special) {
var printableValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

var specialIndex = this.indexTable[special] = this.characters.length;
this.characterTable[specialIndex] = printableValue;
this.characters.push(special);
}
}, {
key: 'toFunctionString',
Expand Down
11 changes: 5 additions & 6 deletions browser.min.js

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions dist/utilities/data-formatter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/utilities/data-formatter.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "brain.js",
"description": "Neural network library",
"version": "1.2.6",
"version": "1.2.7",
"author": "Heather Arthur <[email protected]>",
"repository": {
"type": "git",
Expand Down
11 changes: 4 additions & 7 deletions src/utilities/data-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,10 @@ export default class DataFormatter {
return dataFormatter;
}

addSpecial() {
for (let i = 0; i < arguments.length; i++) {
const special = arguments[i];
let specialIndex = this.indexTable[special] = this.characters.length;
this.characterTable[specialIndex] = special;
this.characters.push(special);
}
addSpecial(special, printableValue = '') {
let specialIndex = this.indexTable[special] = this.characters.length;
this.characterTable[specialIndex] = printableValue;
this.characters.push(special);
}

toFunctionString() {
Expand Down

0 comments on commit 28726ea

Please sign in to comment.