1
var Encrypter = function (keys, values, dictionary) {2
this.encryptMap = new Map();3
for (let i = 0; i < keys.length; i++) {4
this.encryptMap.set(keys[i], values[i]);6
this.dict = new Set(dictionary);7
// Encypt the values in dict for easy comparison later8
this.encryptedVals = [];9
for (let word of this.dict) {10
this.encryptedVals.push(this.encrypt(word));13
Encrypter.prototype.encrypt = function (word1) {15
for (let char of word1) {16
encrypted += this.encryptMap.get(char);20
Encrypter.prototype.decrypt = function (word2) {21
return this.encryptedVals.filter((x) => x === word2).length;