@mediavine/recipe-ingredient-parser
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

recipe-ingredient-parser

Natural language parser for recipes and lists of ingredients. Can parse a string into an object and also combine an array of these ingredient objects.

To install

npm install recipe-ingredient-parser or yarn add recipe-ingredient-parser

To use

import { parse } from 'recipe-ingredient-parser';

And then use on a string, for example: parse('1 teaspoon basil');

Will return an object:

{
  quantity: 1,
  unit: 'teaspoon',
  ingredient: 'basil'
};

Combine ingredient objects

combine([{
  quantity: 1,
  unit: 'teaspoon',
  ingredient: 'basil'
},
{
  quantity: 1,
  unit: 'teaspoon',
  ingredient: 'basil'
}]);

Will return

[{
  quantity: 2,
  unit: 'teaspoon',
  ingredient: 'basil'
}]

Unicode Fractions

Will also correctly parse unicode fractions into the proper amount

Dependents (0)

Package Sidebar

Install

npm i @mediavine/recipe-ingredient-parser

Weekly Downloads

0

Version

2.0.1

License

MIT

Unpacked Size

79.9 kB

Total Files

37

Last publish

Collaborators

  • mv-dwall
  • noel-mediavine
  • andrewmediavine
  • chris-mediavine
  • wzachsmith
  • ari-patwary
  • brandon.johnson
  • mykol
  • 7layersdesign
  • giancarlomv
  • mattmediavine
  • davidschutze
  • jocelynaladin
  • mikemediavine
  • dj-flores
  • mvdawna
  • danfernand
  • gakalantzismv
  • mvryanp
  • blubagoo
  • brienb-mv
  • paulmclark
  • nholloway4
  • brandon-mv
  • jmlallier
  • etnol
  • ehoch
  • jdcauley
  • sethta
  • hannahzulueta
  • johnfoderaro
  • milesdelliott
  • mediavinedev
  • sethbicknell
  • ryanholte
  • trladd
  • renaehodgkins
  • jshilalemv
  • jenjetson
  • fruchter
  • shmariekelly
  • brnnb
  • ray.battle
  • emily.shock
  • keimille