Skip to content

Library for converting ingredients based on serving size changes

Notifications You must be signed in to change notification settings

brianbolnick/ingredient-math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ingredient Math

This library is for converting recipe ingredients based on a serving size factor.

  • NOTE: This module is still in development

Installation

yarn add ingredient-math

Example

import { convertIngredient } from 'ingredient-math';

const ingredient = "1 teaspoon sugar"
const servingsFactor(2)

> convertIngredient(ingredient, servingsFactor)
{
	quantity: "2",
	unit: "teaspoons"
	ingredient: "sugar"
}

It will also automatically calculate and convert units:

import { convertIngredient } from 'ingredient-math';

const ingredient = "1 teaspoon sugar"
const servingsFactor(3)

> convertIngredient(ingredient, servingsFactor)

{
	quantity: "3",
	unit: "tablespoons"
	ingredient: "sugar"
}

About

Library for converting ingredients based on serving size changes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published