interface-forge - v2.5.0
    Preparing search index...

    Class CommerceModule

    Module to generate commerce and product related entries.

    For a long product name like 'Incredible Soft Gloves', use productName(). The product names are generated from a list of adjectives, materials, and products, which can each be accessed separately using productAdjective(), productMaterial(), and product(). You can also create a description using productDescription().

    For a department in a shop or product category, use department().

    You can also create a price using price().

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    faker: Faker

    Methods

    • Returns a department inside a shop.

      Returns string

      faker.commerce.department() // 'Garden'
      

      3.0.0

    • Returns a random ISBN identifier.

      Parameters

      • Optionaloptions: 10 | 13 | { separator?: string; variant?: 10 | 13 }

        The variant to return or an options object.

        • 10
        • 13
        • { separator?: string; variant?: 10 | 13 }
          • Optionalseparator?: string

            The separator to use in the format.

            '-'
            
          • Optionalvariant?: 10 | 13

            The variant of the identifier to return. Can be either 10 (10-digit format) or 13 (13-digit format).

            13
            

      Returns string

      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'

      8.1.0

    • 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

      Parameters

      • Optionaloptions: { dec?: number; max?: number; min?: number; symbol?: string }

        An options object.

        • Optionaldec?: number

          The number of decimal places.

          2
          
        • Optionalmax?: number

          The maximum price.

          1000
          
        • Optionalmin?: number

          The minimum price.

          1
          
        • Optionalsymbol?: string

          The currency value to use.

          ''
          

      Returns string

      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'

      3.0.0

    • Returns a short product name.

      Returns string

      faker.commerce.product() // 'Computer'
      

      3.0.0

    • Returns an adjective describing a product.

      Returns string

      faker.commerce.productAdjective() // 'Handcrafted'
      

      3.0.0

    • Returns a product description.

      Returns string

      faker.commerce.productDescription() // 'Featuring Phosphorus-enhanced technology, our Fish offers unparalleled Modern performance'
      

      5.0.0

    • Returns a material of a product.

      Returns string

      faker.commerce.productMaterial() // 'Rubber'
      

      3.0.0

    • Generates a random descriptive product name.

      Returns string

      faker.commerce.productName() // 'Incredible Soft Gloves'
      

      3.0.0