-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description/Steps to reproduce
UPD. at Expo we have a project with Helper file from groceristar-app
ok, a bit info.
at October, 3 I create a task in order to move default functions that we have in our file:
src/config/HelperFunctions.js into our groceristar-fetch module. and i remember that file has a lot of data inside. Today we checked this file and didn't find that methods(not sure why).
Code that is missing(yep, a bad way to manage changes, but fast):
import gf from '@groceristar/groceristar-fetch/groceristar';
import uuid from 'uuidv4';
const getOldGrocery = gf.getGrocery();
let newGrocery = getOldGrocery;
export const getAllDepartmentList = () => {
const newAllDepartments = gf.getAllDepartments();
const newAllDepartmentsObject = newAllDepartments.map(item => ({
key: uuid(),
departmentName: item,
}));
return newAllDepartmentsObject;
};
export const getAllIngredientsList = DeparmentName => {
const Ingredients = gf.getAllIngredientsByOneDepartment(`${DeparmentName}`);
const IngredientsObject = Ingredients.map(item => ({
key: uuid(),
IngredientName: item,
isChecked: false,
}));
return IngredientsObject;
};
export const getAllGrocery = () => {
const GroceryObjectArray = newGrocery.map(item => ({
key: uuid(),
IngredientName: item,
}));
return GroceryObjectArray;
};
export const getAllGroceryDepartment = departmentArray => {
const departmentArrayObject = departmentArray.map(item => ({
key: uuid(),
departmentName: item,
isChecked: false,
}));
return departmentArrayObject;
};
export const createNewGroceryList = newDepartment => {
const isAvailable = newGrocery.filter(item => {
if (item.name === newDepartment.name) {
return true;
}
return false;
});
if (isAvailable.length === 0) {
const newDepartmentList = [...newGrocery, newDepartment];
newGrocery = newDepartmentList;
}
};
Expected result
Additional information
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request

