Skip to content

skitscript/interpreter-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skitscript Interpreter (NodeJS) Continuous Integration License Renovate enabled npm npm type definitions

A Skitscript document interpreter targeting NodeJS.

Installation

Dependencies

This is a NPM package. It targets NodeJS 20.14.0 or newer on the following operating systems:

  • Ubuntu 22.04
  • Ubuntu 20.04
  • macOS 13 (Ventura)
  • macOS 12 (Monterey)
  • Windows Server 2022
  • Windows Server 2019

It is likely also possible to use this package as part of a web browser application through tools such as webpack. This has not been tested, however.

Install as a runtime dependency

If your application uses this as a runtime dependency, install it like any other NPM package:

npm install --save @skitscript/interpreter-nodejs

Install as a development dependency

If this is used when building your application and not at runtime, install it as a development dependency:

npm install --save-dev @skitscript/interpreter-nodejs

Usage

Parsing documents

Import the start function, and provide it with a parsed document to receive the information to present to the user:

import { start } from "@skitscript/interpreter-nodejs";

const state = start(parsedDocument);

console.log(state);
{
  "type": "valid",
  "flagsSet": [...],
  "characters": [...],
  "speakers": [...],
  "background": null,
  "line": null,
  "interaction": {...},
  "warnings": [...],
}

When they determine how to proceed, import the resume function and provide details regarding what was selected to receive a next piece of information to present to the user:

import { resume } from "@skitscript/interpreter-nodejs";

const nextState = resume(
  parsedDocument,
  previousState,
  previousState.interaction.instructionIndex
);

console.log(nextState);
{
  "type": "valid",
  "flagsSet": [...],
  "characters": [...],
  "speakers": [...],
  "background": null,
  "line": null,
  "interaction": {...},
  "warnings": [...],
}

Types

A comprehensive library of types representing the results of attempting to interpret parsed documents can be imported:

import { State } from "@skitscript/interpreter-nodejs";

States

Characters
Interactions

Errors

Warnings

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •