Select.sample()

Get a random sample from the list

Usage

Hover over inputs/exits for more info.

var Select = require('machinepack-select');


// Get a random sample from the list

Select.sample({

collection: [],

num: 2,

both: true,

}).execSync();

Inputs

collection required

A collection

num required

A number of items

2
both

A boolean to specify if we also return the array

true

Exits

error

An unexpected error occurred.

emptyError

Empty collection.

success

OK.

[ 'lorem ipsum', 5 ]