Given this basic array:
let result = ["doc1.rtf","doc2.rtf","test/doc4.rtf","test/doc4.rtf","test/doc6.rtf"]
To find unique occurrences, you can use the following:
let unique = [...new Set(result)];
This will give you:
["doc1.rtf","doc2.rtf","test/doc4.rtf","test/doc6.rtf"]
However, what you want is to search for unique items after filtering out any content up to leading slashes. So, before removing duplicates with test/
, your array would look like this:
let filtered = ["doc1.rtf","doc2.rtf","test/","test/","test/"]
Is there a way to achieve this in one step? Any help would be appreciated.