d70c04d9c7e7fd71bc6a078838b588c57f806cae0924194b6bc3984a3ff121f9f9717bd3d26be3b5f4345a84e91315c7a5260352c76f3058139de9abe3bf1f 807 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # babel-plugin-transform-es2015-shorthand-properties
  2. > Compile ES2015 shorthand properties to ES5
  3. ## Example
  4. **In**
  5. ```js
  6. var o = { a, b, c };
  7. ```
  8. **Out**
  9. ```js
  10. var o = { a: a, b: b, c: c };
  11. ```
  12. **In**
  13. ```js
  14. var cat = {
  15. getName() {
  16. return name;
  17. }
  18. };
  19. ```
  20. **Out**
  21. ```js
  22. var cat = {
  23. getName: function () {
  24. return name;
  25. }
  26. };
  27. ```
  28. ## Installation
  29. ```sh
  30. npm install --save-dev babel-plugin-transform-es2015-shorthand-properties
  31. ```
  32. ## Usage
  33. ### Via `.babelrc` (Recommended)
  34. **.babelrc**
  35. ```json
  36. {
  37. "plugins": ["transform-es2015-shorthand-properties"]
  38. }
  39. ```
  40. ### Via CLI
  41. ```sh
  42. babel --plugins transform-es2015-shorthand-properties script.js
  43. ```
  44. ### Via Node API
  45. ```javascript
  46. require("babel-core").transform("code", {
  47. plugins: ["transform-es2015-shorthand-properties"]
  48. });
  49. ```