Skip to content

Commit

Permalink
⚡ first version
Browse files Browse the repository at this point in the history
  • Loading branch information
robinpokorny committed Jul 13, 2021
1 parent 237e8d8 commit 82e1ddc
Show file tree
Hide file tree
Showing 19 changed files with 252 additions and 227 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI
on: [push]
jobs:
build:
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['12.x', '14.x', '16.x']
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Test
run: yarn test

- name: Build
run: yarn build
29 changes: 0 additions & 29 deletions dist/index.cjs

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.cjs.map

This file was deleted.

25 changes: 0 additions & 25 deletions dist/index.esm.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.esm.js.map

This file was deleted.

29 changes: 0 additions & 29 deletions dist/index.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.js.map

This file was deleted.

25 changes: 0 additions & 25 deletions dist/index.mjs

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.mjs.map

This file was deleted.

35 changes: 0 additions & 35 deletions dist/index.umd.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.umd.js.map

This file was deleted.

7 changes: 0 additions & 7 deletions dist/index.umd.min.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.umd.min.js.map

This file was deleted.

52 changes: 28 additions & 24 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,59 @@ Promise Throttle All

### Type aliases

- [NumberParseable](README.md#numberparseable)
- [Task](README.md#task)

### Functions

- [isNumberParseable](README.md#isnumberparseable)
- [throttleAll](README.md#throttleall)

## Type aliases

### NumberParseable
### Task

Ƭ **NumberParseable**: `number` \| `string` \| `boolean` & { `isNumberParseble`: unique `symbol` }
Ƭ **Task**<`T`\>: () => `Promise`<`T`\>

A Branded Type for values parseable to number.
#### Type parameters

#### Defined in
| Name |
| :------ |
| `T` |

[index.ts:4](https://github.com/robinpokorny/promise-throttle-all/blob/fb30276/src/index.ts#L4)
#### Type declaration

## Functions
▸ (): `Promise`<`T`\>

### isNumberParseable
##### Returns

`Const` **isNumberParseable**(`value`): value is NumberParseable
`Promise`<`T`\>

#### Defined in

[index.ts:1](https://github.com/robinpokorny/promise-throttle-all/blob/237e8d8/src/index.ts#L1)

## Functions

Check if value is parseable to number.
### throttleAll

**`example`** ```ts
isNumberParseable('AAAA');
//=> false
`Const` **throttleAll**<`T`\>(`limit`, `tasks`): `Promise`<`T`[]\>

isNumberParseable('100');
//=> true
#### Type parameters

if (!isNumberParseable(value))
throw new Error('Value can\'t be parseable to `Number`.')
return Number(value);
```
@param value - An `unknown` value to be checked.
| Name |
| :------ |
| `T` |

#### Parameters

| Name | Type |
| :------ | :------ |
| `value` | `unknown` |
| `limit` | `number` |
| `tasks` | [`Task`](README.md#task)<`T`\>[] |

#### Returns

value is NumberParseable
`Promise`<`T`[]\>

#### Defined in

[index.ts:23](https://github.com/robinpokorny/promise-throttle-all/blob/fb30276/src/index.ts#L23)
[index.ts:3](https://github.com/robinpokorny/promise-throttle-all/blob/237e8d8/src/index.ts#L3)
20 changes: 17 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,23 @@
"url": "git+https://github.com/robinpokorny/promise-throttle-all.git"
},
"keywords": [
"typescript",
"boilerplate",
"library"
"promise",
"throttle",
"limit",
"limited",
"concurrency",
"rate",
"batch",
"ratelimit",
"queue",
"discard",
"async",
"await",
"promises",
"time",
"out",
"wip",
"cancel"
],
"bugs": {
"url": "https://github.com/robinpokorny/promise-throttle-all/issues"
Expand Down
14 changes: 7 additions & 7 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @ts-check

import { terser } from 'rollup-plugin-terser';
import typescript2 from 'rollup-plugin-typescript2';
import { terser } from 'rollup-plugin-terser'
import typescript2 from 'rollup-plugin-typescript2'

import pkg from './package.json';
import pkg from './package.json'

/**
* Comment with library information to be appended in the generated bundles.
Expand All @@ -13,7 +13,7 @@ const banner = `/*!
* (c) ${pkg.author.name}
* Released under the ${pkg.license} License.
*/
`;
`

/**
* Creates an output options object for Rollup.js.
Expand All @@ -27,7 +27,7 @@ function createOutputOptions(options) {
exports: 'named',
sourcemap: true,
...options,
};
}
}

/**
Expand Down Expand Up @@ -69,6 +69,6 @@ const options = {
tsconfig: './tsconfig.bundle.json',
}),
],
};
}

export default options;
export default options
Loading

0 comments on commit 82e1ddc

Please sign in to comment.