Typescript Array Distinct Javascript Substring Replace