parse-ingredient
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -10,3 +10,3 @@ 'use strict'; | ||
var parseIngredient = function parseIngredient(ingText) { | ||
var arrRaw = ingText.split('\n').map(function (ing) { | ||
var arrRaw = ingText.replace(/\n{2,}/g, '\n').split('\n').map(function (ing) { | ||
return ing.trim(); | ||
@@ -13,0 +13,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
"use strict";var t,i=(t=require("numeric-quantity"))&&"object"==typeof t&&"default"in t?t.default:t,s=["cup","cups","c","c.","C","teaspoon","teaspoons","tsp","tsp.","t","tablespoon","tablespoons","tbsp","tbsp.","T","ounce","ounces","oz","oz.","pint","pints","pt","pt.","pound","pounds","lb","lb.","lbs","lbs.","gram","grams","g","g.","kilogram","kilograms","kg","kg.","stick","sticks","inch","inches","in","in.","foot","feet","ft","ft.","quart","quarts","qt","qt.","liter","liters","l"];module.exports=function(t){for(var r=t.split("\n").map((function(t){return t.trim()})),n=[],e=r.length,o=0;o<e;o++){var u={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},p=i(r[o].substring(0,1));if(isNaN(p))u.description=r[o],(u.description.endsWith(":")||u.description.toUpperCase().startsWith("FOR "))&&(u.isGroupHeader=!0);else{var a=6;for(p=NaN;a>0&&isNaN(p);)(p=i(r[o].substring(0,a).trim()))>-1&&(u.quantity=p,u.description=r[o].substring(a).trim()),a--}var c=u.description.substring(0,1);if(("-"===c||"–"===c||"—"===c)&&(p=i(u.description.substring(1).trim().substring(0,1)),!isNaN(p))){var d=6;for(p=NaN;d>0&&isNaN(p);)p=i(u.description.substring(1,d)),isNaN(p)||(u.quantity2=p,u.description=u.description.substring(d).trim()),d--}var l=u.description.indexOf(" "),b=u.description.substring(0,l);s.includes(b)&&(u.unitOfMeasure=b,u.description=u.description.substring(l+1)),n.push(u)}return n}; | ||
"use strict";var t,i=(t=require("numeric-quantity"))&&"object"==typeof t&&"default"in t?t.default:t,s=["cup","cups","c","c.","C","teaspoon","teaspoons","tsp","tsp.","t","tablespoon","tablespoons","tbsp","tbsp.","T","ounce","ounces","oz","oz.","pint","pints","pt","pt.","pound","pounds","lb","lb.","lbs","lbs.","gram","grams","g","g.","kilogram","kilograms","kg","kg.","stick","sticks","inch","inches","in","in.","foot","feet","ft","ft.","quart","quarts","qt","qt.","liter","liters","l"];module.exports=function(t){for(var r=t.replace(/\n{2,}/g,"\n").split("\n").map((function(t){return t.trim()})),n=[],e=r.length,o=0;o<e;o++){var u={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},p=i(r[o].substring(0,1));if(isNaN(p))u.description=r[o],(u.description.endsWith(":")||u.description.toUpperCase().startsWith("FOR "))&&(u.isGroupHeader=!0);else{var a=6;for(p=NaN;a>0&&isNaN(p);)(p=i(r[o].substring(0,a).trim()))>-1&&(u.quantity=p,u.description=r[o].substring(a).trim()),a--}var c=u.description.substring(0,1);if(("-"===c||"–"===c||"—"===c)&&(p=i(u.description.substring(1).trim().substring(0,1)),!isNaN(p))){var l=6;for(p=NaN;l>0&&isNaN(p);)p=i(u.description.substring(1,l)),isNaN(p)||(u.quantity2=p,u.description=u.description.substring(l).trim()),l--}var d=u.description.indexOf(" "),g=u.description.substring(0,d);s.includes(g)&&(u.unitOfMeasure=g,u.description=u.description.substring(d+1)),n.push(u)}return n}; | ||
//# sourceMappingURL=parse-ingredient.cjs.production.min.js.map |
@@ -6,3 +6,3 @@ import numericQuantity from 'numeric-quantity'; | ||
var parseIngredient = function parseIngredient(ingText) { | ||
var arrRaw = ingText.split('\n').map(function (ing) { | ||
var arrRaw = ingText.replace(/\n{2,}/g, '\n').split('\n').map(function (ing) { | ||
return ing.trim(); | ||
@@ -9,0 +9,0 @@ }); |
@@ -13,3 +13,3 @@ System.register('parseIngredient', ['numeric-quantity'], function (exports) { | ||
var parseIngredient = function parseIngredient(ingText) { | ||
var arrRaw = ingText.split('\n').map(function (ing) { | ||
var arrRaw = ingText.replace(/\n{2,}/g, '\n').split('\n').map(function (ing) { | ||
return ing.trim(); | ||
@@ -16,0 +16,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
System.register("parseIngredient",["numeric-quantity"],(function(t){"use strict";var i;return{setters:[function(t){i=t.default}],execute:function(){var s=["cup","cups","c","c.","C","teaspoon","teaspoons","tsp","tsp.","t","tablespoon","tablespoons","tbsp","tbsp.","T","ounce","ounces","oz","oz.","pint","pints","pt","pt.","pound","pounds","lb","lb.","lbs","lbs.","gram","grams","g","g.","kilogram","kilograms","kg","kg.","stick","sticks","inch","inches","in","in.","foot","feet","ft","ft.","quart","quarts","qt","qt.","liter","liters","l"];t("default",(function(t){for(var n=t.split("\n").map((function(t){return t.trim()})),r=[],e=n.length,u=0;u<e;u++){var o={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},a=i(n[u].substring(0,1));if(isNaN(a))o.description=n[u],(o.description.endsWith(":")||o.description.toUpperCase().startsWith("FOR "))&&(o.isGroupHeader=!0);else{var p=6;for(a=NaN;p>0&&isNaN(a);)(a=i(n[u].substring(0,p).trim()))>-1&&(o.quantity=a,o.description=n[u].substring(p).trim()),p--}var c=o.description.substring(0,1);if(("-"===c||"–"===c||"—"===c)&&(a=i(o.description.substring(1).trim().substring(0,1)),!isNaN(a))){var d=6;for(a=NaN;d>0&&isNaN(a);)a=i(o.description.substring(1,d)),isNaN(a)||(o.quantity2=a,o.description=o.description.substring(d).trim()),d--}var l=o.description.indexOf(" "),g=o.description.substring(0,l);s.includes(g)&&(o.unitOfMeasure=g,o.description=o.description.substring(l+1)),r.push(o)}return r}))}}})); | ||
System.register("parseIngredient",["numeric-quantity"],(function(t){"use strict";var i;return{setters:[function(t){i=t.default}],execute:function(){var s=["cup","cups","c","c.","C","teaspoon","teaspoons","tsp","tsp.","t","tablespoon","tablespoons","tbsp","tbsp.","T","ounce","ounces","oz","oz.","pint","pints","pt","pt.","pound","pounds","lb","lb.","lbs","lbs.","gram","grams","g","g.","kilogram","kilograms","kg","kg.","stick","sticks","inch","inches","in","in.","foot","feet","ft","ft.","quart","quarts","qt","qt.","liter","liters","l"];t("default",(function(t){for(var n=t.replace(/\n{2,}/g,"\n").split("\n").map((function(t){return t.trim()})),r=[],e=n.length,u=0;u<e;u++){var o={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},a=i(n[u].substring(0,1));if(isNaN(a))o.description=n[u],(o.description.endsWith(":")||o.description.toUpperCase().startsWith("FOR "))&&(o.isGroupHeader=!0);else{var p=6;for(a=NaN;p>0&&isNaN(a);)(a=i(n[u].substring(0,p).trim()))>-1&&(o.quantity=a,o.description=n[u].substring(p).trim()),p--}var c=o.description.substring(0,1);if(("-"===c||"–"===c||"—"===c)&&(a=i(o.description.substring(1).trim().substring(0,1)),!isNaN(a))){var d=6;for(a=NaN;d>0&&isNaN(a);)a=i(o.description.substring(1,d)),isNaN(a)||(o.quantity2=a,o.description=o.description.substring(d).trim()),d--}var l=o.description.indexOf(" "),g=o.description.substring(0,l);s.includes(g)&&(o.unitOfMeasure=g,o.description=o.description.substring(l+1)),r.push(o)}return r}))}}})); | ||
//# sourceMappingURL=parse-ingredient.system.production.min.js.map |
@@ -12,3 +12,3 @@ (function (global, factory) { | ||
var parseIngredient = function parseIngredient(ingText) { | ||
var arrRaw = ingText.split('\n').map(function (ing) { | ||
var arrRaw = ingText.replace(/\n{2,}/g, '\n').split('\n').map(function (ing) { | ||
return ing.trim(); | ||
@@ -15,0 +15,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i(require("numeric-quantity")):"function"==typeof define&&define.amd?define(["numeric-quantity"],i):(t=t||self).parseIngredient=i(t.numericQuantity)}(this,(function(t){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var i=["cup","cups","c","c.","C","teaspoon","teaspoons","tsp","tsp.","t","tablespoon","tablespoons","tbsp","tbsp.","T","ounce","ounces","oz","oz.","pint","pints","pt","pt.","pound","pounds","lb","lb.","lbs","lbs.","gram","grams","g","g.","kilogram","kilograms","kg","kg.","stick","sticks","inch","inches","in","in.","foot","feet","ft","ft.","quart","quarts","qt","qt.","liter","liters","l"];return function(s){for(var n=s.split("\n").map((function(t){return t.trim()})),e=[],r=n.length,o=0;o<r;o++){var u={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},p=t(n[o].substring(0,1));if(isNaN(p))u.description=n[o],(u.description.endsWith(":")||u.description.toUpperCase().startsWith("FOR "))&&(u.isGroupHeader=!0);else{var a=6;for(p=NaN;a>0&&isNaN(p);)(p=t(n[o].substring(0,a).trim()))>-1&&(u.quantity=p,u.description=n[o].substring(a).trim()),a--}var c=u.description.substring(0,1);if(("-"===c||"–"===c||"—"===c)&&(p=t(u.description.substring(1).trim().substring(0,1)),!isNaN(p))){var d=6;for(p=NaN;d>0&&isNaN(p);)p=t(u.description.substring(1,d)),isNaN(p)||(u.quantity2=p,u.description=u.description.substring(d).trim()),d--}var l=u.description.indexOf(" "),f=u.description.substring(0,l);i.includes(f)&&(u.unitOfMeasure=f,u.description=u.description.substring(l+1)),e.push(u)}return e}})); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i(require("numeric-quantity")):"function"==typeof define&&define.amd?define(["numeric-quantity"],i):(t=t||self).parseIngredient=i(t.numericQuantity)}(this,(function(t){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var i=["cup","cups","c","c.","C","teaspoon","teaspoons","tsp","tsp.","t","tablespoon","tablespoons","tbsp","tbsp.","T","ounce","ounces","oz","oz.","pint","pints","pt","pt.","pound","pounds","lb","lb.","lbs","lbs.","gram","grams","g","g.","kilogram","kilograms","kg","kg.","stick","sticks","inch","inches","in","in.","foot","feet","ft","ft.","quart","quarts","qt","qt.","liter","liters","l"];return function(s){for(var n=s.replace(/\n{2,}/g,"\n").split("\n").map((function(t){return t.trim()})),e=[],r=n.length,o=0;o<r;o++){var u={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},p=t(n[o].substring(0,1));if(isNaN(p))u.description=n[o],(u.description.endsWith(":")||u.description.toUpperCase().startsWith("FOR "))&&(u.isGroupHeader=!0);else{var a=6;for(p=NaN;a>0&&isNaN(p);)(p=t(n[o].substring(0,a).trim()))>-1&&(u.quantity=p,u.description=n[o].substring(a).trim()),a--}var c=u.description.substring(0,1);if(("-"===c||"–"===c||"—"===c)&&(p=t(u.description.substring(1).trim().substring(0,1)),!isNaN(p))){var d=6;for(p=NaN;d>0&&isNaN(p);)p=t(u.description.substring(1,d)),isNaN(p)||(u.quantity2=p,u.description=u.description.substring(d).trim()),d--}var l=u.description.indexOf(" "),f=u.description.substring(0,l);i.includes(f)&&(u.unitOfMeasure=f,u.description=u.description.substring(l+1)),e.push(u)}return e}})); | ||
//# sourceMappingURL=parse-ingredient.umd.production.min.js.map |
{ | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"keywords": [ | ||
"parse", | ||
"recipe", | ||
"ingredient", | ||
"quantity", | ||
"number" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/jakeboone02/parse-ingredient/issues" | ||
}, | ||
"homepage": "https://github.com/jakeboone02/parse-ingredient", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jakeboone02/parse-ingredient" | ||
}, | ||
"files": [ | ||
"dist", | ||
"src" | ||
"dist" | ||
], | ||
@@ -26,3 +40,4 @@ "engines": { | ||
"trailingComma": "es5", | ||
"arrowParens": "avoid" | ||
"arrowParens": "avoid", | ||
"tabWidth": 2 | ||
}, | ||
@@ -32,2 +47,3 @@ "name": "parse-ingredient", | ||
"module": "dist/parse-ingredient.esm.js", | ||
"unpkg": "dist/parse-ingredient.umd.production.min.js", | ||
"devDependencies": { | ||
@@ -34,0 +50,0 @@ "np": "^7.3.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
3
1
72774
19
334