Arrays.uniqBy()

Build a duplicate-free version of an array of dictionaries, judging uniqueness based on a particular key.

Usage

Hover over inputs/exits for more info.

var Arrays = require('machinepack-arrays');


// Build a duplicate-free version of an array of dictionaries, judging uniqueness based on a particular key.

Arrays.uniqBy({

array: [ {} ],

key: 'id',

}).execSync();

Inputs

array required

The array of dictionaries to remove duplicates from.

[ {} ]
key required

The key to use when determining uniqueness.

'id'

Exits

error

An unexpected error occurred.

success

OK.

(varies based on provided inputs)