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

smart-searcher

v1.0.3

Published

⚡ Tiny, fast, zero-dependency search toolkit (exact + fuzzy + indexed)

Downloads

353

Readme

smart-searcher

⚡ Tiny, fast, zero-dependency search toolkit for JavaScript/TypeScript. Supports exact lookup, fuzzy search, weighted multi-key search, indexing, filtering, and plugins.


Features

  • 🔹 Exact search (findExact)
  • 🔹 Indexed lookup (createIndex)
  • 🔹 Fuzzy search (createSearch with fuzzy: true)
  • 🔹 Weighted multi-key fuzzy search
  • 🔹 Filtering by criteria
  • 🔹 Plugin system for query/response transforms
  • ✅ Tiny bundle, tree-shakable, zero dependencies
  • ✅ TypeScript ready

Installation

npm install smart-searcher
# or
yarn add smart-searcher

Usage Examples

1️⃣ Exact search

import { findExact } from 'smart-searcher';

const data = [
  { id: 1, title: 'Apartment Gyumri' },
  { id: 2, title: 'House Yerevan' },
];

const index = findExact(data, 2, 'id');
console.log(index); // 1 (array index)

2️⃣ Indexed lookup (O(1))

import { createIndex } from 'smart-searcher';

const data = [
  { id: 1, title: 'Apartment Gyumri' },
  { id: 2, title: 'House Yerevan' },
];

const indexMap = createIndex(data, 'id');
console.log(indexMap.get(2)); // 1

3️⃣ Filter by criteria

import { filter } from 'smart-searcher';

const data = [
  { id: 1, title: 'Apartment Gyumri', price: 30000 },
  { id: 2, title: 'House Yerevan', price: 80000 },
];

const results = filter(data, { price: { min: 20000, max: 50000 } });
console.log(results);
// [{ id: 1, title: 'Apartment Gyumri', price: 30000 }]

4️⃣ Fuzzy search

import { createSearch } from 'smart-searcher';

const data = [
  { id: 1, title: 'Apartment Gyumri' },
  { id: 2, title: 'House Yerevan' },
];

const search = createSearch(data, { key: 'title', fuzzy: true });

console.log(search.search('gyumr'));
// [{ id: 1, title: 'Apartment Gyumri' }]

5️⃣ Weighted multi-key search

const search = createSearch(data, {
  keys: [
    { key: 'title', weight: 0.7 },
    { key: 'location', weight: 0.3 },
  ],
  fuzzy: true
});

console.log(search.search('gyumr'));
// prioritizes matches in `title` over `location`

6️⃣ Plugins

const searchWithPlugin = createSearch(data, {
  key: 'title',
  fuzzy: true,
  plugins: [
    () => ({
      beforeSearch: (query) => query.trim().toLowerCase(),
      afterSearch: (results) => results.slice(0, 5) // top 5 only
    })
  ]
});

console.log(searchWithPlugin.search(' gyumr '));

7️⃣ Combined API

const search = createSearch(data, { keys: ['title', 'location'], fuzzy: true });

console.log(search.find(1)); // exact find by id
console.log(search.search('gyumr')); // fuzzy
console.log(search.filter({ price: { max: 50000 } })); // filtered results

📦 Why use smart-searcher?

  • Lightweight ✅
  • TypeScript support ✅
  • Zero dependencies ✅
  • Very fast (precomputed tokens, optional index) ✅
  • Multi-key weighted fuzzy search ✅
  • Plugins for custom transformations ✅

License

MIT License