Socket
Book a DemoInstallSign in
Socket

@gram-data/gram-stringify

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gram-data/gram-stringify

Pretty print gram data graphs

latest
Source
npmnpm
Version
0.3.11
Version published
Maintainers
1
Created
Source

From gram AST to text literal (a)-->(b).

How to gram-stringify

Install:

npm install @gram-data/gram-stringify

Build an AST using [[gram-builder]], then pretty print with gram-stringify:

import { node, edge } from '@gram-data/gram-builder';
import { stringify } from '@gram-data/gram-stringify'; 

const left = node('a');
const right = node('b');
const ast = edge([left, right], 'right');

console.log(stringify(ast));

Parse to AST using [[gram-parse]], then pretty print with gram-stringify:

import { toAST } from '@gram-data/gram-parse'; 
import { stringify } from '@gram-data/gram-stringify'; 

const src = '(a)-->(b)';
const ast = toAST(src);

console.log(stringify(ast));

Next Steps

  • Save to a file to share a gram with a friend!

Keywords

graph

FAQs

Package last updated on 22 Jan 2021

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