Sha256: 99128f4c6cb79cb1e3abf3f2ba96faedd2b820aab4fd7f743aab0b8d710a73af

Contents?: true

Size: 842 Bytes

Versions: 26

Compression:

Stored size: 842 Bytes

Contents

// @ts-check
import { SyncWalker } from './sync.js';
import { AsyncWalker } from './async.js';

/** @typedef { import('estree').BaseNode} BaseNode */
/** @typedef { import('./sync.js').SyncHandler} SyncHandler */
/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */

/**
 *
 * @param {BaseNode} ast
 * @param {{
 *   enter?: SyncHandler
 *   leave?: SyncHandler
 * }} walker
 * @returns {BaseNode}
 */
export function walk(ast, { enter, leave }) {
	const instance = new SyncWalker(enter, leave);
	return instance.visit(ast, null);
}

/**
 *
 * @param {BaseNode} ast
 * @param {{
 *   enter?: AsyncHandler
 *   leave?: AsyncHandler
 * }} walker
 * @returns {Promise<BaseNode>}
 */
export async function asyncWalk(ast, { enter, leave }) {
	const instance = new AsyncWalker(enter, leave);
	return await instance.visit(ast, null);
}

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.19 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/estree-walker/src/index.js