Commerce
Module to generate commerce and product related entries.
Color
Returns a human readable color name.
Returns: string
faker.commerce.color(): string
faker.commerce.color() // => "salmon"
faker.commerce.color() // 'red'
Department
Returns a department inside a shop.
Returns: string
faker.commerce.department(): string
faker.commerce.department() // => "Toys"
faker.commerce.department() // 'Garden'
Price
Generates a price between min and max (inclusive).
Parameters
Name | Type | Default | Description |
---|---|---|---|
min | number | 1 | The minimum price. |
max | number | 1000 | The maximum price. |
dec | number | 2 | The number of decimal places. |
symbol | string | '' | The currency value to use. |
Returns: string
faker.commerce.price(min: number = 1, max: number = 1000, dec: number = 2, symbol: string = ''): string
faker.commerce.price() // => "549.00"
faker.commerce.price() // 828.00
faker.commerce.price(100) // 904.00
faker.commerce.price(100, 200) // 154.00
faker.commerce.price(100, 200, 0) // 133
faker.commerce.price(100, 200, 0, '$') // $114
Product
Returns a short product name.
Returns: string
faker.commerce.product(): string
faker.commerce.product() // => "Towels"
faker.commerce.product() // 'Computer'
Product Adjective
Returns an adjective describing a product.
Returns: string
faker.commerce.productAdjective(): string
faker.commerce.productAdjective() // => "Bespoke"
faker.commerce.productAdjective() // 'Handcrafted'
Product Description
Returns a product description.
Returns: string
faker.commerce.productDescription(): string
faker.commerce.productDescription() // => "The Football Is Good For Training And Recreati...
faker.commerce.productDescription() // 'Andy shoes are designed to keeping...'
Product Material
Returns a material of a product.
Returns: string
faker.commerce.productMaterial(): string
faker.commerce.productMaterial() // => "Granite"
faker.commerce.productMaterial() // 'Rubber'
Product Name
Generates a random descriptive product name.
Returns: string
faker.commerce.productName(): string
faker.commerce.productName() // => "Bespoke Rubber Fish"
faker.commerce.productName() // 'Incredible Soft Gloves'