b7b24421557497ccdd0a72e95bc2623faf76122c62924dd869c5b230eb5d2c45d8bd1e31ffd6010e42181449bdc26c191fb0404b90c67c19f4faf429348dd1 944 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # babel-plugin-transform-exponentiation-operator
  2. > Compile exponentiation operator to ES5
  3. ## Example
  4. ```js
  5. // x ** y
  6. let squared = 2 ** 2;
  7. // same as: 2 * 2
  8. let cubed = 2 ** 3;
  9. // same as: 2 * 2 * 2
  10. // x **= y
  11. let a = 2;
  12. a **= 2;
  13. // same as: a = a * a;
  14. let b = 3;
  15. b **= 3;
  16. // same as: b = b * b * b;
  17. ```
  18. ## Installation
  19. ```sh
  20. npm install --save-dev babel-plugin-transform-exponentiation-operator
  21. ```
  22. ## Usage
  23. ### Via `.babelrc` (Recommended)
  24. **.babelrc**
  25. ```json
  26. {
  27. "plugins": ["transform-exponentiation-operator"]
  28. }
  29. ```
  30. ### Via CLI
  31. ```sh
  32. babel --plugins transform-exponentiation-operator script.js
  33. ```
  34. ### Via Node API
  35. ```javascript
  36. require("babel-core").transform("code", {
  37. plugins: ["transform-exponentiation-operator"]
  38. });
  39. ```
  40. ## References
  41. * [Proposal: Exponentiation Operator](https://github.com/rwaldron/exponentiation-operator)
  42. * [Spec: Exponential Operator](https://rwaldron.github.io/exponentiation-operator/)