You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.7 KiB
JavaScript
56 lines
1.7 KiB
JavaScript
6 years ago
|
"use strict";
|
||
|
|
||
|
exports.__esModule = true;
|
||
|
|
||
|
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
|
||
|
|
||
|
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
||
|
|
||
|
exports.default = function () {
|
||
|
return {
|
||
|
visitor: _babelTraverse.visitors.merge([{
|
||
|
ArrowFunctionExpression: function ArrowFunctionExpression(path) {
|
||
|
var params = path.get("params");
|
||
|
for (var _iterator = params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
|
||
|
var _ref;
|
||
|
|
||
|
if (_isArray) {
|
||
|
if (_i >= _iterator.length) break;
|
||
|
_ref = _iterator[_i++];
|
||
|
} else {
|
||
|
_i = _iterator.next();
|
||
|
if (_i.done) break;
|
||
|
_ref = _i.value;
|
||
|
}
|
||
|
|
||
|
var param = _ref;
|
||
|
|
||
|
if (param.isRestElement() || param.isAssignmentPattern()) {
|
||
|
path.arrowFunctionToShadowed();
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}, destructuring.visitor, rest.visitor, def.visitor])
|
||
|
};
|
||
|
};
|
||
|
|
||
|
var _babelTraverse = require("babel-traverse");
|
||
|
|
||
|
var _destructuring = require("./destructuring");
|
||
|
|
||
|
var destructuring = _interopRequireWildcard(_destructuring);
|
||
|
|
||
|
var _default = require("./default");
|
||
|
|
||
|
var def = _interopRequireWildcard(_default);
|
||
|
|
||
|
var _rest = require("./rest");
|
||
|
|
||
|
var rest = _interopRequireWildcard(_rest);
|
||
|
|
||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||
|
|
||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
|
||
|
module.exports = exports["default"];
|