Showing 10 of 10 total issues
File Promise.ts
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict"; /** Module P: Generic Promises for TypeScript
Function unfoldCore
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function unfoldCore<Seed, Element>( elements: Element[], deferred: Deferred<Element[]>, unspool: (current: Seed) => { promise: Promise<Element>; next?: Seed }, seed: Seed): void
Similar blocks of code found in 2 locations. Consider refactoring. Open
fail(f: (err: Rejection) => void ): Deferred<Value> { if (this.status === Status.Rejected) { f(this._error); return this;
- Read upRead up
Similar blocks of code found in 2 locations. Consider refactoring. Open
done(f: (v: Value) => void ): Deferred<Value> { if (this.status === Status.Resolved) { f(this._result); return this;
- Read upRead up
Similar blocks of code found in 2 locations. Consider refactoring. Open
reject(err: Rejection) { if (this._status !== Status.Unfulfilled) throw new Error("tried to reject a fulfilled promise"); this._error = err;
- Read upRead up
Similar blocks of code found in 2 locations. Consider refactoring. Open
resolve(result: Value) { if (this._status !== Status.Unfulfilled) throw new Error("tried to resolve a fulfilled promise"); this._result = result;
- Read upRead up
Similar blocks of code found in 2 locations. Consider refactoring. Open
export function resolve<Value>(v: Value): Promise<Value> { return defer<Value>().resolve(v).promise(); }
- Read upRead up
Similar blocks of code found in 2 locations. Consider refactoring. Open
export function reject<Value>(err: Rejection): Promise<Value> { return defer<Value>().reject(err).promise(); }
- Read upRead up
Similar blocks of code found in 2 locations. Consider refactoring. Open
fail(f: (err: Rejection) => void ): Promise<Value> { this.deferred.fail(f); return this; }
- Read upRead up
Similar blocks of code found in 2 locations. Consider refactoring. Open
done(f: (v: Value) => void ): Promise<Value> { this.deferred.done(f); return this; }
- Read upRead up