0.8.0 • Published 1 year ago

ast-metadata-inferer v0.8.0

Weekly downloads
247,798
License
MIT
Repository
github
Last release
1 year ago

ast-metadata-inferer

Test

A 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.

For all the API's it supports, it gives the

  • AST node type of the API (MemberExpression, NewExpression, or CallExpression)
  • Determines if an API is statically invoked (ex. document.querySelector())
  • Determines if an API is a CSS or JS API
  • Provides compatibility information from @mdn/browser-compat-data

Usage

import AstMetadata from "ast-metadata-inferer";

const [firstRecord] = AstMetadata;
console.log(firstRecord);
// {
//   "language":"js-api",
//   "protoChain":["document","querySelector"],
//   "protoChainId":"document.querySelector",
//   "astNodeTypes":["MemberExpression"],
//   "isStatic":true,
//   "compat": {
//     support: {
//       chrome: {
//         version_added: "14"
//       },
//       chrome_android: { version_added: "18" },
//       ...
//     }
//   }
// }

Related