mirror of
https://github.com/thepeacockproject/StateMachineParser.git
synced 2026-11-22 05:03:05 -10:00
main
Bumps [source-map-js](https://github.com/7rulnik/source-map-js) from 1.2.1 to 1.2.2. - [Release notes](https://github.com/7rulnik/source-map-js/releases) - [Changelog](https://github.com/7rulnik/source-map-js/blob/main/CHANGELOG.md) - [Commits](https://github.com/7rulnik/source-map-js/compare/v1.2.1...v1.2.2) --- updated-dependencies: - dependency-name: source-map-js dependency-version: 1.2.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
StateMachineParser
Check what an IOI state machine would return given an input.
What's an IOI state machine?
An IOI state machine is what we call a part of the JSON scripting system used within the Glacier engine.
For example:
{
"$eq": ["$Value.MyParameter", "Hello"]
}
That is a state machine condition that checks if $Value.MyParameter is "Hello".
Normally, only the actual Glacier engine could check the output of this condition, but this parser can also do it.
How to Use
Install from npm
You can run:
yarn add @peacockproject/statemachine-parser
Or, if you use npm:
npm i @peacockproject/statemachine-parser
This package is published as native ESM. It can also be loaded with require() on Node.js 20.19+ / 22.12+.
Build from Source
git clone https://github.com/thepeacockproject/StateMachineParser
cd StateMachineParser
# installs dependencies and builds
yarn && yarn build
Usage
import { test } from "@peacockproject/statemachine-parser"
const condition = {
$eq: ["$Value.Greeting", "Hi!"],
}
const result = test(
condition, // the state machine condition
{
Value: {
Greeting: "Hi!",
},
}, // the variables object, which is essentially the input values.
)
Description
Check what an IOI state machine would return for a given input.
Readme
Apache-2.0
8.3 MiB
0 Stars
1 Watchers
0 Forks