Home / File/ promise.js — fastify Source File

promise.js — fastify Source File

Architecture documentation for promise.js, a javascript file in the fastify codebase.

Entity Profile

Relationship Graph

Source Code

'use strict'

const { kTestInternals } = require('./symbols')

function withResolvers () {
  let res, rej
  const promise = new Promise((resolve, reject) => {
    res = resolve
    rej = reject
  })
  return { promise, resolve: res, reject: rej }
}

module.exports = {
  // TODO(20.x): remove when node@20 is not supported
  withResolvers: typeof Promise.withResolvers === 'function'
    ? Promise.withResolvers.bind(Promise) // Promise.withResolvers must bind to itself
    /* c8 ignore next */
    : withResolvers, // Tested using the kTestInternals
  [kTestInternals]: {
    withResolvers
  }
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does promise.js do?
promise.js is a source file in the fastify codebase, written in javascript. It belongs to the CoreKernel domain, LifecycleManager subdomain.
What functions are defined in promise.js?
promise.js defines 1 function(s): withResolvers.
Where is promise.js in the architecture?
promise.js is located at lib/promise.js (domain: CoreKernel, subdomain: LifecycleManager, directory: lib).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free