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/ndarray/base/ind/README.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,11 +57,12 @@ idx = ind( 10, 9, 'throw' );
57
57
// throws <RangeError>
58
58
```
59
59
60
-
The function supports the following `modes`:
60
+
The function supports the following modes:
61
61
62
-
-`throw`: specifies that the function should throw an error when an index is outside the interval `[0,max]`.
63
-
-`wrap`: specifies that the function should wrap around an index using modulo arithmetic.
64
-
-`clamp`: specifies that the function should set an index less than `0` to `0` (minimum index) and set an index greater than `max` to `max`.
62
+
-**throw**: specifies that the function should throw an error when an index is outside the interval `[0, max]`.
63
+
-**normalize**: specifies that the function should normalize negative indices and throw an error when an index is outside the interval `[-max-1, max]`.
64
+
-**wrap**: specifies that the function should wrap around an index using modulo arithmetic.
65
+
-**clamp**: specifies that the function should set an index less than `0` to `0` (minimum index) and set an index greater than `max` to `max`.
tape('when the `mode` is equal to `normalize`, the function throws an error when a provided index is outside the interval [-max-1,max]',functiontest(t){
120
+
varmax;
121
+
vari;
122
+
123
+
max=10;
124
+
for(i=-100;i<-max-1;i++){
125
+
t.throws(badValue(i),RangeError,'throws an range error when provided '+i);
126
+
}
127
+
for(i=max+1;i<100;i++){
128
+
t.throws(badValue(i),RangeError,'throws an range error when provided '+i);
0 commit comments