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

@kotenbu135/genshin-calc-wasm

v0.5.12

Published

WASM bindings for genshin-calc damage calculator

Readme

@kotenbu135/genshin-calc-wasm

Genshin Impact damage calculator — WASM bindings for the browser.

Built on genshin-calc, a Rust-based calculation engine.

Install

npm install @kotenbu135/genshin-calc-wasm

Usage

import init, {
  game_version,
  find_character,
  calculate_damage,
  calculate_transformative,
  calculate_lunar,
  resolve_team_stats,
  import_good,
} from "@kotenbu135/genshin-calc-wasm";

// Initialize the WASM module first
await init();

// Game data version
console.log(game_version()); // "6.4"

// Look up a character
const diluc = find_character("diluc");
console.log(diluc.name); // "Diluc"

// Calculate damage
const result = calculate_damage(
  {
    character_level: 90,
    stats: {
      hp: 20000,
      atk: 2000,
      def: 800,
      elemental_mastery: 100,
      crit_rate: 0.75,
      crit_dmg: 1.5,
      energy_recharge: 1.2,
      dmg_bonus: 0.466,
    },
    talent_multiplier: 1.76,
    scaling_stat: "Atk",
    damage_type: "Skill",
    element: "Pyro",
    reaction: null,
    reaction_bonus: 0,
    flat_dmg: 0,
  },
  { level: 90, resistance: 0.1, def_reduction: 0 }
);
console.log(result); // { non_crit, crit, average, reaction }

API

Data Lookup

| Function | Description | |---|---| | game_version() | Returns the game data version string | | find_character(id) | Find character by ID (e.g. "hu_tao") | | find_weapon(id) | Find weapon by ID (e.g. "wolfs_gravestone") | | find_artifact_set(id) | Find artifact set by ID (e.g. "crimson_witch") | | find_enemy(id) | Find enemy by ID (e.g. "hilichurl") | | characters_by_element(el) | List characters by element (e.g. "pyro") | | weapons_by_type(type) | List weapons by type (e.g. "claymore") |

Calculation

| Function | Description | |---|---| | calculate_damage(input, enemy) | Standard damage (ATK/HP/DEF scaling) | | calculate_transformative(input, enemy) | Transformative reactions (overloaded, swirl, etc.) | | calculate_lunar(input, enemy) | Lunar reactions (Nod-Krai crittable reactions) | | resolve_team_stats(members, target_index) | Resolve team buffs into final stats, returns TeamResolveResult | | apply_team_debuffs(members, target_element) | Apply pre-resolved team debuffs to enemy |

GOOD Format Import

| Function | Description | |---|---| | import_good(json) | Import GOOD JSON string → GoodImport with character builds |

// Import from Genshin Optimizer, Scanner tools, etc.
const goodJson = '{"format":"GOOD","source":"GenshinOptimizer","version":2,...}';
const imported = import_good(goodJson);
console.log(imported.builds); // Array of CharacterBuild objects
console.log(imported.warnings); // Any import warnings

TypeScript

Type definitions for all input/output objects are available at types.ts.

import type { DamageInput, Enemy, DamageResult } from "@kotenbu135/genshin-calc-wasm/types";

License

MIT