babel-plugin-transform-property-literals
Turn valid property key literals to plain identifiers
Last updated 7 years ago by boopathi .
MIT · Repository · Bugs · Original npm
$ cnpm install babel-plugin-transform-property-literals 
SYNC missed versions from official npm registry.

babel-plugin-transform-property-literals

This plugin allows Babel to transform valid identifier property key literals into identifiers.

Example

In

var foo = {
  // changed
  "bar": function () {},
  "1": function () {},

  // not changed
  "default": 1,
  [a]: 2,
  foo: 1
};

Out

var foo = {
  bar: function () {},
  1: function () {},

  "default": 1,
  [a]: 2,
  foo: 1
};

Installation

npm install babel-plugin-transform-property-literals

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-property-literals"]
}

Via CLI

babel --plugins transform-property-literals script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["transform-property-literals"]
});

Current Tags

  • 6.9.4                                ...           latest (7 years ago)

3 Versions

  • 0.0.3                                ...           9 years ago
  • 6.10.0-alpha.9                                ...           7 years ago
  • 6.9.4                                ...           7 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org