ngneat/falso

randInList

MathRobin opened this issue · 5 comments

First, many thanks for your work and the great doc^^

Description

Being able to define a list of words (or whatever) and provides one of them

Proposed solution

falso.randInList(['foo', 'bar']);
// foo
falso.randInList(['foo', 'bar']);
// bar

Alternatives considered

No response

Do you want to create a pull request?

No

leon commented

in the core package there is a randElement that takes an array.

could we export that?

Sorry for the delayed reply. Yeah that was my thinking too.

It might be worth moving it of core, (Maybe even aliasing it as something like randInList)

Isn't that the same as the already existing rand() function (docs)?

@rothsandro - Ah yeah, great shout! I'll close this then 😊

Didn't saw it. Exactly what I wanted. Many thanks!