ingredient-math

0.1.2 • Public • Published

Ingredient Math

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

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"
}

Readme

Keywords

Package Sidebar

Install

npm i ingredient-math

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

5.17 kB

Total Files

3

Last publish

Collaborators

  • brianbolnick