Faker Documentation

website·Indexed 38 days ago

https://next.fakerjs.dev/

Documentation for Faker, a library providing a wide range of supported locales for generating fake data, including language-specific data for regions such as Vietnam, China, Nigeria, and South Africa.

Tokens
143.8K
Snippets
1K
Records
1.2K
Agent score
60%

What's inside Faker

  1. Overview of the Location module

    The faker.location module (which replaced faker.address in v8.0.0) generates random address and location data. All outputs are tied to the current locale. For common street addresses, use streetAddress(), city(), state(), and zipCode(). For geographic coordinates, use latitude(), longitude(), or nearbyGPSCoordinate().
  2. Overview of the Company module

    The faker.company module is used to generate company-related entries. For related needs, use faker.commerce for products and commerce, or faker.finance for finance-related entries.
  3. Overview of the Location module

    The faker.location module provides methods to generate random addresses, geographic data, and location-based information. It replaces the faker.address module used prior to version 8.0.0. All generated data is tied to the current locale. For common street addresses, use a combination of streetAddress(), city(), state(), and zipCode().
  4. Overview of book data generation in Faker

    The faker.book module provides several methods for generating book-related entries. All values may be localized. For specific needs, use the following mappings:

    • Random title: faker.book.title()
    • Random existing author: faker.book.author()
    • Random non-existing author: faker.person.fullName()
    • Random genre: faker.book.genre()
    • Random series: faker.book.series()
    • Random publisher: faker.book.publisher()
    • Random format: faker.book.format()
    • Random ISBN: faker.commerce.isbn()
  5. Overview of the Finance module

    The faker.finance module provides utilities to generate mock data for finance and money-related entries, including random currency amounts, traditional bank account details (account numbers, BIC, IBAN), credit card information (numbers, CVV, issuers), and blockchain addresses (Bitcoin, Ethereum, Litecoin).
  6. Overview of Faker Number module

    The faker.number module provides utilities for generating various types of numbers:

    • Simple integers: int()
    • Floating-point numbers: float()
    • Non-base-10 numbers: hex(), octal(), and binary()
    • Large integers: bigInt()

    For other numeric needs, consider:

    • faker.string.numeric() for numeric strings of a specific length.
    • faker.finance.creditCardNumber() for credit card numbers.
  7. Overview of Faker library capabilities

    Faker is a JavaScript library used to generate realistic fake data. It is commonly used for unit testing, performance testing, building demos, and developing front-end features when a backend is not yet available.
  8. Overview of the faker.person module

    The faker.person module (formerly faker.name prior to v8.0.0) is used to generate personal information such as names, job titles, and profile details. It supports locale-specific name patterns and optional sex-based filtering ('male', 'female', or 'generic') for many of its methods.
  9. Overview of Faker module types

    Faker organizes its data generation capabilities into three primary module categories:

    1. Basic Datatypes: Core modules for generating datatype, date, number, and string.
    2. Topic Specific: Specialized modules for specific domains such as animal and food.
    3. Helpers: The helpers module provides utility methods for manipulating data generated by other Faker methods or custom data.
  10. Overview of the Faker Medical module

    The faker.medical module generates plausible, non-clinical healthcare data for tests, demos, and fixtures. It provides generic values for patient records, including conditions, symptoms, procedures, specialties, departments, blood types, allergens, and drug names.

    Important Constraints:

    • Data is intentionally generic or invented.
    • Real diagnosis codes (e.g., ICD-10) and correlated patient records are out of scope.
    • This data must never be used for clinical purposes.
  11. Generate random food-related data with the Food module

    The faker.food module provides methods to generate various food-related information, such as menu items, dish descriptions, and individual ingredients. Note that generated dish names and descriptions are random and will not logically correspond to one another.
  12. Generate random animal types and species using the Animal module

    The faker.animal module provides methods to generate random animal-related strings. All values returned by these methods can be localized. For a general animal type (e.g., 'dog'), use the type() method. For specific breeds or species, use the dedicated methods for that animal group.