tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

async-value.js (745B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
      4 
      5 export function pending() {
      6  return { state: "pending" };
      7 }
      8 export function fulfilled(value) {
      9  return { state: "fulfilled", value };
     10 }
     11 export function rejected(value) {
     12  return { state: "rejected", value };
     13 }
     14 
     15 export function asSettled(value) {
     16  return value && value.state !== "pending" ? value : null;
     17 }
     18 
     19 export function isPending(value) {
     20  return value.state === "pending";
     21 }
     22 export function isFulfilled(value) {
     23  return value.state === "fulfilled";
     24 }
     25 export function isRejected(value) {
     26  return value.state === "rejected";
     27 }