ingredients-parser
Parses ingredient strings into units, amounts and ingredient names. Forked from the now dead Ingreedyjs project.
Installation
npm install ingredients-parser --save
Usage
var parser = require('ingredients-parser');
var result = parser.parse('500ml milk');
result.amount
result.unit
result.ingredient
result = parser.parse('two kg of all purpouse flour');
result.amount
result.unit
result.ingredient
Contributing
If you wish to change the parser you need to change rules.pegjs
file. The pegjs-generated.js
file is generated by PEG.js.
Building
make build
Testing
make test