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

@contrail/data-grouping

Package Overview
Dependencies
Maintainers
0
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrail/data-grouping - npm Package Compare versions

Comparing version 1.0.37 to 1.0.39

22

lib/data-group-generator/data-group-generator.js

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

const sortingArray = [];
data.forEach(obj => {
data.forEach((obj) => {
if (!obj) {

@@ -38,3 +38,3 @@ return;

if (Array.isArray(value) && !groupMultiSelectInSeparateFrame) {
value.forEach(arrayValue => {
value.forEach((arrayValue) => {
map[arrayValue] = arrayValue;

@@ -61,11 +61,13 @@ if (!sortingArray.includes(arrayValue)) {

const val2 = v2 && typeof v2 === 'object' ? (_c = v2 === null || v2 === void 0 ? void 0 : v2.name) === null || _c === void 0 ? void 0 : _c.toLowerCase() : (_d = String(v2)) === null || _d === void 0 ? void 0 : _d.toLowerCase();
const rawVal1 = v1 && typeof v1 === 'object' ? v1.name : String(v1);
const rawVal2 = v2 && typeof v2 === 'object' ? v2.name : String(v2);
switch (sortOrder) {
case 'asc':
case types_1.TypePropertySortOrder.ASCENDING:
return val1 > val2 ? 1 : val1 < val2 ? -1 : 0;
case 'desc':
case types_1.TypePropertySortOrder.DESCENDING:
return val1 < val2 ? 1 : val1 > val2 ? -1 : 0;
case 'list_order_asc':
return ((_e = optionsMap.get(val1)) !== null && _e !== void 0 ? _e : 0) - ((_f = optionsMap.get(val2)) !== null && _f !== void 0 ? _f : 0);
case 'list_order_desc':
return ((_g = optionsMap.get(val2)) !== null && _g !== void 0 ? _g : 0) - ((_h = optionsMap.get(val1)) !== null && _h !== void 0 ? _h : 0);
case types_1.TypePropertySortOrder.LIST_ORDER_ASCENDING:
return ((_e = optionsMap.get(rawVal1)) !== null && _e !== void 0 ? _e : 0) - ((_f = optionsMap.get(rawVal2)) !== null && _f !== void 0 ? _f : 0);
case types_1.TypePropertySortOrder.LIST_ORDER_DESCENDING:
return ((_g = optionsMap.get(rawVal2)) !== null && _g !== void 0 ? _g : 0) - ((_h = optionsMap.get(rawVal1)) !== null && _h !== void 0 ? _h : 0);
default:

@@ -86,6 +88,6 @@ return sortingArray.indexOf(val1) - sortingArray.indexOf(val2);

const sort = groupingProperty.sort || types_1.TypePropertySortOrder.ASCENDING;
const options = ((_c = (_b = groupingProperty.propertyDefinition) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.map(x => x.value)) || null;
const options = ((_c = (_b = groupingProperty.propertyDefinition) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.map((x) => x.value)) || null;
let distinctValues = this.getDistinctValues(data, rootIndex, slugIndex, rootAltIndex, slugAltIndex, groupMultiSelectInSeparateFrame, { sortOrder: sort, options }, isDateProperty);
for (let val of distinctValues) {
const groupData = data.filter(obj => {
const groupData = data.filter((obj) => {
const objVal = util_1.ObjectUtil.getBySlugs(obj, rootIndex, slugIndex) || util_1.ObjectUtil.getBySlugs(obj, rootAltIndex, slugAltIndex);

@@ -92,0 +94,0 @@ if (isDateProperty) {

{
"name": "@contrail/data-grouping",
"version": "1.0.37",
"version": "1.0.39",
"description": "Utilities and interfaces for grouping data into hierarchial data structures based on properties.",

@@ -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