I'm hoping to get some help with the last piece of my extension. I've been working on a JS code that searches a dictionary based on user input from a text area and returns a match. That match is then assigned a series of values which are then put into the slider to control the mouth shapes. Am I on the right track here? I can get the input into separate words but I'm a little lost as to how to iterate through each word to check it against the dictionary.
document.getElementById("myButton").onclick = function(){
var data = document.getElementById("myText").value;
console.log(data);
var strText = JSON.stringify(data);
console.log(strText);
string_to_array = function(str) {
return str.trim().split(" ")
}
console.log(string_to_array(strText));
console.log(strText);
}
localStorage.setItem("userInput", strText);
console.log(localStorage);
var fs = require("fs");
let text = fs.readFileSync("C:/Program Files (x86)/Common Files/Adobe/CEP/extensions/MULTIBUTTON/assets/standard_dictionary.txt").toString();
let index = text.match(strText)
let index = text.match(/(?:^|\W)doctor(?:$|\W)/gi);
console.log(index);