????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.23.61.129 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/forge/node_modules/es6-promise/lib/es6-promise/ |
Upload File : |
import { isArray, isMaybeThenable } from './utils'; import { noop, reject, fulfill, subscribe, FULFILLED, REJECTED, PENDING, handleMaybeThenable } from './-internal'; import then from './then'; import Promise from './promise'; import originalResolve from './promise/resolve'; import originalThen from './then'; import { makePromise, PROMISE_ID } from './-internal'; function validationError() { return new Error('Array Methods must be provided an Array'); }; export default class Enumerator { constructor(Constructor, input) { this._instanceConstructor = Constructor; this.promise = new Constructor(noop); if (!this.promise[PROMISE_ID]) { makePromise(this.promise); } if (isArray(input)) { this.length = input.length; this._remaining = input.length; this._result = new Array(this.length); if (this.length === 0) { fulfill(this.promise, this._result); } else { this.length = this.length || 0; this._enumerate(input); if (this._remaining === 0) { fulfill(this.promise, this._result); } } } else { reject(this.promise, validationError()); } } _enumerate(input) { for (let i = 0; this._state === PENDING && i < input.length; i++) { this._eachEntry(input[i], i); } } _eachEntry(entry, i) { let c = this._instanceConstructor; let { resolve } = c; if (resolve === originalResolve) { let then; let error; let didError = false; try { then = entry.then; } catch (e) { didError = true; error = e; } if (then === originalThen && entry._state !== PENDING) { this._settledAt(entry._state, i, entry._result); } else if (typeof then !== 'function') { this._remaining--; this._result[i] = entry; } else if (c === Promise) { let promise = new c(noop); if (didError) { reject(promise, error); } else { handleMaybeThenable(promise, entry, then); } this._willSettleAt(promise, i); } else { this._willSettleAt(new c(resolve => resolve(entry)), i); } } else { this._willSettleAt(resolve(entry), i); } } _settledAt(state, i, value) { let { promise } = this; if (promise._state === PENDING) { this._remaining--; if (state === REJECTED) { reject(promise, value); } else { this._result[i] = value; } } if (this._remaining === 0) { fulfill(promise, this._result); } } _willSettleAt(promise, i) { let enumerator = this; subscribe( promise, undefined, value => enumerator._settledAt(FULFILLED, i, value), reason => enumerator._settledAt(REJECTED, i, reason) ); } };