@a-la/fixture-alamode 中文文档教程

发布于 5年前 浏览 26 项目主页 更新于 3年前

@a-la/fixture-alamode

npm version

@a-la/fixture-alamode 是使用 ÀLaMode 编译的源代码。

yarn add -E @a-la/fixture-alamode

Table Of Contents

API

该包可通过导入其默认和命名函数使用:

import erte, { c, b } from '@a-la/fixture-alamode'

erte(): string

返回 erte

/* yarn example/ */
import fixtureAlamode from '@a-la/fixture-alamode'

(async () => {
  const res = await fixtureAlamode({
    text: 'example',
  })
  console.log(res)
})()
erte

c(): string

返回 c

b(): string

返回 b

Transpiled Source Code

ÀLaMode 是这样转译 源代码

const Stream = require('stream'); const {
  Transform,
} = Stream;
const { join } = require('path');

class S extends Transform {
  /**
   * Creates a new instance.
   * @param {string} path
   * @param {Stream} [parent]
   */
  constructor(path, parent) {
    super()
    this.source = join('example', path)
    if (parent instanceof Stream)
      this.pipe(parent)
  }
}

/**
 * A function that returns `c`.
 * @param {string} input
 */
const c = (input = '') => {
  return 'c' + input ? `-${input}` : ''
}

/**
 * A function that returns `b`.
 * @param {number} times
 */
const b = (times = 0) => {
  return 'b' + times ? `-${times}` : ''
}

module.exports = S
module.exports.c = c
module.exports.b = b

< /a>

Art Deco© Art Deco for À La Mode 2019Tech Nation VisaTech Nation Visa Sucks

@a-la/fixture-alamode

npm version

@a-la/fixture-alamode is source code compiled with ÀLaMode.

yarn add -E @a-la/fixture-alamode

Table Of Contents

API

The package is available by importing its default and named functions:

import erte, { c, b } from '@a-la/fixture-alamode'

erte(): string

Returns erte.

/* yarn example/ */
import fixtureAlamode from '@a-la/fixture-alamode'

(async () => {
  const res = await fixtureAlamode({
    text: 'example',
  })
  console.log(res)
})()
erte

c(): string

Returns c.

b(): string

Returns b.

Transpiled Source Code

This is how ÀLaMode transpiles the source code:

const Stream = require('stream'); const {
  Transform,
} = Stream;
const { join } = require('path');

class S extends Transform {
  /**
   * Creates a new instance.
   * @param {string} path
   * @param {Stream} [parent]
   */
  constructor(path, parent) {
    super()
    this.source = join('example', path)
    if (parent instanceof Stream)
      this.pipe(parent)
  }
}

/**
 * A function that returns `c`.
 * @param {string} input
 */
const c = (input = '') => {
  return 'c' + input ? `-${input}` : ''
}

/**
 * A function that returns `b`.
 * @param {number} times
 */
const b = (times = 0) => {
  return 'b' + times ? `-${times}` : ''
}

module.exports = S
module.exports.c = c
module.exports.b = b

Art Deco© Art Deco for À La Mode 2019Tech Nation VisaTech Nation Visa Sucks

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文