format-quantity
Advanced tools
Comparing version
@@ -0,0 +0,0 @@ { |
export as namespace formatQuantity; | ||
export default function formatQuantity(qty: number): string; | ||
/** | ||
* Formats a number (or string that appears to be a number) | ||
* as one would see it written in imperial measurements, e.g. | ||
* "1 1/2" instead of "1.5". | ||
*/ | ||
export default function formatQuantity(qty: number | string): string; |
14
index.js
@@ -11,2 +11,8 @@ (function (global, factory) { | ||
/** | ||
* Determines if two numbers are close enough to consider | ||
* them equal for our purposes | ||
* @param {number} a first number | ||
* @param {number} b second number | ||
*/ | ||
var closeEnough = function (a, b) { | ||
@@ -16,5 +22,11 @@ return Math.abs(a - b) < 0.009; | ||
/** | ||
* Formats a number (or string that appears to be a number) | ||
* as one would see it written in imperial measurements, e.g. | ||
* "1 1/2" instead of "1.5". | ||
* @param {number|string} sInQty The quantity | ||
*/ | ||
var formatQuantity = function (sInQty) { | ||
sQty = sInQty; | ||
var sQty = sInQty; | ||
@@ -21,0 +33,0 @@ // bomb out if not a number |
{ | ||
"name": "format-quantity", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Format a number as an integer plus fraction, as seen in recipe ingredient lists", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -0,0 +0,0 @@ # format-quantity |
@@ -0,0 +0,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7825
-13.38%9
-10%180
-15.49%