Skip to content

Commit 1136c80

Browse files
committed
docs: update example and parameter descriptions
1 parent ff1dd27 commit 1136c80

File tree

1 file changed

+9
-21
lines changed
  • lib/node_modules/@stdlib/ndarray/map/docs

1 file changed

+9
-21
lines changed
Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11

2-
{{alias}}( x, [ options, ]fcn[, thisArg] )
2+
{{alias}}( x[, options], fcn[, thisArg] )
33
Applies a callback function to elements in an input ndarray and assigns
4-
results to elements in an output ndarray.
5-
6-
The function accepts the following options:
7-
8-
- dtype: output ndarray data type. Defaults to match the input ndarray
9-
if not specified.
4+
results to elements in a new output ndarray.
105

116
The callback function is provided the following arguments:
127

@@ -22,6 +17,10 @@
2217
options: Object (optional)
2318
Function options.
2419

20+
options.dtype: string (optional)
21+
Output ndarray data type. Overrides using the input array's inferred
22+
data type.
23+
2524
fcn: Function
2625
Callback function.
2726

@@ -30,22 +29,11 @@
3029

3130
Examples
3231
--------
33-
// Define ndarray data and meta data...
34-
> var buffer = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
35-
> var dtype = 'float64';
36-
> var shape = [ 2, 2 ];
37-
> var strides = [ 2, 1 ];
38-
> var offset = 0;
39-
> var order = 'row-major';
40-
41-
// Define a callback function:
32+
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] );
4233
> function f( v ) { return v*10.0; };
43-
44-
// Using ndarray...
45-
> var x = {{alias:@stdlib/ndarray/ctor}}( dtype, buffer, shape, strides, offset, order );
4634
> var y = {{alias}}( x, f );
47-
> y.data
48-
<Float64Array>[ 10.0, 20.0, 30.0, 40.0 ]
35+
> {{alias:@stdlib/ndarray/to-array}}( y )
36+
[ [ 10.0, 20.0 ], [ 30.0, 40.0 ] ]
4937

5038
See Also
5139
--------

0 commit comments

Comments
 (0)