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

tarry

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tarry - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

23

index.d.ts

@@ -131,3 +131,3 @@ /**

/**
Merge each item in items that shares the same identifier.
Merge each subset of items that share the same identifier.

@@ -145,2 +145,23 @@ mergeBy([

/**
Concatenate each subset of items that share the same identifier.
groupBy([
{id: 1, key: 'firstname', value: 'Chris'},
{id: 1, key: 'lastname', value: 'Brown'},
{id: 2, key: 'firstname', value: 'Lionel'},
]) => [
[
{id: 1, key: 'firstname', value: 'Chris'},
{id: 1, key: 'lastname', value: 'Brown'},
],
[
{id: 2, key: 'firstname', value: 'Lionel'},
]
]
This is very similar to mergeBy, except that instead of using {} as a base
and combining with assign(), groupBy uses [] as a base and combines with push().
*/
export declare function groupBy<T>(items: T[], idKey?: string): T[][];
/**
Convert an Array of objects with fixed keys to an object with variable keys.

@@ -147,0 +168,0 @@

@@ -237,3 +237,3 @@ /**

/**
Merge each item in items that shares the same identifier.
Merge each subset of items that share the same identifier.

@@ -268,2 +268,38 @@ mergeBy([

/**
Concatenate each subset of items that share the same identifier.
groupBy([
{id: 1, key: 'firstname', value: 'Chris'},
{id: 1, key: 'lastname', value: 'Brown'},
{id: 2, key: 'firstname', value: 'Lionel'},
]) => [
[
{id: 1, key: 'firstname', value: 'Chris'},
{id: 1, key: 'lastname', value: 'Brown'},
],
[
{id: 2, key: 'firstname', value: 'Lionel'},
]
]
This is very similar to mergeBy, except that instead of using {} as a base
and combining with assign(), groupBy uses [] as a base and combines with push().
*/
function groupBy(items, idKey) {
if (idKey === void 0) { idKey = 'id'; }
var groupedItems = [];
var groupedItemsMapping = {};
items.forEach(function (item) {
var id = item[idKey];
var groupedItem = groupedItemsMapping[id];
if (groupedItem === undefined) {
groupedItem = groupedItemsMapping[id] = [];
groupedItems.push(groupedItem);
}
groupedItem.push(item);
});
return groupedItems;
}
exports.groupBy = groupBy;
/**
Convert an Array of objects with fixed keys to an object with variable keys.

@@ -270,0 +306,0 @@

2

package.json
{
"name": "tarry",
"version": "0.2.4",
"version": "0.2.5",
"description": "Utility library for manipulating JavaScript Arrays",

@@ -5,0 +5,0 @@ "keywords": [

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