Sha256: 92bf156e5a398c8a1156b88c6c7c083defd509b4aca807d9e2e9bd2d2e742927

Contents?: true

Size: 363 Bytes

Versions: 273

Compression:

Stored size: 363 Bytes

Contents

var baseRandom = require('./_baseRandom');

/**
 * A specialized version of `_.sample` for arrays.
 *
 * @private
 * @param {Array} array The array to sample.
 * @returns {*} Returns the random element.
 */
function arraySample(array) {
  var length = array.length;
  return length ? array[baseRandom(0, length - 1)] : undefined;
}

module.exports = arraySample;

Version data entries

273 entries across 271 versions & 29 rubygems

Version Path
clapton-0.0.19 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
immosquare-cleaner-0.1.49 node_modules/lodash/_arraySample.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
immosquare-cleaner-0.1.48 node_modules/lodash/_arraySample.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.6 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.5 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.4 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.3 lib/clapton/javascripts/node_modules/lodash/_arraySample.js
clapton-0.0.2 lib/clapton/javascripts/node_modules/lodash/_arraySample.js