Skip to content

Commit 292336a

Browse files
committed
Auto-generated commit
1 parent 192f423 commit 292336a

File tree

17 files changed

+44
-35
lines changed

17 files changed

+44
-35
lines changed

.editorconfig

-5
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,6 @@ indent_size = 2
148148
indent_style = space
149149
indent_size = 2
150150

151-
# Set properties for `tslint.json` files:
152-
[tslint.json]
153-
indent_style = space
154-
indent_size = 2
155-
156151
# Set properties for `tsconfig.json` files:
157152
[tsconfig.json]
158153
indent_style = space

.github/.keepalive

-1
This file was deleted.

.github/workflows/publish.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
# For all dependencies, check in all *.js files if they are still used; if not, remove them:
120120
jq -r '.dependencies | keys[]' ./package.json | while read -r dep; do
121121
dep=$(echo "$dep" | xargs)
122-
if ! grep -q "$dep" lib/** && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
122+
if ! find lib -name "*.js" -exec grep -q "$dep" {} + && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
123123
jq --indent 2 "del(.dependencies[\"$dep\"])" ./package.json > ./package.json.tmp
124124
mv ./package.json.tmp ./package.json
125125
fi
@@ -129,7 +129,7 @@ jobs:
129129
continue
130130
fi
131131
dep=$(echo "$dep" | xargs)
132-
if ! grep -q "$dep" lib/** && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
132+
if ! find lib -name "*.js" -exec grep -q "$dep" {} + && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
133133
jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp
134134
mv ./package.json.tmp ./package.json
135135
fi

CONTRIBUTORS

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Brendan Graetz <[email protected]>
99
Bruno Fenzl <[email protected]>
1010
Christopher Dambamuromo <[email protected]>
1111
12+
Daniel Killenberger <[email protected]>
1213
Dominik Moritz <[email protected]>
1314
Dorrin Sotoudeh <[email protected]>
1415
Frank Kovacs <[email protected]>
@@ -29,6 +30,7 @@ Ognjen Jevremović <[email protected]>
2930
Philipp Burckhardt <[email protected]>
3031
Pranav Goswami <[email protected]>
3132
Ricky Reusser <[email protected]>
33+
Robert Gislason <[email protected]>
3234
Roman Stetsyk <[email protected]>
3335
Ryan Seal <[email protected]>
3436
Seyyed Parsa Neshaei <[email protected]>
@@ -37,4 +39,3 @@ Stephannie Jiménez Gacha <[email protected]>
3739
Yernar Yergaziyev <[email protected]>
3840
orimiles5 <[email protected]>
3941
40-
Robert Gislason <[email protected]>

README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,15 @@ Returns a list of ndarray index modes.
7777

7878
```javascript
7979
var out = modes();
80-
// returns [ 'throw', 'clamp', 'wrap' ]
80+
// returns [ 'throw', 'normalize', 'clamp', 'wrap' ]
8181
```
8282

83-
The output `array` contains the following modes:
83+
The output array contains the following modes:
8484

85-
- `throw`: specifies that a function should throw an error when an index is outside a restricted interval.
86-
- `wrap`: specifies that a function should wrap around an index using modulo arithmetic.
87-
- `clamp`: specifies that a function should set an index less than `0` to `0` (minimum index) and set an index greater than a maximum index value to the maximum possible index.
85+
- **throw**: specifies that a function should throw an error when an index is outside a restricted interval.
86+
- **normalize**: specifies that a function should normalize negative indices and throw an error when an index is outside a restricted interval.
87+
- **wrap**: specifies that a function should wrap around an index using modulo arithmetic.
88+
- **clamp**: specifies that a function should set an index less than `0` to `0` (minimum index) and set an index greater than a maximum index value to the maximum possible index.
8889

8990
</section>
9091

@@ -111,7 +112,6 @@ var indexOf = require( '@stdlib/utils-index-of' );
111112
var modes = require( '@stdlib/ndarray-index-modes' );
112113

113114
var MODES = modes();
114-
var bool;
115115

116116
function isMode( str ) {
117117
if ( indexOf( MODES, str ) === -1 ) {
@@ -120,7 +120,10 @@ function isMode( str ) {
120120
return true;
121121
}
122122

123-
bool = isMode( 'throw' );
123+
var bool = isMode( 'throw' );
124+
// returns true
125+
126+
bool = isMode( 'normalize' );
124127
// returns true
125128

126129
bool = isMode( 'clamp' );

dist/index.js

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/repl.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
- throw: specifies that a function should throw an error when an index is
88
outside a restricted interval.
9+
- normalize: specifies that a function should normalize negative indices and
10+
throw an error when an index is outside a restricted interval.
911
- wrap: specifies that a function should wrap around an index using modulo
1012
arithmetic.
1113
- clamp: specifies that a function should set an index less than zero to
@@ -20,7 +22,7 @@
2022
Examples
2123
--------
2224
> var out = {{alias}}()
23-
[ 'throw', 'clamp', 'wrap' ]
25+
[ 'throw', 'normalize', 'clamp', 'wrap' ]
2426

2527
See Also
2628
--------

docs/types/index.d.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@
2525
*
2626
* - The output array contains the following modes:
2727
*
28-
* - throw: specifies that a function should throw an error when an index is
28+
* - **throw**: specifies that a function should throw an error when an index is
2929
* outside a restricted interval.
30-
* - wrap: specifies that a function should wrap around an index using modulo
30+
* - **normalize**: specifies that a function should normalize negative indices and throw an error when an index is outside a restricted interval.
31+
* - **wrap**: specifies that a function should wrap around an index using modulo
3132
* arithmetic.
32-
* - clamp: specifies that a function should set an index less than zero to
33+
* - **clamp**: specifies that a function should set an index less than zero to
3334
* zero (minimum index) and set an index greater than a maximum index value to
3435
* the maximum possible index.
3536
*
3637
* @returns list of ndarray index modes
3738
*
3839
* @example
3940
* var list = modes();
40-
* // returns [ 'throw', 'clamp', 'wrap' ]
41+
* // returns [ 'throw', 'normalize', 'clamp', 'wrap' ]
4142
*/
4243
declare function modes(): Array<string>;
4344

examples/index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ var indexOf = require( '@stdlib/utils-index-of' );
2222
var modes = require( './../lib' );
2323

2424
var MODES = modes();
25-
var bool;
2625

2726
function isMode( str ) {
2827
if ( indexOf( MODES, str ) === -1 ) {
@@ -31,7 +30,11 @@ function isMode( str ) {
3130
return true;
3231
}
3332

34-
bool = isMode( 'throw' );
33+
var bool = isMode( 'throw' );
34+
console.log( bool );
35+
// => true
36+
37+
bool = isMode( 'normalize' );
3538
console.log( bool );
3639
// => true
3740

include/stdlib/ndarray/index_modes.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
enum STDLIB_NDARRAY_INDEX_MODE {
2626
STDLIB_NDARRAY_INDEX_ERROR = 1,
2727
STDLIB_NDARRAY_INDEX_CLAMP = 2,
28-
STDLIB_NDARRAY_INDEX_WRAP = 3
28+
STDLIB_NDARRAY_INDEX_WRAP = 3,
29+
STDLIB_NDARRAY_INDEX_NORMALIZE = 4,
2930
};
3031

3132
#endif // !STDLIB_NDARRAY_INDEX_MODES_H

lib/enum.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ function enumerated() {
3939
return {
4040
'throw': 1,
4141
'clamp': 2,
42-
'wrap': 3
42+
'wrap': 3,
43+
'normalize': 4
4344
};
4445
}
4546

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* var modes = require( '@stdlib/ndarray-index-modes' );
2828
*
2929
* var list = modes();
30-
* // returns [ 'throw', 'clamp', 'wrap' ]
30+
* // returns [ 'throw', 'normalize', 'clamp', 'wrap' ]
3131
*/
3232

3333
// MODULES //

lib/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var MODES = require( './modes.json' );
3232
*
3333
* @example
3434
* var list = modes();
35-
* // returns [ 'throw', 'clamp', 'wrap' ]
35+
* // returns [ 'throw', 'normalize', 'clamp', 'wrap' ]
3636
*/
3737
function modes() {
3838
return MODES.slice();

lib/modes.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[
22
"throw",
3+
"normalize",
34
"clamp",
45
"wrap"
56
]

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@stdlib/assert-has-own-property": "^0.1.1",
4646
"@stdlib/assert-is-nonnegative-integer": "^0.1.0",
4747
"@stdlib/assert-is-string-array": "^0.1.1",
48-
"@stdlib/bench": "^0.1.0",
48+
"@stdlib/bench": "^0.2.1",
4949
"@stdlib/utils-index-of": "^0.1.0",
5050
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
5151
"istanbul": "^0.4.1",

test/test.js

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ tape( 'the function returns a list of ndarray index modes', function test( t ) {
4040

4141
expected = [
4242
'throw',
43+
'normalize',
4344
'clamp',
4445
'wrap'
4546
];
@@ -63,6 +64,7 @@ tape( 'attached to the main function is an `enum` method to return an object map
6364
// List of index modes which should be supported...
6465
m = [
6566
'throw',
67+
'normalize',
6668
'clamp',
6769
'wrap'
6870
];

0 commit comments

Comments
 (0)