Item

March 7, 2021 ยท View on GitHub

Items are used to track what products, quantities, and options a customer would like to Order.

If you have cloned this repo, you can run the example with this command: node ./example/item.js

extends DominosFormat class, see more in DominosFormat.md

Constructor

new Item({...})

params.argumenttyperequireddescription
.iDNumbernothis number will auto increment with each item created, you do not need to do anything unless you want specific ids on your items. The casind is weird to support dominos format
.codeStringyesthe product code, like 14SCREEN for a 14' cheese pizza
.qtyNumbernothe quantity of the item to order, defaults to 1 if not specified
.optionsObjectnothe special options for these items, options supported for various products can be found in the menu entries for the item
.isNewBoolnosuggested you do not modify this. tells the dominos api if this is a new item. If set to false, dominos will not return duplicate information for this item

Instance

Also check the DominosFormat.md as this class extends it.

member/methodtypedescription
.iDNumberunique id for each item, autogenerated if not provided upon init
.codeStringthe product code, like 14SCREEN for a 14' cheese pizza
.qtyNumberthe quantity of the item to order
.optionsObjectthe special options for these items, options supported for various products can be found in the menu entries for the item. Poke around in the menu to get an idea about them.
.isNewBoolsuggested you do not modify this. tells the dominos api if this is a new item. If set to false, dominos will not return duplicate information for this item
import {Item} from 'dominos';

const cheesePizza=new Item(
    {
        ID:1,
        code:'14SCREEN',
        options:
            // this says, for the whole pizza put sauce on it
            X: {'1/1' : '1'}, 
            
            //this says for the whole pizza put double cheese
            C: {'1/1' : '2'}
    }
);

console.dir(cheesePizza);

//outputs
Item { 
    code: 'P_14SCREEN', 
    qty: 1, 
    options: {
        X: {'1/1' : '1'}, 
        C: {'1/1' : '2'}
    } 
}