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.7 to 0.3.0

32

index.d.ts

@@ -25,2 +25,17 @@ /**

/**
Transpose an Array of Arrays.
E.g.:
zip([
[1, 2, 3],
[2, 4, 6],
[1, 4, 8],
[10, 100, 1000],
])
-> [[1, 2, 1, 10], [2, 4, 4, 100], [3, 6, 8, 1000]]
*/
export declare function zip<T>(itemss: T[][]): T[][];
/**
Call `fn` with each item in `items`, and flatten the results into a single array.

@@ -173,8 +188,19 @@

{key: 'lastname', value: 'Brown'},
]) => [
{firstname: 'Chris', lastname: 'Brown'},
]
])
-> {firstname: 'Chris', lastname: 'Brown'}
*/
export declare function toObject<T>(items: T[], nameKey?: string, valueKey?: string): {};
/**
Convert an Array of [string, T] tuples to an object.
E.g.:
tuplesToObject([ ['firstname', 'Chris'], ['lastname', 'Brown'] ])
-> {firstname: 'Chris', lastname: 'Brown'}
*/
export declare function tuplesToObject<T>(tuples: [string, T][]): {
[index: string]: T;
};
/**
Groups contiguous equivalent items together.

@@ -181,0 +207,0 @@

@@ -0,1 +1,2 @@

"use strict";
/**

@@ -32,2 +33,24 @@ Push each item in `items` onto the end of `array`.

/**
Transpose an Array of Arrays.
E.g.:
zip([
[1, 2, 3],
[2, 4, 6],
[1, 4, 8],
[10, 100, 1000],
])
-> [[1, 2, 1, 10], [2, 4, 4, 100], [3, 6, 8, 1000]]
*/
function zip(itemss) {
var lengths = itemss.map(function (items) { return items.length; });
var minLength = Math.min.apply(Math, lengths);
return range(minLength).map(function (index) {
return itemss.map(function (items) { return items[index]; });
});
}
exports.zip = zip;
/**
Call `fn` with each item in `items`, and flatten the results into a single array.

@@ -312,5 +335,4 @@

{key: 'lastname', value: 'Brown'},
]) => [
{firstname: 'Chris', lastname: 'Brown'},
]
])
-> {firstname: 'Chris', lastname: 'Brown'}
*/

@@ -328,2 +350,20 @@ function toObject(items, nameKey, valueKey) {

/**
Convert an Array of [string, T] tuples to an object.
E.g.:
tuplesToObject([ ['firstname', 'Chris'], ['lastname', 'Brown'] ])
-> {firstname: 'Chris', lastname: 'Brown'}
*/
function tuplesToObject(tuples) {
var object = {};
tuples.forEach(function (_a) {
var key = _a[0], value = _a[1];
return object[key] = value;
});
return object;
}
exports.tuplesToObject = tuplesToObject;
/**
Groups contiguous equivalent items together.

@@ -330,0 +370,0 @@

4

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

@@ -24,3 +24,3 @@ "keywords": [

"mocha-lcov-reporter": "*",
"typescript": "next"
"typescript": "*"
},

@@ -27,0 +27,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

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