|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
638 bytes
|
| Line | |
|---|
| 1 | import { sampleSize as sampleSize$1 } from '../../array/sampleSize.mjs';
|
|---|
| 2 | import { isIterateeCall } from '../_internal/isIterateeCall.mjs';
|
|---|
| 3 | import { clamp } from '../math/clamp.mjs';
|
|---|
| 4 | import { toArray } from '../util/toArray.mjs';
|
|---|
| 5 | import { toInteger } from '../util/toInteger.mjs';
|
|---|
| 6 |
|
|---|
| 7 | function sampleSize(collection, size, guard) {
|
|---|
| 8 | const arrayCollection = toArray(collection);
|
|---|
| 9 | if (guard ? isIterateeCall(collection, size, guard) : size === undefined) {
|
|---|
| 10 | size = 1;
|
|---|
| 11 | }
|
|---|
| 12 | else {
|
|---|
| 13 | size = clamp(toInteger(size), 0, arrayCollection.length);
|
|---|
| 14 | }
|
|---|
| 15 | return sampleSize$1(arrayCollection, size);
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | export { sampleSize };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.