Inspired by Python SteinLib
A Typescript parser for the SteinLib format
npm install steinlib-ts
// calbacks.ts
const callbacks = {
graph: (rawArgs: string, listArgs: string[]) => {
// ...
},
terminal: (rawArgs: string, listArgs: string[]) => {
// ...
},
coordinates: (rawArgs: string, listArgs: string[]) => {
// ...
},
// ...
};
import { SteinlibParser } from "steinlib-ts";
import { callbacks } from "./callbacks";
const filePath = "path/to/file.stp";
const file = fs.readFileSync(filePath, "utf8");
const lines = file.split("\n");
const parser = new SteinlibParser(lines, callbacks);
// Will call corresponding callbacks for each parsed line
parser.parse();
1. Clone the repository
git clone https://github.com/pietert2000/steinlib-ts.git
2. Install dependencies
cd steinlib-ts
npm i
3. Run the demo
bun examples/demo.ts