我正在使图书馆变得更加用户友好,让消费者在使用图书馆时看到文档。
我有一个在构建时运行的脚本:
babel src --out-dir dist --quiet
这是我的.babelrc
:
{
"presets": [
["es2015", { "loose": true, "modules": "commonjs" }]
]
}
这个 ES6 类只有一个方法:
const { makeRequest } = require('../../lib/api');
const commonService = require('../commonService');
/**
* @augments commonService
*/
class bingSpellCheck extends commonService {
/**
* Constructor.
*
* @param {Object} obj
* @param {string} obj.apiKey
* @param {string} obj.endpoint
*/
constructor(obj) {
// code
}
/**
* Perform contextual grammar and spell checking.
*
* @param {Object} obj
* @param {string} obj.parameters The parameters of the call
* @param {string} obj.body The body
*/
spellCheck({ parameters, body }) {
//code
}
}
module.exports = bingSpellCheck;
转译为:
/**
* Constructor.
*
* @param {Object} obj
* @param {string} obj.apiKey
* @param {string} obj.endpoint
*/
function bingSpellCheck(_ref) {
var apiKey = _ref.apiKey,
endpoint = _ref.endpoint;
_classCallCheck(this, bingSpellCheck);
var _this = _possibleConstructorReturn(this, _commonService.call(this, { apiKey: apiKey, endpoint: endpoint }));
_this.endpoints = ["api.cognitive.microsoft.com"];
return _this;
}
/**
* Perform contextual grammar and spell checking.
*
* @param {Object} obj
* @param {string} obj.parameters The parameters of the call
* @param {string} obj.body The body
*/
bingSpellCheck.prototype.spellCheck = function spellCheck(_ref2) {
var parameters = _ref2.parameters,
body = _ref2.body;
这里的问题是文档丢失了。
不过我可以在源代码中看到它吗?
我如何告诉 babel 不要转换参数obj
to _ref
?