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

@logistics-ts/inventory

v0.1.1

Published

Safety stock, reorder point, EOQ, coverage, and issue analysis for logistics-ts.

Readme

@logistics-ts/inventory

npm version license

Inventory decision-support for logistics-ts: safety stock, reorder point / order-up-to level, EOQ/EPQ (with quantity discounts), coverage, turnover, and a catalogue-wide issue analyser. Every result returns Explained<T>.

Install

npm i @logistics-ts/inventory

What's in it

  • safetyStock — the safety-stock buffer for a target cycle service level; method: 'auto' picks the right formula for whatever variability data you supply (demand only, lead time only, or both — King's combined formula).
  • reorderPoint / orderUpToLevel — the reorder trigger, or the order-up-to level for periodic review.
  • eoq / epq / eoqWithQuantityDiscounts — order-quantity sizing (classic EOQ, finite production rate, price breaks).
  • coverage / turnover — days of inventory on hand / annual turns, always reported in calendar days regardless of demand-bucketing granularity.
  • issues — one call that flags every item needing attention across a catalogue: below-rop, below-safety-stock, stockout-risk-within-leadtime, overstocked, dead-stock.

Quick start

import { generateExampleData, mean, standardDeviation } from '@logistics-ts/core'
import { reorderPoint, safetyStock } from '@logistics-ts/inventory'

const { demand, leadTimes } = generateExampleData({ items: 1, periods: 24, seed: 4 })
const itemId = demand[0]!.itemId
const quantities = demand.filter((d) => d.itemId === itemId).map((d) => d.quantity)
const itemLeadTimes = leadTimes.filter((l) => l.itemId === itemId).map((l) => l.leadTimeDays)

const ss = safetyStock(
  {
    meanDemand: mean(quantities),
    meanLeadTime: mean(itemLeadTimes),
    demandStdDev: standardDeviation(quantities),
  },
  { method: 'auto', serviceLevel: 0.95 },
)

const rop = reorderPoint({
  meanDemand: mean(quantities),
  meanLeadTime: mean(itemLeadTimes),
  safetyStock: ss.value,
})

console.log(ss.value, ss.method, ss.reasoning)
console.log(rop.value) // reorder when on-hand stock drops to this level

meanDemand and meanLeadTime must share a period unit — LeadTimeRecord is always in days, so convert it before combining with weekly/monthly demand (the issues function below does this for you).

For the whole "flag everything that needs reordering" flow in one call:

import { issues } from '@logistics-ts/inventory'

const problems = issues(stock, demand, leadTimes, { serviceLevel: 0.95, granularity: 'month' })

In the umbrella package

@logistics-ts/inventory is re-exported as the inventory namespace from logistics-ts, which also adds a stateful InventoryAnalyzer convenience wrapper over this package's pure functions. @logistics-ts/inventory depends on @logistics-ts/core, @logistics-ts/classification, and @logistics-ts/forecasting.

Links

License

MIT