source: imaps-frontend/node_modules/lodash-es/_baseSampleSize.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 546 bytes
Line 
1import baseClamp from './_baseClamp.js';
2import shuffleSelf from './_shuffleSelf.js';
3import values from './values.js';
4
5/**
6 * The base implementation of `_.sampleSize` without param guards.
7 *
8 * @private
9 * @param {Array|Object} collection The collection to sample.
10 * @param {number} n The number of elements to sample.
11 * @returns {Array} Returns the random elements.
12 */
13function baseSampleSize(collection, n) {
14 var array = values(collection);
15 return shuffleSelf(array, baseClamp(n, 0, array.length));
16}
17
18export default baseSampleSize;
Note: See TracBrowser for help on using the repository browser.