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

@itrocks/list

v0.3.0

Published

Generic action-based object list navigation in HTML and JSON

Downloads

668

Readme

npm version npm downloads GitHub issues discord

list

Generic action-based object list navigation in HTML and JSON.

This documentation was written by an artificial intelligence and may contain errors or approximations. It has not yet been fully reviewed by a human. If anything seems unclear or incomplete, please feel free to contact the author of this package.

Installation

npm i @itrocks/list

Usage

@itrocks/list exposes a single List action that you can plug into your existing @itrocks/action workflow.

The List action is meant to be attached to a domain class (for example an User entity) and is responsible for rendering either an HTML list page or a JSON payload depending on the requested format.

import { List } from '@itrocks/list'
import { Request } from '@itrocks/action-request'

// The domain object you want to list
class User {
	/* ... */
}

// Create an action instance for this domain
const listUsers = new List<User>()

// In your controller / route handler
async function usersHtml (request: Request<User>) {
	return listUsers.html(request)
}

async function usersJson (request: Request<User>) {
	return listUsers.json(request)
}

The request object is typically created by @itrocks/action-request from an incoming HTTP request.

API

class List<T extends object = object> extends Action<T>

Main entry point of the module. It extends @itrocks/action's Action class and adds list‑oriented behaviors.

Type parameter

  • T – The domain object type you want to list (for example User).

Properties

  • lineHeight: number – Estimated height of a row in pixels. This is mainly used by the front‑end to compute scrollable area and virtualisation.

Methods

html(request: Request<T>): Promise<HtmlResponse>

Builds an HTML response for the list view.

The returned HtmlResponse contains the rendered table along with paging, filters and actions configured through your Action stack.

Typical usage is to call this method from a route that should return HTML:

fastify.get('/users', async (req, reply) => {
	const request = toActionRequest<User>(req) // project helper
	const response = await listUsers.html(request)
	reply
		.status(response.status)
		.headers(response.headers)
		.type('text/html')
		.send(response.body)
})
json(request: Request<T>): Promise<JsonResponse>

Builds a JSON representation of the same list data.

The returned JsonResponse typically contains the current page of results, meta‑data (page, page size, total count) and any additional information configured via your Action/List setup.

This is useful for API‑only endpoints, asynchronous front‑end components or infinite‑scroll lists.

fastify.get('/api/users', async (req, reply) => {
	const request = toActionRequest<User>(req)
	const response = await listUsers.json(request)
	reply
		.status(response.status)
		.headers(response.headers)
		.send(response.body)
})

Typical use cases

  • Back‑office list screens for any business entity (users, products, orders…).
  • Filterable / searchable tables built on top of @itrocks/table.
  • JSON list endpoints consumed by SPA or mobile applications.