@contrail/documents
Advanced tools
Comparing version 1.0.101 to 1.0.102
@@ -19,10 +19,13 @@ "use strict"; | ||
static getTextFromFrameMemberValues(displayFunction, property, memberValues) { | ||
let text = ''; | ||
if (memberValues.length === 0) { | ||
return text; | ||
} | ||
const formatter = new types_1.PropertyValueFormatter(); | ||
let text = ''; | ||
if (displayFunction === DynamicTextDisplayFunction.AVERAGE) { | ||
memberValues = memberValues.filter((e) => e !== null && e !== undefined && !isNaN(e)); | ||
memberValues = memberValues.filter(e => e !== null && e !== undefined && !isNaN(e)); | ||
text = formatter.formatValueForProperty(memberValues.reduce((a, b) => a + b, 0) / memberValues.length, property); | ||
} | ||
else if (displayFunction === DynamicTextDisplayFunction.SUM) { | ||
memberValues = memberValues.filter((e) => e !== null && e !== undefined && !isNaN(e)); | ||
memberValues = memberValues.filter(e => e !== null && e !== undefined && !isNaN(e)); | ||
text = formatter.formatValueForProperty(memberValues.reduce((a, b) => a + b, 0), property); | ||
@@ -32,5 +35,5 @@ } | ||
text = Array.from(new Set(memberValues | ||
.filter((e) => e !== null && e !== undefined) | ||
.filter(e => e !== null && e !== undefined) | ||
.flat() | ||
.map((e) => formatter.formatValueForProperty(e, property)))) | ||
.map(e => formatter.formatValueForProperty(e, property)))) | ||
.sort() | ||
@@ -44,10 +47,10 @@ .join(', '); | ||
else if (displayFunction === DynamicTextDisplayFunction.LAST) { | ||
text = formatter.formatValueForProperty([memberValues.length - 1], property); | ||
text = formatter.formatValueForProperty(memberValues[memberValues.length - 1], property); | ||
} | ||
else if (displayFunction === DynamicTextDisplayFunction.MIN) { | ||
memberValues = memberValues.filter((e) => e !== null && e !== undefined); | ||
memberValues = memberValues.filter(e => e !== null && e !== undefined); | ||
text = formatter.formatValueForProperty(Math.min(...memberValues), property); | ||
} | ||
else if (displayFunction === DynamicTextDisplayFunction.MAX) { | ||
memberValues = memberValues.filter((e) => e !== null && e !== undefined); | ||
memberValues = memberValues.filter(e => e !== null && e !== undefined); | ||
text = formatter.formatValueForProperty(Math.max(...memberValues), property); | ||
@@ -54,0 +57,0 @@ } |
{ | ||
"name": "@contrail/documents", | ||
"version": "1.0.101", | ||
"version": "1.0.102", | ||
"description": "Documents library for contrail platform", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
128312
4377