UNPKG

1.33 kBMarkdownView Raw
1# ast-metadata-inferer
2
3[![Test](https://github.com/amilajack/ast-metadata-inferer/actions/workflows/test.yml/badge.svg)](https://github.com/amilajack/ast-metadata-inferer/actions/workflows/test.yml)
4
5A collection of metadata about browser API's. This collection is intended for tools that analyze JS. It currently supports more than 6,000 compatibility records.
6
7For all the API's it supports, it gives the
8
9- AST node type of the API (`MemberExpression`, `NewExpression`, or `CallExpression`)
10- Determines if an API is statically invoked (ex. `document.querySelector()`)
11- Determines if an API is a CSS or JS API
12- Provides compatibility information from `@mdn/browser-compat-data`
13
14## Usage
15
16```js
17import AstMetadata from "ast-metadata-inferer";
18
19const [firstRecord] = AstMetadata;
20console.log(firstRecord);
21// {
22// "language":"js-api",
23// "protoChain":["document","querySelector"],
24// "protoChainId":"document.querySelector",
25// "astNodeTypes":["MemberExpression"],
26// "isStatic":true,
27// "compat": {
28// support: {
29// chrome: {
30// version_added: "14"
31// },
32// chrome_android: { version_added: "18" },
33// ...
34// }
35// }
36// }
37```
38
39## Related
40
41- [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat)
42- [compat-db](https://github.com/amilajack/compat-db)