0.14.0 • Published 2 years ago

swf-types v0.14.0

Weekly downloads
8
License
-
Repository
github
Last release
2 years ago

SWF Types (Typescript)

npm GitHub repository Build status

Typescript implementation of the SWF Abstract Syntax Tree (AST).

Usage

# Run as a simple user
npm install -S swf-types
import {readFileString} from "fs";
import {Movie} from "swf-types";

// Deserialize
const jsonString: string = readFileString("ast.json").toString("utf8");
const parsedJson: Movie.Json = JSON.parse(jsonString);
const movie: Movie = Movie.Type.read("json", parsedJson);

// Serialize
const emittedJson: Movie.Json = Movie.Type.write("json", movie);
console.log(JSON.stringify(jsonMovie, null, 2));