(Constructor, input)
| 488 | } |
| 489 | |
| 490 | function Enumerator(Constructor, input) { |
| 491 | this._instanceConstructor = Constructor; |
| 492 | this.promise = new Constructor(noop); |
| 493 | |
| 494 | if (!this.promise[PROMISE_ID]) { |
| 495 | makePromise(this.promise); |
| 496 | } |
| 497 | |
| 498 | if (isArray(input)) { |
| 499 | this._input = input; |
| 500 | this.length = input.length; |
| 501 | this._remaining = input.length; |
| 502 | |
| 503 | this._result = new Array(this.length); |
| 504 | |
| 505 | if (this.length === 0) { |
| 506 | fulfill(this.promise, this._result); |
| 507 | } else { |
| 508 | this.length = this.length || 0; |
| 509 | this._enumerate(); |
| 510 | if (this._remaining === 0) { |
| 511 | fulfill(this.promise, this._result); |
| 512 | } |
| 513 | } |
| 514 | } else { |
| 515 | _reject(this.promise, validationError()); |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | function validationError() { |
| 520 | return new Error('Array Methods must be provided an Array'); |
nothing calls this directly
no test coverage detected