ingredient-math
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -1,7 +0,1 @@ | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import { parse } from 'recipe-ingredient-parser'; | ||
@@ -30,3 +24,4 @@ import Fraction from 'fraction.js'; | ||
return ingredients.reduce(function (acc, ing) { | ||
return _objectSpread({}, acc, _defineProperty({}, acc[ing], convertIngredient(ing))); | ||
acc[ing] = convertIngredient(ing, servingFactor); | ||
return acc; | ||
}, {}); | ||
@@ -33,0 +28,0 @@ }; |
{ | ||
"name": "ingredient-math", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Library for converting ingredients based on serving size changes", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -18,3 +18,7 @@ # Ingredient Math | ||
> convertIngredient(ingredient, servingsFactor) | ||
// "2 teaspoons sugar" | ||
{ | ||
quantity: "2", | ||
unit: "teaspoons" | ||
ingredient: "sugar" | ||
} | ||
``` | ||
@@ -30,5 +34,10 @@ | ||
> convertIngredient(ingredient, servingsFactor) | ||
// "1 tablespoon sugar" | ||
{ | ||
quantity: "3", | ||
unit: "tablespoons" | ||
ingredient: "sugar" | ||
} | ||
``` | ||
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
42
5137
107