removeduplicates - Remove Duplicates from an Array
Removes duplicates from an array. If the fields parameter is empty, all fields of the first array element are used for the comparison.
This function removes duplicate elements from an array of objects. This function compares the values of one or more specified fields of the array elements to determine whether they are duplicates. If no fields are specified, the function compares all fields of the first array element by default. The function returns an array with the duplicates removed.
For example, consider an array of objects with fields "Column1", "Column2", and "Column3". Suppose the array contains three objects with the same value for "Column2" field, but different values for the other fields. By calling the "removeduplicates" function with "Column2" as the field to compare, the function returns an array with only two objects (the duplicates removed). The function also allows users to specify case sensitivity for the comparison.
data
[
{
"Column1": "Germany",
"Column2": "Apple",
"Column3": "Dragonfruit"
},
{
"Column1": "Germany",
"Column2": "apple",
"Column3": "Dragonfruit"
},
{
"Column1": "US",
"Column2": "Apple",
"Column3": "Dragonfruit"
}
]
fields
[
"Column2"
]
ignoreCase