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

estimate-library

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

estimate-library - npm Package Compare versions

Comparing version 0.2.13 to 0.2.14

2

build/lib/calculations.d.ts
import ITable from "../types/ITable";
import IRow from "../types/IRow";
import IDepartment from "../types/IDepartment";
export declare function calculateRow(this: ITable, row: IRow): IRow;

@@ -10,1 +11,2 @@ export declare function calculateAdditionalRow(this: ITable, subtotal: number): {

};
export declare function calculateAdditionalRowPrice(this: ITable, departments: Array<IDepartment>): number;

@@ -14,3 +14,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateAdditionalRow = exports.calculateRow = void 0;
exports.calculateAdditionalRowPrice = exports.calculateAdditionalRow = exports.calculateRow = void 0;
var getMargin = function (costPrice, discountPercent) { return normalizePrice(costPrice * divIn100(discountPercent)); };

@@ -47,1 +47,5 @@ var getDiscount = function (subtotal, discountPercent) {

exports.calculateAdditionalRow = calculateAdditionalRow;
function calculateAdditionalRowPrice(departments) {
return departments.reduce(function (acc, dep) { return (acc + dep.value); }, 0);
}
exports.calculateAdditionalRowPrice = calculateAdditionalRowPrice;

15

build/lib/core.js

@@ -191,6 +191,9 @@ "use strict";

return section.total.departments.forEach(function (dep, d) {
subtotal.departments[d].value += dep.value;
subtotal.departments[d].value += dep.value * dep.rate;
});
});
this.subtotal = calculations_1.calculateRow.call(this, subtotal);
subtotal.costPrice = subtotal.departments.reduce(function (acc, dep) { return acc + dep.value; }, 0);
subtotal.margin = (subtotal.costPrice * this.config.margin) / 100;
subtotal.price = subtotal.costPrice + subtotal.margin;
this.subtotal = subtotal;
}

@@ -210,6 +213,6 @@ function calculateAdditionalRows() {

});
this.discount = calculations_1.calculateRow.call(this, discountRow);
this.fees = calculations_1.calculateRow.call(this, feesRow);
this.taxes = calculations_1.calculateRow.call(this, taxesRow);
this.total = calculations_1.calculateRow.call(this, totalRow);
this.discount = __assign(__assign({}, discountRow), { price: calculations_1.calculateAdditionalRowPrice.call(this, discountRow.departments) });
this.fees = __assign(__assign({}, feesRow), { price: calculations_1.calculateAdditionalRowPrice.call(this, feesRow.departments) });
this.taxes = __assign(__assign({}, taxesRow), { price: calculations_1.calculateAdditionalRowPrice.call(this, taxesRow.departments) });
this.total = __assign(__assign({}, totalRow), { price: calculations_1.calculateAdditionalRowPrice.call(this, totalRow.departments) });
}

@@ -216,0 +219,0 @@ function calculateTable() {

{
"name": "estimate-library",
"version": "0.2.13",
"version": "0.2.14",
"description": "",

@@ -5,0 +5,0 @@ "main": "build/index.js",

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