Skip to content

Commit 410391c

Browse files
committed
chore(package): update dependencies
1 parent 8c3d083 commit 410391c

File tree

9 files changed

+2461
-1732
lines changed

9 files changed

+2461
-1732
lines changed

.babelrc.js

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,44 @@
1-
'use strict'
1+
"use strict";
22

3-
const NODE_ENV = process.env.NODE_ENV || 'development'
4-
const __PROD__ = NODE_ENV === 'production'
5-
const __TEST__ = NODE_ENV === 'test'
3+
const NODE_ENV = process.env.NODE_ENV || "development";
4+
const __PROD__ = NODE_ENV === "production";
5+
const __TEST__ = NODE_ENV === "test";
66

7-
const pkg = require('./package')
7+
const pkg = require("./package");
88

9-
const plugins = {
10-
lodash: {},
11-
}
9+
const plugins = {};
1210

1311
const presets = {
14-
'@babel/preset-env': {
12+
"@babel/preset-env": {
1513
debug: !__TEST__,
1614
loose: true,
17-
shippedProposals: true,
18-
targets: __PROD__
19-
? (() => {
20-
let node = (pkg.engines || {}).node
21-
if (node !== undefined) {
22-
const trimChars = '^=>~'
23-
while (trimChars.includes(node[0])) {
24-
node = node.slice(1)
25-
}
26-
return { node: node }
15+
targets: (() => {
16+
let node = (pkg.engines || {}).node;
17+
if (node !== undefined) {
18+
const trimChars = "^=>~";
19+
while (trimChars.includes(node[0])) {
20+
node = node.slice(1);
2721
}
28-
})()
29-
: { browsers: '', node: 'current' },
30-
useBuiltIns: '@babel/polyfill' in (pkg.dependencies || {}) && 'usage',
22+
}
23+
return { browsers: pkg.browserslist, node };
24+
})(),
3125
},
32-
}
26+
};
3327

3428
Object.keys(pkg.devDependencies || {}).forEach(name => {
35-
if (!(name in presets) && /@babel\/plugin-.+/.test(name)) {
36-
plugins[name] = {}
37-
} else if (!(name in presets) && /@babel\/preset-.+/.test(name)) {
38-
presets[name] = {}
29+
if (!(name in presets) && /^(?:@babel\/|babel-)plugin-.+$/.test(name)) {
30+
plugins[name] = {};
31+
} else if (
32+
!(name in presets) &&
33+
/^(?:@babel\/|babel-)preset-.+$/.test(name)
34+
) {
35+
presets[name] = {};
3936
}
40-
})
37+
});
4138

4239
module.exports = {
4340
comments: !__PROD__,
4441
ignore: __TEST__ ? undefined : [/\.spec\.js$/],
4542
plugins: Object.keys(plugins).map(plugin => [plugin, plugins[plugin]]),
4643
presets: Object.keys(presets).map(preset => [preset, presets[preset]]),
47-
}
44+
};

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ indent_style = space
2222

2323
# Markdown
2424
[*.{md,mdwn,mdown,markdown}]
25-
indent_size = 4
25+
indent_size = 2
2626
indent_style = space
2727
trim_trailing_whitespace = false
2828

.eslintrc.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
module.exports = {
2-
extends: ['standard'],
3-
parser: 'babel-eslint',
2+
env: { es6: true },
3+
4+
// use standard configuration and disable rules handled by prettier
5+
extends: ["standard", "prettier"],
6+
47
rules: {
5-
'comma-dangle': ['error', 'always-multiline'],
6-
'no-var': 'error',
7-
'node/no-extraneous-import': 'error',
8-
'node/no-extraneous-require': 'error',
9-
'node/no-missing-require': 'error',
10-
'node/no-missing-import': 'error',
11-
'prefer-const': 'error',
8+
// prefer let/const over var
9+
"no-var": "error",
10+
11+
// prefer const over let when possible
12+
//
13+
// should be included in standard: https://github.com/standard/eslint-config-standard/pull/133/
14+
"prefer-const": "error",
15+
16+
// detect incorrect import/require
17+
"node/no-extraneous-import": "error",
18+
"node/no-extraneous-require": "error",
19+
"node/no-missing-require": "error",
20+
"node/no-missing-import": "error",
1221
},
13-
}
22+
};

.prettierrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
// this really improves diffs
3+
trailingComma: "es5",
4+
};

README.md

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,22 @@ Installation of the [npm package](https://npmjs.org/package/async-iterator-to-st
1818
## Usage
1919

2020
```js
21-
const asyncIteratorToStream = require('async-iterator-to-stream')
21+
const asyncIteratorToStream = require("async-iterator-to-stream");
2222

2323
// sync/async iterators
24-
asyncIteratorToStream(new Set(['foo', 'bar']).values())
25-
.pipe(output)
24+
asyncIteratorToStream(new Set(["foo", "bar"]).values()).pipe(output);
2625

2726
// sync/async iterables
28-
asyncIteratorToStream.obj([1, 2, 3])
29-
.pipe(output)
27+
asyncIteratorToStream.obj([1, 2, 3]).pipe(output);
3028

3129
// if you pass a sync/async generator, it will return a factory instead of a
3230
// stream
33-
const createRangeStream = asyncIteratorToStream.obj(function * (n) {
31+
const createRangeStream = asyncIteratorToStream.obj(function*(n) {
3432
for (let i = 0; i < n; ++i) {
35-
yield i
33+
yield i;
3634
}
37-
})
38-
createRangeStream(10)
39-
.pipe(output)
35+
});
36+
createRangeStream(10).pipe(output);
4037
```
4138

4239
## Example
@@ -45,30 +42,30 @@ Let's implement a simpler `fs.createReadStream` to illustrate the usage of this
4542
library.
4643

4744
```js
48-
const asyncIteratorToStream = require('async-iterator-to-stream')
45+
const asyncIteratorToStream = require("async-iterator-to-stream");
4946

5047
// promisified fs
51-
const fs = require('mz/fs')
48+
const fs = require("mz/fs");
5249

53-
const createReadStream = asyncIteratorToStream(async function * (file) {
54-
const fd = await fs.open(file, 'r')
50+
const createReadStream = asyncIteratorToStream(async function*(file) {
51+
const fd = await fs.open(file, "r");
5552
try {
56-
let size = yield
53+
let size = yield;
5754
while (true) {
58-
const buf = Buffer.alloc(size)
59-
const [n] = await fs.read(fd, buf, 0, size, null)
55+
const buf = Buffer.alloc(size);
56+
const [n] = await fs.read(fd, buf, 0, size, null);
6057
if (n < size) {
61-
yield buf.slice(0, n)
62-
return
58+
yield buf.slice(0, n);
59+
return;
6360
}
64-
size = yield buf
61+
size = yield buf;
6562
}
6663
} finally {
67-
await fs.close(fd)
64+
await fs.close(fd);
6865
}
69-
})
66+
});
7067

71-
createReadStream('foo.txt').pipe(process.stdout)
68+
createReadStream("foo.txt").pipe(process.stdout);
7269
```
7370

7471
> If your environment does not support async generators, you may use a sync
@@ -95,7 +92,7 @@ createReadStream('foo.txt').pipe(process.stdout)
9592

9693
## Contributions
9794

98-
Contributions are *very* welcomed, either on the documentation or on
95+
Contributions are _very_ welcomed, either on the documentation or on
9996
the code.
10097

10198
You may:

0 commit comments

Comments
 (0)