Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ukdomino

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ukdomino - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

_config.yml

12

package.json
{
"name": "ukdomino",
"version": "0.0.2",
"version": "0.0.3",
"description": "ukdomino module js",
"main": "src/index.js",
"directories": {},
"scripts": {
"test": "npm run"
},
"repository": {
"type": "git",
"url": "git+https://github.com/rossAPI/ukdomino.git"
"url": "git+https://github.com/rossAPi/ukdomino.git"
},

@@ -22,7 +25,10 @@ "keywords": [

"dependencies": {
"angular": "^1.7.7",
"fs": "0.0.1-security",
"node-fetch": "^2.3.0",
"path": "^0.12.7",
"util": "^0.11.1"
"superagent": "^4.1.0",
"util": "^0.11.1",
"xmlhttprequest": "^1.8.0"
}
}
# UKDOMINO NODE.JS MODULE
<img src="https://npm.packagequality.com/badge/ukdomino.png"/>
[![Join the chat at https://gitter.im/ukdomino/community](https://badges.gitter.im/ukdomino/community.svg)](https://gitter.im/ukdomino/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
In this module, the Dominos API is used to create features in Javascript, such as getMenu (for any store) and ordering (W.I.P. AS OF 18/02/2019). This module is for the UK-only; I HIGHLY recommend [this module](https://www.npmjs.com/package/dominos "DOMINO USA MODULE") for people in the USA (NPM link). This project is licensed under [the MIT license](https://choosealicense.com/licenses/mit/ "the MIT license").

@@ -7,3 +12,3 @@

### Prerequisites and Instaling
### Prerequisites and Installing
You will need to [install Node-JS](https://nodejs.org/en/download/install "Node-JS") and my package by using the following line below;

@@ -34,6 +39,10 @@

-> node-fetch, used to fetch JSON data. https://www.npmjs.com/package/node-fetch
-> fs, used to write file systems. https://nodejs.org/api/fs.html
-> path, joining paths etc. https://www.npmjs.com/package/path
-> util, sync with fs. https://www.npmjs.com/package/util
Apologies for anything I have forgot; I can add on request.

@@ -47,3 +56,3 @@

* **Ross Hamilton** - *Main Scripting* - [rossAPi]https://github.com/rossAPi
* **Ross Hamilton** - *Main Scripting* - [rossAPi](https://github.com/rossAPi "User")

@@ -64,2 +73,2 @@

## DOCS:
-> COMING SOON
-> See the [wiki here.](https://github.com/rossAPi/ukdomino/wiki)

@@ -10,10 +10,3 @@

// TABLE OF THINGS ADDED TO BASKET ETC.
var store = "";
var localStore = null;
var basket = [];
// FIND LOCAL STORE

@@ -38,3 +31,3 @@

exports.localStoreOpen = function(postcode) {
exports.storeOpen = function(postcode) {
// get the local store

@@ -59,77 +52,4 @@ // get the api and find with the postcode provided

exports.setStore = function(postcode) {
// if asked for local store, find it.
// if given the store postcode, use that.
// fetch the api
return fetch('https://www.dominos.co.uk/storefindermap/storesearch?SearchText=' + postcode)
// json the data
.then(res => res.json())
// return and set appropiately
.then(function(json) {
// return console.log(json.localStore.postcode)
// check if store exists (if does set to store, if not throw a controlled error)
store = json.localStore.postcode
// removes whitespaces
store = store.replace(/\s/g, '')
// console.log(store)
console.warn("ukdomino status: Postcode value updated.")
}) .catch (err => console.log("ukdomino error: " + err))
}
exports.addPizzaToBasket = function(pizza, variant="VARIANT.MEDIUM", quantity=1) {
// adds pizza item to "basket" table, ready for ordering.
// systems can be made to log the "basket" in a file, ready to be picked up later, OR by using the saveBasket() function (RECOMMENDED).
// make an array to be added to the basket array
// TO ADD: MAJOR IMPORTANT: ADD ITEM ID FROM ITEM
// array for all arguments
pizza = ["pizza", "stepId: 0", "quantity: " + quantity, "sizeId: " + variant, "productId: " + pizza, "ingredients: [36, 42]", "productIdHalfTwo: 0", "ingredientsHalfTwo: []" , "recipeReferrer: " + 0]
// adds to the end of the list
basket.push(pizza)
// console.log(basket[0])
}
exports.addSideToBasket = function(side, quantity) {
// adds side item to "basket" table, ready for ordering,
// systems can be made to log the "basket" in a file, ready to be picked up later, OR by using the saveBasket() function (RECOMMENDED).
// make an array to be added to the basket array
// TO ADD: MAJOR IMPORTANT: ADD ITEM ID FROM ITEM
// array for all required arguments
side = ["side", "productSkuId: " + side]
}
exports.saveBasket = function(location="./") {
// saves basket to location OR (default) in the folder
// try the location and create the basketFile, made not a TXT to prevent unwanted editing.
// make a variable of the basket that allows it to be put on the next line
var locationLine = path.join(location, "basket")
fs.writeFile(locationLine, basket, function (err) {
if (err) return console.log("ukdomino error: (No file or directory) Formal " + err)
console.log('ukdomino status: Basket was saved.')
})
}
var resultHandler = function(err) {
if(err) {
console.log("ukdomino error: (No file or directory Formal " + err)
} else {
console.log('ukdomino status: Basket was cleared/deleted.')
}
}
exports.clearBasket = function(location = "./") {
// removes all data from the basket
// if del = true then delete the basket file as well
// if del = false then remove just the data
var locationLine = path.join(location, "basket")
fs.unlink(locationLine, resultHandler, function () {
resultHandler()
})
}
exports.getMenu = function(collectionOnly, menuVersion, storeId) {

@@ -136,0 +56,0 @@ // gets the menu for the store requested.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc