# esnext

> Update your project to the latest ECMAScript syntax.

Latest version **3.3.1** (published 2018-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install esnext
pnpm add esnext
yarn add esnext
bun add esnext
```

Provides the command `esnext`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.3.1 |
| Published | 2018-03-19 |
| First published | 2014-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 8 |
| Unpacked size | 260.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 692 |
| Author | Brian Donovan |
| Maintainers | eventualbuddha |
| Keywords | es6, es7, ast |

## Links

- npm: https://www.npmjs.com/package/esnext
- Repository: https://github.com/esnext/esnext
- Homepage: https://github.com/esnext/esnext#readme
- Issues: https://github.com/esnext/esnext/issues
- npm.io page: https://npm.io/package/esnext

## Dependencies (8)

- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [babylon](https://npm.io/package/babylon.md) ^7.0.0-beta.42
- [@babel/types](https://npm.io/package/@babel/types.md) ^7.0.0-beta.42
- [magic-string](https://npm.io/package/magic-string.md) ^0.22.2
- [strip-indent](https://npm.io/package/strip-indent.md) ^2.0.0
- [shebang-regex](https://npm.io/package/shebang-regex.md) ^2.0.0
- [@babel/traverse](https://npm.io/package/@babel/traverse.md) ^7.0.0-beta.42
- [@types/babel-traverse](https://npm.io/package/@types/babel-traverse.md) ^6.7.17

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 3.3.1 (latest) — 2018-03-19
- 3.3.0 — 2018-03-19
- 3.2.1 — 2017-08-14
- 3.2.0 — 2017-07-16
- 3.1.7 — 2017-07-07
- 3.1.6 — 2017-07-07
- 3.1.5 — 2017-07-07
- 3.1.4 — 2017-06-18
- 3.1.3 — 2017-05-20
- 3.1.2 — 2017-05-07
- 3.1.1 — 2017-04-29
- 3.1.0 — 2017-04-24
- 3.0.19 — 2017-04-23
- 3.0.18 — 2017-04-12
- 3.0.17 — 2017-04-01
- … 101 more at https://npm.io/package/esnext/versions

## README

# esnext [![Build Status](https://api.travis-ci.org/esnext/esnext.svg?branch=master)](https://travis-ci.org/esnext/esnext)

Bring your JavaScript into the future.

## Installation

```
$ yarn global add esnext
# or, with `npm`:
$ npm install -g esnext
```

## Usage

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

## Features

### Functions

Translate some regular functions to arrow functions:

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

// ↑ becomes ↓

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

### Declarations

Convert `var` declarations to `let` or `const` as appropriate:

```js
var arr = [];
for (var i = 0; i < 5; i++) {
  arr.push(i);
}

// ↑ becomes ↓

const arr = [];
for (let i = 0; i < 5; i++) {
  arr.push(i);
}
```

### Objects

Use shorthand syntax for various object constructs:

```js
let person = {
  first: first,
  last: last,
  
  fullName: function() {
    return `${first} ${last}`;
  }
};

// ↑ becomes ↓

let person = {
  first,
  last,
  
  fullName() {
    return `${first} ${last}`;
  }
};
```

### Strings

Convert string concatenation to string or template literals:

```js
let name = 'Brian' + ' ' + 'Donovan';
let greeting = 'Hello, ' + name;

// ↑ becomes ↓

let name = 'Brian Donovan';
let greeting = `Hello, ${name}`;
```

### Destructuring

Convert assignments and declarations to use object destructuring syntax:

```js
let a = obj.a, b = obj.b;
a = obj2.a, b = obj2.b;

// ↑ becomes ↓

let { a, b } = obj;
({ a, b } = obj2);
```

### Modules

Translate CommonJS modules into ES6 modules:

```js
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);
}
```

## Options

```js
{
  'declarations.block-scope': {
    /**
     * Set this to `true` to only turn `var` into `let`, never `const`.
     */
    disableConst: boolean
  }
}
```

---
_Source: https://npm.io/package/esnext · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
