ngneat / falso

All the Fake Data for All Your Real Needs 🙂

Home Page:https://ngneat.github.io/falso/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

randInList

MathRobin opened this issue · 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

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!