Appearance
function unique<T>(arr): T[];
定义于: array.ts:19
数组去重(基于 === / SameValueZero),保留首次出现的元素,返回新数组。
===
SameValueZero
T
arr
T[]
去重后的新数组
按引用比较对象;如需按字段去重请用 uniqueBy。
unique([1, 1, 2, 3, 3]) // => [1, 2, 3] unique(['a', 'a', 'b']) // => ['a', 'b']