Skip to content
Browse files

option to forbid 'end'

  • Loading branch information...
1 parent 1d93f42 commit e191d7b4c99634ee56ad20e4eb290f015a520af3 @dominictarr committed Jul 24, 2012
Showing with 4 additions and 8 deletions.
  1. +2 −7 index.js
  2. +2 −1 readme.markdown
View
9 index.js
@@ -105,7 +105,6 @@ function readableSpec (mac, stream, opts) {
function e (n) { return opts.name + '.emit(\''+n+'\')' }
function n (n) { return opts.name + '.'+n+'()' }
-
var onError = mac(function (err){
//'error' means the same thing as 'close'.
onClose.maybeOnce()
@@ -117,10 +116,6 @@ function readableSpec (mac, stream, opts) {
if(opts.debug) console.error(e('end'), err)
}, e('end'))
- if(opts.end !== false)
- onEnd.once()
- else onEnd.never()
-
.isPassed(function () {
a.equal(stream.readable, false, 'stream must not be readable on "end"')
})
@@ -141,8 +136,8 @@ function readableSpec (mac, stream, opts) {
stream.on('end', onEnd)
stream.on('data', onData)
- if(opts.end)
- onEnd.once()
+ if(opts.end !== false) onEnd.once()
+ else onEnd.never()
if(opts.error === false)
onError.never()
View
3 readme.markdown
@@ -43,12 +43,13 @@ is strongly recommended to implement `pause` and `resume`
If the option `{strict: true}` is passed, it means the stream is not allowed to emit
`'data'` or `'end'` when the stream is paused.
+If the option `{end: false}` is passed, then end may not be emitted.
+
``` js
spec(stream)
.readable()
.pausable({strict: true})) //strict is optional.
.validateOnExit()
-
```
### Through (sync writable and readable, aka: 'filter')

0 comments on commit e191d7b

Please sign in to comment.
Something went wrong with that request. Please try again.