Skip to content

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

76 Commits

Folders and files

Repository files navigation

Lightweight Refactoring Tools for JavaScript

Lightweight analysis tools for JavaScript, geared towards automated refactoring support.

Basic Usage

var jsb = new JavaScriptBuffer;
jsb.add(<filename>, <source code>);
var groups = jsb.renameTokenAt(<file>, <offset>);

The groups returned are of type Range[][] given the following type schema:

interface Position {
    offset: int;
    line: int;
    column: int;
}
interface Range {
    file: string;
    start: Position
    end: Position
}

Each Range[] object in the topmost array is one group of identifiers that should be renamed together.

Usage Details

For renaming local variables and labels, loading all files into the buffer is not necessary. For that reason, one may use the following approach:

jsb.add(<current file>, <source code>)
if (!jsb.canRenameLocally(<current file>, <offset>))  {
/* add all other files that should be updated */
}

For the time being, a JavaScriptBuffer object should not be reused once a rename function has been invoked.

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages