@unction/samplesize
TypeScript icon, indicating that this package has built-in type declarations

16.15.0 • Public • Published

@unction/sampleSize

Tests Stability Dependencies

number => OrderedArray | Set | Record<string | number | symbol, B> | Map<B, A> | string => OrderedArray | Set | Record<string | number | symbol, B> | Map<B, A> | string

Takes an Array or string and randomly picks n elements to return, but never the same one.

users() // => [{"id": 1, "name": "Kurtis Rainbolt-Greene"}, {"id": 2, "name": "Angela Englund"}]

sample(1)(users()) // => [{"id": 2, "name": "Angela Englund"}]

sample(2)(users()) // => [{"id": 2, "name": "Angela Englund"}, {"id": 1, "name": "Kurtis Rainbolt-Greene"}]

Readme

Keywords

Package Sidebar

Install

npm i @unction/samplesize

Weekly Downloads

5

Version

16.15.0

License

SEE LICENSE IN LICENSE

Unpacked Size

16.2 kB

Total Files

7

Last publish

Collaborators

  • krainboltgreene