Food Tech related static data in json arrays, like recipes, ingredients, recipes, diets, allergies, etc.
Trello board with current tasks
const { groceristar } = require('@groceristar/groceristar-fetch')
const departments = groceristar.getDepartments();
// returns an array of all departments
example
[
{
"name": "Fresh vegetables",
"type": "food"
},
{
"name": "Condiments / sauces",
"type": "food"
}
]
In a few our projects we have a similar files. And we always copy-paste code between them. So by moving this code into separated place - i hope we'll make our projects better.
npm install @groceristar/groceristar-fetch
or
yarn add @groceristar/groceristar-fetch
const { groceristar, search } = require('@groceristar/groceristar-fetch');
console.log(groceristar.getDepartments());
console.log(search.getAttribute('diets'));
import { groceristar, mealCalendar } from '@groceristar/groceristar-fetch'
npm test
@vadim9999, @MinkoJ2, @chauhannishith, @atherdon
Tasks:
https://groceristar.github.io/groceristar-fetch/docs/searchapi-project.html
https://groceristar.github.io/groceristar-fetch/docs/groceristar-project.html
https://groceristar.github.io/groceristar-fetch/docs/chickenkyiv-project.html
https://groceristar.github.io/groceristar-fetch/docs/mealcalendar-project.html
var groceryId5 = gf.getGroceryById(5);
example
[
{
"departments": [
"FATS",
"KETO SNACKS",
"PROTEIN",
"VEGGIES",
"CONDIMENTS",
"DRINKS",
"FLOUR",
"FRUITS"
],
"id": 5,
"name": "Keto Diet Food",
"img": false,
"desc": false,
"slug": false
}
]
var groceryLists = gf.getGroceryListsWithCountDepartments();
example
[
{
"id": 1,
"name": "Ultimate Grocery List",
"departmentsCount": 27
},
{
"id": 2,
"name": "Clean Fatiring",
"departmentsCount": 8
},
]
var allergy = gf.getPlaceholder('Allergy');
// will return "Allergies"
import { search } from '@groceristar/groceristar-fetch';
function toOpt(arr) {
let Opt= arr.reduce((intermediate, item, index) => {
intermediate[index]={};
intermediate[index].value = index;
intermediate[index].label = item;
return intermediate;
}, []);
return Opt;
}
const Options = toOpt(search.getAllergies());
or
import { search as data } from '@groceristar/groceristar-fetch';
getAttributeData(type){
// this.props.type
if (this.props.type == 'Allergy') {
return data.getAttribute('allergies');
}
if (this.props.type == 'Diet') {
return data.getAttribute('diets');
}
if (this.props.type == 'Cuisine') {
return data.getAttribute('cuisines');
}
if (this.props.type == 'Course') {
return data.getAttribute('courses');
}
if (this.props.type == 'Holiday') {
return data.getAttribute('holidays');
}
}
@TODO use different flags for one command in order to call different imports
npm run test -- --arg="search"
@TODO add tests
"migrate-grocery": "node bin/grocery/002-automigrate.js",
"migrate-search": "node bin/search/automigrate.js",
"migrate-recipes": "node bin/recipes/002-automigrate.js",
"import": "node bin/recipes/001-import.js",
"grocery": "node bin/grocery/001-import.js",
"search": "node bin/search/import.js",
"g": "npm run migrate-grocery && nodemon bin/grocery/import.js",
"r": "npm run migrate-recipes && nodemon bin/recipes/import.js",
"s": "npm run migrate-search && nodemon bin/search/import.js",
"g2": "npm run migrate-grocery && node bin/grocery/import.js",
"r2": "npm run migrate-recipes && node bin/recipes/import.js",
"s2": "npm run migrate-search && node bin/search/import.js"
https://codeburst.io/how-to-create-and-publish-your-first-node-js-module-444e7585b738 https://medium.com/@adrianli/the-idiot-s-guide-to-publishing-a-react-component-to-npm-2b66b1ac03e0
Trello Board: https://trello.com/b/U2Jm8JWX/fetch-plugin
Sandbox Editor: https://codesandbox.io/s/mzknoy0rnp
let table_name = "Allergy"
const get = () => {
var data = [
{
"name":"Gluten-Free",
"type":"allergy",
}
];
return data;
};
module.exports.get = get;
