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

res-profiles

v1.2.26

Published

RES vehicle profiles, engine coefficients, and performance evaluation library

Readme

res-profiles

RES vehicle profiles, engine coefficients, and performance evaluation library.

Purpose

This package provides a comprehensive backend for vehicle performance estimation, including:

  • Data: Vehicle profiles, engine-family coefficients, modification ontology, and validation datasets
  • Core Library: Performance evaluation, modification normalization, VIN-to-profile matching, and calibration utilities
  • CLIs: Tools to generate, validate, and calibrate data

Installation

npm install res-profiles

Quick Start

import { evaluate, normalizeMods, matchVinToProfile, loadProfiles } from 'res-profiles';

// Load vehicle profiles
const profiles = await loadProfiles();

// Match VIN to profile
const { profile } = matchVinToProfile({
  year: 2019,
  make: 'BMW',
  model: 'M340i',
  engine_code: 'B58B30O1',
  drivetrain: 'AWD',
  trans: 'AT8',
  market: 'USDM'
}, profiles);

// Normalize modification text
const mods = normalizeMods('BM3 Stage 2 E30, catless DP, VRSF IC', 'BMW_B58');

// Evaluate performance
const result = evaluate(profile, mods, {
  surface: 'Street',
  tires: 'MaxPerf',
  tempF: 70,
  da_ft: 500
});

console.log(result);
// {
//   whp: 425,
//   zeroTo60: 3.6,
//   quarterET: 12.0,
//   trap: 118,
//   sustainHint: 'IC upgrade improves sustained performance'
// }

Core Functions

evaluate(profile, mods, env)

Calculates performance metrics for a vehicle with modifications:

  • Inputs: CarProfile, NormalizedMods, EvaluationEnvironment
  • Outputs: Wheel HP, 0-60 time, quarter mile ET, trap speed
  • Features: Turbo pressure-ratio modeling, fuel system gains, traction scoring

normalizeMods(freeText, overlay)

Converts free-text modification descriptions to structured format:

  • Inputs: Text description, engine family overlay
  • Outputs: NormalizedMods object
  • Features: Rule-based parsing, schema validation, AI-ready stub

matchVinToProfile(vinDecoded, profiles)

Finds the best matching vehicle profile:

  • Inputs: Decoded VIN data, profile array
  • Outputs: Matched profile with confidence level
  • Features: Engine code primary key, fallback scoring

Data Structure

Vehicle Profiles

Each profile contains:

  • Identity: Make, model, year, engine family/code
  • Powertrain: Crank HP/TQ, redline, displacement
  • Chassis: Weight, drag coefficient, frontal area
  • Baselines: Stock performance metrics
  • Coefficients: Engine-specific tuning parameters
  • Validation: Confidence tier (Bronze/Silver/Gold), source

Confidence Tiers

  • Bronze: Generated profiles with estimated parameters
  • Silver: Validated against some real-world data
  • Gold: Fully validated with comprehensive testing

Model Versioning

Profiles include modelVersion field (e.g., "2025-08-RES-v1") for tracking updates and compatibility.

CLI Tools

Development

npm run dev          # Demo evaluation with sample data

Data Generation

npm run gen:bmw      # Generate BMW profiles 2010-2025

Validation

npm run validate     # Validate all profiles against schemas

Calibration

npm run calibrate    # Calibrate constants against test data

Development

Prerequisites

  • Node.js 18+
  • TypeScript 5.3+

Setup

npm install
npm run build
npm test

Project Structure

res-profiles/
├─ /src
│  ├─ /types          # Zod schemas + TypeScript types
│  ├─ /constants      # Performance constants & gain tables
│  ├─ /lib            # Core library functions
│  └─ /cli            # Command-line tools
├─ /data              # Seed data & validation sets
├─ /schemas           # JSON Schema definitions
└─ /tests             # Vitest test suite

Performance Model

The evaluation engine uses a physics-based approach:

  • Baseline: Crank HP × drivetrain efficiency
  • Turbo/SC: Pressure ratio model with efficiency curves
  • Fuel System: Ethanol content scaling
  • Air Path: Intake, intercooler, and exhaust gains
  • Traction: Tire type, surface, and drivetrain effects

Constants (a0-a2, b0-b2, c0-c2) are calibrated against validation data and can be refined using the calibration CLI.

Contributing

  1. Follow TypeScript strict mode and ESLint rules
  2. Add tests for new functionality
  3. Update schemas when modifying data structures
  4. Use semantic versioning for releases

License

MIT