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

queryable-array

v1.0.2

Published

[![Test Coverage](https://github.com/kipprice/queryable-array/actions/workflows/coverage.yml/badge.svg)](https://github.com/kipprice/queryable-array/actions/workflows/coverage.yml) [![Build](https://github.com/kipprice/queryable-array/actions/workflows/bu

Downloads

263

Readme

Queryable Arrays

Test Coverage Build Benchmark

A lightweight (14kb) TS-first querying language designed to make it easy to work with arrays that need significant filtering, joining, sorting, or mapping. This library has no external dependencies, and performance of the queryable array is within an order of magnitude of standard arrays, ensuring that if you could perform a query via standard array functions, you can probably use a queryable array to do the same, albeit a little more human readable.

Why use this instead of standard array functions, lodash, etc.?

This library has a narrow scope that really optimizes for readability (without sacrificing too much in performance). It is designed for teams that are doing a significant amount of filtering and/or joining in JS / TS code (client-side or server-side) and want the queries they are writing to be somewhat self documenting. For example, consider:

const authors = [
  { id: 'a1', name: 'Kip', contributorSince: '2008-01-01' }, 
  // ...
]
const songs = [
  { 
    id: 's1', 
    name: 'My Song', 
    tags: [{ id: 't1', label: 'rad'}], 
    authorIds: ['a1'],
    lengthInSeconds: 800
  },
  // ...
]

// standard array version
const radLongSongsWithAuthors = songs
  .filter((s) => s.length > 500)
  .filter((s) => s.tags.some((t) => t.name === 'rad'))
  .map((s) => ({ ...s, authors: s.authorIds.map((aId) => 
    authors.find((a) => a.id === s.authorId)
  )}))

// queryable array version
const queryableSongs = queryable(songs)
  .where('length').greaterThan(500)
  .and.where('tags').some('tag').its('label').is('rad')
  .joinWith(authors).whereMy('authorIds').referencesTheir('id').storedTo('authors')

How does it work?

Under the hood, a queryable array extends a standard array, so you can still perform standard array functions on it. Any standard array method that would normally return an array (either as a new instance or by modifying the current array) returns a pre-wrapped queryable array so you can continue chaining off of it. A queryable array respects the same behavior as the underlying array methods, swapping in place when the array method would do so.

const songs = [
  { 
    id: 's1', 
    name: 'My Song', 
    tags: [{ id: 't1', label: 'rad'}], 
    authorId: 'a1',
    lengthInSeconds: 800
  },
  // ...
]

const tags = songs
  .flatMap((s) => s.tags)
  .uniqueBy('id')
  .where('label').is('rad')

Types

Everything in the queryable array library is written in Typescript and infers the shape of objects automatically to present appropriate methods and properties depending on where in the chain a given queryable array is. Performing where queries are non-modifying, meaning the underlying array wrapped by the queryable array remains as it was even as the queryable array version gets successively more narrowed.

Bug Reports

Please report any found bugs on the library's GH Issues page.

Contributing

If you're interested in helping improve this library, feel free to open a PR against the repo.