Introducing a Simple NPM Module for Food Measurementsby@arthur.tkachenko
222 reads

Introducing a Simple NPM Module for Food Measurements

by ArthurApril 26th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The module is a set of constants that can be easily imported. It's mostly for displaying data and displaying data. The math part will be supported later, when this module will be tested for different projects. The idea was simple: Ingredients are a thing that is related to recipes. Items can be purchased at current shopping list (item id) Listed at favorite id + L (Qty and L

People Mentioned

Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Introducing a Simple NPM Module for Food Measurements
Arthur HackerNoon profile picture

This Slogging thread by Arthur Tkachenko occurred in slogging's official #programming channel, and has been edited for readability.

Arthur TkachenkoApr 7, 2022, 10:41 AM

Hello hello and hope you missed my posts about simple modules that i'm working on. Another module that I'm trying to restart related to measurements

Arthur TkachenkoApr 7, 2022, 10:42 AM

And im using the same logic of building it. It must be an isolated and independent module that Javascript people can include and use. Plus, as code is easy - people who using other languages can dig into that semantics and quickly copy it. A simple module doesn't mean it doesn't have a future for improvements. I even decide to create a separate GitHub organization, because i get stuck with so many repositories. It becomes hard to navigate there.I also adore the way how founders of DataHub did. They create a framework+test suite for checking and normalizing data. Plus i want to separate code, related to food data and data itself, so other professionals can use it separately too.

Arthur TkachenkoApr 7, 2022, 10:53 AM

At some point I'll test this assumption and try to convert my modules via tools, similar to make in Linux. one of the easiest tasks will be to migrate to TS

Python has module JS2PY for similar things -

Arthur TkachenkoApr 7, 2022, 10:54 AM

And yeah, I hope that Babel can help with tasks like that a lot. Ave to Babel!

But lets get back to my "measurements module"

Arthur TkachenkoApr 7, 2022, 11:01 AM

Let's start with basics aka why your ordinary programmer shouldn't know about it.

And if you think it's was easy for me to figure it out - you really wrong. It take years to get to this point 🙂 In my article I told how hard it was to generate a grocery list when you have a set of recipes for a week.

While one recipe can be a simple 1-2-3, another can be 1-1.1-1.2-1.2-2-3 🙂 and sometimes you need to combine 1/4 cup with teaspoons... (just trust me, it's not easy)

Arthur TkachenkoApr 7, 2022, 11:03 AM

And let's not forget that US and Europe have different food measurement systems. And it's not helping here as well 🙂

Arthur TkachenkoApr 7, 2022, 11:03 AM
Arthur TkachenkoApr 7, 2022, 11:05 AM

I remember reading Robinson Crusoe as a kid and i was not able to figure out how much food he has. Or reading "Twenty Thousand Leagues Under the Sea" by Jules Verne. My book version was 20k miles, btw

Arthur TkachenkoApr 7, 2022, 11:06 AM

If you are already confused, I hope I answered to your question about why this module can become a great tool in future

Arthur TkachenkoApr 7, 2022, 11:08 AM

This module is a set of constants that can be easily imported

Arthur TkachenkoApr 7, 2022, 11:10 AM

Calculations and moves between cup1/8 and cup1/2 aren't supported now. As you might see - we have strings here, so it's mostly for displaying data

Arthur TkachenkoApr 7, 2022, 11:11 AM

The math part will be supported later, when this module will be tested for different projects.

Arthur TkachenkoApr 7, 2022, 11:14 AM

Let's think about where this module can be used. In my opinion, there is a huge variety of things, related to food measurements.

  • From meal preparations for a family to catering.
  • For weight loss, counting calories, fitness, and different diets
  • From food delivery and restaurant management or POS
  • From replacing ingredients, nutritional values to inventory tracking
Arthur TkachenkoApr 7, 2022, 11:14 AM

and yeah, grocery shopping and family finance management

Arthur TkachenkoApr 7, 2022, 11:14 AM

Arthur TkachenkoApr 7, 2022, 11:15 AM

Arthur TkachenkoApr 7, 2022, 11:16 AM

And while your designer can build a good looking app in a month(probably). You will have a huge opportunity to stuck with measurements.

Arthur TkachenkoApr 7, 2022, 11:20 AM

Building a database can be a pain as well. Here is a schema that I built 5 years ago. Now I think it's so outdated approach to building things....

Arthur TkachenkoApr 7, 2022, 11:28 AM

I remember a cool example, related to building a database for grocery lists.

My developer argued with me because i created a table called Items and we have table Ingredients. In his opinion, this is just the same thing that will be duplicated and mess with our data. and I understand why.

But my idea was simple: ingredients are a thing that is related to recipes. And an item is a thing that is located on a grocery list and can be purchased. Items should also have a price field.

So each item can be milk (Ingredient) + 1 L (Qty and measurement) + id (ingredient stored at favorite list) + id (item is purchased at current shopping list)

such small nuances can adjust a lot of things during development. Especially testing. if you don't know that this can be a problem - later you'll be upset when things start to crash.

Arthur TkachenkoApr 10, 2022, 10:40 PM

While someone can say that doing math convertions is not important, I can't agree with you.

If you take a deeper look, there are people that always looking for a solution in a way, that suits them better.

Someone wants "one app to rule em all", someone else wants a simple tool that can be easily imported/exported into no-code tools like notion.

recently i was looking at notion templates for inspiration and find that people start to store recipes in Notion too!

So it's hard to know what people will adore later. What i know for sure - simplicity is a king.

Arthur TkachenkoApr 10, 2022, 10:42 PM

Let me continue. Someone get a prescription from a doctor and downloaded an app with app-purchases. Other people want to have a free app with only 10 free recipes inside.

if you google online food calculation you will find a lot of strange and old things that sitting and actually still working

Arthur TkachenkoApr 10, 2022, 10:44 PM

And while UX designers trying to figure out the best way to fit a lot of functionality into a mobile screen and make users happy, measurements calculations work as before under the hood

Arthur TkachenkoApr 10, 2022, 10:46 PM

if we go deeper, you may even find microsoft excel templates for managing recipes and making them scalable....
Check the images below, looks so fun. But i'm sure some people still using it for a convenience sake.

Arthur TkachenkoApr 10, 2022, 10:55 PM

probably, next stage will be to polish this module and maybe make it language agnoslic. One of the easiest way that I know is to setup an API at someplace like and provide it as a service for other companies.

Arthur TkachenkoApr 20, 2022, 2:05 PM

If you want to read more articles about food tech: