Skip to content

Commit dec062b

Browse files
committed
Auto-generated commit
1 parent f74614b commit dec062b

File tree

6 files changed

+42
-185
lines changed

6 files changed

+42
-185
lines changed

.github/.keepalive

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-11-01T01:22:13.927Z

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,38 @@ jobs:
173173
rm -f docs/repl.txt
174174
rm -f docs/types/test.ts
175175
176+
# Replace all stdlib GitHub dependencies with the respective npm packages:
177+
- name: 'Replace all stdlib GitHub dependencies with the respective npm packages'
178+
run: |
179+
for dep in $(jq -r '.dependencies | keys | .[]' package.json); do
180+
if [[ "$dep" != "@stdlib"* ]]; then
181+
continue
182+
fi
183+
# Trim leading and trailing whitespace:
184+
dep=$(echo "$dep" | xargs)
185+
version="$(npm view $dep version)"
186+
if [[ -z "$version" ]]; then
187+
continue
188+
fi
189+
version="^$version"
190+
jq -r --arg dep "$dep" --arg version "$version" '.dependencies[$dep] = $version' package.json > package.json.tmp
191+
mv package.json.tmp package.json
192+
done
193+
for dep in $(jq -r '.devDependencies | keys | .[]' package.json); do
194+
if [[ "$dep" != "@stdlib"* ]]; then
195+
continue
196+
fi
197+
# Trim leading and trailing whitespace:
198+
dep=$(echo "$dep" | xargs)
199+
version="$(npm view $dep version)"
200+
if [[ -z "$version" ]]; then
201+
continue
202+
fi
203+
version="^$version"
204+
jq -r --arg dep "$dep" --arg version "$version" '.devDependencies[$dep] = $version' package.json > package.json.tmp
205+
mv package.json.tmp package.json
206+
done
207+
176208
# Publish package to npm:
177209
- name: 'Publish package to npm'
178210
# Pin action to full length commit SHA corresponding to v2.2.2

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ Stephannie Jiménez Gacha <steff456@hotmail.com>
3737
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
3838
orimiles5 <97595296+orimiles5@users.noreply.github.com>
3939
rei2hu <reimu@reimu.ws>
40+
Robert Gislason <gztown2216@yahoo.com>

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,11 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
204204
[npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-base-offset.svg
205205
[npm-url]: https://npmjs.org/package/@stdlib/ndarray-base-offset
206206

207-
[test-image]: https://github.com/stdlib-js/ndarray-base-offset/actions/workflows/test.yml/badge.svg?branch=v0.1.0
208-
[test-url]: https://github.com/stdlib-js/ndarray-base-offset/actions/workflows/test.yml?query=branch:v0.1.0
207+
[test-image]: https://github.com/stdlib-js/ndarray-base-offset/actions/workflows/test.yml/badge.svg?branch=main
208+
[test-url]: https://github.com/stdlib-js/ndarray-base-offset/actions/workflows/test.yml?query=branch:main
209209

210210
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-offset/main.svg
211-
[coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-offset?branch=v0.1.0
211+
[coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-offset?branch=main
212212

213213
<!--
214214

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
},
4343
"devDependencies": {
4444
"@stdlib/array-base-zeros": "^0.1.1",
45-
"@stdlib/array-float64": "^0.1.0",
45+
"@stdlib/array-float64": "^0.1.1",
4646
"@stdlib/bench": "^0.1.0",
4747
"@stdlib/ndarray-ctor": "^0.1.0",
48-
"@stdlib/ndarray-slice": "github:stdlib-js/ndarray-slice#main",
48+
"@stdlib/ndarray-slice": "^0.1.0",
4949
"@stdlib/ndarray-zeros": "^0.1.0",
5050
"@stdlib/slice-ctor": "^0.1.0",
5151
"@stdlib/slice-multi": "^0.1.0",

test/dist/test.js

Lines changed: 3 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -21,190 +21,13 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24-
var Float64Array = require( '@stdlib/array-float64' );
25-
var zeros = require( '@stdlib/ndarray-zeros' );
26-
var ndarray = require( '@stdlib/ndarray-ctor' );
27-
var offset = require( './../../dist' );
24+
var main = require( './../../dist' );
2825

2926

3027
// TESTS //
3128

32-
tape( 'main export is a function', function test( t ) {
29+
tape( 'main export is defined', function test( t ) {
3330
t.ok( true, __filename );
34-
t.strictEqual( typeof offset, 'function', 'main export is a function' );
35-
t.end();
36-
});
37-
38-
tape( 'if provided a zero-dimensional ndarray, the function returns 0', function test( t ) {
39-
t.strictEqual( offset( zeros( [] ) ), 0, 'returns expected value' );
40-
t.end();
41-
});
42-
43-
tape( 'the function returns the index offset', function test( t ) {
44-
var expected;
45-
var values;
46-
var n;
47-
var i;
48-
49-
values = [
50-
zeros( [ 3, 3, 3 ] ),
51-
zeros( [ 1, 1 ] ),
52-
zeros( [ 3, 3, 0, 3 ] ),
53-
zeros( [ 1, 2, 3, 4 ] ),
54-
zeros( [ 5 ] ),
55-
ndarray( 'float64', new Float64Array( 100 ), [ 2, 2 ], [ 2, 1 ], 50, 'row-major' ),
56-
ndarray( 'float64', new Float64Array( 100 ), [ 2, 2 ], [ 2, 1 ], 35, 'row-major' ),
57-
ndarray( 'float64', new Float64Array( 100 ), [ 2, 2 ], [ -2, -1 ], 3, 'row-major' )
58-
];
59-
60-
expected = [
61-
0,
62-
0,
63-
0,
64-
0,
65-
0,
66-
50,
67-
35,
68-
3
69-
];
70-
71-
for ( i = 0; i < values.length; i++ ) {
72-
n = offset( values[ i ] );
73-
t.strictEqual( n, expected[ i ], 'returns expected value for shape '+values[ i ].shape.join( 'x' ) );
74-
}
75-
t.end();
76-
});
77-
78-
tape( 'the function accepts minimal ndarray-like objects (shape, strides)', function test( t ) {
79-
var expected;
80-
var values;
81-
var n;
82-
var i;
83-
84-
values = [
85-
{
86-
'shape': [ 3, 3, 3 ],
87-
'strides': [ -9, -3, -1 ]
88-
},
89-
{
90-
'shape': [ 1, 1 ],
91-
'strides': [ 1, 1 ]
92-
},
93-
{
94-
'shape': [ 3, 3, 0, 3 ],
95-
'strides': [ 0, 0, 0, 1 ]
96-
},
97-
{
98-
'shape': [ 1, 2, 3, 4 ],
99-
'strides': [ 24, 12, 4, 1 ]
100-
},
101-
{
102-
'shape': [ 5 ],
103-
'strides': [ -1 ]
104-
},
105-
{
106-
'shape': [],
107-
'strides': [ 0 ]
108-
}
109-
];
110-
111-
expected = [
112-
26,
113-
0,
114-
0,
115-
0,
116-
4,
117-
0
118-
];
119-
120-
for ( i = 0; i < values.length; i++ ) {
121-
n = offset( values[ i ] );
122-
t.strictEqual( n, expected[ i ], 'returns expected value for shape '+values[ i ].shape.join( 'x' ) );
123-
}
124-
t.end();
125-
});
126-
127-
tape( 'the function accepts minimal ndarray-like objects (shape)', function test( t ) {
128-
var expected;
129-
var values;
130-
var n;
131-
var i;
132-
133-
values = [
134-
{
135-
'shape': [ 3, 3, 3 ],
136-
'strides': null
137-
},
138-
{
139-
'shape': [ 1, 1 ]
140-
},
141-
{
142-
'shape': [ 3, 3, 0, 3 ],
143-
'strides': null
144-
},
145-
{
146-
'shape': [ 1, 2, 3, 4 ]
147-
},
148-
{
149-
'shape': [ 5 ],
150-
'strides': null
151-
},
152-
{
153-
'shape': []
154-
}
155-
];
156-
157-
expected = [
158-
0,
159-
0,
160-
0,
161-
0,
162-
0,
163-
0
164-
];
165-
166-
for ( i = 0; i < values.length; i++ ) {
167-
n = offset( values[ i ] );
168-
t.strictEqual( n, expected[ i ], 'returns expected value for shape '+values[ i ].shape.join( 'x' ) );
169-
}
170-
t.end();
171-
});
172-
173-
tape( 'the function accepts minimal ndarray-like objects (offset)', function test( t ) {
174-
var expected;
175-
var values;
176-
var n;
177-
var i;
178-
179-
values = [
180-
{
181-
'offset': 3
182-
},
183-
{
184-
'offset': 1
185-
},
186-
{
187-
'offset': 0
188-
},
189-
{
190-
'offset': 4
191-
},
192-
{
193-
'offset': 5
194-
}
195-
];
196-
197-
expected = [
198-
3,
199-
1,
200-
0,
201-
4,
202-
5
203-
];
204-
205-
for ( i = 0; i < values.length; i++ ) {
206-
n = offset( values[ i ] );
207-
t.strictEqual( n, expected[ i ], 'returns expected value for '+values[ i ] );
208-
}
31+
t.strictEqual( main !== void 0, true, 'main export is defined' );
20932
t.end();
21033
});

0 commit comments

Comments
 (0)