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.6 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.5 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.4 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.3 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.2 lib/clapton/javascripts/node_modules/estree-walker/src/index.js
clapton-0.0.1 lib/clapton/javascripts/node_modules/estree-walker/src/index.js