babel-plugin-id
[![Build Status](https://travis-ci.org/oreqizer/babel-plugin-id.svg?branch=master)](https://travis-ci.org/oreqizer/babel-plugin-id) [![codecov](https://codecov.io/gh/oreqizer/babel-plugin-id/branch/master/graph/badge.svg)](https://codecov.io/gh/oreqizer/b
Last updated 3 years ago by oreqizer .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-plugin-id 
SYNC missed versions from official npm registry.

babel-plugin-id

Build Status codecov styled with prettier npm (scoped)

Literally all it does is it evaluates a function to its argument. Useful for translation collection, for example.

Function name defaults to __.

Setup

Just add id to the list of babel plugins, e.g. to .babelrc:

{
  "plugins": ["id"]
}

Example

// Input:
const text = __("Translate me");

// Output:
const text = "Translate me";

Config

To change the function name, add an object with the fn property to your config:

{
  "plugins": [["id", { "fn": "t" }]]
}

This will evaluate functions named t.

Example

// Input:
const text = t("Translate me");

// Output:
const text = "Translate me";

License

MIT

Current Tags

  • 1.0.1                                ...           latest (3 years ago)

3 Versions

  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 1
Dependencies (0)
None
Dev Dependencies (10)

Copyright 2014 - 2016 © taobao.org |