MCPcopy
hub / github.com/BrainJS/brain.js / buildCharactersFromIterable

Method buildCharactersFromIterable

src/utilities/data-formatter.js:22–41  ·  view source on GitHub ↗
(values)

Source from the content-addressed store, hash-verified

20 }
21
22 buildCharactersFromIterable(values) {
23 let tempCharactersTable = {};
24 for (let dataFormatterIndex = 0, dataFormatterLength = values.length; dataFormatterIndex < dataFormatterLength; dataFormatterIndex++) {
25 let characters = values[dataFormatterIndex];
26
27 if (characters.hasOwnProperty('length')) {
28 for (let characterIndex = 0, charactersLength = characters.length; characterIndex < charactersLength; characterIndex++) {
29 let character = characters[characterIndex];
30 if (tempCharactersTable.hasOwnProperty(character)) continue;
31 tempCharactersTable[character] = true;
32 this.characters.push(character);
33 }
34 } else {
35 let character = values[dataFormatterIndex];
36 if (tempCharactersTable.hasOwnProperty(character)) continue;
37 tempCharactersTable[dataFormatterIndex] = true;
38 this.characters.push(character);
39 }
40 }
41 }
42
43 buildTables(maxThreshold) {
44 // filter by count threshold and create pointers

Callers 3

constructorMethod · 0.95
eFunction · 0.80
DataFormatterFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected