You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/array/base/mskput/README.md
+9-7
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Replaces elements of an array with provided values according to a provided mask
37
37
```javascript
38
38
var x = [ 1, 2, 3, 4 ];
39
39
40
-
var out =mskput( x, [ 1, 0, 1, 0 ], [ 20, 40 ], 'throw' );
40
+
var out =mskput( x, [ 1, 0, 1, 0 ], [ 20, 40 ], 'strict' );
41
41
// returns [ 1, 20, 3, 40 ]
42
42
43
43
var bool = ( out === x );
@@ -49,27 +49,29 @@ The function supports the following parameters:
49
49
-**x**: input array.
50
50
-**mask**: mask array.
51
51
-**values**: values to set.
52
-
-**mode**: string specifying whether to raise an exception when the number of `values`is less than the number of falsy `mask` values.
52
+
-**mode**: string specifying whether to raise an exception when the number of `values`does not equal the number of falsy `mask` values.
53
53
54
54
The function supports the following modes:
55
55
56
-
-`'throw'`: specifies that the function must raise an exception when the function is provided insufficient `values` to satisfy the `mask` array.
56
+
-`'strict'`: specifies that the function must raise an exception when the number of `values` does not **exactly** equal the number of falsy `mask` values.
57
+
-`'non_strict'`: specifies that the function must raise an exception when the function is provided insufficient `values` to satisfy the `mask` array.
58
+
-`'strict_broadcast'`: specifies that the function must broadcast a single-element `values` array and otherwise raise an exception when the number of `values` does not **exactly** equal the number of falsy `mask` values.
57
59
-`'broadcast'`: specifies that the function must broadcast a single-element `values` array and otherwise raise an exception when the function is provided insufficient `values` to satisfy the `mask` array.
58
60
-`'repeat'`: specifies that the function must reuse provided `values` when replacing elements in `x` in order to satisfy the `mask` array.
59
61
60
-
When `mode` is equal to `'broadcast`', the function supports broadcasting a `values` array containing a single element against the number of falsy values in the `mask` array.
62
+
In broadcasting modes, the function supports broadcasting a `values` array containing a single element against the number of falsy values in the `mask` array.
61
63
62
64
```javascript
63
65
var x = [ 1, 2, 3, 4 ];
64
66
65
-
var out =mskput( x, [ 1, 0, 1, 0 ], [ 20 ], 'broadcast' );
67
+
var out =mskput( x, [ 1, 0, 1, 0 ], [ 20 ], 'strict_broadcast' );
66
68
// returns [ 1, 20, 3, 20 ]
67
69
68
70
var bool = ( out === x );
69
71
// returns true
70
72
```
71
73
72
-
When `mode` is equal to `repeat`, the function supports recycling elements in a `values` array to satisfy the number of falsy values in the `mask` array.
74
+
In repeat mode, the function supports recycling elements in a `values` array to satisfy the number of falsy values in the `mask` array.
73
75
74
76
```javascript
75
77
var x = [ 1, 2, 3, 4 ];
@@ -123,7 +125,7 @@ var values = filledBy( N, discreteUniform.factory( 1000, 2000 ) );
* Mode specifying behavior when the number of values to set is less than the number of falsy values in the mask array.
37
+
* Mode specifying behavior when the number of values to set does not equal the number of falsy values in the mask array.
38
38
*
39
39
* ## Notes
40
40
*
41
41
* - The function supports the following modes:
42
42
*
43
-
* - `'throw'`: specifies that the function must raise an exception when the function is provided insufficient `values` to satisfy the `mask` array.
44
-
* - `'broadcast'`: specifies that the function must broadcast a single-element `values` array and otherwise raise an exception when the function is provided insufficient `values` to satisfy the `mask` array.
45
-
* - `'repeat'`: specifies that the function must reuse provided `values` when replacing elements in `x` in order to satisfy the `mask` array.
43
+
* - `'strict'`: specifies that the function must raise an exception when the number of `values` does not **exactly** equal the number of falsy `mask` values.
44
+
* - `'non_strict'`: specifies that the function must raise an exception when the function is provided insufficient `values` to satisfy the `mask` array.
45
+
* - `'strict_broadcast'`: specifies that the function must broadcast a single-element `values` array and otherwise raise an exception when the number of `values` does not **exactly** equal the number of falsy `mask` values.
46
+
* - `'broadcast'`: specifies that the function must broadcast a single-element `values` array and otherwise raise an exception when the function is provided insufficient `values` to satisfy the `mask` array.
47
+
* - `'repeat'`: specifies that the function must reuse provided `values` when replacing elements in `x` in order to satisfy the `mask` array.
0 commit comments