Skip to content

Commit

Permalink
Refactor code-style
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 13, 2019
1 parent ae0b5d0 commit 1e482d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
20 changes: 12 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ function stream(processor) {
return true
}

// End the writing. Passes all arguments to a final `write`. Starts the
// process, which will trigger `error`, with a fatal error, if any; `data`,
// with the generated document in `string` form, if succesful. If messages
// are triggered during the process, those are triggerd as `warning`s.
// End the writing.
// Passes all arguments to a final `write`.
// Starts the process, which will trigger `error`, with a fatal error, if any;
// `data`, with the generated document in `string` form, if succesful.
// If messages are triggered during the process, those are triggerd as
// `warning`s.
function end() {
write.apply(null, arguments)

Expand Down Expand Up @@ -80,9 +82,10 @@ function stream(processor) {
}
}

// Pipe the processor into a writable stream. Basically `Stream#pipe`, but
// inlined and simplified to keep the bundled size down.
// See <https://github.com/nodejs/node/blob/master/lib/stream.js#L26>.
// Pipe the processor into a writable stream.
// Basically `Stream#pipe`, but inlined and simplified to keep the bundled
// size down.
// See: <https://github.com/nodejs/node/blob/43a5170/lib/internal/streams/legacy.js#L13>.
function pipe(dest, options) {
var settings = options || {}
var onend = once(onended)
Expand All @@ -93,7 +96,8 @@ function stream(processor) {
emitter.on('close', cleanup)

// If the `end` option is not supplied, `dest.end()` will be called when the
// `end` or `close` events are received. Only `dest.end()` once.
// `end` or `close` events are received
// Only `dest.end()` once.
if (!dest._isStdio && settings.end !== false) {
emitter.on('end', onend)
}
Expand Down
6 changes: 4 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ test('createStream', function(t) {
})
.on(
'data',
/* istanbul ignore next */ function() {
/* istanbul ignore next */
function() {
st.fail('should not trigger `data` if an error occurs')
}
)
Expand Down Expand Up @@ -168,7 +169,8 @@ test('createStream', function(t) {
})
.on(
'error',
/* istanbul ignore next */ function() {
/* istanbul ignore next */
function() {
st.fail('should not trigger `error`')
}
)
Expand Down

0 comments on commit 1e482d8

Please sign in to comment.