New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@contrail/aggregates

Package Overview
Dependencies
Maintainers
8
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrail/aggregates - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

1

lib/aggregate-type-property-helper.d.ts

@@ -10,2 +10,3 @@ import { TypeProperty } from "@contrail/types";

static computeAggregatesForNumericProperties(aggregates: any, data: any, properties: Array<AggregatePropertyInfo>): void;
static applyAggregateFunctions(aggregates: any, properties: any): void;
}

@@ -24,2 +24,3 @@ "use strict";

this.computeAggregatesForNumericProperties(propertyAggregate[optionValue], filteredData, properties);
this.applyAggregateFunctions(aggregates, properties);
}

@@ -47,3 +48,33 @@ }

}
static applyAggregateFunctions(aggregates, properties) {
var _a, _b, _c, _d;
const totalMarginProp = properties.find(p => p.typeProperty.slug === 'totalMargin');
if (totalMarginProp) {
const totalRevenue = (_a = aggregates.totalRevenue) === null || _a === void 0 ? void 0 : _a.total;
const totalCost = (_b = aggregates.totalCost) === null || _b === void 0 ? void 0 : _b.total;
console.log('COMPUTING WEIGHTED MARGIN: ', totalRevenue, totalCost);
let weightedMargin;
if (totalRevenue && totalCost) {
weightedMargin = (totalRevenue - totalCost) / totalRevenue;
}
aggregates.totalMargin = {
total: weightedMargin,
};
}
const itemOptionEfficiencyProp = properties.find(p => p.typeProperty.slug === 'itemOptionEfficiency');
const targetItemOptionCountProp = properties.find(p => p.typeProperty.slug === 'targetItemOptionCount');
if (itemOptionEfficiencyProp && targetItemOptionCountProp) {
const totalVolume = (_c = aggregates.targetVolume) === null || _c === void 0 ? void 0 : _c.total;
console.log('COMPUTING EFFICIENCY: ', totalVolume);
const targetItemOptionCount = (_d = aggregates.targetItemOptionCount) === null || _d === void 0 ? void 0 : _d.total;
let efficiency;
if (totalVolume && targetItemOptionCount) {
efficiency = (totalVolume / targetItemOptionCount);
}
aggregates.itemOptionEfficiency = {
total: efficiency,
};
}
}
}
exports.AggregateTypePropertyHelper = AggregateTypePropertyHelper;

2

package.json
{
"name": "@contrail/aggregates",
"version": "1.0.9",
"version": "1.0.10",
"description": "Utilities for computing aggregates",

@@ -5,0 +5,0 @@ "main": "lib/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