@59naga/babel-plugin-transform-array-from 中文文档教程

发布于 9年前 浏览 20 项目主页 更新于 3年前

babel-plugin-transform-array-from

Array.from 替换为 ponyfill 函数

Installation

npm install @59naga/babel-plugin-transform-array-from --save

Example

In

Array.from('????');

Out

var _arrayFrom = Array.from || function(){...};
_arrayFrom('????');

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["@59naga/babel-plugin-transform-array-from"]
}

Via CLI

$ babel --plugins @59naga/babel-plugin-transform-array-from script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["@59naga/babel-plugin-transform-array-from"]
});

Development

要求全局

  • NodeJS v0.12.13
  • Npm v3.7.1
git clone https://github.com/59naga/@59naga/babel-plugin-transform-array-from
cd @59naga/babel-plugin-transform-array-from
npm install

npm test

License

MIT

babel-plugin-transform-array-from

Replace Array.from with an ponyfill function.

Installation

npm install @59naga/babel-plugin-transform-array-from --save

Example

In

Array.from('????');

Out

var _arrayFrom = Array.from || function(){...};
_arrayFrom('????');

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["@59naga/babel-plugin-transform-array-from"]
}

Via CLI

$ babel --plugins @59naga/babel-plugin-transform-array-from script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["@59naga/babel-plugin-transform-array-from"]
});

Development

Requirement global

  • NodeJS v0.12.13
  • Npm v3.7.1
git clone https://github.com/59naga/@59naga/babel-plugin-transform-array-from
cd @59naga/babel-plugin-transform-array-from
npm install

npm test

License

MIT

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