In my CouchDB reduce function I need to reduce a list of items to the unique ones.
Note: In that case it\'s ok to have a list, it will be a small number of items
This should work with anything, not just strings:
export const getUniqueList = (a: Array) : Array => {
const set = new Set();
for(let v of a){
set.add(v);
}
return Array.from(set);
};
the above can just be reduced to:
export const getUniqueValues = (a: Array) => {
return Array.from(new Set(a));
};
:)