Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @wmfs/tymly-statelint with all npm packages installed. Try it out:

var tymlyStatelint = require("@wmfs/tymly-statelint")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@wmfs/tymly-statelint v1.14.1

Validator for Amazon States Language with Tymly Extensions JSON.

tymly-statelint

Tymly Package npm (scoped) CircleCI codecov Dependabot badge Commitizen friendly JavaScript Style Guide license

An npm package providing a validator for Amazon States Language JSON with Tymly extensions. Usable from the command-line or as a library.

It builds on statelint, a package for validating unextended Amazon States Language JSON.

From the Command-line

Installation

npm install --global @wmfs/tymly-statelint

Usage

tymly-statelint state-machine-spec [state-machine-spec...]

There are no options. If you see no output, your state machine is fine.

As a library

Installation

npm install --save @wmfs/tymly-statelint

Usage

const tymlyStateLint = require('@wmfs/statelint')

const problems = tymlyStateLint.validate(json)
if (problems.length !== 0) {
  console.log('Oh dear!')
  problems.forEach(p => console.log(`ERROR: ${p}`)
}
  • json is the state machine to validate. It can be a JSON object, a filename, or a file descriptor.

tymlyStatelint.validate returns an array or error strings. If the array is empty, the state machine is fine. If not, then there's a problem! The validator is exhaustive, so it will report every problem it finds, not simply bail at the first thing. The error messages have the general form <json-path to error> <description of error>.

Contributing

Bug reports and pull requests are welcome on GitHub. Please be aware of our Code of Conduct

License

Licensed under the terms of the MIT license. Copyright (c) 2018 West Midlands Fire Service

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free