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
locomotivecms-3.4.0 app/javascript/node_modules/lodash/_arraySample.js
cortex-0.1.3 spec/dummy/node_modules/lodash/_arraySample.js
sumomo-0.8.3 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
sumomo-0.8.2 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
sumomo-0.8.1 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
condenser-0.0.4 lib/condenser/processors/node_modules/lodash/_arraySample.js
ela-4.0.0 node_modules/lodash/_arraySample.js
ela-3.4.3 node_modules/lodash/_arraySample.js
ela-3.4.2 node_modules/lodash/_arraySample.js
ela-3.4.0 node_modules/lodash/_arraySample.js
ela-3.3.1 node_modules/lodash/_arraySample.js
dragonfly_puppeteer-0.1.0 node_modules/lodash/_arraySample.js
ela-3.3.0 node_modules/lodash/_arraySample.js
ela-3.2.0 node_modules/lodash/_arraySample.js
ela-3.1.1 node_modules/lodash/_arraySample.js
ela-3.1.0 node_modules/lodash/_arraySample.js
ela-3.0.0 node_modules/lodash/_arraySample.js
ela-2.0.0 node_modules/lodash/_arraySample.js
ela-1.1.0 node_modules/lodash/_arraySample.js
sumomo-0.8.0 data/sumomo/api_modules/node_modules/lodash/_arraySample.js