Typescript Array Distinct Javascript Substring Index