Add descriptions to transformation/transformers/es5/properties.mutators

This commit is contained in:
James Kyle 2015-07-11 12:07:17 -07:00
parent dce1a3548c
commit 74cf5ac552

View File

@ -2,13 +2,40 @@ import * as defineMap from "../../helpers/define-map";
import * as t from "../../../types"; 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 = { 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) { ObjectExpression(node, parent, scope, file) {