
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
npm
npm i zip-ts
pnpm
pnpm i zip-ts
You can use zip
to combine multiple iterables into a single iterable of tuples:
import { zip } from 'zip-ts';
const numbers = [1, 2, 3];
const letters = ['a', 'b', 'c']; // works same as: const letters = 'abc'
for (const [number, letter] of zip(numbers, letters)) {
console.log(`${number} - ${letter}`);
}
// Output:
// 1 - a
// 2 - b
// 3 - c
Stop iterating when the shortest input iterable is exhausted:
import { zip } from 'zip-ts';
const shortArray = [1, 2];
const longString = 'abcdef';
for (const [num, char] of zip(shortArray, longString)) {
console.log(`${num} - ${char}`);
}
// Output:
// 1 - a
// 2 - b
Combine iterables of different types:
import { zip } from 'zip-ts';
const numbers = [1, 2, 3];
const mixed = ['a', 2, { key: 'value' }];
for (const [num, item] of zip(numbers, mixed)) {
console.log(num, item);
}
// Output:
// 1 'a'
// 2 2
// 3 { key: 'value' }
zip
can handle nested iterables as well:
import { zip } from 'zip-ts';
const nestedArray = [[1], [2], [3]];
const chars = 'xyz';
for (const [arr, char] of zip(nestedArray, chars)) {
console.log(arr, char);
}
// Output:
// [1] 'x'
// [2] 'y'
// [3] 'z'
When one or more of the input iterables is empty, the result is also empty:
import { zip } from 'zip-ts';
const emptyArray: any[] = [];
const numbers = [1, 2, 3];
for (const [a, b] of zip(emptyArray, numbers)) {
console.log(a, b);
}
// Output:
// (no output, as the zipped iterable is empty)
For more, check out the tests directory.
FAQs
Python's zip() function, but for TypeScript
The npm package zip-ts receives a total of 0 weekly downloads. As such, zip-ts popularity was classified as not popular.
We found that zip-ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.