Skip to content

Commit 1bc94e7

Browse files
committed
Auto-generated commit
1 parent 3153795 commit 1bc94e7

5 files changed

Lines changed: 28 additions & 274 deletions

File tree

.github/.keepalive

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-11-01T05:37:49.958Z

.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

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>

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,27 @@
3939
"dependencies": {
4040
"@stdlib/array-complex128": "^0.1.0",
4141
"@stdlib/array-complex64": "^0.1.0",
42-
"@stdlib/array-float32": "^0.1.0",
43-
"@stdlib/array-float64": "^0.1.0",
44-
"@stdlib/array-int16": "^0.1.0",
45-
"@stdlib/array-int32": "^0.1.0",
46-
"@stdlib/array-int8": "^0.1.0",
47-
"@stdlib/array-uint16": "^0.1.0",
48-
"@stdlib/array-uint32": "^0.1.0",
49-
"@stdlib/array-uint8": "^0.1.0",
50-
"@stdlib/array-uint8c": "^0.1.0",
42+
"@stdlib/array-float32": "^0.1.1",
43+
"@stdlib/array-float64": "^0.1.1",
44+
"@stdlib/array-int16": "^0.1.1",
45+
"@stdlib/array-int32": "^0.1.1",
46+
"@stdlib/array-int8": "^0.1.1",
47+
"@stdlib/array-uint16": "^0.1.1",
48+
"@stdlib/array-uint32": "^0.1.1",
49+
"@stdlib/array-uint8": "^0.1.1",
50+
"@stdlib/array-uint8c": "^0.1.1",
5151
"@stdlib/assert-instance-of": "^0.1.1",
5252
"@stdlib/assert-is-complex-typed-array": "^0.1.0",
5353
"@stdlib/assert-is-typed-array": "^0.1.0",
54-
"@stdlib/strided-base-reinterpret-complex128": "^0.1.0",
55-
"@stdlib/strided-base-reinterpret-complex64": "^0.1.0",
54+
"@stdlib/strided-base-reinterpret-complex128": "^0.1.1",
55+
"@stdlib/strided-base-reinterpret-complex64": "^0.1.1",
5656
"@stdlib/string-format": "^0.1.1",
5757
"@stdlib/types": "^0.1.0",
5858
"@stdlib/utils-constructor-name": "^0.1.1",
5959
"@stdlib/utils-get-prototype-of": "^0.1.1"
6060
},
6161
"devDependencies": {
62-
"@stdlib/assert-has-class-support": "^0.1.0",
62+
"@stdlib/assert-has-class-support": "^0.1.1",
6363
"@stdlib/assert-is-array": "^0.1.1",
6464
"@stdlib/assert-is-browser": "^0.1.1",
6565
"@stdlib/assert-is-plain-object": "^0.1.1",

test/dist/test.js

Lines changed: 4 additions & 260 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 The Stdlib Authors.
4+
* Copyright (c) 2023 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -20,270 +20,14 @@
2020

2121
// MODULES //
2222

23-
var vm = require( 'vm' ); // TODO: handle in-browser tests
2423
var tape = require( 'tape' );
25-
var IS_BROWSER = require( '@stdlib/assert-is-browser' );
26-
var hasClassSupport = require( '@stdlib/assert-has-class-support' );
27-
var isPlainObject = require( '@stdlib/assert-is-plain-object' );
28-
var Int8Array = require( '@stdlib/array-int8' );
29-
var Uint8Array = require( '@stdlib/array-uint8' );
30-
var Uint8ClampedArray = require( '@stdlib/array-uint8c' );
31-
var Int16Array = require( '@stdlib/array-int16' );
32-
var Uint16Array = require( '@stdlib/array-uint16' );
33-
var Int32Array = require( '@stdlib/array-int32' );
34-
var Uint32Array = require( '@stdlib/array-uint32' );
35-
var Float32Array = require( '@stdlib/array-float32' );
36-
var Float64Array = require( '@stdlib/array-float64' );
37-
var Complex64Array = require( '@stdlib/array-complex64' );
38-
var Complex128Array = require( '@stdlib/array-complex128' );
39-
var toJSON = require( './../../dist' );
40-
41-
42-
// FIXTURES //
43-
44-
var createClass1 = require( './../fixtures/custom.proto.js' );
45-
var createClass2 = require( './../fixtures/custom.subclass.js' );
46-
47-
48-
// VARIABLES //
49-
50-
var hasClasses = hasClassSupport();
51-
var opts = {
52-
'skip': false
53-
};
24+
var main = require( './../../dist' );
5425

5526

5627
// TESTS //
5728

58-
tape( 'main export is a function', function test( t ) {
29+
tape( 'main export is defined', function test( t ) {
5930
t.ok( true, __filename );
60-
t.strictEqual( typeof toJSON, 'function', 'main export is a function' );
61-
t.end();
62-
});
63-
64-
tape( 'if provided anything other than a typed array instance, the function will throw an error', function test( t ) {
65-
var values;
66-
var i;
67-
68-
values = [
69-
'5',
70-
5,
71-
NaN,
72-
null,
73-
void 0,
74-
true,
75-
false,
76-
[],
77-
{},
78-
function noop() {},
79-
new Date(),
80-
/.*/
81-
];
82-
83-
for ( i = 0; i < values.length; i++ ) {
84-
t.throws( badValue( values[i] ), Error, 'throws when provided a ' + (typeof values[i]) );
85-
}
86-
t.end();
87-
88-
function badValue( value ) {
89-
return function badValue() {
90-
toJSON( value );
91-
};
92-
}
93-
});
94-
95-
tape( 'the function returns a JSON object', function test( t ) {
96-
var json;
97-
var arr;
98-
99-
arr = new Float64Array( [ 5.0, 3.0 ] );
100-
json = toJSON( arr );
101-
t.strictEqual( isPlainObject( json ), true, 'returns an object' );
102-
t.end();
103-
});
104-
105-
tape( 'the JSON object includes a typed array type', function test( t ) {
106-
var expected;
107-
var values;
108-
var json;
109-
var i;
110-
111-
values = [
112-
new Float64Array( 1 ),
113-
new Float32Array( 1 ),
114-
new Int32Array( 1 ),
115-
new Uint32Array( 1 ),
116-
new Int16Array( 1 ),
117-
new Uint16Array( 1 ),
118-
new Int8Array( 1 ),
119-
new Uint8Array( 1 ),
120-
new Uint8ClampedArray( 1 ),
121-
new Complex64Array( 1 ),
122-
new Complex128Array( 1 )
123-
];
124-
125-
expected = [
126-
'Float64Array',
127-
'Float32Array',
128-
'Int32Array',
129-
'Uint32Array',
130-
'Int16Array',
131-
'Uint16Array',
132-
'Int8Array',
133-
'Uint8Array',
134-
'Uint8ClampedArray',
135-
'Complex64Array',
136-
'Complex128Array'
137-
];
138-
139-
for ( i = 0; i < values.length; i++ ) {
140-
json = toJSON( values[ i ] );
141-
t.strictEqual( json.type, expected[ i ], 'type equal to ' + expected[ i ] );
142-
}
143-
t.end();
144-
});
145-
146-
tape( 'the JSON object includes a data property', function test( t ) {
147-
var expected;
148-
var values;
149-
var json;
150-
var i;
151-
152-
values = [
153-
new Float64Array( [ 1.0 ] ),
154-
new Float32Array( [ 2.0 ] ),
155-
new Int32Array( [ 3.0 ] ),
156-
new Uint32Array( [ 4.0 ] ),
157-
new Int16Array( [ 5.0 ] ),
158-
new Uint16Array( [ 6.0 ] ),
159-
new Int8Array( [ 7.0 ] ),
160-
new Uint8Array( [ 8.0 ] ),
161-
new Uint8ClampedArray( [ 9.0 ] ),
162-
new Complex64Array( [ 1.0, 2.0 ] ),
163-
new Complex128Array( [ 1.0, 2.0 ] )
164-
];
165-
166-
expected = [
167-
[ 1.0 ],
168-
[ 2.0 ],
169-
[ 3.0 ],
170-
[ 4.0 ],
171-
[ 5.0 ],
172-
[ 6.0 ],
173-
[ 7.0 ],
174-
[ 8.0 ],
175-
[ 9.0 ],
176-
[ 1.0, 2.0 ],
177-
[ 1.0, 2.0 ]
178-
];
179-
180-
for ( i = 0; i < values.length; i++ ) {
181-
json = toJSON( values[ i ] );
182-
t.deepEqual( json.data, expected[ i ], 'has expected property value' );
183-
}
184-
t.end();
185-
});
186-
187-
tape( 'custom typed arrays are supported (proto)', function test( t ) {
188-
var CustomTypedArray;
189-
var types;
190-
var ctors;
191-
var json;
192-
var arr;
193-
var i;
194-
195-
ctors = [
196-
Float64Array,
197-
Float32Array,
198-
Int32Array,
199-
Uint32Array,
200-
Int16Array,
201-
Uint16Array,
202-
Int8Array,
203-
Uint8Array,
204-
Uint8ClampedArray
205-
];
206-
207-
types = [
208-
'Float64Array',
209-
'Float32Array',
210-
'Int32Array',
211-
'Uint32Array',
212-
'Int16Array',
213-
'Uint16Array',
214-
'Int8Array',
215-
'Uint8Array',
216-
'Uint8ClampedArray'
217-
];
218-
219-
for ( i = 0; i < ctors.length; i++ ) {
220-
CustomTypedArray = createClass1( ctors[ i ] );
221-
arr = new CustomTypedArray( [ 5.0, 3.0 ] );
222-
json = toJSON( arr );
223-
t.strictEqual( json.type, types[ i ], 'type equal to ' + types[ i ] );
224-
t.deepEqual( json.data, [ 5.0, 3.0 ], 'has expected value' );
225-
}
226-
t.end();
227-
});
228-
229-
opts.skip = !hasClasses;
230-
tape( 'custom typed arrays are supported (subclass; ES2015)', opts, function test( t ) {
231-
var CustomTypedArray;
232-
var ctors;
233-
var json;
234-
var arr;
235-
var i;
236-
237-
ctors = [
238-
'Float64Array',
239-
'Float32Array',
240-
'Int32Array',
241-
'Uint32Array',
242-
'Int16Array',
243-
'Uint16Array',
244-
'Int8Array',
245-
'Uint8Array',
246-
'Uint8ClampedArray'
247-
];
248-
249-
for ( i = 0; i < ctors.length; i++ ) {
250-
CustomTypedArray = createClass2( ctors[ i ] );
251-
arr = new CustomTypedArray( [ 5.0, 3.0 ] );
252-
json = toJSON( arr );
253-
t.strictEqual( json.type, ctors[ i ], 'type equal to ' + ctors[ i ] );
254-
t.deepEqual( json.data, [ 5.0, 3.0 ], 'has expected value' );
255-
}
256-
t.end();
257-
});
258-
259-
opts.skip = IS_BROWSER;
260-
tape( 'the function supports serializing a typed array from a different realm', opts, function test( t ) {
261-
var json;
262-
var arr;
263-
264-
arr = vm.runInNewContext( 'new Float64Array( [ 5.0, 3.0 ] )', {
265-
'Float64Array': Float64Array
266-
});
267-
json = toJSON( arr );
268-
269-
t.strictEqual( json.type, 'Float64Array', 'returns expected value' );
270-
t.deepEqual( json.data, [ 5.0, 3.0 ], 'returns expected value' );
271-
272-
t.end();
273-
});
274-
275-
opts.skip = IS_BROWSER;
276-
tape( 'the function supports serializing an object from a different realm which inherits from a typed array', opts, function test( t ) {
277-
var json;
278-
var arr;
279-
280-
arr = vm.runInNewContext( 'function Arr( data ) { Object.defineProperty( this, "length", {"configurable":false,"enumerable":true,"writable":false,"value":data.length}); for ( var i = 0; i < data.length; i++ ) { this[ i ] = data[ i ]; }; return this; }; Arr.prototype = Object.create( Float64Array.prototype ); Arr.prototype.constructor = Arr; new Arr( [ 5.0, 3.0 ] );', {
281-
'Float64Array': Float64Array
282-
});
283-
json = toJSON( arr );
284-
285-
t.strictEqual( json.type, 'Float64Array', 'returns expected value' );
286-
t.deepEqual( json.data, [ 5.0, 3.0 ], 'returns expected value' );
287-
31+
t.strictEqual( main !== void 0, true, 'main export is defined' );
28832
t.end();
28933
});

0 commit comments

Comments
 (0)