babel-is

0.1.0 • Public • Published

babel-is

Installation

For npm users

npm i babel-is

For yarn users

yarn add babel-is

Usage

In your babel plugin

const is = require( 'babel-is' )

module.exports = function () {
  return {
    visitor: {
      VariableDeclaration( path ) {
        const selector = `FunctionDeclaration[id.name=foo] [kind=let]`

        if ( is( path, selector ) ) {
          // matches all `let` variable declarations in `foo` function
          // add your logic
          // ...
        }
      }
    }
  }
}

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.00latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.00
0.0.00

Package Sidebar

Install

npm i babel-is

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

4.58 kB

Total Files

5

Last publish

Collaborators

  • fengzilong