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

arr-helpers

v1.0.0

Published

Zero-dependency array helpers for frontend and backend — parse, group, chunk, sort, dedupe, and more

Readme

arr-helpers

Zero-dependency array helpers for frontend and backend — parse, group, chunk, sort, dedupe, and more.

Works in the browser (React, Vue, Next.js, Vite) and in Node (Express, Nest, APIs). Pure TypeScript, no Node-only APIs.

npm install arr-helpers

Quick start

import ArrayList, { chunk, uniqueBy, get, groupByField, paginate } from "arr-helpers";

// Parse query / form / URL values into arrays
get("1,2,3");           // ["1", "2", "3"]
get("[1,2,3]");         // [1, 2, 3]
ArrayList.getIntArray("1,2,3"); // [1, 2, 3]

// Chunk for UI lists or batch jobs
chunk([1, 2, 3, 4, 5], 2); // [[1,2],[3,4],[5]]

// Dedupe objects by key
uniqueBy(
  [{ id: 1, name: "a" }, { id: 1, name: "b" }],
  "id"
); // [{ id: 1, name: "a" }]

// Group rows (tables, charts, API payloads)
groupByField(
  [{ type: "a", v: 1 }, { type: "a", v: 2 }, { type: "b", v: 3 }],
  "type"
);

// Paginate for tables or API responses
paginate(items, 1, 20);

ESM and CommonJS:

import { chunk, isEmpty } from "arr-helpers";
// or
const { chunk, isEmpty } = require("arr-helpers");

Where it fits

| Frontend | Backend | |---|---| | Filter / sort / paginate UI lists | Normalize query params & body fields | | Group chart or table data | Chunk IDs for batch DB/API calls | | Dedupe options / tags | Aggregate and sum row fields | | Move items in drag-and-drop lists | Parse comma-separated IDs |

API

Core

| Function | Description | |---|---| | isEmpty / isNotEmpty | Empty-array checks | | isArray | Non-empty array check | | getLength | Safe length (0 for invalid) | | removeDuplicate / unique | Dedupe primitives | | uniqueBy | Dedupe by key or selector | | sort(data, key, "ASC"\|"DESC") | Sort objects by field | | stringIntoArray | "1,2,3"[1,2,3] | | groupBy / groupByName | Sum quantities by date/name | | groupByField | Generic Record<key, T[]> | | groupByKey | Group by one or two keys | | splitArray / chunk | Split into sized batches | | mapByKey | Index objects by key | | mapByFilter | Filter by field, then pluck | | toArray | Wrap single value as array | | get | Normalize string/JSON/array input | | getIntArray | get + parse integers | | sumByKeys | Sum numeric fields across rows |

Extra helpers

| Function | Description | |---|---| | compact | Drop null / undefined / "" | | first / last | Safe ends with defaults | | pluck | Map a single field | | partition | Split by predicate | | difference / intersection / union | Set ops | | countBy | Count by key/selector | | maxBy / minBy / averageBy | Aggregates by field | | paginate(list, page, pageSize) | 1-based paging | | flatten | Flatten nested arrays | | moveItem | Reorder immutably | | shuffle | Fisher–Yates shuffle copy | | filterBy / findBy | Match by field value |

Why this package?

The same array patterns show up in UI lists and API services. arr-helpers packages them with zero dependencies, TypeScript types, tree-shakeable ESM, and CJS for older Node setups.

License

MIT