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

@ifc-lite/rules

v0.7.11

Published

Filter-rule vocabulary, evaluator and .rules.json information-validation engine for IFC-Lite

Readme

@ifc-lite/rules

The filter-rule vocabulary, the Path-B rule evaluator, and the .rules.json information-validation engine for IFC-Lite. This is the shared core behind the viewer's Advanced Filter / Data Validation panel and the ifc-lite check CLI command (#5138) — one evaluator, one .rules.json format, run identically in the browser and on the command line.

Install

npm install @ifc-lite/rules

Usage

import { Rule, evaluateFilterRules, parseRuleSetFile, runRuleSet } from '@ifc-lite/rules';
import type { IfcDataStore } from '@ifc-lite/parser';

declare const store: IfcDataStore;
declare const ruleSetJson: string; // the text of a saved `<name>.rules.json`

// Evaluate an ad-hoc filter against one model.
const matches = evaluateFilterRules('model-1', store, [Rule.ifcType(['IfcWall'])], 'AND');

// Parse and run a saved `.rules.json` rule set against every loaded model.
const parsed = parseRuleSetFile(JSON.parse(ruleSetJson));
if (parsed.ok) {
  const report = await runRuleSet({
    ruleSet: parsed.file,
    models: [{ id: 'model-1', store }],
  });
}

Features

  • isFilterRule validates mandatory names, operands and operators at JSON boundaries; text operands remain strings and quantity/elevation operands remain finite numbers. parseFilterGroups refuses an entire unreadable query, while parseFilterRules retains its per-rule filtering behavior. Missing comparison operands are rejected rather than coerced to empty strings.
  • FilterRule / FilterGroup vocabulary (ifcType, name, property, quantity, material, classification, storey, model, modelTag, parent, group, modelFact, elevation, type, predefinedType, attribute, globalId) plus the Rule builder helpers.
  • listCondition: a saved Lists value predicate (zone, spatial level, model file, quantity/material presence, Lists attributes, inherited properties) inside a FilterGroup. The Lists engine answers it through EvaluatorModel.listConditions (listConditionMatcher(provider) from @ifc-lite/lists); a model without one throws, and rule-set files refuse the kind.
  • legacyLensOperatorToFilterRule and legacyListOperatorToFilterRule convert saved viewer comparisons to this vocabulary. Each returns { status: 'readable', value: rule } or an explicit { status: 'unreadable', vocabulary, operator }; the corresponding filterRuleToLegacy*Operator functions convert supported rules back for export. Pass the target property or attribute as the rule template.
  • evaluateFilterRules / evaluateFilterRulesFederated (sync + async chunked, cancellable, multi-model) — the same Path-B evaluator the viewer's Advanced Filter and Data Validation panel use, with index prefiltering and cheap-first rule ordering for large models.
  • parseRuleSetFile / serializeRuleSet — validate and round-trip a <name>.rules.json file (never throws; failures come back as { ok: false, error }).
  • ruleSetToIds / idsToRuleSet — export the IDS-expressible rules of a rule set as IDS 1.0 XML, and import the simple specifications of an IDS as rules. Each rule or specification that has no exact equivalent is refused with its reasons (see the IDS guide).
  • runRuleSet / resolveTargetModels — the information-validation engine: resolve applicability, check cardinality, dispatch element / unique / aggregate / compare / unit requirements, and fold the result into a @ifc-lite/ids-shaped ValidationReport.

No React, no store, no DOM — every export takes plain data (IfcDataStore, EvaluatorModel[]) in and returns plain data out, so it runs the same in a browser tab and a Node CLI process.

License

MPL-2.0