Skip to content

Commit 1d782b3

Browse files
Merge pull request #268 from BrainJS/267-auto-remove-special-characters
267 auto remove special characters
2 parents 287288b + b8ffa97 commit 1d782b3

File tree

6 files changed

+23
-28
lines changed

6 files changed

+23
-28
lines changed

browser.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* license: MIT (http://opensource.org/licenses/MIT)
77
* author: Heather Arthur <[email protected]>
88
* homepage: https://github.com/brainjs/brain.js#readme
9-
* version: 1.2.6
9+
* version: 1.2.7
1010
*
1111
* acorn:
1212
* license: MIT (http://opensource.org/licenses/MIT)
@@ -4997,13 +4997,12 @@ var DataFormatter = function () {
49974997
}
49984998
}, {
49994999
key: 'addSpecial',
5000-
value: function addSpecial() {
5001-
for (var i = 0; i < arguments.length; i++) {
5002-
var special = arguments[i];
5003-
var specialIndex = this.indexTable[special] = this.characters.length;
5004-
this.characterTable[specialIndex] = special;
5005-
this.characters.push(special);
5006-
}
5000+
value: function addSpecial(special) {
5001+
var printableValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
5002+
5003+
var specialIndex = this.indexTable[special] = this.characters.length;
5004+
this.characterTable[specialIndex] = printableValue;
5005+
this.characters.push(special);
50075006
}
50085007
}, {
50095008
key: 'toFunctionString',

browser.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/utilities/data-formatter.js

+6-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/utilities/data-formatter.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "brain.js",
33
"description": "Neural network library",
4-
"version": "1.2.6",
4+
"version": "1.2.7",
55
"author": "Heather Arthur <[email protected]>",
66
"repository": {
77
"type": "git",

src/utilities/data-formatter.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,10 @@ export default class DataFormatter {
165165
return dataFormatter;
166166
}
167167

168-
addSpecial() {
169-
for (let i = 0; i < arguments.length; i++) {
170-
const special = arguments[i];
171-
let specialIndex = this.indexTable[special] = this.characters.length;
172-
this.characterTable[specialIndex] = special;
173-
this.characters.push(special);
174-
}
168+
addSpecial(special, printableValue = '') {
169+
let specialIndex = this.indexTable[special] = this.characters.length;
170+
this.characterTable[specialIndex] = printableValue;
171+
this.characters.push(special);
175172
}
176173

177174
toFunctionString() {

0 commit comments

Comments
 (0)