GitHub - es-shims/es-shim-api: API contract, and rudimentary tests, for modules that conform to the es-shim API (original) (raw)

es-shim API Version Badge

github actions coverage License Downloads

npm badge

API Contract

For any given “es-shim API v3”-compliant package foo, the following invariants must hold:

Multi-shim Packages

If your package contains multiple shims, you can pass --multi to apply these invariants:

How to denote compliance

Prominently in the package’s README, please include the following markdown:

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.

Please modify “ES3” as needed to the level of support, and please update the spec link so it points directly to the most relevant section of the spec it complies with.

Binary

Very simple and shallow tests that a package follows the es-shim API.

Pass --bound to indicate that the function the package is implementing depends on having a receiver (a “this” value). In particular, this applies to something that is a prototype method, or a static method that depends on its receiver.

Example

es-shim-api object-assign es-shim-api array-includes --bound

Tests

Simply clone the repo, npm install, and run npm test