nav tabs on admin dashboard
This commit is contained in:
35
node_modules/regenerator-transform/lib/replaceShorthandObjectMethod.js
generated
vendored
35
node_modules/regenerator-transform/lib/replaceShorthandObjectMethod.js
generated
vendored
@@ -3,16 +3,16 @@
|
||||
exports.__esModule = true;
|
||||
exports.default = replaceShorthandObjectMethod;
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
var util = _interopRequireWildcard(require("./util"));
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
var util = _interopRequireWildcard(_util);
|
||||
|
||||
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 _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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// this function converts a shorthand object generator method into a normal
|
||||
// (non-shorthand) object property which is a generator function expression. for
|
||||
// example, this:
|
||||
@@ -42,17 +42,19 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
||||
// If this function is called with an AST node path that is not a Function (or with an
|
||||
// argument that isn't an AST node path), it will throw an error.
|
||||
function replaceShorthandObjectMethod(path) {
|
||||
var t = util.getTypes();
|
||||
|
||||
if (!path.node || !t.isFunction(path.node)) {
|
||||
throw new Error("replaceShorthandObjectMethod can only be called on Function AST node paths.");
|
||||
}
|
||||
|
||||
// this function only replaces shorthand object methods (called ObjectMethod
|
||||
} // this function only replaces shorthand object methods (called ObjectMethod
|
||||
// in Babel-speak).
|
||||
|
||||
|
||||
if (!t.isObjectMethod(path.node)) {
|
||||
return path;
|
||||
}
|
||||
} // this function only replaces generators.
|
||||
|
||||
|
||||
// this function only replaces generators.
|
||||
if (!path.node.generator) {
|
||||
return path;
|
||||
}
|
||||
@@ -60,21 +62,18 @@ function replaceShorthandObjectMethod(path) {
|
||||
var parameters = path.node.params.map(function (param) {
|
||||
return t.cloneDeep(param);
|
||||
});
|
||||
|
||||
var functionExpression = t.functionExpression(null, // id
|
||||
parameters, // params
|
||||
t.cloneDeep(path.node.body), // body
|
||||
path.node.generator, path.node.async);
|
||||
|
||||
util.replaceWithOrRemove(path, t.objectProperty(t.cloneDeep(path.node.key), // key
|
||||
functionExpression, //value
|
||||
path.node.computed, // computed
|
||||
false // shorthand
|
||||
));
|
||||
|
||||
// path now refers to the ObjectProperty AST node path, but we want to return a
|
||||
)); // path now refers to the ObjectProperty AST node path, but we want to return a
|
||||
// Function AST node path for the function expression we created. we know that
|
||||
// the FunctionExpression we just created is the value of the ObjectProperty,
|
||||
// so return the "value" path off of this path.
|
||||
|
||||
return path.get("value");
|
||||
}
|
||||
Reference in New Issue
Block a user