Module: Product

Methods


default()

Gives a good default product object

Returns:

A default product (without an ID, position, type_name, units, or input_id)

Type
product

sanitize(product)

Sanitizes the given product into a valid API product. This intentionally excludes crop_names, as we use crop_ids to define crop_names.

Parameters:
Name Type Description
product product

The product to sanitize

Returns:

The sanitized product

Type
product

translateProductTypeToName(type)

Translates the type_name attribute of a product to a readable name.

Parameters:
Name Type Description
type string

The type_name of a given product

Returns:

The humanized name of the product type

Type
string