
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
csv-async-generator
Advanced tools
A tiny CSV library to serialize and deserialize in a performant way. You can take a look at the kind of memory problems it can solve at [serialize-async-generator.test.ts](src/__tests__/serialize-async-generator.test.ts).
A tiny CSV library to serialize and deserialize in a performant way. You can take a look at the kind of memory problems it can solve at serialize-async-generator.test.ts.
expect(
serialize(
[
{ propA: "A1", propB: "B1" },
{ propA: "A2", propB: "B2" },
],
[
{ header: "A", cell: (item) => item.propA },
{ header: "B", cell: (item) => item.propB },
],
),
).toBe("A;B\r\n" + "A1;B1\r\n" + "A2;B2\r\n");
const getPositiveNumbers = async function* () {
let number = 1;
while (true) {
yield Promise.resolve(number);
number++;
}
};
const limit = async function* <Item>(items: AsyncIterable<Item>, max: number) {
let count = 0;
for await (const item of items) {
if (count >= max) {
return;
}
yield item;
count++;
}
};
const filter = async function* <Item>(
items: AsyncIterable<Item>,
predicate: (item: Item) => any,
) {
for await (const item of items) {
if (predicate(item)) {
yield item;
}
}
};
const map = async function* <Input, Output>(
items: AsyncIterable<Input>,
mapper: (item: Input) => Output,
) {
for await (const item of items) {
yield mapper(item);
}
};
const getFirstFiveEvenPositiveNumbersAsItems = () =>
map(
limit(
filter(getPositiveNumbers(), (it) => it % 2),
5,
),
(it) => ({ value: String(it) }),
);
const lines: Array<string> = [];
for await (const line of serializeAsyncGenerator(
getFirstFiveEvenPositiveNumbersAsItems(),
[{ header: "Value", cell: (item) => item.value }],
)) {
lines.push(line);
}
expect(lines).toStrictEqual([
"Value\r\n",
"1\r\n",
"3\r\n",
"5\r\n",
"7\r\n",
"9\r\n",
]);
FAQs
A tiny CSV library to serialize and deserialize in a performant way. You can take a look at the kind of memory problems it can solve at [serialize-async-generator.test.ts](src/__tests__/serialize-async-generator.test.ts).
The npm package csv-async-generator receives a total of 2 weekly downloads. As such, csv-async-generator popularity was classified as not popular.
We found that csv-async-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.