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
sumomo-0.7.3 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
sumomo-0.7.2 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
sumomo-0.7.1 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
sumomo-0.6.4 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
sumomo-0.6.3 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
sumomo-0.6.2 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
sumomo-0.6.1 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
affiliator-0.2.1 node_modules/lodash/_arraySample.js
sumomo-0.6.0 data/sumomo/api_modules/node_modules/lodash/_arraySample.js
guard-sass-lint-0.1.2 node_modules/lodash/_arraySample.js
guard-sass-lint-0.1.1 node_modules/lodash/_arraySample.js
lanes-0.8.0 node_modules/globule/node_modules/lodash/_arraySample.js
lanes-0.8.0 node_modules/lodash/_arraySample.js