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 🙏

© 2025 – Pkg Stats / Ryan Hefner

fast-json-query

v2.0.0

Published

A lightweight and efficient JSON querying utility for filtering and searching data

Readme

Fast JSON Query

npm version Build Status Coverage Status Bundle Size Downloads License

A blazing-fast, MongoDB-like query engine for filtering JSON data in React applications with TypeScript support and built-in debouncing.

Why Fast JSON Query?

  • 🚀 Ultra-lightweight: Only 438B minified + gzipped (core), 695B (with hooks)
  • High Performance: Optimized for large datasets with minimal overhead
  • 🔒 Type-safe: Full TypeScript support with comprehensive type definitions
  • ⚛️ React Integration: Seamless hooks for React applications
  • 🔄 Smart Debouncing: Built-in performance optimization for real-time filtering
  • 📦 Zero Dependencies: No external dependencies, pure JavaScript
  • 🧪 Production Ready: 100% test coverage, battle-tested
  • 🌳 Tree-shakeable: Import only what you need
  • 📝 Well Documented: Comprehensive documentation and examples

Installation

# Using npm
npm install fast-json-query

# Using yarn
yarn add fast-json-query

# Using pnpm
pnpm add fast-json-query

Quick Start

import { useJsonQuery } from 'fast-json-query';

function SearchableUserList() {
  const users = [
    { id: 1, name: 'John Doe', age: 30, skills: ['React', 'TypeScript'] },
    { id: 2, name: 'Jane Smith', age: 25, skills: ['Vue', 'JavaScript'] },
  ];

  // Filter users over 25 with React skills
  const results = useJsonQuery(users, {
    $and: [
      { age: { $gt: 25 } },
      { skills: { $contains: 'React' } }
    ]
  });

  return (
      <ul>
        {results.map(user => (
        <li key={user.id}>{user.name} - {user.age}</li>
        ))}
      </ul>
  );
}

Features

MongoDB-like Query Syntax

// Simple equality
const activeUsers = useJsonQuery(users, { status: 'active' });

// Complex conditions
const seniorDevs = useJsonQuery(users, {
  $or: [
    { experience: { $gt: 5 } },
    { level: { $in: ['senior', 'lead'] } }
  ],
  skills: { $contains: 'JavaScript' }
});

Real-time Search with Debouncing

const { results, isDebouncing } = useDebounceQuery(
  users,
  { name: { $regex: searchTerm } },
  { delay: 300 }
);

API Reference

Query Operators

Comparison

  • $eq: Exact match
  • $gt, $gte: Greater than (or equal)
  • $lt, $lte: Less than (or equal)
  • $ne: Not equal
  • $in: Value in array
  • $nin: Value not in array
  • $regex: Regular expression match
  • $exists: Property existence check

Logical

  • $and: All conditions true
  • $or: Any condition true
  • $not: Negate condition

Array

  • $size: Array length check
  • $contains: Array includes value

Hooks

useJsonQuery

function useJsonQuery<T>(
  data: T[],
  query: Query,
  options?: QueryOptions
): T[];

interface QueryOptions {
  caseSensitive?: boolean;
}

useDebounceQuery

function useDebounceQuery<T>(
  data: T[],
  query: Query,
  options?: DebounceOptions
): DebounceResult<T>;

interface DebounceOptions extends QueryOptions {
  delay?: number;
}

interface DebounceResult<T> {
  results: T[];
  isDebouncing: boolean;
}

Performance

  • Bundle Size: Core: 438B, Hooks: 695B (minified + gzipped)
  • Memory Usage: O(1) space complexity for queries
  • Time Complexity: O(n) for simple queries, optimized for large datasets

Browser Support

  • Chrome, Firefox, Safari, Edge (latest 2 versions)
  • IE 11 with appropriate polyfills

Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'feat: add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

License

MIT © Md Azadur Rahman

Keywords

json-query, mongodb-query, react-hooks, typescript, json-filter, data-query, react-query, json-search, typescript-query, debounce-query, lightweight-query, fast-query, react-json-query, json-query-engine, mongodb-like-query