1.0.1 • Published 8 years ago

esfuture v1.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
8 years ago

esnext

Bring your JavaScript into the future.

Installation

$ npm install -g esnext

Usage

After installing, run esnext -h for comprehensive usage instructions.

Features

Modules

Translate CommonJS modules into ES6 modules:

var readFile = require('fs').readFile;
const MagicString = require('magic-string');
let { ok, strictEqual: eq } = require('assert');

exports.doSomething = function() {
  ok(1);
};

// ↑ becomes ↓

import { readFile } from 'fs';
import MagicString from 'magic-string';
import { ok, strictEqual as eq } from 'assert';

export function doSomething() {
  ok(1);
}

Functions

Translate some regular functions to arrow functions:

list.map(function(item) { return item.name; });

// ↑ becomes ↓

list.map(item => item.name);