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

@tsnet-ts/ts-net

v1.0.1

Published

TypeScript transient hydraulic network simulation library.

Readme

@tsnet-ts/ts-net

TypeScript library for transient hydraulic simulation of water distribution networks using the Method of Characteristics (MOC).

Live demo: tsnet-ts.github.io/TSNet-ts

This project is a TypeScript port of TSNet, maintaining structural parity with the original Python implementation.

Features

  • Load EPANET .inp network files via epanet-js
  • Steady-state initialization (demand-driven or pressure-dependent demand)
  • Transient simulation with MOC (Method of Characteristics)
  • Support for valves, pumps, bursts, leaks, demand pulses, and surge tanks
  • Friction models: steady, quasi-steady, and unsteady
  • Post-processing utilities for time-history analysis

Installation

npm install @tsnet-ts/ts-net

Quick start

import { TransientModel, Initializer, MOCSimulator } from '@tsnet-ts/ts-net';

const tm = await TransientModel.create('networks/Tnet0.inp');

tm.set_wavespeed(1200); // m/s
tm.set_time(25, 0.01);  // duration [s], time step [s]

// Valve closure: [closure period, start time, end open %, closure constant]
tm.valve_closure('3', [0, 0, 0, 1]);

let model = Initializer(tm, 0, 'PDD');
model = MOCSimulator(model, 'Tnet0', 'steady');

const node = model.get_node('2');
console.log(node._head);

See the examples/ directory for more scenarios (pump shutdown, burst, surge tank, demand pulse, etc.).

API overview

| Module | Exports | |--------|---------| | network | TransientModel, topology, discretization, control events | | simulation | Initializer, MOCSimulator, boundary/node solvers | | postprocessing | Time-history and change-point detection | | utils | Valve curves, memoization, numeric helpers | | epanet-bridge | WNTR-like wrapper around epanet-js |

Development

Prerequisites

  • Node.js 20+
  • npm or Bun

Setup

From the monorepo root:

bun install
bun run --cwd TSNET-TS build

Or from this directory:

bun install
bun run build

Scripts

npm run build      # Compile TypeScript to dist/
npm run typecheck  # Type-check without emitting
npm test           # Run Vitest tests
npm run dev        # Watch mode build

Run an example

npm run build
npx tsx examples/Tnet0-valve-closure.ts

Package mapping

This library mirrors the Python TSNet stack with these TypeScript equivalents:

| Python | TypeScript | |--------|------------| | WNTR | epanet-js | | numpy | numpy-ts | | networkx | ndgraph |

Related projects

License

MIT