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

idea-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
377
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idea-toolbox - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

28

index.js

@@ -27,3 +27,3 @@ 'use strict';

// OTHER
ISODateToItalianFormat, cleanStr
ISODateToItalianFormat, cleanStr, joinArraysOnKeys
}

@@ -313,1 +313,27 @@

}
/**
* Join two arrays by a common column, selecting which data to extract.
* @param {Array<any>} mainTable the main array
* @param {Array<any>} lookupTable the lookup array
* @param {string} mainKey mainTable's column for the join condition
* @param {string} lookupKey lookupTable's column for the join condition
* @param {(attrMainTable, attrLookupTable) => Array<any>} selectFunction defines which attributes we want to retain in the joined array
* @return {Array<any>} the joined array
*/
function joinArraysOnKeys(mainTable, lookupTable, mainKey, lookupKey, selectFunction) {
let l = lookupTable.length;
let m = mainTable.length;
let lookupIndex = [];
let output = [];
for(let i = 0; i < l; i++) { // loop through l items
let row = lookupTable[i];
lookupIndex[row[lookupKey]] = row; // create an index for lookup table
}
for(let j = 0; j < m; j++) { // loop through m items
let y = mainTable[j];
let x = lookupIndex[y[mainKey]]; // get corresponding row from lookupTable
output.push(selectFunction(y, x)); // select only the columns you need
}
return output;
}

2

package.json
{
"name": "idea-toolbox",
"version": "0.6.0",
"version": "0.7.0",
"description": "IDEA's utility functions",

@@ -5,0 +5,0 @@ "engines": {

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