Quickly deduplicate an array and return the result.
If the elements in the array are all basic types, the function will process them with
simple ===
comparison.
If the elements in the array are complex types, the function will not compare them with
===
by default. Instead, a makeKey
function must be provided to map the elements to
values that can be compared with ===
. In this case, if you ensure that the elements are
actually comparable with ===
, you can set the makeKey
function to null
to use the default.
For example, there are multiple references to the same object in the array, and you want to
deduplicate them, you can set the makeKey
function to null
to use the default ===
simply.
Quickly deduplicate an array and return the result.
If the elements in the array are all basic types, the function will process them with
simple ===
comparison.
If the elements in the array are complex types, the function will not compare them with
===
by default. Instead, a makeKey
function must be provided to map the elements to
values that can be compared with ===
. In this case, if you ensure that the elements are
actually comparable with ===
, you can set the makeKey
function to null
to use the default.
For example, there are multiple references to the same object in the array, and you want to
deduplicate them, you can set the makeKey
function to null
to use the default ===
simply.
Quickly deduplicate an array and return the result.
If the elements in the array are all basic types, the function will process them with simple
===
comparison, by default.If the elements in the array are complex types, the function will not compare them with
===
by default. Instead, amakeKey
function must be provided to map the elements to values that can be compared with===
. In this case, if you ensure that the elements are actually comparable with===
, you can set themakeKey
function tonull
to use the default. For example, there are multiple references to the same object in the array, and you want to deduplicate them, you can set themakeKey
function tonull
to use the default===
simply.