UNPKG

@faker-js/faker

Version:

Generate massive amounts of fake contextual data

1,610 lines (1,603 loc) 289 kB
/** * A proxy for LocaleDefinition that marks all properties as required and throws an error when an entry is accessed that is not defined. */ type LocaleProxy = Readonly<{ [key in keyof LocaleDefinition]-?: LocaleProxyCategory<LocaleDefinition[key]>; }>; type LocaleProxyCategory<T> = Readonly<{ [key in keyof T]-?: LocaleProxyEntry<T[key]>; }>; type LocaleProxyEntry<T> = unknown extends T ? T : Readonly<NonNullable<T>>; /** * Module to generate animal related entries. * * ### Overview * * For a general type of animal (e.g. `'dog'`), use [`type()`](https://fakerjs.dev/api/animal.html#type). * * Otherwise, use one of the more specific methods, such as [`cat()`](https://fakerjs.dev/api/animal.html#cat) for a specific breed of cat. * * All values may be localized. */ declare class AnimalModule extends ModuleBase { /** * Returns a random dog breed. * * @example * faker.animal.dog() // 'Irish Water Spaniel' * * @since 5.5.0 */ dog(): string; /** * Returns a random cat breed. * * @example * faker.animal.cat() // 'Singapura' * * @since 5.5.0 */ cat(): string; /** * Returns a random snake species. * * @example * faker.animal.snake() // 'Eyelash viper' * * @since 5.5.0 */ snake(): string; /** * Returns a random bear species. * * @example * faker.animal.bear() // 'Asian black bear' * * @since 5.5.0 */ bear(): string; /** * Returns a random lion species. * * @example * faker.animal.lion() // 'Northeast Congo Lion' * * @since 5.5.0 */ lion(): string; /** * Returns a random cetacean species. * * @example * faker.animal.cetacean() // 'Spinner Dolphin' * * @since 5.5.0 */ cetacean(): string; /** * Returns a random horse breed. * * @example * faker.animal.horse() // 'Swedish Warmblood' * * @since 5.5.0 */ horse(): string; /** * Returns a random bird species. * * @example * faker.animal.bird() // 'Buller's Shearwater' * * @since 5.5.0 */ bird(): string; /** * Returns a random cow species. * * @example * faker.animal.cow() // 'Brava' * * @since 5.5.0 */ cow(): string; /** * Returns a random fish species. * * @example * faker.animal.fish() // 'Mandarin fish' * * @since 5.5.0 */ fish(): string; /** * Returns a random crocodilian species. * * @example * faker.animal.crocodilia() // 'Philippine Crocodile' * * @since 5.5.0 */ crocodilia(): string; /** * Returns a random insect species. * * @example * faker.animal.insect() // 'Pyramid ant' * * @since 5.5.0 */ insect(): string; /** * Returns a random rabbit species. * * @example * faker.animal.rabbit() // 'Florida White' * * @since 5.5.0 */ rabbit(): string; /** * Returns a random rodent breed. * * @example * faker.animal.rodent() // 'Cuscomys ashanika' * * @since 7.4.0 */ rodent(): string; /** * Returns a random animal type. * * @example * faker.animal.type() // 'crocodile' * * @since 5.5.0 */ type(): string; /** * Returns a random pet name. * * @example * faker.animal.petName() // 'Coco' * * @since 9.2.0 */ petName(): string; } /** * Module to generate book related entries. * * ### Overview * * - For a random title, use [`title()`](https://fakerjs.dev/api/book.html#title). * - For a random existing author name, use [`author()`](https://fakerjs.dev/api/book.html#author). * - For a random non-existing author name, use [`faker.person.fullName()`](https://fakerjs.dev/api/person.html#fullname). * - For a random genre, use [`genre()`](https://fakerjs.dev/api/book.html#genre). * - For a random series, use [`series()`](https://fakerjs.dev/api/book.html#series). * - For a random publisher, use [`publisher()`](https://fakerjs.dev/api/book.html#publisher). * - For a random book format, use [`format()`](https://fakerjs.dev/api/book.html#format). * - For a random isbn, use [`faker.commerce.isbn()`](https://fakerjs.dev/api/commerce.html#isbn) * * All values may be localized. */ declare class BookModule extends ModuleBase { /** * Returns a random author name. * * @example * faker.book.author() // 'William Shakespeare' * * @since 9.1.0 */ author(): string; /** * Returns a random book format. * * @example * faker.book.format() // 'Hardcover' * * @since 9.1.0 */ format(): string; /** * Returns a random genre. * * @example * faker.book.genre() // 'Fantasy' * * @since 9.1.0 */ genre(): string; /** * Returns a random publisher. * * @example * faker.book.publisher() // 'Addison-Wesley' * * @since 9.1.0 */ publisher(): string; /** * Returns a random series. * * @example * faker.book.series() // 'Harry Potter' * * @since 9.1.0 */ series(): string; /** * Returns a random title. * * @example * faker.book.title() // 'Romeo and Juliet' * * @since 9.1.0 */ title(): string; } /** * Color space names supported by CSS. */ declare enum CssSpace { SRGB = "sRGB", DisplayP3 = "display-p3", REC2020 = "rec2020", A98RGB = "a98-rgb", ProphotoRGB = "prophoto-rgb" } /** * Color space names supported by CSS. */ type CssSpaceType = `${CssSpace}`; /** * Functions supported by CSS to produce color. */ declare enum CssFunction { RGB = "rgb", RGBA = "rgba", HSL = "hsl", HSLA = "hsla", HWB = "hwb", CMYK = "cmyk", LAB = "lab", LCH = "lch", COLOR = "color" } /** * Functions supported by CSS to produce color. */ type CssFunctionType = `${CssFunction}`; type StringColorFormat = 'css' | 'binary'; type NumberColorFormat = 'decimal'; type ColorFormat = StringColorFormat | NumberColorFormat; type Casing$1 = 'lower' | 'upper' | 'mixed'; /** * Module to generate colors. * * ### Overview * * For a human-readable color like `'red'`, use [`human()`](https://fakerjs.dev/api/color.html#human). * * For a hex color like `#ff0000` used in HTML/CSS, use [`rgb()`](https://fakerjs.dev/api/color.html#rgb). There are also methods for other color formats such as [`hsl()`](https://fakerjs.dev/api/color.html#hsl), [`cmyk()`](https://fakerjs.dev/api/color.html#cmyk), [`hwb()`](https://fakerjs.dev/api/color.html#hwb), [`lab()`](https://fakerjs.dev/api/color.html#lab), and [`lch()`](https://fakerjs.dev/api/color.html#lch). */ declare class ColorModule extends ModuleBase { /** * Returns a random human-readable color name. * * @example * faker.color.human() // 'red' * * @since 7.0.0 */ human(): string; /** * Returns a random color space name from the worldwide accepted color spaces. * Source: https://en.wikipedia.org/wiki/List_of_color_spaces_and_their_uses * * @example * faker.color.space() // 'sRGB' * * @since 7.0.0 */ space(): string; /** * Returns a random css supported color function name. * * @example * faker.color.cssSupportedFunction() // 'rgb' * * @since 7.0.0 */ cssSupportedFunction(): CssFunctionType; /** * Returns a random css supported color space name. * * @example * faker.color.cssSupportedSpace() // 'display-p3' * * @since 7.0.0 */ cssSupportedSpace(): CssSpaceType; /** * Returns an RGB color. * * @example * faker.color.rgb() // '#8be4ab' * * @since 7.0.0 */ rgb(): string; /** * Returns an RGB color. * * @param options Options object. * @param options.prefix Prefix of the generated hex color. Only applied when 'hex' format is used. Defaults to `'#'`. * @param options.casing Letter type case of the generated hex color. Only applied when `'hex'` format is used. Defaults to `'lower'`. * @param options.format Format of generated RGB color. Defaults to `hex`. * @param options.includeAlpha Adds an alpha value to the color (RGBA). Defaults to `false`. * * @example * faker.color.rgb() // '#0d7f26' * faker.color.rgb({ prefix: '0x' }) // '0x9ddc8b' * faker.color.rgb({ casing: 'upper' }) // '#B8A51E' * faker.color.rgb({ casing: 'lower' }) // '#b12f8b' * faker.color.rgb({ prefix: '#', casing: 'lower' }) // '#eb0c16' * faker.color.rgb({ format: 'hex', casing: 'lower' }) // '#bb9d17' * faker.color.rgb({ format: 'css' }) // 'rgb(216, 17, 192)' * faker.color.rgb({ format: 'binary' }) // '00110010 00001000 01110110' * faker.color.rgb({ includeAlpha: true }) // '#f96efb5e' * faker.color.rgb({ format: 'css', includeAlpha: true }) // 'rgba(180, 158, 24, 0.75)' * * @since 7.0.0 */ rgb(options?: { /** * Prefix of the generated hex color. Only applied when 'hex' format is used. * * @default '#' */ prefix?: string; /** * Letter type case of the generated hex color. Only applied when `'hex'` format is used. * * @default 'lower' */ casing?: Casing$1; /** * Format of generated RGB color. * * @default 'hex' */ format?: 'hex' | StringColorFormat; /** * Adds an alpha value to the color (RGBA). * * @default false */ includeAlpha?: boolean; }): string; /** * Returns an RGB color. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'hex'`. * @param options.includeAlpha Adds an alpha value to the color (RGBA). Defaults to `false`. * * @example * faker.color.rgb() // '0x8be4ab' * faker.color.rgb({ format: 'decimal' }) // [64, 192,174] * faker.color.rgb({ format: 'decimal', includeAlpha: true }) // [52, 250, 209, 0.21] * * @since 7.0.0 */ rgb(options?: { /** * Format of generated RGB color. * * @default 'hex' */ format?: NumberColorFormat; /** * Adds an alpha value to the color (RGBA). * * @default false */ includeAlpha?: boolean; }): number[]; /** * Returns an RGB color. * * @param options Options object. * @param options.prefix Prefix of the generated hex color. Only applied when `'hex'` format is used. Defaults to `'#'`. * @param options.casing Letter type case of the generated hex color. Only applied when `'hex'` format is used. Defaults to `'lower'`. * @param options.format Format of generated RGB color. Defaults to `'hex'`. * @param options.includeAlpha Adds an alpha value to the color (RGBA). Defaults to `false`. * * @example * faker.color.rgb() // '#0d7f26' * faker.color.rgb({ prefix: '0x' }) // '0x9ddc8b' * faker.color.rgb({ casing: 'upper' }) // '#B8A51E' * faker.color.rgb({ casing: 'lower' }) // '#b12f8b' * faker.color.rgb({ prefix: '#', casing: 'lower' }) // '#eb0c16' * faker.color.rgb({ format: 'hex', casing: 'lower' }) // '#bb9d17' * faker.color.rgb({ format: 'decimal' }) // [64, 192,174] * faker.color.rgb({ format: 'css' }) // 'rgb(216, 17, 192)' * faker.color.rgb({ format: 'binary' }) // '00110010 00001000 01110110' * faker.color.rgb({ includeAlpha: true }) // '#f96efb5e' * faker.color.rgb({ format: 'css', includeAlpha: true }) // 'rgba(180, 158, 24, 0.75)' * faker.color.rgb({ format: 'decimal', includeAlpha: true }) // [52, 250, 209, 0.21] * * @since 7.0.0 */ rgb(options?: { /** * Prefix of the generated hex color. Only applied when `'hex'` format is used. * * @default '#' */ prefix?: string; /** * Letter type case of the generated hex color. Only applied when `'hex'` format is used. * * @default 'lower' */ casing?: Casing$1; /** * Format of generated RGB color. * * @default 'hex' */ format?: 'hex' | ColorFormat; /** * Adds an alpha value to the color (RGBA). * * @default false */ includeAlpha?: boolean; }): string | number[]; /** * Returns a CMYK color. * * @example * faker.color.cmyk() // [0.31, 0.52, 0.32, 0.43] * * @since 7.0.0 */ cmyk(): number[]; /** * Returns a CMYK color. * * @param options Options object. * @param options.format Format of generated CMYK color. Defaults to `'decimal'`. * * @example * faker.color.cmyk() // [0.31, 0.52, 0.32, 0.43] * faker.color.cmyk({ format: 'css' }) // 'cmyk(35%, 39%, 68%, 60%)' * faker.color.cmyk({ format: 'binary' }) // (8-32 bits) x 4 * * @since 7.0.0 */ cmyk(options?: { /** * Format of generated CMYK color. * * @default 'decimal' */ format?: StringColorFormat; }): string; /** * Returns a CMYK color. * * @param options Options object. * @param options.format Format of generated CMYK color. Defaults to `'decimal'`. * * @example * faker.color.cmyk() // [0.31, 0.52, 0.32, 0.43] * faker.color.cmyk({ format: 'decimal' }) // [0.31, 0.52, 0.32, 0.43] * * @since 7.0.0 */ cmyk(options?: { /** * Format of generated CMYK color. * * @default 'decimal' */ format?: NumberColorFormat; }): number[]; /** * Returns a CMYK color. * * @param options Options object. * @param options.format Format of generated CMYK color. Defaults to `'decimal'`. * * @example * faker.color.cmyk() // [0.31, 0.52, 0.32, 0.43] * faker.color.cmyk({ format: 'decimal' }) // [0.31, 0.52, 0.32, 0.43] * faker.color.cmyk({ format: 'css' }) // 'cmyk(35%, 39%, 68%, 60%)' * faker.color.cmyk({ format: 'binary' }) // (8-32 bits) x 4 * * @since 7.0.0 */ cmyk(options?: { /** * Format of generated CMYK color. * * @default 'decimal' */ format?: ColorFormat; }): string | number[]; /** * Returns an HSL color. * * @example * faker.color.hsl() // [201, 0.23, 0.32] * * @since 7.0.0 */ hsl(): number[]; /** * Returns an HSL color. * * @param options Options object. * @param options.format Format of generated HSL color. Defaults to `'decimal'`. * @param options.includeAlpha Adds an alpha value to the color (RGBA). Defaults to `false`. * * @example * faker.color.hsl() // [201, 0.23, 0.32] * faker.color.hsl({ format: 'css' }) // hsl(0deg, 100%, 80%) * faker.color.hsl({ format: 'css', includeAlpha: true }) // hsl(0deg 100% 50% / 0.5) * faker.color.hsl({ format: 'binary' }) // (8-32 bits) x 3 * faker.color.hsl({ format: 'binary', includeAlpha: true }) // (8-32 bits) x 4 * * @since 7.0.0 */ hsl(options?: { /** * Format of generated HSL color. * * @default 'decimal' */ format?: StringColorFormat; /** * Adds an alpha value to the color (RGBA). * * @default false */ includeAlpha?: boolean; }): string; /** * Returns an HSL color. * * @param options Options object. * @param options.format Format of generated HSL color. Defaults to `'decimal'`. * @param options.includeAlpha Adds an alpha value to the color (RGBA). Defaults to `false`. * * @example * faker.color.hsl() // [201, 0.23, 0.32] * faker.color.hsl({ format: 'decimal' }) // [300, 0.21, 0.52] * faker.color.hsl({ format: 'decimal', includeAlpha: true }) // [300, 0.21, 0.52, 0.28] * * @since 7.0.0 */ hsl(options?: { /** * Format of generated HSL color. * * @default 'decimal' */ format?: NumberColorFormat; /** * Adds an alpha value to the color (RGBA). * * @default false */ includeAlpha?: boolean; }): number[]; /** * Returns an HSL color. * * @param options Options object. * @param options.format Format of generated HSL color. Defaults to `'decimal'`. * @param options.includeAlpha Adds an alpha value to the color (RGBA). Defaults to `false`. * * @example * faker.color.hsl() // [201, 0.23, 0.32] * faker.color.hsl({ format: 'decimal' }) // [300, 0.21, 0.52] * faker.color.hsl({ format: 'decimal', includeAlpha: true }) // [300, 0.21, 0.52, 0.28] * faker.color.hsl({ format: 'css' }) // hsl(0deg, 100%, 80%) * faker.color.hsl({ format: 'css', includeAlpha: true }) // hsl(0deg 100% 50% / 0.5) * faker.color.hsl({ format: 'binary' }) // (8-32 bits) x 3 * faker.color.hsl({ format: 'binary', includeAlpha: true }) // (8-32 bits) x 4 * * @since 7.0.0 */ hsl(options?: { /** * Format of generated HSL color. * * @default 'decimal' */ format?: ColorFormat; /** * Adds an alpha value to the color (RGBA). * * @default false */ includeAlpha?: boolean; }): string | number[]; /** * Returns an HWB color. * * @example * faker.color.hwb() // [201, 0.21, 0.31] * * @since 7.0.0 */ hwb(): number[]; /** * Returns an HWB color. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * * @example * faker.color.hwb() // [201, 0.21, 0.31] * faker.color.hwb({ format: 'css' }) // 'hwb(354 72% 41%)' * faker.color.hwb({ format: 'binary' }) // (8-32 bits x 3) * * @since 7.0.0 */ hwb(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: StringColorFormat; }): string; /** * Returns an HWB color. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * * @example * faker.color.hwb() // [201, 0.21, 0.31] * faker.color.hwb({ format: 'decimal' }) // [201, 0.21, 0.31] * * @since 7.0.0 */ hwb(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: NumberColorFormat; }): number[]; /** * Returns an HWB color. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * * @example * faker.color.hwb() // [201, 0.21, 0.31] * faker.color.hwb({ format: 'decimal' }) // [201, 0.21, 0.31] * faker.color.hwb({ format: 'css' }) // 'hwb(354 72% 41%)' * faker.color.hwb({ format: 'binary' }) // (8-32 bits x 3) * * @since 7.0.0 */ hwb(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: ColorFormat; }): string | number[]; /** * Returns a LAB (CIELAB) color. * * @example * faker.color.lab() // [0.832133, -80.3245, 100.1234] * * @since 7.0.0 */ lab(): number[]; /** * Returns a LAB (CIELAB) color. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * * @example * faker.color.lab() // [0.832133, -80.3245, 100.1234] * faker.color.lab({ format: 'css' }) // 'lab(29.2345% 39.3825 20.0664)' * faker.color.lab({ format: 'binary' }) // (8-32 bits x 3) * * @since 7.0.0 */ lab(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: StringColorFormat; }): string; /** * Returns a LAB (CIELAB) color. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * * @example * faker.color.lab() // [0.832133, -80.3245, 100.1234] * faker.color.lab({ format: 'decimal' }) // [0.856773, -80.2345, 100.2341] * * @since 7.0.0 */ lab(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: NumberColorFormat; }): number[]; /** * Returns a LAB (CIELAB) color. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * * @example * faker.color.lab() // [0.832133, -80.3245, 100.1234] * faker.color.lab({ format: 'decimal' }) // [0.856773, -80.2345, 100.2341] * faker.color.lab({ format: 'css' }) // 'lab(29.2345% 39.3825 20.0664)' * faker.color.lab({ format: 'binary' }) // (8-32 bits x 3) * * @since 7.0.0 */ lab(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: ColorFormat; }): string | number[]; /** * Returns an LCH color. Even though upper bound of * chroma in LCH color space is theoretically unbounded, * it is bounded to 230 as anything above will not * make a noticeable difference in the browser. * * @example * faker.color.lch() // [0.522345, 72.2, 56.2] * * @since 7.0.0 */ lch(): number[]; /** * Returns an LCH color. Even though upper bound of * chroma in LCH color space is theoretically unbounded, * it is bounded to 230 as anything above will not * make a noticeable difference in the browser. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * * @example * faker.color.lch() // [0.522345, 72.2, 56.2] * faker.color.lch({ format: 'css' }) // 'lch(52.2345% 72.2 56.2)' * faker.color.lch({ format: 'binary' }) // (8-32 bits x 3) * * @since 7.0.0 */ lch(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: StringColorFormat; }): string; /** * Returns an LCH color. Even though upper bound of * chroma in LCH color space is theoretically unbounded, * it is bounded to 230 as anything above will not * make a noticeable difference in the browser. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * * @example * faker.color.lch() // [0.522345, 72.2, 56.2] * faker.color.lch({ format: 'decimal' }) // [0.522345, 72.2, 56.2] * * @since 7.0.0 */ lch(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: NumberColorFormat; }): number[]; /** * Returns an LCH color. Even though upper bound of * chroma in LCH color space is theoretically unbounded, * it is bounded to 230 as anything above will not * make a noticeable difference in the browser. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * * @example * faker.color.lch() // [0.522345, 72.2, 56.2] * faker.color.lch({ format: 'decimal' }) // [0.522345, 72.2, 56.2] * faker.color.lch({ format: 'css' }) // 'lch(52.2345% 72.2 56.2)' * faker.color.lch({ format: 'binary' }) // (8-32 bits x 3) * * @since 7.0.0 */ lch(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: ColorFormat; }): string | number[]; /** * Returns a random color based on CSS color space specified. * * @example * faker.color.colorByCSSColorSpace() // [0.93, 1, 0.82] * * @since 7.0.0 */ colorByCSSColorSpace(): number[]; /** * Returns a random color based on CSS color space specified. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * @param options.space Color space to generate the color for. Defaults to `'sRGB'`. * * @example * faker.color.colorByCSSColorSpace() // [0.93, 1, 0.82] * faker.color.colorByCSSColorSpace({ format: 'css', space: 'display-p3' }) // color(display-p3 0.12 1 0.23) * faker.color.colorByCSSColorSpace({ format: 'binary' }) // (8-32 bits x 3) * * @since 7.0.0 */ colorByCSSColorSpace(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: StringColorFormat; /** * Color space to generate the color for. * * @default 'sRGB' */ space?: CssSpaceType; }): string; /** * Returns a random color based on CSS color space specified. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * @param options.space Color space to generate the color for. Defaults to `'sRGB'`. * * @example * faker.color.colorByCSSColorSpace() // [0.93, 1, 0.82] * faker.color.colorByCSSColorSpace({ format: 'decimal' }) // [0.12, 0.21, 0.31] * * @since 7.0.0 */ colorByCSSColorSpace(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: NumberColorFormat; /** * Color space to generate the color for. * * @default 'sRGB' */ space?: CssSpaceType; }): number[]; /** * Returns a random color based on CSS color space specified. * * @param options Options object. * @param options.format Format of generated RGB color. Defaults to `'decimal'`. * @param options.space Color space to generate the color for. Defaults to `'sRGB'`. * * @example * faker.color.colorByCSSColorSpace() // [0.93, 1, 0.82] * faker.color.colorByCSSColorSpace({ format: 'decimal' }) // [0.12, 0.21, 0.31] * faker.color.colorByCSSColorSpace({ format: 'css', space: 'display-p3' }) // color(display-p3 0.12 1 0.23) * faker.color.colorByCSSColorSpace({ format: 'binary' }) // (8-32 bits x 3) * * @since 7.0.0 */ colorByCSSColorSpace(options?: { /** * Format of generated RGB color. * * @default 'decimal' */ format?: ColorFormat; /** * Color space to generate the color for. * * @default 'sRGB' */ space?: CssSpaceType; }): string | number[]; } /** * Module to generate commerce and product related entries. * * ### Overview * * For a long product name like `'Incredible Soft Gloves'`, use [`productName()`](https://fakerjs.dev/api/commerce.html#productname). The product names are generated from a list of adjectives, materials, and products, which can each be accessed separately using [`productAdjective()`](https://fakerjs.dev/api/commerce.html#productadjective), [`productMaterial()`](https://fakerjs.dev/api/commerce.html#productmaterial), and [`product()`](https://fakerjs.dev/api/commerce.html#product). You can also create a description using [`productDescription()`](https://fakerjs.dev/api/commerce.html#productdescription). * * For a department in a shop or product category, use [`department()`](https://fakerjs.dev/api/commerce.html#department). * * You can also create a price using [`price()`](https://fakerjs.dev/api/commerce.html#price). */ declare class CommerceModule extends ModuleBase { /** * Returns a department inside a shop. * * @example * faker.commerce.department() // 'Garden' * * @since 3.0.0 */ department(): string; /** * Generates a random descriptive product name. * * @example * faker.commerce.productName() // 'Incredible Soft Gloves' * * @since 3.0.0 */ productName(): string; /** * Generates a price between min and max (inclusive). * * To better represent real-world prices, when `options.dec` is greater than `0`, the final decimal digit in the returned string will be generated as follows: * * - 50% of the time: `9` * - 30% of the time: `5` * - 10% of the time: `0` * - 10% of the time: a random digit from `0` to `9` * * @param options An options object. * @param options.min The minimum price. Defaults to `1`. * @param options.max The maximum price. Defaults to `1000`. * @param options.dec The number of decimal places. Defaults to `2`. * @param options.symbol The currency value to use. Defaults to `''`. * * @example * faker.commerce.price() // '828.07' * faker.commerce.price({ min: 100 }) // '904.19' * faker.commerce.price({ min: 100, max: 200 }) // '154.55' * faker.commerce.price({ min: 100, max: 200, dec: 0 }) // '133' * faker.commerce.price({ min: 100, max: 200, dec: 0, symbol: '$' }) // '$114' * * @since 3.0.0 */ price(options?: { /** * The minimum price. * * @default 1 */ min?: number; /** * The maximum price. * * @default 1000 */ max?: number; /** * The number of decimal places. * * @default 2 */ dec?: number; /** * The currency value to use. * * @default '' */ symbol?: string; }): string; /** * Returns an adjective describing a product. * * @example * faker.commerce.productAdjective() // 'Handcrafted' * * @since 3.0.0 */ productAdjective(): string; /** * Returns a material of a product. * * @example * faker.commerce.productMaterial() // 'Rubber' * * @since 3.0.0 */ productMaterial(): string; /** * Returns a short product name. * * @example * faker.commerce.product() // 'Computer' * * @since 3.0.0 */ product(): string; /** * Returns a product description. * * @example * faker.commerce.productDescription() // 'Featuring Phosphorus-enhanced technology, our Fish offers unparalleled Modern performance' * * @since 5.0.0 */ productDescription(): string; /** * Returns a random [ISBN](https://en.wikipedia.org/wiki/ISBN) identifier. * * @param options The variant to return or an options object. * @param options.variant The variant to return. Can be either `10` (10-digit format) * or `13` (13-digit format). Defaults to `13`. * @param options.separator The separator to use in the format. Defaults to `'-'`. * * @example * faker.commerce.isbn() // '978-0-692-82459-7' * faker.commerce.isbn(10) // '1-155-36404-X' * faker.commerce.isbn(13) // '978-1-60808-867-6' * faker.commerce.isbn({ separator: ' ' }) // '978 0 452 81498 1' * faker.commerce.isbn({ variant: 10, separator: ' ' }) // '0 940319 49 7' * faker.commerce.isbn({ variant: 13, separator: ' ' }) // '978 1 6618 9122 0' * * @since 8.1.0 */ isbn(options?: 10 | 13 | { /** * The variant of the identifier to return. * Can be either `10` (10-digit format) * or `13` (13-digit format). * * @default 13 */ variant?: 10 | 13; /** * The separator to use in the format. * * @default '-' */ separator?: string; }): string; } /** * Module to generate company related entries. * * ### Overview * * To generate a random company name, use [`name()`](https://fakerjs.dev/api/company.html#name). This is localized in many locales. * * To generate jargon-filled company catchphrases and buzzwords, use [`catchPhrase()`](https://fakerjs.dev/api/company.html#catchphrase) or [`buzzPhrase()`](https://fakerjs.dev/api/company.html#buzzphrase). * * ### Related Modules * * - For products and commerce, use [`faker.commerce`](https://fakerjs.dev/api/commerce.html). * - For finance-related entries, use [`faker.finance`](https://fakerjs.dev/api/finance.html). */ declare class CompanyModule extends ModuleBase { /** * Generates a random company name. * * @example * faker.company.name() // 'Zieme, Hauck and McClure' * * @since 7.4.0 */ name(): string; /** * Generates a random catch phrase that can be displayed to an end user. * * @example * faker.company.catchPhrase() // 'Upgradable systematic flexibility' * * @since 2.0.1 */ catchPhrase(): string; /** * Generates a random buzz phrase that can be used to demonstrate data being viewed by a manager. * * @example * faker.company.buzzPhrase() // 'cultivate synergistic e-markets' * * @since 8.0.0 */ buzzPhrase(): string; /** * Returns a random catch phrase adjective that can be displayed to an end user.. * * @example * faker.company.catchPhraseAdjective() // 'Multi-tiered' * * @since 2.0.1 */ catchPhraseAdjective(): string; /** * Returns a random catch phrase descriptor that can be displayed to an end user.. * * @example * faker.company.catchPhraseDescriptor() // 'composite' * * @since 2.0.1 */ catchPhraseDescriptor(): string; /** * Returns a random catch phrase noun that can be displayed to an end user.. * * @example * faker.company.catchPhraseNoun() // 'leverage' * * @since 2.0.1 */ catchPhraseNoun(): string; /** * Returns a random buzz adjective that can be used to demonstrate data being viewed by a manager. * * @example * faker.company.buzzAdjective() // 'one-to-one' * * @since 8.0.0 */ buzzAdjective(): string; /** * Returns a random buzz verb that can be used to demonstrate data being viewed by a manager. * * @example * faker.company.buzzVerb() // 'empower' * * @since 8.0.0 */ buzzVerb(): string; /** * Returns a random buzz noun that can be used to demonstrate data being viewed by a manager. * * @example * faker.company.buzzNoun() // 'paradigms' * * @since 8.0.0 */ buzzNoun(): string; } /** * Module to generate database related entries. * * ### Overview * * Traditional relational database tables have data organized in columns with specific types - [`column()`](https://fakerjs.dev/api/database.html#column), [`type()`](https://fakerjs.dev/api/database.html#type). The database usually has an [`engine()`](https://fakerjs.dev/api/database.html#engine) and a default [`collation()`](https://fakerjs.dev/api/database.html#collation) for sorting. * * For the NoSQL database MongoDB, [`mongodbObjectId()`](https://fakerjs.dev/api/database.html#mongodbobjectid) provides a random ID. */ declare class DatabaseModule extends ModuleBase { /** * Returns a random database column name. * * @example * faker.database.column() // 'createdAt' * * @since 4.0.0 */ column(): string; /** * Returns a random database column type. * * @example * faker.database.type() // 'timestamp' * * @since 4.0.0 */ type(): string; /** * Returns a random database collation. * * @example * faker.database.collation() // 'utf8_unicode_ci' * * @since 4.0.0 */ collation(): string; /** * Returns a random database engine. * * @example * faker.database.engine() // 'ARCHIVE' * * @since 4.0.0 */ engine(): string; /** * Returns a MongoDB [ObjectId](https://docs.mongodb.com/manual/reference/method/ObjectId/) string. * * @example * faker.database.mongodbObjectId() // 'e175cac316a79afdd0ad3afb' * * @since 6.2.0 */ mongodbObjectId(): string; } /** * Module to generate dates (without methods requiring localized data). */ declare class SimpleDateModule extends SimpleModuleBase { /** * Generates a random date that can be either in the past or in the future. * * @param options The optional options object. * @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`. * * @see faker.date.between(): For generating dates in a specific range. * @see faker.date.past(): For generating dates explicitly in the past. * @see faker.date.future(): For generating dates explicitly in the future. * * @example * faker.date.anytime() // '2022-07-31T01:33:29.567Z' * * @since 8.0.0 */ anytime(options?: { /** * The date to use as reference point for the newly generated date. * * @default faker.defaultRefDate() */ refDate?: string | Date | number; }): Date; /** * Generates a random date in the past. * * @param options The optional options object. * @param options.years The range of years the date may be in the past. Defaults to `1`. * @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`. * * @see faker.date.recent(): For generating dates in the recent past (days instead of years). * * @example * faker.date.past() // '2021-12-03T05:40:44.408Z' * faker.date.past({ years: 10 }) // '2017-10-25T21:34:19.488Z' * faker.date.past({ years: 10, refDate: '2020-01-01T00:00:00.000Z' }) // '2017-08-18T02:59:12.350Z' * * @since 8.0.0 */ past(options?: { /** * The range of years the date may be in the past. * * @default 1 */ years?: number; /** * The date to use as reference point for the newly generated date. * * @default faker.defaultRefDate() */ refDate?: string | Date | number; }): Date; /** * Generates a random date in the future. * * @param options The optional options object. * @param options.years The range of years the date may be in the future. Defaults to `1`. * @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`. * * @see faker.date.soon(): For generating dates in the near future (days instead of years). * * @example * faker.date.future() // '2022-11-19T05:52:49.100Z' * faker.date.future({ years: 10 }) // '2030-11-23T09:38:28.710Z' * faker.date.future({ years: 10, refDate: '2020-01-01T00:00:00.000Z' }) // '2020-12-13T22:45:10.252Z' * * @since 8.0.0 */ future(options?: { /** * The range of years the date may be in the future. * * @default 1 */ years?: number; /** * The date to use as reference point for the newly generated date. * * @default faker.defaultRefDate() */ refDate?: string | Date | number; }): Date; /** * Generates a random date between the given boundaries. * * @param options The options object. * @param options.from The early date boundary. * @param options.to The late date boundary. * * @throws If `from` or `to` are not provided. * @throws If `from` is after `to`. * * @example * faker.date.between({ from: '2020-01-01T00:00:00.000Z', to: '2030-01-01T00:00:00.000Z' }) // '2026-05-16T02:22:53.002Z' * * @since 8.0.0 */ between(options: { /** * The early date boundary. */ from: string | Date | number; /** * The late date boundary. */ to: string | Date | number; }): Date; /** * Generates random dates between the given boundaries. The dates will be returned in an array sorted in chronological order. * * @param options The options object. * @param options.from The early date boundary. * @param options.to The late date boundary. * @param options.count The number of dates to generate. Defaults to `3`. * * @throws If `from` or `to` are not provided. * @throws If `from` is after `to`. * * @example * faker.date.betweens({ from: '2020-01-01T00:00:00.000Z', to: '2030-01-01T00:00:00.000Z' }) * // [ * // '2022-07-02T06:00:00.000Z', * // '2024-12-31T12:00:00.000Z', * // '2027-07-02T18:00:00.000Z' * // ] * faker.date.betweens({ from: '2020-01-01T00:00:00.000Z', to: '2030-01-01T00:00:00.000Z', count: 2 }) * // [ '2023-05-02T16:00:00.000Z', '2026-09-01T08:00:00.000Z' ] * faker.date.betweens({ from: '2020-01-01T00:00:00.000Z', to: '2030-01-01T00:00:00.000Z', count: { min: 2, max: 5 }}) * // [ * // 2021-12-19T06:35:40.191Z, * // 2022-09-10T08:03:51.351Z, * // 2023-04-19T11:41:17.501Z * // ] * * @since 8.0.0 */ betweens(options: { /** * The early date boundary. */ from: string | Date | number; /** * The late date boundary. */ to: string | Date | number; /** * The number of dates to generate. * * @default 3 */ count?: number | { /** * The minimum number of dates to generate. */ min: number; /** * The maximum number of dates to generate. */ max: number; }; }): Date[]; /** * Generates a random date in the recent past. * * @param options The optional options object. * @param options.days The range of days the date may be in the past. Defaults to `1`. * @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`. * * @see faker.date.past(): For generating dates further back in time (years instead of days). * * @example * faker.date.recent() // '2022-02-04T02:09:35.077Z' * faker.date.recent({ days: 10 }) // '2022-01-29T06:12:12.829Z' * faker.date.recent({ days: 10, refDate: '2020-01-01T00:00:00.000Z' }) // '2019-12-27T18:11:19.117Z' * * @since 8.0.0 */ recent(options?: { /** * The range of days the date may be in the past. * * @default 1 */ days?: number; /** * The date to use as reference point for the newly generated date. * * @default faker.defaultRefDate() */ refDate?: string | Date | number; }): Date; /** * Generates a random date in the near future. * * @param options The optional options object. * @param options.days The range of days the date may be in the future. Defaults to `1`. * @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`. * * @see faker.date.future(): For generating dates further in the future (years instead of days). * * @example * faker.date.soon() // '2022-02-05T09:55:39.216Z' * faker.date.soon({ days: 10 }) // '2022-02-11T05:14:39.138Z' * faker.date.soon({ days: 10, refDate: '2020-01-01T00:00:00.000Z' }) // '2020-01-01T02:40:44.990Z' * * @since 8.0.0 */ soon(options?: { /** * The range of days the date may be in the future. * * @default 1 */ days?: number; /** * The date to use as reference point for the newly generated date. * * @default faker.defaultRefDate() */ refDate?: string | Date | number; }): Date; /** * Returns a random birthdate. By default, the birthdate is generated for an adult between 18 and 80 years old. * But you can customize the `'age'` range or the `'year'` range to generate a more specific birthdate. * * @param options The options to use to generate the birthdate. * @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`. * * @example * faker.date.birthdate() // '1977-07-10T01:37:30.719Z' * * @since 7.0.0 */ birthdate(options?: { /** * The date to use as reference point for the newly generated date. * * @default faker.defaultRefDate() */ refDate?: string | Date | number; }): Date; /** * Returns a random birthdate for a given age range. * * @param options The options to use to generate the birthdate. * @param options.mode `'age'` to generate a birthdate based on the age range. It is also possible to generate a birthdate based on a `'year'` range. * @param options.min The minimum age to generate a birthdate for. * @param options.max The maximum age to generate a birthdate for. * @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`. * * @example * faker.date.birthdate({ mode: 'age', min: 18, max: 65 }) // '2003-11-02T20:03:20.116Z' * * @since 7.0.0 */ birthdate(options: { /** * `'age'` to generate a birthdate based on the age range. * It is also possible to generate a birthdate based on a `'year'` range. */ mode: 'age'; /** * The minimum age to generate a birthdate for. */ min: number; /** * The maximum age to generate a birthdate for. */ max: number; /** * The date to use as reference point for the newly generated date. * * @default faker.defaultRefDate() */ refDate?: string | Date | number; }): Date; /** * Returns a random birthdate in the given range of years. * * @param options The options to use to generate the birthdate. * @param options.mode `'year'` to generate a birthdate based on the year range. It is also possible to generate a birthdate based on a `'age'` range. * @param options.min The minimum year to generate a birthdate in. * @param options.max The maximum year to generate a birthdate in. * * @example * faker.date.birthdate({ mode: 'year', min: 1900, max: 2000 }) // '1940-08-20T08:53:07.538Z' * * @since 7.0.0 */ birthdate(options: { /** * `'year'` to generate a birthdate based on the year range. * It is also possible to generate a birthdate based on an `'age'` range. */ mode: 'year'; /** * The minimum year to generate a birthdate in. */ min: number; /** * The maximum year to generate a birthdate in. */ max: number; }): Date; /** * Returns a random birthdate. By default, the birthdate is generated for an adult between 18 and 80 years old. * But you can customize the `'age'` range or the `'year'` range to generate a more specific birthdate. * * @param options The options to use to generate the birthdate. * @param options.mode Either `'age'` or `'year'` to generate a birthdate based on the age or year range. * @param options.min The minimum age or year to generate a birthdate in. * @param options.max The maximum age or year to generate a birthdate in. * @param options.refDate The date to use as reference point for the newly generated date. * Only used when `mode` is `'age'`. * Defaults to `faker.defaultRefDate()`. * * @example * faker.date.birthdate() // '1977-07-10T01:37:30.719Z' * faker.date.birthdate({ mode: 'age', min: 18, max: 65 }) // '2003-11-02T20:03:20.116Z' * faker.date.birthdate({ mode: 'year', min: 1900, max: 2000 }) // '1940-08-20T08:53:07.538Z' * * @since 7.0.0 */ birthdate(options?: { /** * The date to use as reference point for the newly generated date. * * @default faker.defaultRefDate() */ refDate?: string | Date | number; } | { /** * Either `'age'` or `'year'` to generate a birthdate based on the age or year range. */ mode: 'age' | 'year'; /** * The minimum age/year to generate a birthdate for/in. */ min: number; /** * The maximum age/year to g