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

@contrail/aggregates

Package Overview
Dependencies
Maintainers
8
Versions
14
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.7 to 1.0.8

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

1

lib/aggregate-helper.d.ts

@@ -10,2 +10,3 @@ export declare class AggregateHelper {

static getGroupTotals(data: Array<any>, groupingIndex: string, groupingValues: Array<string>, totalIndex: string): {};
static computeAggregatesForNumeric(data: any, prefix: any, slug: any): any;
}

@@ -38,6 +38,7 @@ "use strict";

}
const val = Math.min(...data.map(obj => {
const values = data.map(obj => {
const v = util_1.ObjectUtil.getByPath(obj, index);
return v ? v : 0;
}));
return v;
}).filter(v => (v !== null && v !== undefined));
const val = Math.min(...values);
if (val === Infinity) {

@@ -94,3 +95,30 @@ return null;

}
static computeAggregatesForNumeric(data, prefix, slug) {
if (!(data === null || data === void 0 ? void 0 : data.length)) {
return;
}
const index = `${prefix || ''}${slug}`;
const total = AggregateHelper.getTotal(data, index);
const average = AggregateHelper.getAverage(data, index);
const min = AggregateHelper.getMin(data, index);
const max = AggregateHelper.getMax(data, index);
const aggregate = {};
if (total || total === 0) {
aggregate.total = total;
}
if (average || average === 0) {
aggregate.average = average;
}
if (min || min === 0) {
aggregate.min = min;
}
if (max || max === 0) {
aggregate.max = max;
}
const hasValue = (aggregate.total || aggregate.average || aggregate.min || aggregate.max);
if (hasValue) {
return aggregate;
}
}
}
exports.AggregateHelper = AggregateHelper;
export * from './aggregate-helper';
export * from './aggregate-type-property-helper';

@@ -14,1 +14,2 @@ "use strict";

__exportStar(require("./aggregate-helper"), exports);
__exportStar(require("./aggregate-type-property-helper"), exports);

3

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

@@ -41,4 +41,5 @@ "main": "lib/index.js",

"dependencies": {
"@contrail/types": "^2.0.43",
"@contrail/util": "^1.0.15"
}
}
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