# browserslist-to-es-version

Latest version **1.4.2** (published 2026-05-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install browserslist-to-es-version
pnpm add browserslist-to-es-version
yarn add browserslist-to-es-version
bun add browserslist-to-es-version
```

Provides the command `browserslist-to-es-version`.

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.4.2 |
| Published | 2026-05-29 |
| First published | 2024-07-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 24.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 14 |
| Maintainers | chenjiahan |

## Links

- npm: https://www.npmjs.com/package/browserslist-to-es-version
- Repository: https://github.com/rstackjs/browserslist-to-es-version
- npm.io page: https://npm.io/package/browserslist-to-es-version

## Dependencies (1)

- [browserslist](https://npm.io/package/browserslist.md) ^4.28.2

## Recent versions

- 1.4.2 (latest) — 2026-05-29
- 1.4.1 — 2026-01-20
- 1.4.0 — 2026-01-20
- 1.3.0 — 2026-01-04
- 1.2.0 — 2025-10-21
- 1.1.1 — 2025-08-04
- 1.1.0 — 2025-07-08
- 1.0.0 — 2024-07-02

## README

# browserslist-to-es-version

<p>
  <a href="https://npmjs.com/package/browserslist-to-es-version">
   <img src="https://img.shields.io/npm/v/browserslist-to-es-version?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
  </a>
  <img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
  <a href="https://npmcharts.com/compare/browserslist-to-es-version?minimal=true"><img src="https://img.shields.io/npm/dm/browserslist-to-es-version.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
</p>

Convert [browserslist](https://github.com/browserslist/browserslist) query to ECMAScript version.

## CLI usage

In any package with a browserslist configuration:

```bash
$ npx browserslist-to-es-version
2017
```

Alternatively, you can provide a browserslist query as a string:

```bash
npx browserslist-to-es-version "Chrome >= 80, Firefox >= 72"
```

## API usage

Install:

```bash
npm add browserslist-to-es-version -D
```

Example:

```ts
import { browserslistToESVersion } from 'browserslist-to-es-version';

const esVersion = browserslistToESVersion([
  'chrome >= 87',
  'edge >= 88',
  'firefox >= 78',
  'safari >= 14',
]);

console.log(esVersion); // 2017
```

### Type

```ts
// Only supports ES5 ~ ES2024
type ESVersion =
  | 5
  | 2015
  | 2016
  | 2017
  | 2018
  | 2019
  | 2020
  | 2021
  | 2022
  | 2023
  | 2024;

function browserslistToESVersion(browsers: string[]): ESVersion;
```

## Data source

- https://caniuse.com/sr-es15
- https://caniuse.com/?search=es2023
- https://caniuse.com/?search=es2022
- https://caniuse.com/?search=es2021
- https://caniuse.com/?search=es2020
- https://caniuse.com/?search=es2019
- https://caniuse.com/?search=es2018
- https://caniuse.com/?search=es2017
- https://caniuse.com/?search=es2016
- https://caniuse.com/?search=es2015
- https://caniuse.com/?search=es5

## License

[MIT](./LICENSE).

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