Sha256: 731c3f79f1e9609575d34fb76aa1ffba7c5a29adccc97912dd12fced80431a5b

Contents?: true

Size: 806 Bytes

Versions: 26

Compression:

Stored size: 806 Bytes

Contents

import { SyncWalker } from './sync.js';
import { AsyncWalker } from './async.js';

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

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

/**
 * @param {Node} ast
 * @param {{
 *   enter?: AsyncHandler
 *   leave?: AsyncHandler
 * }} walker
 * @returns {Promise<Node | null>}
 */
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/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.19 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/@vitest/mocker/node_modules/estree-walker/src/index.js