Add descriptions to transformation/transformers/es5/properties.mutators
This commit is contained in:
parent
dce1a3548c
commit
74cf5ac552
@ -2,13 +2,40 @@ import * as defineMap from "../../helpers/define-map";
|
||||
import * as t from "../../../types";
|
||||
|
||||
/**
|
||||
* [Please add a description.]
|
||||
* Turn [object initializer mutators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Method_definitions)
|
||||
* into `Object.defineProperties`.
|
||||
*
|
||||
* **In**
|
||||
*
|
||||
* ```javascript
|
||||
* var foo = {
|
||||
* get bar() {
|
||||
* return "bar";
|
||||
* }
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* **Out**
|
||||
*
|
||||
* ```javascript
|
||||
* var foo = Object.defineProperties({}, {
|
||||
* bar: {
|
||||
* get: function () {
|
||||
* return "bar";
|
||||
* },
|
||||
* enumerable: true,
|
||||
* configurable: true
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
|
||||
export var visitor = {
|
||||
|
||||
/**
|
||||
* [Please add a description.]
|
||||
* Look for getters and setters on an object.
|
||||
* Filter them out and wrap the object with an `Object.defineProperties` that
|
||||
* defines the getters and setters.
|
||||
*/
|
||||
|
||||
ObjectExpression(node, parent, scope, file) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user