ngneat/falso

Allow an array instead of a single value

Closed this issue · 1 comments

Description

Currently, each function returns a single value. We should give the option to return an array of values.

Proposed solution

Create a proxy function and use it in each one of the function generators:

export function cat(options?: FakeOptions) {
  return fake(catsData, options)
}
// core.ts
export interface FakeOptions {
  size: number
}

export function fake(options?: { size: 10 } ) {
  return ...
}

Alternatives considered

No response

Do you want to create a pull request?

No

As of API. I would consider to have a plural method for this that is exported from same file

instead of randomNumbers can be used randomNumberList to take into consideration that some words don't have a singular version

e.g.

import { randomNumber, randomNumbers } from 'falso'

randomNumber() // single number
randomNumbers({ size: 10 }) // array with 10 random numbers