btrz-mathematics
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -1,1 +0,1 @@ | ||
module.exports = require("./src/mathematics"); | ||
module.exports = require("./lib/mathematics"); |
{ | ||
"name": "btrz-mathematics", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Betterez Mathematics", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "NODE_ENV=test node_modules/mocha/bin/mocha --ui bdd -t 5000", | ||
"test-w": "NODE_ENV=test node_modules/mocha/bin/mocha -w" | ||
"test": "NODE_ENV=test mocha -- --ui bdd -t 5000 --exit", | ||
"test-w": "NODE_ENV=test mocha -w -t 5000", | ||
"transpile": "babel -d lib/ src/", | ||
"commit-transpile": "git add lib/ && git commit --allow-empty -m \"transpiled src\"", | ||
"preversion": "npm test && npm run transpile && npm run commit-transpile", | ||
"postversion": "git push origin master && git push --tags" | ||
}, | ||
@@ -35,5 +39,8 @@ "repository": { | ||
"devDependencies": { | ||
"@babel/cli": "^7.15.8", | ||
"@babel/core": "^7.15.8", | ||
"@babel/preset-env": "^7.15.8", | ||
"chai": "^3.0.0", | ||
"mocha": "latest" | ||
"mocha": "10.2.0" | ||
} | ||
} |
@@ -48,2 +48,9 @@ "use strict"; | ||
function hundredCents(digits) { | ||
let zeroes = ""; | ||
while (zeroes.length < digits) { | ||
zeroes += "0"; | ||
} | ||
return Number(`1${zeroes}`); | ||
} | ||
class Mathematics { | ||
@@ -112,3 +119,3 @@ | ||
} | ||
if (roundedCents === 100){ | ||
if (roundedCents === hundredCents(digits)){ | ||
whole = addOne(whole); | ||
@@ -129,2 +136,5 @@ return wholePlusDigits(whole); | ||
module.exports = Mathematics; | ||
try { | ||
module.exports = Mathematics; | ||
} catch (e) { | ||
} |
@@ -8,4 +8,11 @@ "use strict"; | ||
it("should convert to money", function () { | ||
expect(mathematics.toMoney(32.30)).to.eql(3230000); | ||
describe("toMoney", () => { | ||
it("should convert to money", function () { | ||
expect(mathematics.toMoney(32.30)).to.eql(3230000); | ||
}); | ||
it("should round properly", function () { | ||
const tricky = 296.99999999999994; | ||
expect(mathematics.toMoney(tricky)).to.eql(29700000); | ||
}); | ||
}); | ||
@@ -12,0 +19,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
86250
20
811
0
5