UNPKG

@putout/operator-filesystem

Version:

🐊Putout operator adds ability to filesystem referenced variables that was not defined

15 lines (11 loc) 314 B
import {traverse} from '@putout/traverse'; import {__filesystem_name} from '@putout/operator-json'; export const getRootFromAst = (ast) => { let root; traverse(ast, { [`${__filesystem_name}(__)`](path) { root = path.get('arguments.0'); }, }); return root; };