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.6 to 0.2.7

9

index.d.ts

@@ -177,1 +177,10 @@ /**

export declare function toObject<T>(items: T[], nameKey?: string, valueKey?: string): {};
/**
Groups contiguous equivalent items together.
I.e., if equal(items[i], items[i + 1]) returns true, then items[i] and
items[i + 1] will end up in the same sublist.
Returns a regrouping of items that, if flattened, would be equivalent to items.
*/
export declare function groupSequential<T>(items: T[], areEqual?: (a: T, b: T) => boolean): T[][];

@@ -325,1 +325,33 @@ /**

exports.toObject = toObject;
/**
Groups contiguous equivalent items together.
I.e., if equal(items[i], items[i + 1]) returns true, then items[i] and
items[i + 1] will end up in the same sublist.
Returns a regrouping of items that, if flattened, would be equivalent to items.
*/
function groupSequential(items, areEqual) {
if (areEqual === void 0) { areEqual = function (a, b) { return a === b; }; }
if (items.length === 0) {
return [];
}
var previousItem = items[0];
var currentSublist = [previousItem];
var sublists = [currentSublist];
for (var i = 1, l = items.length; i < l; i++) {
var currentItem = items[i];
// if comparison returns true, currentItem belongs in the same group as previousItem
if (areEqual(previousItem, currentItem)) {
currentSublist.push(currentItem);
}
else {
// start a new sublist and add it to sublists
currentSublist = [currentItem];
sublists.push(currentSublist);
}
previousItem = currentItem;
}
return sublists;
}
exports.groupSequential = groupSequential;

2

package.json
{
"name": "tarry",
"version": "0.2.6",
"version": "0.2.7",
"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