Moved `uniqueNonSubstring` utility method from Rapture Core