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

@arckit/resultset

v2.1.0

Published

Pagination, filtering, and result set utilities with native branded types

Readme

@arckit/resultset

Pagination, filtering, and result set utilities with native branded types.

npm version npm downloads bundle size codecov TypeScript

📑 Table of Contents

Type-safe pagination, filtering, and sorting utilities using native TypeScript branded types for Page and PageSize. Ensures values are always valid positive integers at the type level.

pnpm add @arckit/resultset

Pagination

import { Page, PageSize, paginate } from '@arckit/resultset';

const items = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'];

const result = paginate(items, { page: Page(2), pageSize: PageSize(5) });
// { items: ['f', 'g', 'h', 'i', 'j'], totalItems: 11, currentPage: 2, pageSize: 5 }

Filtering

import { filtered, Search } from '@arckit/resultset';

const result = filtered(paginatedResult, { search: Search('hello') });
// Adds search metadata to the result

Sorting

import { Sort, sorted } from '@arckit/resultset';

const result = sorted(paginatedResult, { sort: Sort('name', 'desc') });
// Adds sort metadata to the result: { ..., sort: { field: 'name', direction: 'desc' } }

Sort carries the chosen field and direction; the actual ordering stays the caller's responsibility (e.g. the database query). Sort is generic over the field name, so it can be constrained to a known set of sortable columns:

type ClientField = 'name' | 'createdAt';
const sort = Sort<ClientField>('createdAt', 'desc');

Page(value: number) => Page

Branded positive integer. Clamps to 1 minimum, rounds to nearest integer.

PageSize(value: number) => PageSize

Branded positive integer. Clamps to 1 minimum, rounds to nearest integer.

paginate<T>(items: T[], params?) => Paginated<T>

| Parameter | Description | |-------------------|------------------------------| | items | The full array to paginate | | params.page | Page number (default: 1) | | params.pageSize | Items per page (default: 10) |

Search(value: string) => Search

Branded search string. Wraps a raw string into the Search brand for use with filtered.

filtered<T>(result: T, params?) => Filtered<T>

| Parameter | Description | |-----------------|------------------------------------------| | result | The result object to augment | | params.search | Optional Search to attach |

SortDirection(value: string) => SortDirection

Normalizes a raw value to 'asc' | 'desc'. Defaults to 'asc' for anything other than 'desc'.

Sort<Field>(field: Field, direction?: SortDirection) => Sort<Field>

Builds a sort instruction. direction defaults to 'asc'. Generic over the field name to constrain sortable columns.

sorted<T, Field>(result: T, params?) => Sorted<T, Field>

| Parameter | Description | |---------------|------------------------------| | result | The result object to augment | | params.sort | Optional Sort to attach |

See CONTRIBUTING.md for details.

MIT © Marc Gavanier