Socket
Socket
Sign inDemoInstall

ast-node-finder

Package Overview
Dependencies
80
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ast-node-finder

JSCodeshift find api automatically generated from code


Version published
Weekly downloads
4
increased by100%
Maintainers
1
Install size
12.2 MB
Created
Weekly downloads
 

Readme

Source

ast-node-finder

Build and Deploy Coverage Status Version semantic-release Conventional Commits

jscodeshift find api automatically generated from code

Checkout the api in this playground

Read the introductory blog post for more details.

Usage

import { findQuery } from 'ast-node-finder';
import { parse } from 'recast';

const source = `foo.bar.baz(1,2,3)`;

const ast = parse(source);

// Pass the node from ast and get the find api
console.log(findQuery(ast.program.body[0].expression));

Output

root.find(j.CallExpression, {
  callee: {
    object: {   object: { name: 'foo' },
    property: { name: 'bar' }
  },
  property: { name: 'baz' }
  }
})
.forEach(path => {
  // Manipulate the path (node) here
});

Keywords

FAQs

Last updated on 17 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc