Skip to content

Commit

Permalink
feat: Added a few new functions: 'getAppropriateEcmaVersionForBrowser…
Browse files Browse the repository at this point in the history
…slist', 'browserslistSupportsEcmaVersion', and 'browsersWithSupportForEcmaVersion'
  • Loading branch information
wessberg committed Oct 10, 2018
1 parent e9308ec commit 8173687
Show file tree
Hide file tree
Showing 6 changed files with 277 additions and 349 deletions.
290 changes: 0 additions & 290 deletions CHANGELOG.md

This file was deleted.

27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,39 @@ MIT © [Frederik Wessberg](https://github.com/wessberg)

##### `browsersWithSupportForFeatures (...features: string[]): string[]`

Takes any amount of [caniuse](https://caniuse.com/) or [MDN](https://github.com/mdn/browser-compat-data) features and generates a browserslist that targets all browsers that support these features
Takes any amount of [caniuse](https://caniuse.com/) or [MDN](https://github.com/mdn/browser-compat-data) features and generates a [browserslist](https://github.com/browserslist/browserslist) that targets all browsers that support these features

##### `browsersWithoutSupportForFeatures (...features: string[]): string[]`

Takes any amount of [caniuse](https://caniuse.com/) or [MDN](https://github.com/mdn/browser-compat-data) features and generates a browserslist that targets all browsers that _doesn't_ support these features
Takes any amount of [caniuse](https://caniuse.com/) or [MDN](https://github.com/mdn/browser-compat-data) features and generates a [browserslist](https://github.com/browserslist/browserslist) that targets all browsers that _doesn't_ support these features

##### `browsersWithSupportForEcmaVersion (version: EcmaVersion): string[]`

Generates a [browserslist](https://github.com/browserslist/browserslist) that targets all the browsers that support the given Ecma version.

Possible Ecma versions are:

- `es3`
- `es5`
- `es2015`
- `es2016`
- `es2017`
- `es2018`

##### `browserslistSupportsFeatures (browserslist: string[], ...features: string[]): boolean`

Returns true if the given [browserslist](https://github.com/browserslist/browserslist) supports all of the given [caniuse](https://caniuse.com/) or [MDN](https://github.com/mdn/browser-compat-data) features

##### `browserslistSupportsEcmaVersion (browserslist: string[], version: EcmaVersion): boolean`

Returns true if the given [browserslist](https://github.com/browserslist/browserslist) supports the given Ecma version.
See [this section](#browserswithsupportforecmaversion-version-ecmaversion-string) for an overview of all supported Ecma versions.

##### `getAppropriateEcmaVersionForBrowserslist (browserslist: string[]): EcmaVersion`

Gets the Ecma version that is most appropriate for the given [browserslist](https://github.com/browserslist/browserslist).
See [this section](#browserswithsupportforecmaversion-version-ecmaversion-string) for an overview of all supported Ecma versions.

#### `matchBrowserslistOnUserAgent (userAgent: string, browserslist: string[]): boolean`

Will check if the given user agent string matches the given browserslist and return true if so.
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@
"@wessberg/ts-config": "0.0.30",
"ava": "^0.25.0",
"conventional-changelog-cli": "^2.0.5",
"husky": "^1.0.0-rc.15",
"husky": "^1.1.1",
"tslint": "^5.11.0",
"typescript": "^3.0.3"
"typescript": "^3.1.2"
},
"dependencies": {
"@types/object-path": "^0.9.29",
"@types/semver": "^5.5.0",
"@types/ua-parser-js": "^0.7.32",
"browserslist": "^4.1.1",
"caniuse-lite": "^1.0.30000887",
"mdn-browser-compat-data": "0.0.51",
"browserslist": "^4.2.0",
"caniuse-lite": "^1.0.30000890",
"mdn-browser-compat-data": "0.0.53",
"object-path": "^0.11.4",
"semver": "^5.5.1",
"tslib": "^1.9.3",
Expand Down
Loading

0 comments on commit 8173687

Please sign in to comment.