Skip to content

Commit

Permalink
Upgrade deps and test on node 14 (#6)
Browse files Browse the repository at this point in the history
- Add node 14 to the actions workflow for testing
- Update api extractor and move back to a .json config file
- Update tslint and prettier and fix issues therein
- Update all warnings from api extractor, all external facing types are now exported

BREAKING CHANGE: Renamed some type names that were previously unexpected but were used by exported functions. Fixed some exported type definitions to be more correct. Dropping node 8 and targeting Node 10/ES2018.
  • Loading branch information
reconbot authored Jul 2, 2020
1 parent 5dce917 commit 65745f3
Show file tree
Hide file tree
Showing 36 changed files with 1,554 additions and 532 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
node-version: [10.x, 12.x, 14.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ rollup.config-esm.js
rollup.config-umd.js
budle-types.js
dist/tsdoc-metadata.json
SECURITY.md
api-extractor.json
.github
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ if ((Symbol as any).asyncIterator === undefined) {

### batch
```ts
function batch<T>(size: number, iterable: AsyncIterable<T>): AsyncIterableIterator<T[]>
function batch<T>(size: number, iterable: Iterable<T>): IterableIterator<T[]>
function batch<T>(size: number, iterable: AsyncIterable<T>): AsyncGenerator<T[]>
function batch<T>(size: number, iterable: Iterable<T>): Generator<T[]>
```

Batch objects from `iterable` into arrays of `size` length. The final array may be shorter than size if there is not enough items. Returns a sync iterator if the `iterable` is sync, otherwise an async iterator. Errors from the source `iterable` are immediately raised.
Expand All @@ -90,8 +90,8 @@ for await (const pokemons of batch(10, getPokemon())) {

### buffer
```ts
function buffer<T>(size: number, iterable: AsyncIterable<T>): AsyncIterableIterator<T>
function buffer<T>(size: number, iterable: Iterable<T>): IterableIterator<T>
function buffer<T>(size: number, iterable: AsyncIterable<T>): AsyncIterable<T>
function buffer<T>(size: number, iterable: Iterable<T>): AsyncIterable<T>
```
Buffer keeps a number of objects in reserve available for immediate reading. This is helpful with async iterators as it will prefetch results so you don't have to wait for them to load. For sync iterables it will precompute up to `size` values and keep them in reserve. The internal buffer will start to be filled once `.next()` is called for the first time and will continue to fill until the source `iterable` is exhausted or the buffer is full. Errors from the source `iterable` will be raised after all buffered values are yielded.

Expand Down Expand Up @@ -125,8 +125,8 @@ console.log(await collect(getPokemon()))

### concat
```ts
function concat(...iterables: Array<Iterable<any>>): IterableIterator<any>
function concat(...iterables: Array<AnyIterable<any>>): AsyncIterableIterator<any>
function concat(...iterables: Array<Iterable<any>>): Iterable<any>
function concat(...iterables: Array<AnyIterable<any>>): AsyncIterable<any>
```

Combine multiple iterators into a single iterable. Reads each iterable completely one at a time. Returns a sync iterator if all `iterables` are sync, otherwise it returns an async iterable. Errors from the source `iterable` are raised immediately.
Expand Down Expand Up @@ -163,7 +163,7 @@ await consume(train(getPokemon())) // load all the pokemon and train them!

### flatMap
```ts
function flatMap<T, B>(func: (data: T) => FlatMapValue<B>, iterable: AnyIterable<T>): AsyncIterableIterator<B>
function flatMap<T, B>(func: (data: T) => FlatMapValue<B>, iterable: AnyIterable<T>): AsyncGenerator<B>
```

Map `func` over the `iterable`, flatten the result and then ignore all null or undefined values. It's the transform function we've always needed. It's equivalent to;
Expand Down
Loading

0 comments on commit 65745f3

Please sign in to comment.