npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ida

v0.3.0

Published

Iterable data structures

Readme

ida npm

Iterable data structures.

Install

$ yarn add ida

API

Map

Wrapper on top of native ES6 Map.

from

Converts iterable into Map.

static from<K, V>(source: Iterable<readonly [K, V]>): TMap<K, V>
import { Map } from 'ida'

const map = Map.from([
  ['a', 1],
  ['b', 2]
])

console.log(map.get('a'))
// 1

fromAsync

Converts async iterable into Map.

static fromAsync<K, V>(source: AsyncIterable<readonly [K, V]>): Promise<TMap<K, V>>
import { Map } from 'ida'

const asyncIterable = {
  *[symbol.asyncIterable]() {
    yield Promise.resolve(['a', 1])
    yield Promise.resolve(['b', 2])
  }
}
const map = await Map.fromAsync(asyncIterable)

console.log(map.get('a'))
// 1

size

Returns Map size.

get size(): number
import { Map } from 'ida'

const map = new Map([
  ['a', 1],
  ['b', 2]
])

console.log(map.size)
// 2

clear

Clears Map entries.

clear(): this
import { Map } from 'ida'

const map = new Map([
  ['a', 1],
  ['b', 2]
])

map.clear()

console.log(map.size)
// 0

delete

Deletes Map entry by key.

delete(key: K): this
import { Map } from 'ida'

const map = new Map([
  ['a', 1],
  ['b', 2]
])

map.delete('a')

console.log(map.get('a'))
// undefined

has

Checks if Map has a key.

has(key: K): boolean
import { Map } from 'ida'

const map = new Map([
  ['a', 1],
  ['b', 2]
])

console.log(map.has('a'))
// true

get

Returns Map value by key.

get(key: K): V | undefined
get(key: K, fallbackValue: V): V
import { Map } from 'ida'

const map = new Map([
  ['a', 1],
  ['b', 2]
])

console.log(map.get('c'))
// undefined

console.log(map.get('c', 3))
// 3

set

Sets value for key.

set(key: K, value: V): this
import { Map } from 'ida'

const map = new Map()

map.set('a', 1)

console.log(map.has('a'))
// true

update

Updates value in Map by key.

update(key: K, updateFn: (value?: V) => V): this
update(key: K, updateFn: (value: V) => V, fallbackValue: V): this
import { Map } from 'ida'

const map = new Map([
  ['a', 1],
  ['b', 2]
])

map.update('a', (value) => value + 10)

console.log(map.get('a'))
// 11

map.update('c', (value) => value + 10, 3)

console.log(map.get('c'))
// 13

keys

Returns Map keys wrapped into Ida Set.

keys(): TSet<K>
import { Map } from 'ida'

const map = new Map([
  ['a', 1],
  ['b', 2]
])

console.log(map.keys().toArray())
// ['a', 'b']

values

Returns Map values wrapped into Ida Set.

values(): TSet<V>
import { Map } from 'ida'

const map = new Map([
  ['a', 1],
  ['b', 2]
])

console.log(map.values().toArray())
// [1, 2]

pipe

Pipes Map entries into new Map.

pipe(): TMap<K, V>
pipe<K0, V0, K1, V1>(fn0: (arg: Iterable<readonly [K0, V0]>) => Iterable<readonly [K1, V1]>): TMap<K1, V1>
// up to 8 functions
import { Map } from 'ida'
import { filter, map } from 'iterama'

const origMap = new Map([
  ['a', 1],
  ['b', 2],
  ['c', 3]
])

const filterFn = (([key]: readonly [string, number]) => key !== 'c')
const mapFn = (([key, value]: readonly [string, number]) => [key, value + 10] as const)

const newMap = origMap.pipe(
  filter(filterFn),
  map(mapFn)
)

console.log(newMap.get('a'))
// 11

console.log(newMap.get('b'))
// 12

console.log(newMap.get('c'))
// undefined

toObject

Converts Map info Object (explicitly stringifying keys).

toObject(): { [key: string]: V }
import { Map } from 'ida'

const map = new Map([
  ['a', 1],
  ['b', 2]
])

console.log(map.toObject())
// { a: 1, b: 2 }

toNativeMap

Converts Ida Map into native ES6 Map.

toNativeMap(): Map<K, V>
import { Map } from 'ida'

const map = new Map([
  ['a', 1],
  ['b', 2]
])

console.log(map.toNativeMap())
// Map { a → 1, b → 2 }

Set

Wrapper on top of native ES6 Set collection.

from

Converts iterable into Set.

static from<T>(source: Iterable<T>): TSet<T>
import { Set } from 'ida'

const set = Set.from(['a', 'b'])

console.log(set.has('a'))
// true

fromAsync

Converts async iterable into Set.

static fromAsync<T>(source: AsyncIterable<T>): Promise<TSet<T>>
import { Set } from 'ida'

const asyncIterable = {
  *[symbol.asyncIterable]() {
    yield Promise.resolve('a')
    yield Promise.resolve('b')
  }
}
const set = await Set.fromAsync(asyncIterable)

console.log(set.has('a'))
// true

size

Returns Set size.

get size(): number
import { Set } from 'ida'

const set = new Set(['a', 'b'])

console.log(set.size)
// 2

clear

Clears Set values.

clear(): this
import { Set } from 'ida'

const set = new Set(['a', 'b'])

set.clear()

console.log(set.size)
// 0

delete

Deletes Set value.

delete(value: T): this
import { Set } from 'ida'

const set = new Set(['a', 'b'])

set.delete('a')

console.log(set.has('a'))
// false

has

Checks if Set has a value.

has(value: T): boolean
import { Set } from 'ida'

const set = new Set(['a', 'b'])

console.log(set.has('a'))
// true

add

Adds a value to Set.

add(value: T): this
import { Set } from 'ida'

const set = new Set()

set.add('a')

console.log(set.had('a'))
// true

pipe

Pipes Set values into new Set.

pipe(): TSet<T>;
pipe<T0, T1>(fn0: (arg: Iterable<T0>) => Iterable<T1>): TSet<T1>
// up to 8 functions
import { Set } from 'ida'
import { filter, map } from 'iterama'

const origSet = new Set(['a', 'b', 'c'])

const filterFn = ((value: string) => value !== 'c')
const mapFn = ((value: string) => `${value}${value}`)

const newSet = origSet.pipe(
  filter(filterFn),
  map(mapFn)
)

console.log(newSet.toArray())
// [ "a", "b" ]

toArray

Converts Set info Array.

toArray(): T[]
import { Set } from 'ida'

const set = new Set(['a', 'b', 'c'])

console.log(set.toArray())
// ["a", "b", "c"]

toNativeSet

Converts Ida Set into native ES6 Map.

toNativeSet(): Set<T>
import { Set } from 'ida'

const set = new Set(['a', 'b', 'c'])

console.log(set)
// Set [ "a", "b", "c" ]