10000 Release v0.1.0 · stdlib-js/ndarray-order@d0214f6 · GitHub
[go: up one dir, main page]

Skip to content

Commit d0214f6

Browse files
committed
Release v0.1.0
1 parent 3bb75b6 commit d0214f6

File tree

4 files changed

+17
-208
lines changed

4 files changed

+17
-208
lines changed

.github/workflows/publish.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ jobs:
182182
fi
183183
# Trim leading and trailing whitespace:
184184
dep=$(echo "$dep" | xargs)
185-
version="^$(npm view $dep version)"
185+
version="$(npm view $dep version)"
186+
if [[ -z "$version" ]]; then
187+
continue
188+
fi
189+
version="^$version"
186190
jq -r --arg dep "$dep" --arg version "$version" '.dependencies[$dep] = $version' package.json > package.json.tmp
187191
mv package.json.tmp package.json
188192
done
@@ -192,7 +196,11 @@ jobs:
192196
fi
193197
# Trim leading and trailing whitespace:
194198
dep=$(echo "$dep" | xargs)
195-
version="^$(npm view $dep version)"
199+
version="$(npm view $dep version)"
200+
if [[ -z "$version" ]]; then
201+
continue
202+
fi
203+
version="^$version"
196204
jq -r --arg dep "$dep" --arg version "$version" '.devDependencies[$dep] = $version' package.json > package.json.tmp
197205
mv package.json.tmp package.json
198206
done

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
206206
[npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-order.svg
207207
[npm-url]: https://npmjs.org/package/@stdlib/ndarray-order
208208

209-
[test-image]: https://github.com/stdlib-js/ndarray-order/actions/workflows/test.yml/badge.svg?branch=main
210-
[test-url]: https://github.com/stdlib-js/ndarray-order/actions/workflows/test.yml?query=branch:main
209+
[test-image]: https://github.com/stdlib-js/ndarray-order/actions/workflows/test.yml/badge.svg?branch=v0.1.0
210+
[test-url]: https://github.com/stdlib-js/ndarray-order/actions/workflows/test.yml?query=branch:v0.1.0
211211

212212
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-order/main.svg
213213
[coverage-url]: https://codecov.io/github/stdlib-js/ndarray-order?branch=main

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stdlib/ndarray-order",
3-
"version": "0.0.0",
3+
"version": "0.1.0",
44
"description": "Return the layout order of a provided ndarray.",
55
"license": "Apache-2.0",
66
"author": {
@@ -38,7 +38,7 @@
3838
},
3939
"dependencies": {
4040
"@stdlib/ndarray-base-assert-is-order": "^0.1.1",
41-
"@stdlib/ndarray-base-strides2order": "^0.1.0",
41+
"@stdlib/ndarray-base-strides2order": "^0.1.1",
4242
"@stdlib/ndarray-ndims": "github:stdlib-js/ndarray-ndims#main",
4343
"@stdlib/ndarray-strides": "github:stdlib-js/ndarray-strides#main",
4444
"@stdlib/string-format": "^0.1.1",

test/dist/test.js

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

2323
var tape = require( 'tape' );
24-
var zeros = require( '@stdlib/ndarray-zeros' );
25-
var order = require( './../../dist' );
24+
var main = require( './../../dist' );
2625

2726

2827
// TESTS //
2928

30-
tape( 'main export is a function', function test( t ) {
29+
tape( 'main export is defined', function test( t ) {
3130
t.ok( true, __filename );
32-
t.strictEqual( typeof order, 'function', 'main export is a function' );
33-
t.end();
34-
});
35-
36-
tape( 'the function throws an error if not provided a minimal ndarray-like object', function test( t ) {
37-
var values;
38-
var i;
39-
40-
values = [
41-
'5',
42-
5,
43-
NaN,
44-
true,
45-
false,
46-
null,
47-
void 0,
48-
{},
49-
[],
50-
function noop() {},
51-
{
52-
'order': 'foo'
53-
},
54-
{
55-
'order': null
56-
}
57-
];
58-
for ( i = 0; i < values.length; i++ ) {
59-
t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
60-
}
61-
t.end();
62-
63-
function badValue( value ) {
64-
return function badValue() {
65-
order( value );
66-
};
67-
}
68-
});
69-
70-
tape( 'the function returns the data type of a provided ndarray', function test( t ) {
71-
var expected;
72-
var values;
73-
var actual;
74-
var i;
75-
76-
values = [
77-
zeros( [], {
78-
'order': 'row-major'
79-
}),
80-
zeros( [ 3, 3, 3 ], {
81-
'order': 'column-major'
82-
}),
83-
zeros( [ 1, 1 ], {
84-
'order': 'column-major'
85-
}),
86-
zeros( [ 3, 3, 0, 3 ], {
87-
'order': 'row-major'
88-
}),
89-
zeros( [ 1, 2, 3, 4 ], {
90-
'order': 'row-major'
91-
}),
92-
zeros( [ 5 ], {
93-
'order': 'column-major'
94-
})
95-
];
96-
97-
expected = [
98-
'row-major',
99-
'column-major',
100-
'column-major',
101-
'row-major',
102-
'row-major',
103-
'column-major'
104-
];
105-
106-
for ( i = 0; i < values.length; i++ ) {
107-
actual = order( values[ i ] );
108-
t.strictEqual( actual, expected[ i ], 'returns expected value' );
109-
}
110-
t.end();
111-
});
112-
113-
tape( 'the function accepts minimal ndarray-like objects (order)', function test( t ) {
114-
var expected;
115-
var values;
116-
var actual;
117-
var i;
118-
119-
values = [
120-
{
121-
'order': 'row-major'
122-
},
123-
{
124-
'order': 'column-major'
125-
},
126-
{
127-
'order': 'column-major'
128-
},
129-
{
130-
'order': 'row-major'
131-
},
132-
{
133-
'order': 'row-major'
134-
},
135-
{
136-
'order': 'column-major'
137-
}
138-
];
139-
140-
expected = [
141-
'row-major',
142-
'column-major',
143-
'column-major',
144-
'row-major',
145-
'row-major',
146-
'column-major'
147-
];
148-
149-
for ( i = 0; i < values.length; i++ ) {
150-
actual = order( values[ i ] );
151-
t.strictEqual( actual, expected[ i ], 'returns expected value' );
152-
}
153-
t.end();
154-
});
155-
156-
tape( 'the function accepts minimal ndarray-like objects (shape, strides)', function test( t ) {
157-
var expected;
158-
var values;
159-
var actual;
160-
var i;
161-
162-
values = [
163-
{
164-
'shape': [],
165-
'strides': [] // this should not happen, as for zero-dimensional ndarrays should be [ 0 ], but providing an empty array is supported by `ndarray/base/strides2order`
166-
},
167-
{
168-
'shape': [ 2, 2 ],
169-
'strides': [ 2, 1 ]
170-
},
171-
{
172-
'shape': [ 3, 3, 3 ],
173-
'strides': [ 1, 3, 9 ]
174-
},
175-
{
176-
'shape': [ 2, 2 ],
177-
'strides': [ 1, 2 ]
178-
},
179-
{
180-
'shape': [ 2, 2, 2 ],
181-
'strides': [ 8, 4, 2 ]
182-
},
183-
{
184-
'shape': [ 10 ],
185-
'strides': [ 1 ]
186-
},
187-
{
188-
'shape': [ 2, 2, 2 ],
189-
'strides': [ 2, 4, 8 ]
190-
}
191-
];
192-
193-
expected = [
194-
'row-major',
195-
'row-major',
196-
'column-major',
197-
'column-major',
198-
'row-major',
199-
'row-major',
200-
'column-major'
201-
];
202-
203-
for ( i = 0; i < values.length; i++ ) {
204-
actual = order( values[ i ] );
205-
t.strictEqual( actual, expected[ i ], 'returns expected value' );
206-
}
207-
t.end();
208-
});
209-
210-
tape( 'the function returns `null` if provided a minimal ndarray-like object which does not have a recognized order', function test( t ) {
211-
var expected;
212-
var values;
213-
var actual;
214-
var i;
215-
216-
values = [
217-
{
218-
'shape': [ 2, 2, 2 ],
219-
'strides': [ 2, 3, 1 ]
220-
}
221-
];
222-
223-
expected = [
224-
null
225-
];
226-
227-
for ( i = 0; i < values.length; i++ ) {
228-
actual = order( values[ i ] );
229-
t.strictEqual( actual, expected[ i ], 'returns expected value' );
230-
}
31+
t.strictEqual( main !== void 0, true, 'main export is defined' );
23132
t.end();
23233
});

0 commit comments

Comments
 (0)
0