Skip to content

feat: add assert/is-float16array #7273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

udaykakade25
Copy link
Contributor

Resolves {https://github.com/stdlib-js/google-summer-of-code/issues/94}

Description

What is the purpose of this pull request?

This pull request:

  • Add 'assert/is-float16array`

Related Issues

Does this pull request have any related issues?

This pull request:

  • resolves itself

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jun 8, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Jun 8, 2025

Coverage Report

Package Statements Branches Functions Lines
assert/is-float16array $\color{green}104/104$
$\color{green}+100.00\%$
$\color{red}3/4$
$\color{green}+75.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}104/104$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this PR.


<!-- <related-links> -->

[@stdlib/assert/is-float64array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-float64array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[@stdlib/assert/is-float64array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-float64array
[@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

bool = isFloat16Array( new Float64Array( 10 ) );
// returns false

bool = isFloat16Array( new Array( 10 ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line causes the lint error, I am not sure with the solution, maybe removing this be a option, maybe there be a better option, not sure about it.

@ShabiShett07
Copy link
Contributor

/stdlib update-copyright-years

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Jun 8, 2025
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Jun 8, 2025
Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com>
@udaykakade25
Copy link
Contributor Author

Hello @kgryte sir,
Here's assert/is-float16array.
As per your directions, I skipped test cases for test/test.js, examples/index.js, and benchmark/bechmark.js that require float16.
Can you take a look at docs/types? I think the rest is implemented correctly.

// MODULES //

var nativeClass = require( '@stdlib/utils/native-class' );

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

* @returns {boolean} boolean indicating whether value is a Float16Array
*
* @example
* var Float16Array = require( '@stdlib/array/float16/lib/polyfill.js' );
Copy link
Member

@Planeshifter Planeshifter Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to avoid loading internals of a package. Can we do var Float16Array = require( '@stdlib/array/float16' ) here?

Comment on lines 33 to 41
var isFloat16Array = require( './../lib' );

// OPTIONS //

var opts = {
'skip': ( typeof Float16Array === 'undefined' )
};

// TESTS //
Copy link
Member

@Planeshifter Planeshifter Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want two empty lines before header:

Suggested change
var isFloat16Array = require( './../lib' );
// OPTIONS //
var opts = {
'skip': ( typeof Float16Array === 'undefined' )
};
// TESTS //
var isFloat16Array = require( './../lib' );
// VARIABLES //
var opts = {
'skip': ( typeof Float16Array === 'undefined' )
};
// TESTS //

Comment on lines +36 to +42
var Float16Array = globalThis[ Symbol.for( '@@stdlib/array/float16' ) ];

var opts = {
skip: ( typeof Float16Array !== 'function' )
};

// MAIN //
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var Float16Array = globalThis[ Symbol.for( '@@stdlib/array/float16' ) ];
var opts = {
skip: ( typeof Float16Array !== 'function' )
};
// MAIN //
var Float16Array = globalThis[ Symbol.for( '@@stdlib/array/float16' ) ];
// VARIABLES //
var opts = {
skip: ( typeof Float16Array !== 'function' )
};
// MAIN //

…' in main.js

Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com>
Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com>
Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review A pull request which needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants