Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parse-ingredient

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-ingredient - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

dist/parse-ingredient.cjs.development.js

@@ -54,3 +54,3 @@ 'use strict';

if (oIng.description.endsWith(':') || oIng.description.toUpperCase().startsWith('FOR ')) {
if (/:$/.test(oIng.description) || /^For /i.test(oIng.description)) {
oIng.isGroupHeader = true;

@@ -57,0 +57,0 @@ } // If the first character is numeric, then see how many of the first seven

@@ -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){return function(t){for(var i=-1,s=t.length,r=0,n=[];++i<s;){var e=t[i];e&&(n[r++]=e)}return n}(t.replace(/\n{2,}/g,"\n").split("\n").map((function(t){return t.trim()}))).map((function(t){var r={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},n=i(t.substring(0,1));if(isNaN(n))r.description=t,(r.description.endsWith(":")||r.description.toUpperCase().startsWith("FOR "))&&(r.isGroupHeader=!0);else for(var e=6,u=NaN;e>0&&isNaN(u);)(u=i(t.substring(0,e).trim()))>-1&&(r.quantity=u,r.description=t.substring(e).trim()),e--;var o=r.description.substring(0,1);if("-"===o||"–"===o||"—"===o){var a=i(r.description.substring(1).trim().substring(0,1));if(!isNaN(a))for(var p=6,c=NaN;p>0&&isNaN(c);)c=i(r.description.substring(1,p)),isNaN(c)||(r.quantity2=c,r.description=r.description.substring(p).trim()),p--}var l=r.description.indexOf(" "),d=r.description.substring(0,l);return s.includes(d)&&(r.unitOfMeasure=d,r.description=r.description.substring(l+1)),r}))};
"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){return function(t){for(var i=-1,s=t.length,r=0,n=[];++i<s;){var e=t[i];e&&(n[r++]=e)}return n}(t.replace(/\n{2,}/g,"\n").split("\n").map((function(t){return t.trim()}))).map((function(t){var r={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},n=i(t.substring(0,1));if(isNaN(n))r.description=t,(/:$/.test(r.description)||/^For /i.test(r.description))&&(r.isGroupHeader=!0);else for(var e=6,u=NaN;e>0&&isNaN(u);)(u=i(t.substring(0,e).trim()))>-1&&(r.quantity=u,r.description=t.substring(e).trim()),e--;var o=r.description.substring(0,1);if("-"===o||"–"===o||"—"===o){var a=i(r.description.substring(1).trim().substring(0,1));if(!isNaN(a))for(var p=6,c=NaN;p>0&&isNaN(c);)c=i(r.description.substring(1,p)),isNaN(c)||(r.quantity2=c,r.description=r.description.substring(p).trim()),p--}var l=r.description.indexOf(" "),d=r.description.substring(0,l);return s.includes(d)&&(r.unitOfMeasure=d,r.description=r.description.substring(l+1)),r}))};
//# sourceMappingURL=parse-ingredient.cjs.production.min.js.map

@@ -50,3 +50,3 @@ import numericQuantity from 'numeric-quantity';

if (oIng.description.endsWith(':') || oIng.description.toUpperCase().startsWith('FOR ')) {
if (/:$/.test(oIng.description) || /^For /i.test(oIng.description)) {
oIng.isGroupHeader = true;

@@ -53,0 +53,0 @@ } // If the first character is numeric, then see how many of the first seven

@@ -57,3 +57,3 @@ System.register('parseIngredient', ['numeric-quantity'], function (exports) {

if (oIng.description.endsWith(':') || oIng.description.toUpperCase().startsWith('FOR ')) {
if (/:$/.test(oIng.description) || /^For /i.test(oIng.description)) {
oIng.isGroupHeader = true;

@@ -60,0 +60,0 @@ } // If the first character is numeric, then see how many of the first seven

@@ -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){return function(t){for(var i=-1,s=t.length,n=0,r=[];++i<s;){var e=t[i];e&&(r[n++]=e)}return r}(t.replace(/\n{2,}/g,"\n").split("\n").map((function(t){return t.trim()}))).map((function(t){var n={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},r=i(t.substring(0,1));if(isNaN(r))n.description=t,(n.description.endsWith(":")||n.description.toUpperCase().startsWith("FOR "))&&(n.isGroupHeader=!0);else for(var e=6,u=NaN;e>0&&isNaN(u);)(u=i(t.substring(0,e).trim()))>-1&&(n.quantity=u,n.description=t.substring(e).trim()),e--;var o=n.description.substring(0,1);if("-"===o||"–"===o||"—"===o){var a=i(n.description.substring(1).trim().substring(0,1));if(!isNaN(a))for(var p=6,c=NaN;p>0&&isNaN(c);)c=i(n.description.substring(1,p)),isNaN(c)||(n.quantity2=c,n.description=n.description.substring(p).trim()),p--}var d=n.description.indexOf(" "),l=n.description.substring(0,d);return s.includes(l)&&(n.unitOfMeasure=l,n.description=n.description.substring(d+1)),n}))}))}}}));
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){return function(t){for(var i=-1,s=t.length,n=0,r=[];++i<s;){var e=t[i];e&&(r[n++]=e)}return r}(t.replace(/\n{2,}/g,"\n").split("\n").map((function(t){return t.trim()}))).map((function(t){var n={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},r=i(t.substring(0,1));if(isNaN(r))n.description=t,(/:$/.test(n.description)||/^For /i.test(n.description))&&(n.isGroupHeader=!0);else for(var e=6,u=NaN;e>0&&isNaN(u);)(u=i(t.substring(0,e).trim()))>-1&&(n.quantity=u,n.description=t.substring(e).trim()),e--;var o=n.description.substring(0,1);if("-"===o||"–"===o||"—"===o){var a=i(n.description.substring(1).trim().substring(0,1));if(!isNaN(a))for(var p=6,c=NaN;p>0&&isNaN(c);)c=i(n.description.substring(1,p)),isNaN(c)||(n.quantity2=c,n.description=n.description.substring(p).trim()),p--}var l=n.description.indexOf(" "),d=n.description.substring(0,l);return s.includes(d)&&(n.unitOfMeasure=d,n.description=n.description.substring(l+1)),n}))}))}}}));
//# sourceMappingURL=parse-ingredient.system.production.min.js.map

@@ -56,3 +56,3 @@ (function (global, factory) {

if (oIng.description.endsWith(':') || oIng.description.toUpperCase().startsWith('FOR ')) {
if (/:$/.test(oIng.description) || /^For /i.test(oIng.description)) {
oIng.isGroupHeader = true;

@@ -59,0 +59,0 @@ } // If the first character is numeric, then see how many of the first seven

@@ -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(n){return function(t){for(var i=-1,n=t.length,s=0,r=[];++i<n;){var e=t[i];e&&(r[s++]=e)}return r}(n.replace(/\n{2,}/g,"\n").split("\n").map((function(t){return t.trim()}))).map((function(n){var s={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},r=t(n.substring(0,1));if(isNaN(r))s.description=n,(s.description.endsWith(":")||s.description.toUpperCase().startsWith("FOR "))&&(s.isGroupHeader=!0);else for(var e=6,u=NaN;e>0&&isNaN(u);)(u=t(n.substring(0,e).trim()))>-1&&(s.quantity=u,s.description=n.substring(e).trim()),e--;var o=s.description.substring(0,1);if("-"===o||"–"===o||"—"===o){var a=t(s.description.substring(1).trim().substring(0,1));if(!isNaN(a))for(var p=6,c=NaN;p>0&&isNaN(c);)c=t(s.description.substring(1,p)),isNaN(c)||(s.quantity2=c,s.description=s.description.substring(p).trim()),p--}var d=s.description.indexOf(" "),f=s.description.substring(0,d);return i.includes(f)&&(s.unitOfMeasure=f,s.description=s.description.substring(d+1)),s}))}}));
!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(n){return function(t){for(var i=-1,n=t.length,r=0,s=[];++i<n;){var e=t[i];e&&(s[r++]=e)}return s}(n.replace(/\n{2,}/g,"\n").split("\n").map((function(t){return t.trim()}))).map((function(n){var r={quantity:null,quantity2:null,unitOfMeasure:null,description:"",isGroupHeader:!1},s=t(n.substring(0,1));if(isNaN(s))r.description=n,(/:$/.test(r.description)||/^For /i.test(r.description))&&(r.isGroupHeader=!0);else for(var e=6,u=NaN;e>0&&isNaN(u);)(u=t(n.substring(0,e).trim()))>-1&&(r.quantity=u,r.description=n.substring(e).trim()),e--;var o=r.description.substring(0,1);if("-"===o||"–"===o||"—"===o){var a=t(r.description.substring(1).trim().substring(0,1));if(!isNaN(a))for(var p=6,c=NaN;p>0&&isNaN(c);)c=t(r.description.substring(1,p)),isNaN(c)||(r.quantity2=c,r.description=r.description.substring(p).trim()),p--}var d=r.description.indexOf(" "),f=r.description.substring(0,d);return i.includes(f)&&(r.unitOfMeasure=f,r.description=r.description.substring(d+1)),r}))}}));
//# sourceMappingURL=parse-ingredient.umd.production.min.js.map
{
"version": "0.2.0",
"version": "0.2.1",
"license": "MIT",

@@ -33,3 +33,4 @@ "main": "dist/index.js",

"prepare": "npm run build",
"publish:npm": "np"
"publish:npm": "np",
"publish:demo": "node gh-pages.publish.js"
},

@@ -49,2 +50,3 @@ "prettier": {

"devDependencies": {
"gh-pages": "^3.1.0",
"np": "^7.3.0",

@@ -51,0 +53,0 @@ "tsdx": "^0.14.1",

@@ -40,2 +40,6 @@ # parse-ingredient

## Demo
[See demo here](https://jakeboone02.github.io/parse-ingredient/).
## Installation

@@ -42,0 +46,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc