New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mod-engine

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mod-engine

A TypeScript library for typed attributes and modifiers with deterministic evaluation

latest
npmnpm
Version
1.0.4
Version published
Weekly downloads
9
50%
Maintainers
1
Weekly downloads
 
Created
Source

Mod Engine logo

Mod Engine

A lightweight, type-safe TypeScript library for building item modification systems with deterministic evaluation.

npm version TypeScript License: MIT Documentation

✨ Why Mod-Engine?

🔒 Type-Safe - Complete compile-time validation with TypeScript inference
⚡ Performant - Zero runtime dependencies, efficient evaluation algorithms
🎯 Deterministic - Consistent results with predictable modifier stacking
🧩 Flexible - Works with any domain: games, configuration systems, calculations
🛠️ Developer-Friendly - Fluent API with comprehensive error handling

🚀 Quick Example

import { defineConfig, createEngine } from "mod-engine";

// Define your domain
const config = defineConfig({
  metrics: ["Health", "Damage", "Speed"] as const,
  operations: ["sum", "multiply"] as const,
  attributes: [
    {
      key: "Rarity",
      kind: "enum",
      values: ["Common", "Rare", "Epic"] as const,
    },
    { key: "Level", kind: "number", min: 1, max: 100 },
  ] as const,
});

const engine = createEngine(config);

// Prefer initializing attributes from a defaults object
const attributeDefaults = {
  Rarity: "Epic" as const,
  Level: 50,
};

// Build items with modifiers using native bulk attribute setter
const epicSword = engine
  .builder("Epic Sword")
  .setAttributes(attributeDefaults)
  .increase("Damage")
  .by(100)
  .when({ op: "eq", attr: "Rarity", value: "Epic" })
  .multiply("Damage")
  .by(1.5)
  .build();

// Get final stats
const result = engine.evaluate(epicSword);
console.log(result.metrics); // { Health: 0, Damage: 150, Speed: 0 }

🎮 Perfect For

  • RPG Systems - Character stats, equipment modifiers, skill bonuses
  • Configuration Engines - Dynamic settings with conditional logic
  • Financial Modeling - Fee calculations, discount rules, tax modifiers
  • Game Balancing - Predictable buff/debuff systems
  • Any System requiring conditional numeric modifications

📚 Documentation

📖 Complete Documentation

🛠️ Installation

npm install mod-engine

🎯 Try the Demo

npx create-mod-engine-app my-app
# or
git clone https://github.com/brandon-irving/mod-engine
cd mod-engine && npm start

📝 License

MIT - Build amazing systems with confidence!

⭐ Star us on GitHub | 📖 Read the Docs | 🐛 Report Issues

Keywords

typescript

FAQs

Package last updated on 10 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts