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

@tcn/aip-160-editor

v0.0.3

Published

AIP-160 editor

Readme

@tcn/aip-160

A specialized package that provides AIP-160 standard implementation for filtering and querying data with a powerful grammar-based parsing system.

Overview

@tcn/aip-160 implements the AIP-160 standard for data filtering and querying. This package provides a robust filtering system that allows you to create complex queries using a standardized grammar, making it easy to filter and search through data collections with powerful, human-readable syntax.

What's Included

Core Components

  • AipFilter: Main filtering class for applying AIP-160 queries to data
  • Grammar System: Complete AIP-160 grammar implementation
  • Pattern Parser: Advanced pattern parsing using clarity-pattern-parser
  • Filter String Parser: Utility for parsing filter strings into executable queries

Filtering Features

  • String Queries: Text-based filtering with support for quoted strings
  • Numeric Filtering: Number-based comparisons and ranges
  • Date Filtering: Date and time-based filtering capabilities
  • Global Filtering: Search across all properties of data objects
  • Case Sensitivity: Configurable case-sensitive and case-insensitive matching

Key Features

  • AIP-160 Compliance: Full implementation of the AIP-160 standard
  • Powerful Grammar: Advanced grammar-based parsing system
  • Flexible Queries: Support for complex filtering expressions
  • TypeScript Support: Full type safety with excellent IntelliSense
  • Performance Optimized: Efficient filtering with minimal overhead
  • Error Handling: Robust error handling for invalid queries
  • Extensible: Easy to extend with custom filtering logic

Usage

Basic Filtering

import { AipFilter } from '@tcn/aip-160';

async function filterUsers() {
  const filter = new AipFilter();
  const users = [
    { name: 'John Doe', age: 30, email: '[email protected]' },
    { name: 'Jane Smith', age: 25, email: '[email protected]' },
    { name: 'Bob Johnson', age: 35, email: '[email protected]' }
  ];

  // Filter by name containing "John"
  const johnUsers = await filter.filter('name contains "John"', users);

  // Filter by age greater than 25
  const olderUsers = await filter.filter('age > 25', users);

  // Global search across all properties
  const emailUsers = await filter.filter('"@example.com"', users);
}

Complex Queries

import { AipFilter } from '@tcn/aip-160';

async function complexFiltering() {
  const filter = new AipFilter();
  const products = [
    { name: 'Laptop', price: 999, category: 'Electronics', inStock: true },
    { name: 'Book', price: 29, category: 'Books', inStock: false },
    { name: 'Phone', price: 699, category: 'Electronics', inStock: true }
  ];

  // Complex query with multiple conditions
  const expensiveElectronics = await filter.filter(
    'category = "Electronics" AND price > 500 AND inStock = true',
    products
  );

  // Date-based filtering
  const recentOrders = await filter.filter(
    'orderDate > "2024-01-01"',
    orders
  );
}

Case-Sensitive Filtering

import { AipFilter } from '@tcn/aip-160';

async function caseSensitiveFiltering() {
  const filter = new AipFilter();
  const data = [
    { name: 'Apple', type: 'FRUIT' },
    { name: 'apple', type: 'COMPANY' },
    { name: 'APPLE', type: 'BRAND' }
  ];

  // Case-sensitive filtering
  const exactMatch = await filter.filter('name = "Apple"', data, true);

  // Case-insensitive filtering (default)
  const anyCase = await filter.filter('name = "apple"', data, false);
}

Using Grammar Patterns

import { getAip160Patterns, AIP160_GRAMMAR } from '@tcn/aip-160';

async function grammarUsage() {
  // Get available patterns
  const patterns = await getAip160Patterns();

  // Access grammar definition
  console.log('Available patterns:', Object.keys(patterns));
  console.log('Grammar definition:', AIP160_GRAMMAR);
}

Filter Syntax

Basic Operators

  • Equality: =, !=
  • Comparison: >, <, >=, <=
  • Contains: contains, not contains
  • Logical: AND, OR, NOT

Data Types

  • Strings: "quoted string" or 'single quotes'
  • Numbers: 123, 45.67
  • Dates: "2024-01-01", "2024-01-01T10:00:00Z"
  • Booleans: true, false

Query Examples

// Simple equality
'status = "active"'

// Numeric comparison
'age >= 18 AND age <= 65'

// String contains
'name contains "john" OR email contains "john"'

// Date filtering
'createdDate > "2024-01-01" AND createdDate < "2024-12-31"'

// Complex logical expressions
'(category = "Electronics" OR category = "Books") AND price < 100'

Component Features

AipFilter Class

  • Async Filtering: Non-blocking filter operations
  • Pattern Caching: Efficient pattern loading and caching
  • Error Handling: Comprehensive error handling for invalid queries
  • Performance: Optimized filtering algorithms

Grammar System

  • AIP-160 Compliance: Full standard implementation
  • Pattern Recognition: Advanced pattern matching capabilities
  • Extensible: Easy to extend with custom patterns
  • Validation: Built-in query validation

Parser Utilities

  • String Parsing: Parse filter strings into executable queries
  • AST Generation: Abstract syntax tree generation
  • Node Visitors: Customizable node processing
  • Query Optimization: Automatic query optimization

When to Use

Choose @tcn/aip-160 when you need:

  • AIP-160 standard compliance for data filtering
  • Complex query capabilities with human-readable syntax
  • Advanced grammar-based parsing systems
  • Flexible data filtering across multiple data types
  • Standardized filtering interfaces
  • High-performance data querying capabilities

Integration

The package integrates seamlessly with:

  • Data Collections: Arrays, objects, and complex data structures
  • Web Applications: Frontend and backend filtering needs
  • APIs: RESTful API query parameter processing
  • Databases: Query building and filtering
  • Search Systems: Advanced search functionality

Performance

  • Efficient Parsing: Optimized grammar parsing algorithms
  • Pattern Caching: Intelligent caching of compiled patterns
  • Memory Management: Efficient memory usage for large datasets
  • Query Optimization: Automatic query optimization
  • Async Operations: Non-blocking filter operations

Error Handling

  • Invalid Queries: Clear error messages for malformed queries
  • Type Validation: Automatic type checking and validation
  • Grammar Errors: Detailed grammar parsing error information
  • Data Validation: Validation of data structures and types
  • Graceful Degradation: Fallback behavior for edge cases

License

Apache-2.0