castborg

0.0.12 • Public • Published

castborg

SourceCode

Represents code <--> AST Can be initialized with a code, an AST or a file path

// by code
var sourceCode = new SourceCode({ code: 'var obj = { a: 1, b: 2 };' });
// by AST
var sourceCode = new SourceCode({ ast: some_ast_object });
// by file
var sourceCode = new SourceCode({ file: './some-file.js' });

All source code instances have ast, code and filename properties

var ast       = sourceCode.ast;
var code      = sourceCode.code;
var file_name = sourceCode.file;

AstSearcher

AstSearcher has only static method that parse an AST and return a path


AstModifier

AstModifier has only static method that can modify an AST It will then return a new copy of the existing code / AST / filepath.

Readme

Keywords

none

Package Sidebar

Install

npm i castborg

Weekly Downloads

0

Version

0.0.12

License

Apache License

Last publish

Collaborators

  • saitodisse