Skip to content

Commit e6fd298

Browse files
committed
Auto-generated commit
1 parent 06c1c29 commit e6fd298

File tree

14 files changed

+69
-44
lines changed

14 files changed

+69
-44
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ indent_style = tab
4545
indent_style = space
4646
indent_size = 2
4747

48+
# Set properties for `cli_opts.json` files:
49+
[cli_opts.json]
50+
indent_style = tab
51+
4852
# Set properties for TypeScript files:
4953
[*.ts]
5054
indent_style = tab

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ jobs:
5353
id: tests
5454
run: |
5555
npm test || npm test || npm test
56-
- uses: act10ns/slack@v1
56+
- name: Send status to Slack channel in case of failure
57+
uses: act10ns/slack@v1
5758
with:
5859
status: ${{ job.status }}
5960
steps: ${{ toJson(steps) }}

.github/workflows/test_coverage.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,26 @@ jobs:
5151
timeout-minutes: 15
5252
- name: Upload coverage to Codecov
5353
id: upload
54-
uses: codecov/codecov-action@v1
54+
uses: codecov/codecov-action@v2
5555
with:
5656
directory: reports/coverage
5757
flags: unittests
5858
fail_ci_if_error: true
59+
- name: Extract coverage value and assign to output
60+
id: extract-coverage
61+
run: |
62+
coverage=`cat reports/coverage/lcov-report/index.html | grep "fraction" | grep -oP '\d+/\d+' | printf %s "$(cat)" | jq -R -s -c 'split("\n")'`
63+
echo "::set-output name=coverage::$coverage"
5964
- uses: act10ns/slack@v1
6065
with:
6166
status: ${{ job.status }}
6267
steps: ${{ toJson(steps) }}
6368
channel: '#npm-ci'
6469
if: failure()
70+
- name: Send Webhook with status to stdlib backend
71+
uses: distributhor/workflow-webhook@v2
72+
env:
73+
webhook_url: ${{ secrets.STDLIB_COVERAGE_URL }}
74+
webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }}
75+
data: '{ "coverage": ${{ steps.extract-coverage.outputs.coverage }}, "run_id": "${{ github.run_id }}" }'
76+
if: ${{ false }}

.github/workflows/test_install.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ on:
2727
workflow_run:
2828
workflows: ["Publish Package"]
2929
types: [completed]
30+
workflow_dispatch:
3031

3132
# Workflow jobs:
3233
jobs:
3334
on-success:
3435
runs-on: ubuntu-latest
3536
env:
3637
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
37-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
38+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
3839
steps:
3940
- uses: actions/checkout@v2
4041
- uses: actions/setup-node@v2
@@ -45,7 +46,8 @@ jobs:
4546
run: |
4647
npm install --only=prod || npm install --only=prod || npm install --only=prod
4748
timeout-minutes: 15
48-
- uses: act10ns/slack@v1
49+
- name: Send notification to Slack in case of failure
50+
uses: act10ns/slack@v1
4951
with:
5052
status: ${{ job.status }}
5153
steps: ${{ toJson(steps) }}

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Justin Dennison <justin1dennison@gmail.com>
1616
Marcus <mfantham@users.noreply.github.com>
1717
Matt Cochrane <matthew.cochrane.eng@gmail.com>
1818
Milan Raj <rajsite@users.noreply.github.com>
19+
Momtchil Momtchev <momtchil@momtchev.com>
1920
Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com>
2021
Philipp Burckhardt <pburckhardt@outlook.com>
2122
Ricky Reusser <rsreusser@gmail.com>

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# Dispatch
2222

23-
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
23+
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
2424

2525
> Create an [ndarray][@stdlib/ndarray/ctor] function interface which performs multiple dispatch.
2626
@@ -122,7 +122,7 @@ fcn( x, y );
122122
The function accepts the following arguments:
123123

124124
- **fcns**: list of [ndarray][@stdlib/ndarray/ctor] functions.
125-
- **types**: one-dimensional list of [ndarray][@stdlib/ndarray/ctor] argument data types. The length of `types` must be the number of [ndarray][@stdlib/ndarray/ctor] functions multiplied by `nin+nout`. If `fcns` is a function, rather than a list, the number of [ndarray][@stdlib/ndarray/ctor] functions is computed as `types.length / (nin+nout)`.
125+
- **types**: one-dimensional list of [ndarray][@stdlib/ndarray/ctor] argument [data types][@stdlib/ndarray/dtypes]. The length of `types` must be the number of [ndarray][@stdlib/ndarray/ctor] functions multiplied by `nin+nout`. If `fcns` is a function, rather than a list, the number of [ndarray][@stdlib/ndarray/ctor] functions is computed as `types.length / (nin+nout)`.
126126
- **data**: [ndarray][@stdlib/ndarray/ctor] function data (e.g., callbacks). If a list, the length of `data` must equal the number of [ndarray][@stdlib/ndarray/ctor] functions. If `null`, a returned [ndarray][@stdlib/ndarray/ctor] function interface does **not** provide a `data` argument to an invoked [ndarray][@stdlib/ndarray/ctor] function.
127127
- **nargs**: total number of [ndarray][@stdlib/ndarray/ctor] function interface arguments.
128128
- **nin**: number of input [ndarrays][@stdlib/ndarray/ctor].
@@ -319,9 +319,13 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
319319
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-dispatch/main.svg
320320
[coverage-url]: https://codecov.io/github/stdlib-js/ndarray-dispatch?branch=main
321321

322+
<!--
323+
322324
[dependencies-image]: https://img.shields.io/david/stdlib-js/ndarray-dispatch.svg
323325
[dependencies-url]: https://david-dm.org/stdlib-js/ndarray-dispatch/main
324326
327+
-->
328+
325329
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
326330
[chat-url]: https://gitter.im/stdlib-js/stdlib/
327331

@@ -337,6 +341,8 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
337341

338342
[@stdlib/ndarray/ctor]: https://github.com/stdlib-js/ndarray-ctor
339343

344+
[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes
345+
340346
<!-- </related-links> -->
341347

342348
</section>

docs/repl.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
traversing arrays remains the same, but the ndarray function `data`
3737
differs (e.g., callbacks which differ based on the array data types).
3838

39-
types: ArrayLikeObject<string>
39+
types: ArrayLikeObject
4040
One-dimensional list of ndarray argument data types.
4141

4242
data: ArrayLikeObject|null

docs/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ interface Dispatcher {
288288
* @param nin - number of input ndarrays
289289
* @param nout - number of output ndarrays
290290
* @throws first argument must be either a function or an array of functions
291-
* @throws second argument must be an array of strings
291+
* @throws second argument must be an array-like object
292292
* @throws third argument must be an array-like object or `null`
293293
* @throws third and first arguments must have the same number of elements
294294
* @throws fourth argument must be a positive integer
@@ -326,7 +326,7 @@ interface Dispatcher {
326326
* fcn( x, y );
327327
* // ybuf => <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]
328328
*/
329-
declare function dispatch( fcns: ndarrayFcn | ArrayLike<ndarrayFcn>, types: ArrayLike<string>, data: ArrayLike<any> | null, nargs: number, nin: number, nout: number ): Dispatcher; // tslint:disable-line:max-line-length
329+
declare function dispatch( fcns: ndarrayFcn | ArrayLike<ndarrayFcn>, types: ArrayLike<any>, data: ArrayLike<any> | null, nargs: number, nin: number, nout: number ): Dispatcher; // tslint:disable-line:max-line-length
330330

331331

332332
// EXPORTS //

docs/types/test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function array(): ndarray {
216216
dispatch( ( x: number ): number => x, types, data, 2, 1, 1 ); // $ExpectError
217217
}
218218

219-
// The compiler throws an error if the function is provided a second argument which is not an array of strings...
219+
// The compiler throws an error if the function is provided a second argument which is not an array-like object...
220220
{
221221
const data = [ unary ];
222222

@@ -225,9 +225,7 @@ function array(): ndarray {
225225
dispatch( ndarrayFcn, false, data, 2, 1, 1 ); // $ExpectError
226226
dispatch( ndarrayFcn, null, data, 2, 1, 1 ); // $ExpectError
227227
dispatch( ndarrayFcn, undefined, data, 2, 1, 1 ); // $ExpectError
228-
dispatch( ndarrayFcn, [ 1 ], data, 2, 1, 1 ); // $ExpectError
229228
dispatch( ndarrayFcn, {}, data, 2, 1, 1 ); // $ExpectError
230-
dispatch( ndarrayFcn, ( x: number ): number => x, data, 2, 1, 1 ); // $ExpectError
231229
}
232230

233231
// The compiler throws an error if the function is provided a third argument which is not an array-like object or null...

examples/add.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var Int32Array = require( '@stdlib/array-int32' );
2525
var ind2sub = require( '@stdlib/ndarray-ind2sub' );
2626
var ndarray = require( '@stdlib/ndarray-ctor' );
2727
var numel = require( '@stdlib/ndarray-base-numel' );
28+
var dtypes = require( '@stdlib/ndarray-dtypes' );
2829
var dispatch = require( './../lib' );
2930

3031
function add2( arrays ) {
@@ -84,15 +85,15 @@ var fcns = [
8485
];
8586

8687
var types = [
87-
'float64', 'float64', 'float64',
88-
'float32', 'float32', 'float32',
89-
'int32', 'int32', 'int32',
90-
'uint32', 'uint32', 'uint32',
91-
'int16', 'int16', 'int16',
92-
'uint16', 'uint16', 'uint16',
93-
'int8', 'int8', 'int8',
94-
'uint8', 'uint8', 'uint8',
95-
'uint8c', 'uint8c', 'uint8c'
88+
dtypes.float64, dtypes.float64, dtypes.float64,
89+
dtypes.float32, dtypes.float32, dtypes.float32,
90+
dtypes.int32, dtypes.int32, dtypes.int32,
91+
dtypes.uint32, dtypes.uint32, dtypes.uint32,
92+
dtypes.int16, dtypes.int16, dtypes.int16,
93+
dtypes.uint16, dtypes.uint16, dtypes.uint16,
94+
dtypes.int8, dtypes.int8, dtypes.int8,
95+
dtypes.uint8, dtypes.uint8, dtypes.uint8,
96+
dtypes.uint8c, dtypes.uint8c, dtypes.uint8c
9697
];
9798

9899
var add = dispatch( fcns, types, null, 3, 2, 1 );

0 commit comments

Comments
 (0)