babel-plugin-transform-jsx-condition
Support of transform jsx condition directive.
Last updated 5 years ago by zeroling .
Repository · Bugs · Original npm · Tarball · package.json
$ npm install babel-plugin-transform-jsx-condition 
SYNC missed versions from official npm registry.

babel-plugin-transform-jsx-condition

Support of transform jsx condition directive.

Example

In

// input code
<View x-if={condition}>First</View>
<View x-elseif={another}>Second</View>
<View x-else>Third</View>

Out

{
  createCondition([
    [
      () => condition,
      () => <View}>First</View>
    ],
    [
      () => another,
      () => <View}>Second</View>
    ],
    [
      () => true,
      () => <View}>Third</View>
    ],
  ])
}

Installation

$ npm install babel-plugin-transform-jsx-condition

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-jsx-condition"]
}

Via CLI

$ babel --plugins transform-jsx-condition script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-jsx-condition"]
});

Current Tags

  • 0.1.3-0                                ...           beta (3 years ago)
  • 0.1.3                                ...           latest (a year ago)

5 Versions

  • 0.1.3                                ...           a year ago
  • 0.1.3-0                                ...           3 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Total 2
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)

© 2010 - cnpmjs.org x YWFE | Home | YWFE