From e81031de5c307d4f4581fabdf391dde1581227e6 Mon Sep 17 00:00:00 2001 From: Uday Kakade Date: Sun, 8 Jun 2025 18:55:05 +0530 Subject: [PATCH 01/13] feat: add assert/is-float16array --- .../@stdlib/assert/is-float16array/README.md | 148 ++++++++++++++++++ .../is-float16array/benchmark/benchmark.js | 132 ++++++++++++++++ .../assert/is-float16array/docs/repl.txt | 22 +++ .../is-float16array/docs/types/index.d.ts | 42 +++++ .../assert/is-float16array/docs/types/test.ts | 34 ++++ .../assert/is-float16array/examples/index.js | 91 +++++++++++ .../assert/is-float16array/lib/index.js | 44 ++++++ .../assert/is-float16array/lib/main.js | 57 +++++++ .../assert/is-float16array/package.json | 77 +++++++++ .../assert/is-float16array/test/test.js | 81 ++++++++++ 10 files changed, 728 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-float16array/README.md create mode 100644 lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/assert/is-float16array/examples/index.js create mode 100644 lib/node_modules/@stdlib/assert/is-float16array/lib/index.js create mode 100644 lib/node_modules/@stdlib/assert/is-float16array/lib/main.js create mode 100644 lib/node_modules/@stdlib/assert/is-float16array/package.json create mode 100644 lib/node_modules/@stdlib/assert/is-float16array/test/test.js diff --git a/lib/node_modules/@stdlib/assert/is-float16array/README.md b/lib/node_modules/@stdlib/assert/is-float16array/README.md new file mode 100644 index 000000000000..b6d428b4ced0 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-float16array/README.md @@ -0,0 +1,148 @@ + + +# isFloat16Array + +> Test if a value is a [Float16Array][mdn-float16array]. + +
+ +## Usage + +```javascript +var isFloat16Array = require( '@stdlib/assert/is-float16array' ); +``` + +#### isFloat16Array( value ) + +Tests if a value is a [`Float16Array`][mdn-float16array]. + +```javascipt +var Float16Array = require( '@stdlib/array/float16' ); + +var bool = isFloat16Array( new Float16Array( 10 ) ); +// returns true + +bool = isFloat16Array( [] ); +// returns false +``` + +
+ + + +
+ +## Examples + + + +```javascript +var Int8Array = require( '@stdlib/array/int8' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var Uint8ClampedArray = require( '@stdlib/array/uint8c' ); +var Int16Array = require( '@stdlib/array/int16' ); +var Uint16Array = require( '@stdlib/array/uint16' ); +var Int32Array = require( '@stdlib/array/int32' ); +var Uint32Array = require( '@stdlib/array/uint32' ); +var Float32Array = require( '@stdlib/array/float32' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Float16Array = require( '@stdlib/array/float16' ); +var isFloat16Array = require( '@stdlib/assert/is-float16array' ); + +var bool = isFloat16Array( new Float16Array( 10 ) ); +// returns true + +bool = isFloat16Array( new Int8Array( 10 ) ); +// returns false + +bool = isFloat16Array( new Uint8Array( 10 ) ); +// returns false + +bool = isFloat16Array( new Uint8ClampedArray( 10 ) ); +// returns false + +bool = isFloat16Array( new Int16Array( 10 ) ); +// returns false + +bool = isFloat16Array( new Uint16Array( 10 ) ); +// returns false + +bool = isFloat16Array( new Int32Array( 10 ) ); +// returns false + +bool = isFloat16Array( new Uint32Array( 10 ) ); +// returns false + +bool = isFloat16Array( new Float32Array( 10 ) ); +// returns false + +bool = isFloat16Array( new Float64Array( 10 ) ); +// returns false + +bool = isFloat16Array( new Array( 10 ) ); +// returns false + +bool = isFloat16Array( {} ); +// returns false + +bool = isFloat16Array( null ); +// returns false +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js b/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js new file mode 100644 index 000000000000..c92e366f9e9d --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js @@ -0,0 +1,132 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var Int8Array = require( '@stdlib/array/int8' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var Uint8ClampedArray = require( '@stdlib/array/uint8c' ); +var Int16Array = require( '@stdlib/array/int16' ); +var Uint16Array = require( '@stdlib/array/uint16' ); +var Int32Array = require( '@stdlib/array/int32' ); +var Uint32Array = require( '@stdlib/array/uint32' ); +var Float32Array = require( '@stdlib/array/float32' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isFloat16Array = require( './../lib' ); +var Float16Array = globalThis[ Symbol.for( '@@stdlib/array/float16' ) ]; + +var opts = { + skip: ( typeof Float16Array !== 'function' ) +}; + +// MAIN // + +bench( pkg, opts, function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + new Float64Array( 10 ), + new Float16Array( 10 ), + new Float32Array( 10 ), + new Int32Array( 10 ), + new Uint32Array( 10 ), + new Int16Array( 10 ), + new Uint16Array( 10 ), + new Int8Array( 10 ), + new Uint8Array( 10 ), + new Uint8ClampedArray( 10 ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isFloat16Array( values[ i%values.length ] ); + if ( typeof bool !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( bool ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::true', opts, function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + new Float16Array( 10 ), + new Float16Array( 10 ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isFloat16Array( values[ i%values.length ] ); + if ( typeof bool !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( bool ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::false', opts, function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + new Float64Array( 10 ), + new Float32Array( 10 ), + new Int32Array( 10 ), + new Uint32Array( 10 ), + new Int16Array( 10 ), + new Uint16Array( 10 ), + new Int8Array( 10 ), + new Uint8Array( 10 ), + new Uint8ClampedArray( 10 ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isFloat16Array( values[ i%values.length ] ); + if ( typeof bool !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( bool ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt b/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt new file mode 100644 index 000000000000..9f55b6ed22c6 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt @@ -0,0 +1,22 @@ +{{alias}}( value ) + Tests if a value is a Float16Array. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating whether value is a Float16Array. + + Examples + -------- + > var bool = {{alias}}( new {{alias:@stdlib/array/float16}}( 10 ) ) + true + > bool = {{alias}}( [] ) + false + + See Also + -------- \ No newline at end of file diff --git a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts new file mode 100644 index 000000000000..1eb848a42e25 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts @@ -0,0 +1,42 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +import Float16Array = require( '@stdlib/array/float16' ); + +/** +* Tests if a value is a Float16Array. +* +* @param value - value to test +* @returns boolean indicating whether value is a Float16Array +* +* @example +* +* var bool = isFloat16Array( new Float16Array( 10 ) ); +* // returns true +* +* @example +* var bool = isFloat16Array( [] ); +* // returns false +*/ +declare function isFloat16Array( value: any ): value is Float16Array; + +// EXPORTS // + +export = isFloat16Array; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts new file mode 100644 index 000000000000..82c282d40398 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2019 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isFloat16Array = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isFloat16Array( new Float16Array( 10 ) ); // $ExpectType boolean + isFloat16Array( [] ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isFloat16Array(); // $ExpectError + isFloat16Array( new Float16Array( 10 ), 123 ); // $ExpectError +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js b/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js new file mode 100644 index 000000000000..c2fcd4e9b71a --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js @@ -0,0 +1,91 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Int8Array = require( '@stdlib/array/int8' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var Uint8ClampedArray = require( '@stdlib/array/uint8c' ); +var Int16Array = require( '@stdlib/array/int16' ); +var Uint16Array = require( '@stdlib/array/uint16' ); +var Int32Array = require( '@stdlib/array/int32' ); +var Uint32Array = require( '@stdlib/array/uint32' ); +var Float32Array = require( '@stdlib/array/float32' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Float16Array; +var isFloat16Array = require( './../lib' ); + + +try { + Float16Array = require( '@stdlib/array/float16' ); +} catch (err) { + console.log( 'Float16Array is not available in this environment. Skipping all tests.' ); + process.exit(0); +} + +var bool = isFloat16Array( new Float16Array( 10 ) ); +console.log( bool ); +// => true + +bool = isFloat16Array( new Int8Array( 10 ) ); +console.log( bool ); +// => false + +bool = isFloat16Array( new Uint8Array( 10 ) ); +console.log( bool ); +// => false + +bool = isFloat16Array( new Uint8ClampedArray( 10 ) ); +console.log( bool ); +// => false + +bool = isFloat16Array( new Int16Array( 10 ) ); +console.log( bool ); +// => false + +bool = isFloat16Array( new Uint16Array( 10 ) ); +console.log( bool ); +// => false + +bool = isFloat16Array( new Int32Array( 10 ) ); +console.log( bool ); +// => false + +bool = isFloat16Array( new Uint32Array( 10 ) ); +console.log( bool ); +// => false + +bool = isFloat16Array( new Float32Array( 10 ) ); +console.log( bool ); +// => false + +bool = isFloat16Array( new Float64Array( 10 ) ); +console.log( bool ); +// => false + +bool = isFloat16Array( new Array( 10 ) ); +console.log( bool ); +// => false + +bool = isFloat16Array( {} ); +console.log( bool ); +// => false + +bool = isFloat16Array( null ); +console.log( bool ); +// => false \ No newline at end of file diff --git a/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js b/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js new file mode 100644 index 000000000000..bd3d0081b029 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test if a value is a Float16Array. +* +* @module @stdlib/assert/is-float16array +* +* @example +* var isFloat16Array = require( '@stdlib/assert/is-float16array' ); +* +* var value = new Float16rray( 2 ); +* var bool = isFloat16Array( value ); +* // returns true +* +* bool = isFloat16Array( [] ); +* // returns false +*/ + +// MODULES // + +var isFloat16Array = require( './main.js' ); + + +// EXPORTS // + +module.exports = isFloat16Array; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js new file mode 100644 index 000000000000..a876a265bc46 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var nativeClass = require( '@stdlib/utils/native-class' ); + +// VARIABLES // + +var hasFloat16Array = ( typeof Float16Array === 'function' ); // eslint-disable-line stdlib/require-globals + + +// MAIN // + +/** +* Tests if a value is a Float16Array. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether value is a Float16Array +* +* @example +* var Float16Array = require( '@stdlib/array/float16/lib/polyfill.js' ); +* var isFloat16Array = require( '@stdlib/assert/is-float16array' ); +* +* var bool = isFloat16Array( new Float16Array( 10 ) ); +* // returns true +* +* bool = isFloat16Array( [] ); +* // returns false +*/ +function isFloat16Array( value ) { + return ( + ( hasFloat16Array && value instanceof Float16Array ) || // eslint-disable-line stdlib/require-globals, no-undef + nativeClass( value ) === '[object Float16Array]' + ); +} + +// EXPORTS // + +module.exports = isFloat16Array; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/assert/is-float16array/package.json b/lib/node_modules/@stdlib/assert/is-float16array/package.json new file mode 100644 index 000000000000..1144c6f49b93 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-float16array/package.json @@ -0,0 +1,77 @@ +{ + "name": "@stdlib/assert/is-float16array", + "version": "0.0.0", + "description": "Test if a value is a Float16Array.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdassert", + "assertion", + "assert", + "utilities", + "utility", + "utils", + "util", + "float16array", + "float16", + "float", + "typed", + "typed array", + "typed-array", + "array", + "is", + "isarray", + "istypedarray", + "type", + "check", + "validate", + "valid", + "isvalid", + "test" + ] +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/assert/is-float16array/test/test.js b/lib/node_modules/@stdlib/assert/is-float16array/test/test.js new file mode 100644 index 000000000000..5bd077116f43 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-float16array/test/test.js @@ -0,0 +1,81 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Int8Array = require( '@stdlib/array/int8' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var Uint8ClampedArray = require( '@stdlib/array/uint8c' ); +var Int16Array = require( '@stdlib/array/int16' ); +var Uint16Array = require( '@stdlib/array/uint16' ); +var Int32Array = require( '@stdlib/array/int32' ); +var Uint32Array = require( '@stdlib/array/uint32' ); +var Float32Array = require( '@stdlib/array/float32' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isFloat16Array = require( './../lib' ); + +// OPTIONS // + +var opts = { + 'skip': ( typeof Float16Array === 'undefined' ) +}; + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isFloat16Array, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a Float16Array', opts, function test( t ) { + t.strictEqual( isFloat16Array( new Float16Array( 10 ) ), true, 'returns true' ); + t.end(); +}); + +tape( 'the function returns `false` if not provided a Float16Array', function test( t ) { + var values = [ + '5', + 5, + NaN, + true, + null, + void 0, + [], + {}, + function noop() {}, + new Array( 10 ), + new Float64Array( 10 ), + new Uint32Array( 10 ), + new Int32Array( 10 ), + new Uint16Array( 10 ), + new Int16Array( 10 ), + new Uint8Array( 10 ), + new Int8Array( 10 ), + new Uint8ClampedArray( 10 ), + new Float32Array( 10 ) + ]; + + for ( var i = 0; i < values.length; i++ ) { + t.strictEqual( isFloat16Array( values[i] ), false, 'returns false when provided ' + values[i] ); + } + t.end(); +}); \ No newline at end of file From c725d89e2f26150191c99489381bdbc96755f8ca Mon Sep 17 00:00:00 2001 From: Uday Kakade Date: Sun, 8 Jun 2025 19:20:34 +0530 Subject: [PATCH 02/13] Added newline at the end of code for few files --- .../@stdlib/assert/is-float16array/benchmark/benchmark.js | 2 +- .../@stdlib/assert/is-float16array/docs/types/index.d.ts | 2 +- .../@stdlib/assert/is-float16array/docs/types/test.ts | 2 +- .../@stdlib/assert/is-float16array/examples/index.js | 2 +- lib/node_modules/@stdlib/assert/is-float16array/lib/index.js | 2 +- lib/node_modules/@stdlib/assert/is-float16array/lib/main.js | 2 +- lib/node_modules/@stdlib/assert/is-float16array/package.json | 2 +- lib/node_modules/@stdlib/assert/is-float16array/test/test.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js b/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js index c92e366f9e9d..09f3c30ee8b2 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js @@ -129,4 +129,4 @@ bench( pkg+'::false', opts, function benchmark( b ) { } b.pass( 'benchmark finished' ); b.end(); -}); \ No newline at end of file +}); diff --git a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts index 1eb848a42e25..c14fe1cd8563 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts @@ -39,4 +39,4 @@ declare function isFloat16Array( value: any ): value is Float16Array; // EXPORTS // -export = isFloat16Array; \ No newline at end of file +export = isFloat16Array; diff --git a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts index 82c282d40398..013bfe044977 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts +++ b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts @@ -31,4 +31,4 @@ import isFloat16Array = require( './index' ); { isFloat16Array(); // $ExpectError isFloat16Array( new Float16Array( 10 ), 123 ); // $ExpectError -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js b/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js index c2fcd4e9b71a..92a135dbf2f8 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js @@ -88,4 +88,4 @@ console.log( bool ); bool = isFloat16Array( null ); console.log( bool ); -// => false \ No newline at end of file +// => false diff --git a/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js b/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js index bd3d0081b029..0d17a27a22c0 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js @@ -41,4 +41,4 @@ var isFloat16Array = require( './main.js' ); // EXPORTS // -module.exports = isFloat16Array; \ No newline at end of file +module.exports = isFloat16Array; diff --git a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js index a876a265bc46..cfce38934618 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js @@ -54,4 +54,4 @@ function isFloat16Array( value ) { // EXPORTS // -module.exports = isFloat16Array; \ No newline at end of file +module.exports = isFloat16Array; diff --git a/lib/node_modules/@stdlib/assert/is-float16array/package.json b/lib/node_modules/@stdlib/assert/is-float16array/package.json index 1144c6f49b93..d3edb52f9726 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/package.json +++ b/lib/node_modules/@stdlib/assert/is-float16array/package.json @@ -74,4 +74,4 @@ "isvalid", "test" ] -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/assert/is-float16array/test/test.js b/lib/node_modules/@stdlib/assert/is-float16array/test/test.js index 5bd077116f43..e452f6909a54 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/test/test.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/test/test.js @@ -78,4 +78,4 @@ tape( 'the function returns `false` if not provided a Float16Array', function te t.strictEqual( isFloat16Array( values[i] ), false, 'returns false when provided ' + values[i] ); } t.end(); -}); \ No newline at end of file +}); From ab7bb199462a73005241ffbd110f1055792646fa Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Sun, 8 Jun 2025 13:56:15 +0000 Subject: [PATCH 03/13] chore: update copyright years --- .../@stdlib/assert/is-float16array/docs/types/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts index 013bfe044977..5675a3d69a30 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts +++ b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2019 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 06f61004c1c15d659c615645b46fc0f5397b7151 Mon Sep 17 00:00:00 2001 From: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> Date: Sun, 8 Jun 2025 19:43:48 +0530 Subject: [PATCH 04/13] Added related links for float32array in README.md Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> --- lib/node_modules/@stdlib/assert/is-float16array/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/README.md b/lib/node_modules/@stdlib/assert/is-float16array/README.md index b6d428b4ced0..4e85d923d505 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/README.md +++ b/lib/node_modules/@stdlib/assert/is-float16array/README.md @@ -120,7 +120,6 @@ bool = isFloat16Array( null ); ## See Also - [`@stdlib/assert/is-float64array`][@stdlib/assert/is-float64array]: test if a value is a Float64Array. - - [`@stdlib/assert/is-float32array`][@stdlib/assert/is-float32array]: test if a value is a Float32Array. @@ -140,6 +139,7 @@ bool = isFloat16Array( null ); [@stdlib/assert/is-float64array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-float64array +[@stdlib/assert/is-float32array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-float32array From 5113a6731ad61e7876901c861eb74d640ed4f977 Mon Sep 17 00:00:00 2001 From: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> Date: Fri, 13 Jun 2025 14:10:48 +0530 Subject: [PATCH 05/13] Replaced polyfill with Float16Array = require( '@stdlib/array/float16' in main.js Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> --- lib/node_modules/@stdlib/assert/is-float16array/lib/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js index cfce38934618..4ec1ff1855d2 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js @@ -22,6 +22,7 @@ var nativeClass = require( '@stdlib/utils/native-class' ); + // VARIABLES // var hasFloat16Array = ( typeof Float16Array === 'function' ); // eslint-disable-line stdlib/require-globals @@ -36,7 +37,7 @@ var hasFloat16Array = ( typeof Float16Array === 'function' ); // eslint-disable- * @returns {boolean} boolean indicating whether value is a Float16Array * * @example -* var Float16Array = require( '@stdlib/array/float16/lib/polyfill.js' ); +* var Float16Array = require( '@stdlib/array/float16' ); * var isFloat16Array = require( '@stdlib/assert/is-float16array' ); * * var bool = isFloat16Array( new Float16Array( 10 ) ); From 380e7b5003b9a5bbdb30ca5956edce581f42bad8 Mon Sep 17 00:00:00 2001 From: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> Date: Fri, 13 Jun 2025 14:12:39 +0530 Subject: [PATCH 06/13] Two empty lines before headers lint issue fixed in test.js Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> --- lib/node_modules/@stdlib/assert/is-float16array/test/test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/test/test.js b/lib/node_modules/@stdlib/assert/is-float16array/test/test.js index e452f6909a54..605879ad682c 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/test/test.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/test/test.js @@ -32,12 +32,14 @@ var Float32Array = require( '@stdlib/array/float32' ); var Float64Array = require( '@stdlib/array/float64' ); var isFloat16Array = require( './../lib' ); + // OPTIONS // var opts = { 'skip': ( typeof Float16Array === 'undefined' ) }; + // TESTS // tape( 'main export is a function', function test( t ) { From ccd688e54c2f0a84bc45e1b0ed6a0eb99cbce125 Mon Sep 17 00:00:00 2001 From: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> Date: Fri, 13 Jun 2025 14:22:13 +0530 Subject: [PATCH 07/13] Fixed lint erros in main.js Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> --- lib/node_modules/@stdlib/assert/is-float16array/lib/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js index 4ec1ff1855d2..5007ae6f0b2f 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js @@ -18,6 +18,7 @@ 'use strict'; + // MODULES // var nativeClass = require( '@stdlib/utils/native-class' ); @@ -25,7 +26,7 @@ var nativeClass = require( '@stdlib/utils/native-class' ); // VARIABLES // -var hasFloat16Array = ( typeof Float16Array === 'function' ); // eslint-disable-line stdlib/require-globals +var hasFloat16Array = ( typeof Float16Array === 'function' ); // MAIN // @@ -48,11 +49,12 @@ var hasFloat16Array = ( typeof Float16Array === 'function' ); // eslint-disable- */ function isFloat16Array( value ) { return ( - ( hasFloat16Array && value instanceof Float16Array ) || // eslint-disable-line stdlib/require-globals, no-undef + ( hasFloat16Array && value instanceof Float16Array ) || nativeClass( value ) === '[object Float16Array]' ); } + // EXPORTS // module.exports = isFloat16Array; From 5821d4b272a1fdff4370df28fa37fb9ee5d70118 Mon Sep 17 00:00:00 2001 From: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> Date: Mon, 23 Jun 2025 12:19:38 +0530 Subject: [PATCH 08/13] Update README.md Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> --- lib/node_modules/@stdlib/assert/is-float16array/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/README.md b/lib/node_modules/@stdlib/assert/is-float16array/README.md index 4e85d923d505..e3018efeb316 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/README.md +++ b/lib/node_modules/@stdlib/assert/is-float16array/README.md @@ -34,7 +34,7 @@ var isFloat16Array = require( '@stdlib/assert/is-float16array' ); Tests if a value is a [`Float16Array`][mdn-float16array]. -```javascipt +```javascript var Float16Array = require( '@stdlib/array/float16' ); var bool = isFloat16Array( new Float16Array( 10 ) ); From f684ff37410ffcfb08edd7e7fcfe955c64b7d25c Mon Sep 17 00:00:00 2001 From: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> Date: Mon, 23 Jun 2025 12:22:42 +0530 Subject: [PATCH 09/13] Update benchmark.js Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> --- .../@stdlib/assert/is-float16array/benchmark/benchmark.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js b/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js index 09f3c30ee8b2..41182cb247b7 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js @@ -35,10 +35,14 @@ var pkg = require( './../package.json' ).name; var isFloat16Array = require( './../lib' ); var Float16Array = globalThis[ Symbol.for( '@@stdlib/array/float16' ) ]; + +// VARIABLES // + var opts = { skip: ( typeof Float16Array !== 'function' ) }; + // MAIN // bench( pkg, opts, function benchmark( b ) { From 9cf8ac673d36ab267b289ecf6c4cda468a9053b0 Mon Sep 17 00:00:00 2001 From: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> Date: Mon, 23 Jun 2025 12:26:40 +0530 Subject: [PATCH 10/13] Update main.js Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> --- lib/node_modules/@stdlib/assert/is-float16array/lib/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js index 5007ae6f0b2f..f061f0f426d2 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js @@ -18,7 +18,6 @@ 'use strict'; - // MODULES // var nativeClass = require( '@stdlib/utils/native-class' ); From 34b721ae10f8198740d75bd92dfb0e85245f9672 Mon Sep 17 00:00:00 2001 From: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> Date: Mon, 23 Jun 2025 12:32:40 +0530 Subject: [PATCH 11/13] Update repl.txt Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> --- lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt b/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt index 9f55b6ed22c6..f7d15fd09d62 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt +++ b/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt @@ -1,3 +1,4 @@ + {{alias}}( value ) Tests if a value is a Float16Array. @@ -19,4 +20,5 @@ false See Also - -------- \ No newline at end of file + -------- + From 93e8d5a1c8620e890b1473c79ae78ed303e28370 Mon Sep 17 00:00:00 2001 From: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> Date: Mon, 23 Jun 2025 22:00:59 +0530 Subject: [PATCH 12/13] Update README.md Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> --- lib/node_modules/@stdlib/assert/is-float16array/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/README.md b/lib/node_modules/@stdlib/assert/is-float16array/README.md index e3018efeb316..58294b346a4a 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/README.md +++ b/lib/node_modules/@stdlib/assert/is-float16array/README.md @@ -134,10 +134,6 @@ bool = isFloat16Array( null ); -[mdn-float32array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array - - - [@stdlib/assert/is-float64array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-float64array [@stdlib/assert/is-float32array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-float32array From fa8d23d6e7f47de4e396ad5ef47bf6a866c66297 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 8 Jul 2025 01:00:09 -0700 Subject: [PATCH 13/13] chore: clean-up --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/assert/is-float16array/README.md | 31 +++---------------- .../is-float16array/benchmark/benchmark.js | 10 +++--- .../assert/is-float16array/docs/repl.txt | 5 +-- .../is-float16array/docs/types/index.d.ts | 6 ++-- .../assert/is-float16array/docs/types/test.ts | 3 +- .../assert/is-float16array/examples/index.js | 17 ++-------- .../assert/is-float16array/lib/index.js | 4 +-- .../assert/is-float16array/lib/main.js | 6 ++-- .../assert/is-float16array/test/test.js | 21 +++++-------- 9 files changed, 33 insertions(+), 70 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/is-float16array/README.md b/lib/node_modules/@stdlib/assert/is-float16array/README.md index 58294b346a4a..16b237390334 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/README.md +++ b/lib/node_modules/@stdlib/assert/is-float16array/README.md @@ -34,13 +34,10 @@ var isFloat16Array = require( '@stdlib/assert/is-float16array' ); Tests if a value is a [`Float16Array`][mdn-float16array]. -```javascript -var Float16Array = require( '@stdlib/array/float16' ); - -var bool = isFloat16Array( new Float16Array( 10 ) ); -// returns true + -bool = isFloat16Array( [] ); +```javascript +var bool = isFloat16Array( [] ); // returns false ``` @@ -64,13 +61,9 @@ var Int32Array = require( '@stdlib/array/int32' ); var Uint32Array = require( '@stdlib/array/uint32' ); var Float32Array = require( '@stdlib/array/float32' ); var Float64Array = require( '@stdlib/array/float64' ); -var Float16Array = require( '@stdlib/array/float16' ); var isFloat16Array = require( '@stdlib/assert/is-float16array' ); -var bool = isFloat16Array( new Float16Array( 10 ) ); -// returns true - -bool = isFloat16Array( new Int8Array( 10 ) ); +var bool = isFloat16Array( new Int8Array( 10 ) ); // returns false bool = isFloat16Array( new Uint8Array( 10 ) ); @@ -97,7 +90,7 @@ bool = isFloat16Array( new Float32Array( 10 ) ); bool = isFloat16Array( new Float64Array( 10 ) ); // returns false -bool = isFloat16Array( new Array( 10 ) ); +bool = isFloat16Array( [] ); // returns false bool = isFloat16Array( {} ); @@ -115,13 +108,6 @@ bool = isFloat16Array( null ); @@ -132,13 +118,6 @@ bool = isFloat16Array( null ); [mdn-float16array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float16Array - - -[@stdlib/assert/is-float64array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-float64array -[@stdlib/assert/is-float32array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-float32array - - - diff --git a/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js b/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js index 41182cb247b7..fb7e41407a4c 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/benchmark/benchmark.js @@ -33,26 +33,26 @@ var Float64Array = require( '@stdlib/array/float64' ); var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pkg = require( './../package.json' ).name; var isFloat16Array = require( './../lib' ); -var Float16Array = globalThis[ Symbol.for( '@@stdlib/array/float16' ) ]; // VARIABLES // +// TODO: remove once `array/float16` is added +var Float16Array = ( typeof Float16Array === 'function' ) ? Float16Array : null; // eslint-disable-line no-use-before-define var opts = { - skip: ( typeof Float16Array !== 'function' ) + 'skip': ( Float16Array === null ) }; // MAIN // -bench( pkg, opts, function benchmark( b ) { +bench( pkg, function benchmark( b ) { var values; var bool; var i; values = [ new Float64Array( 10 ), - new Float16Array( 10 ), new Float32Array( 10 ), new Int32Array( 10 ), new Uint32Array( 10 ), @@ -103,7 +103,7 @@ bench( pkg+'::true', opts, function benchmark( b ) { b.end(); }); -bench( pkg+'::false', opts, function benchmark( b ) { +bench( pkg+'::false', function benchmark( b ) { var values; var bool; var i; diff --git a/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt b/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt index f7d15fd09d62..824930703e02 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt +++ b/lib/node_modules/@stdlib/assert/is-float16array/docs/repl.txt @@ -14,8 +14,9 @@ Examples -------- - > var bool = {{alias}}( new {{alias:@stdlib/array/float16}}( 10 ) ) - true + // TODO: update to use `array/float16` once added + > var bool = {{alias}}( new {{alias:@stdlib/array/float32}}( 10 ) ) + false > bool = {{alias}}( [] ) false diff --git a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts index c14fe1cd8563..9706f9090c64 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/index.d.ts @@ -18,8 +18,6 @@ // TypeScript Version: 4.1 -import Float16Array = require( '@stdlib/array/float16' ); - /** * Tests if a value is a Float16Array. * @@ -27,6 +25,7 @@ import Float16Array = require( '@stdlib/array/float16' ); * @returns boolean indicating whether value is a Float16Array * * @example +* var Float16Array = require( '@stdlib/array/float16' ); * * var bool = isFloat16Array( new Float16Array( 10 ) ); * // returns true @@ -35,7 +34,8 @@ import Float16Array = require( '@stdlib/array/float16' ); * var bool = isFloat16Array( [] ); * // returns false */ -declare function isFloat16Array( value: any ): value is Float16Array; +declare function isFloat16Array( value: any ): boolean; // TODO: replace with `value is Float16Array` once `array/float16` added + // EXPORTS // diff --git a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts index 5675a3d69a30..1f8ddf65f9dc 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts +++ b/lib/node_modules/@stdlib/assert/is-float16array/docs/types/test.ts @@ -23,12 +23,11 @@ import isFloat16Array = require( './index' ); // The function returns a boolean... { - isFloat16Array( new Float16Array( 10 ) ); // $ExpectType boolean isFloat16Array( [] ); // $ExpectType boolean } // The compiler throws an error if the function is provided an unsupported number of arguments... { isFloat16Array(); // $ExpectError - isFloat16Array( new Float16Array( 10 ), 123 ); // $ExpectError + isFloat16Array( [], 123 ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js b/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js index 92a135dbf2f8..6a4224cc9ed1 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/examples/index.js @@ -27,22 +27,11 @@ var Int32Array = require( '@stdlib/array/int32' ); var Uint32Array = require( '@stdlib/array/uint32' ); var Float32Array = require( '@stdlib/array/float32' ); var Float64Array = require( '@stdlib/array/float64' ); -var Float16Array; var isFloat16Array = require( './../lib' ); +// TODO: add example with Float16Array once `array/float16` is added -try { - Float16Array = require( '@stdlib/array/float16' ); -} catch (err) { - console.log( 'Float16Array is not available in this environment. Skipping all tests.' ); - process.exit(0); -} - -var bool = isFloat16Array( new Float16Array( 10 ) ); -console.log( bool ); -// => true - -bool = isFloat16Array( new Int8Array( 10 ) ); +var bool = isFloat16Array( new Int8Array( 10 ) ); console.log( bool ); // => false @@ -78,7 +67,7 @@ bool = isFloat16Array( new Float64Array( 10 ) ); console.log( bool ); // => false -bool = isFloat16Array( new Array( 10 ) ); +bool = isFloat16Array( [] ); console.log( bool ); // => false diff --git a/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js b/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js index 0d17a27a22c0..d7b41e8c959c 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/lib/index.js @@ -24,10 +24,10 @@ * @module @stdlib/assert/is-float16array * * @example +* var Float16Array = require( '@stdlib/array/float16' ); * var isFloat16Array = require( '@stdlib/assert/is-float16array' ); * -* var value = new Float16rray( 2 ); -* var bool = isFloat16Array( value ); +* var bool = isFloat16Array( new Float16Array( 10 ) ); * // returns true * * bool = isFloat16Array( [] ); diff --git a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js index f061f0f426d2..c38ae627bc6a 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/lib/main.js @@ -16,6 +16,8 @@ * limitations under the License. */ +/* eslint-disable no-undef, stdlib/jsdoc-doctest */ // TODO: remove once `array/float16` added; consider refactoring similar to `assert/is-complex128array` + 'use strict'; // MODULES // @@ -38,12 +40,12 @@ var hasFloat16Array = ( typeof Float16Array === 'function' ); * * @example * var Float16Array = require( '@stdlib/array/float16' ); -* var isFloat16Array = require( '@stdlib/assert/is-float16array' ); * * var bool = isFloat16Array( new Float16Array( 10 ) ); * // returns true * -* bool = isFloat16Array( [] ); +* @example +* var bool = isFloat16Array( [] ); * // returns false */ function isFloat16Array( value ) { diff --git a/lib/node_modules/@stdlib/assert/is-float16array/test/test.js b/lib/node_modules/@stdlib/assert/is-float16array/test/test.js index 605879ad682c..026b5b4dd334 100644 --- a/lib/node_modules/@stdlib/assert/is-float16array/test/test.js +++ b/lib/node_modules/@stdlib/assert/is-float16array/test/test.js @@ -33,13 +33,6 @@ var Float64Array = require( '@stdlib/array/float64' ); var isFloat16Array = require( './../lib' ); -// OPTIONS // - -var opts = { - 'skip': ( typeof Float16Array === 'undefined' ) -}; - - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,13 +41,13 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function returns `true` if provided a Float16Array', opts, function test( t ) { - t.strictEqual( isFloat16Array( new Float16Array( 10 ) ), true, 'returns true' ); - t.end(); -}); +// TODO: add positive assertion test once `array/float16` is added tape( 'the function returns `false` if not provided a Float16Array', function test( t ) { - var values = [ + var values; + var i; + + values = [ '5', 5, NaN, @@ -64,7 +57,7 @@ tape( 'the function returns `false` if not provided a Float16Array', function te [], {}, function noop() {}, - new Array( 10 ), + [], new Float64Array( 10 ), new Uint32Array( 10 ), new Int32Array( 10 ), @@ -76,7 +69,7 @@ tape( 'the function returns `false` if not provided a Float16Array', function te new Float32Array( 10 ) ]; - for ( var i = 0; i < values.length; i++ ) { + for ( i = 0; i < values.length; i++ ) { t.strictEqual( isFloat16Array( values[i] ), false, 'returns false when provided ' + values[i] ); } t.end();