New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

ingredientparser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ingredientparser

Parsing of recipe ingredients in JavaScript

latest
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

Build Status

Ingredient Parser

Simple recipe ingredient parser. Parses a single line of text into a JavaScript Object that represents the best guess at what the ingredient line should be.

Works in any browser that supports Array.forEach, Array.reduce, and Object.keys.

Why?

I'm building a recipe management application and there were no good ingredient parsers in existence that worked in the browser. So, I wrote one.

Install

npm install ingredientparser

How

  • Breaks up the input string on whitespace characters (space and tab)
  • Checks for and concatenates numeric or fractional values
  • Checks for optional or (optional)
  • Checks for "to taste"
  • Checks for text in ()'s to find preparation steps
  • Removes all noise words
  • Returns the resulting object

Input Schema

<amount> <unit> [of] (<prep>) <ingredient> optional|(optional) (<prep>)

Usage

var ing = require('ingredientparser');
console.log(ing.parse('1 cup brown sugar'));

Outputs:

{ amount: '1',
  unit: 'Cup',
  name: 'brown sugar' }

Tests

mocha test
or
npm test

Bug Reports

Found a bug, submit a new issue along with a failing test. If you feel really nice and want a thank you, submit a pull request to resolve it as well.

Keywords

Recipe

FAQs

Package last updated on 31 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts