unique

Function

Determines if a value is unique in an array Allows for code like:

const ary = [ 1, 2, 3, 3, 4, 5, 1 ];

const result = ary.filter(unique);

result => [ 1, 2, 3, 4, 5 ]
  • unique(value: any, index: number, ary: any[]) : boolean

Parameters

Parameter Type Default Notes
value Required any

the value to search for

index Required number

the index of the searched value

ary Required any[]

the array to search

Returns

  • indicating if the value is unique in the array
boolean

Function defined in common/src/util.ts:283