Commerce

Module to generate commerce and product related entries.

  • Department
  • Price
  • Product
  • Product Adjective
  • Product Description
  • Product Material
  • Product Name

Department

Returns a department inside a shop.

Returns: string

// department function
commerce.department(): string

// import
import { useFaker } from 'next-faker';

const { commerce } = useFaker();

// usage
commerce.department() // => "Toys"
commerce.department() // 'Garden'

Price

Generates a price between min and max (inclusive).

Parameters

NameTypeDefaultDescription
minnumber1The minimum price.
maxnumber1000The maximum price.
decnumber2The number of decimal places.
symbolstring''The currency value to use.

Returns: string

// price function
commerce.price(min: number = 1, max: number = 1000, dec: number = 2, symbol: string = ''): string

// import
import { useFaker } from 'next-faker';

const { commerce } = useFaker();

// usage
commerce.price(); // => "549.00"
commerce.price(); // 828.00
commerce.price(100); // 904.00
commerce.price(100, 200); // 154.00
commerce.price(100, 200, 0); // 133
commerce.price(100, 200, 0, '$'); // $114

Product

Returns a short product name.

Returns: string

// product function
commerce.product(): string

// import
import { useFaker } from 'next-faker';

const { commerce } = useFaker();

// usage
commerce.product(); // => "Towels"
commerce.product(); // 'Computer'

Product Adjective

Returns an adjective describing a product.

Returns: string

// productAdjective function
commerce.productAdjective(): string

// import
import { useFaker } from 'next-faker';

const { commerce } = useFaker();

// usage
commerce.productAdjective(); // => "Bespoke"
commerce.productAdjective(); // 'Handcrafted'

Product Description

Returns a product description.

Returns: string

// productDescription function
commerce.productDescription(): string

// import
import { useFaker } from 'next-faker';

const { commerce } = useFaker();

// usage
commerce.productDescription(); // => "The Football Is Good For Training And Recreati...
commerce.productDescription(); // 'Andy shoes are designed to keeping...'

Product Material

Returns a material of a product.

Returns: string

// productMaterial function
commerce.productMaterial(): string

// import
import { useFaker } from 'next-faker';

const { commerce } = useFaker();

// usage
commerce.productMaterial(); // => "Granite"
commerce.productMaterial(); // 'Rubber'

Product Name

Generates a random descriptive product name.

Returns: string

// productName function
commerce.productName(): string

// import
import { useFaker } from 'next-faker';

const { commerce } = useFaker();

// usage
commerce.productName(); // => "Bespoke Rubber Fish"
commerce.productName(); // 'Incredible Soft Gloves'