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

search-gold

v1.0.2

Published

speedy search engine targeting an array of objects

Downloads

8

Readme

search-gold

Overview

Your web page displays a list of columnar information, based on the common data structure:

array of objects

For an improved UX, you want to add a search field so the user can filter the displayed records.

The search-gold package is easy to set up and use!

Installation

$ npm i search-gold

OR

$ bun i search-gold

Usage

The following should provide enough to get local search up and running and keep your users in a happy place!

Provide the following in your component, e.g., my-data-list-component.ts.

1. Import the two types and methods.

import {
  ConfigParams,
  ItemRecord,
  searchHandler,
  searchSetConfig,
} from 'search-gold'

2. Create a method to set search configuration.

This wrapper method only needs to be called in the following two cases:

  • when component is initialized and when data is ready
  • when data changes (record has been created, edited, deleted)

You can name this wrapper method anything you want.

const initSearchConfig = () => {
  const config: ConfigParams = {
    // required: items must reference an array of
    // objects.
    //
    // 'search-gold' package only reads this data.
    // Search results are returned in a separate array.
    items: MyData,

    // required: keys are the object properties you
    // want to expose to search queries. List only
    // the fields which make sense to you.
    keys: ['productName', 'model', 'status'],

    // optional: default is false
    caseSensitive: true,

    // optional: default is true
    //
    // You should only ever consider disabling
    // memoization if you observe browser memory
    // limitations with cached search results.
    enableMemoize: false,
  }

  // Call the imported method with config arg.
  searchSetConfig(config)

  // After setting the config, you can call searchHandler()
  // as many times as necessary without having to set the
  // config again.
  //
  // Your template would be iterating over myFilteredData
  // in this example.
  //
  // How you set up your component to display the filtered
  // data is up to you and how your component is structured.
  //
  // Passing an empty string effectively returns the
  // the unfiltered set of records, the same as MyData.
  myFilteredData = <ItemRecord[]>searchHandler('')
}

3. Initialize the search engine.

This method (from Step 2.) should be called when your component has been initialized and your data is ready.

Also, this initSearchConfig() method should be called whenever your data changes after a record has been created, edited, or deleted.

// For this example we chose this method name; you
// can name this wrapper method anything you want.
initSearchConfig()

4. Execute search queries and get results.

Presumably, a method is binded to the UI's search field (in this example it's called searchMyData) and is called on every keystroke, debounced keystrokes, or an explicit and separate submit event. Ultimately, the UX behavior is left up to the front end engineer / design team.

const searchMyData = (query: string) => {
  // Call the imported method and get results.
  myFilteredData = searchHandler(query)
}

Author's Development

During development of the search-gold package, I integrated it into several apps I had previously created with Vue using its Composition API.

In this documentation I tried to keep the Usage code snippets framework neutral.

search-gold itself is framework neutral and should work in any TS codebase.

Credits

G. Gold

October 2025

Have fun!