Skip to content

Commit 34607a6

Browse files
💥 refactor!: Use flat export style.
BREAKING CHANGE: The default export is gone.
1 parent 5ec9472 commit 34607a6

File tree

3 files changed

+55
-98
lines changed

3 files changed

+55
-98
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ See [docs](https://async-abstraction.github.io/tape/index.html).
99
> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime).
1010
1111
```js
12+
import { fromReadStream } from '@async-abstraction/tape' ;
1213
const stdin = fs.createReadStream( '/dev/stdin' , { encoding : 'utf8'} ) ;
13-
const myTape = tape.fromReadStream( stdin ) ;
14-
for await ( const character of myTape ) ... ;
14+
const tape = fromReadStream( stdin ) ;
15+
for await ( const character of tape ) ... ;
1516
```
1617

1718
[![License](https://img.shields.io/github/license/async-abstraction/tape.svg)](https://raw.githubusercontent.com/async-abstraction/tape/main/LICENSE)

doc/manual/example.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,40 @@ import tape from '@async-abstraction/tape' ;
1313
## `fromString`
1414

1515
```js
16-
import tape from '@async-abstraction/tape' ;
17-
const myTape = tape.fromString( 'abracadabra' ) ;
16+
import {
17+
fromString,
18+
fromArray,
19+
fromCallable,
20+
fromIterable,
21+
fromAsyncIterable,
22+
fromIterator,
23+
fromReadStream,
24+
} from '@async-abstraction/tape' ;
25+
const tape = fromString( 'abracadabra' ) ;
1826
// // OR
19-
// const myTape = tape.fromArray( ... ) ;
20-
// const myTape = tape.fromCallable( ... ) ;
21-
// const myTape = tape.fromIterable( ... ) ;
22-
// const myTape = tape.fromAsyncIterable( ... ) ;
23-
// const myTape = tape.fromIterator( ... ) ;
24-
// const myTape = tape.fromReadStream( ... ) ;
27+
// const tape = fromArray( ... ) ;
28+
// const tape = fromCallable( ... ) ;
29+
// const tape = fromIterable( ... ) ;
30+
// const tape = fromAsyncIterable( ... ) ;
31+
// const tape = fromIterator( ... ) ;
32+
// const tape = fromReadStream( ... ) ;
2533
```
2634

2735

2836
## `read` and `unread`
2937

3038
```js
31-
myTape.read()
32-
.then( character => console.log(character) ) // 'a'
33-
.then( () => myTape.read() )
34-
.then( character => console.log(character) ) // 'b'
35-
.then( () => myTape.unread('Z') )
36-
.then( () => myTape.unread('X') )
37-
.then( () => myTape.read() )
38-
.then( character => console.log(character) ) // 'X'
39-
.then( () => myTape.read() )
40-
.then( character => console.log(character) ) // 'Z'
41-
.then( () => myTape.read() )
42-
.then( character => console.log(character) ) // 'r'
43-
// ...
39+
tape.read()
40+
.then( character => console.log(character) ) // 'a'
41+
.then( () => tape.read() )
42+
.then( character => console.log(character) ) // 'b'
43+
.then( () => tape.unread('Z') )
44+
.then( () => tape.unread('X') )
45+
.then( () => tape.read() )
46+
.then( character => console.log(character) ) // 'X'
47+
.then( () => tape.read() )
48+
.then( character => console.log(character) ) // 'Z'
49+
.then( () => tape.read() )
50+
.then( character => console.log(character) ) // 'r'
51+
// ...
4452
```

src/index.js

Lines changed: 23 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,23 @@
1-
import eof from './eof.js';
2-
import Tape from './Tape.js';
3-
import asyncIterableChain from './asyncIterableChain.js';
4-
import asyncIterableMap from './asyncIterableMap.js';
5-
import asyncIterableToArray from './asyncIterableToArray.js';
6-
import chain from './chain.js';
7-
import exhaust from './exhaust.js';
8-
import fromArray from './fromArray.js';
9-
import fromAsyncIterable from './fromAsyncIterable.js';
10-
import fromCallable from './fromCallable.js';
11-
import fromIterable from './fromIterable.js';
12-
import fromIterator from './fromIterator.js';
13-
import fromReadStream from './fromReadStream.js';
14-
import fromString from './fromString.js';
15-
import ignore from './ignore.js';
16-
import map from './map.js';
17-
import skip from './skip.js';
18-
import split from './split.js';
19-
import toArray from './toArray.js';
20-
import toAsyncCallable from './toAsyncCallable.js';
21-
import toAsyncIterable from './toAsyncIterable.js';
22-
import toAsyncIterator from './toAsyncIterator.js';
23-
import toString from './toString.js';
24-
25-
export default {
26-
eof,
27-
Tape,
28-
asyncIterableChain,
29-
asyncIterableMap,
30-
asyncIterableToArray,
31-
chain,
32-
exhaust,
33-
fromArray,
34-
fromAsyncIterable,
35-
fromCallable,
36-
fromIterable,
37-
fromIterator,
38-
fromReadStream,
39-
fromString,
40-
ignore,
41-
map,
42-
skip,
43-
split,
44-
toArray,
45-
toAsyncCallable,
46-
toAsyncIterable,
47-
toAsyncIterator,
48-
toString
49-
};
50-
51-
export {
52-
eof,
53-
Tape,
54-
asyncIterableChain,
55-
asyncIterableMap,
56-
asyncIterableToArray,
57-
chain,
58-
exhaust,
59-
fromArray,
60-
fromAsyncIterable,
61-
fromCallable,
62-
fromIterable,
63-
fromIterator,
64-
fromReadStream,
65-
fromString,
66-
ignore,
67-
map,
68-
skip,
69-
split,
70-
toArray,
71-
toAsyncCallable,
72-
toAsyncIterable,
73-
toAsyncIterator,
74-
toString
75-
};
1+
export {default as Tape} from './Tape.js';
2+
export {default as asyncIterableChain} from './asyncIterableChain.js';
3+
export {default as asyncIterableMap} from './asyncIterableMap.js';
4+
export {default as asyncIterableToArray} from './asyncIterableToArray.js';
5+
export {default as chain} from './chain.js';
6+
export {default as eof} from './eof.js';
7+
export {default as exhaust} from './exhaust.js';
8+
export {default as fromArray} from './fromArray.js';
9+
export {default as fromAsyncIterable} from './fromAsyncIterable.js';
10+
export {default as fromCallable} from './fromCallable.js';
11+
export {default as fromIterable} from './fromIterable.js';
12+
export {default as fromIterator} from './fromIterator.js';
13+
export {default as fromReadStream} from './fromReadStream.js';
14+
export {default as fromString} from './fromString.js';
15+
export {default as ignore} from './ignore.js';
16+
export {default as map} from './map.js';
17+
export {default as skip} from './skip.js';
18+
export {default as split} from './split.js';
19+
export {default as toArray} from './toArray.js';
20+
export {default as toAsyncCallable} from './toAsyncCallable.js';
21+
export {default as toAsyncIterable} from './toAsyncIterable.js';
22+
export {default as toAsyncIterator} from './toAsyncIterator.js';
23+
export {default as toString} from './toString.js';

0 commit comments

Comments
 (0)