(stream)
| 3731 | } |
| 3732 | |
| 3733 | function endReadable(stream) { |
| 3734 | var state = stream._readableState; |
| 3735 | |
| 3736 | // If we get here before consuming all the bytes, then that is a |
| 3737 | // bug in node. Should never happen. |
| 3738 | if (state.length > 0) |
| 3739 | throw new Error('endReadable called on non-empty stream'); |
| 3740 | |
| 3741 | if (!state.endEmitted && state.calledRead) { |
| 3742 | state.ended = true; |
| 3743 | process.nextTick(function() { |
| 3744 | // Check that we didn't get one last unshift. |
| 3745 | if (!state.endEmitted && state.length === 0) { |
| 3746 | state.endEmitted = true; |
| 3747 | stream.readable = false; |
| 3748 | stream.emit('end'); |
| 3749 | } |
| 3750 | }); |
| 3751 | } |
| 3752 | } |
| 3753 | |
| 3754 | function forEach (xs, f) { |
| 3755 | for (var i = 0, l = xs.length; i < l; i++) { |
no test coverage detected