Javascript class substituting keywords in string using an object