Skip to content

Commit 7ee074d

Browse files
committed
Auto-generated commit
1 parent 606936c commit 7ee074d

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ A total of 17 issues were closed in this release:
426426

427427
<details>
428428

429+
- [`9168604`](https://github.com/stdlib-js/stdlib/commit/9168604c1138d438bee5c6856026cc36de35e705) - **refactor:** improve type specificity _(by Athan Reines)_
430+
- [`49952f7`](https://github.com/stdlib-js/stdlib/commit/49952f7b2fbfdad1b20108aab89a34aeab73da48) - **refactor:** improve type specificity _(by Athan Reines)_
431+
- [`d47c5ea`](https://github.com/stdlib-js/stdlib/commit/d47c5eab74c76573c9479de1bc7addf8a97483cb) - **docs:** update example _(by Athan Reines)_
429432
- [`0643a79`](https://github.com/stdlib-js/stdlib/commit/0643a7936cfa4d916eb52b0f4ad89964ceb70560) - **bench:** fix call signatures _(by Athan Reines)_
430433
- [`344834e`](https://github.com/stdlib-js/stdlib/commit/344834ebf6c9102b86aee2c7c45b9e60e8486576) - **refactor:** rename template parameter _(by Athan Reines)_
431434
- [`37070e8`](https://github.com/stdlib-js/stdlib/commit/37070e8d3748ba83f8fcbf41f5a3dc9a4f2bd2a8) - **bench:** refactor value generation _(by Athan Reines)_

base/map/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,8 @@ The callback function is provided the following arguments:
130130
<!-- eslint no-undef: "error" -->
131131

132132
```javascript
133-
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
134-
var filledarray = require( '@stdlib/array/filled' );
135-
var filledarrayBy = require( '@stdlib/array/filled-by' );
133+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
134+
var zeros = require( '@stdlib/array/zeros' );
136135
var abs = require( '@stdlib/math/base/special/abs' );
137136
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
138137
var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
@@ -142,15 +141,17 @@ var map = require( '@stdlib/ndarray/base/map' );
142141
var N = 10;
143142
var x = {
144143
'dtype': 'generic',
145-
'data': filledarrayBy( N, 'generic', discreteUniform( -100, 100 ) ),
144+
'data': discreteUniform( N, -100, 100, {
145+
'dtype': 'generic'
146+
}),
146147
'shape': [ 5, 2 ],
147148
'strides': [ 2, 1 ],
148149
'offset': 0,
149150
'order': 'row-major'
150151
};
151152
var y = {
152153
'dtype': 'generic',
153-
'data': filledarray( 0, N, 'generic' ),
154+
'data': zeros( N, 'generic' ),
154155
'shape': x.shape.slice(),
155156
'strides': shape2strides( x.shape, 'column-major' ),
156157
'offset': 0,

base/map/docs/types/index.d.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,22 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { ArrayLike } from '@stdlib/types/array';
2423
import { typedndarray } from '@stdlib/types/ndarray';
2524

2625
/**
2726
* Callback invoked for each ndarray element.
2827
*
2928
* @returns output value
3029
*/
31-
type Nullary<U, ThisArg> = ( this: ThisArg ) => U;
30+
type Nullary<V, ThisArg> = ( this: ThisArg ) => V;
3231

3332
/**
3433
* Callback invoked for each ndarray element.
3534
*
3635
* @param value - current array element
3736
* @returns output value
3837
*/
39-
type Unary<T, U, ThisArg> = ( this: ThisArg, value: T ) => U;
38+
type Unary<T, V, ThisArg> = ( this: ThisArg, value: T ) => V;
4039

4140
/**
4241
* Callback invoked for each ndarray element.
@@ -45,7 +44,7 @@ type Unary<T, U, ThisArg> = ( this: ThisArg, value: T ) => U;
4544
* @param indices - current array element indices
4645
* @returns output value
4746
*/
48-
type Binary<T, U, ThisArg> = ( this: ThisArg, value: T, indices: Array<number> ) => U;
47+
type Binary<T, V, ThisArg> = ( this: ThisArg, value: T, indices: Array<number> ) => V;
4948

5049
/**
5150
* Callback invoked for each ndarray element.
@@ -55,7 +54,7 @@ type Binary<T, U, ThisArg> = ( this: ThisArg, value: T, indices: Array<number> )
5554
* @param arr - input array
5655
* @returns output value
5756
*/
58-
type Ternary<T, U, ThisArg> = ( this: ThisArg, value: T, indices: Array<number>, arr: typedndarray<T> ) => U;
57+
type Ternary<T, U, V, ThisArg> = ( this: ThisArg, value: T, indices: Array<number>, arr: U ) => V;
5958

6059
/**
6160
* Callback invoked for each ndarray element.
@@ -65,7 +64,7 @@ type Ternary<T, U, ThisArg> = ( this: ThisArg, value: T, indices: Array<number>,
6564
* @param arr - input array
6665
* @returns output value
6766
*/
68-
type Callback<T, U, ThisArg> = Nullary<U, ThisArg> | Unary<T, U, ThisArg> | Binary<T, U, ThisArg> | Ternary<T, U, ThisArg>;
67+
type Callback<T, U, V, ThisArg> = Nullary<V, ThisArg> | Unary<T, V, ThisArg> | Binary<T, V, ThisArg> | Ternary<T, U, V, ThisArg>;
6968

7069
/**
7170
* Applies a callback function to elements in an input ndarray and assigns results to elements in an output ndarray.
@@ -109,7 +108,7 @@ type Callback<T, U, ThisArg> = Nullary<U, ThisArg> | Unary<T, U, ThisArg> | Bina
109108
* console.log( y.data );
110109
* // => <Float64Array>[ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]
111110
*/
112-
declare function map<T = unknown, U = unknown, ThisArg = unknown>( arrays: ArrayLike<typedndarray<T>>, fcn: Callback<T, U, ThisArg>, thisArg?: ThisParameterType<Callback<T, U, ThisArg>> ): void;
111+
declare function map<T = unknown, U extends typedndarray<T> = typedndarray<T>, V = unknown, ThisArg = unknown>( arrays: [ U, typedndarray<V> ], fcn: Callback<T, U, V, ThisArg>, thisArg?: ThisParameterType<Callback<T, U, V, ThisArg>> ): void;
113112

114113

115114
// EXPORTS //

base/map/examples/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818

1919
'use strict';
2020

21-
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
22-
var filledarray = require( '@stdlib/array/filled' );
23-
var filledarrayBy = require( '@stdlib/array/filled-by' );
21+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
22+
var zeros = require( '@stdlib/array/zeros' );
2423
var abs = require( '@stdlib/math/base/special/abs' );
2524
var shape2strides = require( './../../../base/shape2strides' );
2625
var ndarray2array = require( './../../../base/to-array' );
@@ -30,15 +29,17 @@ var map = require( './../lib' );
3029
var N = 10;
3130
var x = {
3231
'dtype': 'generic',
33-
'data': filledarrayBy( N, 'generic', discreteUniform( -100, 100 ) ),
32+
'data': discreteUniform( N, -100, 100, {
33+
'dtype': 'generic'
34+
}),
3435
'shape': [ 5, 2 ],
3536
'strides': [ 2, 1 ],
3637
'offset': 0,
3738
'order': 'row-major'
3839
};
3940
var y = {
4041
'dtype': 'generic',
41-
'data': filledarray( 0, N, 'generic' ),
42+
'data': zeros( N, 'generic' ),
4243
'shape': x.shape.slice(),
4344
'strides': shape2strides( x.shape, 'column-major' ),
4445
'offset': 0,

0 commit comments

Comments
 (0)