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

@superhero/array

v4.8.2

Published

An extension of the js Array class with additional functionalities.

Readme

Array

An extended Array class with additional utility methods for formatting, comparison, and normalization.

Installation

npm install @superhero/array

Usage

Conjunction and Disjunction Formatting

Locale-aware string formatting using Intl.ListFormat:

import SuperArray from '@superhero/array'

const list = new SuperArray('apple', 'orange', 'banana')

list.conjunction() // 'apple, orange and banana'
list.disjunction() // 'apple, orange or banana'

Configure the list formatters:

list.locale = 'es'
list.style  = 'short'

list.conjunction() // 'apple, orange y banana'

Array Utilities

Convenient methods for working with arrays:

const list = new SuperArray('a', 'b', 'c')

list.last()   // 'c'
list.last(1)  // 'b'

list.intersection(['b', 'c', 'd'], ['c', 'b']) // ['b', 'c']
list.xor(['b', 'x'], ['c', 'y'])               // ['a', 'x', 'y']
list.unique(['a', 'b', 'd'])                   // ['a', 'b', 'c', 'd']

Normalization

Ensure a value is treated as an extended array instance:

SuperArray.normalize('x')        // ['x']
SuperArray.normalize(['x', 'y']) // ['x', 'y']

API

Instance Methods

  • .conjunction(config) : Format as conjunction list
  • .disjunction(config) : Format as disjunction list
  • .intersection(...arrays) : Shared values across all arrays
  • .xor(...arrays) : Values exclusive to one array
  • .unique(...arrays) : Distinct values across arrays
  • .last(offset) : Get the last or offset-last value

Static Methods

  • Array.normalize(input) : Normalize a value into a proper array instance

Configurations

Set formatting behavior:

list.locale = 'en-GB'
list.style  = 'short'

Test Suite

Run tests using:

npm test

Test Coverage

────────────────────────────────── ⋅⋆ Suite ⋆⋅ ─────────────────────────────────


@superhero/array
├─ should format a list using conjunction
│  └─ ✔ passed 19.196708ms
├─ should format a list using disjunction
│  └─ ✔ passed 0.452016ms
├─ should set configuration for "locale" affecting the formatters
│  └─ ✔ passed 0.318799ms
├─ should return correct last item with and without offset
│  └─ ✔ passed 0.391488ms
├─ should compute intersection correctly
│  └─ ✔ passed 1.322853ms
├─ should throw error if non-array passed to intersection
│  └─ ✔ passed 0.756649ms
├─ should compute xor correctly
│  └─ ✔ passed 0.51159ms
├─ should throw error if non-array passed to xor
│  └─ ✔ passed 1.472181ms
├─ should return unique values
│  └─ ✔ passed 0.565676ms
├─ should throw error if non-array passed to unique
│  └─ ✔ passed 0.506743ms
├─ normalize should wrap single values into array
│  └─ ✔ passed 0.308307ms
├─ normalize should return instance unchanged
│  └─ ✔ passed 0.24679ms
├─ normalize should wrap plain array into instance
│  └─ ✔ passed 0.189833ms
└─ ✔ suite passed 28.219359ms


──────────────────────────────── ⋅⋆ Coverage ⋆⋅ ────────────────────────────────


Files                                            Coverage   Branches   Functions
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
index.js                                              95%       100%         85%
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
index.test.js                                        100%       100%        100%
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Total                                                 97%       100%         91%


───────────────────────────────── ⋅⋆ Summary ⋆⋅ ────────────────────────────────


Suites                                                                         1
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Tests                                                                         13
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Passed                                                                        13
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Failed                                                                         0
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Cancelled                                                                      0
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Skipped                                                                        0
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Todo                                                                           0

License

This project is licensed under the MIT License.

Contributing

Feel free to submit issues or pull requests for improvements or additional features.