Skip to content

Commit 2a55c87

Browse files
committed
Merge Symbol.asyncIterator into class, add full-test command for travis
1 parent d66896f commit 2a55c87

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ node_js:
44
- '6'
55
- '4'
66
- '4.5'
7+
install: make --no-builtin-rules --jobs=4
8+
script: make --no-builtin-rules full-test

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ build: node_modules ${build_files} ${build_asset_files} ${build_package_files}
4848

4949
# Tasks
5050

51+
full-test: lint test cover
52+
5153
lint:
5254
eslint lib
5355

lib/stream-async-iterator.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ export default class StreamAsyncIterator {
8787
stream.once('end', handleStreamEnd);
8888
}
8989

90+
/**
91+
* @returns {StreamAsyncIterator} - this
92+
*/
93+
[Symbol.asyncIterator]() {
94+
return this;
95+
}
96+
9097
/**
9198
* Returns the next iteration of data. Rejects if the stream errored out.
9299
* @returns {Promise<StreamAsyncIterator~Iteration>}
@@ -149,9 +156,3 @@ export default class StreamAsyncIterator {
149156
})
150157
}
151158
}
152-
if (typeof Symbol.asyncIterator === 'symbol') {
153-
Object.defineProperty(StreamAsyncIterator.prototype, Symbol.asyncIterator, {
154-
configurable: true,
155-
value: function() { return this; }
156-
});
157-
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "ES async interator wrapper for node streams",
55
"main": "stream-async-iterator.js",
66
"scripts": {
7-
"test": "make test"
7+
"test": "make full-test"
88
},
99
"repository": {
1010
"type": "git",

0 commit comments

Comments
 (0)