Socket
Book a DemoInstallSign in
Socket

monotone

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monotone

An implementation of the monotone framework for JavaScript

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

monotone

An implementation of the monotone framework for JavaScript

Install

npm install monotone --save

Usage

import { monotone, runString, Direction, TransferResult } from "monotone";

const instance = monotone((files, checker) => {
	return {
		direction: Direction.Backward,    // Or Direction.Forward
		
		bottom: undefined,                // Bottom value
		entry() {
			return undefined;             // Initial value for entry points
		},
		union(a, b) {
			return undefined;             // Combine two values
		},
		isLessOrEqual(a, b) {
			return true;                  // Compare two value
		},
		
		kinds: [GraphNodeKind.Begin],     // The positions of nodes in the AST that have a transfer function
		filter(node) {
			return true;                  // Filter nodes that have a transfer function
		}
		transfer(node, kind, state, get) {
			return TransferResult(state); // The transfer function of the monotone framework
		},
		result(get) {
			return undefined;             // Extract the information from the final state
		}
	};
});
const result = runString(instance, `function(a, b) { return a + b }`);

You can find a complete example, which implements live variable analysis, in src/test/monotone-example.ts.

This project uses the TypeScript compiler for parsing and scope analysis, which can parse both JavaScript and TypeScript.

Build

You can build this project with npm run build and test it with npm test.

License

Monotone is licensed under the MIT license.

Keywords

monotone framework

FAQs

Package last updated on 29 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts