Stage3

GitHub version deno land npm version Coverage Status

Polyfill for TC39 Stage 3 proposals

https://github.com/tc39/proposals#stage-3

Installation

Node.js

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

Deno

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

Usage

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

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

// Assert
assertEquals(result, resolvedValue);