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

@atari-engine/core

v0.1.0

Published

Lightweight rule evaluation engine for conditions and feature flags

Readme

@atari-engine/core

Lightweight rule evaluation engine for conditions, feature flags, and user targeting. Define rules with AND/OR groups, validate structure, and evaluate against context (e.g. user properties). Zero runtime dependencies.

Installation

npm install @atari-engine/core
# or
pnpm add @atari-engine/core
# or
yarn add @atari-engine/core

Quick Start

import {
  evaluate,
  validate,
  FIELD_TYPES,
  LOGICAL_OPERATORS,
  OPERATORS,
  type RuleGroup,
  type UserProperties,
} from "@atari-engine/core";

const rule: RuleGroup = {
  logicalOperator: LOGICAL_OPERATORS.AND,
  conditions: [
    {
      fieldName: "age",
      fieldType: FIELD_TYPES.NUMBER,
      operator: OPERATORS.GREATER_THAN_OR_EQUAL_TO,
      value: 18,
    },
    {
      fieldName: "country",
      fieldType: FIELD_TYPES.STRING,
      operator: OPERATORS.IN,
      value: ["KR", "JP", "US"],
    },
  ],
};

const validation = validate(rule);
if (!validation.valid) {
  console.error(validation.errors);
  process.exit(1);
}

const user: UserProperties = { age: 25, country: "KR" };
const matched = evaluate(rule, user);
console.log(matched); // true

API Reference

evaluate(rule, context, options?)

Evaluates a rule or rule group against a context object. Returns true if the rule matches, false otherwise. Never throws; use options.onError to receive validation/runtime errors.

  • rule: Rule | RuleGroup — A single rule or nested AND/OR group.
  • context: UserProperties — Key-value context (e.g. user properties). Supports dot notation for nested keys (e.g. "address.city").
  • options.onError: (error: AtariError) => void — Optional callback for errors (e.g. missing field, type mismatch).

validate(rule)

Validates the structure and types of a rule. Returns { valid: true } or { valid: false, errors: ValidationError[] }.

Types

  • Rule: { fieldName, fieldType, operator, value } — Single condition.
  • RuleGroup: { logicalOperator: "AND" | "OR", conditions: (Rule | RuleGroup)[] } — Nested conditions.
  • FieldType: "string" | "number" | "boolean" | "date" | "date_unix".
  • Operator: Equality (==, !=), comparison (>, >=, <, <=), in / not_in, string (contains, starts_with, ends_with), exists / not_exists.

Constants

  • FIELD_TYPES, OPERATORS, LOGICAL_OPERATORS — Use these when building rules.
  • OPERATOR_FIELD_TYPE_MATRIX — Map of which operators are allowed per field type.
  • isOperatorAllowedForFieldType(operator, fieldType) — Helper for UI/validation.

Errors

  • AtariError — Custom error class; code has id and category, message for description.
  • ATARI_ERROR_CODESFIELD_NOT_FOUND, TYPE_MISMATCH, INVALID_OPERATOR, INVALID_RULE, EMPTY_CONDITIONS.

License

MIT © JammyTheDreamer