Skip to content
Jason Godesky edited this page Jul 18, 2026 · 1 revision

dedupe creates a copy of an array of strings, numbers, or booleans with only unique values.

Parameters

orig: Array<string | number | boolean>

An array of strings, numbers, or booleans that you would like to deduplicate.

Returns

A copy of orig from which all duplicate values have been removed.

Examples

import { dedupe } from '@revolutionarygamesco/common'

dedupe(['a', 'a', 'b', 'b', 'c', 'c', 'c']) // ['a', 'b', 'c']
dedupe([1, 2, 2, 3, 3, 3]) // [1, 2, 3]
dedupe([true, true, true, false]) // [true, false]
dedupe(['a', 'a', 3, 3, 3, true, true, false]) // ['a', 3, true, false]

Clone this wiki locally