How to use the periscopic.analyze function in periscopic

To help you get started, we’ve selected a few periscopic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Rich-Harris / code-red / src / print / index.ts View on Github external
export function print(node: Node, opts: PrintOptions = {}): { code: string, map: any } {
	if (Array.isArray(node)) {
		return print({
			type: 'Program',
			body: node
		} as unknown as Program, opts);
	}

	const {
		getName = (x: string) => x
	} = opts;

	let { map: scope_map, scope } = perisopic.analyze(node);
	const deconflicted = new WeakMap();

	const chunks = handle(node, {
		indent: '',
		getName,
		scope,
		scope_map,
		deconflicted,
		comments: []
	});

	type Segment = [number, number, number, number];

	let code = '';
	let mappings: Segment[][] = [];
	let current_line: Segment[] = [];

periscopic

periscopic

MIT
Latest version published 11 months ago

Package Health Score

71 / 100
Full package analysis

Popular periscopic functions