Skip to content

Commit 05b9ac0

Browse files
committed
Require Node.js 6
1 parent 4fddd22 commit 05b9ac0

10 files changed

+81
-92
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true
99

10-
[{package.json,*.yml}]
10+
[*.yml]
1111
indent_style = space
1212
indent_size = 2

.gitattributes

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
* text=auto
2-
*.js text eol=lf
1+
* text=auto eol=lf

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
yarn.lock

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
sudo: false
21
language: node_js
32
node_js:
3+
- '10'
4+
- '8'
45
- '6'
5-
- '4'

index.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
const from = require('from2');
33
const pIsPromise = require('p-is-promise');
44

5-
module.exports = x => {
6-
if (Array.isArray(x)) {
7-
x = x.slice();
5+
module.exports = input => {
6+
if (Array.isArray(input)) {
7+
input = input.slice();
88
}
99

1010
let promise;
1111
let iterator;
1212

13-
prepare(x);
13+
prepare(input);
1414

1515
function prepare(value) {
16-
x = value;
17-
promise = pIsPromise(x) ? x : null;
18-
// we don't iterate on strings and buffers since slicing them is ~7x faster
19-
const shouldIterate = !promise && x[Symbol.iterator] && typeof x !== 'string' && !Buffer.isBuffer(x);
20-
iterator = shouldIterate ? x[Symbol.iterator]() : null;
16+
input = value;
17+
promise = pIsPromise(input) ? input : null;
18+
// We don't iterate on strings and buffers since slicing them is ~7x faster
19+
const shouldIterate = !promise && input[Symbol.iterator] && typeof input !== 'string' && !Buffer.isBuffer(input);
20+
iterator = shouldIterate ? input[Symbol.iterator]() : null;
2121
}
2222

2323
return from(function reader(size, cb) {
@@ -32,32 +32,32 @@ module.exports = x => {
3232
return;
3333
}
3434

35-
if (x.length === 0) {
35+
if (input.length === 0) {
3636
setImmediate(cb, null, null);
3737
return;
3838
}
3939

40-
const chunk = x.slice(0, size);
41-
x = x.slice(size);
40+
const chunk = input.slice(0, size);
41+
input = input.slice(size);
4242

4343
setImmediate(cb, null, chunk);
4444
});
4545
};
4646

47-
module.exports.obj = x => {
48-
if (Array.isArray(x)) {
49-
x = x.slice();
47+
module.exports.obj = input => {
48+
if (Array.isArray(input)) {
49+
input = input.slice();
5050
}
5151

5252
let promise;
5353
let iterator;
5454

55-
prepare(x);
55+
prepare(input);
5656

5757
function prepare(value) {
58-
x = value;
59-
promise = pIsPromise(x) ? x : null;
60-
iterator = !promise && x[Symbol.iterator] ? x[Symbol.iterator]() : null;
58+
input = value;
59+
promise = pIsPromise(input) ? input : null;
60+
iterator = !promise && input[Symbol.iterator] ? input[Symbol.iterator]() : null;
6161
}
6262

6363
return from.obj(function reader(size, cb) {
@@ -72,7 +72,7 @@ module.exports.obj = x => {
7272
return;
7373
}
7474

75-
this.push(x);
75+
this.push(input);
7676

7777
setImmediate(cb, null, null);
7878
});

license

+4-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
The MIT License (MIT)
1+
MIT License
22

33
Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
116

12-
The above copyright notice and this permission notice shall be included in
13-
all copies or substantial portions of the Software.
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
148

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

package.json

+48-48
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
{
2-
"name": "into-stream",
3-
"version": "3.1.0",
4-
"description": "Convert a buffer/string/array/object/iterable/promise into a stream",
5-
"license": "MIT",
6-
"repository": "sindresorhus/into-stream",
7-
"author": {
8-
"name": "Sindre Sorhus",
9-
"email": "[email protected]",
10-
"url": "sindresorhus.com"
11-
},
12-
"engines": {
13-
"node": ">=4"
14-
},
15-
"scripts": {
16-
"test": "xo && ava"
17-
},
18-
"files": [
19-
"index.js"
20-
],
21-
"keywords": [
22-
"stream",
23-
"buffer",
24-
"string",
25-
"object",
26-
"array",
27-
"iterable",
28-
"promise",
29-
"promises",
30-
"from",
31-
"into",
32-
"to",
33-
"transform",
34-
"convert",
35-
"readable",
36-
"pull",
37-
"gulpfriendly",
38-
"value",
39-
"str"
40-
],
41-
"dependencies": {
42-
"from2": "^2.1.1",
43-
"p-is-promise": "^1.1.0"
44-
},
45-
"devDependencies": {
46-
"ava": "*",
47-
"get-stream": "^3.0.0",
48-
"xo": "*"
49-
}
2+
"name": "into-stream",
3+
"version": "3.1.0",
4+
"description": "Convert a buffer/string/array/object/iterable/promise into a stream",
5+
"license": "MIT",
6+
"repository": "sindresorhus/into-stream",
7+
"author": {
8+
"name": "Sindre Sorhus",
9+
"email": "[email protected]",
10+
"url": "sindresorhus.com"
11+
},
12+
"engines": {
13+
"node": ">=6"
14+
},
15+
"scripts": {
16+
"test": "xo && ava"
17+
},
18+
"files": [
19+
"index.js"
20+
],
21+
"keywords": [
22+
"stream",
23+
"buffer",
24+
"string",
25+
"object",
26+
"array",
27+
"iterable",
28+
"promise",
29+
"promises",
30+
"from",
31+
"into",
32+
"to",
33+
"transform",
34+
"convert",
35+
"readable",
36+
"pull",
37+
"gulpfriendly",
38+
"value",
39+
"str"
40+
],
41+
"dependencies": {
42+
"from2": "^2.1.1",
43+
"p-is-promise": "^1.1.0"
44+
},
45+
"devDependencies": {
46+
"ava": "*",
47+
"get-stream": "^3.0.0",
48+
"xo": "*"
49+
}
5050
}

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Correctly chunks up the input and handles backpressure.
88
## Install
99

1010
```
11-
$ npm install --save into-stream
11+
$ npm install into-stream
1212
```
1313

1414

test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import test from 'ava';
22
import getStream from 'get-stream';
3-
import m from './';
3+
import m from '.';
44

55
const fixture = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.';
66

77
function iterableFrom(arr) {
88
return {
9-
[Symbol.iterator]: function * () {
9+
* [Symbol.iterator]() {
1010
let i = 0;
1111
while (i < arr.length) {
1212
yield arr[i++];

0 commit comments

Comments
 (0)