Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/myty/stage3

Polyfill for TC39 Stage 3 proposals
https://github.com/myty/stage3

Last synced: 1 day ago
JSON representation

Polyfill for TC39 Stage 3 proposals

Awesome Lists containing this project

README

        

# Stage3

[![GitHub version](https://badgen.net/github/release/myty/stage3?color=green)](https://github.com/myty/stage3)
[![deno land](https://badgen.net/github/release/myty/stage3?color=green&label=deno.land)](https://deno.land/x/stage3)
[![npm version](https://badgen.net/npm/v/@myty/stage3?color=green)](https://www.npmjs.com/package/@myty/stage3)
[![Coverage Status](https://badgen.net/coveralls/c/github/myty/stage3?color=green)](https://coveralls.io/github/myty/stage3?branch=main)

Polyfill for TC39 Stage 3 proposals

## Installation

### Node.js

```bash
# npm
npm install --save @myty/stage3
# yarn
yarn add @myty/stage3
# pnpm
pnpm install --save @myty/stage3
```

### Deno

```bash
import "https://deno.land/x/stage3/mod.ts";
import "https://deno.land/x/stage3/promise-with-resolvers.ts";
```

### Usage

```ts
import "@myty/stage3/script/promise-with-resolvers"; // Node.js (commonjs)
import "@myty/stage3/esm/promise-with-resolvers"; // Node.js (module)
import "https://deno.land/x/stage3/promise-with-resolvers.ts"; // Deno

// Arrange
const resolvedValue = 5;
const { resolve, promise } = Promise.withResolvers();

// Act
setTimeout(() => resolve(resolvedValue), 10);
const result = await promise;

// Assert
assertEquals(result, resolvedValue);
```