
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@shun-shobon/iter-funcs
Advanced tools
Utility functions for iterators. Inspired by Rust's `std::iter::Iterator` trait.
Utility functions for iterators. Inspired by Rust's
std::iter::Iterator
trait. This library uses JavaScript native iterators, so it's compatible with
any library that uses them.
Install package from npm.
npm install @shun-shobon/iter-funcs@1.7.0
You can import from the package as @shun-shobon/iter-funcs
.
import { filter, map } from "@shun-shobon/iter-funcs";
You can directly import from deno.land/x
.
import { filter, map } from "https://deno.land/x/iter_funcs@1.7.0/mod.ts";
You can directly import from unpkg.com
.
import {
filter,
map,
} from "https://unpkg.com/@shun-shobon/iter-funcs@1.7.0/esm/mod.js";
This is a basic example.
import {
filter,
forEach,
fromIterable,
map,
pipe,
take,
} from "https://deno.land/x/iter_funcs@1.7.0/mod.ts";
const array = [1, 2, 3, 4, 5, 6];
pipe(
array,
fromIterable, // make iterator from iterable
filter((x) => x % 2 === 0), // filter even numbers
map((x) => x * 2), // multiply by 2
take(2), // take first 2 elements
forEach(console.log), // => 4, 8
);
You can also AsyncIterator
.
import { expandGlob } from "https://deno.land/std/fs/mod.ts";
import {
asyncFilter,
asyncForEach,
asyncMap,
asyncTake,
asyncToArray,
pipe,
} from "https://deno.land/x/iter_funcs@1.7.0/mod.ts";
const files: Array<string> = await pipe(
expandGlob("src/*.ts"), // Find all .ts files in src directory
asyncMap((entry) => entry.path), // Get path from entry
asyncFilter((path) => !path.endsWith("_test.ts")), // Exclude test files
asyncTake(2), // Take first 2 elements
asyncMap((path) => Deno.readTextFile(path)), // Read file content
asyncToArray, // Convert to array
);
Array.prototype
methodsThis library's functions are lazy. They don't evaluate the whole iterator at once. They evaluate only the needed elements. This is useful when you have a large iterator and you only need a few elements from it.
Method chaining is a common pattern in JavaScript. However, it tends to increase bundle size. It also makes it difficult to use with other libraries that use iterators.
FAQs
Utility functions for iterators. Inspired by Rust's `std::iter::Iterator` trait.
The npm package @shun-shobon/iter-funcs receives a total of 3 weekly downloads. As such, @shun-shobon/iter-funcs popularity was classified as not popular.
We found that @shun-shobon/iter-funcs 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.