flexmonster-compressor
Advanced tools
Comparing version 2.7.6 to 2.7.7
{ | ||
"name": "flexmonster-compressor", | ||
"version": "2.7.6", | ||
"version": "2.7.7", | ||
"description": "Flexmonster Compressor for Node.js – a special server-side compression tool that helps you to increase data loading speed from server to Flexmonster Pivot Table component.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -62,9 +62,10 @@ const version = require('../version'); | ||
composeDataRow(values) { | ||
let result = []; | ||
for (let colIdx = 0; colIdx < this._header.length; colIdx++) { | ||
values[colIdx] = this.addMember(values[colIdx], colIdx); | ||
result.push(this.addMember(values[colIdx], colIdx, values)); | ||
} | ||
return values.join(",") + "\n"; | ||
return result.join(",") + "\n"; | ||
} | ||
addMember(value, colIdx) { | ||
addMember(value, colIdx, _values) { | ||
let type = this._header[colIdx].type; | ||
@@ -75,12 +76,11 @@ if (type == ColumnType.FACT) { | ||
let _col = this._header[colIdx].parentHierarchy ? this._header[colIdx].parentHierarchy : this._header[colIdx]; | ||
let _lvlCaption = this._header[colIdx].caption; | ||
let v = value ? value.toString() : ""; | ||
if (_col.members[_lvlCaption] == undefined) { | ||
_col.members[_lvlCaption] = []; | ||
if (type == ColumnType.LEVELS) { | ||
v = this.getFullLevelMemberCaption(_values, colIdx); | ||
} | ||
if (_col.members[_lvlCaption][v.toLowerCase()] !== undefined) { | ||
return "^" + _col.members[_lvlCaption][v.toLowerCase()]; | ||
if (_col.members[v.toLowerCase()] !== undefined) { | ||
return "^" + _col.members[v.toLowerCase()]; | ||
} else { | ||
_col.members[_lvlCaption][v.toLowerCase()] = _col.membersCount++; | ||
return this.encodeChars(v); | ||
_col.members[v.toLowerCase()] = _col.membersCount++; | ||
return this.encodeChars(value ? value.toString() : ""); | ||
} | ||
@@ -107,2 +107,13 @@ } else if (type == ColumnType.DATE || | ||
//composes full level's member name in reverse order, example: "Chicago.Illinois.Midwest" | ||
getFullLevelMemberCaption(_values, colIdx) { | ||
let memberNames = []; | ||
while (this._header[colIdx].parentHierarchy) { | ||
memberNames.push(_values[colIdx]); | ||
colIdx--; | ||
} | ||
memberNames.push(_values[colIdx]); | ||
return memberNames.join("."); | ||
} | ||
timeStrToSeconds(timeStr) { | ||
@@ -202,3 +213,3 @@ var timeParts = timeStr.split(":"); | ||
constructor() { | ||
this.members = []; | ||
this.members = {}; | ||
this.membersCount = 0; | ||
@@ -205,0 +216,0 @@ } |
module.exports = { | ||
VERSION: "2.7.6", | ||
VERSION: "2.7.7", | ||
VERSION_COMPATIBLE: "2.213" | ||
} |
@@ -464,2 +464,3 @@ const assert = require('assert'); | ||
'./test/data/json-data-4', | ||
'./test/data/json-data-5', | ||
]; | ||
@@ -466,0 +467,0 @@ files.forEach(filename => { |
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
220117
29
6267