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

15.15.0 • Public • Published

@unction/sample

Tests Stability Dependencies

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

Takes an ordered enumerable and returns one random element.

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

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

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

sample(users()) // => {"id": 1, "name": "Kurtis Rainbolt-Greene"}

Readme

Keywords

Package Sidebar

Install

npm i @unction/sample

Weekly Downloads

2

Version

15.15.0

License

SEE LICENSE IN LICENSE

Unpacked Size

14.8 kB

Total Files

7

Last publish

Collaborators

  • krainboltgreene