Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Comprose

This class creates a Comprose instance and defines the default dataset and locale to be used by all methods.

example
import { Comprose } from 'comprose';

const comprose = new Comprose({
dataset: 'faker',
locale: 'en',
});

comprose.personName();
// John Smith

Hierarchy

  • Comprose

Index

Constructors

constructor

Properties

dataset

dataset: Dataset

locale

locale: Locale

localeFallback

localeFallback: Locale

Methods

companyCatchPhrase

  • companyCatchPhrase(): string

get

  • get(...collectionsOrPaths: string[] | string[][]): any
  • example
    import { data, Comprose } from 'comprose';

    const comprose = new Comprose();

    comprose.get(data.faker.en.animal.dog);
    // Bulldog

    comprose.get(data.faker.en.address.cityName, data.faker.fr.address.cityName);
    // London

    comprose.get('animal.dog', data.faker.fr.address.cityName);
    // Paris

    Parameters

    • Rest ...collectionsOrPaths: string[] | string[][]

      Pass a collection, or a series of collections and return a random sample. Alternatively use path strings and the default dataset and locale will be used.

    Returns any

personFirstName

personLastName

  • personLastName(): string

personName

  • example
    comprose.personName({ gender: 'male' });
    // John Smith

    Parameters

    Returns string

Generated using TypeDoc