UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

10 lines (9 loc) 308 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.sample = void 0; function sample(array) { const length = array == null ? 0 : array.length; return length ? array[Math.floor(Math.random() * length)] : undefined; } exports.sample = sample; exports.default = sample;