format-quantity
Advanced tools
Comparing version 0.1.0 to 0.3.0
21
index.js
@@ -1,6 +0,16 @@ | ||
function closeEnough (a, b) { | ||
(function (global, factory) { | ||
if (typeof exports === "object" && typeof module !== "undefined" && module.exports) { | ||
module.exports = factory(); | ||
} else if (typeof define === "function" && define.amd) { | ||
define(factory); | ||
} else { | ||
global.formatQuantity = factory(); | ||
} | ||
}(this, function() { | ||
var closeEnough = function(a, b) { | ||
return Math.abs(a - b) < 0.009; | ||
} | ||
}; | ||
module.exports = function(sInQty) { | ||
var formatQuantity = function(sInQty) { | ||
@@ -76,2 +86,5 @@ sQty = sInQty; | ||
return sQty + ""; | ||
} | ||
}; | ||
return formatQuantity; | ||
})); |
{ | ||
"name": "format-quantity", | ||
"version": "0.1.0", | ||
"version": "0.3.0", | ||
"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 |
11
test.js
@@ -5,3 +5,4 @@ /** | ||
var fq = require("./"); | ||
var fq = this.formatQuantity !== undefined ? this.formatQuantity : require("./"); | ||
var testCount = 0; | ||
@@ -12,3 +13,3 @@ var passCount = 0; | ||
this.attempt = attempt; | ||
}; | ||
} | ||
@@ -23,3 +24,3 @@ Tester.prototype.is = function(test) { | ||
console.log(!!passes ? "pass" : "FAIL: '" + this.attempt + "' is not '" + test + "'"); | ||
} | ||
}; | ||
@@ -70,2 +71,4 @@ function assert(attempt) { | ||
process.exit(testCount - passCount ? 1 : 0); | ||
if (typeof process !== "undefined") { | ||
process.exit(testCount - passCount ? 1 : 0); | ||
} |
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
6573
7
147