@a-la/fixture-babel 中文文档教程
@a-la/fixture-babel
@a-la/fixture-babel
是用 Babel 转译的源代码。
yarn add -E @a-la/fixture-babel
Table Of Contents
API
该包可通过导入其默认和命名函数使用:
import erte, { c, b } from '@a-la/fixture-babel'
erte(): string
返回 erte
。
/* yarn example/ */
import fixtureBabel from '@a-la/fixture-babel'
(async () => {
const res = await fixtureBabel({
text: 'example',
})
console.log(res)
})()
erte
c(): string
返回 c
。
b(): string
返回 b
。
Transpiled Source Code
Babel 就是这样转译 源代码:
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.b = exports.c = exports.default = void 0;
var _stream = _interopRequireWildcard(require("stream"));
var _path = require("path");
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; } }
class S extends _stream.Transform {
/**
* Creates a new instance.
* @param {string} path
* @param {Stream} [parent]
*/
constructor(path, parent) {
super();
this.source = (0, _path.join)('example', path);
if (parent instanceof _stream.default) this.pipe(parent);
}
}
/**
* A function that returns `c`.
* @param {string} input
*/
exports.default = S;
const c = (input = '') => {
return 'c' + input ? `-${input}` : '';
};
/**
* A function that returns `b`.
* @param {number} times
*/
exports.c = c;
const b = (times = 0) => {
return 'b' + times ? `-${times}` : '';
};
exports.b = b;
Copyright
© Art Deco for À La Mode 2019 | Tech Nation Visa Sucks |
---|
@a-la/fixture-babel
@a-la/fixture-babel
is source code transpiled with Babel.
yarn add -E @a-la/fixture-babel
Table Of Contents
API
The package is available by importing its default and named functions:
import erte, { c, b } from '@a-la/fixture-babel'
erte(): string
Returns erte
.
/* yarn example/ */
import fixtureBabel from '@a-la/fixture-babel'
(async () => {
const res = await fixtureBabel({
text: 'example',
})
console.log(res)
})()
erte
c(): string
Returns c
.
b(): string
Returns b
.
Transpiled Source Code
This is how Babel transpiles source code:
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.b = exports.c = exports.default = void 0;
var _stream = _interopRequireWildcard(require("stream"));
var _path = require("path");
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; } }
class S extends _stream.Transform {
/**
* Creates a new instance.
* @param {string} path
* @param {Stream} [parent]
*/
constructor(path, parent) {
super();
this.source = (0, _path.join)('example', path);
if (parent instanceof _stream.default) this.pipe(parent);
}
}
/**
* A function that returns `c`.
* @param {string} input
*/
exports.default = S;
const c = (input = '') => {
return 'c' + input ? `-${input}` : '';
};
/**
* A function that returns `b`.
* @param {number} times
*/
exports.c = c;
const b = (times = 0) => {
return 'b' + times ? `-${times}` : '';
};
exports.b = b;
Copyright
© Art Deco for À La Mode 2019 | Tech Nation Visa Sucks |
---|