Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rspack-contrib/browserslist-to-es-version
Convert browserslist query to ECMAScript version.
https://github.com/rspack-contrib/browserslist-to-es-version
browserslist ecmascript
Last synced: about 1 month ago
JSON representation
Convert browserslist query to ECMAScript version.
- Host: GitHub
- URL: https://github.com/rspack-contrib/browserslist-to-es-version
- Owner: rspack-contrib
- License: mit
- Created: 2024-07-02T13:17:28.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-10T11:41:38.000Z (2 months ago)
- Last Synced: 2024-11-10T12:29:11.021Z (2 months ago)
- Topics: browserslist, ecmascript
- Language: JavaScript
- Homepage:
- Size: 64.5 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# browserslist-to-es-version
Convert [browserslist](https://github.com/browserslist/browserslist) query to ECMAScript version.
## 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 ~ ES2018
type ESVersion = 5 | 2015 | 2016 | 2017 | 2018;function browserslistToESVersion(browsers: string[]): ESVersion;
```## License
[MIT](./LICENSE).