Utility functions for iterators. Inspired by Rust's `std::iter::Iterator` trait.

Overview

iter-funcs

test codecov release

About

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.

Difference from Array.prototype methods

This 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.

Example

import {
  filter,
  forEach,
  map,
  pipe,
  take,
} from "https://deno.land/x/[email protected]/mod.ts";

const array = [1, 2, 3, 4, 5, 6];

pipe(
  array.values(), // make iterator from array
  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
);
Comments
Releases(1.7.0)
Owner
Shuntaro Nishizawa
I'm in National Institute of Technology, Nagano College 4th grade. I like TypeScript, Haskell and Rust.
Shuntaro Nishizawa
WIP : Un pictionary mais avec 15 trait droits (sans courbes)

TODO Signer l'ID Ban dès le lobby Limiter la taille des pseudos Joueur déconnecté avec une couleur Afficher un message en cas de kick Limiter les devi

Jonathan 11 Apr 25, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A utility for creating toggleable items with JavaScript. Inspired by bootstrap's toggle utility. Implemented in vanillaJS in a functional style.

LUX TOGGLE Demo: https://jesschampion.github.io/lux-toggle/ A utility for creating toggleable dom elements with JavaScript. Inspired by bootstrap's to

Jess Champion 2 Oct 3, 2020
An iterator wrapper that supports Rust-style chaining

Riter (in development) An iterator wrapper that supports Rust-style chaining Install TODO: This package is not yet available. Once it's mature enough,

잇창명 3 Mar 3, 2022
Functions Recipes is a library of examples to help you getting started with Salesforce Functions and get used to their main features.

Functions Recipes Introduction Salesforce Functions lets you use the Salesforce Platform for building event-driven, elastically scalable apps and expe

Trailhead Apps 172 Dec 29, 2022
Easily create key board shortcuts for your JS functions. Built using JS only with no other dependency. Inspired from MacOS spotlight

floodlightjs Inspired from macOS spotlight, floodlight is simple JS library that will show a search area. How the search is handled is completely on y

Raj Nandan Sharma 6 Aug 12, 2022
Most dreaded utility functions

Frustration Most dreaded utility functions Installation Using npm: npm install --save frustration Using Frustration In Node.js const Frustration = req

Atul Kumar 20 Jul 7, 2022
Collection of utility functions for common JavaScript/TypeScript task

@oysterlee/utils Collection of utility functions for common JavaScript/TypeScript task Features Tree-shakable No dependencies Installation pnpm i @oys

Oyster Lee 3 Apr 4, 2022
A small javascript DOM manipulation library based on Jquery's syntax. Acts as a small utility library with the most common functions.

Quantdom JS Quantdom is a very small (about 600 bytes when ran through terser & gzipped) dom danipulation library that uuses a Jquery like syntax and

Sean McQuaid 7 Aug 16, 2022
Well-tested utility functions dealing with async iterables

aitertools This library provides a well-tested collection of small utility functions dealing with async iterables. You can think of it as LINQ or aite

Hong Minhee (洪 民憙) 11 Aug 15, 2022
Generate meshes from signed distance functions and constructive solid geometry operations.

sdf-csg Generate meshes from signed distance functions and constructive solid geometry operations. This library is heavily based upon Inigo Quilez's 3

Rye Terrell 151 Oct 24, 2022
A JavaScript Library for things I use often, as well as some helper functions

Elements A JavaScript Library for things I use often, as well as some helper functions. Full documentation below. Inspired by Habitat, another library

Magnogen 3 Apr 21, 2022
Temporal-time-utils - This is a library with some reusable functions for Temporal.io TypeScript SDK

temporal-time-utils This is a library with some reusable functions for Temporal.io TypeScript SDK: sleepUntil: sleep to a specific date, instead of by

swyx 15 Oct 18, 2022
Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

null 7 Jan 14, 2022
Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.

Atomico simplifies learning, workflow and maintenance when creating webcomponents. Scalable and reusable interfaces: with Atomico the code is simpler

Atomico 898 Dec 31, 2022
Babel plugin and helper functions for interoperation between Node.js native ESM and Babel ESM

babel-plugin-node-cjs-interop and node-cjs-interop: fix the default import interoperability issue in Node.js The problem to solve Consider the followi

Masaki Hara 15 Nov 6, 2022
Netlify functions session cookie 🍪

netlify-functions-session-cookie ?? Cryptographically-signed session cookies for Netlify functions. Summary Install Concept and Usage API Environment

Matteo Cargnelutti 7 Jun 8, 2022