Arrays.sortBy()

Sort an array of dictionaries by a particular key.

Usage

Hover over inputs/exits for more info.

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


// Sort an array of dictionaries by a particular key.

Arrays.sortBy({

array: [ {} ],

key: 'createdAt',

}).execSync();

Inputs

array required

The array to sort.

[ {} ]
key required

The shared key to sort by.

'createdAt'

Exits

error

An unexpected error occurred.

success

OK.

(varies based on provided inputs)