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

btrz-mathematics

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

btrz-mathematics - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

.babelrc

2

index.js

@@ -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 @@

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