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

@turing-machine-js/builder

v6.0.1

Published

A turing machine builder — declarative state-table construction. Not actively developed by the author; the same state-table pattern is also shown as an inline example in @turing-machine-js/machine's README. Contributions welcome.

Readme

@turing-machine-js/builder

npm (tag)

Status: not actively developed by the author. The package still works and existing tests pass — but no new features are planned. The same state-table construction pattern is shown as an inline example in @turing-machine-js/machine's README, so most users won't need this package as a separate dependency. Contributions are welcome if you'd like to extend it (e.g. multi-tape support, OR-patterns, a string-DSL parser shipped with the package itself).

What it does

Constructs a Turing machine from a declarative state-table object. Every transition is a single (state, currentSymbol) → (nextState, nextSymbol, movement) row — the simplest possible API surface, matching how state machines are typically presented in textbooks.

import { Tape } from '@turing-machine-js/machine';
import buildMachine from '@turing-machine-js/builder';

// Flip every bit on the tape; halt when the head reaches a blank.
const [machine, initialState] = buildMachine({
  alphabetString: ' 01',
  initialState: 'flip',
  finalStateList: ['DONE'],
  states: {
    flip: {
      '0': { state: 'flip', symbol: '1', movement: 'R' },
      '1': { state: 'flip', symbol: '0', movement: 'R' },
      ' ': { state: 'DONE', symbol: ' ', movement: 'S' },
    },
  },
});

machine.tapeBlock.replaceTape(new Tape({
  alphabet: machine.tapeBlock.alphabets[0],
  symbols: '0101'.split(''),
}));

await machine.run({ initialState, stepsLimit: 100 });
console.log(machine.tapeBlock.tapes[0].symbols.join('').trim()); // "1010"

See builder.spec.ts for a longer worked example — a 27-state binary-string-duplicator (input #011# → output #011#011#) — including a small parser that reads the textbook (state,symbol)→(state,symbol,movement); notation.

Limitations

The state-table format is intentionally minimal. It does not support:

  • OR-patterns (matching multiple current symbols with one transition row). For tapeBlock.symbol('^10$') style patterns, use the raw @turing-machine-js/machine API.
  • Multi-tape machines (buildMachine is single-tape only).
  • withOverrodeHaltState composition (the subroutine-call mechanism). For composed machines like library-binary-numbers's minusOne, use the raw API.

If you need any of the above, the inline state-table example in @turing-machine-js/machine's README shows how to write your own buildMachine-equivalent in ~30 lines, and you can extend it to fit your case.

Install

npm install @turing-machine-js/machine @turing-machine-js/builder

@turing-machine-js/machine is a peer dependency (so consumer and library share the same singleton sentinels — haltState, ifOtherSymbol, etc.).

Links