Main entry point to the tool. The function accepts multiple different kinds
of arguments as a convenience. In particular the function accepts either
- a string containing source code
The string is parsed with Recast
- a single AST node
- a single node path
- an array of nodes
- an array of node paths
Parameters:
Name | Type | Description |
---|---|---|
source |
Node | NodePath | Array | string | |
options |
Object | Options to pass to Recast when passing source code |
Returns:
- Type
- Collection
Members
(static) types :external:astTypes
Type:
Methods
(static) match(path)
Utility function to match a node against a pattern.
Parameters:
Name | Type | Description |
---|---|---|
path |
Node | NodePath | Object |
Returns:
boolean
(static) use(plugin)
Utility function for registering plugins.
Plugins are simple functions that are passed the core jscodeshift instance.
They should extend jscodeshift by calling `registerMethods`, etc.
This method guards against repeated registrations (the plugin callback will only be called once).
Parameters:
Name | Type | Description |
---|---|---|
plugin |
function |
(static) withParser()
Returns a version of the core jscodeshift function "bound" to a specific
parser.